@interop/wallet-core 0.41.0 → 0.43.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 (121) hide show
  1. package/README.md +17 -4
  2. package/dist/clients/rosterPolicy.d.ts +28 -16
  3. package/dist/clients/rosterPolicy.d.ts.map +1 -1
  4. package/dist/clients/rosterPolicy.js +51 -26
  5. package/dist/clients/rosterPolicy.js.map +1 -1
  6. package/dist/descriptors/index.d.ts +1 -1
  7. package/dist/descriptors/index.d.ts.map +1 -1
  8. package/dist/descriptors/index.js +1 -1
  9. package/dist/descriptors/index.js.map +1 -1
  10. package/dist/descriptors/logSource.d.ts +58 -6
  11. package/dist/descriptors/logSource.d.ts.map +1 -1
  12. package/dist/descriptors/logSource.js +57 -15
  13. package/dist/descriptors/logSource.js.map +1 -1
  14. package/dist/enrollment/enrollment.d.ts.map +1 -1
  15. package/dist/enrollment/enrollment.js +14 -26
  16. package/dist/enrollment/enrollment.js.map +1 -1
  17. package/dist/keyring/fetch.d.ts +12 -0
  18. package/dist/keyring/fetch.d.ts.map +1 -1
  19. package/dist/keyring/fetch.js +0 -2
  20. package/dist/keyring/fetch.js.map +1 -1
  21. package/dist/keyring/index.d.ts +1 -1
  22. package/dist/keyring/index.d.ts.map +1 -1
  23. package/dist/keyring/index.js +1 -1
  24. package/dist/keyring/index.js.map +1 -1
  25. package/dist/keyring/kdf.d.ts +22 -6
  26. package/dist/keyring/kdf.d.ts.map +1 -1
  27. package/dist/keyring/kdf.js +9 -14
  28. package/dist/keyring/kdf.js.map +1 -1
  29. package/dist/keys/index.d.ts +1 -1
  30. package/dist/keys/index.d.ts.map +1 -1
  31. package/dist/keys/index.js +1 -1
  32. package/dist/keys/index.js.map +1 -1
  33. package/dist/keys/rosterLogStore.d.ts +4 -1
  34. package/dist/keys/rosterLogStore.d.ts.map +1 -1
  35. package/dist/keys/rosterLogStore.js +13 -16
  36. package/dist/keys/rosterLogStore.js.map +1 -1
  37. package/dist/keys/rosterStore.d.ts +13 -1
  38. package/dist/keys/rosterStore.d.ts.map +1 -1
  39. package/dist/keys/rosterStore.js +18 -0
  40. package/dist/keys/rosterStore.js.map +1 -1
  41. package/dist/keys/userKeyRoster.d.ts +17 -5
  42. package/dist/keys/userKeyRoster.d.ts.map +1 -1
  43. package/dist/keys/userKeyRoster.js +38 -13
  44. package/dist/keys/userKeyRoster.js.map +1 -1
  45. package/dist/recovery/index.d.ts +14 -12
  46. package/dist/recovery/index.d.ts.map +1 -1
  47. package/dist/recovery/index.js +13 -11
  48. package/dist/recovery/index.js.map +1 -1
  49. package/dist/recovery/recoveryCode.d.ts +5 -17
  50. package/dist/recovery/recoveryCode.d.ts.map +1 -1
  51. package/dist/recovery/recoveryCode.js +4 -14
  52. package/dist/recovery/recoveryCode.js.map +1 -1
  53. package/dist/recovery/recoveryDelegation.d.ts +50 -19
  54. package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
  55. package/dist/recovery/recoveryDelegation.js +86 -41
  56. package/dist/recovery/recoveryDelegation.js.map +1 -1
  57. package/dist/recovery/recoveryWebvh.d.ts +13 -22
  58. package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
  59. package/dist/recovery/recoveryWebvh.js +37 -129
  60. package/dist/recovery/recoveryWebvh.js.map +1 -1
  61. package/dist/resourceLog/append.d.ts +12 -3
  62. package/dist/resourceLog/append.d.ts.map +1 -1
  63. package/dist/resourceLog/append.js +17 -10
  64. package/dist/resourceLog/append.js.map +1 -1
  65. package/dist/resourceLog/index.d.ts +1 -1
  66. package/dist/resourceLog/index.d.ts.map +1 -1
  67. package/dist/resourceLog/index.js +1 -1
  68. package/dist/resourceLog/index.js.map +1 -1
  69. package/dist/resourceLog/pin.d.ts +46 -8
  70. package/dist/resourceLog/pin.d.ts.map +1 -1
  71. package/dist/resourceLog/pin.js +32 -7
  72. package/dist/resourceLog/pin.js.map +1 -1
  73. package/dist/resourceLog/seal.d.ts +4 -1
  74. package/dist/resourceLog/seal.d.ts.map +1 -1
  75. package/dist/resourceLog/seal.js +6 -2
  76. package/dist/resourceLog/seal.js.map +1 -1
  77. package/dist/unlock/index.d.ts +40 -0
  78. package/dist/unlock/index.d.ts.map +1 -0
  79. package/dist/unlock/index.js +36 -0
  80. package/dist/unlock/index.js.map +1 -0
  81. package/dist/unlock/ladder.d.ts +100 -0
  82. package/dist/unlock/ladder.d.ts.map +1 -0
  83. package/dist/unlock/ladder.js +144 -0
  84. package/dist/unlock/ladder.js.map +1 -0
  85. package/dist/unlock/selfEnroll.d.ts +83 -0
  86. package/dist/unlock/selfEnroll.d.ts.map +1 -0
  87. package/dist/unlock/selfEnroll.js +126 -0
  88. package/dist/unlock/selfEnroll.js.map +1 -0
  89. package/dist/unlock/standingClient.d.ts +68 -0
  90. package/dist/unlock/standingClient.d.ts.map +1 -0
  91. package/dist/unlock/standingClient.js +81 -0
  92. package/dist/unlock/standingClient.js.map +1 -0
  93. package/dist/unlock/standingWebvh.d.ts +153 -0
  94. package/dist/unlock/standingWebvh.d.ts.map +1 -0
  95. package/dist/unlock/standingWebvh.js +370 -0
  96. package/dist/unlock/standingWebvh.js.map +1 -0
  97. package/dist/unlock/unlockRecord.d.ts +207 -0
  98. package/dist/unlock/unlockRecord.d.ts.map +1 -0
  99. package/dist/unlock/unlockRecord.js +435 -0
  100. package/dist/unlock/unlockRecord.js.map +1 -0
  101. package/dist/webvh/didWebvh.d.ts +94 -6
  102. package/dist/webvh/didWebvh.d.ts.map +1 -1
  103. package/dist/webvh/didWebvh.js +175 -19
  104. package/dist/webvh/didWebvh.js.map +1 -1
  105. package/dist/webvh/index.d.ts +7 -2
  106. package/dist/webvh/index.d.ts.map +1 -1
  107. package/dist/webvh/index.js +7 -2
  108. package/dist/webvh/index.js.map +1 -1
  109. package/dist/webvh/keyAgreement.d.ts +22 -6
  110. package/dist/webvh/keyAgreement.d.ts.map +1 -1
  111. package/dist/webvh/keyAgreement.js +1 -1
  112. package/dist/webvh/keyAgreement.js.map +1 -1
  113. package/dist/webvh/verifyLog.d.ts +15 -2
  114. package/dist/webvh/verifyLog.d.ts.map +1 -1
  115. package/dist/webvh/verifyLog.js +22 -3
  116. package/dist/webvh/verifyLog.js.map +1 -1
  117. package/package.json +11 -5
  118. package/dist/recovery/recoveryRecord.d.ts +0 -172
  119. package/dist/recovery/recoveryRecord.d.ts.map +0 -1
  120. package/dist/recovery/recoveryRecord.js +0 -288
  121. package/dist/recovery/recoveryRecord.js.map +0 -1
@@ -19,6 +19,11 @@
19
19
  * - `listEnrolledWebvhClients` -- the enrolled-client listing over a
20
20
  * caller-verified log (keyed on `capabilityInvocation`, update keys
21
21
  * recovered by log attribution), for a "your wallets" surface.
22
+ * - `keyAgreementCommitment` / `commitmentMatchesKey` -- the
23
+ * `MultikeyCommitment` wire rule: the bare sha2-256 multihash, base64url
24
+ * no-pad, over a key-agreement key's decoded multikey bytes, and the
25
+ * decode-based check that verifies a candidate key against a published
26
+ * commitment.
22
27
  * - `delegationKeyInDocument` -- the current-key-set rule for one recorded
23
28
  * delegation: does the document still publish the key that signed it (a
24
29
  * missing key id reads as "cannot be checked", so: no).
@@ -38,8 +43,8 @@
38
43
  * Kept out of the root export: this subpath pulls the did:webvh, ed25519, and
39
44
  * ezcap dependency graph (the same isolation pattern as `./identity`).
40
45
  */
41
- export { clientKeyAgreementController, didWebvhControllerTemplate, ensureDidWebvh, enrollWebvhClient, keyAgreementTwinMultibase, markedVerificationMethodPair, mintClientWebvhUpdateKeys, relationIds, repairKeyBindings, rotateWebvhUpdateKey, updateKeyMultibase, WebvhLogConflictError, withLogConflictRetry } from './didWebvh.js';
42
- export { AccountLogMissingError, verifyAccountLog } from './verifyLog.js';
46
+ export { BYOE_CONTEXT_URL, clientKeyAgreementController, commitmentMatchesKey, didWebvhControllerTemplate, ensureDidWebvh, enrollWebvhClient, keyAgreementCommitment, keyAgreementTwinMultibase, MULTIKEY_COMMITMENT_VM_TYPE, markedVerificationMethodPair, mintClientWebvhUpdateKeys, relationIds, repairKeyBindings, rotateWebvhUpdateKey, updateKeyMultibase, WebvhLogConflictError, withLogConflictRetry } from './didWebvh.js';
47
+ export { accountLogPinId, AccountLogMissingError, verifyAccountLog } from './verifyLog.js';
43
48
  export { wasWebvhIdStore } from './wasIdStore.js';
44
49
  export { attributeClientUpdateKey, delegationKeyInDocument, documentKeyMultibases, listEnrolledWebvhClients, markedKeyAgreementMethods, markedKeyAgreementMultibases } from './listClients.js';
45
50
  export { resolvedKeyAgreementMethods } from './keyAgreement.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/webvh/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,4BAA4B,EAC5B,yBAAyB,EACzB,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC7B,MAAM,kBAAkB,CAAA;AAKzB,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EACL,iBAAiB,EACjB,8BAA8B,EAC/B,MAAM,mBAAmB,CAAA;AAW1B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGzC,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,UAAU,EACV,oBAAoB,EACpB,WAAW,EACX,eAAe,EAChB,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/webvh/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,oBAAoB,EACpB,0BAA0B,EAC1B,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,yBAAyB,EACzB,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC7B,MAAM,kBAAkB,CAAA;AAKzB,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EACL,iBAAiB,EACjB,8BAA8B,EAC/B,MAAM,mBAAmB,CAAA;AAW1B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGzC,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,UAAU,EACV,oBAAoB,EACpB,WAAW,EACX,eAAe,EAChB,MAAM,WAAW,CAAA"}
@@ -26,15 +26,35 @@
26
26
  export interface KeyAgreementDocument {
27
27
  verificationMethod?: Array<{
28
28
  id?: string;
29
+ type?: string;
29
30
  controller?: string;
30
31
  publicKeyMultibase?: string;
32
+ publicKeyCommitment?: string;
31
33
  }>;
32
34
  keyAgreement?: Array<string | {
33
35
  id?: string;
36
+ type?: string;
34
37
  controller?: string;
35
38
  publicKeyMultibase?: string;
39
+ publicKeyCommitment?: string;
36
40
  }>;
37
41
  }
42
+ /**
43
+ * The materialized shape {@link resolvedKeyAgreementMethods} returns: a
44
+ * `keyAgreement` verification method carrying either the key itself
45
+ * (`publicKeyMultibase`) or, for a low-entropy-derived standing unlock
46
+ * credential, its hash commitment (`publicKeyCommitment`). The `type` rides
47
+ * along so a consumer can tell the two published flavors apart (`Multikey` vs
48
+ * `MultikeyCommitment`) instead of inferring the flavor from which property
49
+ * happens to be present.
50
+ */
51
+ export interface ResolvedKeyAgreementMethod {
52
+ id?: string;
53
+ type?: string;
54
+ controller?: string;
55
+ publicKeyMultibase?: string;
56
+ publicKeyCommitment?: string;
57
+ }
38
58
  /**
39
59
  * The `keyAgreement` verification methods a document publishes, materialized:
40
60
  * string references resolved against `verificationMethod` (a reference nothing
@@ -44,13 +64,9 @@ export interface KeyAgreementDocument {
44
64
  *
45
65
  * @param options {object}
46
66
  * @param options.doc {KeyAgreementDocument} a locally verified document
47
- * @returns {Array<{ id?: string, controller?: string, publicKeyMultibase?: string }>}
67
+ * @returns {ResolvedKeyAgreementMethod[]}
48
68
  */
49
69
  export declare function resolvedKeyAgreementMethods({ doc }: {
50
70
  doc: KeyAgreementDocument;
51
- }): Array<{
52
- id?: string;
53
- controller?: string;
54
- publicKeyMultibase?: string;
55
- }>;
71
+ }): ResolvedKeyAgreementMethod[];
56
72
  //# sourceMappingURL=keyAgreement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyAgreement.d.ts","sourceRoot":"","sources":["../../src/webvh/keyAgreement.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,kBAAkB,CAAC,EAAE,KAAK,CAAC;QACzB,EAAE,CAAC,EAAE,MAAM,CAAA;QACX,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAC5B,CAAC,CAAA;IACF,YAAY,CAAC,EAAE,KAAK,CAClB,MAAM,GAAG;QAAE,EAAE,CAA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;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,GAAG,EACJ,EAAE;IACD,GAAG,EAAE,oBAAoB,CAAA;CAC1B,GAAG,0BAA0B,EAAE,CAe/B"}
@@ -26,7 +26,7 @@
26
26
  *
27
27
  * @param options {object}
28
28
  * @param options.doc {KeyAgreementDocument} a locally verified document
29
- * @returns {Array<{ id?: string, controller?: string, publicKeyMultibase?: string }>}
29
+ * @returns {ResolvedKeyAgreementMethod[]}
30
30
  */
31
31
  export function resolvedKeyAgreementMethods({ doc }) {
32
32
  const byId = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"keyAgreement.js","sourceRoot":"","sources":["../../src/webvh/keyAgreement.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AAmBH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,2BAA2B,CAAC,EAC1C,GAAG,EAGJ;IACC,MAAM,IAAI,GAAG,IAAI,GAAG,EAGjB,CAAA;IACH,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,kBAAkB,IAAI,EAAE,EAAE,CAAC;QAClD,IAAI,OAAO,MAAM,EAAE,EAAE,KAAK,QAAQ,EAAE,CAAC;YACnC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QAC7B,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAIR,EAAE,CAAA;IACP,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QAClE,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACtB,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
1
+ {"version":3,"file":"keyAgreement.js","sourceRoot":"","sources":["../../src/webvh/keyAgreement.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AA6CH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,2BAA2B,CAAC,EAC1C,GAAG,EAGJ;IACC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAsC,CAAA;IAC1D,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,kBAAkB,IAAI,EAAE,EAAE,CAAC;QAClD,IAAI,OAAO,MAAM,EAAE,EAAE,KAAK,QAAQ,EAAE,CAAC;YACnC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QAC7B,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAAiC,EAAE,CAAA;IAChD,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QAClE,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACtB,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -1,5 +1,17 @@
1
1
  import type { DIDDoc, DIDLog } from '@interop/did-method-webvh';
2
- import type { ResourceLogHeadPin, ResourceLogPinStore } from '../resourceLog/pin.js';
2
+ import { type ResourceLogHeadPin, type ResourceLogPinStore } from '../resourceLog/pin.js';
3
+ /**
4
+ * The pin-slot key for an account's did:webvh log (`id/did.jsonl`) -- what a
5
+ * ceremony taking its own read of the log names its pin by, and what
6
+ * {@link verifyAccountLog} derives internally.
7
+ *
8
+ * @param options {object}
9
+ * @param options.spaceId {string} the account's Space id
10
+ * @returns {string}
11
+ */
12
+ export declare function accountLogPinId({ spaceId }: {
13
+ spaceId: string;
14
+ }): string;
3
15
  /**
4
16
  * Thrown when the account has published no DID log at all (the resource is
5
17
  * absent). Distinguished from every other failure because it is the one
@@ -59,7 +71,8 @@ export declare function checkAccountLogContinuity({ log, pin }: {
59
71
  * @param options.spaceId {string} the account's Space id
60
72
  * @param options.host {string} the storage server the account lives on
61
73
  * @param [options.pinStore] {ResourceLogPinStore} this client's chain-head
62
- * pin for the account log
74
+ * pins; the account log's slot is keyed by {@link accountLogPinId} over the
75
+ * `spaceId` above
63
76
  * @returns {Promise<object>} the resolved document, the raw log, and the
64
77
  * log's effective `updateKeys` / `nextKeyHashes`
65
78
  */
@@ -1 +1 @@
1
- {"version":3,"file":"verifyLog.d.ts","sourceRoot":"","sources":["../../src/webvh/verifyLog.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAI/D,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,uBAAuB,CAAA;AAE9B;;;;;;GAMG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,SAA0C;CAI9D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,GAAG,EACH,GAAG,EACJ,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,kBAAkB,GAAG,IAAI,CAAA;CAC/B,GAAG,kBAAkB,CA4CrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,GAAG,EACH,OAAO,EACP,IAAI,EACJ,QAAQ,EACT,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,mBAAmB,CAAA;CA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A6CD"}
@@ -30,6 +30,23 @@ import { readLogFromString, resolveDIDFromLog } from '@interop/did-method-webvh'
30
30
  import { resourcePath, toUrl } from '@interop/was-client/paths';
31
31
  import { DID_LOG_RESOURCE, ID_COLLECTION } from '../space/collections.js';
32
32
  import { ResourceLogContinuityError } from '../resourceLog/errors.js';
33
+ import { resourceLogPinId } from '../resourceLog/pin.js';
34
+ /**
35
+ * The pin-slot key for an account's did:webvh log (`id/did.jsonl`) -- what a
36
+ * ceremony taking its own read of the log names its pin by, and what
37
+ * {@link verifyAccountLog} derives internally.
38
+ *
39
+ * @param options {object}
40
+ * @param options.spaceId {string} the account's Space id
41
+ * @returns {string}
42
+ */
43
+ export function accountLogPinId({ spaceId }) {
44
+ return resourceLogPinId({
45
+ spaceId,
46
+ collectionId: ID_COLLECTION.id,
47
+ resourceId: DID_LOG_RESOURCE
48
+ });
49
+ }
33
50
  /**
34
51
  * Thrown when the account has published no DID log at all (the resource is
35
52
  * absent). Distinguished from every other failure because it is the one
@@ -133,7 +150,8 @@ export function checkAccountLogContinuity({ log, pin }) {
133
150
  * @param options.spaceId {string} the account's Space id
134
151
  * @param options.host {string} the storage server the account lives on
135
152
  * @param [options.pinStore] {ResourceLogPinStore} this client's chain-head
136
- * pin for the account log
153
+ * pins; the account log's slot is keyed by {@link accountLogPinId} over the
154
+ * `spaceId` above
137
155
  * @returns {Promise<object>} the resolved document, the raw log, and the
138
156
  * log's effective `updateKeys` / `nextKeyHashes`
139
157
  */
@@ -159,12 +177,13 @@ export async function verifyAccountLog({ did, spaceId, host, pinStore }) {
159
177
  'pointer names.');
160
178
  }
161
179
  if (pinStore) {
162
- const pin = await pinStore.read();
180
+ const logId = accountLogPinId({ spaceId });
181
+ const pin = await pinStore.read({ logId });
163
182
  const served = checkAccountLogContinuity({ log, pin });
164
183
  // Advanced only when the served head is genuinely ahead of the pin: the
165
184
  // checks above have already refused everything that is not.
166
185
  if (!pin || pin.head !== served.head) {
167
- await pinStore.write(served);
186
+ await pinStore.write({ logId, pin: served });
168
187
  }
169
188
  }
170
189
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"verifyLog.js","sourceRoot":"","sources":["../../src/webvh/verifyLog.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAA;AAMrE;;;;;;GAMG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,OAAO,GAAG,uCAAuC;QAC3D,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAA;IACtC,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,yBAAyB,CAAC,EACxC,GAAG,EACH,GAAG,EAIJ;IACC,MAAM,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;IACtB,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAChC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;IAClD,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,IAAI,EAAE,CAAA;IAC9C,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,IAAI,EAAE,CAAA;IAC1C,IAAI,GAAG,EAAE,CAAC;QACR,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC1B,MAAM,IAAI,0BAA0B,CAAC;gBAC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,QAAQ,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CACb,4CACE,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI,uCACzB,IAAI,CACL,CAAA;IACH,CAAC;IACD,IAAI,QAAQ,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,qEAAqE;YACnE,gBAAgB,CACnB,CAAA;IACH,CAAC;IACD,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,KAAK,GAAG,eAAe,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;QAC1C,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;QAC1C,MAAM,MAAM,GAAG,yBAAyB,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAA;QACtD,wEAAwE;QACxE,4DAA4D;QAC5D,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;YACrC,MAAM,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;QAC9C,CAAC;IACH,CAAC;IACD,OAAO;QACL,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,GAAG;QACH,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE;QAC1C,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE;KACjD,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@interop/wallet-core",
3
3
  "description": "Shared wallet-domain logic (WAS sync engine core and wallet Space layout contracts) for Interop wallet apps.",
4
- "version": "0.41.0",
4
+ "version": "0.43.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "pnpm run clear && tsc",
@@ -90,6 +90,12 @@
90
90
  "import": "./dist/recovery/index.js",
91
91
  "default": "./dist/recovery/index.js"
92
92
  },
93
+ "./unlock": {
94
+ "types": "./dist/unlock/index.d.ts",
95
+ "react-native": "./dist/unlock/index.js",
96
+ "import": "./dist/unlock/index.js",
97
+ "default": "./dist/unlock/index.js"
98
+ },
93
99
  "./keys": {
94
100
  "types": "./dist/keys/index.d.ts",
95
101
  "react-native": "./dist/keys/index.js",
@@ -132,22 +138,22 @@
132
138
  "types": "dist/index.d.ts",
133
139
  "sideEffects": false,
134
140
  "dependencies": {
135
- "@interop/data-integrity-core": "^8.5.0",
141
+ "@interop/data-integrity-core": "^8.7.1",
136
142
  "@interop/data-integrity-proof": "^3.4.3",
137
- "@interop/did-method-webvh": "^5.2.0",
143
+ "@interop/did-method-webvh": "^5.5.0",
138
144
  "@interop/ed25519-signature": "^7.1.4",
139
145
  "@interop/ed25519-verification-key": "^8.0.3",
140
146
  "@interop/ezcap": "^7.4.1",
141
147
  "@interop/security-document-loader": "^10.0.0",
142
148
  "@interop/social-core": "^0.8.1",
143
149
  "@interop/vc": "^11.0.6",
144
- "@interop/was-client": "^0.39.0",
150
+ "@interop/was-client": "^0.39.1",
145
151
  "@interop/webkms-client": "^14.7.1",
146
152
  "@interop/x25519-key-agreement-key": "^5.2.1",
147
153
  "@noble/ciphers": "^2.3.0",
148
154
  "@noble/hashes": "^2.3.0",
149
155
  "@scure/base": "^2.3.0",
150
- "byoe-context": "^0.3.0"
156
+ "byoe-context": "^0.5.0"
151
157
  },
152
158
  "devDependencies": {
153
159
  "@eslint/js": "^10.0.1",
@@ -1,172 +0,0 @@
1
- import type { IKeyAgreementKey, IKeyResolver, IZcap } from '@interop/data-integrity-core';
2
- import type { AccountPointer, RecordSigner, SignedRecord } from '../keyring/record.js';
3
- /**
4
- * A recovery record's account binding is absent, malformed, or does not
5
- * verify under the typed code's binding MAC key. Its own class, distinct from
6
- * a proof or decrypt failure: this is the refusal that says the record's
7
- * `{ controller, pointer }` core was not written by a holder of this code --
8
- * a forged record redirecting recovery at another account, or a record from
9
- * before the account moved hosts (either way the code cannot recover here
10
- * and must be re-issued).
11
- */
12
- export declare class RecoveryBindingError extends Error {
13
- constructor(message: string);
14
- }
15
- /**
16
- * The unwrapped contents of a recovery keyring record: the code-authenticated
17
- * account binding (controller + pointer) plus the delegation and bind
18
- * timestamp. `pointer` is required -- a recovery record exists only on WAS
19
- * deployments (there is nothing to recover toward without a Space).
20
- */
21
- export interface RecoveryRecordContents {
22
- controller: string;
23
- pointer: AccountPointer;
24
- delegation: IZcap;
25
- createdAt: string;
26
- }
27
- /**
28
- * A stored recovery record: the shared signed frame plus the account-binding
29
- * tag the frame proof also covers.
30
- */
31
- export interface SignedRecoveryRecord extends SignedRecord {
32
- binding: string;
33
- }
34
- /**
35
- * Where a recovery record's proof stands after the unwrap: `'verified'` when
36
- * the code-derived unlock key signed it (checked before decryption), or a
37
- * pending marker naming the signer the caller must still check against the
38
- * account's verified did:webvh document -- the re-mint case, where an enrolled
39
- * client signed on the code's behalf. The pending case is a value the caller
40
- * cannot ignore by accident: the shell is not trustworthy until
41
- * `verifyRecordProof` is run against the document-listed keys. The account
42
- * the document belongs to is the one the code-authenticated pointer names --
43
- * the binding is verified either way, so the pending state defers the shell's
44
- * authenticity only, never the account identity.
45
- */
46
- export type RecoveryRecordProofState = 'verified' | {
47
- pending: {
48
- verificationMethod: string;
49
- keyMultibase: string;
50
- };
51
- };
52
- /**
53
- * Computes the account-binding tag: HMAC-SHA-256 over the binding values
54
- * under the code-derived binding MAC key, base64url (no pad). Issuance calls
55
- * it to stamp the record; recovery recomputes it to verify.
56
- *
57
- * @param options {object}
58
- * @param options.bindingMacKey {Uint8Array} the code-derived MAC key
59
- * @param options.controller {string} the account did:key
60
- * @param options.pointer {AccountPointer} the account pointer
61
- * @returns {string}
62
- */
63
- export declare function computeRecoveryBinding({ bindingMacKey, controller, pointer }: {
64
- bindingMacKey: Uint8Array;
65
- controller: string;
66
- pointer: AccountPointer;
67
- }): string;
68
- /**
69
- * Reads the `binding` frame member off a stored recovery record without
70
- * decrypting anything. The re-mint path uses it to carry the tag forward
71
- * verbatim -- it cannot recompute the tag (no code bytes) and does not need
72
- * to. Refuses a record with no binding: such a record predates the
73
- * code-authenticated core and cannot be re-minted -- its code must be
74
- * re-issued.
75
- *
76
- * @param options {object}
77
- * @param options.record {unknown} the stored record envelope
78
- * @returns {string}
79
- */
80
- export declare function recoveryRecordBinding({ record }: {
81
- record: unknown;
82
- }): string;
83
- /**
84
- * Wraps the recovery record: controller, pointer, and the pre-minted
85
- * `did.jsonl` PUT delegation, encrypted under the code's unlock KAK via the
86
- * keyring EDV cipher context, then signed into the same frame the keyring
87
- * record uses -- with the account-binding tag as one more frame member the
88
- * proof covers. Issuance passes the code-derived `bindingMacKey` (the tag is
89
- * computed here) and the code-derived unlock signer; the revocation cascade's
90
- * re-mint path passes the standing record's `binding` verbatim and an
91
- * enrolled client's account signer (see this module's header for the policy
92
- * the reader applies to the two). Exactly one of the two binding inputs must
93
- * be given.
94
- *
95
- * @param options {object}
96
- * @param options.controller {string} the account did:key
97
- * @param options.pointer {AccountPointer} the account pointer
98
- * @param options.delegation {IZcap} the PUT-on-`did.jsonl` delegation to the
99
- * code-derived signing DID
100
- * @param options.keyAgreementKey {IKeyAgreementKey} the code's unlock KAK --
101
- * its public half is all the wrap uses (sealing needs no key-agreement
102
- * secret), which is exactly what lets the re-mint path re-seal a record it
103
- * can never open
104
- * @param options.signer {RecordSigner} the signing key: the code's unlock
105
- * key at issuance, an enrolled client's account key on a re-mint
106
- * @param [options.bindingMacKey] {Uint8Array} the code-derived binding MAC
107
- * key -- the issuance path, which computes the tag
108
- * @param [options.binding] {string} the standing record's tag, carried
109
- * forward verbatim -- the re-mint path, which cannot recompute it
110
- * @param [options.createdAt] {string} the bind timestamp to stamp, as an ISO
111
- * string; defaults to now. Supplied by a caller that pins record freshness.
112
- * @returns {Promise<SignedRecoveryRecord>}
113
- */
114
- export declare function wrapRecoveryRecord({ controller, pointer, delegation, keyAgreementKey, signer, bindingMacKey, binding, createdAt }: {
115
- controller: string;
116
- pointer: AccountPointer;
117
- delegation: IZcap;
118
- keyAgreementKey: IKeyAgreementKey;
119
- signer: RecordSigner;
120
- bindingMacKey?: Uint8Array;
121
- binding?: string;
122
- createdAt?: string;
123
- }): Promise<SignedRecoveryRecord>;
124
- /**
125
- * Unwraps and validates a recovery record: the ordinary keyring-record checks
126
- * plus the required pointer, delegation, and account binding. A record
127
- * without a delegation is not a recovery record (an ordinary keyring record
128
- * found under a code's unlock Space would mean a corrupted issuance) and is
129
- * refused.
130
- *
131
- * The account binding is verified before the contents are returned: the
132
- * decrypted `{ controller, pointer }` must carry the tag the code-derived
133
- * MAC key computes over them, or the record is refused as forged
134
- * ({@link RecoveryBindingError}) -- the check that closes the host-forgery
135
- * redirect, since the host never holds the MAC key. Nothing downstream may
136
- * trust the pointer before this returns.
137
- *
138
- * Proof verification is mixed-signer and ordered deliberately. A proof by the
139
- * code's own unlock key is verified BEFORE decryption -- the strong path,
140
- * where the typed code alone establishes what may have signed the record. A
141
- * proof by any other key can only be checked after decryption, because the
142
- * re-minting client is knowable only once the code-authenticated pointer says
143
- * which account this is and that account's log has been verified; the
144
- * contents come back with a pending proof state naming the signer, and the
145
- * caller completes the check with {@link verifyRecordProof} against the
146
- * document's keys. That second phase is what makes an unexpected signer
147
- * refuse: a record whose proof belongs to neither class ends in a
148
- * `RecordProofError` there.
149
- *
150
- * @param options {object}
151
- * @param options.record {unknown} the stored `{ version, encryption,
152
- * wrapped, binding, proof }` envelope
153
- * @param options.keyAgreementKey {IKeyAgreementKey} the code's unlock KAK
154
- * @param options.keyResolver {IKeyResolver}
155
- * @param options.expectedKeyMultibase {string} the code-derived unlock
156
- * signing key's multibase
157
- * @param options.bindingMacKey {Uint8Array} the code-derived binding MAC
158
- * key the record's account binding must verify under
159
- * @returns {Promise<{ contents: RecoveryRecordContents,
160
- * proofState: RecoveryRecordProofState }>}
161
- */
162
- export declare function unwrapRecoveryRecord({ record, keyAgreementKey, keyResolver, expectedKeyMultibase, bindingMacKey }: {
163
- record: unknown;
164
- keyAgreementKey: IKeyAgreementKey;
165
- keyResolver: IKeyResolver;
166
- expectedKeyMultibase: string;
167
- bindingMacKey: Uint8Array;
168
- }): Promise<{
169
- contents: RecoveryRecordContents;
170
- proofState: RecoveryRecordProofState;
171
- }>;
172
- //# sourceMappingURL=recoveryRecord.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recoveryRecord.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryRecord.ts"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,KAAK,EACN,MAAM,8BAA8B,CAAA;AAcrC,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACb,MAAM,sBAAsB,CAAA;AAQ7B;;;;;;;;GAQG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,cAAc,CAAA;IACvB,UAAU,EAAE,KAAK,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,wBAAwB,GAClC,UAAU,GAAG;IAAE,OAAO,EAAE;QAAE,kBAAkB,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAA;AAyBhF;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,aAAa,EACb,UAAU,EACV,OAAO,EACR,EAAE;IACD,aAAa,EAAE,UAAU,CAAA;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,cAAc,CAAA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