@interop/wallet-core 0.41.0 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -4
- package/dist/clients/rosterPolicy.d.ts +28 -16
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +51 -26
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/descriptors/index.d.ts +1 -1
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +1 -1
- package/dist/descriptors/index.js.map +1 -1
- package/dist/descriptors/logSource.d.ts +58 -6
- package/dist/descriptors/logSource.d.ts.map +1 -1
- package/dist/descriptors/logSource.js +57 -15
- package/dist/descriptors/logSource.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +14 -26
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/keyring/fetch.d.ts +12 -0
- package/dist/keyring/fetch.d.ts.map +1 -1
- package/dist/keyring/fetch.js +0 -2
- package/dist/keyring/fetch.js.map +1 -1
- package/dist/keyring/index.d.ts +1 -1
- package/dist/keyring/index.d.ts.map +1 -1
- package/dist/keyring/index.js +1 -1
- package/dist/keyring/index.js.map +1 -1
- package/dist/keyring/kdf.d.ts +22 -6
- package/dist/keyring/kdf.d.ts.map +1 -1
- package/dist/keyring/kdf.js +9 -14
- package/dist/keyring/kdf.js.map +1 -1
- package/dist/keys/index.d.ts +1 -1
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +1 -1
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts +4 -1
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +13 -16
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/rosterStore.d.ts +13 -1
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +18 -0
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +17 -5
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +38 -13
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/recovery/index.d.ts +14 -12
- package/dist/recovery/index.d.ts.map +1 -1
- package/dist/recovery/index.js +13 -11
- package/dist/recovery/index.js.map +1 -1
- package/dist/recovery/recoveryCode.d.ts +5 -17
- package/dist/recovery/recoveryCode.d.ts.map +1 -1
- package/dist/recovery/recoveryCode.js +4 -14
- package/dist/recovery/recoveryCode.js.map +1 -1
- package/dist/recovery/recoveryDelegation.d.ts +50 -19
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
- package/dist/recovery/recoveryDelegation.js +86 -41
- package/dist/recovery/recoveryDelegation.js.map +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +13 -22
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +37 -129
- package/dist/recovery/recoveryWebvh.js.map +1 -1
- package/dist/resourceLog/append.d.ts +12 -3
- package/dist/resourceLog/append.d.ts.map +1 -1
- package/dist/resourceLog/append.js +17 -10
- package/dist/resourceLog/append.js.map +1 -1
- package/dist/resourceLog/index.d.ts +1 -1
- package/dist/resourceLog/index.d.ts.map +1 -1
- package/dist/resourceLog/index.js +1 -1
- package/dist/resourceLog/index.js.map +1 -1
- package/dist/resourceLog/pin.d.ts +46 -8
- package/dist/resourceLog/pin.d.ts.map +1 -1
- package/dist/resourceLog/pin.js +32 -7
- package/dist/resourceLog/pin.js.map +1 -1
- package/dist/resourceLog/seal.d.ts +4 -1
- package/dist/resourceLog/seal.d.ts.map +1 -1
- package/dist/resourceLog/seal.js +6 -2
- package/dist/resourceLog/seal.js.map +1 -1
- package/dist/unlock/index.d.ts +40 -0
- package/dist/unlock/index.d.ts.map +1 -0
- package/dist/unlock/index.js +36 -0
- package/dist/unlock/index.js.map +1 -0
- package/dist/unlock/ladder.d.ts +100 -0
- package/dist/unlock/ladder.d.ts.map +1 -0
- package/dist/unlock/ladder.js +144 -0
- package/dist/unlock/ladder.js.map +1 -0
- package/dist/unlock/selfEnroll.d.ts +83 -0
- package/dist/unlock/selfEnroll.d.ts.map +1 -0
- package/dist/unlock/selfEnroll.js +126 -0
- package/dist/unlock/selfEnroll.js.map +1 -0
- package/dist/unlock/standingClient.d.ts +68 -0
- package/dist/unlock/standingClient.d.ts.map +1 -0
- package/dist/unlock/standingClient.js +81 -0
- package/dist/unlock/standingClient.js.map +1 -0
- package/dist/unlock/standingWebvh.d.ts +153 -0
- package/dist/unlock/standingWebvh.d.ts.map +1 -0
- package/dist/unlock/standingWebvh.js +370 -0
- package/dist/unlock/standingWebvh.js.map +1 -0
- package/dist/unlock/unlockRecord.d.ts +207 -0
- package/dist/unlock/unlockRecord.d.ts.map +1 -0
- package/dist/unlock/unlockRecord.js +435 -0
- package/dist/unlock/unlockRecord.js.map +1 -0
- package/dist/webvh/didWebvh.d.ts +94 -6
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +175 -19
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/index.d.ts +7 -2
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +7 -2
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/keyAgreement.d.ts +22 -6
- package/dist/webvh/keyAgreement.d.ts.map +1 -1
- package/dist/webvh/keyAgreement.js +1 -1
- package/dist/webvh/keyAgreement.js.map +1 -1
- package/dist/webvh/verifyLog.d.ts +15 -2
- package/dist/webvh/verifyLog.d.ts.map +1 -1
- package/dist/webvh/verifyLog.js +22 -3
- package/dist/webvh/verifyLog.js.map +1 -1
- package/package.json +11 -5
- package/dist/recovery/recoveryRecord.d.ts +0 -172
- package/dist/recovery/recoveryRecord.d.ts.map +0 -1
- package/dist/recovery/recoveryRecord.js +0 -288
- package/dist/recovery/recoveryRecord.js.map +0 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { VerificationMethod } from '@interop/did-method-webvh';
|
|
2
|
+
import type { ClientWebvhUpdateKeys, WebvhEnrollmentKeys, WebvhIdStore } from '../webvh/didWebvh.js';
|
|
3
|
+
/**
|
|
4
|
+
* The narrow store seam the self-enrollment continuation writes through: a
|
|
5
|
+
* public read of the log and the delegated `did.jsonl` PUT. A subset of
|
|
6
|
+
* {@link WebvhIdStore}, so an app's remote-store class satisfies it too.
|
|
7
|
+
*/
|
|
8
|
+
export type UnlockLogStore = Pick<WebvhIdStore, 'getIdResourceRaw' | 'putIdResource'>;
|
|
9
|
+
/**
|
|
10
|
+
* How a credential's key-agreement key is published in the document: the key
|
|
11
|
+
* verbatim (a high-entropy credential -- passkey PRF, recovery code), or its
|
|
12
|
+
* hash commitment (`keyAgreementCommitment`) for a low-entropy-derived key.
|
|
13
|
+
* A commitment withholds the key material and gives the roster's recipient
|
|
14
|
+
* resolver a document-anchored check to verify a roster-carried key against.
|
|
15
|
+
*/
|
|
16
|
+
export type UnlockKeyAgreementPublication = {
|
|
17
|
+
publicKeyMultibase: string;
|
|
18
|
+
} | {
|
|
19
|
+
commitment: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A standing credential's public posture as the document and log carry it:
|
|
23
|
+
* its key-agreement publication and the update key whose hash stands in
|
|
24
|
+
* `nextKeyHashes` (ladder rung 0 at bind time; a code's single derived key).
|
|
25
|
+
*/
|
|
26
|
+
export interface StandingUnlockKeys {
|
|
27
|
+
keyAgreement: UnlockKeyAgreementPublication;
|
|
28
|
+
updateKeyMultibase: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The verification-method id a credential's key-agreement entry publishes
|
|
32
|
+
* under: `<did>#<multibase>` for a verbatim key (indistinguishable by id from
|
|
33
|
+
* any other keyAgreement entry), `<did>#<commitment>` for a commitment entry
|
|
34
|
+
* (the commitment string is deterministic, so the id is too).
|
|
35
|
+
*
|
|
36
|
+
* @param options {object}
|
|
37
|
+
* @param options.did {string} the account's did:webvh
|
|
38
|
+
* @param options.keyAgreement {UnlockKeyAgreementPublication}
|
|
39
|
+
* @returns {string}
|
|
40
|
+
*/
|
|
41
|
+
export declare function unlockKeyVmId({ did, keyAgreement }: {
|
|
42
|
+
did: string;
|
|
43
|
+
keyAgreement: UnlockKeyAgreementPublication;
|
|
44
|
+
}): string;
|
|
45
|
+
/**
|
|
46
|
+
* The credential's `keyAgreement` verification method: an ordinary unmarked
|
|
47
|
+
* entry carrying either the key verbatim (a `Multikey` with
|
|
48
|
+
* `publicKeyMultibase`) or its hash commitment (a `MultikeyCommitment` with
|
|
49
|
+
* `publicKeyCommitment` -- the document convention for a low-entropy-derived
|
|
50
|
+
* key, which withholds the key material and gives the roster resolver a
|
|
51
|
+
* document-anchored check). Controlled by the account and deliberately
|
|
52
|
+
* unmarked: a credential is not a listed client, so its entry must never
|
|
53
|
+
* carry the controller marker a client listing or a revocation removal
|
|
54
|
+
* matches on.
|
|
55
|
+
*
|
|
56
|
+
* @param options {object}
|
|
57
|
+
* @param options.did {string} the account's did:webvh
|
|
58
|
+
* @param options.keyAgreement {UnlockKeyAgreementPublication}
|
|
59
|
+
* @returns {VerificationMethod}
|
|
60
|
+
*/
|
|
61
|
+
export declare function unlockKeyVerificationMethod({ did, keyAgreement }: {
|
|
62
|
+
did: string;
|
|
63
|
+
keyAgreement: UnlockKeyAgreementPublication;
|
|
64
|
+
}): VerificationMethod;
|
|
65
|
+
/**
|
|
66
|
+
* BIND (run by an enrolled client, root authority): publishes a standing
|
|
67
|
+
* credential's split posture into the document -- one entry adding the
|
|
68
|
+
* credential's `keyAgreement` entry (verbatim or commitment) and committing
|
|
69
|
+
* its current update key's hash in `nextKeyHashes`. The update key joins
|
|
70
|
+
* `updateKeys` nowhere. Idempotent: a posture already published is a no-op,
|
|
71
|
+
* so re-running a torn bind converges. The entry publishes conditionally on
|
|
72
|
+
* the log this call read; a race lost to a concurrent ceremony re-runs and
|
|
73
|
+
* rebases on the new head.
|
|
74
|
+
*
|
|
75
|
+
* @param options {object}
|
|
76
|
+
* @param options.idStore {WebvhIdStore}
|
|
77
|
+
* @param options.updateKeys {ClientWebvhUpdateKeys} the BINDING client's own
|
|
78
|
+
* did:webvh update-key seeds
|
|
79
|
+
* @param options.unlockKeys {StandingUnlockKeys} the credential's public
|
|
80
|
+
* posture
|
|
81
|
+
* @param [options.expectedDid] {string} the account DID the log must resolve
|
|
82
|
+
* to, from the caller's stored account pointer
|
|
83
|
+
* @param [options.verb] {string} what the caller is doing, for the
|
|
84
|
+
* pending-rotation refusal message (e.g. `'issuing a recovery code'`)
|
|
85
|
+
* @returns {Promise<{ did: string }>}
|
|
86
|
+
*/
|
|
87
|
+
export declare function publishUnlockKey(options: {
|
|
88
|
+
idStore: WebvhIdStore;
|
|
89
|
+
updateKeys: ClientWebvhUpdateKeys;
|
|
90
|
+
unlockKeys: StandingUnlockKeys;
|
|
91
|
+
expectedDid?: string;
|
|
92
|
+
verb?: string;
|
|
93
|
+
}): Promise<{
|
|
94
|
+
did: string;
|
|
95
|
+
}>;
|
|
96
|
+
/**
|
|
97
|
+
* REMOVAL (run by an enrolled client, root authority): removes a standing
|
|
98
|
+
* credential's posture from the document -- its `keyAgreement` entry and its
|
|
99
|
+
* committed update-key hash -- in one entry. Idempotent. The roster-side half
|
|
100
|
+
* (rotating the user key epoch off the credential's wrap) is the caller's,
|
|
101
|
+
* and runs after this so the resolver's document no longer backs the removed
|
|
102
|
+
* entry.
|
|
103
|
+
*
|
|
104
|
+
* @param options {object} see {@link publishUnlockKey}
|
|
105
|
+
* @returns {Promise<{ did: string }>}
|
|
106
|
+
*/
|
|
107
|
+
export declare function removeUnlockKey(options: {
|
|
108
|
+
idStore: WebvhIdStore;
|
|
109
|
+
updateKeys: ClientWebvhUpdateKeys;
|
|
110
|
+
unlockKeys: StandingUnlockKeys;
|
|
111
|
+
expectedDid?: string;
|
|
112
|
+
verb?: string;
|
|
113
|
+
}): Promise<{
|
|
114
|
+
did: string;
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* SELF-ENROLLMENT (run by the credential-derived client through the delegated
|
|
118
|
+
* `did.jsonl` PUT): writes the standing continuation described in the module
|
|
119
|
+
* doc -- the reveal-and-commit entry signed by the attributed ladder rung,
|
|
120
|
+
* then the add entry signed by the new ordinary client's update key, which
|
|
121
|
+
* also retires the spent rung. Resumable from durable state alone: a
|
|
122
|
+
* completed continuation is detected by the new client's update key already
|
|
123
|
+
* being authorized (no-op), a torn one by the attribution finding the rung
|
|
124
|
+
* already revealed. Both entries publish conditionally on the read they were
|
|
125
|
+
* built on, and a race lost to a concurrent ceremony re-runs from the top --
|
|
126
|
+
* re-attributing, which is exactly the retry-up-the-ladder resolution.
|
|
127
|
+
*
|
|
128
|
+
* @param options {object}
|
|
129
|
+
* @param options.store {UnlockLogStore} public log read + delegated PUT
|
|
130
|
+
* @param options.ladderSeed {Uint8Array} the credential's ladder seed, from
|
|
131
|
+
* its unlock record
|
|
132
|
+
* @param options.newClientKeys {WebvhEnrollmentKeys} the new ordinary
|
|
133
|
+
* client's public halves
|
|
134
|
+
* @param options.newClientUpdateSeeds {ClientWebvhUpdateKeys} the new
|
|
135
|
+
* client's update-key seeds (minted by the self-enrolling flow, which
|
|
136
|
+
* therefore holds them and can sign the add entry)
|
|
137
|
+
* @param [options.expectedDid] {string} the account DID the log must resolve
|
|
138
|
+
* to, from the credential-authenticated pointer
|
|
139
|
+
* @returns {Promise<{ did: string, webDoc?: object }>} the account DID and,
|
|
140
|
+
* when the add entry ran here, the final `did.json` projection for the
|
|
141
|
+
* enrolled session to republish
|
|
142
|
+
*/
|
|
143
|
+
export declare function selfEnrollWebvhClient(options: {
|
|
144
|
+
store: UnlockLogStore;
|
|
145
|
+
ladderSeed: Uint8Array;
|
|
146
|
+
newClientKeys: WebvhEnrollmentKeys;
|
|
147
|
+
newClientUpdateSeeds: ClientWebvhUpdateKeys;
|
|
148
|
+
expectedDid?: string;
|
|
149
|
+
}): Promise<{
|
|
150
|
+
did: string;
|
|
151
|
+
webDoc?: object;
|
|
152
|
+
}>;
|
|
153
|
+
//# sourceMappingURL=standingWebvh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standingWebvh.d.ts","sourceRoot":"","sources":["../../src/unlock/standingWebvh.ts"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAU,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAe3E,OAAO,KAAK,EACV,qBAAqB,EAErB,mBAAmB,EACnB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAG7B;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,YAAY,EACZ,kBAAkB,GAAG,eAAe,CACrC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,6BAA6B,GACvC;IAAE,kBAAkB,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAA;AAEzD;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,6BAA6B,CAAA;IAC3C,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,EAC5B,GAAG,EACH,YAAY,EACb,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,6BAA6B,CAAA;CAC5C,GAAG,MAAM,CAMT;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,GAAG,EACH,YAAY,EACb,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,6BAA6B,CAAA;CAC5C,GAAG,kBAAkB,CAgBrB;AAsDD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,OAAO,EAAE,YAAY,CAAA;IACrB,UAAU,EAAE,qBAAqB,CAAA;IACjC,UAAU,EAAE,kBAAkB,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAI3B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE;IAC7C,OAAO,EAAE,YAAY,CAAA;IACrB,UAAU,EAAE,qBAAqB,CAAA;IACjC,UAAU,EAAE,kBAAkB,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAI3B;AAkGD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IACnD,KAAK,EAAE,cAAc,CAAA;IACrB,UAAU,EAAE,UAAU,CAAA;IACtB,aAAa,EAAE,mBAAmB,CAAA;IAClC,oBAAoB,EAAE,qBAAqB,CAAA;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAE5C"}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The did:webvh half of the standing unlock-credential lifecycle: the split
|
|
6
|
+
* posture every unlock method holds under the standing model, and the
|
|
7
|
+
* self-enrolling continuation a fresh browser runs with nothing but the
|
|
8
|
+
* credential in hand.
|
|
9
|
+
*
|
|
10
|
+
* At bind time the document gains the credential's `keyAgreement` entry --
|
|
11
|
+
* the key verbatim for a high-entropy credential (a passkey PRF output, a
|
|
12
|
+
* recovery code), or a `MultikeyCommitment` entry for a low-entropy-derived
|
|
13
|
+
* key (a passphrase), so the world-readable document carries a check on the
|
|
14
|
+
* key without carrying the key -- and `nextKeyHashes` gains the hash of the
|
|
15
|
+
* credential's current update key (a ladder rung, or a code's single derived
|
|
16
|
+
* key).
|
|
17
|
+
* Decryption standing, authority latent: the credential's update key joins
|
|
18
|
+
* `updateKeys` nowhere, and both entries are deliberately unmarked, so client
|
|
19
|
+
* listings (keyed on `capabilityInvocation`) and revocation removals never
|
|
20
|
+
* see them. {@link publishUnlockKey} / {@link removeUnlockKey} are one merged
|
|
21
|
+
* add/remove pair, shared verbatim by the recovery-code wrappers.
|
|
22
|
+
*
|
|
23
|
+
* Self-enrollment ({@link selfEnrollWebvhClient}) is the recovery
|
|
24
|
+
* continuation generalized to a non-spending credential: two entries through
|
|
25
|
+
* the record's delegated `did.jsonl` bridge --
|
|
26
|
+
*
|
|
27
|
+
* 1. **Reveal + commit**: ladder rung `i` joins `updateKeys` (its hash stands
|
|
28
|
+
* committed, which is what makes the entry verify) and `nextKeyHashes`
|
|
29
|
+
* extends with the new ordinary client's update- and staged-key hashes
|
|
30
|
+
* plus `hash(rung i + 1)` -- the credential's next standing commitment.
|
|
31
|
+
* 2. **Add + retire the rung**: signed by the new client's update key
|
|
32
|
+
* (revealed from the commit), this entry publishes the new client's
|
|
33
|
+
* verification methods and update key and drops the spent rung and its
|
|
34
|
+
* hash. The credential's own posture -- its `keyAgreement` entry and the
|
|
35
|
+
* freshly committed `hash(rung i + 1)` -- stands untouched, ready for the
|
|
36
|
+
* next self-enrollment. Nothing is spent, and no replacement exists.
|
|
37
|
+
*
|
|
38
|
+
* Which rung is current is recovered from the log itself
|
|
39
|
+
* (`attributeLadderRung`, fail-closed); a lost compare-and-swap race re-runs,
|
|
40
|
+
* re-attributes, and climbs to the winner's committed rung -- the
|
|
41
|
+
* retry-up-the-ladder resolution. Every stage is idempotent and resumable
|
|
42
|
+
* from durable state alone, on the recovery continuation's pattern.
|
|
43
|
+
*/
|
|
44
|
+
import { deriveNextKeyHash, updateDID } from '@interop/did-method-webvh';
|
|
45
|
+
import { assertCarryOverCommitments, BYOE_CONTEXT_URL, markedVerificationMethodPair, MULTIKEY_COMMITMENT_VM_TYPE, MULTIKEY_VM_TYPE, publishUpdatedLog, putLogResource, readPublishedLog, relationIds, updateKeyMultibase, updateKeySigner, withLogConflictRetry } from '../webvh/didWebvh.js';
|
|
46
|
+
import { attributeLadderRung, ladderRung } from './ladder.js';
|
|
47
|
+
/**
|
|
48
|
+
* The verification-method id a credential's key-agreement entry publishes
|
|
49
|
+
* under: `<did>#<multibase>` for a verbatim key (indistinguishable by id from
|
|
50
|
+
* any other keyAgreement entry), `<did>#<commitment>` for a commitment entry
|
|
51
|
+
* (the commitment string is deterministic, so the id is too).
|
|
52
|
+
*
|
|
53
|
+
* @param options {object}
|
|
54
|
+
* @param options.did {string} the account's did:webvh
|
|
55
|
+
* @param options.keyAgreement {UnlockKeyAgreementPublication}
|
|
56
|
+
* @returns {string}
|
|
57
|
+
*/
|
|
58
|
+
export function unlockKeyVmId({ did, keyAgreement }) {
|
|
59
|
+
const fragment = 'publicKeyMultibase' in keyAgreement
|
|
60
|
+
? keyAgreement.publicKeyMultibase
|
|
61
|
+
: keyAgreement.commitment;
|
|
62
|
+
return `${did}#${fragment}`;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The credential's `keyAgreement` verification method: an ordinary unmarked
|
|
66
|
+
* entry carrying either the key verbatim (a `Multikey` with
|
|
67
|
+
* `publicKeyMultibase`) or its hash commitment (a `MultikeyCommitment` with
|
|
68
|
+
* `publicKeyCommitment` -- the document convention for a low-entropy-derived
|
|
69
|
+
* key, which withholds the key material and gives the roster resolver a
|
|
70
|
+
* document-anchored check). Controlled by the account and deliberately
|
|
71
|
+
* unmarked: a credential is not a listed client, so its entry must never
|
|
72
|
+
* carry the controller marker a client listing or a revocation removal
|
|
73
|
+
* matches on.
|
|
74
|
+
*
|
|
75
|
+
* @param options {object}
|
|
76
|
+
* @param options.did {string} the account's did:webvh
|
|
77
|
+
* @param options.keyAgreement {UnlockKeyAgreementPublication}
|
|
78
|
+
* @returns {VerificationMethod}
|
|
79
|
+
*/
|
|
80
|
+
export function unlockKeyVerificationMethod({ did, keyAgreement }) {
|
|
81
|
+
const id = unlockKeyVmId({ did, keyAgreement });
|
|
82
|
+
if ('publicKeyMultibase' in keyAgreement) {
|
|
83
|
+
return {
|
|
84
|
+
id,
|
|
85
|
+
type: MULTIKEY_VM_TYPE,
|
|
86
|
+
controller: did,
|
|
87
|
+
publicKeyMultibase: keyAgreement.publicKeyMultibase
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
id,
|
|
92
|
+
type: MULTIKEY_COMMITMENT_VM_TYPE,
|
|
93
|
+
controller: did,
|
|
94
|
+
publicKeyCommitment: keyAgreement.commitment
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Reads and resolves the published log through the narrow store seam.
|
|
99
|
+
*
|
|
100
|
+
* @param options {object}
|
|
101
|
+
* @param options.store {UnlockLogStore}
|
|
102
|
+
* @param [options.expectedDid] {string} the account DID the log must resolve
|
|
103
|
+
* to, where the caller holds one
|
|
104
|
+
* @returns {Promise<PublishedWebvhLog>}
|
|
105
|
+
*/
|
|
106
|
+
async function readLogOrThrow({ store, expectedDid }) {
|
|
107
|
+
// readPublishedLog only calls getIdResourceRaw, so the narrow seam is safe.
|
|
108
|
+
const published = await readPublishedLog({
|
|
109
|
+
idStore: store,
|
|
110
|
+
...(expectedDid !== undefined ? { expectedDid } : {})
|
|
111
|
+
});
|
|
112
|
+
if (!published) {
|
|
113
|
+
throw new Error('did:webvh: did.jsonl is missing; nothing to enroll into.');
|
|
114
|
+
}
|
|
115
|
+
return published;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Publishes `did.jsonl` through the narrow seam -- the log only, never
|
|
119
|
+
* `did.json` (the bridge delegation covers nothing else; the enrolled session
|
|
120
|
+
* republishes the projection once it is the controller). Conditional on the
|
|
121
|
+
* read the entry was built on; a lost race surfaces as a
|
|
122
|
+
* `WebvhLogConflictError` (the mapping lives in `putLogResource`).
|
|
123
|
+
*
|
|
124
|
+
* @param options {object}
|
|
125
|
+
* @param options.store {UnlockLogStore}
|
|
126
|
+
* @param options.log {DIDLog}
|
|
127
|
+
* @param [options.ifMatch] {string} publish only if `did.jsonl` is unchanged
|
|
128
|
+
* @returns {Promise<void>}
|
|
129
|
+
*/
|
|
130
|
+
async function publishLogOnly({ store, log, ifMatch }) {
|
|
131
|
+
await putLogResource({ store, log, ifMatch });
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* BIND (run by an enrolled client, root authority): publishes a standing
|
|
135
|
+
* credential's split posture into the document -- one entry adding the
|
|
136
|
+
* credential's `keyAgreement` entry (verbatim or commitment) and committing
|
|
137
|
+
* its current update key's hash in `nextKeyHashes`. The update key joins
|
|
138
|
+
* `updateKeys` nowhere. Idempotent: a posture already published is a no-op,
|
|
139
|
+
* so re-running a torn bind converges. The entry publishes conditionally on
|
|
140
|
+
* the log this call read; a race lost to a concurrent ceremony re-runs and
|
|
141
|
+
* rebases on the new head.
|
|
142
|
+
*
|
|
143
|
+
* @param options {object}
|
|
144
|
+
* @param options.idStore {WebvhIdStore}
|
|
145
|
+
* @param options.updateKeys {ClientWebvhUpdateKeys} the BINDING client's own
|
|
146
|
+
* did:webvh update-key seeds
|
|
147
|
+
* @param options.unlockKeys {StandingUnlockKeys} the credential's public
|
|
148
|
+
* posture
|
|
149
|
+
* @param [options.expectedDid] {string} the account DID the log must resolve
|
|
150
|
+
* to, from the caller's stored account pointer
|
|
151
|
+
* @param [options.verb] {string} what the caller is doing, for the
|
|
152
|
+
* pending-rotation refusal message (e.g. `'issuing a recovery code'`)
|
|
153
|
+
* @returns {Promise<{ did: string }>}
|
|
154
|
+
*/
|
|
155
|
+
export async function publishUnlockKey(options) {
|
|
156
|
+
return withLogConflictRetry(() => setUnlockKeyPostureOnce({ ...options, polarity: 'publish' }));
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* REMOVAL (run by an enrolled client, root authority): removes a standing
|
|
160
|
+
* credential's posture from the document -- its `keyAgreement` entry and its
|
|
161
|
+
* committed update-key hash -- in one entry. Idempotent. The roster-side half
|
|
162
|
+
* (rotating the user key epoch off the credential's wrap) is the caller's,
|
|
163
|
+
* and runs after this so the resolver's document no longer backs the removed
|
|
164
|
+
* entry.
|
|
165
|
+
*
|
|
166
|
+
* @param options {object} see {@link publishUnlockKey}
|
|
167
|
+
* @returns {Promise<{ did: string }>}
|
|
168
|
+
*/
|
|
169
|
+
export async function removeUnlockKey(options) {
|
|
170
|
+
return withLogConflictRetry(() => setUnlockKeyPostureOnce({ ...options, polarity: 'remove' }));
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* One attempt of the merged posture edit, re-invoked by the conflict retry.
|
|
174
|
+
* The publish and remove polarities are one function because the entry they
|
|
175
|
+
* build is the same edit with the set operations inverted -- a divergence
|
|
176
|
+
* between two copies would be published into an append-only log.
|
|
177
|
+
*
|
|
178
|
+
* @param options {object} see {@link publishUnlockKey}, plus `polarity`
|
|
179
|
+
* @returns {Promise<{ did: string }>}
|
|
180
|
+
*/
|
|
181
|
+
async function setUnlockKeyPostureOnce({ idStore, updateKeys, unlockKeys, expectedDid, verb, polarity }) {
|
|
182
|
+
const published = await readLogOrThrow({
|
|
183
|
+
store: idStore,
|
|
184
|
+
...(expectedDid !== undefined ? { expectedDid } : {})
|
|
185
|
+
});
|
|
186
|
+
const { did, doc } = published;
|
|
187
|
+
const keyHash = await deriveNextKeyHash(unlockKeys.updateKeyMultibase);
|
|
188
|
+
const vmId = unlockKeyVmId({ did, keyAgreement: unlockKeys.keyAgreement });
|
|
189
|
+
const vmPresent = (doc.verificationMethod ?? []).some(method => method.id === vmId);
|
|
190
|
+
const hashCommitted = published.nextKeyHashes.includes(keyHash);
|
|
191
|
+
const settled = polarity === 'publish'
|
|
192
|
+
? vmPresent && hashCommitted
|
|
193
|
+
: !vmPresent && !hashCommitted;
|
|
194
|
+
if (settled) {
|
|
195
|
+
return { did };
|
|
196
|
+
}
|
|
197
|
+
const activeKey = await updateKeyMultibase({ seed: updateKeys.updateSeed });
|
|
198
|
+
if (!published.updateKeys.includes(activeKey)) {
|
|
199
|
+
throw new Error("did:webvh: the published log does not authorize this client's active " +
|
|
200
|
+
'update key; finalize the pending rotation before ' +
|
|
201
|
+
`${verb ?? 'changing an unlock credential'}.`);
|
|
202
|
+
}
|
|
203
|
+
await assertCarryOverCommitments({ published });
|
|
204
|
+
const existingMethods = (doc.verificationMethod ?? []);
|
|
205
|
+
const signer = await updateKeySigner({ seed: updateKeys.updateSeed });
|
|
206
|
+
const nextKeyHashes = polarity === 'publish'
|
|
207
|
+
? [...new Set([...published.nextKeyHashes, keyHash])]
|
|
208
|
+
: published.nextKeyHashes.filter(hash => hash !== keyHash);
|
|
209
|
+
const verificationMethods = polarity === 'publish'
|
|
210
|
+
? [
|
|
211
|
+
...existingMethods.filter(method => method.id !== vmId),
|
|
212
|
+
unlockKeyVerificationMethod({
|
|
213
|
+
did,
|
|
214
|
+
keyAgreement: unlockKeys.keyAgreement
|
|
215
|
+
})
|
|
216
|
+
]
|
|
217
|
+
: existingMethods.filter(method => method.id !== vmId);
|
|
218
|
+
const keyAgreement = polarity === 'publish'
|
|
219
|
+
? [...new Set([...relationIds(doc.keyAgreement), vmId])]
|
|
220
|
+
: relationIds(doc.keyAgreement).filter(id => id !== vmId);
|
|
221
|
+
const updated = await updateDID({
|
|
222
|
+
log: published.log,
|
|
223
|
+
signer,
|
|
224
|
+
alsoKnownAsWeb: true,
|
|
225
|
+
// A commitment entry's terms are defined by the byoe context, so the
|
|
226
|
+
// posture publish appends it to the carried-forward context. The append
|
|
227
|
+
// is deduplicated, so a document already carrying it is unchanged.
|
|
228
|
+
additionalContext: [BYOE_CONTEXT_URL],
|
|
229
|
+
updateKeys: published.updateKeys,
|
|
230
|
+
nextKeyHashes,
|
|
231
|
+
verificationMethods,
|
|
232
|
+
authentication: relationIds(doc.authentication),
|
|
233
|
+
assertionMethod: relationIds(doc.assertionMethod),
|
|
234
|
+
keyAgreement,
|
|
235
|
+
capabilityInvocation: relationIds(doc.capabilityInvocation),
|
|
236
|
+
capabilityDelegation: relationIds(doc.capabilityDelegation)
|
|
237
|
+
});
|
|
238
|
+
await publishUpdatedLog({ idStore, updated, ifMatch: published.etag });
|
|
239
|
+
return { did: updated.did };
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* SELF-ENROLLMENT (run by the credential-derived client through the delegated
|
|
243
|
+
* `did.jsonl` PUT): writes the standing continuation described in the module
|
|
244
|
+
* doc -- the reveal-and-commit entry signed by the attributed ladder rung,
|
|
245
|
+
* then the add entry signed by the new ordinary client's update key, which
|
|
246
|
+
* also retires the spent rung. Resumable from durable state alone: a
|
|
247
|
+
* completed continuation is detected by the new client's update key already
|
|
248
|
+
* being authorized (no-op), a torn one by the attribution finding the rung
|
|
249
|
+
* already revealed. Both entries publish conditionally on the read they were
|
|
250
|
+
* built on, and a race lost to a concurrent ceremony re-runs from the top --
|
|
251
|
+
* re-attributing, which is exactly the retry-up-the-ladder resolution.
|
|
252
|
+
*
|
|
253
|
+
* @param options {object}
|
|
254
|
+
* @param options.store {UnlockLogStore} public log read + delegated PUT
|
|
255
|
+
* @param options.ladderSeed {Uint8Array} the credential's ladder seed, from
|
|
256
|
+
* its unlock record
|
|
257
|
+
* @param options.newClientKeys {WebvhEnrollmentKeys} the new ordinary
|
|
258
|
+
* client's public halves
|
|
259
|
+
* @param options.newClientUpdateSeeds {ClientWebvhUpdateKeys} the new
|
|
260
|
+
* client's update-key seeds (minted by the self-enrolling flow, which
|
|
261
|
+
* therefore holds them and can sign the add entry)
|
|
262
|
+
* @param [options.expectedDid] {string} the account DID the log must resolve
|
|
263
|
+
* to, from the credential-authenticated pointer
|
|
264
|
+
* @returns {Promise<{ did: string, webDoc?: object }>} the account DID and,
|
|
265
|
+
* when the add entry ran here, the final `did.json` projection for the
|
|
266
|
+
* enrolled session to republish
|
|
267
|
+
*/
|
|
268
|
+
export async function selfEnrollWebvhClient(options) {
|
|
269
|
+
return withLogConflictRetry(() => selfEnrollWebvhClientOnce(options));
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* One attempt of {@link selfEnrollWebvhClient}, re-invoked by the conflict
|
|
273
|
+
* retry.
|
|
274
|
+
*
|
|
275
|
+
* @param options {object} see {@link selfEnrollWebvhClient}
|
|
276
|
+
* @returns {Promise<{ did: string, webDoc?: object }>}
|
|
277
|
+
*/
|
|
278
|
+
async function selfEnrollWebvhClientOnce({ store, ladderSeed, newClientKeys, newClientUpdateSeeds, expectedDid }) {
|
|
279
|
+
let published = await readLogOrThrow({
|
|
280
|
+
store,
|
|
281
|
+
...(expectedDid !== undefined ? { expectedDid } : {})
|
|
282
|
+
});
|
|
283
|
+
// Already complete (a torn earlier run finished the add entry): the new
|
|
284
|
+
// client's update key is authorized, which only the add entry writes.
|
|
285
|
+
if (published.updateKeys.includes(newClientKeys.updateKeyMultibase)) {
|
|
286
|
+
return { did: published.did };
|
|
287
|
+
}
|
|
288
|
+
// Which rung is current, recovered from the log itself. Fails closed with
|
|
289
|
+
// `LadderAttributionError` for a revoked (or never-bound) credential and
|
|
290
|
+
// for any ambiguous history.
|
|
291
|
+
const { rung, state } = await attributeLadderRung({ ladderSeed, published });
|
|
292
|
+
const nextRung = await ladderRung({ ladderSeed, index: rung.index + 1 });
|
|
293
|
+
const rungHash = await deriveNextKeyHash(rung.keyMultibase);
|
|
294
|
+
const newUpdateHash = await deriveNextKeyHash(newClientKeys.updateKeyMultibase);
|
|
295
|
+
const newStagedHash = await deriveNextKeyHash(newClientKeys.stagedUpdateKeyMultibase);
|
|
296
|
+
const nextRungHash = await deriveNextKeyHash(nextRung.keyMultibase);
|
|
297
|
+
// The reveal-and-commit entry, skipped when a torn earlier run already
|
|
298
|
+
// published it (the rung revealed AND every needed hash committed).
|
|
299
|
+
const revealed = state === 'revealed';
|
|
300
|
+
const committed = [newUpdateHash, newStagedHash, nextRungHash].every(hash => published.nextKeyHashes.includes(hash));
|
|
301
|
+
if (!revealed || !committed) {
|
|
302
|
+
await assertCarryOverCommitments({ published });
|
|
303
|
+
const signer = await updateKeySigner({ seed: rung.seed });
|
|
304
|
+
const updated = await updateDID({
|
|
305
|
+
log: published.log,
|
|
306
|
+
signer,
|
|
307
|
+
alsoKnownAsWeb: true,
|
|
308
|
+
updateKeys: [...new Set([...published.updateKeys, rung.keyMultibase])],
|
|
309
|
+
// The spent rung's own hash is kept through this entry (so a resumed
|
|
310
|
+
// commit can re-state the revealed key); the add entry drops it, while
|
|
311
|
+
// the next rung's hash stays as the credential's standing commitment.
|
|
312
|
+
nextKeyHashes: [
|
|
313
|
+
...new Set([
|
|
314
|
+
...published.nextKeyHashes,
|
|
315
|
+
rungHash,
|
|
316
|
+
newUpdateHash,
|
|
317
|
+
newStagedHash,
|
|
318
|
+
nextRungHash
|
|
319
|
+
])
|
|
320
|
+
]
|
|
321
|
+
});
|
|
322
|
+
await publishLogOnly({ store, log: updated.log, ifMatch: published.etag });
|
|
323
|
+
// The same account the reveal entry just extended.
|
|
324
|
+
published = await readLogOrThrow({ store, expectedDid: published.did });
|
|
325
|
+
}
|
|
326
|
+
// The add entry: the new client's verification methods and update key in;
|
|
327
|
+
// the spent rung's key and hash out. The credential's keyAgreement entry
|
|
328
|
+
// and the next rung's committed hash stand untouched. Signed by the new
|
|
329
|
+
// client's update key, whose hash the commit entry just committed.
|
|
330
|
+
const { did, doc } = published;
|
|
331
|
+
const vmId = (publicKeyMultibase) => `${did}#${publicKeyMultibase}`;
|
|
332
|
+
const addedMethods = markedVerificationMethodPair({
|
|
333
|
+
controller: did,
|
|
334
|
+
signingKeyMultibase: newClientKeys.signingKeyMultibase,
|
|
335
|
+
keyAgreementKeyMultibase: newClientKeys.keyAgreementKeyMultibase
|
|
336
|
+
});
|
|
337
|
+
const existingMethods = (doc.verificationMethod ?? []);
|
|
338
|
+
const verificationMethods = [
|
|
339
|
+
...existingMethods.filter(method => !addedMethods.some(added => added.id === method.id)),
|
|
340
|
+
...addedMethods
|
|
341
|
+
];
|
|
342
|
+
const withReference = (relation, id) => [...new Set([...relationIds(relation), id])];
|
|
343
|
+
const signingVmId = vmId(newClientKeys.signingKeyMultibase);
|
|
344
|
+
const signer = await updateKeySigner({
|
|
345
|
+
seed: newClientUpdateSeeds.updateSeed
|
|
346
|
+
});
|
|
347
|
+
const updated = await updateDID({
|
|
348
|
+
log: published.log,
|
|
349
|
+
signer,
|
|
350
|
+
alsoKnownAsWeb: true,
|
|
351
|
+
updateKeys: [
|
|
352
|
+
...new Set([
|
|
353
|
+
...published.updateKeys.filter(key => key !== rung.keyMultibase),
|
|
354
|
+
newClientKeys.updateKeyMultibase
|
|
355
|
+
])
|
|
356
|
+
],
|
|
357
|
+
nextKeyHashes: published.nextKeyHashes.filter(hash => hash !== rungHash),
|
|
358
|
+
verificationMethods,
|
|
359
|
+
authentication: withReference(doc.authentication, signingVmId),
|
|
360
|
+
assertionMethod: withReference(doc.assertionMethod, signingVmId),
|
|
361
|
+
keyAgreement: withReference(doc.keyAgreement, vmId(newClientKeys.keyAgreementKeyMultibase)),
|
|
362
|
+
capabilityInvocation: withReference(doc.capabilityInvocation, signingVmId),
|
|
363
|
+
capabilityDelegation: withReference(doc.capabilityDelegation, signingVmId)
|
|
364
|
+
});
|
|
365
|
+
// Conditional on the read this entry was built on: the re-read above when
|
|
366
|
+
// the commit entry ran here, the first read when it was skipped.
|
|
367
|
+
await publishLogOnly({ store, log: updated.log, ifMatch: published.etag });
|
|
368
|
+
return { did: updated.did, webDoc: updated.webDoc };
|
|
369
|
+
}
|
|
370
|
+
//# sourceMappingURL=standingWebvh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standingWebvh.js","sourceRoot":"","sources":["../../src/unlock/standingWebvh.ts"],"names":[],"mappings":"AAAA;;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