@interop/wallet-core 0.69.0 → 0.70.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.
Files changed (143) hide show
  1. package/README.md +17 -28
  2. package/dist/clientAnnex/ladder.d.ts +103 -57
  3. package/dist/clientAnnex/ladder.d.ts.map +1 -1
  4. package/dist/clientAnnex/ladder.js +254 -335
  5. package/dist/clientAnnex/ladder.js.map +1 -1
  6. package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
  7. package/dist/clientAnnex/ladderAnchored.js +10 -5
  8. package/dist/clientAnnex/ladderAnchored.js.map +1 -1
  9. package/dist/clientAnnex/recoveryLadderAnchored.d.ts +3 -15
  10. package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
  11. package/dist/clientAnnex/recoveryLadderAnchored.js +22 -3
  12. package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
  13. package/dist/clients/grantState.d.ts +67 -0
  14. package/dist/clients/grantState.d.ts.map +1 -0
  15. package/dist/clients/grantState.js +72 -0
  16. package/dist/clients/grantState.js.map +1 -0
  17. package/dist/clients/index.d.ts +7 -0
  18. package/dist/clients/index.d.ts.map +1 -1
  19. package/dist/clients/index.js +6 -0
  20. package/dist/clients/index.js.map +1 -1
  21. package/dist/enrollment/connectCode.d.ts +4 -3
  22. package/dist/enrollment/connectCode.d.ts.map +1 -1
  23. package/dist/enrollment/connectCode.js +4 -3
  24. package/dist/enrollment/connectCode.js.map +1 -1
  25. package/dist/enrollment/index.d.ts +2 -2
  26. package/dist/enrollment/index.js +2 -2
  27. package/dist/enrollment/onboardingInvite.d.ts +1 -1
  28. package/dist/enrollment/onboardingInvite.js +1 -1
  29. package/dist/enrollment/onboardingResponse.js +1 -1
  30. package/dist/identity/index.d.ts +1 -1
  31. package/dist/identity/index.js +1 -1
  32. package/dist/index.d.ts +4 -8
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +4 -8
  35. package/dist/index.js.map +1 -1
  36. package/dist/keyring/kdf.d.ts +33 -19
  37. package/dist/keyring/kdf.d.ts.map +1 -1
  38. package/dist/keyring/kdf.js +36 -25
  39. package/dist/keyring/kdf.js.map +1 -1
  40. package/dist/recovery/continuation.d.ts +5 -4
  41. package/dist/recovery/continuation.d.ts.map +1 -1
  42. package/dist/recovery/continuation.js +14 -13
  43. package/dist/recovery/continuation.js.map +1 -1
  44. package/dist/resourceLog/document.d.ts +10 -2
  45. package/dist/resourceLog/document.d.ts.map +1 -1
  46. package/dist/resourceLog/document.js +1 -2
  47. package/dist/resourceLog/document.js.map +1 -1
  48. package/dist/space/index.d.ts +4 -2
  49. package/dist/space/index.d.ts.map +1 -1
  50. package/dist/space/index.js +4 -2
  51. package/dist/space/index.js.map +1 -1
  52. package/dist/space/wasLink.d.ts +13 -2
  53. package/dist/space/wasLink.d.ts.map +1 -1
  54. package/dist/space/wasLink.js +28 -2
  55. package/dist/space/wasLink.js.map +1 -1
  56. package/dist/unlock/index.d.ts +1 -1
  57. package/dist/unlock/index.d.ts.map +1 -1
  58. package/dist/unlock/index.js.map +1 -1
  59. package/dist/unlock/standingWebvh.d.ts +81 -19
  60. package/dist/unlock/standingWebvh.d.ts.map +1 -1
  61. package/dist/unlock/standingWebvh.js +170 -30
  62. package/dist/unlock/standingWebvh.js.map +1 -1
  63. package/dist/webvh/did.d.ts +2 -4
  64. package/dist/webvh/did.d.ts.map +1 -1
  65. package/dist/webvh/did.js +2 -4
  66. package/dist/webvh/did.js.map +1 -1
  67. package/dist/webvh/didWebvh.d.ts +3 -2
  68. package/dist/webvh/didWebvh.d.ts.map +1 -1
  69. package/dist/webvh/didWebvh.js +2 -1
  70. package/dist/webvh/didWebvh.js.map +1 -1
  71. package/dist/webvh/revokeClient.d.ts +13 -7
  72. package/dist/webvh/revokeClient.d.ts.map +1 -1
  73. package/dist/webvh/revokeClient.js +14 -7
  74. package/dist/webvh/revokeClient.js.map +1 -1
  75. package/package.json +1 -16
  76. package/dist/request/appKey.d.ts +0 -295
  77. package/dist/request/appKey.d.ts.map +0 -1
  78. package/dist/request/appKey.js +0 -516
  79. package/dist/request/appKey.js.map +0 -1
  80. package/dist/request/capabilityRequest.d.ts +0 -41
  81. package/dist/request/capabilityRequest.d.ts.map +0 -1
  82. package/dist/request/capabilityRequest.js +0 -46
  83. package/dist/request/capabilityRequest.js.map +0 -1
  84. package/dist/request/classify.d.ts +0 -226
  85. package/dist/request/classify.d.ts.map +0 -1
  86. package/dist/request/classify.js +0 -416
  87. package/dist/request/classify.js.map +0 -1
  88. package/dist/request/composeVp.d.ts +0 -52
  89. package/dist/request/composeVp.d.ts.map +0 -1
  90. package/dist/request/composeVp.js +0 -176
  91. package/dist/request/composeVp.js.map +0 -1
  92. package/dist/request/ephemeralExchange.d.ts +0 -100
  93. package/dist/request/ephemeralExchange.d.ts.map +0 -1
  94. package/dist/request/ephemeralExchange.js +0 -230
  95. package/dist/request/ephemeralExchange.js.map +0 -1
  96. package/dist/request/exchangeClient.d.ts +0 -142
  97. package/dist/request/exchangeClient.d.ts.map +0 -1
  98. package/dist/request/exchangeClient.js +0 -241
  99. package/dist/request/exchangeClient.js.map +0 -1
  100. package/dist/request/index.d.ts +0 -59
  101. package/dist/request/index.d.ts.map +0 -1
  102. package/dist/request/index.js +0 -59
  103. package/dist/request/index.js.map +0 -1
  104. package/dist/request/interactionRequest.d.ts +0 -23
  105. package/dist/request/interactionRequest.d.ts.map +0 -1
  106. package/dist/request/interactionRequest.js +0 -46
  107. package/dist/request/interactionRequest.js.map +0 -1
  108. package/dist/request/interactionUrl.d.ts +0 -42
  109. package/dist/request/interactionUrl.d.ts.map +0 -1
  110. package/dist/request/interactionUrl.js +0 -104
  111. package/dist/request/interactionUrl.js.map +0 -1
  112. package/dist/request/matching.d.ts +0 -95
  113. package/dist/request/matching.d.ts.map +0 -1
  114. package/dist/request/matching.js +0 -205
  115. package/dist/request/matching.js.map +0 -1
  116. package/dist/request/onboarding.d.ts +0 -94
  117. package/dist/request/onboarding.d.ts.map +0 -1
  118. package/dist/request/onboarding.js +0 -167
  119. package/dist/request/onboarding.js.map +0 -1
  120. package/dist/request/parse.d.ts +0 -63
  121. package/dist/request/parse.d.ts.map +0 -1
  122. package/dist/request/parse.js +0 -153
  123. package/dist/request/parse.js.map +0 -1
  124. package/dist/request/presentationSuite.d.ts +0 -71
  125. package/dist/request/presentationSuite.d.ts.map +0 -1
  126. package/dist/request/presentationSuite.js +0 -143
  127. package/dist/request/presentationSuite.js.map +0 -1
  128. package/dist/request/processRequest.d.ts +0 -45
  129. package/dist/request/processRequest.d.ts.map +0 -1
  130. package/dist/request/processRequest.js +0 -147
  131. package/dist/request/processRequest.js.map +0 -1
  132. package/dist/request/queryPredicates.d.ts +0 -98
  133. package/dist/request/queryPredicates.d.ts.map +0 -1
  134. package/dist/request/queryPredicates.js +0 -107
  135. package/dist/request/queryPredicates.js.map +0 -1
  136. package/dist/request/types.d.ts +0 -257
  137. package/dist/request/types.d.ts.map +0 -1
  138. package/dist/request/types.js +0 -2
  139. package/dist/request/types.js.map +0 -1
  140. package/dist/request/walletInput.d.ts +0 -93
  141. package/dist/request/walletInput.d.ts.map +0 -1
  142. package/dist/request/walletInput.js +0 -179
  143. package/dist/request/walletInput.js.map +0 -1
@@ -30,7 +30,9 @@
30
30
  * - `publicCredentialUrl`, the world-readable shared-credential URL both
31
31
  * replicas derive identically.
32
32
  * - The `was-link` QR hand-off contract (`buildWasLinkPayload` /
33
- * `parseWasLinkPayload` / `encodeWasLinkSecret`).
33
+ * `parseWasLinkPayload` / `encodeWasLinkSecret`) and `isWasLinkPayload`,
34
+ * the recognizer a wallet hands `@interop/wallet-request`'s input
35
+ * classifier.
34
36
  * - `CEREMONY_IDS` / `CeremonyId`, the typed vocabulary of shared account
35
37
  * ceremony ids.
36
38
  */
@@ -43,7 +45,7 @@ export { plaintextCollection } from './plaintextCollection.js';
43
45
  export { ACTIVITY_TYPE, addHistoryNewAccount, addHistorySpaceCreated, addHistoryCredentialCreated, addHistoryCredentialDeleted, addHistoryCredentialShared, addHistoryCredentialUnshared, addHistoryLogin, addHistoryWalletLogin, addHistoryAppRevoke, addHistoryAgentRevoke, addHistoryClientRevoked, addHistoryGenerationCollected } from './activity.js';
44
46
  export type { WalletActivity, ActivityGrant } from './activity.js';
45
47
  export { publicCredentialUrl } from './publicLink.js';
46
- export { encodeWasLinkSecret, buildWasLinkPayload, parseWasLinkPayload } from './wasLink.js';
48
+ export { encodeWasLinkSecret, isWasLinkPayload, buildWasLinkPayload, parseWasLinkPayload } from './wasLink.js';
47
49
  export type { WasLinkPayload } from './wasLink.js';
48
50
  export { HumanReadableError } from './errors.js';
49
51
  export { CEREMONY_IDS } from './ceremony.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/space/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EACL,iBAAiB,EACjB,8BAA8B,EAC9B,6BAA6B,EAC7B,0BAA0B,EAC1B,0BAA0B,EAC1B,mCAAmC,EACnC,kCAAkC,EAClC,+BAA+B,EAC/B,8BAA8B,EAC9B,sCAAsC,EACtC,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC9B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,8BAA8B,EAC9B,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,4BAA4B,EAC5B,kCAAkC,EAClC,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE/E,OAAO,EAAE,oBAAoB,EAAE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EAC9B,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,4BAA4B,EAC5B,kCAAkC,EAClC,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA"}
@@ -30,7 +30,9 @@
30
30
  * - `publicCredentialUrl`, the world-readable shared-credential URL both
31
31
  * replicas derive identically.
32
32
  * - The `was-link` QR hand-off contract (`buildWasLinkPayload` /
33
- * `parseWasLinkPayload` / `encodeWasLinkSecret`).
33
+ * `parseWasLinkPayload` / `encodeWasLinkSecret`) and `isWasLinkPayload`,
34
+ * the recognizer a wallet hands `@interop/wallet-request`'s input
35
+ * classifier.
34
36
  * - `CEREMONY_IDS` / `CeremonyId`, the typed vocabulary of shared account
35
37
  * ceremony ids.
36
38
  */
@@ -41,7 +43,7 @@ export { provisionWalletSpace } from './provisioning.js';
41
43
  export { plaintextCollection } from './plaintextCollection.js';
42
44
  export { ACTIVITY_TYPE, addHistoryNewAccount, addHistorySpaceCreated, addHistoryCredentialCreated, addHistoryCredentialDeleted, addHistoryCredentialShared, addHistoryCredentialUnshared, addHistoryLogin, addHistoryWalletLogin, addHistoryAppRevoke, addHistoryAgentRevoke, addHistoryClientRevoked, addHistoryGenerationCollected } from './activity.js';
43
45
  export { publicCredentialUrl } from './publicLink.js';
44
- export { encodeWasLinkSecret, buildWasLinkPayload, parseWasLinkPayload } from './wasLink.js';
46
+ export { encodeWasLinkSecret, isWasLinkPayload, buildWasLinkPayload, parseWasLinkPayload } from './wasLink.js';
45
47
  export { HumanReadableError } from './errors.js';
46
48
  export { CEREMONY_IDS } from './ceremony.js';
47
49
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/space/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EACL,iBAAiB,EACjB,8BAA8B,EAC9B,6BAA6B,EAC7B,0BAA0B,EAC1B,0BAA0B,EAC1B,mCAAmC,EACnC,kCAAkC,EAClC,+BAA+B,EAC/B,8BAA8B,EAC9B,sCAAsC,EACtC,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC9B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,8BAA8B,EAC9B,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,4BAA4B,EAC5B,kCAAkC,EAClC,sBAA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CAAkC,EAClC,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAGrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA"}
@@ -9,10 +9,21 @@ export interface WasLinkPayload {
9
9
  secret: string;
10
10
  }
11
11
  /**
12
- * The `t` discriminator member every `was-link` payload carries. Exported so
13
- * input classification can match it structurally without calling the parser.
12
+ * The `t` discriminator member every `was-link` payload carries.
14
13
  */
15
14
  export declare const WAS_LINK_TYPE = "was-link";
15
+ /**
16
+ * Whether some scanned or pasted text has a `was-link` payload's JSON shape.
17
+ * Matched structurally on the `t` member rather than by calling the parser,
18
+ * so an unrelated JSON blob is not refused with a connection-code error
19
+ * message. This is the recognizer a wallet hands `@interop/wallet-request`'s
20
+ * input classifier for its `was-link` branch; whether the payload is valid
21
+ * is {@link parseWasLinkPayload}'s answer.
22
+ *
23
+ * @param text {string}
24
+ * @returns {boolean}
25
+ */
26
+ export declare function isWasLinkPayload(text: string): boolean;
16
27
  /**
17
28
  * Encodes a passphrase into the payload's `secret` field: `base64url(utf8(...))`,
18
29
  * no padding.
@@ -1 +1 @@
1
- {"version":3,"file":"wasLink.d.ts","sourceRoot":"","sources":["../../src/space/wasLink.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,aAAa,CAAA;AA4CvC;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,UAAU,EACX,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CACnB,GAAG,MAAM,CAOT;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAyC/D"}
1
+ {"version":3,"file":"wasLink.d.ts","sourceRoot":"","sources":["../../src/space/wasLink.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,aAAa,CAAA;AAEvC;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAgBtD;AA4CD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,UAAU,EACX,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CACnB,GAAG,MAAM,CAOT;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAyC/D"}
@@ -14,10 +14,36 @@
14
14
  import { base64urlnopad } from '@scure/base';
15
15
  import { HumanReadableError } from './errors.js';
16
16
  /**
17
- * The `t` discriminator member every `was-link` payload carries. Exported so
18
- * input classification can match it structurally without calling the parser.
17
+ * The `t` discriminator member every `was-link` payload carries.
19
18
  */
20
19
  export const WAS_LINK_TYPE = 'was-link';
20
+ /**
21
+ * Whether some scanned or pasted text has a `was-link` payload's JSON shape.
22
+ * Matched structurally on the `t` member rather than by calling the parser,
23
+ * so an unrelated JSON blob is not refused with a connection-code error
24
+ * message. This is the recognizer a wallet hands `@interop/wallet-request`'s
25
+ * input classifier for its `was-link` branch; whether the payload is valid
26
+ * is {@link parseWasLinkPayload}'s answer.
27
+ *
28
+ * @param text {string}
29
+ * @returns {boolean}
30
+ */
31
+ export function isWasLinkPayload(text) {
32
+ const trimmed = text.trim();
33
+ if (!trimmed.startsWith('{')) {
34
+ return false;
35
+ }
36
+ let parsed;
37
+ try {
38
+ parsed = JSON.parse(trimmed);
39
+ }
40
+ catch {
41
+ return false;
42
+ }
43
+ return (parsed !== null &&
44
+ typeof parsed === 'object' &&
45
+ parsed.t === WAS_LINK_TYPE);
46
+ }
21
47
  const NOT_A_LINK = 'This QR code is not a wallet connection code.';
22
48
  const BAD_SERVER = 'Connection code points at an insecure or invalid server and was rejected.';
23
49
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"wasLink.js","sourceRoot":"","sources":["../../src/space/wasLink.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAahD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAA;AAEvC,MAAM,UAAU,GAAG,+CAA+C,CAAA;AAClE,MAAM,UAAU,GACd,2EAA2E,CAAA;AAE7E;;GAEG;AACH,SAAS,YAAY,CAA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AA;IAC1C,CAAC;IAED,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAiC,CAAA;IACrE,IAAI,CAAC,KAAK,aAAa,EAAE,CAAC;QACxB,MAAM,IAAI,kBAAkB,CAAC,UAAU,CAAC,CAAA;IAC1C,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACZ,MAAM,IAAI,kBAAkB,CAC1B,kEAAkE,CACnE,CAAA;IACH,CAAC;IACD,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,kBAAkB,CAAC,wCAAwC,CAAC,CAAA;IACxE,CAAC;IACD,oBAAoB,CAAC,SAAS,CAAC,CAAA;IAC/B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,kBAAkB,CAAC,wCAAwC,CAAC,CAAA;IACxE,CAAC;IAED,IAAI,UAAkB,CAAA;IACtB,IAAI,CAAC;QACH,UAAU,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CACnC,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAC5C,CAAA;IACH,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,kBAAkB,CAAC,yCAAyC,CAAC,CAAA;IACzE,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,kBAAkB,CAAC,sCAAsC,CAAC,CAAA;IACtE,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,CAAA;AAC1C,CAAC"}
@@ -40,7 +40,7 @@ export type { StandingUnlockClient, UnlockClientIdentity } from './standingClien
40
40
  export { computeUnlockBinding, LADDER_SEED_BYTES, recordSealedRecipientKeys, remintUnlockRecordDelegations, UnlockBindingError, unlockRecordBinding, unlockRecordSealedTo, unwrapUnlockRecord, wrapUnlockRecord } from './unlockRecord.js';
41
41
  export type { SealedRecordMember, SignedUnlockRecord, UnlockRecordContents, UnlockRecordProofState } from './unlockRecord.js';
42
42
  export { assertLadderVmClaimed, ladderVmClaimOf, preflightUnlockCredentialRetirement, publishUnlockKey, removeUnlockKey, UnclaimedLadderVmRetirementError, unlockKeyVerificationMethod, unlockKeyVmId } from './standingWebvh.js';
43
- export type { LadderVmRemovalReport, StandingUnlockKeys, UnlockKeyAgreementPublication, UnlockLogStore } from './standingWebvh.js';
43
+ export type { CredentialKeyAgreementMethod, LadderVmRemovalReport, StandingUnlockKeys, UnlockKeyAgreementPublication, UnlockLogStore } from './standingWebvh.js';
44
44
  export { retireUnlockCredential } from './retire.js';
45
45
  export type { ClientAnnexInventoryRetirement, UnlockCredentialRetirementResult } from './retire.js';
46
46
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/unlock/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,4BAA4B,EAC7B,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,mCAAmC,EACnC,gBAAgB,EAChB,eAAe,EACf,gCAAgC,EAChC,2BAA2B,EAC3B,aAAa,EACd,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,6BAA6B,EAC7B,cAAc,EACf,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,YAAY,EACV,8BAA8B,EAC9B,gCAAgC,EACjC,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/unlock/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,4BAA4B,EAC7B,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,mCAAmC,EACnC,gBAAgB,EAChB,eAAe,EACf,gCAAgC,EAChC,2BAA2B,EAC3B,aAAa,EACd,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,4BAA4B,EAC5B,qBAAqB,EACrB,kBAAkB,EAClB,6BAA6B,EAC7B,cAAc,EACf,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,YAAY,EACV,8BAA8B,EAC9B,gCAAgC,EACjC,MAAM,aAAa,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/unlock/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,4BAA4B,EAC7B,MAAM,qBAAqB,CAAA;AAM5B,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,mBAAmB,CAAA;AAQ1B,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,mCAAmC,EACnC,gBAAgB,EAChB,eAAe,EACf,gCAAgC,EAChC,2BAA2B,EAC3B,aAAa,EACd,MAAM,oBAAoB,CAAA;AAQ3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/unlock/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,4BAA4B,EAC7B,MAAM,qBAAqB,CAAA;AAM5B,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,mBAAmB,CAAA;AAQ1B,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,mCAAmC,EACnC,gBAAgB,EAChB,eAAe,EACf,gCAAgC,EAChC,2BAA2B,EAC3B,aAAa,EACd,MAAM,oBAAoB,CAAA;AAS3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA"}
@@ -109,11 +109,32 @@ export declare function unlockKeyVmId({ did, keyAgreement }: {
109
109
  }): string;
110
110
  /**
111
111
  * What of a standing credential's ladder currently stands in the published
112
- * log, resolved with the recorded update key as ANCHOR and the credential's
113
- * own key-agreement id as the attribution's second arm. The removal edit uses
114
- * it to know what to strike; the retirement ceremony uses it one stage
115
- * earlier, to name the ladder VM it is about to strike to the pass that
116
- * re-mints whatever that VM signed for other credentials.
112
+ * log, resolved from the two anchors a ceremony holds and cross-checked
113
+ * between them. The registry's recorded update key (`updateKeyMultibase`,
114
+ * rung 0 at bind time or a later rung a self-enrollment advanced it to) is
115
+ * one anchor; the credential's own `keyAgreement` member names the other,
116
+ * its rung-0 commitment (`ladderCommitment`, read by
117
+ * {@link credentialLadderAnchor}). Either one alone can be wrong for this
118
+ * credential -- a registry entry recording another ladder's key, a member a
119
+ * foreign update-key holder restated -- and a walk that trusts one strikes
120
+ * whatever ladder that anchor names. The removal edit uses the result to
121
+ * know what to strike; the retirement ceremony uses it one stage earlier,
122
+ * to name the ladder VM it is about to strike to the pass that re-mints
123
+ * whatever that VM signed for other credentials.
124
+ *
125
+ * Seedless, both walks run when the member names an anchor. The
126
+ * member-anchored walk starts at rung 0 and needs no backward recovery, so
127
+ * it is the complete reading; the registry-anchored walk may start at a
128
+ * later rung and recover the earlier ones from the log's positional rules,
129
+ * which leaves it at best equal and in one reachable history (WC-158)
130
+ * short of the member's. So the registry-anchored inventory must be
131
+ * contained in the member-anchored one, and the member-anchored one is what
132
+ * is returned. Anything else -- the two anchors naming different ladders --
133
+ * refuses with {@link LadderAttributionError}. A member naming no anchor
134
+ * (a split bind torn before its authority entry, a member without the
135
+ * property) leaves the registry walk to answer alone, as before. With the
136
+ * ladder seed in hand the cross-check is direct: the seed's rung-0 hash must
137
+ * be the member's named anchor, and the seeded walk is returned.
117
138
  *
118
139
  * It lives here rather than in the ceremony because this module is the one
119
140
  * base-side holder of the annex attribution helpers (the pinned lint
@@ -264,6 +285,22 @@ export declare function preflightUnlockCredentialRetirement({ idStore, unlockKey
264
285
  ladderVmIds: string[];
265
286
  document: DIDDoc;
266
287
  }>;
288
+ /**
289
+ * The write-side shape of a credential-class `keyAgreement` member, the
290
+ * twin of the read side's `ResolvedKeyAgreementMethod`: a `VerificationMethod`
291
+ * carrying the key verbatim (`publicKeyMultibase`) or its hash commitment
292
+ * (`publicKeyCommitment`), and always the ladder's rung-0 commitment. Every
293
+ * bind site builds one through {@link unlockKeyVerificationMethod}, so the
294
+ * permanent property is typed where it is written rather than cast in.
295
+ */
296
+ export type CredentialKeyAgreementMethod = VerificationMethod & {
297
+ controller: string;
298
+ ladderCommitment: string;
299
+ } & ({
300
+ publicKeyMultibase: string;
301
+ } | {
302
+ publicKeyCommitment: string;
303
+ });
267
304
  /**
268
305
  * The credential's `keyAgreement` verification method: an ordinary unmarked
269
306
  * entry carrying either the key verbatim (a `Multikey` with
@@ -275,15 +312,26 @@ export declare function preflightUnlockCredentialRetirement({ idStore, unlockKey
275
312
  * carry the controller marker a client listing or a revocation removal
276
313
  * matches on.
277
314
  *
315
+ * Either flavor names its ladder's rung-0 commitment (`ladderCommitment`):
316
+ * `hash(rung 0)` in the multihash form `nextKeyHashes` carries, the same
317
+ * value the bind commits there. It is what a seedless reader anchors the
318
+ * credential's ladder walk on (`credentialLadderAnchor`), so no reader
319
+ * infers the anchor from the shape of the entry that introduced the member.
320
+ * Every bind site builds the member here, so no emitter can omit it; the
321
+ * roster resolver and the client listings ignore it.
322
+ *
278
323
  * @param options {object}
279
324
  * @param options.did {string} the account's did:webvh
280
325
  * @param options.keyAgreement {UnlockKeyAgreementPublication}
281
- * @returns {VerificationMethod}
326
+ * @param options.ladderCommitment {string} `hash(rung 0)` of the
327
+ * credential's ladder, as `deriveNextKeyHash` renders it
328
+ * @returns {CredentialKeyAgreementMethod}
282
329
  */
283
- export declare function unlockKeyVerificationMethod({ did, keyAgreement }: {
330
+ export declare function unlockKeyVerificationMethod({ did, keyAgreement, ladderCommitment }: {
284
331
  did: string;
285
332
  keyAgreement: UnlockKeyAgreementPublication;
286
- }): VerificationMethod;
333
+ ladderCommitment: string;
334
+ }): CredentialKeyAgreementMethod;
287
335
  /**
288
336
  * BIND (run by an enrolled client, root authority): publishes a standing
289
337
  * credential's split configuration into the document -- one entry adding the
@@ -299,7 +347,17 @@ export declare function unlockKeyVerificationMethod({ did, keyAgreement }: {
299
347
  * idempotence against the SAME seed, finds the completed stage and publishes
300
348
  * nothing -- where a mint-when-absent would publish a second VM that no
301
349
  * anchored attribution could later strike. A credential with no ladder at all
302
- * passes `null` and gets no VM.
350
+ * passes `null` and gets no VM. The same rule is enforced against the
351
+ * document, since a caller can mint a fresh seed for a member that already
352
+ * stands (a torn establishment re-run, a registry entry recording the wrong
353
+ * key): a standing member names its ladder's rung-0 commitment
354
+ * (`ladderCommitment`), and a bind whose rung-0 hash differs from it refuses
355
+ * with {@link LadderAttributionError} and writes nothing. Re-adding the
356
+ * member under the new hash would leave it unclaimable by every seedless
357
+ * reader for the rest of its standing run and the first ladder's VM and
358
+ * commitment as orphans; the re-run that converges holds the seed that bound
359
+ * the member. A standing member naming the same hash is extended as before,
360
+ * which is what a split bind's authority entry does.
303
361
  *
304
362
  * `part` splits the bind across two entries where a ceremony needs the
305
363
  * credential's decryption material to precede its authority: `'key'`
@@ -370,16 +428,20 @@ export declare function publishUnlockKey(options: {
370
428
  * too, reading the log's positional rules backwards, so an anchor advanced by
371
429
  * a self-enrollment resolves the same inventory a bind-time anchor does
372
430
  * wherever each rung's hash was committed by an entry that also revealed the
373
- * previous rung, or by a handover. One reachable shape falls outside that: a
374
- * ladder VM the last-client transition reinstalled, whose acting rung a later
375
- * self-enrollment then spends. That reveal-and-commit entry authorizes no key,
376
- * so the backward walk cannot name the rung that signed it, and the VM stays
377
- * standing as `unclaimed` (WC-158). A supplied `ladderSeed` is then a shortcut
378
- * and a cross-check rather than a requirement (every rung known outright, no
379
- * backward walk). For a
380
- * single-key credential (a
381
- * recovery code, a never-self-enrolled bind) the resolution degenerates to
382
- * exactly the recorded key's hash, as before.
431
+ * previous rung, or by a handover. The credential's own member names a
432
+ * second anchor, its rung-0 commitment, and the removal walks from both and
433
+ * cross-checks them ({@link attributeUnlockLadderInventory}): the
434
+ * member-anchored walk reads the whole history forward and is what the
435
+ * strike acts on, the registry-anchored one must be contained in it, and
436
+ * two anchors resolving to different ladders refuse with
437
+ * {@link LadderAttributionError}. That is what reads the one history the
438
+ * backward walk cannot -- a ladder VM the last-client transition reinstalled,
439
+ * whose acting rung a later self-enrollment then spends, so that the
440
+ * registry anchor advances past a reveal-and-commit entry that authorized no
441
+ * key. A supplied `ladderSeed` is then a shortcut and a cross-check rather
442
+ * than a requirement (every rung known outright, no backward walk). For a
443
+ * single-key credential (a recovery code, a never-self-enrolled bind) the
444
+ * resolution degenerates to exactly the recorded key's hash, as before.
383
445
  *
384
446
  * The credential's LADDER VM goes in the same entry, so a retired credential
385
447
  * no longer signs governed-log appends or account delegations. This is the
@@ -1 +1 @@
1
- {"version":3,"file":"standingWebvh.d.ts","sourceRoot":"","sources":["../../src/unlock/standingWebvh.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EACN,kBAAkB,EACnB,MAAM,2BAA2B,CAAA;AASlC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAGhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAMxD,OAAO,EAKL,KAAK,uBAAuB,EAC7B,MAAM,0BAA0B,CAAA;AAEjC;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,YAAY,EACZ,kBAAkB,GAAG,eAAe,GAAG,KAAK,CAC7C,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,KAAK,GAAG,WAAW,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,gCAAiC,SAAQ,KAAK;IACzD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,EAAE,CAAA;IACvC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,C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;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,OAAO,EAAE,YAAY,CAAA;IACrB,MAAM,EAAE,gBAAgB,CAAA;IACxB,UAAU,EAAE,kBAAkB,CAAA;IAC9B,UAAU,EAAE,UAAU,GAAG,IAAI,CAAA;IAC7B,IAAI,CAAC,EAAE,mBAAmB,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAIrD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE;IAC7C,OAAO,EAAE,YAAY,CAAA;IACrB,MAAM,EAAE,gBAAgB,CAAA;IACxB,eAAe,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,kBAAkB,GAAG,eAAe,CAAC,CAAA;IAC1E,UAAU,EAAE,kBAAkB,CAAA;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,OAAO,CAAC;IACV,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,qBAAqB,CAAA;CAChC,CAAC,CAID"}
@@ -38,7 +38,7 @@ import { ladderVmIds, relationIds } from '../resourceLog/document.js';
38
38
  // ladder inventory from the log itself (the shared attribution helpers in
39
39
  // `clientAnnex/ladder.ts`), never touching the annex log machinery, and
40
40
  // derives the credential's ladder VM from its seed at the install.
41
- import { attributeLadderInventory, LadderAttributionError, ladderVmIdsIntroducedWithCredential, ladderVmKeyMultibase } from '../clientAnnex/ladder.js';
41
+ import { attributeLadderInventory, credentialLadderAnchor, credentialLadderCommitment, LadderAttributionError, ladderRung, ladderVmIdsIntroducedWithCredential, ladderVmKeyMultibase } from '../clientAnnex/ladder.js';
42
42
  /**
43
43
  * A retirement whose ladder attribution could not claim the retired
44
44
  * credential's ladder VM, refused with nothing written. The shape is the
@@ -106,11 +106,32 @@ export function unlockKeyVmId({ did, keyAgreement }) {
106
106
  }
107
107
  /**
108
108
  * What of a standing credential's ladder currently stands in the published
109
- * log, resolved with the recorded update key as ANCHOR and the credential's
110
- * own key-agreement id as the attribution's second arm. The removal edit uses
111
- * it to know what to strike; the retirement ceremony uses it one stage
112
- * earlier, to name the ladder VM it is about to strike to the pass that
113
- * re-mints whatever that VM signed for other credentials.
109
+ * log, resolved from the two anchors a ceremony holds and cross-checked
110
+ * between them. The registry's recorded update key (`updateKeyMultibase`,
111
+ * rung 0 at bind time or a later rung a self-enrollment advanced it to) is
112
+ * one anchor; the credential's own `keyAgreement` member names the other,
113
+ * its rung-0 commitment (`ladderCommitment`, read by
114
+ * {@link credentialLadderAnchor}). Either one alone can be wrong for this
115
+ * credential -- a registry entry recording another ladder's key, a member a
116
+ * foreign update-key holder restated -- and a walk that trusts one strikes
117
+ * whatever ladder that anchor names. The removal edit uses the result to
118
+ * know what to strike; the retirement ceremony uses it one stage earlier,
119
+ * to name the ladder VM it is about to strike to the pass that re-mints
120
+ * whatever that VM signed for other credentials.
121
+ *
122
+ * Seedless, both walks run when the member names an anchor. The
123
+ * member-anchored walk starts at rung 0 and needs no backward recovery, so
124
+ * it is the complete reading; the registry-anchored walk may start at a
125
+ * later rung and recover the earlier ones from the log's positional rules,
126
+ * which leaves it at best equal and in one reachable history (WC-158)
127
+ * short of the member's. So the registry-anchored inventory must be
128
+ * contained in the member-anchored one, and the member-anchored one is what
129
+ * is returned. Anything else -- the two anchors naming different ladders --
130
+ * refuses with {@link LadderAttributionError}. A member naming no anchor
131
+ * (a split bind torn before its authority entry, a member without the
132
+ * property) leaves the registry walk to answer alone, as before. With the
133
+ * ladder seed in hand the cross-check is direct: the seed's rung-0 hash must
134
+ * be the member's named anchor, and the seeded walk is returned.
114
135
  *
115
136
  * It lives here rather than in the ceremony because this module is the one
116
137
  * base-side holder of the annex attribution helpers (the pinned lint
@@ -126,15 +147,55 @@ export function unlockKeyVmId({ did, keyAgreement }) {
126
147
  * @returns {Promise<LadderStandingInventory>}
127
148
  */
128
149
  export async function attributeUnlockLadderInventory({ log, did, unlockKeys, ladderSeed }) {
129
- return attributeLadderInventory({
150
+ const credentialVmId = unlockKeyVmId({
151
+ did,
152
+ keyAgreement: unlockKeys.keyAgreement
153
+ });
154
+ const memberAnchor = credentialLadderAnchor({ log, credentialVmId });
155
+ if (ladderSeed) {
156
+ const rung0 = await ladderRung({ ladderSeed, index: 0 });
157
+ const seedAnchorHash = await deriveNextKeyHash(rung0.keyMultibase);
158
+ if (memberAnchor !== undefined &&
159
+ memberAnchor.anchorHash !== seedAnchorHash) {
160
+ throw new LadderAttributionError("The credential's keyAgreement member names a ladder commitment the " +
161
+ 'supplied ladder seed does not derive; refusing to act on a ladder ' +
162
+ 'the seed and the document disagree about.');
163
+ }
164
+ // The seed derives every rung, so the recorded key adds nothing the walk
165
+ // needs -- and a registry entry recording a sibling's rung would put that
166
+ // key into the claims. The walk anchors on the seed's own rung 0.
167
+ return attributeLadderInventory({
168
+ log,
169
+ anchorHash: seedAnchorHash,
170
+ credentialVmId,
171
+ ladderSeed
172
+ });
173
+ }
174
+ const registryAnchored = await attributeLadderInventory({
130
175
  log,
131
176
  anchorKeyMultibase: unlockKeys.updateKeyMultibase,
132
- credentialVmId: unlockKeyVmId({
133
- did,
134
- keyAgreement: unlockKeys.keyAgreement
135
- }),
136
- ...(ladderSeed ? { ladderSeed } : {})
177
+ credentialVmId
178
+ });
179
+ if (memberAnchor === undefined) {
180
+ return registryAnchored;
181
+ }
182
+ const memberAnchored = await attributeLadderInventory({
183
+ log,
184
+ anchorHash: memberAnchor.anchorHash,
185
+ credentialVmId
137
186
  });
187
+ const contained = (subset) => {
188
+ const within = new Set(memberAnchored[subset]);
189
+ return registryAnchored[subset].every(item => within.has(item));
190
+ };
191
+ if (!contained('revealedKeys') ||
192
+ !contained('committedHashes') ||
193
+ !contained('ladderVmIds')) {
194
+ throw new LadderAttributionError("The credential's recorded update key and its keyAgreement member's " +
195
+ 'ladder commitment resolve to different ladders; refusing to strike ' +
196
+ 'on anchors that disagree.');
197
+ }
198
+ return memberAnchored;
138
199
  }
139
200
  /**
140
201
  * What of the document's ladder VMs a credential's attribution claims: the
@@ -335,26 +396,38 @@ export async function preflightUnlockCredentialRetirement({ idStore, unlockKeys,
335
396
  * carry the controller marker a client listing or a revocation removal
336
397
  * matches on.
337
398
  *
399
+ * Either flavor names its ladder's rung-0 commitment (`ladderCommitment`):
400
+ * `hash(rung 0)` in the multihash form `nextKeyHashes` carries, the same
401
+ * value the bind commits there. It is what a seedless reader anchors the
402
+ * credential's ladder walk on (`credentialLadderAnchor`), so no reader
403
+ * infers the anchor from the shape of the entry that introduced the member.
404
+ * Every bind site builds the member here, so no emitter can omit it; the
405
+ * roster resolver and the client listings ignore it.
406
+ *
338
407
  * @param options {object}
339
408
  * @param options.did {string} the account's did:webvh
340
409
  * @param options.keyAgreement {UnlockKeyAgreementPublication}
341
- * @returns {VerificationMethod}
410
+ * @param options.ladderCommitment {string} `hash(rung 0)` of the
411
+ * credential's ladder, as `deriveNextKeyHash` renders it
412
+ * @returns {CredentialKeyAgreementMethod}
342
413
  */
343
- export function unlockKeyVerificationMethod({ did, keyAgreement }) {
414
+ export function unlockKeyVerificationMethod({ did, keyAgreement, ladderCommitment }) {
344
415
  const id = unlockKeyVmId({ did, keyAgreement });
345
416
  if ('publicKeyMultibase' in keyAgreement) {
346
417
  return {
347
418
  id,
348
419
  type: MULTIKEY_VM_TYPE,
349
420
  controller: did,
350
- publicKeyMultibase: keyAgreement.publicKeyMultibase
421
+ publicKeyMultibase: keyAgreement.publicKeyMultibase,
422
+ ladderCommitment
351
423
  };
352
424
  }
353
425
  return {
354
426
  id,
355
427
  type: MULTIKEY_COMMITMENT_VM_TYPE,
356
428
  controller: did,
357
- publicKeyCommitment: keyAgreement.commitment
429
+ publicKeyCommitment: keyAgreement.commitment,
430
+ ladderCommitment
358
431
  };
359
432
  }
360
433
  /**
@@ -372,7 +445,17 @@ export function unlockKeyVerificationMethod({ did, keyAgreement }) {
372
445
  * idempotence against the SAME seed, finds the completed stage and publishes
373
446
  * nothing -- where a mint-when-absent would publish a second VM that no
374
447
  * anchored attribution could later strike. A credential with no ladder at all
375
- * passes `null` and gets no VM.
448
+ * passes `null` and gets no VM. The same rule is enforced against the
449
+ * document, since a caller can mint a fresh seed for a member that already
450
+ * stands (a torn establishment re-run, a registry entry recording the wrong
451
+ * key): a standing member names its ladder's rung-0 commitment
452
+ * (`ladderCommitment`), and a bind whose rung-0 hash differs from it refuses
453
+ * with {@link LadderAttributionError} and writes nothing. Re-adding the
454
+ * member under the new hash would leave it unclaimable by every seedless
455
+ * reader for the rest of its standing run and the first ladder's VM and
456
+ * commitment as orphans; the re-run that converges holds the seed that bound
457
+ * the member. A standing member naming the same hash is extended as before,
458
+ * which is what a split bind's authority entry does.
376
459
  *
377
460
  * `part` splits the bind across two entries where a ceremony needs the
378
461
  * credential's decryption material to precede its authority: `'key'`
@@ -433,16 +516,20 @@ export async function publishUnlockKey(options) {
433
516
  * too, reading the log's positional rules backwards, so an anchor advanced by
434
517
  * a self-enrollment resolves the same inventory a bind-time anchor does
435
518
  * wherever each rung's hash was committed by an entry that also revealed the
436
- * previous rung, or by a handover. One reachable shape falls outside that: a
437
- * ladder VM the last-client transition reinstalled, whose acting rung a later
438
- * self-enrollment then spends. That reveal-and-commit entry authorizes no key,
439
- * so the backward walk cannot name the rung that signed it, and the VM stays
440
- * standing as `unclaimed` (WC-158). A supplied `ladderSeed` is then a shortcut
441
- * and a cross-check rather than a requirement (every rung known outright, no
442
- * backward walk). For a
443
- * single-key credential (a
444
- * recovery code, a never-self-enrolled bind) the resolution degenerates to
445
- * exactly the recorded key's hash, as before.
519
+ * previous rung, or by a handover. The credential's own member names a
520
+ * second anchor, its rung-0 commitment, and the removal walks from both and
521
+ * cross-checks them ({@link attributeUnlockLadderInventory}): the
522
+ * member-anchored walk reads the whole history forward and is what the
523
+ * strike acts on, the registry-anchored one must be contained in it, and
524
+ * two anchors resolving to different ladders refuse with
525
+ * {@link LadderAttributionError}. That is what reads the one history the
526
+ * backward walk cannot -- a ladder VM the last-client transition reinstalled,
527
+ * whose acting rung a later self-enrollment then spends, so that the
528
+ * registry anchor advances past a reveal-and-commit entry that authorized no
529
+ * key. A supplied `ladderSeed` is then a shortcut and a cross-check rather
530
+ * than a requirement (every rung known outright, no backward walk). For a
531
+ * single-key credential (a recovery code, a never-self-enrolled bind) the
532
+ * resolution degenerates to exactly the recorded key's hash, as before.
446
533
  *
447
534
  * The credential's LADDER VM goes in the same entry, so a retired credential
448
535
  * no longer signs governed-log appends or account delegations. This is the
@@ -523,7 +610,49 @@ async function setUnlockKeyInventoryOnce({ idStore, signer, projectionStore, unl
523
610
  const { did, doc } = published;
524
611
  const keyHash = await deriveNextKeyHash(unlockKeys.updateKeyMultibase);
525
612
  const vmId = unlockKeyVmId({ did, keyAgreement: unlockKeys.keyAgreement });
613
+ // What the bind commits and names as the member's ladder commitment:
614
+ // `hash(rung 0)` derived from the seed the bind holds, which is what
615
+ // the recorded key must be at bind time. A recorded key that has since
616
+ // advanced (a registry refreshed by a self-enrollment) must neither
617
+ // move the anchor a re-run tests against nor be published as one.
618
+ const seedRung0Hash = polarity === 'publish' && ladderSeed
619
+ ? await deriveNextKeyHash((await ladderRung({ ladderSeed, index: 0 })).keyMultibase)
620
+ : undefined;
621
+ const anchorHash = seedRung0Hash ?? keyHash;
526
622
  const vmPresent = (doc.verificationMethod ?? []).some(method => method.id === vmId);
623
+ const reading = polarity === 'publish' && vmPresent
624
+ ? credentialLadderCommitment({
625
+ log: published.log,
626
+ credentialVmId: vmId
627
+ })
628
+ : undefined;
629
+ if (polarity === 'publish' &&
630
+ !vmPresent &&
631
+ seedRung0Hash !== undefined &&
632
+ seedRung0Hash !== keyHash) {
633
+ throw new LadderAttributionError("did:webvh: the credential's recorded update key is not rung 0 of " +
634
+ 'the ladder seed handed to the bind; refusing to publish an ' +
635
+ 'inventory the seed does not derive.');
636
+ }
637
+ if (polarity === 'publish' && vmPresent) {
638
+ // The write-side half of the anchor rule: a standing member's
639
+ // `ladderCommitment` is what every seedless reader anchors the
640
+ // credential's ladder on, and only the ladder that bound the member
641
+ // may extend its inventory. A bind reaching a standing member under
642
+ // another rung-0 hash -- a torn establishment re-run that minted a
643
+ // fresh seed, a registry entry naming the wrong key, a sibling's
644
+ // rung -- would re-add the member naming the new hash, leaving the
645
+ // member unclaimable for the rest of its standing run and the first
646
+ // ladder's VM and commitment as orphans. It refuses instead, with
647
+ // nothing written: the re-run that converges is the one holding the
648
+ // seed that bound the member.
649
+ if (reading?.retargeted || reading?.named !== anchorHash) {
650
+ throw new LadderAttributionError("did:webvh: the credential's keyAgreement member already stands " +
651
+ 'naming a ladder commitment this bind does not derive; ' +
652
+ 'refusing to re-bind a standing member under another ladder. ' +
653
+ 'Re-run with the ladder seed that bound it.');
654
+ }
655
+ }
527
656
  // The remove polarity strikes the ladder's CURRENT inventory, resolved
528
657
  // from the log with the recorded key as anchor -- never just the
529
658
  // recorded key's hash, which a self-enrollment since the bind leaves
@@ -579,7 +708,11 @@ async function setUnlockKeyInventoryOnce({ idStore, signer, projectionStore, unl
579
708
  ? ladderVmId !== undefined && standingLadderVmIds.includes(ladderVmId)
580
709
  : struckLadderVmIds.size > 0;
581
710
  const struckIds = new Set([vmId, ...struckLadderVmIds]);
582
- const hashCommitted = published.nextKeyHashes.includes(keyHash);
711
+ // The authority half is settled once the log committed the anchor for
712
+ // the member: standing still, or spent since by a self-enrollment that
713
+ // climbed the ladder past it.
714
+ const hashCommitted = published.nextKeyHashes.includes(anchorHash) ||
715
+ reading?.committed === true;
583
716
  // What this entry is responsible for, by `part`: the key half publishes
584
717
  // the `keyAgreement` member alone, the authority half the ladder VM and
585
718
  // the rung's commitment, and the default entry both.
@@ -606,7 +739,7 @@ async function setUnlockKeyInventoryOnce({ idStore, signer, projectionStore, unl
606
739
  // the seam's `commitHashes`, so on a ladder-signed entry it lands after
607
740
  // the acting rung's own carry-over hash (`decisions/0007` order).
608
741
  const commitHashes = polarity === 'publish' && publishesAuthority && !hashCommitted
609
- ? [keyHash]
742
+ ? [anchorHash]
610
743
  : [];
611
744
  const nextKeyHashes = polarity === 'publish'
612
745
  ? undefined
@@ -627,7 +760,14 @@ async function setUnlockKeyInventoryOnce({ idStore, signer, projectionStore, unl
627
760
  ? [
628
761
  unlockKeyVerificationMethod({
629
762
  did,
630
- keyAgreement: unlockKeys.keyAgreement
763
+ keyAgreement: unlockKeys.keyAgreement,
764
+ /**
765
+ * The recorded update key is rung 0 at bind time, so
766
+ * its hash is the member's ladder commitment -- on a
767
+ * split bind too, where the authority entry commits it
768
+ * two versions later.
769
+ */
770
+ ladderCommitment: anchorHash
631
771
  })
632
772
  ]
633
773
  : []),