@metalabel/dfos-protocol 0.50.0 → 0.52.0

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.
@@ -6,16 +6,16 @@ import {
6
6
  matchesResource,
7
7
  verifyDFOSCredential,
8
8
  verifyDelegationChain
9
- } from "./chunk-MHSBBYDO.js";
9
+ } from "./chunk-IV3TIYKP.js";
10
10
  import {
11
11
  KEY_ADD_JWS_TYP,
12
12
  KEY_ROLES,
13
13
  unsafeKeyProofSubject,
14
14
  verifyChainKeyProof
15
- } from "./chunk-JVSC67DC.js";
15
+ } from "./chunk-QRCOMLAP.js";
16
16
  import {
17
- decodeMultikey
18
- } from "./chunk-IDVYITX7.js";
17
+ decodeEd25519PublicMultikey
18
+ } from "./chunk-F7RHI2CK.js";
19
19
  import {
20
20
  assertJwsProfile,
21
21
  base64urlDecode,
@@ -25,13 +25,13 @@ import {
25
25
  decodeJwsUnsafe,
26
26
  generateIdNoPrefix,
27
27
  verifyJws
28
- } from "./chunk-4LG2GEB2.js";
28
+ } from "./chunk-QTJZGXMH.js";
29
29
 
30
30
  // src/chain/schemas.ts
31
31
  import { z } from "zod";
32
32
  var MAX_KEYS_PER_ROLE = 256;
33
33
  var MAX_KEY_PROOFS = 256;
34
- var MAX_RELATION = 64;
34
+ var MAX_RELATION_BYTES = 64;
35
35
  var MAX_SERVICES_ENTRIES = 256;
36
36
  var MAX_SERVICES_PAYLOAD_SIZE = 32768;
37
37
  var MAX_OPERATION_SIZE = 65536;
@@ -78,7 +78,7 @@ var parseProtocolTimestampUnix = (value) => {
78
78
  const ms = Date.parse(value);
79
79
  return Number.isFinite(ms) ? Math.floor(ms / 1e3) : null;
80
80
  };
81
- var CIDString = z.string();
81
+ var CIDString = z.string().min(1, "CID must not be empty");
82
82
  var IdentityCreate = z.looseObject({
83
83
  version: z.literal(1),
84
84
  type: z.literal("create"),
@@ -102,7 +102,7 @@ var IdentityUpdate = z.looseObject({
102
102
  createdAt: Iso8601,
103
103
  /**
104
104
  * POSSESSION PROOFS FOR THE KEYS THIS OPERATION INTRODUCES — compact key-proof
105
- * JWS strings (specs/KEY-PROOF.md), each signed by the key it speaks for.
105
+ * JWS strings (specs/PROTOCOL.md § Key possession), each signed by the key it speaks for.
106
106
  *
107
107
  * Optional, and optional in the CID-neutral sense: omitting it encodes
108
108
  * identically to an operation that never had it (undefined strips under
@@ -188,7 +188,31 @@ var VerifiedIdentity = z.strictObject({
188
188
  * re-deriving it from the raw log under a declared-state rule that quietly
189
189
  * disagrees with this one.
190
190
  */
191
- provedKeys: DeclaredKeyState.optional()
191
+ provedKeys: DeclaredKeyState.optional(),
192
+ /**
193
+ * HAS-EVER-BEEN-DECLARED, as a key-id-to-material binding: one entry per key
194
+ * id the chain has ever written, carrying the Multikey that id went in with,
195
+ * in the order the walk first saw it.
196
+ *
197
+ * A KEY ID IS BOUND TO ONE KEY FOR THE LIFE OF A CHAIN. The full walk enforces
198
+ * that chain-wide and rejects the operation that breaks it — the id is a
199
+ * stable name, so re-pointing it at new material would silently re-aim every
200
+ * artifact that ever referenced it. The incremental extension verifier has no
201
+ * log to re-scan, so it needs the binding handed to it, and this member is how
202
+ * it arrives: with it, the fast path returns the SAME verdict as a full replay
203
+ * on the same operation, which is the property that keeps a relay's linear
204
+ * path from accepting a chain its own re-verification would refuse.
205
+ *
206
+ * Broader than `declared` and than `provedKeys` on purpose. The rule covers
207
+ * every id the chain wrote, including one declared into a void membership and
208
+ * later dropped — neither of the other two members remembers that id, and it
209
+ * is exactly the id an attacker would reuse.
210
+ *
211
+ * Optional because a caller may hand the extension verifier a hand-built or
212
+ * older state. Absent, the binding is read off `declared` and `provedKeys`,
213
+ * which is complete for any chain that never dropped an unproved key id.
214
+ */
215
+ seenKeys: z.array(MultikeyPublicKey).optional()
192
216
  });
193
217
  var ContentCreate = z.looseObject({
194
218
  version: z.literal(1),
@@ -237,7 +261,9 @@ var CountersignPayload = z.looseObject({
237
261
  type: z.literal("countersign"),
238
262
  did: z.string(),
239
263
  targetCID: CIDString,
240
- relation: z.string().min(1).max(MAX_RELATION).optional(),
264
+ relation: z.string().min(1).refine((value) => new TextEncoder().encode(value).length <= MAX_RELATION_BYTES, {
265
+ message: `relation exceeds ${MAX_RELATION_BYTES} bytes`
266
+ }).optional(),
241
267
  createdAt: Iso8601
242
268
  });
243
269
  var RevocationPayload = z.looseObject({
@@ -333,7 +359,9 @@ var unionProved = (into, next) => {
333
359
  return merged;
334
360
  };
335
361
  var foldEffectiveKeyState = (input) => {
336
- const carried = (role, key) => input.priorEffective[ROLE_ARRAY[role]].some((prior) => prior.id === key.id);
362
+ const carried = (role, key) => input.priorEffective[ROLE_ARRAY[role]].some(
363
+ (prior) => prior.id === key.id && prior.type === key.type && prior.publicKeyMultibase === key.publicKeyMultibase
364
+ );
337
365
  const introduced = /* @__PURE__ */ new Map();
338
366
  for (const role of KEY_ROLES) {
339
367
  for (const key of input.declared[ROLE_ARRAY[role]]) {
@@ -379,6 +407,26 @@ var foldEffectiveKeyState = (input) => {
379
407
  }
380
408
  return { effective, voidKeys };
381
409
  };
410
+ var admitKeyMaterial = (index, keys) => {
411
+ for (const key of keys) {
412
+ const existing = index.get(key.id);
413
+ if (!existing) {
414
+ index.set(key.id, key);
415
+ } else if (existing.publicKeyMultibase !== key.publicKeyMultibase || existing.type !== key.type) {
416
+ throw new Error(`key ${key.id} type or public key inconsistency`);
417
+ }
418
+ }
419
+ };
420
+ var keyMaterialIndex = (keys) => {
421
+ const index = /* @__PURE__ */ new Map();
422
+ for (const key of keys) if (!index.has(key.id)) index.set(key.id, key);
423
+ return index;
424
+ };
425
+ var flatKeys = (state) => [
426
+ ...state.authKeys,
427
+ ...state.assertKeys,
428
+ ...state.controllerKeys
429
+ ];
382
430
  var assertSingleKeyGenesis = (op) => {
383
431
  if (op.authKeys.length !== 1 || op.assertKeys.length !== 1 || op.controllerKeys.length !== 1) {
384
432
  throw new Error("create must declare exactly one key in each of auth, assert and controller");
@@ -407,6 +455,7 @@ var signIdentityOperation = async (input) => {
407
455
  };
408
456
  var verifyIdentityChain = async (input) => {
409
457
  if (input.log.length === 0) throw new Error("log must have at least one operation");
458
+ if (input.asOf === "") throw new Error("basis must not be empty");
410
459
  const state = {
411
460
  did: void 0,
412
461
  isDeleted: false,
@@ -422,6 +471,7 @@ var verifyIdentityChain = async (input) => {
422
471
  services: [],
423
472
  seenKeys: /* @__PURE__ */ new Map()
424
473
  };
474
+ let asOfState;
425
475
  for (const [idx, jwsToken] of input.log.entries()) {
426
476
  const decoded = decodeJwsUnsafe(jwsToken);
427
477
  if (!decoded) throw new Error(`log[${idx}]: failed to decode JWS`);
@@ -472,19 +522,15 @@ var verifyIdentityChain = async (input) => {
472
522
  }
473
523
  }
474
524
  if (op.type === "create" || op.type === "update") {
475
- const incomingKeys = [...op.authKeys, ...op.assertKeys, ...op.controllerKeys];
476
- const currentKeys = [
477
- ...state.declared.authKeys,
478
- ...state.declared.assertKeys,
479
- ...state.declared.controllerKeys
480
- ];
481
- for (const k of [...currentKeys, ...incomingKeys]) {
482
- const existing = state.seenKeys.get(k.id);
483
- if (!existing) {
484
- state.seenKeys.set(k.id, k);
485
- } else if (existing.publicKeyMultibase !== k.publicKeyMultibase || existing.type !== k.type) {
486
- throw new Error(`log[${idx}]: key ${k.id} type or public key inconsistency`);
487
- }
525
+ try {
526
+ admitKeyMaterial(state.seenKeys, [
527
+ ...flatKeys(state.declared),
528
+ ...op.authKeys,
529
+ ...op.assertKeys,
530
+ ...op.controllerKeys
531
+ ]);
532
+ } catch (e) {
533
+ throw new Error(`log[${idx}]: ${e.message}`);
488
534
  }
489
535
  [op.authKeys, op.assertKeys, op.controllerKeys].forEach((keys) => {
490
536
  const set = new Set(keys.map((k) => k.id));
@@ -500,7 +546,7 @@ var verifyIdentityChain = async (input) => {
500
546
  }
501
547
  }
502
548
  }
503
- const encoded = await dagCborCanonicalEncode(op);
549
+ const encoded = await dagCborCanonicalEncode(decoded.payload);
504
550
  if (encoded.bytes.length > MAX_OPERATION_SIZE) {
505
551
  throw new Error(
506
552
  `log[${idx}]: operation exceeds max size: ${encoded.bytes.length} > ${MAX_OPERATION_SIZE}`
@@ -531,7 +577,7 @@ var verifyIdentityChain = async (input) => {
531
577
  if (!signingKey) {
532
578
  throw new Error(`log[${idx}]: kid references unknown key: ${signingKeyId}`);
533
579
  }
534
- const { keyBytes } = decodeMultikey(signingKey.publicKeyMultibase);
580
+ const keyBytes = decodeEd25519PublicMultikey(signingKey.publicKeyMultibase);
535
581
  try {
536
582
  verifyJws({ token: jwsToken, publicKey: keyBytes });
537
583
  } catch {
@@ -578,8 +624,26 @@ var verifyIdentityChain = async (input) => {
578
624
  state.isDeleted = false;
579
625
  break;
580
626
  }
627
+ if (input.asOf !== void 0 && op.createdAt <= input.asOf) {
628
+ asOfState = {
629
+ did,
630
+ isDeleted: state.isDeleted,
631
+ authKeys: state.effective.authKeys,
632
+ assertKeys: state.effective.assertKeys,
633
+ controllerKeys: state.effective.controllerKeys,
634
+ services: state.services,
635
+ declared: state.declared,
636
+ voidKeys: state.voidKeys,
637
+ provedKeys: state.provedKeys,
638
+ seenKeys: [...state.seenKeys.values()]
639
+ };
640
+ }
581
641
  }
582
642
  if (!state.did) throw new Error("did is not set");
643
+ if (input.asOf !== void 0) {
644
+ if (!asOfState) throw new Error(`identity has no state as of ${input.asOf}`);
645
+ return asOfState;
646
+ }
583
647
  return {
584
648
  did: state.did,
585
649
  isDeleted: state.isDeleted,
@@ -590,7 +654,10 @@ var verifyIdentityChain = async (input) => {
590
654
  services: state.services,
591
655
  declared: state.declared,
592
656
  voidKeys: state.voidKeys,
593
- provedKeys: state.provedKeys
657
+ provedKeys: state.provedKeys,
658
+ // The id-to-material binding the walk enforced, handed on so an incremental
659
+ // extension of this state can enforce the identical rule without the log.
660
+ seenKeys: [...state.seenKeys.values()]
594
661
  };
595
662
  };
596
663
  var verifyIdentityExtensionFromTrustedState = async (input) => {
@@ -598,6 +665,10 @@ var verifyIdentityExtensionFromTrustedState = async (input) => {
598
665
  const priorEffective = keyStateOf(currentState);
599
666
  const priorDeclared = currentState.declared ?? priorEffective;
600
667
  const priorProved = currentState.provedKeys ?? priorEffective;
668
+ const seenKeys = keyMaterialIndex(
669
+ currentState.seenKeys ?? [...flatKeys(priorDeclared), ...flatKeys(priorProved)]
670
+ );
671
+ const priorSeenKeys = [...seenKeys.values()];
601
672
  const decoded = decodeJwsUnsafe(newOp);
602
673
  if (!decoded) throw new Error("failed to decode JWS");
603
674
  const result = IdentityOperation.safeParse(decoded.payload);
@@ -625,7 +696,7 @@ var verifyIdentityExtensionFromTrustedState = async (input) => {
625
696
  if (op.createdAt <= lastCreatedAt) {
626
697
  throw new Error("createdAt must be after last op");
627
698
  }
628
- const encoded = await dagCborCanonicalEncode(op);
699
+ const encoded = await dagCborCanonicalEncode(decoded.payload);
629
700
  if (encoded.bytes.length > MAX_OPERATION_SIZE) {
630
701
  throw new Error(`operation exceeds max size: ${encoded.bytes.length} > ${MAX_OPERATION_SIZE}`);
631
702
  }
@@ -646,13 +717,14 @@ var verifyIdentityExtensionFromTrustedState = async (input) => {
646
717
  if (!signingKey) {
647
718
  throw new Error(`kid references unknown key: ${signingKeyId}`);
648
719
  }
649
- const { keyBytes } = decodeMultikey(signingKey.publicKeyMultibase);
720
+ const keyBytes = decodeEd25519PublicMultikey(signingKey.publicKeyMultibase);
650
721
  try {
651
722
  verifyJws({ token: newOp, publicKey: keyBytes });
652
723
  } catch {
653
724
  throw new Error("invalid signature");
654
725
  }
655
726
  if (op.type === "update") {
727
+ admitKeyMaterial(seenKeys, [...op.authKeys, ...op.assertKeys, ...op.controllerKeys]);
656
728
  [op.authKeys, op.assertKeys, op.controllerKeys].forEach((keys) => {
657
729
  const set = new Set(keys.map((k) => k.id));
658
730
  if (set.size !== keys.length) {
@@ -682,7 +754,8 @@ var verifyIdentityExtensionFromTrustedState = async (input) => {
682
754
  services: op.services ?? [],
683
755
  declared,
684
756
  voidKeys: folded.voidKeys,
685
- provedKeys: unionProved(priorProved, folded.effective)
757
+ provedKeys: unionProved(priorProved, folded.effective),
758
+ seenKeys: [...seenKeys.values()]
686
759
  };
687
760
  }
688
761
  // delete and restore introduce nothing, so both key states — and the void
@@ -697,7 +770,8 @@ var verifyIdentityExtensionFromTrustedState = async (input) => {
697
770
  services: currentState.services,
698
771
  declared: priorDeclared,
699
772
  voidKeys: currentState.voidKeys ?? [],
700
- provedKeys: priorProved
773
+ provedKeys: priorProved,
774
+ seenKeys: priorSeenKeys
701
775
  };
702
776
  case "restore":
703
777
  return {
@@ -709,7 +783,8 @@ var verifyIdentityExtensionFromTrustedState = async (input) => {
709
783
  services: currentState.services,
710
784
  declared: priorDeclared,
711
785
  voidKeys: currentState.voidKeys ?? [],
712
- provedKeys: priorProved
786
+ provedKeys: priorProved,
787
+ seenKeys: priorSeenKeys
713
788
  };
714
789
  }
715
790
  })();
@@ -718,11 +793,13 @@ var verifyIdentityExtensionFromTrustedState = async (input) => {
718
793
 
719
794
  // src/chain/content-chain.ts
720
795
  var operationSizeForCap = async (op, fullByteLength) => {
796
+ if (op.type === "create") return fullByteLength;
721
797
  const auth = op.authorization;
722
798
  if (typeof auth !== "string") return fullByteLength;
723
- if (auth.length > MAX_CREDENTIAL_SIZE) {
799
+ const authByteLength = new TextEncoder().encode(auth).length;
800
+ if (authByteLength > MAX_CREDENTIAL_SIZE) {
724
801
  throw new Error(
725
- `authorization credential exceeds max size: ${auth.length} > ${MAX_CREDENTIAL_SIZE}`
802
+ `authorization credential exceeds max size: ${authByteLength} > ${MAX_CREDENTIAL_SIZE}`
726
803
  );
727
804
  }
728
805
  const { authorization: _omit, ...rest } = op;
@@ -750,7 +827,7 @@ var verifyOperationAuthorization = async (input) => {
750
827
  const opCreatedAtUnix = Math.floor(new Date(input.createdAt).getTime() / 1e3);
751
828
  const credential = await verifyDFOSCredential(input.authorization, {
752
829
  resolveIdentity: input.resolveIdentity,
753
- now: opCreatedAtUnix
830
+ basis: input.createdAt
754
831
  });
755
832
  if (input.isRevoked && await input.isRevoked(credential.iss, credential.credentialCID, opCreatedAtUnix)) {
756
833
  throw new Error("credential is revoked");
@@ -758,8 +835,8 @@ var verifyOperationAuthorization = async (input) => {
758
835
  await verifyDelegationChain(credential, {
759
836
  resolveIdentity: input.resolveIdentity,
760
837
  rootDID: input.creatorDID,
761
- now: opCreatedAtUnix,
762
- ...input.isRevoked ? { isRevoked: input.isRevoked, asOfUnix: opCreatedAtUnix } : {}
838
+ basis: input.createdAt,
839
+ ...input.isRevoked ? { isRevoked: input.isRevoked } : {}
763
840
  });
764
841
  if (credential.aud !== "*" && credential.aud !== input.operationDID) {
765
842
  throw new Error(
@@ -821,7 +898,7 @@ var verifyContentChain = async (input) => {
821
898
  if (kidDid !== op.did) {
822
899
  throw new Error(`log[${idx}]: kid DID does not match operation did`);
823
900
  }
824
- const publicKey = await input.resolveKey(kid);
901
+ const publicKey = await input.resolveKey(kid, op.createdAt);
825
902
  try {
826
903
  verifyJws({ token: jwsToken, publicKey });
827
904
  } catch {
@@ -854,8 +931,8 @@ var verifyContentChain = async (input) => {
854
931
  );
855
932
  }
856
933
  }
857
- const encoded = await dagCborCanonicalEncode(op);
858
- const opSize = await operationSizeForCap(op, encoded.bytes.length);
934
+ const encoded = await dagCborCanonicalEncode(decoded.payload);
935
+ const opSize = await operationSizeForCap(decoded.payload, encoded.bytes.length);
859
936
  if (opSize > MAX_OPERATION_SIZE) {
860
937
  throw new Error(`operation exceeds max size: ${opSize} > ${MAX_OPERATION_SIZE}`);
861
938
  }
@@ -931,7 +1008,7 @@ var verifyContentExtensionFromTrustedState = async (input) => {
931
1008
  if (kidDid !== op.did) {
932
1009
  throw new Error("kid DID does not match operation did");
933
1010
  }
934
- const publicKey = await resolveKey(kid);
1011
+ const publicKey = await resolveKey(kid, op.createdAt);
935
1012
  try {
936
1013
  verifyJws({ token: newOp, publicKey });
937
1014
  } catch {
@@ -959,8 +1036,8 @@ var verifyContentExtensionFromTrustedState = async (input) => {
959
1036
  throw carryDependencyMissing(err, new Error(`authorization verification failed: ${message}`));
960
1037
  }
961
1038
  }
962
- const encoded = await dagCborCanonicalEncode(op);
963
- const opSize = await operationSizeForCap(op, encoded.bytes.length);
1039
+ const encoded = await dagCborCanonicalEncode(decoded.payload);
1040
+ const opSize = await operationSizeForCap(decoded.payload, encoded.bytes.length);
964
1041
  if (opSize > MAX_OPERATION_SIZE) {
965
1042
  throw new Error(`operation exceeds max size: ${opSize} > ${MAX_OPERATION_SIZE}`);
966
1043
  }
@@ -1009,7 +1086,7 @@ var verifyCountersignature = async (input) => {
1009
1086
  if (kidDid !== payload.did) {
1010
1087
  throw new Error("countersignature kid DID does not match payload did");
1011
1088
  }
1012
- const publicKey = await input.resolveKey(kid);
1089
+ const publicKey = await input.resolveKey(kid, payload.createdAt);
1013
1090
  try {
1014
1091
  verifyJws({ token: input.jwsToken, publicKey });
1015
1092
  } catch {
@@ -1062,7 +1139,7 @@ var verifyArtifact = async (input) => {
1062
1139
  if (kidDid !== payload.did) {
1063
1140
  throw new Error("artifact kid DID does not match payload did");
1064
1141
  }
1065
- const publicKey = await input.resolveKey(kid);
1142
+ const publicKey = await input.resolveKey(kid, payload.createdAt);
1066
1143
  try {
1067
1144
  verifyJws({ token: input.jwsToken, publicKey });
1068
1145
  } catch {
@@ -1119,13 +1196,13 @@ var verifyRevocation = async (input) => {
1119
1196
  if (kidDid !== payload.did) {
1120
1197
  throw new Error("revocation kid DID does not match payload did");
1121
1198
  }
1122
- const publicKey = await input.resolveKey(kid);
1199
+ const publicKey = await input.resolveKey(kid, payload.createdAt);
1123
1200
  try {
1124
1201
  verifyJws({ token: input.jwsToken, publicKey });
1125
1202
  } catch {
1126
1203
  throw new Error("invalid revocation signature");
1127
1204
  }
1128
- const encoded = await dagCborCanonicalEncode(payload);
1205
+ const encoded = await dagCborCanonicalEncode(decoded.payload);
1129
1206
  const revocationCID = encoded.cid.toString();
1130
1207
  if (!decoded.header.cid) throw new Error("missing cid in revocation header");
1131
1208
  if (decoded.header.cid !== revocationCID) throw new Error("revocation cid mismatch");
@@ -1158,7 +1235,7 @@ var resolveKeyFromIdentity = (identity, kid) => {
1158
1235
  if (!key) {
1159
1236
  throw markDependencyMissing(invalid(`key ${keyId} not found on identity ${identity.did}`));
1160
1237
  }
1161
- const { keyBytes } = decodeMultikey(key.publicKeyMultibase);
1238
+ const keyBytes = decodeEd25519PublicMultikey(key.publicKeyMultibase);
1162
1239
  return keyBytes;
1163
1240
  };
1164
1241
  var normalizeClaimCreatedAt = (createdAt) => {
@@ -1254,7 +1331,7 @@ var verifyCreditClaim = async (jwsToken, options) => {
1254
1331
  } catch {
1255
1332
  throw invalid("invalid credit claim signature");
1256
1333
  }
1257
- const encoded = await dagCborCanonicalEncode(payload);
1334
+ const encoded = await dagCborCanonicalEncode(decoded.payload);
1258
1335
  const claimCID = encoded.cid.toString();
1259
1336
  if (!decoded.header.cid) throw invalid("missing cid in credit claim header");
1260
1337
  if (decoded.header.cid !== claimCID) throw invalid("credit claim cid mismatch");
@@ -1381,7 +1458,7 @@ var resolveCurrentKey = (identity, kid) => {
1381
1458
  );
1382
1459
  if (!key) throw invalid2(`key ${keyId} not found on current identity ${identity.did}`);
1383
1460
  try {
1384
- return decodeMultikey(key.publicKeyMultibase).keyBytes;
1461
+ return decodeEd25519PublicMultikey(key.publicKeyMultibase);
1385
1462
  } catch {
1386
1463
  throw invalid2(`key ${keyId} on identity ${identity.did} is not a valid Ed25519 multikey`);
1387
1464
  }
@@ -1481,7 +1558,7 @@ var verifySignRequest = async (jwsToken, options) => {
1481
1558
  }
1482
1559
  let encoded;
1483
1560
  try {
1484
- encoded = await dagCborCanonicalEncode(payload);
1561
+ encoded = await dagCborCanonicalEncode(decoded.payload);
1485
1562
  } catch (error) {
1486
1563
  const detail = error instanceof Error ? error.message : String(error);
1487
1564
  throw invalid2(`failed to derive sign request CID: ${detail}`);
@@ -1,8 +1,7 @@
1
1
  import {
2
- ED25519_PUB_MULTICODEC,
3
- decodeMultikey,
2
+ decodeEd25519PublicMultikey,
4
3
  encodeEd25519Multikey
5
- } from "./chunk-IDVYITX7.js";
4
+ } from "./chunk-F7RHI2CK.js";
6
5
  import {
7
6
  base64urlDecode,
8
7
  base64urlEncode,
@@ -10,7 +9,7 @@ import {
10
9
  isValidEd25519Signature,
11
10
  sha256,
12
11
  signPayloadEd25519
13
- } from "./chunk-4LG2GEB2.js";
12
+ } from "./chunk-QTJZGXMH.js";
14
13
 
15
14
  // src/key-proof/role-set.ts
16
15
  var KEY_ROLES = ["auth", "assert", "controller"];
@@ -205,11 +204,7 @@ var decodeKeyProof = (jws, expectedTyp) => {
205
204
  var verifyKeyProofSignature = (decoded) => {
206
205
  let keyBytes;
207
206
  try {
208
- const key = decodeMultikey(decoded.payload.publicKeyMultibase);
209
- if (key.codec !== ED25519_PUB_MULTICODEC) {
210
- throw new Error("publicKeyMultibase is not an Ed25519 public key");
211
- }
212
- keyBytes = key.keyBytes;
207
+ keyBytes = decodeEd25519PublicMultikey(decoded.payload.publicKeyMultibase);
213
208
  } catch (err) {
214
209
  throw invalid(
215
210
  "signature",