@interop/wallet-core 0.12.0 → 0.13.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.
- package/README.md +8 -4
- package/dist/enrollment/enrollment.d.ts +35 -1
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +31 -51
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/keys/index.d.ts +11 -4
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +11 -4
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/pukRoster.d.ts +65 -0
- package/dist/keys/pukRoster.d.ts.map +1 -1
- package/dist/keys/pukRoster.js +97 -0
- package/dist/keys/pukRoster.js.map +1 -1
- package/dist/keys/wasLabelsStore.d.ts +26 -0
- package/dist/keys/wasLabelsStore.d.ts.map +1 -0
- package/dist/keys/wasLabelsStore.js +27 -0
- package/dist/keys/wasLabelsStore.js.map +1 -0
- package/dist/webvh/index.d.ts +7 -0
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +7 -0
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/revokeClient.d.ts +7 -1
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +7 -3
- package/dist/webvh/revokeClient.js.map +1 -1
- package/dist/webvh/verifyLog.d.ts +37 -0
- package/dist/webvh/verifyLog.d.ts.map +1 -0
- package/dist/webvh/verifyLog.js +75 -0
- package/dist/webvh/verifyLog.js.map +1 -0
- package/dist/webvh/wasIdStore.d.ts +34 -0
- package/dist/webvh/wasIdStore.d.ts.map +1 -0
- package/dist/webvh/wasIdStore.js +43 -0
- package/dist/webvh/wasIdStore.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,8 +66,10 @@ The subpaths:
|
|
|
66
66
|
entries, the one-entry client-revocation edit (verification methods, update
|
|
67
67
|
key, and standing commitments out in a single entry, the staged commitment
|
|
68
68
|
recovered by log attribution), the enrolled-client listing over a
|
|
69
|
-
caller-verified log (for a "your wallets" surface),
|
|
70
|
-
|
|
69
|
+
caller-verified log (for a "your wallets" surface), the
|
|
70
|
+
fetch-and-verify-the-published-log step those ceremonies share, the WAS-backed
|
|
71
|
+
store they write through, and ZCap signing under the did:webvh
|
|
72
|
+
verification-method id.
|
|
71
73
|
|
|
72
74
|
- **`@interop/wallet-core/keys`** -- the per-user key (PUK) and its
|
|
73
75
|
`key-map/puk.json` wrap-set roster: minting, the roster's init/read/rotate
|
|
@@ -75,8 +77,10 @@ The subpaths:
|
|
|
75
77
|
pin, the document-backed recipient resolver), the roster's compare-and-swap
|
|
76
78
|
descriptor store, and the PUK rotation cascade's per-collection op (re-epoch a
|
|
77
79
|
collection onto the roster's current PUK, staleness detected from durable
|
|
78
|
-
state alone, history escrowed -- also the completion sweep's building block)
|
|
79
|
-
|
|
80
|
+
state alone, history escrowed -- also the completion sweep's building block),
|
|
81
|
+
plus the detector that converges a roster left wrapping the current key to a
|
|
82
|
+
recipient the account document no longer keys. Also the enrolled-client
|
|
83
|
+
display labels (`key-map/client-labels.json`) and their WAS-backed store.
|
|
80
84
|
|
|
81
85
|
- **`@interop/wallet-core/descriptors`** -- collection encryption-descriptor
|
|
82
86
|
acquisition (fetch / cache / offline fallback) and the unknown-epoch refresh
|
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The client enrollment ceremony: connecting a second wallet client (a fresh
|
|
6
|
+
* browser profile, another app install) to an existing account without any
|
|
7
|
+
* secret ever leaving either side. The new client mints its whole key set
|
|
8
|
+
* locally -- client seed, did:webvh update-key seeds -- and only PUBLIC halves
|
|
9
|
+
* travel, as a compact "connect code" carried point-to-point (pasted between
|
|
10
|
+
* two browsers in the room today; the same payload renders as a QR for a
|
|
11
|
+
* camera-holding wallet). Nothing travels back over the channel: the account
|
|
12
|
+
* pointer comes out of the keyring (the enrollee holds the unlock secret), and
|
|
13
|
+
* the PUK comes back through the wrap-set roster.
|
|
14
|
+
*
|
|
15
|
+
* Push, not pull, in the recovery-anchor order (decryption material before
|
|
16
|
+
* authorization): the enrolling client wraps the PUK to the new client's
|
|
17
|
+
* key-agreement key in `key-map/puk.json` FIRST, then writes the two
|
|
18
|
+
* did:webvh log entries (commit, then add-VMs-and-update-key). No
|
|
19
|
+
* authorized-but-blind window exists at any point, and both tear points
|
|
20
|
+
* resume by re-running the ceremony with the same code -- a tear after the
|
|
21
|
+
* roster write leaves an orphan wrap (invisible to authorization), a tear
|
|
22
|
+
* between the log entries is detected from the published commitments.
|
|
23
|
+
*
|
|
24
|
+
* The new client's first roster read happens post-enrollment, signed with its
|
|
25
|
+
* `<did:webvh>#<multibase>` key -- the server authorizes it under the
|
|
26
|
+
* current-key-set rule the moment the add entry publishes. Persisting the key
|
|
27
|
+
* set under the app's own unlock layer is the caller's job: this module hands
|
|
28
|
+
* back the PUK and the roster epoch to pin, and stops there.
|
|
29
|
+
*/
|
|
1
30
|
import type { IKeyAgreementKey } from '@interop/data-integrity-core';
|
|
2
31
|
import type { EncryptionDescriptorStore } from '@interop/was-client/edv';
|
|
3
32
|
import type { ClientWebvhUpdateKeys, WebvhEnrollmentKeys, WebvhIdStore } from '../webvh/didWebvh.js';
|
|
@@ -98,7 +127,10 @@ export declare function mintEnrollmentRequest(): Promise<{
|
|
|
98
127
|
* @param options.pukRosterStore {EncryptionDescriptorStore} the account's
|
|
99
128
|
* `key-map/puk.json` descriptor store
|
|
100
129
|
* @param options.idStore {WebvhIdStore} the account's `id` collection
|
|
101
|
-
* @returns {Promise<
|
|
130
|
+
* @returns {Promise<object>} the account's did:webvh, plus the enrollee's
|
|
131
|
+
* own identity as this call already knows it: its did:key and its signing-key
|
|
132
|
+
* multibase (the key a label or a listing row is filed under), so the caller
|
|
133
|
+
* needs no second parse of the connect code
|
|
102
134
|
*/
|
|
103
135
|
export declare function approveEnrollment({ request, clientWebvhKeys, clientKeyAgreementKey, pukRosterStore, idStore }: {
|
|
104
136
|
request: EnrollmentRequest;
|
|
@@ -108,6 +140,8 @@ export declare function approveEnrollment({ request, clientWebvhKeys, clientKeyA
|
|
|
108
140
|
idStore: WebvhIdStore;
|
|
109
141
|
}): Promise<{
|
|
110
142
|
did: string;
|
|
143
|
+
clientDid: string;
|
|
144
|
+
signingKeyMultibase: string;
|
|
111
145
|
}>;
|
|
112
146
|
/**
|
|
113
147
|
* ENROLLEE, step two (after the other client approves): verifies the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrollment.d.ts","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"enrollment.d.ts","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAQxE,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAU7B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAa1D;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,CAAA;AAEnD;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;gBAE7C,OAAO,SAC+C;CAKzD;AASD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,OAAO,EACR,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAA;CAC3B,GAAG,MAAM,CAKT;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,IAA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AAM,CAAA;CAAE,CAAC,CA8D/C"}
|
|
@@ -1,40 +1,10 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The client enrollment ceremony: connecting a second wallet client (a fresh
|
|
6
|
-
* browser profile, another app install) to an existing account without any
|
|
7
|
-
* secret ever leaving either side. The new client mints its whole key set
|
|
8
|
-
* locally -- client seed, did:webvh update-key seeds -- and only PUBLIC halves
|
|
9
|
-
* travel, as a compact "connect code" carried point-to-point (pasted between
|
|
10
|
-
* two browsers in the room today; the same payload renders as a QR for a
|
|
11
|
-
* camera-holding wallet). Nothing travels back over the channel: the account
|
|
12
|
-
* pointer comes out of the keyring (the enrollee holds the unlock secret), and
|
|
13
|
-
* the PUK comes back through the wrap-set roster.
|
|
14
|
-
*
|
|
15
|
-
* Push, not pull, in the recovery-anchor order (decryption material before
|
|
16
|
-
* authorization): the enrolling client wraps the PUK to the new client's
|
|
17
|
-
* key-agreement key in `key-map/puk.json` FIRST, then writes the two
|
|
18
|
-
* did:webvh log entries (commit, then add-VMs-and-update-key). No
|
|
19
|
-
* authorized-but-blind window exists at any point, and both tear points
|
|
20
|
-
* resume by re-running the ceremony with the same code -- a tear after the
|
|
21
|
-
* roster write leaves an orphan wrap (invisible to authorization), a tear
|
|
22
|
-
* between the log entries is detected from the published commitments.
|
|
23
|
-
*
|
|
24
|
-
* The new client's first roster read happens post-enrollment, signed with its
|
|
25
|
-
* `<did:webvh>#<multibase>` key -- the server authorizes it under the
|
|
26
|
-
* current-key-set rule the moment the add entry publishes. Persisting the key
|
|
27
|
-
* set under the app's own unlock layer is the caller's job: this module hands
|
|
28
|
-
* back the PUK and the roster epoch to pin, and stops there.
|
|
29
|
-
*/
|
|
30
|
-
import { readLogFromString, resolveDIDFromLog } from '@interop/did-method-webvh';
|
|
31
1
|
import { base64urlnopad } from '@scure/base';
|
|
32
2
|
import { agentsFromSeed } from '../identity/agents.js';
|
|
33
|
-
import { DID_LOG_RESOURCE, ID_COLLECTION } from '../space/collections.js';
|
|
34
3
|
import { enrollWebvhClient, mintClientWebvhUpdateKeys, updateKeyMultibase } from '../webvh/didWebvh.js';
|
|
35
4
|
import { clientSigningKeyMultibase, isWebvhDid, webvhZcapClient } from '../webvh/zcap.js';
|
|
5
|
+
import { AccountLogMissingError, verifyAccountLog } from '../webvh/verifyLog.js';
|
|
36
6
|
import { addPukRosterRecipient } from '../keys/pukRoster.js';
|
|
37
|
-
import { readPukRoster } from '../keys/pukRoster.js';
|
|
7
|
+
import { readPukRoster, rosterRecipientKid } from '../keys/pukRoster.js';
|
|
38
8
|
import { pukRosterDescriptorStore } from '../keys/rosterStore.js';
|
|
39
9
|
/**
|
|
40
10
|
* The connect-code prefix; the payload after it is base64url(JSON) of an
|
|
@@ -139,7 +109,10 @@ export function enrollmentClientDid({ request }) {
|
|
|
139
109
|
* @returns {string}
|
|
140
110
|
*/
|
|
141
111
|
export function enrollmentRecipientKid({ request }) {
|
|
142
|
-
return
|
|
112
|
+
return rosterRecipientKid({
|
|
113
|
+
signingKeyMultibase: request.signingKeyMultibase,
|
|
114
|
+
keyAgreementKeyMultibase: request.keyAgreementKeyMultibase
|
|
115
|
+
});
|
|
143
116
|
}
|
|
144
117
|
/**
|
|
145
118
|
* ENROLLEE, step one: mints the new client's whole key set locally and
|
|
@@ -195,7 +168,10 @@ export async function mintEnrollmentRequest() {
|
|
|
195
168
|
* @param options.pukRosterStore {EncryptionDescriptorStore} the account's
|
|
196
169
|
* `key-map/puk.json` descriptor store
|
|
197
170
|
* @param options.idStore {WebvhIdStore} the account's `id` collection
|
|
198
|
-
* @returns {Promise<
|
|
171
|
+
* @returns {Promise<object>} the account's did:webvh, plus the enrollee's
|
|
172
|
+
* own identity as this call already knows it: its did:key and its signing-key
|
|
173
|
+
* multibase (the key a label or a listing row is filed under), so the caller
|
|
174
|
+
* needs no second parse of the connect code
|
|
199
175
|
*/
|
|
200
176
|
export async function approveEnrollment({ request, clientWebvhKeys, clientKeyAgreementKey, pukRosterStore, idStore }) {
|
|
201
177
|
// Decryption material before authorization: the wrap lands first, so no
|
|
@@ -208,11 +184,16 @@ export async function approveEnrollment({ request, clientWebvhKeys, clientKeyAgr
|
|
|
208
184
|
},
|
|
209
185
|
ownerKeyAgreementKey: clientKeyAgreementKey
|
|
210
186
|
});
|
|
211
|
-
|
|
187
|
+
const { did } = await enrollWebvhClient({
|
|
212
188
|
idStore,
|
|
213
189
|
updateKeys: clientWebvhKeys,
|
|
214
190
|
newClient: request
|
|
215
191
|
});
|
|
192
|
+
return {
|
|
193
|
+
did,
|
|
194
|
+
clientDid: enrollmentClientDid({ request }),
|
|
195
|
+
signingKeyMultibase: request.signingKeyMultibase
|
|
196
|
+
};
|
|
216
197
|
}
|
|
217
198
|
/**
|
|
218
199
|
* ENROLLEE, step two (after the other client approves): verifies the
|
|
@@ -249,28 +230,27 @@ export async function completeEnrollmentCore({ clientSeed, webvhUpdateKeys, poin
|
|
|
249
230
|
});
|
|
250
231
|
// Verify the enrollment from the world-readable, self-certifying log: it
|
|
251
232
|
// must resolve to exactly the DID the account pointer names, and its
|
|
252
|
-
// document must list this client's keys -- the add entry has published.
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const resolved = await resolveDIDFromLog(readLogFromString(await response.text()));
|
|
262
|
-
if (resolved.meta.error || !resolved.did || !resolved.doc) {
|
|
263
|
-
throw new Error(`The account's DID log failed to resolve (${resolved.meta.error}).`);
|
|
233
|
+
// document must list this client's keys -- the add entry has published. An
|
|
234
|
+
// absent log is the same "not yet" state as an unpublished add entry.
|
|
235
|
+
let verified;
|
|
236
|
+
try {
|
|
237
|
+
verified = await verifyAccountLog({
|
|
238
|
+
did,
|
|
239
|
+
spaceId: pointer.spaceId,
|
|
240
|
+
host: pointer.host
|
|
241
|
+
});
|
|
264
242
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
243
|
+
catch (err) {
|
|
244
|
+
if (err instanceof AccountLogMissingError) {
|
|
245
|
+
throw new EnrollmentPendingError();
|
|
246
|
+
}
|
|
247
|
+
throw err;
|
|
268
248
|
}
|
|
269
249
|
const signingMultibase = clientSigningKeyMultibase({ keyAgent });
|
|
270
250
|
const updateKey = await updateKeyMultibase({
|
|
271
251
|
seed: webvhUpdateKeys.updateSeed
|
|
272
252
|
});
|
|
273
|
-
const enrolled = (
|
|
253
|
+
const enrolled = (verified.doc.verificationMethod ?? []).some(method => method.publicKeyMultibase === signingMultibase) && verified.updateKeys.includes(updateKey);
|
|
274
254
|
if (!enrolled) {
|
|
275
255
|
throw new EnrollmentPendingError();
|
|
276
256
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrollment.js","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"enrollment.js","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,sBAAsB,CAAA;AAM7B,OAAO,EACL,yBAAyB,EACzB,UAAU,EACV,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AAIjE;;;GAGG;AACH,MAAM,mBAAmB,GAAG,qBAAqB,CAAA;A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
|
|
17
17
|
* - `pukRosterDescriptorStore` -- that descriptor store, built from a bare
|
|
18
18
|
* signing client for the login-time direct read.
|
|
19
|
-
* - `
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* - `rosterRecipientKid` -- the one builder of a client's roster kid, shared by
|
|
20
|
+
* the enrollment wrap, the roster read, and the rotation that retires it.
|
|
21
|
+
* - `convergePukRosterToDocument` -- the standing detector for a revocation
|
|
22
|
+
* cascade torn between the document edit and the roster rotation: a roster
|
|
23
|
+
* recipient the document no longer keys is rotated away from.
|
|
24
|
+
* - `readClientLabels` / `setClientLabel` / `removeClientLabel` /
|
|
25
|
+
* `wasClientLabelsStore` -- the enrolled-client display labels
|
|
26
|
+
* (`key-map/client-labels.json`), the record a "your wallets" surface names
|
|
27
|
+
* clients from, and the WAS-backed store they run through.
|
|
22
28
|
* - `rotatePukRoster` / `unwrapPukGenerations` / `rotateCollectionEpochsToPuk`
|
|
23
29
|
* / `cascadeCollectionsToPuk` / `pukAsRecipient` -- the PUK rotation
|
|
24
30
|
* cascade: the roster rotation off a revoked recipient, the per-collection
|
|
@@ -28,11 +34,12 @@
|
|
|
28
34
|
*/
|
|
29
35
|
export { mintPuk, pukVaultKeys } from './puk.js';
|
|
30
36
|
export type { Puk } from './puk.js';
|
|
31
|
-
export { addPukRosterRecipient, ensurePukRoster, PukRosterContinuityError, PukRosterIntegrityError, PukRosterUnwrapError, pukRosterRecipientResolver, readPukRoster, rotatePukRoster } from './pukRoster.js';
|
|
37
|
+
export { addPukRosterRecipient, convergePukRosterToDocument, ensurePukRoster, PukRosterContinuityError, PukRosterIntegrityError, PukRosterUnwrapError, pukRosterRecipientResolver, readPukRoster, rosterRecipientKid, rotatePukRoster } from './pukRoster.js';
|
|
32
38
|
export { cascadeCollectionsToPuk, pukAsRecipient, rotateCollectionEpochsToPuk, unwrapPukGenerations } from './pukCascade.js';
|
|
33
39
|
export type { CollectionPukRotationOutcome, PukCascadeResult } from './pukCascade.js';
|
|
34
40
|
export type { PukRosterReadResult, RosterRecipientDocument } from './pukRoster.js';
|
|
35
41
|
export { pukRosterDescriptorStore } from './rosterStore.js';
|
|
36
42
|
export { readClientLabels, removeClientLabel, setClientLabel } from './clientLabels.js';
|
|
37
43
|
export type { ClientLabelsRecord, ClientLabelsStore } from './clientLabels.js';
|
|
44
|
+
export { wasClientLabelsStore } from './wasLabelsStore.js';
|
|
38
45
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/keys/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAChD,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,EAClB,eAAe,EAChB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,2BAA2B,EAC3B,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,4BAA4B,EAC5B,gBAAgB,EACjB,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAE3D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACf,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/keys/index.js
CHANGED
|
@@ -16,9 +16,15 @@
|
|
|
16
16
|
* document).
|
|
17
17
|
* - `pukRosterDescriptorStore` -- that descriptor store, built from a bare
|
|
18
18
|
* signing client for the login-time direct read.
|
|
19
|
-
* - `
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* - `rosterRecipientKid` -- the one builder of a client's roster kid, shared by
|
|
20
|
+
* the enrollment wrap, the roster read, and the rotation that retires it.
|
|
21
|
+
* - `convergePukRosterToDocument` -- the standing detector for a revocation
|
|
22
|
+
* cascade torn between the document edit and the roster rotation: a roster
|
|
23
|
+
* recipient the document no longer keys is rotated away from.
|
|
24
|
+
* - `readClientLabels` / `setClientLabel` / `removeClientLabel` /
|
|
25
|
+
* `wasClientLabelsStore` -- the enrolled-client display labels
|
|
26
|
+
* (`key-map/client-labels.json`), the record a "your wallets" surface names
|
|
27
|
+
* clients from, and the WAS-backed store they run through.
|
|
22
28
|
* - `rotatePukRoster` / `unwrapPukGenerations` / `rotateCollectionEpochsToPuk`
|
|
23
29
|
* / `cascadeCollectionsToPuk` / `pukAsRecipient` -- the PUK rotation
|
|
24
30
|
* cascade: the roster rotation off a revoked recipient, the per-collection
|
|
@@ -27,8 +33,9 @@
|
|
|
27
33
|
* names (also the completion sweep's driver).
|
|
28
34
|
*/
|
|
29
35
|
export { mintPuk, pukVaultKeys } from './puk.js';
|
|
30
|
-
export { addPukRosterRecipient, ensurePukRoster, PukRosterContinuityError, PukRosterIntegrityError, PukRosterUnwrapError, pukRosterRecipientResolver, readPukRoster, rotatePukRoster } from './pukRoster.js';
|
|
36
|
+
export { addPukRosterRecipient, convergePukRosterToDocument, ensurePukRoster, PukRosterContinuityError, PukRosterIntegrityError, PukRosterUnwrapError, pukRosterRecipientResolver, readPukRoster, rosterRecipientKid, rotatePukRoster } from './pukRoster.js';
|
|
31
37
|
export { cascadeCollectionsToPuk, pukAsRecipient, rotateCollectionEpochsToPuk, unwrapPukGenerations } from './pukCascade.js';
|
|
32
38
|
export { pukRosterDescriptorStore } from './rosterStore.js';
|
|
33
39
|
export { readClientLabels, removeClientLabel, setClientLabel } from './clientLabels.js';
|
|
40
|
+
export { wasClientLabelsStore } from './wasLabelsStore.js';
|
|
34
41
|
//# sourceMappingURL=index.js.map
|
package/dist/keys/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGhD,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,EAClB,eAAe,EAChB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,2BAA2B,EAC3B,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;AAUxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAE3D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACf,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/keys/pukRoster.d.ts
CHANGED
|
@@ -89,6 +89,24 @@ export interface RosterRecipientDocument {
|
|
|
89
89
|
publicKeyMultibase?: string;
|
|
90
90
|
}>;
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* A wallet client's roster kid: its key-agreement key's id exactly as
|
|
94
|
+
* `agentsFromSeed` derives it at the client's own logins
|
|
95
|
+
* (`did:key:<ed-multibase>#<x-multibase>`). One builder for the whole
|
|
96
|
+
* lifecycle -- the wrap the enrollment ceremony mints, the entry a roster read
|
|
97
|
+
* looks for, and the recipient a rotation retires are the same string by
|
|
98
|
+
* construction rather than by three copies agreeing.
|
|
99
|
+
*
|
|
100
|
+
* @param options {object}
|
|
101
|
+
* @param options.signingKeyMultibase {string} the client's Ed25519 signing
|
|
102
|
+
* key
|
|
103
|
+
* @param options.keyAgreementKeyMultibase {string} its X25519 twin
|
|
104
|
+
* @returns {string}
|
|
105
|
+
*/
|
|
106
|
+
export declare function rosterRecipientKid({ signingKeyMultibase, keyAgreementKeyMultibase }: {
|
|
107
|
+
signingKeyMultibase: string;
|
|
108
|
+
keyAgreementKeyMultibase: string;
|
|
109
|
+
}): string;
|
|
92
110
|
/**
|
|
93
111
|
* Builds the recipient resolver for roster rotations, backed by a locally
|
|
94
112
|
* verified did:webvh document -- the enforcement point for "the roster
|
|
@@ -185,6 +203,53 @@ export declare function rotatePukRoster({ store, document, retireRecipientId }:
|
|
|
185
203
|
document: RosterRecipientDocument;
|
|
186
204
|
retireRecipientId: string;
|
|
187
205
|
}): Promise<CollectionEncryption>;
|
|
206
|
+
/**
|
|
207
|
+
* Converges the roster onto the account document: the standing detector for a
|
|
208
|
+
* revocation cascade torn between its two halves. The cascade edits the
|
|
209
|
+
* document first and rotates the roster second, so a client that crashes in
|
|
210
|
+
* between leaves a roster that keeps wrapping the CURRENT per-user key to a
|
|
211
|
+
* recipient the document no longer keys -- durable, silent, and permanent,
|
|
212
|
+
* since the revoked client's document edit will never be re-run.
|
|
213
|
+
*
|
|
214
|
+
* The detection is pure durable state: a current-epoch recipient the
|
|
215
|
+
* document-backed resolver cannot answer for is exactly a recipient the
|
|
216
|
+
* document no longer keys, so a healthy account reads the descriptor and
|
|
217
|
+
* writes nothing. When any such recipient is found the roster is rotated away
|
|
218
|
+
* from ALL of them at once -- a single {@link rotatePukRoster} suffices,
|
|
219
|
+
* because the resolver drops every unbacked entry from the fresh epoch, not
|
|
220
|
+
* just the one named as retiring.
|
|
221
|
+
*
|
|
222
|
+
* Rotating onto nobody is refused: a current epoch in which NO recipient is
|
|
223
|
+
* backed by the document is a mismatched pair (a stale document, the wrong
|
|
224
|
+
* account), not a cascade to finish, and completing it would lock every
|
|
225
|
+
* client out of the account.
|
|
226
|
+
*
|
|
227
|
+
* The fresh per-user key itself is not returned: the caller adopts it the
|
|
228
|
+
* ordinary way, by re-reading the roster ({@link readPukRoster}) once
|
|
229
|
+
* `rotated` says there is something to adopt, and then runs the collection
|
|
230
|
+
* fan-out.
|
|
231
|
+
*
|
|
232
|
+
* @param options {object}
|
|
233
|
+
* @param options.store {EncryptionDescriptorStore} the roster's descriptor
|
|
234
|
+
* store
|
|
235
|
+
* @param options.document {RosterRecipientDocument} the locally verified
|
|
236
|
+
* did:webvh document -- the recipient source of record
|
|
237
|
+
* @param [options.descriptor] {CollectionEncryption} a descriptor the caller
|
|
238
|
+
* has just read (a login-time roster read), to save a re-read; omitted, the
|
|
239
|
+
* roster is read fresh
|
|
240
|
+
* @returns {Promise<object>} whether the roster rotated on this call, the
|
|
241
|
+
* stale recipient kids found, and the roster descriptor as it now stands
|
|
242
|
+
* (`null` when the account has no roster yet)
|
|
243
|
+
*/
|
|
244
|
+
export declare function convergePukRosterToDocument({ store, document, descriptor }: {
|
|
245
|
+
store: EncryptionDescriptorStore;
|
|
246
|
+
document: RosterRecipientDocument;
|
|
247
|
+
descriptor?: CollectionEncryption;
|
|
248
|
+
}): Promise<{
|
|
249
|
+
rotated: boolean;
|
|
250
|
+
staleRecipientIds: string[];
|
|
251
|
+
descriptor: CollectionEncryption | null;
|
|
252
|
+
}>;
|
|
188
253
|
/**
|
|
189
254
|
* What a roster read resolves to: the authenticated descriptor, the current
|
|
190
255
|
* PUK (the cached one confirmed current, or a fresh one unwrapped from a
|
|
@@ -1 +1 @@
|
|
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E,oBAAoB,CAAA;CAClC,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,UAAU,EAAE,oBAAoB,GAAG,IAAI,CAAA;CACxC,CAAC,CAgDD;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,oBAAoB,CAAA;IAChC,GAAG,EAAE,GAAG,CAAA;IACR,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,aAAa,CAAC,EAClC,KAAK,EACL,GAAG,EACH,qBAAqB,EACrB,aAAa,EACd,EAAE;IACD,KAAK,EAAE,yBAAyB,CAAA;IAChC,GAAG,CAAC,EAAE,GAAG,CAAA;IACT,qBAAqB,EAAE,gBAAgB,CAAA;IACvC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CA0EtC"}
|
package/dist/keys/pukRoster.js
CHANGED
|
@@ -39,6 +39,23 @@ export class PukRosterUnwrapError extends Error {
|
|
|
39
39
|
this.name = 'PukRosterUnwrapError';
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* A wallet client's roster kid: its key-agreement key's id exactly as
|
|
44
|
+
* `agentsFromSeed` derives it at the client's own logins
|
|
45
|
+
* (`did:key:<ed-multibase>#<x-multibase>`). One builder for the whole
|
|
46
|
+
* lifecycle -- the wrap the enrollment ceremony mints, the entry a roster read
|
|
47
|
+
* looks for, and the recipient a rotation retires are the same string by
|
|
48
|
+
* construction rather than by three copies agreeing.
|
|
49
|
+
*
|
|
50
|
+
* @param options {object}
|
|
51
|
+
* @param options.signingKeyMultibase {string} the client's Ed25519 signing
|
|
52
|
+
* key
|
|
53
|
+
* @param options.keyAgreementKeyMultibase {string} its X25519 twin
|
|
54
|
+
* @returns {string}
|
|
55
|
+
*/
|
|
56
|
+
export function rosterRecipientKid({ signingKeyMultibase, keyAgreementKeyMultibase }) {
|
|
57
|
+
return `did:key:${signingKeyMultibase}#${keyAgreementKeyMultibase}`;
|
|
58
|
+
}
|
|
42
59
|
/**
|
|
43
60
|
* The fragment after the last `#` of a key/VM id -- for the ids this roster
|
|
44
61
|
* handles (did:key KAK ids, `<did>#<multibase>` VM ids) that fragment is the
|
|
@@ -201,6 +218,86 @@ export async function rotatePukRoster({ store, document, retireRecipientId }) {
|
|
|
201
218
|
pull: async () => { }
|
|
202
219
|
});
|
|
203
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Converges the roster onto the account document: the standing detector for a
|
|
223
|
+
* revocation cascade torn between its two halves. The cascade edits the
|
|
224
|
+
* document first and rotates the roster second, so a client that crashes in
|
|
225
|
+
* between leaves a roster that keeps wrapping the CURRENT per-user key to a
|
|
226
|
+
* recipient the document no longer keys -- durable, silent, and permanent,
|
|
227
|
+
* since the revoked client's document edit will never be re-run.
|
|
228
|
+
*
|
|
229
|
+
* The detection is pure durable state: a current-epoch recipient the
|
|
230
|
+
* document-backed resolver cannot answer for is exactly a recipient the
|
|
231
|
+
* document no longer keys, so a healthy account reads the descriptor and
|
|
232
|
+
* writes nothing. When any such recipient is found the roster is rotated away
|
|
233
|
+
* from ALL of them at once -- a single {@link rotatePukRoster} suffices,
|
|
234
|
+
* because the resolver drops every unbacked entry from the fresh epoch, not
|
|
235
|
+
* just the one named as retiring.
|
|
236
|
+
*
|
|
237
|
+
* Rotating onto nobody is refused: a current epoch in which NO recipient is
|
|
238
|
+
* backed by the document is a mismatched pair (a stale document, the wrong
|
|
239
|
+
* account), not a cascade to finish, and completing it would lock every
|
|
240
|
+
* client out of the account.
|
|
241
|
+
*
|
|
242
|
+
* The fresh per-user key itself is not returned: the caller adopts it the
|
|
243
|
+
* ordinary way, by re-reading the roster ({@link readPukRoster}) once
|
|
244
|
+
* `rotated` says there is something to adopt, and then runs the collection
|
|
245
|
+
* fan-out.
|
|
246
|
+
*
|
|
247
|
+
* @param options {object}
|
|
248
|
+
* @param options.store {EncryptionDescriptorStore} the roster's descriptor
|
|
249
|
+
* store
|
|
250
|
+
* @param options.document {RosterRecipientDocument} the locally verified
|
|
251
|
+
* did:webvh document -- the recipient source of record
|
|
252
|
+
* @param [options.descriptor] {CollectionEncryption} a descriptor the caller
|
|
253
|
+
* has just read (a login-time roster read), to save a re-read; omitted, the
|
|
254
|
+
* roster is read fresh
|
|
255
|
+
* @returns {Promise<object>} whether the roster rotated on this call, the
|
|
256
|
+
* stale recipient kids found, and the roster descriptor as it now stands
|
|
257
|
+
* (`null` when the account has no roster yet)
|
|
258
|
+
*/
|
|
259
|
+
export async function convergePukRosterToDocument({ store, document, descriptor }) {
|
|
260
|
+
let roster = descriptor;
|
|
261
|
+
if (!roster) {
|
|
262
|
+
const read = await store.read();
|
|
263
|
+
if (read === null) {
|
|
264
|
+
return { rotated: false, staleRecipientIds: [], descriptor: null };
|
|
265
|
+
}
|
|
266
|
+
roster = read.descriptor;
|
|
267
|
+
}
|
|
268
|
+
const currentEpochId = roster.currentEpoch;
|
|
269
|
+
const currentEpoch = (roster.epochs ?? []).find(epoch => epoch.id === currentEpochId);
|
|
270
|
+
if (!currentEpoch) {
|
|
271
|
+
throw new PukRosterIntegrityError('The PUK roster names no current epoch in its own epoch list.');
|
|
272
|
+
}
|
|
273
|
+
const resolveRecipientKey = pukRosterRecipientResolver({ document });
|
|
274
|
+
const staleRecipientIds = [];
|
|
275
|
+
let backed = 0;
|
|
276
|
+
for (const entry of currentEpoch.recipients) {
|
|
277
|
+
const kid = entry.header.kid;
|
|
278
|
+
if ((await resolveRecipientKey(kid)) === null) {
|
|
279
|
+
staleRecipientIds.push(kid);
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
backed++;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (staleRecipientIds.length === 0) {
|
|
286
|
+
return { rotated: false, staleRecipientIds, descriptor: roster };
|
|
287
|
+
}
|
|
288
|
+
if (backed === 0) {
|
|
289
|
+
throw new PukRosterIntegrityError('No PUK roster recipient is keyed by the account document; refusing ' +
|
|
290
|
+
'to rotate the roster onto no one.');
|
|
291
|
+
}
|
|
292
|
+
// One rotation retires them all: the fresh epoch is wrapped only to the
|
|
293
|
+
// recipients the resolver answers for.
|
|
294
|
+
const rotated = await rotatePukRoster({
|
|
295
|
+
store,
|
|
296
|
+
document,
|
|
297
|
+
retireRecipientId: staleRecipientIds[0]
|
|
298
|
+
});
|
|
299
|
+
return { rotated: true, staleRecipientIds, descriptor: rotated };
|
|
300
|
+
}
|
|
204
301
|
/**
|
|
205
302
|
* Reads and authenticates the roster -- the direct read at login and on epoch
|
|
206
303
|
* mismatch. Resolves `null` when the roster does not exist yet (an account
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pukRoster.js","sourceRoot":"","sources":["../../src/keys/pukRoster.ts"],"names":[],"mappings":"AA2CA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,eAAe,EAGhB,MAAM,yBAAyB,CAAA;AAGhC;;;;;GAKG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAA;IACvC,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,aAAa,CAAQ;IACrB,YAAY,EAAE,aAAa,EAA6B;QACtD,KAAK,CACH,uEAAuE;YACrE,mCAAmC,CACtC,CAAA;QACD,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;QACtC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;IACpC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC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C,MAAM,CAAC,GAAG,KAAK,qBAAqB,CAAC,EAAE,CAC/D,CAAA;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,oBAAoB,CAC5B,+DAA+D,CAChE,CAAA;QACH,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC;YACrC,KAAK;YACL,eAAe,EAAE,qBAAqB;SACvC,CAAC,CAAA;QACF,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,oBAAoB,CAC5B,kDAAkD,CACnD,CAAA;QACH,CAAC;QACD,UAAU,GAAG,EAAE,EAAE,EAAE,UAAU,CAAC,YAAa,EAAE,MAAM,EAAE,CAAA;QACrD,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC;IAED,IACE,CAAC,CAAC,MAAM,eAAe,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,EACxE,CAAC;QACD,MAAM,IAAI,uBAAuB,CAC/B,2DAA2D,CAC5D,CAAA;IACH,CAAC;IAED,OAAO;QACL,UAAU;QACV,GAAG,EAAE,UAAU;QACf,OAAO;QACP,aAAa,EAAE,UAAU,CAAC,YAAa;KACxC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The WAS-backed adapter for the enrolled-client display labels
|
|
6
|
+
* (`key-map/client-labels.json`): the {@link ClientLabelsStore} seam the label
|
|
7
|
+
* helpers read and write through, over the same private, plaintext `key-map`
|
|
8
|
+
* collection the wrap-set roster lives in. Every wallet app on the account
|
|
9
|
+
* shares this one implementation, so they share one record.
|
|
10
|
+
*/
|
|
11
|
+
import type { WasClient } from '@interop/was-client';
|
|
12
|
+
import type { ClientLabelsStore } from './clientLabels.js';
|
|
13
|
+
/**
|
|
14
|
+
* Builds the labels store over `key-map/client-labels.json` in a data Space.
|
|
15
|
+
*
|
|
16
|
+
* @param options {object}
|
|
17
|
+
* @param options.was {WasClient} the account's storage client, signing as an
|
|
18
|
+
* enrolled client
|
|
19
|
+
* @param options.spaceId {string} the data Space id
|
|
20
|
+
* @returns {ClientLabelsStore}
|
|
21
|
+
*/
|
|
22
|
+
export declare function wasClientLabelsStore({ was, spaceId }: {
|
|
23
|
+
was: WasClient;
|
|
24
|
+
spaceId: string;
|
|
25
|
+
}): ClientLabelsStore;
|
|
26
|
+
//# sourceMappingURL=wasLabelsStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasLabelsStore.d.ts","sourceRoot":"","sources":["../../src/keys/wasLabelsStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAKpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,GAAG,EACH,OAAO,EACR,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,iBAAiB,CAepB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CLIENT_LABELS_RESOURCE, KEY_MAP_COLLECTION } from '../space/collections.js';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the labels store over `key-map/client-labels.json` in a data Space.
|
|
4
|
+
*
|
|
5
|
+
* @param options {object}
|
|
6
|
+
* @param options.was {WasClient} the account's storage client, signing as an
|
|
7
|
+
* enrolled client
|
|
8
|
+
* @param options.spaceId {string} the data Space id
|
|
9
|
+
* @returns {ClientLabelsStore}
|
|
10
|
+
*/
|
|
11
|
+
export function wasClientLabelsStore({ was, spaceId }) {
|
|
12
|
+
const resource = was
|
|
13
|
+
.space(spaceId)
|
|
14
|
+
.collection(KEY_MAP_COLLECTION.id, { encryption: 'plaintext' })
|
|
15
|
+
.resource(CLIENT_LABELS_RESOURCE);
|
|
16
|
+
return {
|
|
17
|
+
async get() {
|
|
18
|
+
const result = await resource.get();
|
|
19
|
+
return result === null ? undefined : result;
|
|
20
|
+
},
|
|
21
|
+
async put({ content }) {
|
|
22
|
+
const body = new TextEncoder().encode(JSON.stringify(content));
|
|
23
|
+
await resource.put(body, { contentType: 'application/json' });
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=wasLabelsStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasLabelsStore.js","sourceRoot":"","sources":["../../src/keys/wasLabelsStore.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,yBAAyB,CAAA;AAGhC;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,GAAG,EACH,OAAO,EAIR;IACC,MAAM,QAAQ,GAAG,GAAG;SACjB,KAAK,CAAC,OAAO,CAAC;SACd,UAAU,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;SAC9D,QAAQ,CAAC,sBAAsB,CAAC,CAAA;IACnC,OAAO;QACL,KAAK,CAAC,GAAG;YACP,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,GAAG,EAAE,CAAA;YACnC,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAA;QAC7C,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAuB;YACxC,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;YAC9D,MAAM,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC,CAAA;QAC/D,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/webvh/index.d.ts
CHANGED
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
* - `listEnrolledWebvhClients` -- the enrolled-client listing over a
|
|
15
15
|
* caller-verified log (keyed on `capabilityInvocation`, update keys
|
|
16
16
|
* recovered by log attribution), for a "your wallets" surface.
|
|
17
|
+
* - `verifyAccountLog` -- the verification step every one of those ceremonies
|
|
18
|
+
* runs first: fetch the world-readable log, resolve it locally, refuse a log
|
|
19
|
+
* that resolves to another DID.
|
|
20
|
+
* - `wasWebvhIdStore` -- the WAS-backed `WebvhIdStore` the ceremonies write
|
|
21
|
+
* through.
|
|
17
22
|
* - `repairKeyBindings` -- the lost-`keys.json` recovery path.
|
|
18
23
|
* - `webvhZcapClient` / `webvhSigner` / `didKeyZcapClient` -- ZCap signing
|
|
19
24
|
* under the account's did:webvh verification-method id (and the
|
|
@@ -23,6 +28,8 @@
|
|
|
23
28
|
* ezcap dependency graph (the same isolation pattern as `./identity`).
|
|
24
29
|
*/
|
|
25
30
|
export { didWebvhControllerTemplate, ensureDidWebvh, enrollWebvhClient, mintClientWebvhUpdateKeys, relationIds, repairKeyBindings, rotateWebvhUpdateKey, updateKeyMultibase } from './didWebvh.js';
|
|
31
|
+
export { AccountLogMissingError, verifyAccountLog } from './verifyLog.js';
|
|
32
|
+
export { wasWebvhIdStore } from './wasIdStore.js';
|
|
26
33
|
export { keyAgreementTwinMultibase, listEnrolledWebvhClients } from './listClients.js';
|
|
27
34
|
export type { EnrolledWebvhClient } from './listClients.js';
|
|
28
35
|
export { revokeWebvhClient, StagedCommitmentAmbiguousError } from './revokeClient.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webvh/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webvh/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EACL,iBAAiB,EACjB,8BAA8B,EAC/B,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,YAAY,EACV,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,YAAY,EACb,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,UAAU,EACV,oBAAoB,EACpB,WAAW,EACX,eAAe,EAChB,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/webvh/index.js
CHANGED
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
* - `listEnrolledWebvhClients` -- the enrolled-client listing over a
|
|
15
15
|
* caller-verified log (keyed on `capabilityInvocation`, update keys
|
|
16
16
|
* recovered by log attribution), for a "your wallets" surface.
|
|
17
|
+
* - `verifyAccountLog` -- the verification step every one of those ceremonies
|
|
18
|
+
* runs first: fetch the world-readable log, resolve it locally, refuse a log
|
|
19
|
+
* that resolves to another DID.
|
|
20
|
+
* - `wasWebvhIdStore` -- the WAS-backed `WebvhIdStore` the ceremonies write
|
|
21
|
+
* through.
|
|
17
22
|
* - `repairKeyBindings` -- the lost-`keys.json` recovery path.
|
|
18
23
|
* - `webvhZcapClient` / `webvhSigner` / `didKeyZcapClient` -- ZCap signing
|
|
19
24
|
* under the account's did:webvh verification-method id (and the
|
|
@@ -23,6 +28,8 @@
|
|
|
23
28
|
* ezcap dependency graph (the same isolation pattern as `./identity`).
|
|
24
29
|
*/
|
|
25
30
|
export { didWebvhControllerTemplate, ensureDidWebvh, enrollWebvhClient, mintClientWebvhUpdateKeys, relationIds, repairKeyBindings, rotateWebvhUpdateKey, updateKeyMultibase } from './didWebvh.js';
|
|
31
|
+
export { AccountLogMissingError, verifyAccountLog } from './verifyLog.js';
|
|
32
|
+
export { wasWebvhIdStore } from './wasIdStore.js';
|
|
26
33
|
export { keyAgreementTwinMultibase, listEnrolledWebvhClients } from './listClients.js';
|
|
27
34
|
export { revokeWebvhClient, StagedCommitmentAmbiguousError } from './revokeClient.js';
|
|
28
35
|
export { multibaseOf } from './didWeb.js';
|
package/dist/webvh/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/webvh/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/webvh/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,kBAAkB,CAAA;AAEzB,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,3 +1,4 @@
|
|
|
1
|
+
import type { DIDDoc } from '@interop/did-method-webvh';
|
|
1
2
|
import type { ClientWebvhUpdateKeys, WebvhClientKeys, WebvhIdStore } from './didWebvh.js';
|
|
2
3
|
/**
|
|
3
4
|
* The public halves of the client being revoked, as the document and log
|
|
@@ -51,7 +52,11 @@ export declare class StagedCommitmentAmbiguousError extends Error {
|
|
|
51
52
|
* @param [options.knownLatentHashes] {string[]} standing latent commitments
|
|
52
53
|
* the caller vouches for (the recovery registry's update-key hashes),
|
|
53
54
|
* excluded from the staged-hash attribution
|
|
54
|
-
* @returns {Promise<{ did: string }>}
|
|
55
|
+
* @returns {Promise<{ did: string, doc: DIDDoc }>} the account's DID and its
|
|
56
|
+
* resolved document AFTER the edit -- what the roster rotation that follows
|
|
57
|
+
* resolves its remaining recipients from, so the caller needs no re-fetch of
|
|
58
|
+
* the log it just extended. On the idempotent no-op path this is the
|
|
59
|
+
* already-published document, which states the same thing.
|
|
55
60
|
*/
|
|
56
61
|
export declare function revokeWebvhClient({ idStore, updateKeys, revokedClient, knownLatentHashes }: {
|
|
57
62
|
idStore: WebvhIdStore;
|
|
@@ -60,5 +65,6 @@ export declare function revokeWebvhClient({ idStore, updateKeys, revokedClient,
|
|
|
60
65
|
knownLatentHashes?: string[];
|
|
61
66
|
}): Promise<{
|
|
62
67
|
did: string;
|
|
68
|
+
doc: DIDDoc;
|
|
63
69
|
}>;
|
|
64
70
|
//# sourceMappingURL=revokeClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revokeClient.d.ts","sourceRoot":"","sources":["../../src/webvh/revokeClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"revokeClient.d.ts","sourceRoot":"","sources":["../../src/webvh/revokeClient.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EACV,MAAM,EAGP,MAAM,2BAA2B,CAAA;AAUlC,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,YAAY,EACb,MAAM,eAAe,CAAA;AAEtB;;;;;GAKG;AACH,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,qBAAa,8BAA+B,SAAQ,KAAK;IACvD,UAAU,EAAE,MAAM,EAAE,CAAA;gBACR,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE;CASrD;AA6FD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,UAAU,EACV,aAAa,EACb,iBAAsB,EACvB,EAAE;IACD,OAAO,EAAE,YAAY,CAAA;IACrB,UAAU,EAAE,qBAAqB,CAAA;IACjC,aAAa,EAAE,iBAAiB,CAAA;IAChC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC7B,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CA2FxC"}
|
|
@@ -156,7 +156,11 @@ async function attributeStagedHash({ log, revokedUpdateKey, knownLatentHashes })
|
|
|
156
156
|
* @param [options.knownLatentHashes] {string[]} standing latent commitments
|
|
157
157
|
* the caller vouches for (the recovery registry's update-key hashes),
|
|
158
158
|
* excluded from the staged-hash attribution
|
|
159
|
-
* @returns {Promise<{ did: string }>}
|
|
159
|
+
* @returns {Promise<{ did: string, doc: DIDDoc }>} the account's DID and its
|
|
160
|
+
* resolved document AFTER the edit -- what the roster rotation that follows
|
|
161
|
+
* resolves its remaining recipients from, so the caller needs no re-fetch of
|
|
162
|
+
* the log it just extended. On the idempotent no-op path this is the
|
|
163
|
+
* already-published document, which states the same thing.
|
|
160
164
|
*/
|
|
161
165
|
export async function revokeWebvhClient({ idStore, updateKeys, revokedClient, knownLatentHashes = [] }) {
|
|
162
166
|
const published = await readPublishedLog({ idStore });
|
|
@@ -177,7 +181,7 @@ export async function revokeWebvhClient({ idStore, updateKeys, revokedClient, kn
|
|
|
177
181
|
const keyPresent = published.updateKeys.includes(revokedClient.updateKeyMultibase);
|
|
178
182
|
const hashPresent = published.nextKeyHashes.includes(revokedHash);
|
|
179
183
|
if (!vmPresent && !keyPresent && !hashPresent) {
|
|
180
|
-
return { did };
|
|
184
|
+
return { did, doc };
|
|
181
185
|
}
|
|
182
186
|
if (!published.updateKeys.includes(activeKey)) {
|
|
183
187
|
throw new Error("did:webvh: the published log does not authorize this client's active " +
|
|
@@ -213,6 +217,6 @@ export async function revokeWebvhClient({ idStore, updateKeys, revokedClient, kn
|
|
|
213
217
|
throw new Error('did:webvh: updateDID returned no webDoc despite the did:web alsoKnownAs.');
|
|
214
218
|
}
|
|
215
219
|
await publishWebvhLog({ idStore, log: updated.log, webDoc: updated.webDoc });
|
|
216
|
-
return { did: updated.did };
|
|
220
|
+
return { did: updated.did, doc: updated.doc };
|
|
217
221
|
}
|
|
218
222
|
//# sourceMappingURL=revokeClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revokeClient.js","sourceRoot":"","sources":["../../src/webvh/revokeClient.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"revokeClient.js","sourceRoot":"","sources":["../../src/webvh/revoke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C,GAAG,CAAC,cAAc,CAAC,CAAC,MAAM,CACpD,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,WAAW,CACzB;QACD,eAAe,EAAE,WAAW,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CACtD,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,WAAW,CACzB;QACD,YAAY,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,MAAM,CAChD,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,gBAAgB,CAC9B;QACD,oBAAoB,EAAE,WAAW,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAChE,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,WAAW,CACzB;QACD,oBAAoB,EAAE,WAAW,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAChE,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,WAAW,CACzB;KACF,CAAC,CAAA;IACF,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;IACH,CAAC;IACD,MAAM,eAAe,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAC5E,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAA;AAC/C,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { DIDDoc, DIDLog } from '@interop/did-method-webvh';
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when the account has published no DID log at all (the resource is
|
|
4
|
+
* absent). Distinguished from every other failure because it is the one
|
|
5
|
+
* expected state of an in-flight ceremony -- a client completing its
|
|
6
|
+
* enrollment before the other side has approved it reads this as "not yet",
|
|
7
|
+
* not as a broken account.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AccountLogMissingError extends Error {
|
|
10
|
+
constructor(message?: string);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Fetches and locally verifies the account's world-readable DID log.
|
|
14
|
+
*
|
|
15
|
+
* Throws {@link AccountLogMissingError} when the log resource is absent, and
|
|
16
|
+
* an ordinary error when the fetch fails, the log does not resolve, or it
|
|
17
|
+
* resolves to a DID other than the one named.
|
|
18
|
+
*
|
|
19
|
+
* @param options {object}
|
|
20
|
+
* @param options.did {string} the account's did:webvh, as the caller's
|
|
21
|
+
* stored account pointer names it
|
|
22
|
+
* @param options.spaceId {string} the account's Space id
|
|
23
|
+
* @param options.host {string} the storage server the account lives on
|
|
24
|
+
* @returns {Promise<object>} the resolved document, the raw log, and the
|
|
25
|
+
* log's effective `updateKeys` / `nextKeyHashes`
|
|
26
|
+
*/
|
|
27
|
+
export declare function verifyAccountLog({ did, spaceId, host }: {
|
|
28
|
+
did: string;
|
|
29
|
+
spaceId: string;
|
|
30
|
+
host: string;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
doc: DIDDoc;
|
|
33
|
+
log: DIDLog;
|
|
34
|
+
updateKeys: string[];
|
|
35
|
+
nextKeyHashes: string[];
|
|
36
|
+
}>;
|
|
37
|
+
//# sourceMappingURL=verifyLog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyLog.d.ts","sourceRoot":"","sources":["../../src/webvh/verifyLog.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAG/D;;;;;;GAMG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,SAA0C;CAI9D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,GAAG,EACH,OAAO,EACP,IAAI,EACL,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC;IACV,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,aAAa,EAAE,MAAM,EAAE,CAAA;CACxB,CAAC,CAmCD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The account's published-log verification step: fetch the world-readable
|
|
6
|
+
* did:webvh log out of the Space's `id` collection, resolve it locally, and
|
|
7
|
+
* refuse a log that resolves to a different DID than the account pointer
|
|
8
|
+
* names. Every ceremony that reads or edits the document -- listing the
|
|
9
|
+
* enrolled clients, approving a connect code, disconnecting a client,
|
|
10
|
+
* rotating the wrap-set roster -- runs it first, so it lives here once
|
|
11
|
+
* instead of once per wallet.
|
|
12
|
+
*
|
|
13
|
+
* The fetch is unauthenticated on purpose: the log is world-readable by
|
|
14
|
+
* policy, and its own hash chain (SCID-pinned, prerotation-checked,
|
|
15
|
+
* update-key signed) is what makes it trustworthy, not the channel. The
|
|
16
|
+
* caller supplies the DID it expects; a resolved DID that does not match is
|
|
17
|
+
* the substituted-account refusal, and the only thing the transport could
|
|
18
|
+
* ever buy back.
|
|
19
|
+
*/
|
|
20
|
+
import { readLogFromString, resolveDIDFromLog } from '@interop/did-method-webvh';
|
|
21
|
+
import { DID_LOG_RESOURCE, ID_COLLECTION } from '../space/collections.js';
|
|
22
|
+
/**
|
|
23
|
+
* Thrown when the account has published no DID log at all (the resource is
|
|
24
|
+
* absent). Distinguished from every other failure because it is the one
|
|
25
|
+
* expected state of an in-flight ceremony -- a client completing its
|
|
26
|
+
* enrollment before the other side has approved it reads this as "not yet",
|
|
27
|
+
* not as a broken account.
|
|
28
|
+
*/
|
|
29
|
+
export class AccountLogMissingError extends Error {
|
|
30
|
+
constructor(message = 'The account has no published DID log.') {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = 'AccountLogMissingError';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Fetches and locally verifies the account's world-readable DID log.
|
|
37
|
+
*
|
|
38
|
+
* Throws {@link AccountLogMissingError} when the log resource is absent, and
|
|
39
|
+
* an ordinary error when the fetch fails, the log does not resolve, or it
|
|
40
|
+
* resolves to a DID other than the one named.
|
|
41
|
+
*
|
|
42
|
+
* @param options {object}
|
|
43
|
+
* @param options.did {string} the account's did:webvh, as the caller's
|
|
44
|
+
* stored account pointer names it
|
|
45
|
+
* @param options.spaceId {string} the account's Space id
|
|
46
|
+
* @param options.host {string} the storage server the account lives on
|
|
47
|
+
* @returns {Promise<object>} the resolved document, the raw log, and the
|
|
48
|
+
* log's effective `updateKeys` / `nextKeyHashes`
|
|
49
|
+
*/
|
|
50
|
+
export async function verifyAccountLog({ did, spaceId, host }) {
|
|
51
|
+
const url = new URL(`/space/${spaceId}/${ID_COLLECTION.id}/${DID_LOG_RESOURCE}`, host);
|
|
52
|
+
const response = await fetch(url);
|
|
53
|
+
if (response.status === 404) {
|
|
54
|
+
throw new AccountLogMissingError();
|
|
55
|
+
}
|
|
56
|
+
if (!response.ok) {
|
|
57
|
+
throw new Error(`Fetching the account's DID log failed (HTTP ${response.status}).`);
|
|
58
|
+
}
|
|
59
|
+
const log = readLogFromString(await response.text());
|
|
60
|
+
const resolved = await resolveDIDFromLog(log);
|
|
61
|
+
if (resolved.meta.error || !resolved.did || !resolved.doc) {
|
|
62
|
+
throw new Error(`The account's DID log failed to resolve (${resolved.meta.error ?? 'the resolver returned no DID document'}).`);
|
|
63
|
+
}
|
|
64
|
+
if (resolved.did !== did) {
|
|
65
|
+
throw new Error('The published DID log resolves to a different DID than the account ' +
|
|
66
|
+
'pointer names.');
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
doc: resolved.doc,
|
|
70
|
+
log,
|
|
71
|
+
updateKeys: resolved.meta.updateKeys ?? [],
|
|
72
|
+
nextKeyHashes: resolved.meta.nextKeyHashes ?? []
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=verifyLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyLog.js","sourceRoot":"","sources":["../../src/webvh/verifyLog.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEzE;;;;;;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;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,GAAG,EACH,OAAO,EACP,IAAI,EAKL;IAMC,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,UAAU,OAAO,IAAI,aAAa,CAAC,EAAE,IAAI,gBAAgB,EAAE,EAC3D,IAAI,CACL,CAAA;IACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;IACjC,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC5B,MAAM,IAAI,sBAAsB,EAAE,CAAA;IACpC,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,+CAA+C,QAAQ,CAAC,MAAM,IAAI,CACnE,CAAA;IACH,CAAC;IACD,MAAM,GAAG,GAAG,iBAAiB,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;IACpD,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAA;IAC7C,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,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,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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The WAS-backed adapter for the did:webvh module's narrow store seam: the
|
|
6
|
+
* account's identity collections as a {@link WebvhIdStore}, so every wallet
|
|
7
|
+
* app drives the log ceremonies through one implementation instead of its own
|
|
8
|
+
* copy.
|
|
9
|
+
*
|
|
10
|
+
* Both collections are addressed as plaintext: `id` holds published documents
|
|
11
|
+
* (world-readable by policy) and `key-map` holds plain JSON, so neither goes
|
|
12
|
+
* through the encryption codec.
|
|
13
|
+
*
|
|
14
|
+
* Bodies are written as raw bytes under the content type the caller states --
|
|
15
|
+
* load-bearing, since the log is JSON Lines (`text/jsonl`), not JSON, and the
|
|
16
|
+
* DID document is served as `application/did+json`.
|
|
17
|
+
*/
|
|
18
|
+
import type { WasClient } from '@interop/was-client';
|
|
19
|
+
import type { WebvhIdStore } from './didWebvh.js';
|
|
20
|
+
/**
|
|
21
|
+
* Builds the `id`-collection store the did:webvh ceremonies read and write
|
|
22
|
+
* through.
|
|
23
|
+
*
|
|
24
|
+
* @param options {object}
|
|
25
|
+
* @param options.was {WasClient} the account's storage client, signing as an
|
|
26
|
+
* enrolled client
|
|
27
|
+
* @param options.spaceId {string} the data Space id
|
|
28
|
+
* @returns {WebvhIdStore}
|
|
29
|
+
*/
|
|
30
|
+
export declare function wasWebvhIdStore({ was, spaceId }: {
|
|
31
|
+
was: WasClient;
|
|
32
|
+
spaceId: string;
|
|
33
|
+
}): WebvhIdStore;
|
|
34
|
+
//# sourceMappingURL=wasIdStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasIdStore.d.ts","sourceRoot":"","sources":["../../src/webvh/wasIdStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAMpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,OAAO,EACR,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,YAAY,CAqCf"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DID_KEYS_RESOURCE, ID_COLLECTION, KEY_MAP_COLLECTION } from '../space/collections.js';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the `id`-collection store the did:webvh ceremonies read and write
|
|
4
|
+
* through.
|
|
5
|
+
*
|
|
6
|
+
* @param options {object}
|
|
7
|
+
* @param options.was {WasClient} the account's storage client, signing as an
|
|
8
|
+
* enrolled client
|
|
9
|
+
* @param options.spaceId {string} the data Space id
|
|
10
|
+
* @returns {WebvhIdStore}
|
|
11
|
+
*/
|
|
12
|
+
export function wasWebvhIdStore({ was, spaceId }) {
|
|
13
|
+
const idResource = (resourceId) => was
|
|
14
|
+
.space(spaceId)
|
|
15
|
+
.collection(ID_COLLECTION.id, { encryption: 'plaintext' })
|
|
16
|
+
.resource(resourceId);
|
|
17
|
+
return {
|
|
18
|
+
getIdResourceRaw: async ({ resourceId }) => {
|
|
19
|
+
const text = await idResource(resourceId).getText();
|
|
20
|
+
return text === null ? undefined : text;
|
|
21
|
+
},
|
|
22
|
+
getIdResource: async ({ resourceId }) => {
|
|
23
|
+
const data = await idResource(resourceId).get();
|
|
24
|
+
return data === null ? undefined : data;
|
|
25
|
+
},
|
|
26
|
+
putIdResource: async ({ resourceId, content, contentType = 'application/json' }) => {
|
|
27
|
+
const serialized = typeof content === 'string' ? content : JSON.stringify(content);
|
|
28
|
+
await idResource(resourceId).put(new TextEncoder().encode(serialized), {
|
|
29
|
+
contentType
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
putKeyMap: async ({ content }) => {
|
|
33
|
+
await was
|
|
34
|
+
.space(spaceId)
|
|
35
|
+
.collection(KEY_MAP_COLLECTION.id, { encryption: 'plaintext' })
|
|
36
|
+
.resource(DID_KEYS_RESOURCE)
|
|
37
|
+
.put(new TextEncoder().encode(JSON.stringify(content)), {
|
|
38
|
+
contentType: 'application/json'
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=wasIdStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasIdStore.js","sourceRoot":"","sources":["../../src/webvh/wasIdStore.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EACnB,MAAM,yBAAyB,CAAA;AAGhC;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,GAAG,EACH,OAAO,EAIR;IACC,MAAM,UAAU,GAAG,CAAC,UAAkB,EAAE,EAAE,CACxC,GAAG;SACA,KAAK,C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CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE;gBACtD,WAAW,EAAE,kBAAkB;aAChC,CAAC,CAAA;QACN,CAAC;KACF,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.
|
|
4
|
+
"version": "0.13.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|