@interop/wallet-core 0.40.0 → 0.42.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 -3
- package/dist/clients/listing.d.ts +4 -3
- package/dist/clients/listing.d.ts.map +1 -1
- package/dist/clients/listing.js.map +1 -1
- package/dist/clients/policy.d.ts +3 -2
- package/dist/clients/policy.d.ts.map +1 -1
- package/dist/clients/policy.js +3 -3
- package/dist/clients/policy.js.map +1 -1
- package/dist/clients/revocation.d.ts +14 -4
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +29 -14
- package/dist/clients/revocation.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +22 -15
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +32 -15
- 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 +30 -2
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +58 -30
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/enrollment/index.d.ts +4 -1
- package/dist/enrollment/index.d.ts.map +1 -1
- package/dist/enrollment/index.js +4 -1
- package/dist/enrollment/index.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 +7 -6
- package/dist/keyring/index.d.ts.map +1 -1
- package/dist/keyring/index.js +7 -6
- 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/keyring/record.d.ts +30 -10
- package/dist/keyring/record.d.ts.map +1 -1
- package/dist/keyring/record.js +31 -15
- package/dist/keyring/record.js.map +1 -1
- package/dist/keys/index.d.ts +5 -3
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +3 -2
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts +22 -2
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +40 -20
- 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/userKeyCascade.d.ts +10 -3
- package/dist/keys/userKeyCascade.d.ts.map +1 -1
- package/dist/keys/userKeyCascade.js +10 -4
- package/dist/keys/userKeyCascade.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +29 -21
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +47 -23
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/recovery/index.d.ts +21 -11
- package/dist/recovery/index.d.ts.map +1 -1
- package/dist/recovery/index.js +19 -10
- 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 +151 -0
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -0
- package/dist/recovery/recoveryDelegation.js +261 -0
- package/dist/recovery/recoveryDelegation.js.map +1 -0
- package/dist/recovery/recoveryWebvh.d.ts +13 -22
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +53 -139
- 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 +166 -7
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +286 -31
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/index.d.ts +15 -3
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +14 -3
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/keyAgreement.d.ts +72 -0
- package/dist/webvh/keyAgreement.d.ts.map +1 -0
- package/dist/webvh/keyAgreement.js +47 -0
- package/dist/webvh/keyAgreement.js.map +1 -0
- package/dist/webvh/listClients.d.ts +69 -20
- package/dist/webvh/listClients.d.ts.map +1 -1
- package/dist/webvh/listClients.js +102 -14
- package/dist/webvh/listClients.js.map +1 -1
- package/dist/webvh/revokeClient.d.ts +21 -11
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +31 -14
- package/dist/webvh/revokeClient.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 -171
- package/dist/recovery/recoveryRecord.d.ts.map +0 -1
- package/dist/recovery/recoveryRecord.js +0 -290
- package/dist/recovery/recoveryRecord.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryCode.js","sourceRoot":"","sources":["../../src/recovery/recoveryCode.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"recoveryCode.js","sourceRoot":"","sources":["../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C,EACnD,EAAE,CACH,CAAA;IACD,MAAM,aAAa,GAAG,IAAI,CACxB,MAAM,EACN,SAAS,EACT,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,EAC3C,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC,EACnD,EAAE,CACH,CAAA;IACD,MAAM,QAAQ,GAAG,MAAM,4BAA4B,CAAC,EAAE,UAAU,EAAE,CAAC,CAAA;IACnE,OAAO;QACL,GAAG,QAAQ;QACX,SAAS;QACT,UAAU;QACV,aAAa;QACb,kBAAkB,EAAE,MAAM,kBAAkB,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;KACnE,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { IZcap } from '@interop/data-integrity-core';
|
|
2
|
+
import type { ZcapClient } from '@interop/ezcap';
|
|
3
|
+
import type { PublishedKeyDocument } from '../webvh/listClients.js';
|
|
4
|
+
import type { AccountPointer, RecordSigner } from '../keyring/record.js';
|
|
5
|
+
/**
|
|
6
|
+
* The recovery delegation's lifetime: one year, following NIST SP 800-57's
|
|
7
|
+
* one-to-two-year cryptoperiod guidance for private signature keys. The
|
|
8
|
+
* delegation's scope stays narrow (PUT on the one world-readable DID log
|
|
9
|
+
* resource, whose worst-case abuse is a log write that still has to verify
|
|
10
|
+
* against the published hash chain and prerotation commitments to resolve),
|
|
11
|
+
* but a standing bearer artifact should not outlive its signing key's
|
|
12
|
+
* recommended cryptoperiod. A code must keep working past the year, so
|
|
13
|
+
* expiry is watched rather than terminal: the registry entry records the
|
|
14
|
+
* delegation's `expires`, {@link zcapExpiring} treats the
|
|
15
|
+
* renewal window before it as stale, the re-mint refreshes a stale
|
|
16
|
+
* delegation, and the login-time recovery health check flags one the same
|
|
17
|
+
* way it flags rot (the signing client's verification method leaving the
|
|
18
|
+
* document).
|
|
19
|
+
*/
|
|
20
|
+
export declare const RECOVERY_DELEGATION_TTL_MS: number;
|
|
21
|
+
/**
|
|
22
|
+
* How long before its `expires` a standing recorded zcap counts as stale:
|
|
23
|
+
* thirty days, so a refresh (a re-mint, a login-time re-delegation) or a
|
|
24
|
+
* regenerate nudge lands well before the zcap actually lapses.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ZCAP_RENEWAL_WINDOW_MS: number;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a recorded zcap expiry is past or inside the renewal window -- the
|
|
29
|
+
* expiry half of the staleness predicate for every long-lived zcap a wallet
|
|
30
|
+
* records beside its registry entries (the recovery `did.jsonl` delegation,
|
|
31
|
+
* an unlock Space's management zcap). The re-mint and the wallets'
|
|
32
|
+
* login-time checks all ask this one predicate. A record carrying no expiry
|
|
33
|
+
* (or an unparseable one) is uncheckable and therefore not assumed healthy,
|
|
34
|
+
* matching the rot check's treatment of a missing `delegationKeyId`.
|
|
35
|
+
*
|
|
36
|
+
* @param options {object}
|
|
37
|
+
* @param [options.expires] {string} the recorded ISO 8601 expiry
|
|
38
|
+
* @param [options.now] {number} epoch milliseconds, for tests
|
|
39
|
+
* @returns {boolean}
|
|
40
|
+
*/
|
|
41
|
+
export declare function zcapExpiring({ expires, now }: {
|
|
42
|
+
expires?: string;
|
|
43
|
+
now?: number;
|
|
44
|
+
}): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Delegates the narrow log-write bridge to a code-derived client: PUT on the
|
|
47
|
+
* one `did.jsonl` resource, {@link RECOVERY_DELEGATION_TTL_MS} lifetime. The
|
|
48
|
+
* delegation is what lets a latent-authority code write its self-enrolling
|
|
49
|
+
* continuation without any standing invocation presence.
|
|
50
|
+
*
|
|
51
|
+
* @param options {object}
|
|
52
|
+
* @param options.zcapClient {ZcapClient} the delegating client (an enrolled
|
|
53
|
+
* client's promoted signer)
|
|
54
|
+
* @param options.pointer {AccountPointer}
|
|
55
|
+
* @param options.recoveryClientDid {string}
|
|
56
|
+
* @returns {Promise<IZcap>}
|
|
57
|
+
*/
|
|
58
|
+
export declare function delegateLogWrite({ zcapClient, pointer, recoveryClientDid }: {
|
|
59
|
+
zcapClient: ZcapClient;
|
|
60
|
+
pointer: AccountPointer;
|
|
61
|
+
recoveryClientDid: string;
|
|
62
|
+
}): Promise<IZcap>;
|
|
63
|
+
/**
|
|
64
|
+
* The verification method that signed a delegation's proof -- recorded in the
|
|
65
|
+
* registry entry so the health check and the re-mint's rot check can test it
|
|
66
|
+
* against the current document without holding the code.
|
|
67
|
+
*
|
|
68
|
+
* @param delegation {IZcap}
|
|
69
|
+
* @returns {string | undefined}
|
|
70
|
+
*/
|
|
71
|
+
export declare function delegationProofKeyId(delegation: IZcap): string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* The members of a recovery-code registry entry the re-mint reads: where the
|
|
74
|
+
* code's unlock Space and record are (`unlockSpaceId`, `manageCapability`),
|
|
75
|
+
* which key signed the recorded delegation and when it expires
|
|
76
|
+
* (`delegationKeyId` / `delegationExpires` -- either absent on an entry
|
|
77
|
+
* predating its field, which the staleness checks conservatively flag), and
|
|
78
|
+
* the re-mint fields: the code-derived signing DID the fresh delegation names
|
|
79
|
+
* and the unlock KAK public half the record is re-wrapped to. Structural on
|
|
80
|
+
* purpose -- an app's richer registry entry satisfies it, and the re-mint
|
|
81
|
+
* hands the SAME entry back (with the fresh `delegationKeyId`) through the
|
|
82
|
+
* record seam, extra members untouched.
|
|
83
|
+
*/
|
|
84
|
+
export interface RecoveryDelegationEntry {
|
|
85
|
+
label: string;
|
|
86
|
+
unlockSpaceId: string;
|
|
87
|
+
manageCapability?: IZcap;
|
|
88
|
+
delegationKeyId?: string;
|
|
89
|
+
delegationExpires?: string;
|
|
90
|
+
recoveryClientDid?: string;
|
|
91
|
+
unlockKeyAgreementKeyId?: string;
|
|
92
|
+
unlockKeyAgreementKeyMultibase?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Re-mints the recovery delegations the current document no longer backs --
|
|
96
|
+
* the recovery-code delta riding the revocation cascade (see the module doc
|
|
97
|
+
* for the mechanism and the skip policy).
|
|
98
|
+
*
|
|
99
|
+
* The record's credential-authenticated core is preserved verbatim: the
|
|
100
|
+
* re-mint reads the standing record through the entry's management zcap and
|
|
101
|
+
* replaces only its bridge member ({@link remintUnlockRecordBridge}) -- the
|
|
102
|
+
* shell, the ladder member (where one rides), and the binding tag all travel
|
|
103
|
+
* untouched, since the re-mint can decrypt none of them and does not need to.
|
|
104
|
+
* A re-mint therefore can never change the pointer or controller the
|
|
105
|
+
* credential was bound against -- and after a host migration the tag no
|
|
106
|
+
* longer matches the moved pointer, so credentials must be rebound (codes
|
|
107
|
+
* re-issued) when the account moves hosts.
|
|
108
|
+
*
|
|
109
|
+
* The re-mint holds the code's KAK public half but not its signing key, so
|
|
110
|
+
* every record it re-PUTs is signed with the acting client's own account key
|
|
111
|
+
* (`recordSigner`) -- the mixed-signer case a reader settles against the
|
|
112
|
+
* verified did:webvh document.
|
|
113
|
+
*
|
|
114
|
+
* Best-effort per entry: a skipped entry stays flagged by the login-time
|
|
115
|
+
* health check, whose regenerate nudge remains the backstop.
|
|
116
|
+
*
|
|
117
|
+
* @param options {object}
|
|
118
|
+
* @param options.doc {PublishedKeyDocument} the locally verified did:webvh
|
|
119
|
+
* document, AFTER the revocation edit
|
|
120
|
+
* @param options.entries {RecoveryDelegationEntry[]} the registry's
|
|
121
|
+
* recovery-code entries, as the app's registry read returned them
|
|
122
|
+
* @param options.pointer {AccountPointer}
|
|
123
|
+
* @param options.storageServerUrl {string} the unlock Spaces' storage server
|
|
124
|
+
* @param options.zcapClient {ZcapClient} the acting client's promoted
|
|
125
|
+
* signer, which mints the fresh delegations
|
|
126
|
+
* @param options.recordSigner {RecordSigner} the acting client's account
|
|
127
|
+
* key, which signs the re-wrapped records
|
|
128
|
+
* @param options.managementZcapClient {Function} `({ capability }) =>
|
|
129
|
+
* ZcapClient` -- the client an entry's management zcap is invoked with
|
|
130
|
+
* @param options.recordEntry {Function} `({ entry }) => Promise<void>` --
|
|
131
|
+
* persists one updated registry entry (matching on the app's entry key)
|
|
132
|
+
* @returns {Promise<{ reminted: number; skipped: number }>}
|
|
133
|
+
*/
|
|
134
|
+
export declare function remintRecoveryDelegations<Entry extends RecoveryDelegationEntry>({ doc, entries, pointer, storageServerUrl, zcapClient, recordSigner, managementZcapClient, recordEntry }: {
|
|
135
|
+
doc: PublishedKeyDocument;
|
|
136
|
+
entries: Entry[];
|
|
137
|
+
pointer: AccountPointer;
|
|
138
|
+
storageServerUrl: string;
|
|
139
|
+
zcapClient: ZcapClient;
|
|
140
|
+
recordSigner: RecordSigner;
|
|
141
|
+
managementZcapClient: (options: {
|
|
142
|
+
capability: IZcap;
|
|
143
|
+
}) => ZcapClient;
|
|
144
|
+
recordEntry: (options: {
|
|
145
|
+
entry: Entry;
|
|
146
|
+
}) => Promise<void>;
|
|
147
|
+
}): Promise<{
|
|
148
|
+
reminted: number;
|
|
149
|
+
skipped: number;
|
|
150
|
+
}>;
|
|
151
|
+
//# sourceMappingURL=recoveryDelegation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recoveryDelegation.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAoB,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGxE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,0BAA0B,QAA4B,CAAA;AAEnE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAA2B,CAAA;AAE9D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,GAAgB,EACjB,EAAE;IACD,OAAO,CAAC,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;KAAE,KAAK,UAAU,CAAA;IACpE,WAAW,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1D,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA+FjD"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The recovery code's authorization bridge: the pre-minted PUT-on-`did.jsonl`
|
|
6
|
+
* delegation and the revocation cascade's re-mint of it. The delegation is a
|
|
7
|
+
* wire artifact both apps must mint byte-identically (issuance and every
|
|
8
|
+
* re-mint produce the record another replica later recovers with), so its
|
|
9
|
+
* builder lives here: PUT on the one `did.jsonl` resource, one-year TTL,
|
|
10
|
+
* delegated to the code-derived signing DID. Its narrow scope is what keeps
|
|
11
|
+
* recovery loud -- a stolen code must extend the world-readable log before it
|
|
12
|
+
* can read anything.
|
|
13
|
+
*
|
|
14
|
+
* Beside the builder lives the re-mint core (`remintRecoveryDelegations`):
|
|
15
|
+
* revoking a client kills, by the current-key-set rule, every `did.jsonl`
|
|
16
|
+
* delegation that client signed, which would brick recovery exactly when it
|
|
17
|
+
* is needed -- and a delegation left standing eventually reaches its own
|
|
18
|
+
* expiry. For each registry entry whose recorded delegation no longer
|
|
19
|
+
* chains (its signing verification method left the document) or is expired
|
|
20
|
+
* or inside the renewal window, the acting
|
|
21
|
+
* client signs a fresh delegation to the code's signing DID, re-wraps the
|
|
22
|
+
* record to the code's unlock KAK (the public half the registry records --
|
|
23
|
+
* the record carries no secrets, so re-encryption needs none), re-PUTs it
|
|
24
|
+
* through the entry's management zcap, and updates the registry's
|
|
25
|
+
* `delegationKeyId` and `delegationExpires`. The skip policy is
|
|
26
|
+
* cross-replica correctness and is
|
|
27
|
+
* decided here once: an entry that predates the re-mint fields, or whose
|
|
28
|
+
* standing record cannot be read or carries no binding, is skipped and stays
|
|
29
|
+
* flagged by the login-time health check. What stays app-side is the seams:
|
|
30
|
+
* the management-zcap client factory, the storage server URL, and the
|
|
31
|
+
* registry read/record halves.
|
|
32
|
+
*/
|
|
33
|
+
import { X25519KeyAgreementKey2020 } from '@interop/x25519-key-agreement-key';
|
|
34
|
+
import { DID_LOG_RESOURCE, ID_COLLECTION } from '../space/collections.js';
|
|
35
|
+
import { delegationKeyInDocument } from '../webvh/listClients.js';
|
|
36
|
+
import { getUnlockKeyringWithCapability, putUnlockKeyringWithCapability } from '../keyring/unlockSpace.js';
|
|
37
|
+
import { remintUnlockRecordBridge } from '../unlock/unlockRecord.js';
|
|
38
|
+
/**
|
|
39
|
+
* The recovery delegation's lifetime: one year, following NIST SP 800-57's
|
|
40
|
+
* one-to-two-year cryptoperiod guidance for private signature keys. The
|
|
41
|
+
* delegation's scope stays narrow (PUT on the one world-readable DID log
|
|
42
|
+
* resource, whose worst-case abuse is a log write that still has to verify
|
|
43
|
+
* against the published hash chain and prerotation commitments to resolve),
|
|
44
|
+
* but a standing bearer artifact should not outlive its signing key's
|
|
45
|
+
* recommended cryptoperiod. A code must keep working past the year, so
|
|
46
|
+
* expiry is watched rather than terminal: the registry entry records the
|
|
47
|
+
* delegation's `expires`, {@link zcapExpiring} treats the
|
|
48
|
+
* renewal window before it as stale, the re-mint refreshes a stale
|
|
49
|
+
* delegation, and the login-time recovery health check flags one the same
|
|
50
|
+
* way it flags rot (the signing client's verification method leaving the
|
|
51
|
+
* document).
|
|
52
|
+
*/
|
|
53
|
+
export const RECOVERY_DELEGATION_TTL_MS = 365 * 24 * 60 * 60 * 1000;
|
|
54
|
+
/**
|
|
55
|
+
* How long before its `expires` a standing recorded zcap counts as stale:
|
|
56
|
+
* thirty days, so a refresh (a re-mint, a login-time re-delegation) or a
|
|
57
|
+
* regenerate nudge lands well before the zcap actually lapses.
|
|
58
|
+
*/
|
|
59
|
+
export const ZCAP_RENEWAL_WINDOW_MS = 30 * 24 * 60 * 60 * 1000;
|
|
60
|
+
/**
|
|
61
|
+
* Whether a recorded zcap expiry is past or inside the renewal window -- the
|
|
62
|
+
* expiry half of the staleness predicate for every long-lived zcap a wallet
|
|
63
|
+
* records beside its registry entries (the recovery `did.jsonl` delegation,
|
|
64
|
+
* an unlock Space's management zcap). The re-mint and the wallets'
|
|
65
|
+
* login-time checks all ask this one predicate. A record carrying no expiry
|
|
66
|
+
* (or an unparseable one) is uncheckable and therefore not assumed healthy,
|
|
67
|
+
* matching the rot check's treatment of a missing `delegationKeyId`.
|
|
68
|
+
*
|
|
69
|
+
* @param options {object}
|
|
70
|
+
* @param [options.expires] {string} the recorded ISO 8601 expiry
|
|
71
|
+
* @param [options.now] {number} epoch milliseconds, for tests
|
|
72
|
+
* @returns {boolean}
|
|
73
|
+
*/
|
|
74
|
+
export function zcapExpiring({ expires, now = Date.now() }) {
|
|
75
|
+
if (!expires) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
const expiresAt = Date.parse(expires);
|
|
79
|
+
if (Number.isNaN(expiresAt)) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
return expiresAt - now <= ZCAP_RENEWAL_WINDOW_MS;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The absolute URL of the account's `did.jsonl` log resource -- the
|
|
86
|
+
* invocation target of the pre-minted recovery delegation.
|
|
87
|
+
*
|
|
88
|
+
* @param options {object}
|
|
89
|
+
* @param options.pointer {AccountPointer}
|
|
90
|
+
* @returns {string}
|
|
91
|
+
*/
|
|
92
|
+
function didLogUrl({ pointer }) {
|
|
93
|
+
return new URL(`/space/${pointer.spaceId}/${ID_COLLECTION.id}/${DID_LOG_RESOURCE}`, pointer.host).toString();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Delegates the narrow log-write bridge to a code-derived client: PUT on the
|
|
97
|
+
* one `did.jsonl` resource, {@link RECOVERY_DELEGATION_TTL_MS} lifetime. The
|
|
98
|
+
* delegation is what lets a latent-authority code write its self-enrolling
|
|
99
|
+
* continuation without any standing invocation presence.
|
|
100
|
+
*
|
|
101
|
+
* @param options {object}
|
|
102
|
+
* @param options.zcapClient {ZcapClient} the delegating client (an enrolled
|
|
103
|
+
* client's promoted signer)
|
|
104
|
+
* @param options.pointer {AccountPointer}
|
|
105
|
+
* @param options.recoveryClientDid {string}
|
|
106
|
+
* @returns {Promise<IZcap>}
|
|
107
|
+
*/
|
|
108
|
+
export async function delegateLogWrite({ zcapClient, pointer, recoveryClientDid }) {
|
|
109
|
+
return zcapClient.delegate({
|
|
110
|
+
invocationTarget: didLogUrl({ pointer }),
|
|
111
|
+
controller: recoveryClientDid,
|
|
112
|
+
allowedActions: ['PUT'],
|
|
113
|
+
expires: new Date(Date.now() + RECOVERY_DELEGATION_TTL_MS)
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The verification method that signed a delegation's proof -- recorded in the
|
|
118
|
+
* registry entry so the health check and the re-mint's rot check can test it
|
|
119
|
+
* against the current document without holding the code.
|
|
120
|
+
*
|
|
121
|
+
* @param delegation {IZcap}
|
|
122
|
+
* @returns {string | undefined}
|
|
123
|
+
*/
|
|
124
|
+
export function delegationProofKeyId(delegation) {
|
|
125
|
+
const { proof } = delegation;
|
|
126
|
+
const single = Array.isArray(proof) ? proof[0] : proof;
|
|
127
|
+
return single?.verificationMethod;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Re-mints the recovery delegations the current document no longer backs --
|
|
131
|
+
* the recovery-code delta riding the revocation cascade (see the module doc
|
|
132
|
+
* for the mechanism and the skip policy).
|
|
133
|
+
*
|
|
134
|
+
* The record's credential-authenticated core is preserved verbatim: the
|
|
135
|
+
* re-mint reads the standing record through the entry's management zcap and
|
|
136
|
+
* replaces only its bridge member ({@link remintUnlockRecordBridge}) -- the
|
|
137
|
+
* shell, the ladder member (where one rides), and the binding tag all travel
|
|
138
|
+
* untouched, since the re-mint can decrypt none of them and does not need to.
|
|
139
|
+
* A re-mint therefore can never change the pointer or controller the
|
|
140
|
+
* credential was bound against -- and after a host migration the tag no
|
|
141
|
+
* longer matches the moved pointer, so credentials must be rebound (codes
|
|
142
|
+
* re-issued) when the account moves hosts.
|
|
143
|
+
*
|
|
144
|
+
* The re-mint holds the code's KAK public half but not its signing key, so
|
|
145
|
+
* every record it re-PUTs is signed with the acting client's own account key
|
|
146
|
+
* (`recordSigner`) -- the mixed-signer case a reader settles against the
|
|
147
|
+
* verified did:webvh document.
|
|
148
|
+
*
|
|
149
|
+
* Best-effort per entry: a skipped entry stays flagged by the login-time
|
|
150
|
+
* health check, whose regenerate nudge remains the backstop.
|
|
151
|
+
*
|
|
152
|
+
* @param options {object}
|
|
153
|
+
* @param options.doc {PublishedKeyDocument} the locally verified did:webvh
|
|
154
|
+
* document, AFTER the revocation edit
|
|
155
|
+
* @param options.entries {RecoveryDelegationEntry[]} the registry's
|
|
156
|
+
* recovery-code entries, as the app's registry read returned them
|
|
157
|
+
* @param options.pointer {AccountPointer}
|
|
158
|
+
* @param options.storageServerUrl {string} the unlock Spaces' storage server
|
|
159
|
+
* @param options.zcapClient {ZcapClient} the acting client's promoted
|
|
160
|
+
* signer, which mints the fresh delegations
|
|
161
|
+
* @param options.recordSigner {RecordSigner} the acting client's account
|
|
162
|
+
* key, which signs the re-wrapped records
|
|
163
|
+
* @param options.managementZcapClient {Function} `({ capability }) =>
|
|
164
|
+
* ZcapClient` -- the client an entry's management zcap is invoked with
|
|
165
|
+
* @param options.recordEntry {Function} `({ entry }) => Promise<void>` --
|
|
166
|
+
* persists one updated registry entry (matching on the app's entry key)
|
|
167
|
+
* @returns {Promise<{ reminted: number; skipped: number }>}
|
|
168
|
+
*/
|
|
169
|
+
export async function remintRecoveryDelegations({ doc, entries, pointer, storageServerUrl, zcapClient, recordSigner, managementZcapClient, recordEntry }) {
|
|
170
|
+
let reminted = 0;
|
|
171
|
+
let skipped = 0;
|
|
172
|
+
for (const entry of entries) {
|
|
173
|
+
// The current-key-set rule, decided once in `webvh`: an entry whose
|
|
174
|
+
// recorded signing key the document no longer publishes -- or that
|
|
175
|
+
// records no signing key at all -- is rotted. Expiry is the other
|
|
176
|
+
// staleness axis: a delegation expired or inside the renewal window
|
|
177
|
+
// (or recording no expiry at all) is re-minted even though its key
|
|
178
|
+
// still stands.
|
|
179
|
+
const stands = delegationKeyInDocument({
|
|
180
|
+
doc,
|
|
181
|
+
...(entry.delegationKeyId
|
|
182
|
+
? { delegationKeyId: entry.delegationKeyId }
|
|
183
|
+
: {})
|
|
184
|
+
});
|
|
185
|
+
const expiring = zcapExpiring({
|
|
186
|
+
...(entry.delegationExpires ? { expires: entry.delegationExpires } : {})
|
|
187
|
+
});
|
|
188
|
+
if (stands && !expiring) {
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (!entry.recoveryClientDid ||
|
|
192
|
+
!entry.unlockKeyAgreementKeyId ||
|
|
193
|
+
!entry.unlockKeyAgreementKeyMultibase ||
|
|
194
|
+
!entry.manageCapability) {
|
|
195
|
+
// An entry issued before the re-mint fields existed: the health check
|
|
196
|
+
// keeps flagging it until the code is regenerated.
|
|
197
|
+
skipped += 1;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
try {
|
|
201
|
+
// The standing record, whose credential-authenticated core travels
|
|
202
|
+
// verbatim (a record with no binding predates the standing layout and
|
|
203
|
+
// cannot be re-minted -- `remintUnlockRecordBridge` refuses, and the
|
|
204
|
+
// entry is skipped into the health check's regenerate nudge).
|
|
205
|
+
const standing = await getUnlockKeyringWithCapability({
|
|
206
|
+
storageServerUrl,
|
|
207
|
+
zcapClient: managementZcapClient({
|
|
208
|
+
capability: entry.manageCapability
|
|
209
|
+
}),
|
|
210
|
+
spaceId: entry.unlockSpaceId,
|
|
211
|
+
capability: entry.manageCapability
|
|
212
|
+
});
|
|
213
|
+
const delegation = await delegateLogWrite({
|
|
214
|
+
zcapClient,
|
|
215
|
+
pointer,
|
|
216
|
+
recoveryClientDid: entry.recoveryClientDid
|
|
217
|
+
});
|
|
218
|
+
// The credential's unlock KAK, public half only -- exactly enough to
|
|
219
|
+
// seal the fresh bridge to the same recipient the credential derives
|
|
220
|
+
// (sealing goes through the encrypt-only cipher, so no secret is
|
|
221
|
+
// needed).
|
|
222
|
+
const unlockKak = (await X25519KeyAgreementKey2020.from({
|
|
223
|
+
id: entry.unlockKeyAgreementKeyId,
|
|
224
|
+
controller: entry.unlockKeyAgreementKeyId.split('#')[0],
|
|
225
|
+
type: 'X25519KeyAgreementKey2020',
|
|
226
|
+
publicKeyMultibase: entry.unlockKeyAgreementKeyMultibase
|
|
227
|
+
}));
|
|
228
|
+
const wrapped = await remintUnlockRecordBridge({
|
|
229
|
+
record: standing,
|
|
230
|
+
delegation,
|
|
231
|
+
keyAgreementKey: unlockKak,
|
|
232
|
+
signer: recordSigner
|
|
233
|
+
});
|
|
234
|
+
await putUnlockKeyringWithCapability({
|
|
235
|
+
storageServerUrl,
|
|
236
|
+
zcapClient: managementZcapClient({
|
|
237
|
+
capability: entry.manageCapability
|
|
238
|
+
}),
|
|
239
|
+
spaceId: entry.unlockSpaceId,
|
|
240
|
+
record: wrapped,
|
|
241
|
+
capability: entry.manageCapability
|
|
242
|
+
});
|
|
243
|
+
const delegationKeyId = delegationProofKeyId(delegation);
|
|
244
|
+
const delegationExpires = delegation.expires;
|
|
245
|
+
await recordEntry({
|
|
246
|
+
entry: {
|
|
247
|
+
...entry,
|
|
248
|
+
...(delegationKeyId ? { delegationKeyId } : {}),
|
|
249
|
+
...(delegationExpires ? { delegationExpires } : {})
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
reminted += 1;
|
|
253
|
+
}
|
|
254
|
+
catch (err) {
|
|
255
|
+
console.warn(`Could not re-mint the recovery delegation for "${entry.label}":`, err);
|
|
256
|
+
skipped += 1;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return { reminted, skipped };
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=recoveryDelegation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recoveryDelegation.js","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAG7E,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAEpE;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAEnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAE9D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,OAAO,EACP,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,EAIjB;IACC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACrC,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,SAAS,GAAG,GAAG,IAAI,sBAAsB,CAAA;AAClD,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,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I,CAAC,CAAA;QACd,CAAC;IACH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;AAC9B,CAAC"}
|
|
@@ -41,12 +41,12 @@ export type RecoveryLogStore = Pick<WebvhIdStore, 'getIdResourceRaw' | 'putIdRes
|
|
|
41
41
|
/**
|
|
42
42
|
* ISSUANCE (run by an enrolled client, root authority): publishes a recovery
|
|
43
43
|
* code's split posture into the document -- one entry adding the code's
|
|
44
|
-
* `keyAgreement` verification method (an ordinary, unmarked Multikey entry
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
44
|
+
* `keyAgreement` verification method (an ordinary, unmarked Multikey entry,
|
|
45
|
+
* the key published verbatim: a code is high-entropy, so no commitment is
|
|
46
|
+
* needed) and committing its update-key hash in `nextKeyHashes`. The code's
|
|
47
|
+
* update key joins `updateKeys` nowhere. A thin wrapper over the standing
|
|
48
|
+
* unlock-key posture core ({@link publishUnlockKey}), which owns idempotence
|
|
49
|
+
* and the conditional publish.
|
|
50
50
|
*
|
|
51
51
|
* @param options {object}
|
|
52
52
|
* @param options.idStore {WebvhIdStore}
|
|
@@ -57,7 +57,7 @@ export type RecoveryLogStore = Pick<WebvhIdStore, 'getIdResourceRaw' | 'putIdRes
|
|
|
57
57
|
* resolve to, from the caller's stored account pointer
|
|
58
58
|
* @returns {Promise<{ did: string }>}
|
|
59
59
|
*/
|
|
60
|
-
export declare function publishRecoveryKey(
|
|
60
|
+
export declare function publishRecoveryKey({ idStore, updateKeys, recovery, expectedDid }: {
|
|
61
61
|
idStore: WebvhIdStore;
|
|
62
62
|
updateKeys: ClientWebvhUpdateKeys;
|
|
63
63
|
recovery: RecoveryPublicKeys;
|
|
@@ -68,24 +68,15 @@ export declare function publishRecoveryKey(options: {
|
|
|
68
68
|
/**
|
|
69
69
|
* REVOCATION (run by an enrolled client, root authority): removes a recovery
|
|
70
70
|
* code's posture from the document -- its `keyAgreement` verification method
|
|
71
|
-
* and its committed update-key hash -- in one entry
|
|
72
|
-
* roster-side half (rotating the
|
|
73
|
-
* caller's, and runs after this so
|
|
74
|
-
* the removed entry.
|
|
71
|
+
* and its committed update-key hash -- in one entry, through the same shared
|
|
72
|
+
* posture core ({@link removeUnlockKey}). The roster-side half (rotating the
|
|
73
|
+
* user key epoch off the code's wrap) is the caller's, and runs after this so
|
|
74
|
+
* the resolver's document no longer backs the removed entry.
|
|
75
75
|
*
|
|
76
|
-
*
|
|
77
|
-
* a concurrent ceremony re-runs and rebases on the new head.
|
|
78
|
-
*
|
|
79
|
-
* @param options {object}
|
|
80
|
-
* @param options.idStore {WebvhIdStore}
|
|
81
|
-
* @param options.updateKeys {ClientWebvhUpdateKeys} the REVOKING client's
|
|
82
|
-
* own did:webvh update-key seeds
|
|
83
|
-
* @param options.recovery {RecoveryPublicKeys} the code's public halves
|
|
84
|
-
* @param [options.expectedDid] {string} the account DID the log must
|
|
85
|
-
* resolve to, from the caller's stored account pointer
|
|
76
|
+
* @param options {object} see {@link publishRecoveryKey}
|
|
86
77
|
* @returns {Promise<{ did: string }>}
|
|
87
78
|
*/
|
|
88
|
-
export declare function removeRecoveryKey(
|
|
79
|
+
export declare function removeRecoveryKey({ idStore, updateKeys, recovery, expectedDid }: {
|
|
89
80
|
idStore: WebvhIdStore;
|
|
90
81
|
updateKeys: ClientWebvhUpdateKeys;
|
|
91
82
|
recovery: RecoveryPublicKeys;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryWebvh.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryWebvh.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"recoveryWebvh.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryWebvh.ts"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EACV,qBAAqB,EAErB,mBAAmB,EACnB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAG7B;;;;;;;;;;;GAWG;AACH,wBAAgB,YA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