@interop/wallet-core 0.5.0 → 0.7.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/dist/enrollment/enrollment.d.ts +144 -0
- package/dist/enrollment/enrollment.d.ts.map +1 -0
- package/dist/enrollment/enrollment.js +296 -0
- package/dist/enrollment/enrollment.js.map +1 -0
- package/dist/enrollment/index.d.ts +20 -0
- package/dist/enrollment/index.d.ts.map +1 -0
- package/dist/enrollment/index.js +19 -0
- package/dist/enrollment/index.js.map +1 -0
- package/dist/identity/index.d.ts +0 -5
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +0 -4
- package/dist/identity/index.js.map +1 -1
- package/dist/index.d.ts +16 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/keyring/fetch.d.ts +22 -0
- package/dist/keyring/fetch.d.ts.map +1 -0
- package/dist/keyring/fetch.js +35 -0
- package/dist/keyring/fetch.js.map +1 -0
- package/dist/keyring/index.d.ts +30 -0
- package/dist/keyring/index.d.ts.map +1 -0
- package/dist/keyring/index.js +28 -0
- package/dist/keyring/index.js.map +1 -0
- package/dist/keyring/kdf.d.ts +102 -0
- package/dist/keyring/kdf.d.ts.map +1 -0
- package/dist/keyring/kdf.js +148 -0
- package/dist/keyring/kdf.js.map +1 -0
- package/dist/keyring/record.d.ts +98 -0
- package/dist/keyring/record.d.ts.map +1 -0
- package/dist/keyring/record.js +119 -0
- package/dist/keyring/record.js.map +1 -0
- package/dist/keyring/unlockSpace.d.ts +101 -0
- package/dist/keyring/unlockSpace.d.ts.map +1 -0
- package/dist/keyring/unlockSpace.js +226 -0
- package/dist/keyring/unlockSpace.js.map +1 -0
- package/dist/keys/index.d.ts +24 -0
- package/dist/keys/index.d.ts.map +1 -0
- package/dist/keys/index.js +22 -0
- package/dist/keys/index.js.map +1 -0
- package/dist/keys/puk.d.ts +42 -0
- package/dist/keys/puk.d.ts.map +1 -0
- package/dist/keys/puk.js +56 -0
- package/dist/keys/puk.js.map +1 -0
- package/dist/keys/pukRoster.d.ts +210 -0
- package/dist/keys/pukRoster.d.ts.map +1 -0
- package/dist/keys/pukRoster.js +263 -0
- package/dist/keys/pukRoster.js.map +1 -0
- package/dist/keys/rosterStore.d.ts +18 -0
- package/dist/keys/rosterStore.d.ts.map +1 -0
- package/dist/keys/rosterStore.js +38 -0
- package/dist/keys/rosterStore.js.map +1 -0
- package/dist/markers/acquire.d.ts +107 -0
- package/dist/markers/acquire.d.ts.map +1 -0
- package/dist/markers/acquire.js +83 -0
- package/dist/markers/acquire.js.map +1 -0
- package/dist/markers/cipher.d.ts +56 -0
- package/dist/markers/cipher.d.ts.map +1 -0
- package/dist/markers/cipher.js +73 -0
- package/dist/markers/cipher.js.map +1 -0
- package/dist/markers/index.d.ts +30 -0
- package/dist/markers/index.d.ts.map +1 -0
- package/dist/markers/index.js +29 -0
- package/dist/markers/index.js.map +1 -0
- package/dist/markers/refresh.d.ts +60 -0
- package/dist/markers/refresh.d.ts.map +1 -0
- package/dist/markers/refresh.js +67 -0
- package/dist/markers/refresh.js.map +1 -0
- package/dist/recovery/index.d.ts +31 -0
- package/dist/recovery/index.d.ts.map +1 -0
- package/dist/recovery/index.js +28 -0
- package/dist/recovery/index.js.map +1 -0
- package/dist/recovery/recoveryCode.d.ts +105 -0
- package/dist/recovery/recoveryCode.d.ts.map +1 -0
- package/dist/recovery/recoveryCode.js +155 -0
- package/dist/recovery/recoveryCode.js.map +1 -0
- package/dist/recovery/recoveryRecord.d.ts +75 -0
- package/dist/recovery/recoveryRecord.d.ts.map +1 -0
- package/dist/recovery/recoveryRecord.js +89 -0
- package/dist/recovery/recoveryRecord.js.map +1 -0
- package/dist/recovery/recoveryWebvh.d.ts +126 -0
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -0
- package/dist/recovery/recoveryWebvh.js +379 -0
- package/dist/recovery/recoveryWebvh.js.map +1 -0
- package/dist/space/collections.d.ts +57 -0
- package/dist/space/collections.d.ts.map +1 -1
- package/dist/space/collections.js +48 -0
- package/dist/space/collections.js.map +1 -1
- package/dist/space/index.d.ts +4 -0
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +4 -0
- package/dist/space/index.js.map +1 -1
- package/dist/webvh/didWeb.d.ts +41 -0
- package/dist/webvh/didWeb.d.ts.map +1 -0
- package/dist/webvh/didWeb.js +24 -0
- package/dist/webvh/didWeb.js.map +1 -0
- package/dist/webvh/didWebvh.d.ts +330 -0
- package/dist/webvh/didWebvh.d.ts.map +1 -0
- package/dist/webvh/didWebvh.js +775 -0
- package/dist/webvh/didWebvh.js.map +1 -0
- package/dist/webvh/index.d.ts +27 -0
- package/dist/webvh/index.d.ts.map +1 -0
- package/dist/webvh/index.js +24 -0
- package/dist/webvh/index.js.map +1 -0
- package/dist/webvh/zcap.d.ts +104 -0
- package/dist/webvh/zcap.d.ts.map +1 -0
- package/dist/webvh/zcap.js +117 -0
- package/dist/webvh/zcap.js.map +1 -0
- package/package.json +42 -4
- package/dist/identity/collectionKeys.d.ts +0 -36
- package/dist/identity/collectionKeys.d.ts.map +0 -1
- package/dist/identity/collectionKeys.js +0 -92
- package/dist/identity/collectionKeys.js.map +0 -1
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The did:webvh half of recovery-code lifecycle: the split posture the
|
|
6
|
+
* roster identity model gives a code. At issuance the document gains the
|
|
7
|
+
* code's `keyAgreement` verification method (an ordinary Multikey entry --
|
|
8
|
+
* deliberately unmarked; a recovery key is distinguishable structurally,
|
|
9
|
+
* since it appears ONLY under `keyAgreement` while every enrolled client
|
|
10
|
+
* also publishes signing relationships, so client listings key on
|
|
11
|
+
* `capabilityInvocation` and never see it) and `nextKeyHashes` gains the
|
|
12
|
+
* code's update-key hash -- decryption standing, authority latent: the
|
|
13
|
+
* code's update key joins `updateKeys` nowhere, and its material exists
|
|
14
|
+
* nowhere until the code is typed.
|
|
15
|
+
*
|
|
16
|
+
* At recovery time the pre-committed update key reveals itself to sign the
|
|
17
|
+
* self-enrolling continuation, two entries:
|
|
18
|
+
*
|
|
19
|
+
* 1. **Reveal + commit**: the code's update key joins `updateKeys` (its hash
|
|
20
|
+
* stands committed since issuance, which is what makes the entry verify)
|
|
21
|
+
* and `nextKeyHashes` extends with the NEW ordinary client's update- and
|
|
22
|
+
* staged-key hashes plus the replacement code's update-key hash.
|
|
23
|
+
* 2. **Add + retire**: signed by the new client's update key (revealed from
|
|
24
|
+
* the commit), this entry publishes the new client's verification methods
|
|
25
|
+
* and update key, removes the spent code's `keyAgreement` VM, publishes
|
|
26
|
+
* the replacement code's, and drops the spent code's update key and hash
|
|
27
|
+
* -- so no recovery authority stands afterwards.
|
|
28
|
+
*
|
|
29
|
+
* Both entries are written through the caller's store seam; the recovery
|
|
30
|
+
* continuation publishes ONLY `did.jsonl` (the delegation the record carries
|
|
31
|
+
* covers nothing else -- narrow scope preserves loudness), and hands back the
|
|
32
|
+
* final `webDoc` so the recovered session can republish `did.json` once it is
|
|
33
|
+
* the authorized controller. Every step is idempotent/resumable: re-running
|
|
34
|
+
* with the same key material converges without forking the log.
|
|
35
|
+
*/
|
|
36
|
+
import { deriveNextKeyHash, logToJsonlString, updateDID } from '@interop/did-method-webvh';
|
|
37
|
+
import { DID_LOG_RESOURCE } from '../space/collections.js';
|
|
38
|
+
import { MULTIKEY_VM_TYPE, publishWebvhLog, readPublishedLog, relationIds, updateKeyMultibase, updateKeySigner } from '../webvh/didWebvh.js';
|
|
39
|
+
/**
|
|
40
|
+
* The verification-method id a code's key-agreement key publishes under --
|
|
41
|
+
* the ordinary `<did>#<multibase>` form, indistinguishable by id from any
|
|
42
|
+
* other keyAgreement entry. Consumers that must exclude recovery entries do
|
|
43
|
+
* it structurally (an enrolled client is a `capabilityInvocation` entry; a
|
|
44
|
+
* recovery key never has one) or by the registry's recorded multibase.
|
|
45
|
+
*
|
|
46
|
+
* @param options {object}
|
|
47
|
+
* @param options.did {string} the account's did:webvh
|
|
48
|
+
* @param options.keyAgreementKeyMultibase {string}
|
|
49
|
+
* @returns {string}
|
|
50
|
+
*/
|
|
51
|
+
export function recoveryVmId({ did, keyAgreementKeyMultibase }) {
|
|
52
|
+
return `${did}#${keyAgreementKeyMultibase}`;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Thrown by the recovery continuation when the log carries neither the code's
|
|
56
|
+
* update key nor its committed hash -- the code was revoked (or never
|
|
57
|
+
* issued), so no continuation can verify.
|
|
58
|
+
*/
|
|
59
|
+
export class RecoveryKeyNotCommittedError extends Error {
|
|
60
|
+
constructor(message = 'The account log no longer commits this recovery code; the ' +
|
|
61
|
+
'code has been revoked or was never issued.') {
|
|
62
|
+
super(message);
|
|
63
|
+
this.name = 'RecoveryKeyNotCommittedError';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Reads and resolves the published log through the narrow recovery seam.
|
|
68
|
+
*
|
|
69
|
+
* @param options {object}
|
|
70
|
+
* @param options.store {RecoveryLogStore}
|
|
71
|
+
* @returns {Promise<PublishedWebvhLog>}
|
|
72
|
+
*/
|
|
73
|
+
async function readLogOrThrow({ store }) {
|
|
74
|
+
// readPublishedLog only calls getIdResourceRaw, so the narrow seam is safe.
|
|
75
|
+
const published = await readPublishedLog({
|
|
76
|
+
idStore: store
|
|
77
|
+
});
|
|
78
|
+
if (!published) {
|
|
79
|
+
throw new Error('did:webvh: did.jsonl is missing; nothing to recover.');
|
|
80
|
+
}
|
|
81
|
+
return published;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Publishes `did.jsonl` through the narrow recovery seam -- the log only,
|
|
85
|
+
* never `did.json` (the delegation covers nothing else; the recovered
|
|
86
|
+
* session republishes the projection once it is the controller).
|
|
87
|
+
*
|
|
88
|
+
* @param options {object}
|
|
89
|
+
* @param options.store {RecoveryLogStore}
|
|
90
|
+
* @param options.log {object}
|
|
91
|
+
* @returns {Promise<void>}
|
|
92
|
+
*/
|
|
93
|
+
async function publishLogOnly({ store, log }) {
|
|
94
|
+
await store.putIdResource({
|
|
95
|
+
resourceId: DID_LOG_RESOURCE,
|
|
96
|
+
content: logToJsonlString(log),
|
|
97
|
+
contentType: 'text/jsonl'
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Asserts the carry-over commitment convention holds for every currently
|
|
102
|
+
* authorized update key -- the precondition for any entry that re-states
|
|
103
|
+
* `updateKeys` (the resolver checks the re-stated set against the previous
|
|
104
|
+
* entry's `nextKeyHashes`).
|
|
105
|
+
*
|
|
106
|
+
* @param options {object}
|
|
107
|
+
* @param options.published {PublishedWebvhLog}
|
|
108
|
+
* @returns {Promise<void>}
|
|
109
|
+
*/
|
|
110
|
+
async function assertCarryOverCommitments({ published }) {
|
|
111
|
+
for (const key of published.updateKeys) {
|
|
112
|
+
if (!published.nextKeyHashes.includes(await deriveNextKeyHash(key))) {
|
|
113
|
+
throw new Error('did:webvh: the published log does not carry the active update ' +
|
|
114
|
+
"keys' own hashes in nextKeyHashes (it predates the carry-over " +
|
|
115
|
+
'commitment convention); re-provision the account first.');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* ISSUANCE (run by an enrolled client, root authority): publishes a recovery
|
|
121
|
+
* code's split posture into the document -- one entry adding the code's
|
|
122
|
+
* `keyAgreement` verification method (an ordinary, unmarked Multikey entry)
|
|
123
|
+
* and committing its update-key hash in `nextKeyHashes`. The code's update
|
|
124
|
+
* key joins `updateKeys` nowhere. Idempotent: a posture already published is
|
|
125
|
+
* a no-op, so re-running a torn issuance converges.
|
|
126
|
+
*
|
|
127
|
+
* @param options {object}
|
|
128
|
+
* @param options.idStore {WebvhIdStore}
|
|
129
|
+
* @param options.updateKeys {ClientWebvhUpdateKeys} the ISSUING client's
|
|
130
|
+
* own did:webvh update-key seeds
|
|
131
|
+
* @param options.recovery {RecoveryPublicKeys} the code's public halves
|
|
132
|
+
* @returns {Promise<{ did: string }>}
|
|
133
|
+
*/
|
|
134
|
+
export async function publishRecoveryKey({ idStore, updateKeys, recovery }) {
|
|
135
|
+
const published = await readLogOrThrow({ store: idStore });
|
|
136
|
+
const { did, doc } = published;
|
|
137
|
+
const recoveryHash = await deriveNextKeyHash(recovery.updateKeyMultibase);
|
|
138
|
+
const vmId = recoveryVmId({
|
|
139
|
+
did,
|
|
140
|
+
keyAgreementKeyMultibase: recovery.keyAgreementKeyMultibase
|
|
141
|
+
});
|
|
142
|
+
const vmPresent = (doc.verificationMethod ?? []).some(method => method.id === vmId);
|
|
143
|
+
const hashCommitted = published.nextKeyHashes.includes(recoveryHash);
|
|
144
|
+
if (vmPresent && hashCommitted) {
|
|
145
|
+
return { did };
|
|
146
|
+
}
|
|
147
|
+
const activeKey = await updateKeyMultibase({ seed: updateKeys.updateSeed });
|
|
148
|
+
if (!published.updateKeys.includes(activeKey)) {
|
|
149
|
+
throw new Error("did:webvh: the published log does not authorize this client's active " +
|
|
150
|
+
'update key; finalize the pending rotation before issuing a ' +
|
|
151
|
+
'recovery code.');
|
|
152
|
+
}
|
|
153
|
+
await assertCarryOverCommitments({ published });
|
|
154
|
+
const existingMethods = (doc.verificationMethod ?? []);
|
|
155
|
+
const recoveryMethod = {
|
|
156
|
+
id: vmId,
|
|
157
|
+
type: MULTIKEY_VM_TYPE,
|
|
158
|
+
controller: did,
|
|
159
|
+
publicKeyMultibase: recovery.keyAgreementKeyMultibase
|
|
160
|
+
};
|
|
161
|
+
const signer = await updateKeySigner({ seed: updateKeys.updateSeed });
|
|
162
|
+
const updated = await updateDID({
|
|
163
|
+
log: published.log,
|
|
164
|
+
signer,
|
|
165
|
+
updateKeys: published.updateKeys,
|
|
166
|
+
nextKeyHashes: [...new Set([...published.nextKeyHashes, recoveryHash])],
|
|
167
|
+
verificationMethods: [
|
|
168
|
+
...existingMethods.filter(method => method.id !== vmId),
|
|
169
|
+
recoveryMethod
|
|
170
|
+
],
|
|
171
|
+
authentication: relationIds(doc.authentication),
|
|
172
|
+
assertionMethod: relationIds(doc.assertionMethod),
|
|
173
|
+
keyAgreement: [...new Set([...relationIds(doc.keyAgreement), vmId])],
|
|
174
|
+
capabilityInvocation: relationIds(doc.capabilityInvocation),
|
|
175
|
+
capabilityDelegation: relationIds(doc.capabilityDelegation)
|
|
176
|
+
});
|
|
177
|
+
if (!updated.webDoc) {
|
|
178
|
+
throw new Error('did:webvh: updateDID returned no webDoc despite the did:web alsoKnownAs.');
|
|
179
|
+
}
|
|
180
|
+
await publishWebvhLog({ idStore, log: updated.log, webDoc: updated.webDoc });
|
|
181
|
+
return { did: updated.did };
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* REVOCATION (run by an enrolled client, root authority): removes a recovery
|
|
185
|
+
* code's posture from the document -- its `keyAgreement` verification method
|
|
186
|
+
* and its committed update-key hash -- in one entry. Idempotent. The
|
|
187
|
+
* roster-side half (rotating the PUK epoch off the code's wrap) is the
|
|
188
|
+
* caller's, and runs after this so the resolver's document no longer backs
|
|
189
|
+
* the removed entry.
|
|
190
|
+
*
|
|
191
|
+
* @param options {object}
|
|
192
|
+
* @param options.idStore {WebvhIdStore}
|
|
193
|
+
* @param options.updateKeys {ClientWebvhUpdateKeys} the REVOKING client's
|
|
194
|
+
* own did:webvh update-key seeds
|
|
195
|
+
* @param options.recovery {RecoveryPublicKeys} the code's public halves
|
|
196
|
+
* @returns {Promise<{ did: string }>}
|
|
197
|
+
*/
|
|
198
|
+
export async function removeRecoveryKey({ idStore, updateKeys, recovery }) {
|
|
199
|
+
const published = await readLogOrThrow({ store: idStore });
|
|
200
|
+
const { did, doc } = published;
|
|
201
|
+
const recoveryHash = await deriveNextKeyHash(recovery.updateKeyMultibase);
|
|
202
|
+
const vmId = recoveryVmId({
|
|
203
|
+
did,
|
|
204
|
+
keyAgreementKeyMultibase: recovery.keyAgreementKeyMultibase
|
|
205
|
+
});
|
|
206
|
+
const vmPresent = (doc.verificationMethod ?? []).some(method => method.id === vmId);
|
|
207
|
+
const hashCommitted = published.nextKeyHashes.includes(recoveryHash);
|
|
208
|
+
if (!vmPresent && !hashCommitted) {
|
|
209
|
+
return { did };
|
|
210
|
+
}
|
|
211
|
+
const activeKey = await updateKeyMultibase({ seed: updateKeys.updateSeed });
|
|
212
|
+
if (!published.updateKeys.includes(activeKey)) {
|
|
213
|
+
throw new Error("did:webvh: the published log does not authorize this client's active " +
|
|
214
|
+
'update key; finalize the pending rotation before revoking a ' +
|
|
215
|
+
'recovery code.');
|
|
216
|
+
}
|
|
217
|
+
await assertCarryOverCommitments({ published });
|
|
218
|
+
const existingMethods = (doc.verificationMethod ?? []);
|
|
219
|
+
const signer = await updateKeySigner({ seed: updateKeys.updateSeed });
|
|
220
|
+
const updated = await updateDID({
|
|
221
|
+
log: published.log,
|
|
222
|
+
signer,
|
|
223
|
+
updateKeys: published.updateKeys,
|
|
224
|
+
nextKeyHashes: published.nextKeyHashes.filter(hash => hash !== recoveryHash),
|
|
225
|
+
verificationMethods: existingMethods.filter(method => method.id !== vmId),
|
|
226
|
+
authentication: relationIds(doc.authentication),
|
|
227
|
+
assertionMethod: relationIds(doc.assertionMethod),
|
|
228
|
+
keyAgreement: relationIds(doc.keyAgreement).filter(id => id !== vmId),
|
|
229
|
+
capabilityInvocation: relationIds(doc.capabilityInvocation),
|
|
230
|
+
capabilityDelegation: relationIds(doc.capabilityDelegation)
|
|
231
|
+
});
|
|
232
|
+
if (!updated.webDoc) {
|
|
233
|
+
throw new Error('did:webvh: updateDID returned no webDoc despite the did:web alsoKnownAs.');
|
|
234
|
+
}
|
|
235
|
+
await publishWebvhLog({ idStore, log: updated.log, webDoc: updated.webDoc });
|
|
236
|
+
return { did: updated.did };
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* RECOVERY (run by the code-derived client through the delegated `did.jsonl`
|
|
240
|
+
* PUT): writes the self-enrolling continuation described in the module doc --
|
|
241
|
+
* the reveal-and-commit entry signed by the code's pre-committed update key,
|
|
242
|
+
* then the add-and-retire entry signed by the new ordinary client's update
|
|
243
|
+
* key. Resumable from durable state alone: a completed continuation is
|
|
244
|
+
* detected by the new client's update key already being authorized (no-op),
|
|
245
|
+
* a torn one by the standing commitments (the commit step re-runs
|
|
246
|
+
* convergently -- the spent code's hash is deliberately carried through the
|
|
247
|
+
* commit entry, so a resumed commit can re-state the revealed key).
|
|
248
|
+
*
|
|
249
|
+
* @param options {object}
|
|
250
|
+
* @param options.store {RecoveryLogStore} public log read + delegated PUT
|
|
251
|
+
* @param options.recovery {object} the spent code's update seed and public
|
|
252
|
+
* halves
|
|
253
|
+
* @param options.recovery.updateSeed {Uint8Array}
|
|
254
|
+
* @param options.recovery.keyAgreementKeyMultibase {string}
|
|
255
|
+
* @param options.recovery.updateKeyMultibase {string}
|
|
256
|
+
* @param options.newClientKeys {WebvhEnrollmentKeys} the new ordinary
|
|
257
|
+
* client's public halves
|
|
258
|
+
* @param options.newClientUpdateSeeds {ClientWebvhUpdateKeys} the new
|
|
259
|
+
* client's update-key seeds (minted by the recovery flow, which therefore
|
|
260
|
+
* holds them and can sign the add entry)
|
|
261
|
+
* @param options.replacement {RecoveryPublicKeys} the replacement code's
|
|
262
|
+
* public halves, committed and published in the same continuation
|
|
263
|
+
* @returns {Promise<{ did: string, webDoc?: object }>} the account DID and,
|
|
264
|
+
* when the add entry ran here, the final `did.json` projection for the
|
|
265
|
+
* recovered session to republish
|
|
266
|
+
*/
|
|
267
|
+
export async function recoverWebvhClient({ store, recovery, newClientKeys, newClientUpdateSeeds, replacement }) {
|
|
268
|
+
let published = await readLogOrThrow({ store });
|
|
269
|
+
// Already complete (a torn earlier run finished the add entry): the new
|
|
270
|
+
// client's update key is authorized, which only the add entry writes.
|
|
271
|
+
if (published.updateKeys.includes(newClientKeys.updateKeyMultibase)) {
|
|
272
|
+
return { did: published.did };
|
|
273
|
+
}
|
|
274
|
+
const recoveryHash = await deriveNextKeyHash(recovery.updateKeyMultibase);
|
|
275
|
+
const newUpdateHash = await deriveNextKeyHash(newClientKeys.updateKeyMultibase);
|
|
276
|
+
const newStagedHash = await deriveNextKeyHash(newClientKeys.stagedUpdateKeyMultibase);
|
|
277
|
+
const replacementHash = await deriveNextKeyHash(replacement.updateKeyMultibase);
|
|
278
|
+
// The reveal-and-commit entry, skipped when a torn earlier run already
|
|
279
|
+
// published it (the revealed key authorized AND every needed hash
|
|
280
|
+
// committed).
|
|
281
|
+
const revealed = published.updateKeys.includes(recovery.updateKeyMultibase);
|
|
282
|
+
const committed = [newUpdateHash, newStagedHash, replacementHash].every(hash => published.nextKeyHashes.includes(hash));
|
|
283
|
+
if (!revealed || !committed) {
|
|
284
|
+
if (!revealed && !published.nextKeyHashes.includes(recoveryHash)) {
|
|
285
|
+
throw new RecoveryKeyNotCommittedError();
|
|
286
|
+
}
|
|
287
|
+
await assertCarryOverCommitments({ published });
|
|
288
|
+
const signer = await updateKeySigner({ seed: recovery.updateSeed });
|
|
289
|
+
const updated = await updateDID({
|
|
290
|
+
log: published.log,
|
|
291
|
+
signer,
|
|
292
|
+
updateKeys: [
|
|
293
|
+
...new Set([...published.updateKeys, recovery.updateKeyMultibase])
|
|
294
|
+
],
|
|
295
|
+
// The spent code's own hash is kept through this entry (so a resumed
|
|
296
|
+
// commit can re-state the revealed key); the add entry drops it.
|
|
297
|
+
nextKeyHashes: [
|
|
298
|
+
...new Set([
|
|
299
|
+
...published.nextKeyHashes,
|
|
300
|
+
recoveryHash,
|
|
301
|
+
newUpdateHash,
|
|
302
|
+
newStagedHash,
|
|
303
|
+
replacementHash
|
|
304
|
+
])
|
|
305
|
+
]
|
|
306
|
+
});
|
|
307
|
+
await publishLogOnly({ store, log: updated.log });
|
|
308
|
+
published = await readLogOrThrow({ store });
|
|
309
|
+
}
|
|
310
|
+
// The add-and-retire entry: the new client's verification methods and
|
|
311
|
+
// update key in; the spent code's VM, update key, and hash out; the
|
|
312
|
+
// replacement code's VM in. Signed by the new client's update key, whose
|
|
313
|
+
// hash the commit entry just committed.
|
|
314
|
+
const { did, doc } = published;
|
|
315
|
+
const vmId = (publicKeyMultibase) => `${did}#${publicKeyMultibase}`;
|
|
316
|
+
const spentVmId = recoveryVmId({
|
|
317
|
+
did,
|
|
318
|
+
keyAgreementKeyMultibase: recovery.keyAgreementKeyMultibase
|
|
319
|
+
});
|
|
320
|
+
const replacementVmId = recoveryVmId({
|
|
321
|
+
did,
|
|
322
|
+
keyAgreementKeyMultibase: replacement.keyAgreementKeyMultibase
|
|
323
|
+
});
|
|
324
|
+
const addedMethods = [
|
|
325
|
+
{
|
|
326
|
+
id: vmId(newClientKeys.signingKeyMultibase),
|
|
327
|
+
publicKeyMultibase: newClientKeys.signingKeyMultibase
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
id: vmId(newClientKeys.keyAgreementKeyMultibase),
|
|
331
|
+
publicKeyMultibase: newClientKeys.keyAgreementKeyMultibase
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
id: replacementVmId,
|
|
335
|
+
publicKeyMultibase: replacement.keyAgreementKeyMultibase
|
|
336
|
+
}
|
|
337
|
+
].map(method => ({
|
|
338
|
+
...method,
|
|
339
|
+
type: MULTIKEY_VM_TYPE,
|
|
340
|
+
controller: did
|
|
341
|
+
}));
|
|
342
|
+
const existingMethods = (doc.verificationMethod ?? []);
|
|
343
|
+
const verificationMethods = [
|
|
344
|
+
...existingMethods.filter(method => method.id !== spentVmId &&
|
|
345
|
+
!addedMethods.some(added => added.id === method.id)),
|
|
346
|
+
...addedMethods
|
|
347
|
+
];
|
|
348
|
+
const withReference = (relation, id) => [...new Set([...relationIds(relation), id])];
|
|
349
|
+
const signingVmId = vmId(newClientKeys.signingKeyMultibase);
|
|
350
|
+
const signer = await updateKeySigner({
|
|
351
|
+
seed: newClientUpdateSeeds.updateSeed
|
|
352
|
+
});
|
|
353
|
+
const updated = await updateDID({
|
|
354
|
+
log: published.log,
|
|
355
|
+
signer,
|
|
356
|
+
updateKeys: [
|
|
357
|
+
...new Set([
|
|
358
|
+
...published.updateKeys.filter(key => key !== recovery.updateKeyMultibase),
|
|
359
|
+
newClientKeys.updateKeyMultibase
|
|
360
|
+
])
|
|
361
|
+
],
|
|
362
|
+
nextKeyHashes: published.nextKeyHashes.filter(hash => hash !== recoveryHash),
|
|
363
|
+
verificationMethods,
|
|
364
|
+
authentication: withReference(doc.authentication, signingVmId),
|
|
365
|
+
assertionMethod: withReference(doc.assertionMethod, signingVmId),
|
|
366
|
+
keyAgreement: [
|
|
367
|
+
...new Set([
|
|
368
|
+
...relationIds(doc.keyAgreement).filter(id => id !== spentVmId),
|
|
369
|
+
vmId(newClientKeys.keyAgreementKeyMultibase),
|
|
370
|
+
replacementVmId
|
|
371
|
+
])
|
|
372
|
+
],
|
|
373
|
+
capabilityInvocation: withReference(doc.capabilityInvocation, signingVmId),
|
|
374
|
+
capabilityDelegation: withReference(doc.capabilityDelegation, signingVmId)
|
|
375
|
+
});
|
|
376
|
+
await publishLogOnly({ store, log: updated.log });
|
|
377
|
+
return { did: updated.did, webDoc: updated.webDoc };
|
|
378
|
+
}
|
|
379
|
+
//# sourceMappingURL=recoveryWebvh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recoveryWebvh.js","sourceRoot":"","sources":["../../src/recovery/recoveryWebvh.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACV,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAQ7B;;;;;;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3C,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,YAAY,CAC9B;QACD,mBAAmB;QACnB,cAAc,EAAE,aAAa,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,CAAC;QAC9D,eAAe,EAAE,aAAa,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,CAAC;QAChE,YAAY,EAAE;YACZ,GAAG,IAAI,GAAG,CAAC;gBACT,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC;gBAC/D,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC;gBAC5C,eAAe;aAChB,CAAC;SACH;QACD,oBAAoB,EAAE,aAAa,CAAC,GAAG,CAAC,oBAAoB,EAAE,WAAW,CAAC;QAC1E,oBAAoB,EAAE,aAAa,CAAC,GAAG,CAAC,oBAAoB,EAAE,WAAW,CAAC;KAC3E,CAAC,CAAA;IACF,MAAM,cAAc,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;IACjD,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAA;AACrD,CAAC"}
|
|
@@ -62,4 +62,61 @@ export declare const PUBLIC_CREDENTIALS_COLLECTION_SPEC: SpaceCollectionSpec;
|
|
|
62
62
|
export declare const WALLET_ACTIVITY_COLLECTION_SPEC: SpaceCollectionSpec;
|
|
63
63
|
/** The wallet Space's own (non-contacts) collection specs, in provision order. */
|
|
64
64
|
export declare const WALLET_SPACE_COLLECTION_SPECS: SpaceCollectionSpec[];
|
|
65
|
+
/**
|
|
66
|
+
* The system collections and resource names that carry an account's identity
|
|
67
|
+
* and key material. They sit deliberately OUTSIDE the synced collection specs
|
|
68
|
+
* above: none of them gets a local replica or background replication, and each
|
|
69
|
+
* is read and written directly.
|
|
70
|
+
*
|
|
71
|
+
* - `id` -- world-readable (a collection-level public-read policy): the
|
|
72
|
+
* published DID document (`did.json`) and the did:webvh history log
|
|
73
|
+
* (`did.jsonl`). The path segments name the collection that holds the
|
|
74
|
+
* document, so the did:web id is `did:web:<host>:space:<spaceId>:id` and
|
|
75
|
+
* resolves to `https://<host>/space/<spaceId>/id/did.json`.
|
|
76
|
+
* - `key-map` -- private and capability-gated: the key-id map (`keys.json`)
|
|
77
|
+
* and the PUK wrap-set roster (`puk.json`). Kept separate from `id` exactly
|
|
78
|
+
* so `id` can be made world-readable without ever exposing key material.
|
|
79
|
+
* - `keyring` -- the unlock Space's single collection, holding the one
|
|
80
|
+
* keyring record (`keyring.json`). It lives in the minimal unlock Space
|
|
81
|
+
* controlled by an unlock identity, never in the wallet data Space.
|
|
82
|
+
*/
|
|
83
|
+
export declare const ID_COLLECTION: {
|
|
84
|
+
id: string;
|
|
85
|
+
name: string;
|
|
86
|
+
};
|
|
87
|
+
export declare const KEY_MAP_COLLECTION: {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
};
|
|
91
|
+
export declare const KEYRING_COLLECTION: {
|
|
92
|
+
id: string;
|
|
93
|
+
name: string;
|
|
94
|
+
};
|
|
95
|
+
/** The world-readable DID document, served as `application/did+json`. */
|
|
96
|
+
export declare const DID_DOCUMENT_RESOURCE = "did.json";
|
|
97
|
+
/**
|
|
98
|
+
* The world-readable did:webvh history log, a raw JSON-Lines string served as
|
|
99
|
+
* `text/jsonl`: one log entry per line, each a full DID-document snapshot in a
|
|
100
|
+
* hash chain. Sibling of `did.json` in the same `id` collection;
|
|
101
|
+
* `did:webvh:<scid>:<host>:space:<spaceId>:id` resolves to
|
|
102
|
+
* `https://<host>/space/<spaceId>/id/did.jsonl`.
|
|
103
|
+
*/
|
|
104
|
+
export declare const DID_LOG_RESOURCE = "did.jsonl";
|
|
105
|
+
/**
|
|
106
|
+
* The (non-public) key-id map: verification method to KMS key id. Lives in the
|
|
107
|
+
* `key-map` collection. The recovery anchor -- written before `did.json` so a
|
|
108
|
+
* torn provisioning resumes from it.
|
|
109
|
+
*/
|
|
110
|
+
export declare const DID_KEYS_RESOURCE = "keys.json";
|
|
111
|
+
/**
|
|
112
|
+
* The per-user-key (PUK) wrap-set roster, sibling of `keys.json` in the same
|
|
113
|
+
* private `key-map` collection: a `CollectionEncryption` marker stored
|
|
114
|
+
* verbatim as the resource body, whose current epoch IS the current PUK (the
|
|
115
|
+
* epoch id is the PUK's did:key; the wrapped secret is the PUK's raw key,
|
|
116
|
+
* wrapped to each enrolled client's key-agreement key). Read directly with a
|
|
117
|
+
* compare-and-swap etag -- never replicated.
|
|
118
|
+
*/
|
|
119
|
+
export declare const PUK_ROSTER_RESOURCE = "puk.json";
|
|
120
|
+
/** The keyring record: the encrypted account pointer, in the unlock Space. */
|
|
121
|
+
export declare const KEYRING_RESOURCE = "keyring.json";
|
|
65
122
|
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/space/collections.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,8BAA8B,wBAAwB,CAAA;AACnE,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,uBAAuB,CAAA;AACjE,0DAA0D;AAC1D,eAAO,MAAM,0BAA0B,oBAAoB,CAAA;AAE3D;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,SAAS,GAAG,QAAQ,CAAA;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,KAAK,GAAG,WAAW,CAAA;IAC/B,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;;GAGG;AACH,eAAO,MAAM,mCAAmC,EAAE,mBAMjD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,EAAE,mBA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AAC5C;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,aAAa,CAAA;AAC7C,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,iBAAiB,CAAA"}
|
|
@@ -62,4 +62,52 @@ export const WALLET_SPACE_COLLECTION_SPECS = [
|
|
|
62
62
|
PUBLIC_CREDENTIALS_COLLECTION_SPEC,
|
|
63
63
|
WALLET_ACTIVITY_COLLECTION_SPEC
|
|
64
64
|
];
|
|
65
|
+
/**
|
|
66
|
+
* The system collections and resource names that carry an account's identity
|
|
67
|
+
* and key material. They sit deliberately OUTSIDE the synced collection specs
|
|
68
|
+
* above: none of them gets a local replica or background replication, and each
|
|
69
|
+
* is read and written directly.
|
|
70
|
+
*
|
|
71
|
+
* - `id` -- world-readable (a collection-level public-read policy): the
|
|
72
|
+
* published DID document (`did.json`) and the did:webvh history log
|
|
73
|
+
* (`did.jsonl`). The path segments name the collection that holds the
|
|
74
|
+
* document, so the did:web id is `did:web:<host>:space:<spaceId>:id` and
|
|
75
|
+
* resolves to `https://<host>/space/<spaceId>/id/did.json`.
|
|
76
|
+
* - `key-map` -- private and capability-gated: the key-id map (`keys.json`)
|
|
77
|
+
* and the PUK wrap-set roster (`puk.json`). Kept separate from `id` exactly
|
|
78
|
+
* so `id` can be made world-readable without ever exposing key material.
|
|
79
|
+
* - `keyring` -- the unlock Space's single collection, holding the one
|
|
80
|
+
* keyring record (`keyring.json`). It lives in the minimal unlock Space
|
|
81
|
+
* controlled by an unlock identity, never in the wallet data Space.
|
|
82
|
+
*/
|
|
83
|
+
export const ID_COLLECTION = { id: 'id', name: 'Identity' };
|
|
84
|
+
export const KEY_MAP_COLLECTION = { id: 'key-map', name: 'Key Map' };
|
|
85
|
+
export const KEYRING_COLLECTION = { id: 'keyring', name: 'Keyring' };
|
|
86
|
+
/** The world-readable DID document, served as `application/did+json`. */
|
|
87
|
+
export const DID_DOCUMENT_RESOURCE = 'did.json';
|
|
88
|
+
/**
|
|
89
|
+
* The world-readable did:webvh history log, a raw JSON-Lines string served as
|
|
90
|
+
* `text/jsonl`: one log entry per line, each a full DID-document snapshot in a
|
|
91
|
+
* hash chain. Sibling of `did.json` in the same `id` collection;
|
|
92
|
+
* `did:webvh:<scid>:<host>:space:<spaceId>:id` resolves to
|
|
93
|
+
* `https://<host>/space/<spaceId>/id/did.jsonl`.
|
|
94
|
+
*/
|
|
95
|
+
export const DID_LOG_RESOURCE = 'did.jsonl';
|
|
96
|
+
/**
|
|
97
|
+
* The (non-public) key-id map: verification method to KMS key id. Lives in the
|
|
98
|
+
* `key-map` collection. The recovery anchor -- written before `did.json` so a
|
|
99
|
+
* torn provisioning resumes from it.
|
|
100
|
+
*/
|
|
101
|
+
export const DID_KEYS_RESOURCE = 'keys.json';
|
|
102
|
+
/**
|
|
103
|
+
* The per-user-key (PUK) wrap-set roster, sibling of `keys.json` in the same
|
|
104
|
+
* private `key-map` collection: a `CollectionEncryption` marker stored
|
|
105
|
+
* verbatim as the resource body, whose current epoch IS the current PUK (the
|
|
106
|
+
* epoch id is the PUK's did:key; the wrapped secret is the PUK's raw key,
|
|
107
|
+
* wrapped to each enrolled client's key-agreement key). Read directly with a
|
|
108
|
+
* compare-and-swap etag -- never replicated.
|
|
109
|
+
*/
|
|
110
|
+
export const PUK_ROSTER_RESOURCE = 'puk.json';
|
|
111
|
+
/** The keyring record: the encrypted account pointer, in the unlock Space. */
|
|
112
|
+
export const KEYRING_RESOURCE = 'keyring.json';
|
|
65
113
|
//# sourceMappingURL=collections.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/space/collections.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,8BAA8B,GAAG,qBAAqB,CAAA;AACnE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,6BAA6B,GAAG,oBAAoB,CAAA;AACjE,0DAA0D;AAC1D,MAAM,CA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ials`,
|
|
9
9
|
* `public-credentials`, `wallet-activity`). The contacts collections stay in
|
|
10
10
|
* `@interop/social-core`.
|
|
11
|
+
* - The system collections and resource names that carry identity and key
|
|
12
|
+
* material (`id`, `key-map`, `keyring`; `did.json`, `did.jsonl`, `keys.json`,
|
|
13
|
+
* `puk.json`, `keyring.json`) -- outside the synced set, never replicated.
|
|
11
14
|
* - The `wallet-activity` wire shape (`WalletActivity`) and the pure
|
|
12
15
|
* `addHistory*` payload builders.
|
|
13
16
|
* - `publicCredentialUrl`, the world-readable shared-credential URL both
|
|
@@ -16,6 +19,7 @@
|
|
|
16
19
|
* `parseWasLinkPayload` / `encodeWasLinkSecret`).
|
|
17
20
|
*/
|
|
18
21
|
export { PRIVATE_CREDENTIALS_COLLECTION, PUBLIC_CREDENTIALS_COLLECTION, WALLET_ACTIVITY_COLLECTION, PRIVATE_CREDENTIALS_COLLECTION_SPEC, PUBLIC_CREDENTIALS_COLLECTION_SPEC, WALLET_ACTIVITY_COLLECTION_SPEC, WALLET_SPACE_COLLECTION_SPECS } from './collections.js';
|
|
22
|
+
export { ID_COLLECTION, KEY_MAP_COLLECTION, KEYRING_COLLECTION, DID_DOCUMENT_RESOURCE, DID_LOG_RESOURCE, DID_KEYS_RESOURCE, PUK_ROSTER_RESOURCE, KEYRING_RESOURCE } from './collections.js';
|
|
19
23
|
export type { SpaceCollectionSpec } from './collections.js';
|
|
20
24
|
export { ACTIVITY_TYPE, addHistoryNewAccount, addHistorySpaceCreated, addHistoryCredentialCreated, addHistoryCredentialDeleted, addHistoryCredentialShared, addHistoryCredentialUnshared, addHistoryLogin, addHistoryAppRevoke } from './activity.js';
|
|
21
25
|
export type { WalletActivity, ActivityGrant } from './activity.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/space/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/space/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,0BAA0B,EAC1B,mCAAmC,EACnC,kCAAkC,EAClC,+BAA+B,EAC/B,6BAA6B,EAC9B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE3D,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,eAAe,EACf,mBAAmB,EACpB,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/space/index.js
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* - The shared collection ids and descriptive specs (`private-credentials`,
|
|
9
9
|
* `public-credentials`, `wallet-activity`). The contacts collections stay in
|
|
10
10
|
* `@interop/social-core`.
|
|
11
|
+
* - The system collections and resource names that carry identity and key
|
|
12
|
+
* material (`id`, `key-map`, `keyring`; `did.json`, `did.jsonl`, `keys.json`,
|
|
13
|
+
* `puk.json`, `keyring.json`) -- outside the synced set, never replicated.
|
|
11
14
|
* - The `wallet-activity` wire shape (`WalletActivity`) and the pure
|
|
12
15
|
* `addHistory*` payload builders.
|
|
13
16
|
* - `publicCredentialUrl`, the world-readable shared-credential URL both
|
|
@@ -16,6 +19,7 @@
|
|
|
16
19
|
* `parseWasLinkPayload` / `encodeWasLinkSecret`).
|
|
17
20
|
*/
|
|
18
21
|
export { PRIVATE_CREDENTIALS_COLLECTION, PUBLIC_CREDENTIALS_COLLECTION, WALLET_ACTIVITY_COLLECTION, PRIVATE_CREDENTIALS_COLLECTION_SPEC, PUBLIC_CREDENTIALS_COLLECTION_SPEC, WALLET_ACTIVITY_COLLECTION_SPEC, WALLET_SPACE_COLLECTION_SPECS } from './collections.js';
|
|
22
|
+
export { ID_COLLECTION, KEY_MAP_COLLECTION, KEYRING_COLLECTION, DID_DOCUMENT_RESOURCE, DID_LOG_RESOURCE, DID_KEYS_RESOURCE, PUK_ROSTER_RESOURCE, KEYRING_RESOURCE } from './collections.js';
|
|
19
23
|
export { ACTIVITY_TYPE, addHistoryNewAccount, addHistorySpaceCreated, addHistoryCredentialCreated, addHistoryCredentialDeleted, addHistoryCredentialShared, addHistoryCredentialUnshared, addHistoryLogin, addHistoryAppRevoke } from './activity.js';
|
|
20
24
|
export { publicCredentialUrl } from './publicLink.js';
|
|
21
25
|
export { encodeWasLinkSecret, buildWasLinkPayload, parseWasLinkPayload } from './wasLink.js';
|
package/dist/space/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/space/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/space/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,0BAA0B,EAC1B,mCAAmC,EACnC,kCAAkC,EAClC,+BAA+B,EAC/B,6BAA6B,EAC9B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,eAAe,EACf,mBAAmB,EACpB,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAGrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The did:web relationship map the did:webvh module round-trips: the durable
|
|
6
|
+
* `keys.json` binding from DID relationship to KMS key, plus the fragment
|
|
7
|
+
* helper both documents' verification-method ids are read through. A KMS key's
|
|
8
|
+
* public alias expands `{publicKeyMultibase}` at generate time, so a
|
|
9
|
+
* verification-method id already carries the key's `publicKeyMultibase` and no
|
|
10
|
+
* separate key-description fetch is ever needed.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* One verification method's durable binding: the verification-method id (the
|
|
14
|
+
* did:web `#fragment` URL, which is also the KMS key's publicAlias) and the
|
|
15
|
+
* KMS key id used to invoke signing.
|
|
16
|
+
*/
|
|
17
|
+
export interface DidWebKey {
|
|
18
|
+
vmId: string;
|
|
19
|
+
kmsKeyId: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The key-id map persisted as `keys.json` in the private `key-map` collection:
|
|
23
|
+
* the durable mapping from DID relationship to KMS key, since the KMS protocol
|
|
24
|
+
* has no list-keys endpoint and key ids are server-generated.
|
|
25
|
+
*/
|
|
26
|
+
export interface DidWebKeyMap {
|
|
27
|
+
authentication: DidWebKey;
|
|
28
|
+
assertionMethod: DidWebKey;
|
|
29
|
+
keyAgreement: DidWebKey;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The bare `publicKeyMultibase` a KMS key alias or verification-method id
|
|
33
|
+
* carries in its fragment. The KMS expanded `#{publicKeyMultibase}` at generate
|
|
34
|
+
* time, so the fragment IS the multibase key (no separate key-description fetch
|
|
35
|
+
* needed).
|
|
36
|
+
*
|
|
37
|
+
* @param id {string}
|
|
38
|
+
* @returns {string}
|
|
39
|
+
*/
|
|
40
|
+
export declare function multibaseOf(id: string): string;
|
|
41
|
+
//# sourceMappingURL=didWeb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"didWeb.d.ts","sourceRoot":"","sources":["../../src/webvh/didWeb.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AAEH;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,SAAS,CAAA;IACzB,eAAe,EAAE,SAAS,CAAA;IAC1B,YAAY,EAAE,SAAS,CAAA;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The did:web relationship map the did:webvh module round-trips: the durable
|
|
6
|
+
* `keys.json` binding from DID relationship to KMS key, plus the fragment
|
|
7
|
+
* helper both documents' verification-method ids are read through. A KMS key's
|
|
8
|
+
* public alias expands `{publicKeyMultibase}` at generate time, so a
|
|
9
|
+
* verification-method id already carries the key's `publicKeyMultibase` and no
|
|
10
|
+
* separate key-description fetch is ever needed.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The bare `publicKeyMultibase` a KMS key alias or verification-method id
|
|
14
|
+
* carries in its fragment. The KMS expanded `#{publicKeyMultibase}` at generate
|
|
15
|
+
* time, so the fragment IS the multibase key (no separate key-description fetch
|
|
16
|
+
* needed).
|
|
17
|
+
*
|
|
18
|
+
* @param id {string}
|
|
19
|
+
* @returns {string}
|
|
20
|
+
*/
|
|
21
|
+
export function multibaseOf(id) {
|
|
22
|
+
return id.slice(id.lastIndexOf('#') + 1);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=didWeb.js.map
|