@sheaf-labs/kya 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/kya.mjs +4 -4
- package/package.json +1 -1
package/bin/kya.mjs
CHANGED
|
@@ -18,7 +18,7 @@ const AGENTS = pathJoin(HOME, "agents");
|
|
|
18
18
|
const B58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
19
19
|
const b58 = bytes => { let n = BigInt("0x" + Buffer.from(bytes).toString("hex")), s = ""; while (n > 0n) { s = B58[Number(n % 58n)] + s; n /= 58n; } for (const b of bytes) { if (b !== 0) break; s = "1" + s; } return s; };
|
|
20
20
|
const canonical = v => Array.isArray(v) ? "[" + v.map(canonical).join(",") + "]"
|
|
21
|
-
: v && typeof v === "object" ? "{" + Object.keys(v).sort().map(k => JSON.stringify(k) + ":" + canonical(v[k])).join(",") + "}"
|
|
21
|
+
: v && typeof v === "object" ? "{" + Object.keys(v).filter(k => v[k] !== undefined).sort().map(k => JSON.stringify(k) + ":" + canonical(v[k])).join(",") + "}"
|
|
22
22
|
: JSON.stringify(v);
|
|
23
23
|
const sha256 = buf => createHash("sha256").update(buf).digest();
|
|
24
24
|
const pubOf = priv => Buffer.from(createPrivateKey(priv).export({ format: "jwk" }).x, "base64url");
|
|
@@ -199,10 +199,10 @@ async function verify() {
|
|
|
199
199
|
const o = owner(); const domain = rest[0];
|
|
200
200
|
if (!domain) die("kya verify <domain>: the domain you control, for example acme.example");
|
|
201
201
|
const r = await post("/api/v1/register/owners/verify", signed(o.key, { type: "traceable-verify", owner: didOf(o.key), domain, at: now() }));
|
|
202
|
-
const
|
|
202
|
+
const d = (r.verification || {}).domain || {}; const rec = d.record || {}; const file = d.file || {};
|
|
203
203
|
out(`Claimed ${domain}. Put this where only the domain's controller can:`);
|
|
204
|
-
out(` DNS: _traceableagents
|
|
205
|
-
out(` or: https
|
|
204
|
+
out(` DNS: ${rec.name || "_traceableagents." + domain} TXT "${rec.value || ""}"`);
|
|
205
|
+
out(` or: ${file.url || "https://" + domain + "/.well-known/traceable-agents.txt"} containing the line ${file.content || rec.value || ""}`);
|
|
206
206
|
out(`Then run: kya verify-check`);
|
|
207
207
|
if (flags.json) out(r);
|
|
208
208
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheaf-labs/kya",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Know Your Agent. Put an AI agent on the Register of Traceable Agents, prove who it is, write its record, and check other agents before dealing with them.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": { "kya": "bin/kya.mjs" },
|