@signet-registry/operator 0.1.5 → 0.1.6

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.
@@ -1,4 +1,4 @@
1
- import { createHash, generateKeyPairSync, sign as signBytes } from 'node:crypto';
1
+ import { createHash, createPublicKey, generateKeyPairSync, sign as signBytes } from 'node:crypto';
2
2
  import { readFile } from 'node:fs/promises';
3
3
  import { z } from 'zod';
4
4
  export const TransparencySampleGraphSpecSchema = z.object({
@@ -81,7 +81,7 @@ export async function seedTransparencySampleGraph(api, apiToken, input = {}) {
81
81
  {
82
82
  signer: spec.logId,
83
83
  detachedSignature: checkpointSigTwo,
84
- keyHintBytes: [0, 0, 0, 1],
84
+ keyHintBytes: specKeyHint(spec.logId, checkpointKey),
85
85
  },
86
86
  {
87
87
  signer: spec.signerName,
@@ -108,7 +108,9 @@ export async function seedTransparencySampleGraph(api, apiToken, input = {}) {
108
108
  const rootTwoAlt = `base64:${nodeHash(leafOne, leafTwoAlt).toString('base64')}`;
109
109
  const checkpointBodyTwoAlt = checkpointBody(spec.logId, 2, rootTwoAlt);
110
110
  const checkpointSigTwoAlt = encodeSignature(checkpointBodyTwoAlt, checkpointKey);
111
- const checkpointTwoAltNote = signedCheckpointNote(checkpointBodyTwoAlt, checkpointSigTwoAlt);
111
+ const checkpointTwoAltNote = signedCheckpointNote(checkpointBodyTwoAlt, [
112
+ { signer: spec.logId, detachedSignature: checkpointSigTwoAlt, keyHintBytes: specKeyHint(spec.logId, checkpointKey) },
113
+ ]);
112
114
  await api.createTransparencyObservation(spec.logId, {
113
115
  signed_note: checkpointTwoAltNote,
114
116
  observed_from_type: 'peer',
@@ -198,6 +200,16 @@ function signedCheckpointNote(body, signatures) {
198
200
  });
199
201
  return `${body}\n${signatureLines.join('\n')}\n`;
200
202
  }
203
+ /**
204
+ * Spec note-key hint (bigendian32(SHA256(origin + "\n" + 0x01||pubkey))[:4]).
205
+ * The registry's checkpoint seam enforces it for Ed25519 trusted keys, so
206
+ * seeded signed notes must bind to the log's key identity.
207
+ */
208
+ function specKeyHint(origin, privateKey) {
209
+ const publicDer = createPublicKey(privateKey).export({ type: 'spki', format: 'der' });
210
+ const keyData = Buffer.concat([Buffer.from([0x01]), publicDer.subarray(publicDer.length - 32)]);
211
+ return [...createHash('sha256').update(origin).update('\n').update(keyData).digest().subarray(0, 4)];
212
+ }
201
213
  function sha256Hex(bytes) {
202
214
  return createHash('sha256').update(bytes).digest('hex');
203
215
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signet-registry/operator",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Operator/assistant CLI for the Signet registry: bootstrap, seed, and verify agents and skills.",
5
5
  "license": "BSD-3-Clause",
6
6
  "contributors": [