Skip to content

Commit 415aaaa

Browse files
authored
fix review feedback on signing example and CI node version
1 parent b40da9f commit 415aaaa

8 files changed

Lines changed: 15 additions & 11 deletions

File tree

.agents/skills/building-with-hypercerts-lexicons/SKILL.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,14 @@ const cidBytes = cid.bytes; // 36 bytes: 0x01 0x71 0x12 0x20 + 32-byte hash
556556
// 4. ECDSA-sign the CID bytes. Keypair.sign() applies the standard
557557
// ECDSA hash-then-sign convention and enforces low-S per BIP-0062.
558558
const keypair = await Secp256k1Keypair.create({ exportable: false });
559+
const signerDid = keypair.did();
560+
const signerKey = `${signerDid}#${signerDid.slice("did:key:".length)}`;
559561
const signatureBytes = await keypair.sign(cidBytes);
560562

561563
const inlineSignature = {
562564
$type: "app.certified.signature.defs#inline" as const,
563565
signature: signatureBytes,
564-
key: `${platformDid}#signing`, // DID verification method reference
566+
key: signerKey, // DID verification method reference for the keypair above
565567
};
566568
```
567569

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup Node.js
1717
uses: actions/setup-node@v6
1818
with:
19-
node-version: "20"
19+
node-version: "22"
2020
cache: "npm"
2121

2222
- name: Install dependencies

.github/workflows/pr-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fetch-depth: 0
1414
- uses: actions/setup-node@v6
1515
with:
16-
node-version: 20
16+
node-version: 22
1717
cache: "npm"
1818
- run: npm ci
1919
- name: Check for changeset

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
4949
- uses: actions/setup-node@v6
5050
with:
51-
node-version: 20
51+
node-version: 22
5252
cache: "npm"
5353
# registry-url is required for npm Trusted Publishers
5454
registry-url: "https://registry.npmjs.org"

.github/workflows/style.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup Node.js
1717
uses: actions/setup-node@v6
1818
with:
19-
node-version: "20"
19+
node-version: "22"
2020
cache: "npm"
2121

2222
- name: Install dependencies

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup Node.js
1717
uses: actions/setup-node@v6
1818
with:
19-
node-version: "20"
19+
node-version: "22"
2020
cache: "npm"
2121

2222
- name: Install dependencies

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,12 +640,14 @@ const cidBytes = cid.bytes; // 36 bytes: 0x01 0x71 0x12 0x20 + 32-byte hash
640640
// 4. ECDSA-sign the CID bytes. Keypair.sign() applies the standard
641641
// ECDSA hash-then-sign convention and enforces low-S per BIP-0062.
642642
const keypair = await Secp256k1Keypair.create({ exportable: false });
643+
const signerDid = keypair.did();
644+
const signerKey = `${signerDid}#${signerDid.slice("did:key:".length)}`;
643645
const signatureBytes = await keypair.sign(cidBytes);
644646

645647
const inlineSignature = {
646648
$type: "app.certified.signature.defs#inline" as const,
647649
signature: signatureBytes,
648-
key: `${platformDid}#signing`, // DID verification method reference
650+
key: signerKey, // DID verification method reference for the keypair above
649651
};
650652
```
651653

tests/validate-signing-example.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { verifySignature } from "@atproto/crypto";
2626
import * as Activity from "../generated/types/org/hypercerts/claim/activity.js";
2727

2828
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
29-
const EXTRACT_DIR = resolve(ROOT, "tests/extracted");
29+
const EXTRACT_DIR = resolve(ROOT, "tmp/extracted-signing-examples");
3030

3131
interface ExtractedExample {
3232
signedActivity: { signatures: unknown[] };
@@ -206,7 +206,7 @@ for (const [label, relPath, basename] of SOURCES) {
206206
expect(example.inlineSignature.$type).toBe(
207207
"app.certified.signature.defs#inline",
208208
);
209-
expect(example.inlineSignature.signature).toBe(example.signatureBytes);
209+
expect(example.inlineSignature.signature).toEqual(example.signatureBytes);
210210
expect(example.inlineSignature.key).toMatch(/^did:[^:]+:.+#.+$/);
211211
});
212212

@@ -219,10 +219,10 @@ for (const [label, relPath, basename] of SOURCES) {
219219

220220
it("attaches both signatures to the final record", () => {
221221
expect(example.signedActivity.signatures).toHaveLength(2);
222-
expect(example.signedActivity.signatures[0]).toBe(
222+
expect(example.signedActivity.signatures[0]).toEqual(
223223
example.inlineSignature,
224224
);
225-
expect(example.signedActivity.signatures[1]).toBe(
225+
expect(example.signedActivity.signatures[1]).toEqual(
226226
example.remoteAttestation,
227227
);
228228
});

0 commit comments

Comments
 (0)