@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 @@
|
|
|
1
|
+
{"version":3,"file":"didWeb.js","sourceRoot":"","sources":["../../src/webvh/didWeb.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AAuBH;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU;IACpC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;AAC1C,CAAC"}
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import type { DIDDoc, DIDLog, Signer } from '@interop/did-method-webvh';
|
|
2
|
+
import type { KeystoreAgent } from '@interop/webkms-client';
|
|
3
|
+
import type { DidWebKeyMap } from './didWeb.js';
|
|
4
|
+
/**
|
|
5
|
+
* The Space-side seam this module reads and writes through: the world-readable
|
|
6
|
+
* `id` collection (the DID log and document) and the private `key-map`
|
|
7
|
+
* collection's `keys.json`. A wallet app's own remote-store class satisfies
|
|
8
|
+
* the shape structurally -- no adapter needed.
|
|
9
|
+
*/
|
|
10
|
+
export interface WebvhIdStore {
|
|
11
|
+
/**
|
|
12
|
+
* The raw text body of an `id` collection resource (the JSON-Lines log), or
|
|
13
|
+
* `undefined` when it is not published.
|
|
14
|
+
*/
|
|
15
|
+
getIdResourceRaw(options: {
|
|
16
|
+
resourceId: string;
|
|
17
|
+
}): Promise<string | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* The parsed JSON body of an `id` collection resource (the DID document), or
|
|
20
|
+
* `undefined` when it is not published.
|
|
21
|
+
*/
|
|
22
|
+
getIdResource(options: {
|
|
23
|
+
resourceId: string;
|
|
24
|
+
}): Promise<unknown>;
|
|
25
|
+
/**
|
|
26
|
+
* Writes (upserts) an `id` collection resource.
|
|
27
|
+
*/
|
|
28
|
+
putIdResource(options: {
|
|
29
|
+
resourceId: string;
|
|
30
|
+
content: object | string;
|
|
31
|
+
contentType?: string;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Writes (upserts) `keys.json` in the private `key-map` collection.
|
|
35
|
+
*/
|
|
36
|
+
putKeyMap(options: {
|
|
37
|
+
content: object;
|
|
38
|
+
}): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The Multikey verification-method type the did:webvh data model uses for both
|
|
42
|
+
* the Ed25519 (authentication/assertionMethod/capability*) and X25519
|
|
43
|
+
* (keyAgreement) keys. The same key material and multibase are carried as by
|
|
44
|
+
* the 2020 suite types, only `type` and `@context` change, and credential
|
|
45
|
+
* verifiers verify `Ed25519Signature2020` / `eddsa-rdfc-2022` proofs against
|
|
46
|
+
* it.
|
|
47
|
+
*/
|
|
48
|
+
export declare const MULTIKEY_VM_TYPE = "Multikey";
|
|
49
|
+
/**
|
|
50
|
+
* The client-held did:webvh update-key material: 32-byte Ed25519 seeds.
|
|
51
|
+
* `pendingStagedSeed` is present only mid-rotation (minted and persisted
|
|
52
|
+
* before the log entry publishes, promoted to `stagedSeed` after).
|
|
53
|
+
*/
|
|
54
|
+
export interface ClientWebvhUpdateKeys {
|
|
55
|
+
updateSeed: Uint8Array;
|
|
56
|
+
stagedSeed: Uint8Array;
|
|
57
|
+
pendingStagedSeed?: Uint8Array;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The public halves of one enrolled client's key set, as they appear in the
|
|
61
|
+
* document: the Ed25519 signing key (`z6Mk...`) and its X25519 key-agreement
|
|
62
|
+
* twin (`z6LS...`).
|
|
63
|
+
*/
|
|
64
|
+
export interface WebvhClientKeys {
|
|
65
|
+
signingKeyMultibase: string;
|
|
66
|
+
keyAgreementKeyMultibase: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The `webvh` block added to `keys.json` v2, a sibling of the did:web
|
|
70
|
+
* relationship map. Absent block = a record written before did:webvh hosting;
|
|
71
|
+
* everything degrades to did:web behavior, no format-version bump (additive
|
|
72
|
+
* convention). It carries only the published DID: the update keys are
|
|
73
|
+
* client-held seeds, never recorded in a Space-hosted resource.
|
|
74
|
+
*/
|
|
75
|
+
export interface DidWebvhBlock {
|
|
76
|
+
did?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* `keys.json` v2: the did:web key map plus the optional `webvh` block. The
|
|
80
|
+
* did:web parse/guard tolerates and preserves the block, so a round-trip
|
|
81
|
+
* through the did:web provisioning never strips it.
|
|
82
|
+
*/
|
|
83
|
+
export type DidWebKeyMapV2 = DidWebKeyMap & {
|
|
84
|
+
webvh?: DidWebvhBlock;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* The `did:webvh:{SCID}:<host>:space:<spaceId>:id` controller template, with
|
|
88
|
+
* the literal `{SCID}` placeholder the library replaces at creation. The host
|
|
89
|
+
* segment percent-encodes a port (`localhost:8080` becomes `localhost%3A8080`),
|
|
90
|
+
* matching the library's `toDidDomainComponent`.
|
|
91
|
+
*
|
|
92
|
+
* @param options {object}
|
|
93
|
+
* @param options.wasServerUrl {string}
|
|
94
|
+
* @param options.spaceId {string}
|
|
95
|
+
* @returns {string}
|
|
96
|
+
*/
|
|
97
|
+
export declare function didWebvhControllerTemplate({ wasServerUrl, spaceId }: {
|
|
98
|
+
wasServerUrl: string;
|
|
99
|
+
spaceId: string;
|
|
100
|
+
}): string;
|
|
101
|
+
/**
|
|
102
|
+
* Mints a fresh pair of client-held update-key seeds (active + staged) for a
|
|
103
|
+
* brand-new did:webvh log. The caller owns persistence: these seeds are the
|
|
104
|
+
* only update authority the log will ever accept, so they must be durable
|
|
105
|
+
* before {@link ensureDidWebvh} publishes anything.
|
|
106
|
+
*
|
|
107
|
+
* @returns {Promise<ClientWebvhUpdateKeys>}
|
|
108
|
+
*/
|
|
109
|
+
export declare function mintClientWebvhUpdateKeys(): Promise<ClientWebvhUpdateKeys>;
|
|
110
|
+
/**
|
|
111
|
+
* The `publicKeyMultibase` of the Ed25519 update key a seed derives, as it
|
|
112
|
+
* appears in the log's `parameters.updateKeys`.
|
|
113
|
+
*
|
|
114
|
+
* @param options {object}
|
|
115
|
+
* @param options.seed {Uint8Array} a 32-byte Ed25519 seed
|
|
116
|
+
* @returns {Promise<string>}
|
|
117
|
+
*/
|
|
118
|
+
export declare function updateKeyMultibase({ seed }: {
|
|
119
|
+
seed: Uint8Array;
|
|
120
|
+
}): Promise<string>;
|
|
121
|
+
/**
|
|
122
|
+
* Bridges a client-held update-key seed to the did:webvh `Signer` interface via
|
|
123
|
+
* the library's `signerFromExternalKey`. The only wallet-side seam is the shape
|
|
124
|
+
* adapter: the key pair's `signer().sign({ data })` matches the factory's
|
|
125
|
+
* `sign({ data })` bridge exactly, so the proof-value multibase encoding and
|
|
126
|
+
* the load-bearing `did:key:<pkm>#<pkm>` verification-method id (which the
|
|
127
|
+
* resolver matches against the entry's authorized `updateKeys`) are owned by
|
|
128
|
+
* the library, not duplicated here.
|
|
129
|
+
*
|
|
130
|
+
* @param options {object}
|
|
131
|
+
* @param options.seed {Uint8Array} the 32-byte update-key seed
|
|
132
|
+
* @returns {Promise<Signer>}
|
|
133
|
+
*/
|
|
134
|
+
export declare function updateKeySigner({ seed }: {
|
|
135
|
+
seed: Uint8Array;
|
|
136
|
+
}): Promise<Signer>;
|
|
137
|
+
/**
|
|
138
|
+
* Publishes an already-created log: PUT `did.jsonl` (`text/jsonl`) then PUT
|
|
139
|
+
* `did.json` from `webDoc` (`application/did+json`, adopting the webvh
|
|
140
|
+
* projection). Both land in the `id` collection, whose collection-level
|
|
141
|
+
* `PublicCanRead` policy (set at provisioning) makes them world-readable, so
|
|
142
|
+
* the publish tail no longer sets per-resource policies. The shared publish
|
|
143
|
+
* tail of the create and rotate paths.
|
|
144
|
+
*
|
|
145
|
+
* @param options {object}
|
|
146
|
+
* @param options.idStore {WebvhIdStore}
|
|
147
|
+
* @param options.log {DIDLog}
|
|
148
|
+
* @param options.webDoc {object}
|
|
149
|
+
* @returns {Promise<void>}
|
|
150
|
+
*/
|
|
151
|
+
export declare function publishWebvhLog({ idStore, log, webDoc }: {
|
|
152
|
+
idStore: WebvhIdStore;
|
|
153
|
+
log: DIDLog;
|
|
154
|
+
webDoc: object;
|
|
155
|
+
}): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* The verified state of the published log: the log itself, the resolved DID
|
|
158
|
+
* and document, and the effective update-key parameters (the authorized
|
|
159
|
+
* `updateKeys` and the standing `nextKeyHashes` commitments).
|
|
160
|
+
*/
|
|
161
|
+
export interface PublishedWebvhLog {
|
|
162
|
+
log: DIDLog;
|
|
163
|
+
did: string;
|
|
164
|
+
doc: DIDDoc;
|
|
165
|
+
updateKeys: string[];
|
|
166
|
+
nextKeyHashes: string[];
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Reads and resolves the published `did.jsonl`, or returns `undefined` when
|
|
170
|
+
* the log is not published. A log that exists but fails to resolve throws --
|
|
171
|
+
* a published-but-broken log is never silently re-created over.
|
|
172
|
+
*
|
|
173
|
+
* @param options {object}
|
|
174
|
+
* @param options.idStore {WebvhIdStore}
|
|
175
|
+
* @returns {Promise<PublishedWebvhLog | undefined>}
|
|
176
|
+
*/
|
|
177
|
+
export declare function readPublishedLog({ idStore }: {
|
|
178
|
+
idStore: WebvhIdStore;
|
|
179
|
+
}): Promise<PublishedWebvhLog | undefined>;
|
|
180
|
+
/**
|
|
181
|
+
* Idempotently provisions and publishes the user's did:webvh DID log, run
|
|
182
|
+
* directly after the did:web provisioning (non-fatal). The durable anchor is
|
|
183
|
+
* the caller-persisted update-key seeds, so the flow is a simple probe:
|
|
184
|
+
*
|
|
185
|
+
* - `did.jsonl` published: sanity-check that the log's authorized `updateKeys`
|
|
186
|
+
* still name one of this client's seeds (active, staged, or pending -- a
|
|
187
|
+
* rotation in flight finalizes separately), adopt the resolved DID, and
|
|
188
|
+
* write the `keys.json` webvh block if it is missing or stale.
|
|
189
|
+
* - `did.jsonl` absent: create the log with the active update key, prerotation
|
|
190
|
+
* committed to the staged key, publish log + `did.json`, then record the DID
|
|
191
|
+
* in `keys.json`.
|
|
192
|
+
*
|
|
193
|
+
* A published log whose `updateKeys` match none of the seeds is fatal: with
|
|
194
|
+
* client-held update keys a lost seed is lost update authority, and no KMS
|
|
195
|
+
* repair path exists by design.
|
|
196
|
+
*
|
|
197
|
+
* @param options {object}
|
|
198
|
+
* @param options.idStore {WebvhIdStore}
|
|
199
|
+
* @param options.wasServerUrl {string}
|
|
200
|
+
* @param options.spaceId {string}
|
|
201
|
+
* @param options.didWebKeys {DidWebKeyMapV2} the parsed keys.json (with any
|
|
202
|
+
* webvh block) returned by the did:web provisioning.
|
|
203
|
+
* @param options.clientKeys {WebvhClientKeys} this client's published keys
|
|
204
|
+
* @param options.updateKeys {ClientWebvhUpdateKeys} already durably persisted
|
|
205
|
+
* @returns {Promise<{ did: string }>}
|
|
206
|
+
*/
|
|
207
|
+
export declare function ensureDidWebvh({ idStore, wasServerUrl, spaceId, didWebKeys, clientKeys, updateKeys }: {
|
|
208
|
+
idStore: WebvhIdStore;
|
|
209
|
+
wasServerUrl: string;
|
|
210
|
+
spaceId: string;
|
|
211
|
+
didWebKeys: DidWebKeyMapV2;
|
|
212
|
+
clientKeys: WebvhClientKeys;
|
|
213
|
+
updateKeys: ClientWebvhUpdateKeys;
|
|
214
|
+
}): Promise<{
|
|
215
|
+
did: string;
|
|
216
|
+
}>;
|
|
217
|
+
/**
|
|
218
|
+
* Rotates this client's did:webvh update key (the user-triggered ceremony on
|
|
219
|
+
* the wallet's settings screen). The staged key is revealed to sign its own
|
|
220
|
+
* activation and become the sole active update key, a freshly minted staged
|
|
221
|
+
* key is committed as the new `nextKeyHashes`, and the caller's persisted
|
|
222
|
+
* seeds roll forward. No KMS and no `keys.json` involvement: the update keys
|
|
223
|
+
* are client-held, and the published DID does not change.
|
|
224
|
+
*
|
|
225
|
+
* The persist-before-publish invariant is load-bearing: the new staged seed is
|
|
226
|
+
* handed to `persistUpdateKeys` (as `pendingStagedSeed`) and awaited BEFORE the
|
|
227
|
+
* log entry committing it is published, so no published log can ever depend on
|
|
228
|
+
* a seed that is not durable. A crash between publish and finalize is
|
|
229
|
+
* recovered on the next run: the log already sits at the staged (or pending)
|
|
230
|
+
* key, and the seeds are simply rolled forward locally without touching it.
|
|
231
|
+
*
|
|
232
|
+
* @param options {object}
|
|
233
|
+
* @param options.idStore {WebvhIdStore}
|
|
234
|
+
* @param options.updateKeys {ClientWebvhUpdateKeys} the current seeds
|
|
235
|
+
* @param options.persistUpdateKeys {Function} awaited before every publish
|
|
236
|
+
* that changes the log's authorized update keys
|
|
237
|
+
* @returns {Promise<{ did: string }>}
|
|
238
|
+
*/
|
|
239
|
+
export declare function rotateWebvhUpdateKey({ idStore, updateKeys, persistUpdateKeys }: {
|
|
240
|
+
idStore: WebvhIdStore;
|
|
241
|
+
updateKeys: ClientWebvhUpdateKeys;
|
|
242
|
+
persistUpdateKeys: (next: ClientWebvhUpdateKeys) => Promise<void>;
|
|
243
|
+
}): Promise<{
|
|
244
|
+
did: string;
|
|
245
|
+
}>;
|
|
246
|
+
/**
|
|
247
|
+
* The public halves of a client being enrolled: its published key set (the
|
|
248
|
+
* Ed25519 signing key and X25519 key-agreement twin that become document
|
|
249
|
+
* verification methods) plus its update-key pair -- the active key that joins
|
|
250
|
+
* `updateKeys` and the staged key whose hash is committed so the new client
|
|
251
|
+
* can later self-rotate. All four are `publicKeyMultibase` strings; the seeds
|
|
252
|
+
* behind them never leave the client being enrolled.
|
|
253
|
+
*/
|
|
254
|
+
export interface WebvhEnrollmentKeys extends WebvhClientKeys {
|
|
255
|
+
updateKeyMultibase: string;
|
|
256
|
+
stagedUpdateKeyMultibase: string;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* The relationship references of a resolved document as verification-method
|
|
260
|
+
* ids, tolerating embedded objects beside string references.
|
|
261
|
+
*
|
|
262
|
+
* @param relation {Array} the relationship array, when present
|
|
263
|
+
* @returns {string[]}
|
|
264
|
+
*/
|
|
265
|
+
export declare function relationIds(relation: Array<string | {
|
|
266
|
+
id?: string;
|
|
267
|
+
}> | undefined): string[];
|
|
268
|
+
/**
|
|
269
|
+
* Enrolls a second wallet client into the published did:webvh document -- the
|
|
270
|
+
* log half of the enrollment ceremony (the PUK roster wrap happens first,
|
|
271
|
+
* outside this module). Two entries, forced by prerotation (a new update key
|
|
272
|
+
* must hash into the PREVIOUS entry's `nextKeyHashes`):
|
|
273
|
+
*
|
|
274
|
+
* 1. **Commit**: a sparse entry extending `nextKeyHashes` with the new
|
|
275
|
+
* client's update-key and staged-key hashes (document and `updateKeys`
|
|
276
|
+
* untouched).
|
|
277
|
+
* 2. **Add**: an entry adding the new client's verification methods (its
|
|
278
|
+
* Ed25519 key under the four signing relationships, its X25519 twin under
|
|
279
|
+
* `keyAgreement`) and its update key to `updateKeys`.
|
|
280
|
+
*
|
|
281
|
+
* Both entries are signed by THIS client's active update key (quorum-of-one:
|
|
282
|
+
* any single enrolled client can enroll). The ceremony is resumable from
|
|
283
|
+
* durable state alone: a tear after the commit is detected by its hashes
|
|
284
|
+
* already standing in `nextKeyHashes` (skip to the add entry), and a
|
|
285
|
+
* completed enrollment is detected by the update key already being authorized
|
|
286
|
+
* (no-op). Re-running with the same key set converges without forking the
|
|
287
|
+
* log.
|
|
288
|
+
*
|
|
289
|
+
* @param options {object}
|
|
290
|
+
* @param options.idStore {WebvhIdStore}
|
|
291
|
+
* @param options.updateKeys {ClientWebvhUpdateKeys} THIS client's seeds
|
|
292
|
+
* @param options.newClient {WebvhEnrollmentKeys} the enrollee's public halves
|
|
293
|
+
* @returns {Promise<{ did: string }>}
|
|
294
|
+
*/
|
|
295
|
+
export declare function enrollWebvhClient({ idStore, updateKeys, newClient }: {
|
|
296
|
+
idStore: WebvhIdStore;
|
|
297
|
+
updateKeys: ClientWebvhUpdateKeys;
|
|
298
|
+
newClient: WebvhEnrollmentKeys;
|
|
299
|
+
}): Promise<{
|
|
300
|
+
did: string;
|
|
301
|
+
}>;
|
|
302
|
+
/**
|
|
303
|
+
* Rebuilds `keys.json` from the published artifacts plus a WebKMS key listing
|
|
304
|
+
* -- the recovery path for a lost or rolled-back `keys.json`. List Keys is
|
|
305
|
+
* authorized as `read` against the keystore controller, which only the
|
|
306
|
+
* root-controlled keystore agent can invoke.
|
|
307
|
+
*
|
|
308
|
+
* KMS key local ids are server-generated random and appear in no published
|
|
309
|
+
* artifact, so the bindings are rediscovered by public key material instead.
|
|
310
|
+
* List the keystore once -- each listed description carries `keyUrl`, the
|
|
311
|
+
* key's canonical invocation URL (the signable handle its alias-overridden
|
|
312
|
+
* `id` erases) -- then match `did.json`'s three relationship verification
|
|
313
|
+
* methods by `publicKeyMultibase` and rewrite `keys.json` from what matched.
|
|
314
|
+
* When `did.jsonl` is published, its resolved DID is recorded in the `webvh`
|
|
315
|
+
* block; there is nothing else to repair there, since the log's update keys are
|
|
316
|
+
* client-held seeds that no keystore listing could recover.
|
|
317
|
+
*
|
|
318
|
+
* An unmatchable binding is unrepairable and throws: a published artifact
|
|
319
|
+
* depends on a key the keystore no longer lists.
|
|
320
|
+
*
|
|
321
|
+
* @param options {object}
|
|
322
|
+
* @param options.keystoreAgent {KeystoreAgent}
|
|
323
|
+
* @param options.idStore {WebvhIdStore}
|
|
324
|
+
* @returns {Promise<DidWebKeyMapV2>} the rebuilt, persisted keys.json
|
|
325
|
+
*/
|
|
326
|
+
export declare function repairKeyBindings({ keystoreAgent, idStore }: {
|
|
327
|
+
keystoreAgent: KeystoreAgent;
|
|
328
|
+
idStore: WebvhIdStore;
|
|
329
|
+
}): Promise<DidWebKeyMapV2>;
|
|
330
|
+
//# sourceMappingURL=didWebvh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"didWebvh.d.ts","sourceRoot":"","sources":["../../src/webvh/didWebvh.ts"],"names":[],"mappings":"AA0DA,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EACN,MAAM,EAEP,MAAM,2BAA2B,CAAA;AAElC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAO3D,OAAO,KAAK,EAAa,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,gBAAgB,CAAC,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC9E;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAChE;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE;QACrB,UAAU,EAAE,MAAM,CAAA;QAClB,OAAO,EAAE,MAAM,GAAG,MAAM,CAA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