diff --git a/examples/agent-loop/agent.mjs b/examples/agent-loop/agent.mjs index f460bac..a68f5bd 100644 --- a/examples/agent-loop/agent.mjs +++ b/examples/agent-loop/agent.mjs @@ -28,7 +28,8 @@ async function generateNames(brief, count) { } async function verifyEtymolt(name) { - const r = await fetch("https://api.etymolt.com/v1/verify", { + const BASE = process.env.ETYMOLT_BASE_URL || "https://api.etymolt.com"; + const r = await fetch(`${BASE}/v1/verify`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ name }), diff --git a/examples/namelix-postcheck/postcheck.mjs b/examples/namelix-postcheck/postcheck.mjs index 6eed175..93808c9 100644 --- a/examples/namelix-postcheck/postcheck.mjs +++ b/examples/namelix-postcheck/postcheck.mjs @@ -14,7 +14,8 @@ if (!Array.isArray(candidates)) { const verdicts = await Promise.all( candidates.map(async (name) => { - const r = await fetch("https://api.etymolt.com/v1/verify", { + const BASE = process.env.ETYMOLT_BASE_URL || "https://api.etymolt.com"; + const r = await fetch(`${BASE}/v1/verify`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ name }), diff --git a/examples/react-render/verify-signature.mjs b/examples/react-render/verify-signature.mjs index 14872cb..b9cddd0 100644 --- a/examples/react-render/verify-signature.mjs +++ b/examples/react-render/verify-signature.mjs @@ -9,7 +9,8 @@ import { sign } from "tweetnacl"; import { decodeBase64 } from "tweetnacl-util"; import canonicalize from "canonicalize"; -export async function verifyVerdict(verdict, jwksUrl = "https://api.etymolt.com/.well-known/evp-keys.json") { +const BASE = process.env.ETYMOLT_BASE_URL || "https://api.etymolt.com"; +export async function verifyVerdict(verdict, jwksUrl = `${BASE}/.well-known/evp-keys.json`) { const { signature, signature_key_id, signature_payload_digest, ...payload } = verdict; const canonical = canonicalize(payload); const message = new TextEncoder().encode(canonical); diff --git a/examples/verify-single-name/verify.mjs b/examples/verify-single-name/verify.mjs index e14fe6b..30d2d35 100644 --- a/examples/verify-single-name/verify.mjs +++ b/examples/verify-single-name/verify.mjs @@ -8,7 +8,8 @@ if (!name) { process.exit(1); } -const response = await fetch("https://api.etymolt.com/v1/verify", { +const BASE = process.env.ETYMOLT_BASE_URL || "https://api.etymolt.com"; +const response = await fetch(`${BASE}/v1/verify`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ name }), diff --git a/examples/watch-loop/watch.mjs b/examples/watch-loop/watch.mjs index e39d78c..36b08a9 100644 --- a/examples/watch-loop/watch.mjs +++ b/examples/watch-loop/watch.mjs @@ -17,7 +17,8 @@ if (!name || !webhook) { const stateFile = `.watch-${name}.json`; while (true) { - const r = await fetch("https://api.etymolt.com/v1/verify", { + const BASE = process.env.ETYMOLT_BASE_URL || "https://api.etymolt.com"; + const r = await fetch(`${BASE}/v1/verify`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ name }),