@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,288 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The recovery keyring record codec: the `{ version, encryption, wrapped,
|
|
6
|
-
* binding, proof }` envelope stored as the one resource of a recovery code's
|
|
7
|
-
* unlock Space. Its plaintext is the ordinary keyring record's (controller,
|
|
8
|
-
* account pointer) PLUS the pre-minted PUT-on-`did.jsonl` delegation -- the
|
|
9
|
-
* narrow zcap bridge that lets the code-derived client write its
|
|
10
|
-
* self-enrolling log continuation. It carries **no key material of any
|
|
11
|
-
* kind**: never a seed, never a user key wrap (wraps live doc-and-roster
|
|
12
|
-
* only), so the record stays a pure pointer.
|
|
13
|
-
*
|
|
14
|
-
* The wrap reuses the keyring record construction (cipher context,
|
|
15
|
-
* record-own epoch, and signed frame alike), so a recovery record IS a
|
|
16
|
-
* keyring record to every generic consumer -- only the recovery flow demands
|
|
17
|
-
* the delegation and the binding.
|
|
18
|
-
*
|
|
19
|
-
* The record splits into a code-authenticated core and a re-mintable shell.
|
|
20
|
-
* The core is the account binding `{ controller, pointer }`, authenticated by
|
|
21
|
-
* the `binding` frame member: an HMAC tag under a key derived from the code
|
|
22
|
-
* bytes, computed at issuance and verified at recovery BEFORE the pointer is
|
|
23
|
-
* trusted. Only the issuer and the code holder ever hold that key -- the
|
|
24
|
-
* storage host never does -- so a host-forged record pointing recovery at
|
|
25
|
-
* another account fails the tag however it is encrypted or signed. The tag
|
|
26
|
-
* rides the frame in the clear (it reveals nothing) so the re-mint path,
|
|
27
|
-
* which cannot decrypt the record or recompute the tag, preserves it
|
|
28
|
-
* verbatim; the binding values themselves stay inside the plaintext. The
|
|
29
|
-
* consequence: a re-mint can never change the pointer, and an account that
|
|
30
|
-
* moves hosts must re-issue its codes.
|
|
31
|
-
*
|
|
32
|
-
* The shell is the delegation and the frame proof, and its signer is mixed.
|
|
33
|
-
* At issuance the record is signed by the code-derived unlock key, the one a
|
|
34
|
-
* typed code re-derives, so recovery verifies the proof before decrypting.
|
|
35
|
-
* The revocation cascade's re-mint path holds only the code's KAK public
|
|
36
|
-
* half plus an enrolled client's account key, so it re-PUTs the record
|
|
37
|
-
* signed by that client's account verification method instead. This codec is
|
|
38
|
-
* agnostic -- it signs with what it is given -- and the reader carries the
|
|
39
|
-
* policy: a proof by the expected unlock key verifies up front, and anything
|
|
40
|
-
* else comes back marked unverified, for the caller to check against the
|
|
41
|
-
* verified did:webvh document of the account the code-authenticated pointer
|
|
42
|
-
* names.
|
|
43
|
-
*/
|
|
44
|
-
import { base64urlnopad } from '@scure/base';
|
|
45
|
-
import { equalBytes } from '@noble/ciphers/utils.js';
|
|
46
|
-
import { hmac } from '@noble/hashes/hmac.js';
|
|
47
|
-
import { sha256 } from '@noble/hashes/sha2.js';
|
|
48
|
-
import { KEYRING_RECORD_VERSION, mintRecordEncryption, parseRecordCreatedAt, parseRecordFrame, parseRecordPointer, recordCipher, recordCreatedAtStamp, recordProofKeyMultibase, recordSealCipher, signRecordFrame, verifyRecordProof } from '../keyring/record.js';
|
|
49
|
-
/**
|
|
50
|
-
* The context label mixed into the binding MAC input, versioning the tag
|
|
51
|
-
* construction. Permanent -- changing it orphans every issued code.
|
|
52
|
-
*/
|
|
53
|
-
const RECOVERY_BINDING_CONTEXT = 'freewallet/recovery/binding/v1';
|
|
54
|
-
/**
|
|
55
|
-
* A recovery record's account binding is absent, malformed, or does not
|
|
56
|
-
* verify under the typed code's binding MAC key. Its own class, distinct from
|
|
57
|
-
* a proof or decrypt failure: this is the refusal that says the record's
|
|
58
|
-
* `{ controller, pointer }` core was not written by a holder of this code --
|
|
59
|
-
* a forged record redirecting recovery at another account, or a record from
|
|
60
|
-
* before the account moved hosts (either way the code cannot recover here
|
|
61
|
-
* and must be re-issued).
|
|
62
|
-
*/
|
|
63
|
-
export class RecoveryBindingError extends Error {
|
|
64
|
-
constructor(message) {
|
|
65
|
-
super(message);
|
|
66
|
-
this.name = 'RecoveryBindingError';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* The deterministic MAC input over a record's account binding: a JSON array
|
|
71
|
-
* of the context label and the binding values, so no delimiter ambiguity can
|
|
72
|
-
* make two bindings collide.
|
|
73
|
-
*/
|
|
74
|
-
function bindingMacInput({ controller, pointer }) {
|
|
75
|
-
return new TextEncoder().encode(JSON.stringify([
|
|
76
|
-
RECOVERY_BINDING_CONTEXT,
|
|
77
|
-
controller,
|
|
78
|
-
pointer.did ?? '',
|
|
79
|
-
pointer.spaceId,
|
|
80
|
-
pointer.host
|
|
81
|
-
]));
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Computes the account-binding tag: HMAC-SHA-256 over the binding values
|
|
85
|
-
* under the code-derived binding MAC key, base64url (no pad). Issuance calls
|
|
86
|
-
* it to stamp the record; recovery recomputes it to verify.
|
|
87
|
-
*
|
|
88
|
-
* @param options {object}
|
|
89
|
-
* @param options.bindingMacKey {Uint8Array} the code-derived MAC key
|
|
90
|
-
* @param options.controller {string} the account did:key
|
|
91
|
-
* @param options.pointer {AccountPointer} the account pointer
|
|
92
|
-
* @returns {string}
|
|
93
|
-
*/
|
|
94
|
-
export function computeRecoveryBinding({ bindingMacKey, controller, pointer }) {
|
|
95
|
-
return base64urlnopad.encode(hmac(sha256, bindingMacKey, bindingMacInput({ controller, pointer })));
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Reads the `binding` frame member off a stored recovery record without
|
|
99
|
-
* decrypting anything. The re-mint path uses it to carry the tag forward
|
|
100
|
-
* verbatim -- it cannot recompute the tag (no code bytes) and does not need
|
|
101
|
-
* to. Refuses a record with no binding: such a record predates the
|
|
102
|
-
* code-authenticated core and cannot be re-minted -- its code must be
|
|
103
|
-
* re-issued.
|
|
104
|
-
*
|
|
105
|
-
* @param options {object}
|
|
106
|
-
* @param options.record {unknown} the stored record envelope
|
|
107
|
-
* @returns {string}
|
|
108
|
-
*/
|
|
109
|
-
export function recoveryRecordBinding({ record }) {
|
|
110
|
-
const { binding } = (record ?? {});
|
|
111
|
-
if (typeof binding !== 'string' || !binding) {
|
|
112
|
-
throw new RecoveryBindingError('The recovery record carries no code-authenticated account binding; ' +
|
|
113
|
-
'the recovery code must be re-issued.');
|
|
114
|
-
}
|
|
115
|
-
return binding;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Wraps the recovery record: controller, pointer, and the pre-minted
|
|
119
|
-
* `did.jsonl` PUT delegation, encrypted under the code's unlock KAK via the
|
|
120
|
-
* keyring EDV cipher context, then signed into the same frame the keyring
|
|
121
|
-
* record uses -- with the account-binding tag as one more frame member the
|
|
122
|
-
* proof covers. Issuance passes the code-derived `bindingMacKey` (the tag is
|
|
123
|
-
* computed here) and the code-derived unlock signer; the revocation cascade's
|
|
124
|
-
* re-mint path passes the standing record's `binding` verbatim and an
|
|
125
|
-
* enrolled client's account signer (see this module's header for the policy
|
|
126
|
-
* the reader applies to the two). Exactly one of the two binding inputs must
|
|
127
|
-
* be given.
|
|
128
|
-
*
|
|
129
|
-
* @param options {object}
|
|
130
|
-
* @param options.controller {string} the account did:key
|
|
131
|
-
* @param options.pointer {AccountPointer} the account pointer
|
|
132
|
-
* @param options.delegation {IZcap} the PUT-on-`did.jsonl` delegation to the
|
|
133
|
-
* code-derived signing DID
|
|
134
|
-
* @param options.keyAgreementKey {IKeyAgreementKey} the code's unlock KAK --
|
|
135
|
-
* its public half is all the wrap uses (sealing needs no key-agreement
|
|
136
|
-
* secret), which is exactly what lets the re-mint path re-seal a record it
|
|
137
|
-
* can never open
|
|
138
|
-
* @param options.signer {RecordSigner} the signing key: the code's unlock
|
|
139
|
-
* key at issuance, an enrolled client's account key on a re-mint
|
|
140
|
-
* @param [options.bindingMacKey] {Uint8Array} the code-derived binding MAC
|
|
141
|
-
* key -- the issuance path, which computes the tag
|
|
142
|
-
* @param [options.binding] {string} the standing record's tag, carried
|
|
143
|
-
* forward verbatim -- the re-mint path, which cannot recompute it
|
|
144
|
-
* @param [options.createdAt] {string} the bind timestamp to stamp, as an ISO
|
|
145
|
-
* string; defaults to now. Supplied by a caller that pins record freshness.
|
|
146
|
-
* @returns {Promise<SignedRecoveryRecord>}
|
|
147
|
-
*/
|
|
148
|
-
export async function wrapRecoveryRecord({ controller, pointer, delegation, keyAgreementKey, signer, bindingMacKey, binding, createdAt }) {
|
|
149
|
-
if ((bindingMacKey === undefined) === (binding === undefined)) {
|
|
150
|
-
throw new Error('Exactly one of bindingMacKey (issuance) or binding (re-mint) is ' +
|
|
151
|
-
'required.');
|
|
152
|
-
}
|
|
153
|
-
const tag = bindingMacKey !== undefined
|
|
154
|
-
? computeRecoveryBinding({ bindingMacKey, controller, pointer })
|
|
155
|
-
: binding;
|
|
156
|
-
const encryption = await mintRecordEncryption({ keyAgreementKey });
|
|
157
|
-
const cipher = await recordSealCipher({ encryption });
|
|
158
|
-
const data = {
|
|
159
|
-
controller,
|
|
160
|
-
pointer: {
|
|
161
|
-
...(pointer.did ? { did: pointer.did } : {}),
|
|
162
|
-
spaceId: pointer.spaceId,
|
|
163
|
-
host: pointer.host
|
|
164
|
-
},
|
|
165
|
-
delegation,
|
|
166
|
-
createdAt: recordCreatedAtStamp({ createdAt })
|
|
167
|
-
};
|
|
168
|
-
const { envelope } = await cipher.encrypt({
|
|
169
|
-
data: data
|
|
170
|
-
});
|
|
171
|
-
return (await signRecordFrame({
|
|
172
|
-
version: KEYRING_RECORD_VERSION,
|
|
173
|
-
encryption,
|
|
174
|
-
wrapped: envelope,
|
|
175
|
-
signer,
|
|
176
|
-
members: { binding: tag }
|
|
177
|
-
}));
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Unwraps and validates a recovery record: the ordinary keyring-record checks
|
|
181
|
-
* plus the required pointer, delegation, and account binding. A record
|
|
182
|
-
* without a delegation is not a recovery record (an ordinary keyring record
|
|
183
|
-
* found under a code's unlock Space would mean a corrupted issuance) and is
|
|
184
|
-
* refused.
|
|
185
|
-
*
|
|
186
|
-
* The account binding is verified before the contents are returned: the
|
|
187
|
-
* decrypted `{ controller, pointer }` must carry the tag the code-derived
|
|
188
|
-
* MAC key computes over them, or the record is refused as forged
|
|
189
|
-
* ({@link RecoveryBindingError}) -- the check that closes the host-forgery
|
|
190
|
-
* redirect, since the host never holds the MAC key. Nothing downstream may
|
|
191
|
-
* trust the pointer before this returns.
|
|
192
|
-
*
|
|
193
|
-
* Proof verification is mixed-signer and ordered deliberately. A proof by the
|
|
194
|
-
* code's own unlock key is verified BEFORE decryption -- the strong path,
|
|
195
|
-
* where the typed code alone establishes what may have signed the record. A
|
|
196
|
-
* proof by any other key can only be checked after decryption, because the
|
|
197
|
-
* re-minting client is knowable only once the code-authenticated pointer says
|
|
198
|
-
* which account this is and that account's log has been verified; the
|
|
199
|
-
* contents come back with a pending proof state naming the signer, and the
|
|
200
|
-
* caller completes the check with {@link verifyRecordProof} against the
|
|
201
|
-
* document's keys. That second phase is what makes an unexpected signer
|
|
202
|
-
* refuse: a record whose proof belongs to neither class ends in a
|
|
203
|
-
* `RecordProofError` there.
|
|
204
|
-
*
|
|
205
|
-
* @param options {object}
|
|
206
|
-
* @param options.record {unknown} the stored `{ version, encryption,
|
|
207
|
-
* wrapped, binding, proof }` envelope
|
|
208
|
-
* @param options.keyAgreementKey {IKeyAgreementKey} the code's unlock KAK
|
|
209
|
-
* @param options.keyResolver {IKeyResolver}
|
|
210
|
-
* @param options.expectedKeyMultibase {string} the code-derived unlock
|
|
211
|
-
* signing key's multibase
|
|
212
|
-
* @param options.bindingMacKey {Uint8Array} the code-derived binding MAC
|
|
213
|
-
* key the record's account binding must verify under
|
|
214
|
-
* @returns {Promise<{ contents: RecoveryRecordContents,
|
|
215
|
-
* proofState: RecoveryRecordProofState }>}
|
|
216
|
-
*/
|
|
217
|
-
export async function unwrapRecoveryRecord({ record, keyAgreementKey, keyResolver, expectedKeyMultibase, bindingMacKey }) {
|
|
218
|
-
const { encryption, wrapped, proof } = parseRecordFrame({
|
|
219
|
-
record,
|
|
220
|
-
label: 'recovery'
|
|
221
|
-
});
|
|
222
|
-
const binding = recoveryRecordBinding({ record });
|
|
223
|
-
// `parseRecordFrame` shape-checks the proof of a current-version frame, so
|
|
224
|
-
// it is present here.
|
|
225
|
-
const verificationMethod = proof.verificationMethod;
|
|
226
|
-
const keyMultibase = recordProofKeyMultibase({
|
|
227
|
-
verificationMethod,
|
|
228
|
-
label: 'recovery'
|
|
229
|
-
});
|
|
230
|
-
let proofState = {
|
|
231
|
-
pending: { verificationMethod, keyMultibase }
|
|
232
|
-
};
|
|
233
|
-
if (keyMultibase === expectedKeyMultibase) {
|
|
234
|
-
await verifyRecordProof({
|
|
235
|
-
record,
|
|
236
|
-
allowedKeyMultibases: expectedKeyMultibase,
|
|
237
|
-
label: 'recovery'
|
|
238
|
-
});
|
|
239
|
-
proofState = 'verified';
|
|
240
|
-
}
|
|
241
|
-
const cipher = await recordCipher({
|
|
242
|
-
keyAgreementKey,
|
|
243
|
-
keyResolver,
|
|
244
|
-
encryption
|
|
245
|
-
});
|
|
246
|
-
const plaintext = (await cipher.decrypt({
|
|
247
|
-
envelope: wrapped
|
|
248
|
-
}));
|
|
249
|
-
if (typeof plaintext.controller !== 'string' || !plaintext.controller) {
|
|
250
|
-
throw new Error('Recovery record is missing a controller.');
|
|
251
|
-
}
|
|
252
|
-
const pointer = parseRecordPointer(plaintext.pointer);
|
|
253
|
-
if (!pointer) {
|
|
254
|
-
throw new Error('Recovery record is missing its account pointer.');
|
|
255
|
-
}
|
|
256
|
-
if (plaintext.delegation === null ||
|
|
257
|
-
typeof plaintext.delegation !== 'object') {
|
|
258
|
-
throw new Error('Recovery record is missing its did.jsonl delegation.');
|
|
259
|
-
}
|
|
260
|
-
const createdAt = parseRecordCreatedAt({
|
|
261
|
-
value: plaintext.createdAt,
|
|
262
|
-
label: 'Recovery'
|
|
263
|
-
});
|
|
264
|
-
const expectedTag = hmac(sha256, bindingMacKey, bindingMacInput({ controller: plaintext.controller, pointer }));
|
|
265
|
-
let servedTag;
|
|
266
|
-
try {
|
|
267
|
-
servedTag = base64urlnopad.decode(binding);
|
|
268
|
-
}
|
|
269
|
-
catch {
|
|
270
|
-
servedTag = null;
|
|
271
|
-
}
|
|
272
|
-
// `equalBytes` is @noble/ciphers' authentication-tag comparison (no early
|
|
273
|
-
// exit), so the check leaks nothing through timing.
|
|
274
|
-
if (servedTag === null || !equalBytes(servedTag, expectedTag)) {
|
|
275
|
-
throw new RecoveryBindingError("The recovery record's account binding does not verify under this " +
|
|
276
|
-
'code; the record is refused as forged.');
|
|
277
|
-
}
|
|
278
|
-
return {
|
|
279
|
-
contents: {
|
|
280
|
-
controller: plaintext.controller,
|
|
281
|
-
pointer,
|
|
282
|
-
delegation: plaintext.delegation,
|
|
283
|
-
createdAt
|
|
284
|
-
},
|
|
285
|
-
proofState
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
//# sourceMappingURL=recoveryRecord.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryRecord.js","sourceRoot":"","sources":["../../src/recovery/recoveryRecord.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAM9C,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EAClB,MAAM,sBAAsB,CAAA;AAO7B;;;GAGG;AACH,MAAM,wBAAwB,GAAG,gCAAgC,CAAA;AAEjE;;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