@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addRecipient, initRecipients, ownerRecipient, removeRecipient, unwrapEpochSecret } from '@interop/was-client/edv';
|
|
2
2
|
import { vmFragmentOf } from '../resourceLog/index.js';
|
|
3
|
+
import { commitmentMatcher, MULTIKEY_COMMITMENT_VM_TYPE } from '../webvh/didWebvh.js';
|
|
3
4
|
import { resolvedKeyAgreementMethods } from '../webvh/keyAgreement.js';
|
|
4
5
|
import { clientSigningKeyMultibase } from '../webvh/zcap.js';
|
|
5
6
|
/**
|
|
@@ -96,36 +97,60 @@ export function rosterRecipientKid({ signingKeyMultibase, keyAgreementKeyMultiba
|
|
|
96
97
|
* from the fresh epoch and never receives a wrap.
|
|
97
98
|
*
|
|
98
99
|
* The match is over EVERY key-agreement method the document publishes
|
|
99
|
-
* ({@link resolvedKeyAgreementMethods}
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
100
|
+
* ({@link resolvedKeyAgreementMethods}), deliberately including the unmarked
|
|
101
|
+
* ones. That is where this predicate parts company with
|
|
102
|
+
* `markedKeyAgreementMethods`, which hard-requires a client's controller
|
|
103
|
+
* marker: a recovery code's or standing unlock credential's key-agreement
|
|
103
104
|
* method is published unmarked by design, so that client listings and
|
|
104
105
|
* revocations never match it, and it must keep its user key wrap through every
|
|
105
|
-
* rotation. Filtering by the marker here would drop every
|
|
106
|
+
* rotation. Filtering by the marker here would drop every such credential from
|
|
106
107
|
* each rotated epoch.
|
|
107
108
|
*
|
|
109
|
+
* Two branches back an entry, and a method's `type` selects exactly one. A
|
|
110
|
+
* method that is not a `MultikeyCommitment` and carries the key verbatim
|
|
111
|
+
* (`publicKeyMultibase`) matches on the multibase (so a did:key-form kid
|
|
112
|
+
* matches its `<did:webvh>#<multibase>` VM). A `MultikeyCommitment` method's
|
|
113
|
+
* hash commitment (`publicKeyCommitment` -- a low-entropy-derived standing
|
|
114
|
+
* credential, whose key material the document withholds) matches when it
|
|
115
|
+
* commits to the roster entry's own key: the roster carries the real key, the
|
|
116
|
+
* document vouches for it, and a server-injected entry can neither meet a
|
|
117
|
+
* standing commitment nor add one. The type split means a hybrid method
|
|
118
|
+
* carrying both properties backs at most one recipient -- the flavor its
|
|
119
|
+
* `type` declares -- never two.
|
|
120
|
+
*
|
|
108
121
|
* @param options {object}
|
|
109
122
|
* @param options.document {KeyAgreementDocument} the locally verified
|
|
110
123
|
* did:webvh document (never a server-supplied roster field)
|
|
111
124
|
* @returns {function} a `resolveRecipientKey` for `removeRecipient`
|
|
112
125
|
*/
|
|
113
126
|
export function userKeyRosterRecipientResolver({ document }) {
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
const methods = resolvedKeyAgreementMethods({ doc: document });
|
|
128
|
+
const verbatimMethods = methods.filter(method => method.type !== MULTIKEY_COMMITMENT_VM_TYPE &&
|
|
129
|
+
typeof method.publicKeyMultibase === 'string');
|
|
130
|
+
const commitmentBacked = commitmentMatcher({
|
|
131
|
+
commitments: methods
|
|
132
|
+
.filter(method => method.type === MULTIKEY_COMMITMENT_VM_TYPE)
|
|
133
|
+
.map(method => method.publicKeyCommitment)
|
|
134
|
+
.filter((value) => typeof value === 'string')
|
|
135
|
+
});
|
|
117
136
|
return async function resolveRecipientKey(kid) {
|
|
118
137
|
const fragment = vmFragmentOf(kid);
|
|
119
138
|
if (!fragment) {
|
|
120
139
|
return null;
|
|
121
140
|
}
|
|
122
|
-
const match =
|
|
141
|
+
const match = verbatimMethods.find(method => method.publicKeyMultibase === fragment ||
|
|
123
142
|
(typeof method.id === 'string' && vmFragmentOf(method.id) === fragment));
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
143
|
+
if (match) {
|
|
144
|
+
return { id: kid, publicKeyMultibase: match.publicKeyMultibase };
|
|
145
|
+
}
|
|
146
|
+
// The commitment branch: the roster entry's key is document-backed iff a
|
|
147
|
+
// published `MultikeyCommitment` method commits to it. The matcher
|
|
148
|
+
// pre-decoded the commitments (a malformed one matches nothing).
|
|
149
|
+
if (commitmentBacked(fragment)) {
|
|
150
|
+
return { id: kid, publicKeyMultibase: fragment };
|
|
127
151
|
}
|
|
128
|
-
|
|
152
|
+
// No document verification method backs this roster entry: drop it.
|
|
153
|
+
return null;
|
|
129
154
|
};
|
|
130
155
|
}
|
|
131
156
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userKeyRoster.js","sourceRoot":"","sources":["../../src/keys/userKeyRoster.ts"],"names":[],"mappings":"AAmDA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,iBAAiB,EAGlB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,YAAY,EAA0B,MAAM,yBAAyB,CAAA;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AAEtE,OAAO,EACL,yBAAyB,EAE1B,MAAM,kBAAkB,CAAA;AAGzB;;;;;GAKG;AACH,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IACpD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAA;IAC3C,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IACrD,aAAa,CAAQ;IACrB,YAAY,EAAE,aAAa,EAA6B;QACtD,KAAK,CACH,4EAA4E;YAC1E,mCAAmC,CACtC,CAAA;QACD,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAA;QAC1C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;IACpC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;IACxC,CAAC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,sBAAsB,CAAC,EACrC,QAAQ,EAGT;IACC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AAC,MAAO,CAAC,YAAY,CAAE,CAAC,UAAU,CAAC,IAAI,CAC7D,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK,qBAAqB,CAAC,EAAE,CAC/D,CAAA;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,wBAAwB,CAChC,oEAAoE,CACrE,CAAA;QACH,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC;YACrC,KAAK;YACL,eAAe,EAAE,qBAAqB;SACvC,CAAC,CAAA;QACF,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,wBAAwB,CAChC,uDAAuD,CACxD,CAAA;QACH,CAAC;QACD,cAAc,GAAG,EAAE,EAAE,EAAE,UAAU,CAAC,YAAa,EAAE,MAAM,EAAE,CAAA;QACzD,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC;IAED,OAAO;QACL,UAAU;QACV,OAAO,EAAE,cAAc;QACvB,OAAO;QACP,aAAa,EAAE,UAAU,CAAC,YAAa;KACxC,CAAA;AACH,CAAC"}
|
package/dist/recovery/index.d.ts
CHANGED
|
@@ -12,16 +12,18 @@
|
|
|
12
12
|
* - `recoveryClientFromCode` -- the deterministic client key set:
|
|
13
13
|
* unlock identity, client seed (signing + key-agreement pair), and the
|
|
14
14
|
* single did:webvh update key whose hash stands pre-committed.
|
|
15
|
-
* -
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* so a storage host can never redirect recovery at
|
|
15
|
+
* - The record codec lives in `@interop/wallet-core/unlock` now
|
|
16
|
+
* (`wrapUnlockRecord` / `unwrapUnlockRecord`, re-exported here): a
|
|
17
|
+
* recovery record is an unlock record with no ladder member -- the account
|
|
18
|
+
* pointer plus the pre-minted PUT-on-`did.jsonl` bridge delegation (never
|
|
19
|
+
* a seed, never a user key wrap), signed under the mixed-signer policy
|
|
20
|
+
* (the code's unlock key at issuance, an enrolled client's account key on
|
|
21
|
+
* a re-mint), with the account core authenticated by a MAC under a
|
|
22
|
+
* code-derived key, so a storage host can never redirect recovery at
|
|
23
|
+
* another account.
|
|
23
24
|
* - `publishRecoveryKey` / `removeRecoveryKey` / `recoverWebvhClient` -- the
|
|
24
|
-
* document half: issuance's split posture
|
|
25
|
+
* document half: issuance's split posture and revocation's removal (thin
|
|
26
|
+
* wrappers over the unlock subpath's merged posture core), and the
|
|
25
27
|
* self-enrolling recovery continuation.
|
|
26
28
|
* - `delegateLogWrite` / `delegationProofKeyId` /
|
|
27
29
|
* `remintRecoveryDelegations` -- the authorization bridge: the pre-minted
|
|
@@ -35,9 +37,9 @@
|
|
|
35
37
|
*/
|
|
36
38
|
export { decodeRecoveryCode, formatRecoveryCode, generateRecoveryCode, normalizeRecoveryCode, RECOVERY_CODE_BYTES, RECOVERY_KDF, RecoveryCodeInvalidError, recoveryClientFromCode } from './recoveryCode.js';
|
|
37
39
|
export type { RecoveryClient } from './recoveryCode.js';
|
|
38
|
-
export {
|
|
39
|
-
export type {
|
|
40
|
-
export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, remintRecoveryDelegations } from './recoveryDelegation.js';
|
|
40
|
+
export { computeUnlockBinding, remintUnlockRecordBridge, UnlockBindingError, unlockRecordBinding, unwrapUnlockRecord, wrapUnlockRecord } from '../unlock/unlockRecord.js';
|
|
41
|
+
export type { SignedUnlockRecord, UnlockRecordContents, UnlockRecordProofState } from '../unlock/unlockRecord.js';
|
|
42
|
+
export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
|
|
41
43
|
export type { RecoveryDelegationEntry } from './recoveryDelegation.js';
|
|
42
44
|
export { publishRecoveryKey, recoverWebvhClient, RecoveryKeyNotCommittedError, recoveryVmId, removeRecoveryKey } from './recoveryWebvh.js';
|
|
43
45
|
export type { RecoveryLogStore, RecoveryPublicKeys } from './recoveryWebvh.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAChC,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAEtE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/recovery/index.js
CHANGED
|
@@ -12,16 +12,18 @@
|
|
|
12
12
|
* - `recoveryClientFromCode` -- the deterministic client key set:
|
|
13
13
|
* unlock identity, client seed (signing + key-agreement pair), and the
|
|
14
14
|
* single did:webvh update key whose hash stands pre-committed.
|
|
15
|
-
* -
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* so a storage host can never redirect recovery at
|
|
15
|
+
* - The record codec lives in `@interop/wallet-core/unlock` now
|
|
16
|
+
* (`wrapUnlockRecord` / `unwrapUnlockRecord`, re-exported here): a
|
|
17
|
+
* recovery record is an unlock record with no ladder member -- the account
|
|
18
|
+
* pointer plus the pre-minted PUT-on-`did.jsonl` bridge delegation (never
|
|
19
|
+
* a seed, never a user key wrap), signed under the mixed-signer policy
|
|
20
|
+
* (the code's unlock key at issuance, an enrolled client's account key on
|
|
21
|
+
* a re-mint), with the account core authenticated by a MAC under a
|
|
22
|
+
* code-derived key, so a storage host can never redirect recovery at
|
|
23
|
+
* another account.
|
|
23
24
|
* - `publishRecoveryKey` / `removeRecoveryKey` / `recoverWebvhClient` -- the
|
|
24
|
-
* document half: issuance's split posture
|
|
25
|
+
* document half: issuance's split posture and revocation's removal (thin
|
|
26
|
+
* wrappers over the unlock subpath's merged posture core), and the
|
|
25
27
|
* self-enrolling recovery continuation.
|
|
26
28
|
* - `delegateLogWrite` / `delegationProofKeyId` /
|
|
27
29
|
* `remintRecoveryDelegations` -- the authorization bridge: the pre-minted
|
|
@@ -34,7 +36,7 @@
|
|
|
34
36
|
* was-client dependency graph (the same isolation pattern as `./keyring`).
|
|
35
37
|
*/
|
|
36
38
|
export { decodeRecoveryCode, formatRecoveryCode, generateRecoveryCode, normalizeRecoveryCode, RECOVERY_CODE_BYTES, RECOVERY_KDF, RecoveryCodeInvalidError, recoveryClientFromCode } from './recoveryCode.js';
|
|
37
|
-
export {
|
|
38
|
-
export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, remintRecoveryDelegations } from './recoveryDelegation.js';
|
|
39
|
+
export { computeUnlockBinding, remintUnlockRecordBridge, UnlockBindingError, unlockRecordBinding, unwrapUnlockRecord, wrapUnlockRecord } from '../unlock/unlockRecord.js';
|
|
40
|
+
export { delegateLogWrite, delegationProofKeyId, RECOVERY_DELEGATION_TTL_MS, remintRecoveryDelegations, ZCAP_RENEWAL_WINDOW_MS, zcapExpiring } from './recoveryDelegation.js';
|
|
39
41
|
export { publishRecoveryKey, recoverWebvhClient, RecoveryKeyNotCommittedError, recoveryVmId, removeRecoveryKey } from './recoveryWebvh.js';
|
|
40
42
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAOlC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EAClB,MAAM,oBAAoB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProfileAgents } from '../identity/agents.js';
|
|
2
1
|
import type { UnlockKdf } from '../keyring/kdf.js';
|
|
2
|
+
import type { UnlockClientIdentity } from '../unlock/standingClient.js';
|
|
3
3
|
/**
|
|
4
4
|
* The byte length of a recovery code: 16 random bytes is ~128 bits, enough
|
|
5
5
|
* that the unlock derivation is a single expansion rather than a stretched
|
|
@@ -73,28 +73,16 @@ export declare function decodeRecoveryCode({ code }: {
|
|
|
73
73
|
* agents, and the public multibases / ids the issuance and recovery flows
|
|
74
74
|
* publish and look up.
|
|
75
75
|
*/
|
|
76
|
-
export interface RecoveryClient {
|
|
76
|
+
export interface RecoveryClient extends UnlockClientIdentity {
|
|
77
77
|
codeBytes: Uint8Array;
|
|
78
|
-
clientSeed: Uint8Array;
|
|
79
78
|
updateSeed: Uint8Array;
|
|
80
79
|
/**
|
|
81
|
-
* The symmetric key that MACs the recovery record's account binding
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* storage host never holds it.
|
|
80
|
+
* The symmetric key that MACs the recovery record's account binding:
|
|
81
|
+
* computed at issuance, verified at recovery before the pointer is trusted.
|
|
82
|
+
* Derived from the code bytes, so the storage host never holds it.
|
|
85
83
|
*/
|
|
86
84
|
bindingMacKey: Uint8Array;
|
|
87
|
-
agents: ProfileAgents;
|
|
88
|
-
clientDid: string;
|
|
89
|
-
signingKeyMultibase: string;
|
|
90
|
-
keyAgreementKeyMultibase: string;
|
|
91
85
|
updateKeyMultibase: string;
|
|
92
|
-
/**
|
|
93
|
-
* The kid of the code's user-key-roster entry -- its key-agreement key's id
|
|
94
|
-
* exactly as `agentsFromSeed` derives it (`did:key:<ed>#<x>`), so the wrap
|
|
95
|
-
* minted at issuance is the one the recovery flow's roster read looks for.
|
|
96
|
-
*/
|
|
97
|
-
recipientKid: string;
|
|
98
86
|
}
|
|
99
87
|
/**
|
|
100
88
|
* Derives the code's whole client identity from a (possibly formatted) code.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryCode.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryCode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"recoveryCode.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryCode.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAGvE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,SAM1B,CAAA;AAoBD;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,SAAuC;CAI3D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAI7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAErE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE1E;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAazE;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAe,SAAQ,oBAAoB;IAC1D,SAAS,EAAE,UAAU,CAAA;IACrB,UAAU,EAAE,UAAU,CAAA;IACtB;;;;OAIG;IACH,aAAa,EAAE,UAAU,CAAA;IACzB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,IAAI,EACL,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,cAAc,CAAC,CAgC1B"}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { base58 } from '@scure/base';
|
|
21
21
|
import { hkdf } from '@noble/hashes/hkdf.js';
|
|
22
22
|
import { sha256 } from '@noble/hashes/sha2.js';
|
|
23
|
-
import {
|
|
23
|
+
import { unlockClientIdentityFromSeed } from '../unlock/standingClient.js';
|
|
24
24
|
import { updateKeyMultibase } from '../webvh/didWebvh.js';
|
|
25
25
|
/**
|
|
26
26
|
* The byte length of a recovery code: 16 random bytes is ~128 bits, enough
|
|
@@ -143,23 +143,13 @@ export async function recoveryClientFromCode({ code }) {
|
|
|
143
143
|
const clientSeed = hkdf(sha256, codeBytes, salt, new TextEncoder().encode(RECOVERY_CLIENT_SEED_INFO), 32);
|
|
144
144
|
const updateSeed = hkdf(sha256, codeBytes, salt, new TextEncoder().encode(RECOVERY_UPDATE_SEED_INFO), 32);
|
|
145
145
|
const bindingMacKey = hkdf(sha256, codeBytes, new TextEncoder().encode(RECOVERY_KDF.salt), new TextEncoder().encode(RECOVERY_BINDING_MAC_INFO), 32);
|
|
146
|
-
const
|
|
147
|
-
const { publicKeyMultibase: keyAgreementKeyMultibase } = agents.keyAgreementKey;
|
|
148
|
-
if (!keyAgreementKeyMultibase) {
|
|
149
|
-
throw new Error('The derived key-agreement key has no public multibase.');
|
|
150
|
-
}
|
|
151
|
-
const [, , signingKeyMultibase] = agents.keyAgent.id.split(':');
|
|
146
|
+
const identity = await unlockClientIdentityFromSeed({ clientSeed });
|
|
152
147
|
return {
|
|
148
|
+
...identity,
|
|
153
149
|
codeBytes,
|
|
154
|
-
clientSeed,
|
|
155
150
|
updateSeed,
|
|
156
151
|
bindingMacKey,
|
|
157
|
-
|
|
158
|
-
clientDid: agents.keyAgent.id,
|
|
159
|
-
signingKeyMultibase: signingKeyMultibase,
|
|
160
|
-
keyAgreementKeyMultibase,
|
|
161
|
-
updateKeyMultibase: await updateKeyMultibase({ seed: updateSeed }),
|
|
162
|
-
recipientKid: `${agents.keyAgent.id}#${keyAgreementKeyMultibase}`
|
|
152
|
+
updateKeyMultibase: await updateKeyMultibase({ seed: updateSeed })
|
|
163
153
|
};
|
|
164
154
|
}
|
|
165
155
|
//# sourceMappingURL=recoveryCode.js.map
|
|
@@ -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":["../../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;AAE9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAE1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAErC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAc;IACrC,OAAO,EAAE,CAAC;IACV,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,qCAAqC;IAC3C,IAAI,EAAE,wBAAwB;CAC/B,CAAA;AAED;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,oCAAoC,CAAA;AACjE,MAAM,yBAAyB,GAAG,aAAa,CAAA;AAC/C,MAAM,yBAAyB,GAAG,YAAY,CAAA;AAE9C;;;;;;GAMG;AACH,MAAM,yBAAyB,GAAG,wBAAwB,CAAA;AAE1D;;;;;;GAMG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAO,GA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EAAE,IAAI,EAAE,CAAC,CAAA;IAC9C,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC3D,MAAM,UAAU,GAAG,IAAI,CACrB,MAAM,EACN,SAAS,EACT,IAAI,EACJ,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC,EACnD,EAAE,CACH,CAAA;IACD,MAAM,UAAU,GAAG,IAAI,CACrB,MAAM,EACN,SAAS,EACT,IAAI,EACJ,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC,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"}
|
|
@@ -3,15 +3,45 @@ import type { ZcapClient } from '@interop/ezcap';
|
|
|
3
3
|
import type { PublishedKeyDocument } from '../webvh/listClients.js';
|
|
4
4
|
import type { AccountPointer, RecordSigner } from '../keyring/record.js';
|
|
5
5
|
/**
|
|
6
|
-
* The recovery delegation's lifetime:
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* write that still has to verify
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
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).
|
|
13
19
|
*/
|
|
14
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;
|
|
15
45
|
/**
|
|
16
46
|
* Delegates the narrow log-write bridge to a code-derived client: PUT on the
|
|
17
47
|
* one `did.jsonl` resource, {@link RECOVERY_DELEGATION_TTL_MS} lifetime. The
|
|
@@ -42,8 +72,9 @@ export declare function delegationProofKeyId(delegation: IZcap): string | undefi
|
|
|
42
72
|
/**
|
|
43
73
|
* The members of a recovery-code registry entry the re-mint reads: where the
|
|
44
74
|
* code's unlock Space and record are (`unlockSpaceId`, `manageCapability`),
|
|
45
|
-
* which key signed the recorded delegation
|
|
46
|
-
*
|
|
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
|
|
47
78
|
* the re-mint fields: the code-derived signing DID the fresh delegation names
|
|
48
79
|
* and the unlock KAK public half the record is re-wrapped to. Structural on
|
|
49
80
|
* purpose -- an app's richer registry entry satisfies it, and the re-mint
|
|
@@ -55,6 +86,7 @@ export interface RecoveryDelegationEntry {
|
|
|
55
86
|
unlockSpaceId: string;
|
|
56
87
|
manageCapability?: IZcap;
|
|
57
88
|
delegationKeyId?: string;
|
|
89
|
+
delegationExpires?: string;
|
|
58
90
|
recoveryClientDid?: string;
|
|
59
91
|
unlockKeyAgreementKeyId?: string;
|
|
60
92
|
unlockKeyAgreementKeyMultibase?: string;
|
|
@@ -64,13 +96,15 @@ export interface RecoveryDelegationEntry {
|
|
|
64
96
|
* the recovery-code delta riding the revocation cascade (see the module doc
|
|
65
97
|
* for the mechanism and the skip policy).
|
|
66
98
|
*
|
|
67
|
-
* The record's
|
|
99
|
+
* The record's credential-authenticated core is preserved verbatim: the
|
|
68
100
|
* re-mint reads the standing record through the entry's management zcap and
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
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.
|
|
74
108
|
*
|
|
75
109
|
* The re-mint holds the code's KAK public half but not its signing key, so
|
|
76
110
|
* every record it re-PUTs is signed with the acting client's own account key
|
|
@@ -86,8 +120,6 @@ export interface RecoveryDelegationEntry {
|
|
|
86
120
|
* @param options.entries {RecoveryDelegationEntry[]} the registry's
|
|
87
121
|
* recovery-code entries, as the app's registry read returned them
|
|
88
122
|
* @param options.pointer {AccountPointer}
|
|
89
|
-
* @param options.controller {string} the account controller to stamp into
|
|
90
|
-
* re-wrapped records (an identity label, as at issuance)
|
|
91
123
|
* @param options.storageServerUrl {string} the unlock Spaces' storage server
|
|
92
124
|
* @param options.zcapClient {ZcapClient} the acting client's promoted
|
|
93
125
|
* signer, which mints the fresh delegations
|
|
@@ -99,11 +131,10 @@ export interface RecoveryDelegationEntry {
|
|
|
99
131
|
* persists one updated registry entry (matching on the app's entry key)
|
|
100
132
|
* @returns {Promise<{ reminted: number; skipped: number }>}
|
|
101
133
|
*/
|
|
102
|
-
export declare function remintRecoveryDelegations<Entry extends RecoveryDelegationEntry>({ doc, entries, pointer,
|
|
134
|
+
export declare function remintRecoveryDelegations<Entry extends RecoveryDelegationEntry>({ doc, entries, pointer, storageServerUrl, zcapClient, recordSigner, managementZcapClient, recordEntry }: {
|
|
103
135
|
doc: PublishedKeyDocument;
|
|
104
136
|
entries: Entry[];
|
|
105
137
|
pointer: AccountPointer;
|
|
106
|
-
controller: string;
|
|
107
138
|
storageServerUrl: string;
|
|
108
139
|
zcapClient: ZcapClient;
|
|
109
140
|
recordSigner: RecordSigner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryDelegation.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"
|
|
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,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CASV;AAiBD;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,UAAU,EACV,OAAO,EACP,iBAAiB,EAClB,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,cAAc,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;CAC1B,GAAG,OAAO,CAAC,KAAK,CAAC,CAOjB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAU1E;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,i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