@interop/wallet-core 0.98.0 → 0.99.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 (37) hide show
  1. package/README.md +5 -4
  2. package/dist/clientAnnex/index.d.ts +1 -1
  3. package/dist/clientAnnex/index.d.ts.map +1 -1
  4. package/dist/clientAnnex/index.js +1 -1
  5. package/dist/clientAnnex/index.js.map +1 -1
  6. package/dist/clientAnnex/log.d.ts +15 -0
  7. package/dist/clientAnnex/log.d.ts.map +1 -1
  8. package/dist/clientAnnex/log.js +26 -8
  9. package/dist/clientAnnex/log.js.map +1 -1
  10. package/dist/keyring/index.d.ts +9 -7
  11. package/dist/keyring/index.d.ts.map +1 -1
  12. package/dist/keyring/index.js +9 -7
  13. package/dist/keyring/index.js.map +1 -1
  14. package/dist/keyring/unlockSpace.d.ts +45 -4
  15. package/dist/keyring/unlockSpace.d.ts.map +1 -1
  16. package/dist/keyring/unlockSpace.js +71 -19
  17. package/dist/keyring/unlockSpace.js.map +1 -1
  18. package/dist/resourceLog/controller.d.ts +6 -5
  19. package/dist/resourceLog/controller.d.ts.map +1 -1
  20. package/dist/resourceLog/controller.js +10 -21
  21. package/dist/resourceLog/controller.js.map +1 -1
  22. package/dist/resourceLog/document.d.ts +69 -52
  23. package/dist/resourceLog/document.d.ts.map +1 -1
  24. package/dist/resourceLog/document.js +77 -84
  25. package/dist/resourceLog/document.js.map +1 -1
  26. package/dist/resourceLog/ladderRungs.d.ts.map +1 -1
  27. package/dist/resourceLog/ladderRungs.js +7 -47
  28. package/dist/resourceLog/ladderRungs.js.map +1 -1
  29. package/dist/webvh/documentDids.d.ts +46 -0
  30. package/dist/webvh/documentDids.d.ts.map +1 -0
  31. package/dist/webvh/documentDids.js +50 -0
  32. package/dist/webvh/documentDids.js.map +1 -0
  33. package/dist/webvh/index.d.ts +7 -1
  34. package/dist/webvh/index.d.ts.map +1 -1
  35. package/dist/webvh/index.js +7 -1
  36. package/dist/webvh/index.js.map +1 -1
  37. package/package.json +3 -3
@@ -80,11 +80,13 @@ async function ensurePlaintextCollection({ was, spaceId, collectionId, name }) {
80
80
  .configure({ name, force: true });
81
81
  }
82
82
  /**
83
- * Reads a single plaintext JSON record from a Space collection, or `null` when
84
- * it does not exist yet (a missing Space, collection, or resource all surface
85
- * as a 404-shaped `null` from `resource.get()`). A network / unreachable error
86
- * propagates, so callers can distinguish "no record" from "could not check".
87
- * The explicit `plaintext` override is load-bearing (see the module doc).
83
+ * Reads a single plaintext JSON record from a Space collection together with
84
+ * its `ETag` validator, or `null` when it does not exist yet (a missing Space,
85
+ * collection, or resource all surface as a 404-shaped `null` from
86
+ * `resource.getWithEtag()`). A network / unreachable error propagates, so
87
+ * callers can distinguish "no record" from "could not check". The explicit
88
+ * `plaintext` override is load-bearing (see the module doc): it is also what
89
+ * lets the validator reach the server unchanged on a conditional write.
88
90
  *
89
91
  * @param options {object}
90
92
  * @param options.was {WasClient} the unlock Space client
@@ -93,7 +95,8 @@ async function ensurePlaintextCollection({ was, spaceId, collectionId, name }) {
93
95
  * @param options.resourceId {string}
94
96
  * @param [options.capability] {IZcap} an invocation capability the GET
95
97
  * rides; absent, the request invokes the root capability
96
- * @returns {Promise<unknown | null>}
98
+ * @returns {Promise<{ record: unknown; etag?: string } | null>} `etag` is
99
+ * absent only where the header did not reach the client
97
100
  */
98
101
  async function getPlaintextRecord({ was, spaceId, collectionId, resourceId, capability }) {
99
102
  const result = await plaintextCollection({
@@ -103,12 +106,20 @@ async function getPlaintextRecord({ was, spaceId, collectionId, resourceId, capa
103
106
  capability
104
107
  })
105
108
  .resource(resourceId)
106
- .get();
107
- return result === null ? null : result;
109
+ .getWithEtag();
110
+ if (result === null) {
111
+ return null;
112
+ }
113
+ return result.etag !== undefined
114
+ ? { record: result.data, etag: result.etag }
115
+ : { record: result.data };
108
116
  }
109
117
  /**
110
- * Writes (upserts) a single plaintext JSON record into a Space collection.
111
- * Serialized to bytes with an explicit `application/json` content-type.
118
+ * Writes a single plaintext JSON record into a Space collection. Serialized to
119
+ * bytes with an explicit `application/json` content-type. A plain upsert
120
+ * unless `ifMatch` is given, in which case the write lands only while the
121
+ * stored record's `ETag` still matches, and a mismatch throws was-client's
122
+ * `PreconditionFailedError` (412) unchanged.
112
123
  *
113
124
  * @param options {object}
114
125
  * @param options.was {WasClient} the unlock Space client
@@ -118,13 +129,15 @@ async function getPlaintextRecord({ was, spaceId, collectionId, resourceId, capa
118
129
  * @param options.record {object}
119
130
  * @param [options.capability] {IZcap} an invocation capability the PUT
120
131
  * rides; absent, the request invokes the root capability
121
- * @returns {Promise<void>}
132
+ * @param [options.ifMatch] {string} the `ETag` a prior read returned; the
133
+ * write is conditional on it
134
+ * @returns {Promise<{ etag?: string }>} the stored record's new `ETag`
122
135
  */
123
- async function putPlaintextRecord({ was, spaceId, collectionId, resourceId, record, capability }) {
136
+ async function putPlaintextRecord({ was, spaceId, collectionId, resourceId, record, capability, ifMatch }) {
124
137
  const body = new TextEncoder().encode(JSON.stringify(record));
125
- await plaintextCollection({ was, spaceId, collectionId, capability })
138
+ return plaintextCollection({ was, spaceId, collectionId, capability })
126
139
  .resource(resourceId)
127
- .put(body, { contentType: 'application/json' });
140
+ .put(body, { contentType: 'application/json', ifMatch });
128
141
  }
129
142
  /**
130
143
  * Ensures the unlock Space and its single `keyring` collection exist
@@ -185,6 +198,36 @@ export async function ensureUnlockSpace({ storageServerUrl, zcapClient, serviceD
185
198
  * @returns {Promise<unknown | null>}
186
199
  */
187
200
  export async function getUnlockKeyring({ storageServerUrl, zcapClient, serviceDescription, spaceId, capability }) {
201
+ const result = await getUnlockKeyringWithEtag({
202
+ storageServerUrl,
203
+ zcapClient,
204
+ serviceDescription,
205
+ spaceId,
206
+ capability
207
+ });
208
+ return result === null ? null : result.record;
209
+ }
210
+ /**
211
+ * Reads the keyring record from the unlock Space together with its `ETag`
212
+ * validator, or returns `null` when it does not exist yet. The read half of a
213
+ * compare-and-swap re-bind: a writer that rebuilds the record from what it
214
+ * read passes this `etag` to {@link putUnlockKeyring}'s `ifMatch`, so a
215
+ * concurrent writer's record is never overwritten unseen. Same request,
216
+ * errors, and `capability` semantics as {@link getUnlockKeyring}.
217
+ *
218
+ * @param options {object}
219
+ * @param options.storageServerUrl {string}
220
+ * @param options.zcapClient {ZcapClient}
221
+ * @param [options.serviceDescription] {ServiceDescription} the server's
222
+ * service description a client the caller already holds discovered
223
+ * (`(await was.service()).description`), so this one skips discovery
224
+ * @param options.spaceId {string} the unlock Space id
225
+ * @param [options.capability] {IZcap} the delegated management zcap;
226
+ * absent, the read is a root invocation
227
+ * @returns {Promise<{ record: unknown; etag?: string } | null>} `etag` is
228
+ * absent only where the header did not reach the client
229
+ */
230
+ export async function getUnlockKeyringWithEtag({ storageServerUrl, zcapClient, serviceDescription, spaceId, capability }) {
188
231
  return getPlaintextRecord({
189
232
  was: unlockSpaceClient({
190
233
  storageServerUrl,
@@ -198,7 +241,13 @@ export async function getUnlockKeyring({ storageServerUrl, zcapClient, serviceDe
198
241
  });
199
242
  }
200
243
  /**
201
- * Writes (upserts) the keyring record into the unlock Space as a JSON document.
244
+ * Writes the keyring record into the unlock Space as a JSON document. A plain
245
+ * upsert unless `ifMatch` is given: then the write is a compare-and-swap
246
+ * against the `etag` a {@link getUnlockKeyringWithEtag} read returned, and a
247
+ * record another writer replaced in between fails with was-client's
248
+ * `PreconditionFailedError` (412, matched by `err.name`) rather than being
249
+ * overwritten. A first bind of a fresh record has no `etag` to name and stays
250
+ * an upsert.
202
251
  *
203
252
  * With a `capability`, the `zcapClient` is an enrolled client's rather than
204
253
  * the unlock identity's, and the attached management zcap (delegated by the
@@ -218,10 +267,12 @@ export async function getUnlockKeyring({ storageServerUrl, zcapClient, serviceDe
218
267
  * @param options.record {object} the keyring record
219
268
  * @param [options.capability] {IZcap} the delegated management zcap;
220
269
  * absent, the write is a root invocation
221
- * @returns {Promise<void>}
270
+ * @param [options.ifMatch] {string} the `ETag` of the record this write
271
+ * replaces; absent, the write is an unconditional upsert
272
+ * @returns {Promise<{ etag?: string }>} the stored record's new `ETag`
222
273
  */
223
- export async function putUnlockKeyring({ storageServerUrl, zcapClient, serviceDescription, spaceId, record, capability }) {
224
- await putPlaintextRecord({
274
+ export async function putUnlockKeyring({ storageServerUrl, zcapClient, serviceDescription, spaceId, record, capability, ifMatch }) {
275
+ return putPlaintextRecord({
225
276
  was: unlockSpaceClient({
226
277
  storageServerUrl,
227
278
  zcapClient,
@@ -231,7 +282,8 @@ export async function putUnlockKeyring({ storageServerUrl, zcapClient, serviceDe
231
282
  collectionId: KEYRING_COLLECTION.id,
232
283
  resourceId: KEYRING_RESOURCE,
233
284
  record,
234
- capability
285
+ capability,
286
+ ifMatch
235
287
  });
236
288
  }
237
289
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"unlockSpace.js","sourceRoot":"","sources":["../../src/keyring/unlockSpace.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,SAAS,EAA2B,MAAM,qBAAqB,CAAA;AAGxE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAErE;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAA;AAErD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,gBAAgB,EAAE,OAAO,EAAE,aAAa,CAAC,CAAA;AAE3E;;;;;;;;;;;;GAYG;AACH,SAAS,iBAAiB,CAAC,EACzB,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAKnB;IACC,OAAO,IAAI,SAAS,CAAC;QACnB,SAAS,EAAE,gBAAgB;QAC3B,UAAU;QACV,kBAAkB;KACnB,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,KAAK,UAAU,yBAAyB,CAAC,EACvC,G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O,EACP,MAAM,EACN,UAAU,EACV,OAAO,EASR;IACC,OAAO,kBAAkB,CAAC;QACxB,GAAG,EAAE,iBAAiB,CAAC;YACrB,gBAAgB;YAChB,UAAU;YACV,kBAAkB;SACnB,CAAC;QACF,OAAO;QACP,YAAY,EAAE,kBAAkB,CAAC,EAAE;QACnC,UAAU,EAAE,gBAAgB;QAC5B,MAAM;QACN,UAAU;QACV,OAAO;KACR,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EACtC,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,OAAO,EACP,UAAU,EAOX;IACC,MAAM,GAAG,GAAG,iBAAiB,CAAC;QAC5B,gBAAgB;QAChB,UAAU;QACV,kBAAkB;KACnB,CAAC,CAAA;IACF,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAA;AAC/D,CAAC"}
@@ -36,11 +36,12 @@ import { type LadderRungKeys } from './ladderRungs.js';
36
36
  /**
37
37
  * The credential-inventory view at one controller-log version, consumed by the
38
38
  * ceremony-tail license on ladder-signed appends (clause B of the ladder
39
- * VM's authority clauses). Both members come from the shared
40
- * account-document readers beside this file (`ladderVmMethods` and
41
- * `credentialKeyAgreementMethods` in `document.ts`), so the license reads the
42
- * document exactly as the client listing and the roster's recipient resolver
43
- * do. `ladderKeys` holds the ladder VMs' signing-key multibases, which is how
39
+ * VM's authority clauses). Every member comes from the shared
40
+ * account-document readers beside this file (`ladderVmKeyMultibases`,
41
+ * `enrolledClientKeyMultibases`, and `credentialKeyAgreementMethods` in
42
+ * `document.ts`), so the license reads the document exactly as the rung
43
+ * attribution, the did:key census, and the roster's recipient resolver do.
44
+ * `ladderKeys` holds the ladder VMs' signing-key multibases, which is how
44
45
  * a verifier tells a ladder-signed proof from an enrolled client's.
45
46
  * `inventoryKeys` is S(V), the credential-inventory key set: the
46
47
  * credential-class `keyAgreement` methods keyed by their key material,
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/resourceLog/controller.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,2BAA2B,CAAA;AACpE,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,0BAA0B,CAAA;AAOjC,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAA;AAGzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACvB,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC1B,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC/B,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC5B,cAAc,EAAE,cAAc,CAAA;CAC/B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE;;;;;;;;OAQG;IACH,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;IAC7D,WAAW,EAAE,WAAW,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAA;CAC/D;AA2FD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,GAAG,EACH,GAAG,EACJ,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,0BAA0B,CA+E7B"}
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/resourceLog/controller.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,2BAA2B,CAAA;AACpE,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,0BAA0B,CAAA;AAQjC,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAA;AAGzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACvB,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC1B,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC/B,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC5B,cAAc,EAAE,cAAc,CAAA;CAC/B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE;;;;;;;;OAQG;IACH,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;IAC7D,WAAW,EAAE,WAAW,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAA;CAC/D;AAgFD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,GAAG,EACH,GAAG,EACJ,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,0BAA0B,CA+E7B"}
@@ -1,5 +1,5 @@
1
1
  import { ResourceLogIntegrityError } from '@interop/vh-resource-log';
2
- import { credentialKeyAgreementMethods, ladderVmMethods, resolvedRelationMethods } from './document.js';
2
+ import { credentialKeyAgreementMethods, enrolledClientKeyMultibases, ladderVmKeyMultibases, resolvedRelationMethods } from './document.js';
3
3
  import { attributeLadderRungsPerVersion, entrySignerKeysOf } from './ladderRungs.js';
4
4
  import { assertLadderAppendLicensed } from './license.js';
5
5
  /**
@@ -26,9 +26,10 @@ function assertionKeysOf(doc) {
26
26
  * Collects a document's credential-inventory view (see
27
27
  * {@link ControllerInventory}) over the shared account-document readers, so
28
28
  * ladder recognition and the credential class have one definition here and in
29
- * every other reader: `ladderVmMethods` names the ladder VMs by relation
30
- * asymmetry, and `credentialKeyAgreementMethods` names the account-controlled
31
- * `keyAgreement` methods. S(V) is those methods' key material --
29
+ * every other reader: `ladderVmKeyMultibases` names the ladder VMs' keys by
30
+ * relation asymmetry under the library's one key-multibase rule, and
31
+ * `credentialKeyAgreementMethods` names the account-controlled `keyAgreement`
32
+ * methods. S(V) is those methods' key material --
32
33
  * `publicKeyCommitment` where the entry is a commitment,
33
34
  * `publicKeyMultibase` where it is verbatim (the two value spaces are
34
35
  * disjoint) -- union the ladder keys. A `keyAgreement` method carrying
@@ -36,8 +37,9 @@ function assertionKeysOf(doc) {
36
37
  * inventories compare equal.
37
38
  *
38
39
  * The enrolled-client set the license's third shape compares across versions
39
- * is read from the same document in the same pass: the `capabilityInvocation`
40
- * methods' key multibases. That relation is the client census by definition --
40
+ * is read from the same document in the same pass, by
41
+ * `enrolledClientKeyMultibases` under the same key-multibase rule. That
42
+ * relation is the client census by definition --
41
43
  * a ladder VM is absent from it by the recognition asymmetry, and a
42
44
  * credential's `keyAgreement` entry was never in it -- so the two sets this
43
45
  * function returns cannot overlap by construction.
@@ -51,12 +53,7 @@ function assertionKeysOf(doc) {
51
53
  * @returns {Omit<ControllerInventory, 'ladderRungKeys'>}
52
54
  */
53
55
  function inventoryOf({ doc, did, entry }) {
54
- const ladderKeys = new Set();
55
- for (const method of ladderVmMethods({ doc })) {
56
- if (typeof method.publicKeyMultibase === 'string') {
57
- ladderKeys.add(method.publicKeyMultibase);
58
- }
59
- }
56
+ const ladderKeys = ladderVmKeyMultibases({ doc });
60
57
  const inventoryKeys = new Set(ladderKeys);
61
58
  for (const method of credentialKeyAgreementMethods({ doc, did })) {
62
59
  if (typeof method.publicKeyCommitment === 'string') {
@@ -66,15 +63,7 @@ function inventoryOf({ doc, did, entry }) {
66
63
  inventoryKeys.add(method.publicKeyMultibase);
67
64
  }
68
65
  }
69
- const enrolledClientKeys = new Set();
70
- for (const method of resolvedRelationMethods({
71
- doc,
72
- relation: 'capabilityInvocation'
73
- })) {
74
- if (typeof method.publicKeyMultibase === 'string') {
75
- enrolledClientKeys.add(method.publicKeyMultibase);
76
- }
77
- }
66
+ const enrolledClientKeys = enrolledClientKeyMultibases({ doc });
78
67
  return {
79
68
  ladderKeys,
80
69
  inventoryKeys,
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/resourceLog/controller.ts"],"names":[],"mappings":"AAiCA,OAAO,EACL,yBAAyB,EAE1B,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,uBAAuB,EAExB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,8BAA8B,EAC9B,iBAAiB,EAElB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAA;AAmEzD;;;;;;;GAOG;AACH,SAAS,eAAe,CAAC,GAAoB;IAC3C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,KAAK,MAAM,MAAM,IAAI,uBAAuB,CAAC;QAC3C,GAAG;QACH,QAAQ,EAAE,iBAAiB;KAC5B,CAAC,EAAE,CAAC;QACH,IAAI,OAAO,MAAM,CAAC,kBAAkB,KAAK,QAAQ,EAAE,CAAC;YAClD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAA;QACrC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAS,WAAW,CAAC,EACnB,GAAG,EACH,GAAG,EACH,KAAK,EAKN;IACC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAA;IACpC,KAAK,MAAM,MA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C,SAAS;gBACX,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;YAC9C,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBACxC,MAAM,cAAc,CAAC,SAAS,CAAC,CAAA;YACjC,CAAC;YACD,aAAa,KAAK,8BAA8B,CAAC,GAAG,CAAC,CAAA;YACrD,MAAM,SAAS,GAAG,MAAM,aAAa,CAAA;YACrC,OAAO;gBACL,GAAG,QAAQ;gBACX,cAAc,EAAE,SAAS,CAAC,QAAQ,CAAC,IAAI,IAAI,GAAG,EAAE;aACjD,CAAA;QACH,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,EAChB,YAAY,EACZ,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,SAAS,EACV;YACC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAA;YAC7D,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC3C,MAAM,0BAA0B,CAAC;oBAC/B,UAAU,EAAE,IAAI;oBAChB,sBAAsB;oBACtB,0BAA0B;oBAC1B,SAAS;iBACV,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;KACF,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -3,26 +3,33 @@
3
3
  */
4
4
  /**
5
5
  * The account-document reading conventions every reader shares, in one place:
6
- * how a verification relation resolves (string references into
7
- * `verificationMethod`, embedded methods verbatim), which
8
- * `capabilityDelegation` members are ladder VMs, and which `keyAgreement`
9
- * methods are the account's credential inventory.
6
+ * which `capabilityDelegation` members are ladder VMs, which `keyAgreement`
7
+ * methods are the account's credential inventory, and which key multibases
8
+ * the two account-document key classes (the enrolled clients' signing keys,
9
+ * the ladder VMs' keys) publish. How a verification relation resolves, and
10
+ * which key multibase a relation member names, are the generic rules every
11
+ * consumer of the stack shares; they come from `@interop/vh-resource-log`
12
+ * and are re-exported here under the names this module always had.
10
13
  *
11
14
  * Each of those rules is a wire-level convention of the account document, so
12
15
  * a second implementation of one is a place the readers can disagree: the
13
16
  * ceremony-tail license's inventory comparison and the client listing's
14
17
  * ladder-VM recognition must answer identically over the same document, and
15
18
  * so must the roster's recipient resolver and the client listing's marker
16
- * filter. They are consumers of the readers here rather than re-readings of
19
+ * filter, and so must the ladder-rung attribution and the account's did:key
20
+ * census. They are consumers of the readers here rather than re-readings of
17
21
  * the document.
18
22
  *
19
- * Deliberately dependency-light -- it imports nothing at all -- so both the
20
- * layer-0 controller adapter beside it and the `webvh` and `keys` layers
21
- * above can share the readers without pulling the ceremony or signing graph.
22
- * Its public home is `@interop/wallet-core/webvh`, which re-exports the
23
- * `keyAgreement` readers and the ladder recognition; this subpath exports
24
- * none of them, so each name has one owner.
23
+ * Deliberately dependency-light -- it imports only the resource-log library
24
+ * the layer beside it already sits over -- so both the layer-0 controller
25
+ * adapter and the `webvh` and `keys` layers above can share the readers
26
+ * without pulling the ceremony or signing graph. Its public home is
27
+ * `@interop/wallet-core/webvh`, which re-exports the `keyAgreement` readers,
28
+ * the ladder recognition, and the two key-class readers; this subpath
29
+ * exports none of them, so each name has one owner.
25
30
  */
31
+ import { relationIds, resolvedRelationMethods, type ControllerDocument, type VerificationRelation } from '@interop/vh-resource-log';
32
+ export { relationIds, resolvedRelationMethods };
26
33
  /**
27
34
  * The materialized shape the relation readers return: a verification method
28
35
  * carrying either the key itself (`publicKeyMultibase`) or, for a
@@ -49,17 +56,12 @@ export interface ResolvedKeyAgreementMethod {
49
56
  }
50
57
  /**
51
58
  * A locally verified did:webvh document, read for the verification relations
52
- * it publishes and the methods they resolve to. Structural on purpose: a
53
- * resolved `DIDDoc` satisfies it, and so does any narrower document shape a
54
- * wallet already holds.
59
+ * it publishes and the methods they resolve to: the library's
60
+ * `ControllerDocument` over this module's method shape. Structural on
61
+ * purpose: a resolved `DIDDoc` satisfies it, and so does any narrower
62
+ * document shape a wallet already holds.
55
63
  */
56
- export interface AccountDocument {
57
- verificationMethod?: ResolvedKeyAgreementMethod[];
58
- assertionMethod?: Array<string | ResolvedKeyAgreementMethod>;
59
- keyAgreement?: Array<string | ResolvedKeyAgreementMethod>;
60
- capabilityInvocation?: Array<string | ResolvedKeyAgreementMethod>;
61
- capabilityDelegation?: Array<string | ResolvedKeyAgreementMethod>;
62
- }
64
+ export type AccountDocument = ControllerDocument<ResolvedKeyAgreementMethod>;
63
65
  /**
64
66
  * The document shape the `keyAgreement` readers take, kept as the published
65
67
  * name the `webvh` and `keys` subpaths surface. It is {@link AccountDocument}
@@ -70,33 +72,7 @@ export type KeyAgreementDocument = AccountDocument;
70
72
  /**
71
73
  * The verification relations a document reader may resolve.
72
74
  */
73
- export type DocumentRelation = Exclude<keyof AccountDocument, 'verificationMethod'>;
74
- /**
75
- * The relationship references of a resolved document as verification-method
76
- * ids, tolerating embedded objects beside string references.
77
- *
78
- * @param relation {Array} the relationship array, when present
79
- * @returns {string[]}
80
- */
81
- export declare function relationIds(relation: Array<string | {
82
- id?: string;
83
- }> | undefined): string[];
84
- /**
85
- * The verification methods one relation publishes, materialized: string
86
- * references resolved against `verificationMethod` (a reference nothing backs
87
- * is dropped), embedded methods taken verbatim. Document order is preserved,
88
- * and nothing is filtered -- deciding which of these methods belongs to whom
89
- * is each caller's own rule.
90
- *
91
- * @param options {object}
92
- * @param options.doc {AccountDocument} a locally verified document
93
- * @param options.relation {DocumentRelation} the relation to resolve
94
- * @returns {ResolvedKeyAgreementMethod[]}
95
- */
96
- export declare function resolvedRelationMethods({ doc, relation }: {
97
- doc: AccountDocument;
98
- relation: DocumentRelation;
99
- }): ResolvedKeyAgreementMethod[];
75
+ export type DocumentRelation = VerificationRelation;
100
76
  /**
101
77
  * The `keyAgreement` verification methods a document publishes, materialized:
102
78
  * string references resolved against `verificationMethod` (a reference nothing
@@ -212,12 +188,16 @@ export declare function ladderVmIds({ doc }: {
212
188
  * The ladder VMs' verification methods, materialized: the
213
189
  * `capabilityDelegation` methods {@link ladderVmIds} names, resolved the way
214
190
  * every other relation read resolves. Recognition therefore has exactly one
215
- * definition -- a reader needing the ladder keys themselves (their
216
- * `publicKeyMultibase`) asks here rather than re-deriving the asymmetry.
191
+ * definition -- a reader needing the ladder VMs' resolved methods asks here
192
+ * rather than re-deriving the asymmetry. A reader needing the ladder KEYS
193
+ * asks {@link ladderVmKeyMultibases} instead, which applies the library's one
194
+ * key-multibase rule; this reader hands back the methods as resolved, with no
195
+ * fragment check.
217
196
  *
218
197
  * A method the recognition cannot name -- an embedded `capabilityDelegation`
219
- * entry carrying no `id`, or a reference nothing backs -- is not a ladder VM
220
- * here, the same refuse-not-guess answer the id-keyed recognition gives.
198
+ * entry carrying no `id`, or a reference nothing backs -- has no resolved
199
+ * method here, the same refuse-not-guess answer the id-keyed recognition
200
+ * gives. (The key reader names such a reference's key by fragment alone.)
221
201
  *
222
202
  * @param options {object}
223
203
  * @param options.doc {AccountDocument} a locally verified document
@@ -226,4 +206,41 @@ export declare function ladderVmIds({ doc }: {
226
206
  export declare function ladderVmMethods({ doc }: {
227
207
  doc: AccountDocument;
228
208
  }): ResolvedKeyAgreementMethod[];
209
+ /**
210
+ * The enrolled clients' signing-key multibases a document publishes: the
211
+ * keys of its `capabilityInvocation` members, which is the relation an
212
+ * enrolled client publishes its signing key under and a ladder VM, a
213
+ * credential's key-agreement key, a transient annex VM, and the KMS
214
+ * convenience key deliberately do not (`enrolledClientVmIds` is the same
215
+ * convention read as ids). Each member is read under the library's one
216
+ * key-multibase rule (`memberKeyMultibase`): its id fragment and its
217
+ * resolved method's `publicKeyMultibase` must agree when both are present,
218
+ * either alone is the key, and a member whose two readings disagree names no
219
+ * key. The ladder-rung attribution and the account's did:key census both read
220
+ * this set, so a malformed member drops out of both rather than naming a
221
+ * different key in each.
222
+ *
223
+ * @param options {object}
224
+ * @param options.doc {AccountDocument} a locally verified document
225
+ * @returns {Set<string>}
226
+ */
227
+ export declare function enrolledClientKeyMultibases({ doc }: {
228
+ doc: AccountDocument;
229
+ }): Set<string>;
230
+ /**
231
+ * The ladder VMs' key multibases a document publishes: the keys of the
232
+ * `capabilityDelegation` members {@link ladderVmIds} recognizes, each read
233
+ * under the same one key-multibase rule as
234
+ * {@link enrolledClientKeyMultibases}. Recognition stays id-keyed, so an
235
+ * id-less embedded delegation member is not a ladder VM here either; a
236
+ * recognized member that is a reference nothing backs names its key by
237
+ * fragment alone.
238
+ *
239
+ * @param options {object}
240
+ * @param options.doc {AccountDocument} a locally verified document
241
+ * @returns {Set<string>}
242
+ */
243
+ export declare function ladderVmKeyMultibases({ doc }: {
244
+ doc: AccountDocument;
245
+ }): Set<string>;
229
246
  //# sourceMappingURL=document.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/resourceLog/document.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,0BAA0B;IACzC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,kBAAkB,CAAC,EAAE,0BAA0B,EAAE,CAAA;IACjD,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,0BAA0B,CAAC,CAAA;IAC5D,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,0BAA0B,CAAC,CAAA;IACzD,oBAAoB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,0BAA0B,CAAC,CAAA;IACjE,oBAAoB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,0BAA0B,CAAC,CA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