Skip to content

Commit ec4c3e1

Browse files
committed
Align ENS verification docs and clarify commons version export
1 parent 0bb1b5b commit ec4c3e1

File tree

2 files changed

+57
-4
lines changed

2 files changed

+57
-4
lines changed

README.md

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,63 @@ verifyReceipt(receipt, {
139139

140140
```ts
141141
verifyReceipt(receipt, {
142-
ens: true,
143-
rpcUrl: "https://mainnet.infura.io/v3/..."
142+
ens: {
143+
name: "runtime.commandlayer.eth",
144+
rpcUrl: "https://mainnet.infura.io/v3/..."
145+
}
146+
});
147+
```
148+
149+
ENS verification resolves signer material using this TXT record chain:
150+
151+
- Agent/issuer ENS name TXT `cl.receipt.signer` => signer ENS name
152+
- Signer ENS name TXT `cl.sig.pub` and `cl.sig.kid` => Ed25519 public key metadata
153+
154+
To verify receipts issued by the runtime signer, set `ens.name` to the issuer/agent name that contains `cl.receipt.signer`. If using `runtime.commandlayer.eth` as the agent name, set `cl.receipt.signer` on `runtime.commandlayer.eth` to point to itself.
155+
156+
### Verification (Working Example)
157+
158+
```ts
159+
import { createClient } from "@commandlayer/sdk";
160+
import { verifyReceipt } from "@commandlayer/sdk";
161+
162+
const client = createClient({
163+
actor: "my-app",
164+
verifyReceipts: true,
165+
verify: {
166+
ens: {
167+
name: "runtime.commandlayer.eth",
168+
rpcUrl: process.env.MAINNET_RPC!
169+
}
170+
}
171+
});
172+
173+
const receipt = await client.summarize({ content: "hello", style: "bullet_points" });
174+
// if verifyReceipts true, client methods should throw or return verify result depending on your design
175+
// also show direct call:
176+
const vr = await verifyReceipt(receipt, {
177+
ens: { name: "runtime.commandlayer.eth", rpcUrl: process.env.MAINNET_RPC! }
144178
});
179+
console.log(vr.ok, vr.checks);
145180
```
146181

147-
This resolves the signer’s public key from ENS (`cl.receipt.pubkey_*` TXT record).
182+
### ENS Setup
183+
184+
For `runtime.commandlayer.eth` as the signer identity:
185+
186+
- Existing TXT records on `runtime.commandlayer.eth`:
187+
- `cl.sig.kid = v1`
188+
- `cl.sig.pub = ed25519:CEHI9g4...`
189+
- Add one additional TXT record on `runtime.commandlayer.eth`:
190+
- `cl.receipt.signer = runtime.commandlayer.eth`
191+
192+
This makes `runtime.commandlayer.eth` self-describing for ENS verification, so the SDK can resolve `cl.receipt.signer` and then fetch `cl.sig.pub`/`cl.sig.kid` from the same name.
193+
194+
Optional future pattern:
195+
196+
- If each issuer/agent ENS name (for example, `summarizeagent.eth`) should verify through its own lookup, add:
197+
- `cl.receipt.signer = runtime.commandlayer.eth`
198+
on each issuer/agent ENS name, while keeping signing keys only on `runtime.commandlayer.eth`.
148199

149200
---
150201

typescript-sdk/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import nacl from "tweetnacl";
1515
* Node-only. (Uses node:crypto). For browser support, swap sha256 to noble + conditional exports.
1616
*/
1717

18-
export const version = "1.0.0";
18+
export const commonsVersion = "1.0.0";
19+
/** @deprecated Use commonsVersion. */
20+
export const version = commonsVersion;
1921

2022
// -----------------------
2123
// Types

0 commit comments

Comments
 (0)