@openzeppelin/miden-multisig-client 0.17.0-rc.1 → 0.17.0-rc.3
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 +167 -42
- package/dist/account/builder.d.ts +2 -2
- package/dist/account/builder.d.ts.map +1 -1
- package/dist/account/builder.js +49 -24
- package/dist/account/builder.js.map +1 -1
- package/dist/connectivity.d.ts +2 -0
- package/dist/connectivity.d.ts.map +1 -1
- package/dist/connectivity.js +7 -4
- package/dist/connectivity.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/multisig/authArgErrors.d.ts +59 -0
- package/dist/multisig/authArgErrors.d.ts.map +1 -0
- package/dist/multisig/authArgErrors.js +115 -0
- package/dist/multisig/authArgErrors.js.map +1 -0
- package/dist/multisig/helpers.d.ts +5 -0
- package/dist/multisig/helpers.d.ts.map +1 -1
- package/dist/multisig/helpers.js +7 -2
- package/dist/multisig/helpers.js.map +1 -1
- package/dist/multisig.d.ts +140 -0
- package/dist/multisig.d.ts.map +1 -1
- package/dist/multisig.js +419 -12
- package/dist/multisig.js.map +1 -1
- package/dist/procedures.d.ts +1 -1
- package/dist/procedures.js +1 -1
- package/dist/recovery/proposalNoteImport.d.ts +173 -0
- package/dist/recovery/proposalNoteImport.d.ts.map +1 -0
- package/dist/recovery/proposalNoteImport.js +411 -0
- package/dist/recovery/proposalNoteImport.js.map +1 -0
- package/dist/recovery/publicNoteBackfill.d.ts +168 -0
- package/dist/recovery/publicNoteBackfill.d.ts.map +1 -0
- package/dist/recovery/publicNoteBackfill.js +368 -0
- package/dist/recovery/publicNoteBackfill.js.map +1 -0
- package/dist/recovery/recoverNotes.d.ts +147 -0
- package/dist/recovery/recoverNotes.d.ts.map +1 -0
- package/dist/recovery/recoverNotes.js +163 -0
- package/dist/recovery/recoverNotes.js.map +1 -0
- package/dist/recovery/transportDrain.d.ts +124 -0
- package/dist/recovery/transportDrain.d.ts.map +1 -0
- package/dist/recovery/transportDrain.js +262 -0
- package/dist/recovery/transportDrain.js.map +1 -0
- package/dist/transaction/consumeNotes.d.ts.map +1 -1
- package/dist/transaction/consumeNotes.js +4 -1
- package/dist/transaction/consumeNotes.js.map +1 -1
- package/dist/transaction/p2id.d.ts.map +1 -1
- package/dist/transaction/p2id.js +4 -1
- package/dist/transaction/p2id.js.map +1 -1
- package/dist/transaction/summary.d.ts +10 -4
- package/dist/transaction/summary.d.ts.map +1 -1
- package/dist/transaction/summary.js +13 -7
- package/dist/transaction/summary.js.map +1 -1
- package/dist/transaction/updateGuardian.js +4 -1
- package/dist/transaction/updateGuardian.js.map +1 -1
- package/dist/transaction/updateProcedureThreshold.js +4 -1
- package/dist/transaction/updateProcedureThreshold.js.map +1 -1
- package/dist/transaction/updateSigners.js +4 -1
- package/dist/transaction/updateSigners.js.map +1 -1
- package/dist/transaction.d.ts +1 -1
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +1 -1
- package/dist/transaction.js.map +1 -1
- package/package.json +14 -10
- package/src/account/builder.ts +87 -35
- package/src/connectivity.ts +9 -4
- package/src/index.ts +34 -1
- package/src/multisig/authArgErrors.ts +138 -0
- package/src/multisig/helpers.ts +7 -2
- package/src/multisig.ts +513 -20
- package/src/procedures.ts +1 -1
- package/src/recovery/proposalNoteImport.ts +548 -0
- package/src/recovery/publicNoteBackfill.ts +502 -0
- package/src/recovery/recoverNotes.ts +288 -0
- package/src/recovery/transportDrain.ts +330 -0
- package/src/transaction/consumeNotes.ts +4 -1
- package/src/transaction/p2id.ts +4 -1
- package/src/transaction/summary.ts +13 -7
- package/src/transaction/updateGuardian.ts +4 -1
- package/src/transaction/updateProcedureThreshold.ts +4 -1
- package/src/transaction/updateSigners.ts +4 -1
- package/src/transaction.ts +1 -1
- package/dist/account/builder.test.d.ts +0 -2
- package/dist/account/builder.test.d.ts.map +0 -1
- package/dist/account/builder.test.js +0 -166
- package/dist/account/builder.test.js.map +0 -1
- package/dist/account/masm/account-components/auth.d.ts +0 -2
- package/dist/account/masm/account-components/auth.d.ts.map +0 -1
- package/dist/account/masm/account-components/auth.js +0 -46
- package/dist/account/masm/account-components/auth.js.map +0 -1
- package/dist/account/masm/index.d.ts +0 -2
- package/dist/account/masm/index.d.ts.map +0 -1
- package/dist/account/masm/index.js +0 -4
- package/dist/account/masm/index.js.map +0 -1
- package/dist/account/masm.d.ts +0 -2
- package/dist/account/masm.d.ts.map +0 -1
- package/dist/account/masm.js +0 -4
- package/dist/account/masm.js.map +0 -1
- package/dist/account/storage.test.d.ts +0 -2
- package/dist/account/storage.test.d.ts.map +0 -1
- package/dist/account/storage.test.js +0 -73
- package/dist/account/storage.test.js.map +0 -1
- package/dist/client.test.d.ts +0 -2
- package/dist/client.test.d.ts.map +0 -1
- package/dist/client.test.js +0 -380
- package/dist/client.test.js.map +0 -1
- package/dist/connectivity.test.d.ts +0 -2
- package/dist/connectivity.test.d.ts.map +0 -1
- package/dist/connectivity.test.js +0 -61
- package/dist/connectivity.test.js.map +0 -1
- package/dist/inspector.test.d.ts +0 -2
- package/dist/inspector.test.d.ts.map +0 -1
- package/dist/inspector.test.js +0 -425
- package/dist/inspector.test.js.map +0 -1
- package/dist/lookupAuth.test.d.ts +0 -2
- package/dist/lookupAuth.test.d.ts.map +0 -1
- package/dist/lookupAuth.test.js +0 -138
- package/dist/lookupAuth.test.js.map +0 -1
- package/dist/multisig/consumeNotesErrors.test.d.ts +0 -2
- package/dist/multisig/consumeNotesErrors.test.d.ts.map +0 -1
- package/dist/multisig/consumeNotesErrors.test.js +0 -28
- package/dist/multisig/consumeNotesErrors.test.js.map +0 -1
- package/dist/multisig/helpers.test.d.ts +0 -2
- package/dist/multisig/helpers.test.d.ts.map +0 -1
- package/dist/multisig/helpers.test.js +0 -94
- package/dist/multisig/helpers.test.js.map +0 -1
- package/dist/multisig.test.d.ts +0 -2
- package/dist/multisig.test.d.ts.map +0 -1
- package/dist/multisig.test.js +0 -4112
- package/dist/multisig.test.js.map +0 -1
- package/dist/proposal/factory.test.d.ts +0 -2
- package/dist/proposal/factory.test.d.ts.map +0 -1
- package/dist/proposal/factory.test.js +0 -32
- package/dist/proposal/factory.test.js.map +0 -1
- package/dist/proposal/metadata.test.d.ts +0 -2
- package/dist/proposal/metadata.test.d.ts.map +0 -1
- package/dist/proposal/metadata.test.js +0 -193
- package/dist/proposal/metadata.test.js.map +0 -1
- package/dist/prover/config.test.d.ts +0 -2
- package/dist/prover/config.test.d.ts.map +0 -1
- package/dist/prover/config.test.js +0 -54
- package/dist/prover/config.test.js.map +0 -1
- package/dist/prover/errors.test.d.ts +0 -2
- package/dist/prover/errors.test.d.ts.map +0 -1
- package/dist/prover/errors.test.js +0 -29
- package/dist/prover/errors.test.js.map +0 -1
- package/dist/prover/retry.test.d.ts +0 -2
- package/dist/prover/retry.test.d.ts.map +0 -1
- package/dist/prover/retry.test.js +0 -20
- package/dist/prover/retry.test.js.map +0 -1
- package/dist/prover/workflow.test.d.ts +0 -2
- package/dist/prover/workflow.test.d.ts.map +0 -1
- package/dist/prover/workflow.test.js +0 -105
- package/dist/prover/workflow.test.js.map +0 -1
- package/dist/raw-client.test.d.ts +0 -2
- package/dist/raw-client.test.d.ts.map +0 -1
- package/dist/raw-client.test.js +0 -111
- package/dist/raw-client.test.js.map +0 -1
- package/dist/rpc/config.test.d.ts +0 -2
- package/dist/rpc/config.test.d.ts.map +0 -1
- package/dist/rpc/config.test.js +0 -24
- package/dist/rpc/config.test.js.map +0 -1
- package/dist/rpc/errors.test.d.ts +0 -2
- package/dist/rpc/errors.test.d.ts.map +0 -1
- package/dist/rpc/errors.test.js +0 -34
- package/dist/rpc/errors.test.js.map +0 -1
- package/dist/rpc/retry.test.d.ts +0 -2
- package/dist/rpc/retry.test.d.ts.map +0 -1
- package/dist/rpc/retry.test.js +0 -98
- package/dist/rpc/retry.test.js.map +0 -1
- package/dist/signers/ecdsa.test.d.ts +0 -2
- package/dist/signers/ecdsa.test.d.ts.map +0 -1
- package/dist/signers/ecdsa.test.js +0 -88
- package/dist/signers/ecdsa.test.js.map +0 -1
- package/dist/signers/falcon.test.d.ts +0 -2
- package/dist/signers/falcon.test.d.ts.map +0 -1
- package/dist/signers/falcon.test.js +0 -161
- package/dist/signers/falcon.test.js.map +0 -1
- package/dist/signers/miden-wallet.ecdsa-recovery.test.d.ts +0 -2
- package/dist/signers/miden-wallet.ecdsa-recovery.test.d.ts.map +0 -1
- package/dist/signers/miden-wallet.ecdsa-recovery.test.js +0 -148
- package/dist/signers/miden-wallet.ecdsa-recovery.test.js.map +0 -1
- package/dist/signers/miden-wallet.test.d.ts +0 -2
- package/dist/signers/miden-wallet.test.d.ts.map +0 -1
- package/dist/signers/miden-wallet.test.js +0 -164
- package/dist/signers/miden-wallet.test.js.map +0 -1
- package/dist/signers/para.test.d.ts +0 -2
- package/dist/signers/para.test.d.ts.map +0 -1
- package/dist/signers/para.test.js +0 -146
- package/dist/signers/para.test.js.map +0 -1
- package/dist/transaction/index.d.ts +0 -8
- package/dist/transaction/index.d.ts.map +0 -1
- package/dist/transaction/index.js +0 -7
- package/dist/transaction/index.js.map +0 -1
- package/dist/transaction/p2id.test.d.ts +0 -2
- package/dist/transaction/p2id.test.d.ts.map +0 -1
- package/dist/transaction/p2id.test.js +0 -246
- package/dist/transaction/p2id.test.js.map +0 -1
- package/dist/transaction/rpoRandomCoin.test.d.ts +0 -2
- package/dist/transaction/rpoRandomCoin.test.d.ts.map +0 -1
- package/dist/transaction/rpoRandomCoin.test.js +0 -52
- package/dist/transaction/rpoRandomCoin.test.js.map +0 -1
- package/dist/transaction/summary.test.d.ts +0 -2
- package/dist/transaction/summary.test.d.ts.map +0 -1
- package/dist/transaction/summary.test.js +0 -26
- package/dist/transaction/summary.test.js.map +0 -1
- package/dist/transaction.test.d.ts +0 -2
- package/dist/transaction.test.d.ts.map +0 -1
- package/dist/transaction.test.js +0 -122
- package/dist/transaction.test.js.map +0 -1
- package/dist/types/proposal.test.d.ts +0 -2
- package/dist/types/proposal.test.d.ts.map +0 -1
- package/dist/types/proposal.test.js +0 -56
- package/dist/types/proposal.test.js.map +0 -1
- package/dist/utils/digest.test.d.ts +0 -2
- package/dist/utils/digest.test.d.ts.map +0 -1
- package/dist/utils/digest.test.js +0 -48
- package/dist/utils/digest.test.js.map +0 -1
- package/dist/utils/ecdsa.test.d.ts +0 -2
- package/dist/utils/ecdsa.test.d.ts.map +0 -1
- package/dist/utils/ecdsa.test.js +0 -131
- package/dist/utils/ecdsa.test.js.map +0 -1
- package/dist/utils/encoding.test.d.ts +0 -2
- package/dist/utils/encoding.test.d.ts.map +0 -1
- package/dist/utils/encoding.test.js +0 -185
- package/dist/utils/encoding.test.js.map +0 -1
- package/dist/utils/key.test.d.ts +0 -2
- package/dist/utils/key.test.d.ts.map +0 -1
- package/dist/utils/key.test.js +0 -82
- package/dist/utils/key.test.js.map +0 -1
- package/dist/utils/signature.test.d.ts +0 -2
- package/dist/utils/signature.test.d.ts.map +0 -1
- package/dist/utils/signature.test.js +0 -164
- package/dist/utils/signature.test.js.map +0 -1
- package/dist/utils/word.test.d.ts +0 -2
- package/dist/utils/word.test.d.ts.map +0 -1
- package/dist/utils/word.test.js +0 -54
- package/dist/utils/word.test.js.map +0 -1
- package/masm/account_components/auth/guarded_multisig.masm +0 -42
- package/src/account/builder.test.ts +0 -238
- package/src/account/masm/account-components/auth.ts +0 -46
- package/src/account/masm/index.ts +0 -4
- package/src/account/masm.ts +0 -4
- package/src/account/storage.test.ts +0 -90
- package/src/client.test.ts +0 -473
- package/src/connectivity.test.ts +0 -67
- package/src/inspector.test.ts +0 -542
- package/src/lookupAuth.test.ts +0 -185
- package/src/multisig/consumeNotesErrors.test.ts +0 -43
- package/src/multisig/helpers.test.ts +0 -114
- package/src/multisig.test.ts +0 -5008
- package/src/proposal/factory.test.ts +0 -40
- package/src/proposal/metadata.test.ts +0 -235
- package/src/prover/config.test.ts +0 -90
- package/src/prover/errors.test.ts +0 -61
- package/src/prover/retry.test.ts +0 -38
- package/src/prover/workflow.test.ts +0 -145
- package/src/raw-client.test.ts +0 -171
- package/src/rpc/config.test.ts +0 -45
- package/src/rpc/errors.test.ts +0 -69
- package/src/rpc/retry.test.ts +0 -144
- package/src/signers/ecdsa.test.ts +0 -111
- package/src/signers/falcon.test.ts +0 -197
- package/src/signers/miden-wallet.ecdsa-recovery.test.ts +0 -201
- package/src/signers/miden-wallet.test.ts +0 -206
- package/src/signers/para.test.ts +0 -186
- package/src/transaction/index.ts +0 -13
- package/src/transaction/p2id.test.ts +0 -371
- package/src/transaction/rpoRandomCoin.test.ts +0 -64
- package/src/transaction/summary.test.ts +0 -32
- package/src/transaction.test.ts +0 -142
- package/src/types/proposal.test.ts +0 -68
- package/src/utils/digest.test.ts +0 -55
- package/src/utils/ecdsa.test.ts +0 -164
- package/src/utils/encoding.test.ts +0 -233
- package/src/utils/key.test.ts +0 -91
- package/src/utils/signature.test.ts +0 -210
- package/src/utils/word.test.ts +0 -64
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Miden multisig accounts store their authentication logic on-chain, but **their s
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install @openzeppelin/miden-multisig-client @miden-sdk/miden-sdk@0.16.0-rc.
|
|
20
|
+
npm install @openzeppelin/miden-multisig-client @miden-sdk/miden-sdk@0.16.0-rc.7
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
> **Why the peer version is exact**: no stable `0.16.0` is published, so a
|
|
@@ -201,38 +201,6 @@ own SDK copy (common in wallets) will get a descriptive error from the SDK's
|
|
|
201
201
|
instance checks; construct the account with this package's SDK instance
|
|
202
202
|
instead.
|
|
203
203
|
|
|
204
|
-
### Recover An Account By Key
|
|
205
|
-
|
|
206
|
-
When the wallet only holds a signing key from the account's authorization
|
|
207
|
-
set, it does not yet know the account ID. `recoverByKey` queries Guardian's
|
|
208
|
-
`/state/lookup` endpoint with proof-of-possession of the key, fetches state
|
|
209
|
-
for each matching account, and returns `(accountId, state)` pairs.
|
|
210
|
-
|
|
211
|
-
```typescript
|
|
212
|
-
const recovered = await client.recoverByKey(signer);
|
|
213
|
-
|
|
214
|
-
if (recovered.length === 0) {
|
|
215
|
-
// No account on this Guardian operator authorizes the key.
|
|
216
|
-
} else {
|
|
217
|
-
for (const { accountId, state } of recovered) {
|
|
218
|
-
const multisig = await client.load(accountId, signer);
|
|
219
|
-
// ...
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
The `Signer` passed to `recoverByKey` MUST implement `signLookupMessage`
|
|
225
|
-
(the bundled `FalconSigner` and `EcdsaSigner` both do). The lookup endpoint
|
|
226
|
-
authenticates by proof-of-possession of the queried commitment — same key
|
|
227
|
-
that already authenticates per-account requests, so revealing the account ID
|
|
228
|
-
does not grant any new capability. See the design doc for the security
|
|
229
|
-
analysis.
|
|
230
|
-
|
|
231
|
-
Multiple matches are returned uniformly: a key may legitimately authorize
|
|
232
|
-
several accounts, and the helper surfaces all of them rather than silently
|
|
233
|
-
picking one. The returned list is empty (not an error) when no account
|
|
234
|
-
authorizes the queried commitment.
|
|
235
|
-
|
|
236
204
|
### Fetch Account State
|
|
237
205
|
|
|
238
206
|
```typescript
|
|
@@ -388,6 +356,37 @@ const signedJson = await multisig.signProposalOffline(imported.id);
|
|
|
388
356
|
console.log(signedJson);
|
|
389
357
|
```
|
|
390
358
|
|
|
359
|
+
### Leave an Unreachable Guardian (Offline Switch)
|
|
360
|
+
|
|
361
|
+
A switch-Guardian proposal can be created fully offline — nothing is pushed to
|
|
362
|
+
the current Guardian, so an account can leave an operator that is down
|
|
363
|
+
(mirrors the Rust `create_proposal_offline`). Only switch-Guardian proposals
|
|
364
|
+
support this: every other type needs a Guardian acknowledgment at execution.
|
|
365
|
+
The new endpoint must be reachable; its `/pubkey` commitment is verified
|
|
366
|
+
before anything is signed.
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
// Proposer: build, sign, and cache locally — the current Guardian is never contacted.
|
|
370
|
+
const exported = await multisig.createSwitchGuardianProposalOffline(
|
|
371
|
+
'https://new-guardian.example',
|
|
372
|
+
newGuardianPubkey,
|
|
373
|
+
);
|
|
374
|
+
const json = JSON.stringify(exported); // share with cosigners side-channel
|
|
375
|
+
|
|
376
|
+
// Cosigner: import, sign, send the updated JSON back.
|
|
377
|
+
const imported = await cosigner.importProposal(json);
|
|
378
|
+
const signedJson = await cosigner.signProposalOffline(imported.id);
|
|
379
|
+
|
|
380
|
+
// Proposer: import the cosigned proposal and execute. The push to the old
|
|
381
|
+
// Guardian is best-effort; registration happens on the new Guardian.
|
|
382
|
+
const ready = await multisig.importProposal(signedJson);
|
|
383
|
+
await multisig.executeProposal(ready.id);
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
For hand-rolled export/import flows, `computeCommitmentFromTxSummary` is
|
|
387
|
+
exported: a proposal's `commitment` is its transaction summary's commitment,
|
|
388
|
+
recomputed from the serialized summary.
|
|
389
|
+
|
|
391
390
|
### Custom Proposal Types
|
|
392
391
|
|
|
393
392
|
GUARDIAN accepts any non-empty `proposalType`, so an integration can propose a
|
|
@@ -433,26 +432,42 @@ const { request: finalRequest } = buildP2idTransactionRequest(
|
|
|
433
432
|
await multisig.submitTransaction(proposal.id, finalRequest);
|
|
434
433
|
```
|
|
435
434
|
|
|
435
|
+
The exported transaction builders declare the proposal salt through
|
|
436
|
+
`TransactionRequestBuilder.withFeeConversionSalt`. Miden-client derives the
|
|
437
|
+
native 1:1 conversion info from the execution reference header. Integrations
|
|
438
|
+
that build a request directly must retain the original salt and call
|
|
439
|
+
`withFeeConversionSalt(salt)` on their builder when they create and rebuild the
|
|
440
|
+
request.
|
|
441
|
+
|
|
436
442
|
The integration keeps only its own recipe (build inputs + salt) so it can
|
|
437
443
|
reproduce the exact transaction at execute time — the SDK does not store the
|
|
438
444
|
serialized request. The binding check guarantees the rebuilt transaction matches the
|
|
439
445
|
commitment the cosigners signed.
|
|
440
446
|
|
|
441
|
-
|
|
442
|
-
|
|
447
|
+
The salt cannot be recovered from the summary. Once the auth arg became the
|
|
448
|
+
commitment `hash(CONVERSION_INFO || SALT)` it stopped being invertible, so a
|
|
449
|
+
recipe that was not retained cannot be reconstructed from the signed summary —
|
|
450
|
+
keep the salt, or read it from the proposal's `saltHex` metadata, which is what
|
|
451
|
+
the SDK's own execution path does.
|
|
452
|
+
|
|
453
|
+
The summary exposes the committed auth argument for inspection:
|
|
443
454
|
|
|
444
455
|
```typescript
|
|
445
|
-
import {
|
|
456
|
+
import { summaryAuthArg } from '@openzeppelin/miden-multisig-client';
|
|
446
457
|
import { TransactionSummary } from '@miden-sdk/miden-sdk';
|
|
447
458
|
|
|
448
|
-
const
|
|
459
|
+
const signedAuthArg = summaryAuthArg(TransactionSummary.deserialize(bytes));
|
|
449
460
|
```
|
|
450
461
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
462
|
+
Do not use `signedAuthArg` as the salt when rebuilding the request.
|
|
463
|
+
`withFeeConversionSalt` would derive and commit a second value from it, and the
|
|
464
|
+
rebuilt summary would not match the summary that the cosigners signed.
|
|
465
|
+
|
|
466
|
+
On the Miden 0.16 pre-release line a summary binds seven user-defined elements,
|
|
467
|
+
and the guarded-multisig auth component zeroes the leading three and passes the
|
|
468
|
+
auth arg as the trailing four. `summaryAuthArg` reads that convention, so prefer
|
|
469
|
+
it over indexing `userParams()` by hand. It replaced `summarySalt`, whose name
|
|
470
|
+
claimed an inversion that no longer exists.
|
|
456
471
|
|
|
457
472
|
> **Rust ↔ TS parity:** both SDKs expose the same producer surface —
|
|
458
473
|
> `createCustomProposal` / `propose_custom_transaction`, `prepareCustomExecution` /
|
|
@@ -461,6 +476,116 @@ four. `summarySalt` reads that convention, so prefer it over indexing
|
|
|
461
476
|
> place (`request.advice_map_mut().extend(advice)`), while the immutable browser
|
|
462
477
|
> `TransactionRequest` is rebuilt from the recipe with the advice.
|
|
463
478
|
|
|
479
|
+
### Recover An Account By Key
|
|
480
|
+
|
|
481
|
+
When the wallet only holds a signing key from the account's authorization
|
|
482
|
+
set, it does not yet know the account ID. `recoverByKey` queries Guardian's
|
|
483
|
+
`/state/lookup` endpoint with proof-of-possession of the key, fetches state
|
|
484
|
+
for each matching account, and returns `(accountId, state)` pairs.
|
|
485
|
+
|
|
486
|
+
```typescript
|
|
487
|
+
const recovered = await client.recoverByKey(signer);
|
|
488
|
+
|
|
489
|
+
if (recovered.length === 0) {
|
|
490
|
+
// No account on this Guardian operator authorizes the key.
|
|
491
|
+
} else {
|
|
492
|
+
for (const { accountId, state } of recovered) {
|
|
493
|
+
const multisig = await client.load(accountId, signer);
|
|
494
|
+
// ...
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
The `Signer` passed to `recoverByKey` MUST implement `signLookupMessage`
|
|
500
|
+
(the bundled `FalconSigner` and `EcdsaSigner` both do). The lookup endpoint
|
|
501
|
+
authenticates by proof-of-possession of the queried commitment — same key
|
|
502
|
+
that already authenticates per-account requests, so revealing the account ID
|
|
503
|
+
does not grant any new capability. See the design doc for the security
|
|
504
|
+
analysis.
|
|
505
|
+
|
|
506
|
+
Multiple matches are returned uniformly: a key may legitimately authorize
|
|
507
|
+
several accounts, and the helper surfaces all of them rather than silently
|
|
508
|
+
picking one. The returned list is empty (not an error) when no account
|
|
509
|
+
authorizes the queried commitment.
|
|
510
|
+
|
|
511
|
+
### Recovering Notes After Device Loss
|
|
512
|
+
|
|
513
|
+
Normal forward sync cannot see notes that landed behind the store's
|
|
514
|
+
cursors. After `load()` on a recovered account, `multisig.recoverNotes()`
|
|
515
|
+
runs the three recovery strategies as one flow — the private-note transport
|
|
516
|
+
drain, the proposal-embedded note import, and the historical public-note
|
|
517
|
+
backfill — and finishes with a normal sync (transport fetch, chain sync,
|
|
518
|
+
and GUARDIAN state sync) so imported notes are verified and ready to
|
|
519
|
+
consume. The flow is the one public entry point; the strategies are
|
|
520
|
+
internal.
|
|
521
|
+
|
|
522
|
+
```typescript
|
|
523
|
+
const multisig = await client.load(accountId, signer);
|
|
524
|
+
|
|
525
|
+
const report = await multisig.recoverNotes();
|
|
526
|
+
console.log(`recovered ${report.imported} notes`);
|
|
527
|
+
for (const problem of report.problems) {
|
|
528
|
+
console.log(`step ${problem.step} did not run: ${problem.reason}`);
|
|
529
|
+
}
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
Strategies are individually selectable and the backfill's block range can be
|
|
533
|
+
bounded:
|
|
534
|
+
|
|
535
|
+
```typescript
|
|
536
|
+
// Rescan only the transport backlog and recent public history, skipping the
|
|
537
|
+
// proposal import and the final verifying sync.
|
|
538
|
+
const report = await multisig.recoverNotes({
|
|
539
|
+
proposalImport: false,
|
|
540
|
+
fromBlock: 1_690_000,
|
|
541
|
+
syncAfter: false,
|
|
542
|
+
});
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
The combined `NoteRecoveryReport` carries each strategy's own report
|
|
546
|
+
(`transport`, `proposalImport`, `backfill`) untouched; a strategy that
|
|
547
|
+
cannot run at all (GUARDIAN unreachable, chain tip unresolvable, broken
|
|
548
|
+
local store) becomes a `RecoveryStepProblem` entry instead of aborting the
|
|
549
|
+
flow, and `retryable: true` means rerunning the flow — which is idempotent —
|
|
550
|
+
can plausibly recover more. In brief:
|
|
551
|
+
|
|
552
|
+
- **Transport drain** — rescans the full private-note transport backlog for
|
|
553
|
+
every tracked tag, regardless of the stored cursor (and without ever
|
|
554
|
+
regressing it). Bounded by the transport service's retention: a
|
|
555
|
+
best-effort rescan, **not** a backup.
|
|
556
|
+
- **Proposal import** — rebuilds importable notes from the bytes v2
|
|
557
|
+
consume-notes proposals embed (validated against the proposals' declared
|
|
558
|
+
note ids) plus node-fetched inclusion proofs, so it works for private
|
|
559
|
+
notes too. Per-note `NoteImportOutcome`s; corrupt proposals and notes are
|
|
560
|
+
isolated as `invalid` outcomes instead of blocking the rest.
|
|
561
|
+
- **Public backfill** — tag-scoped historical scan (genesis to tip by
|
|
562
|
+
default) importing discovered public notes with their proofs, never
|
|
563
|
+
touching the global sync height; cost scales with matches, not range
|
|
564
|
+
length. This SDK screens discoveries statically against the well-known
|
|
565
|
+
P2ID/P2IDE scripts (custom-script notes are counted as
|
|
566
|
+
`skippedUnscreenable`), and unscannable sub-ranges are reported in
|
|
567
|
+
`uncovered` instead of failing the flow.
|
|
568
|
+
|
|
569
|
+
For the full report semantics see
|
|
570
|
+
[`docs/MULTISIG_SDK.md`](https://github.com/OpenZeppelin/guardian/blob/main/docs/MULTISIG_SDK.md).
|
|
571
|
+
|
|
572
|
+
### Preserving notes across a guardian switch
|
|
573
|
+
|
|
574
|
+
Pending proposals do not survive a guardian switch — the new GUARDIAN is
|
|
575
|
+
registered with bare account state — so the notes embedded in the old
|
|
576
|
+
GUARDIAN's pending consume-notes proposals are the one recovery source
|
|
577
|
+
`recoverNotes` can no longer reach after the repoint. `executeProposal`
|
|
578
|
+
runs the proposal-import slice automatically on the switch-guardian path
|
|
579
|
+
(against the old GUARDIAN, before the switch transaction executes),
|
|
580
|
+
best-effort and bounded by a 30s timeout with cooperative cancellation;
|
|
581
|
+
the transport drain and public backfill deliberately do not run there (an
|
|
582
|
+
intact local store loses nothing they rescan). When repointing a client by
|
|
583
|
+
hand via `setGuardianClient`, request the same preservation first:
|
|
584
|
+
|
|
585
|
+
```typescript
|
|
586
|
+
const report = await multisig.preservePreSwitchProposalNotes();
|
|
587
|
+
```
|
|
588
|
+
|
|
464
589
|
## Transaction Utilities
|
|
465
590
|
|
|
466
591
|
The package also exports utility functions for building transactions:
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This module provides functionality to create multisig accounts.
|
|
5
5
|
*/
|
|
6
|
-
import { type MidenClient } from
|
|
7
|
-
import type { MultisigConfig, CreateAccountResult } from
|
|
6
|
+
import { type MidenClient } from "@miden-sdk/miden-sdk";
|
|
7
|
+
import type { MultisigConfig, CreateAccountResult } from "../types.js";
|
|
8
8
|
/**
|
|
9
9
|
* Creates a multisig account with GUARDIAN authentication.
|
|
10
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/account/builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/account/builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAQL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAgEvE;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,cAAc,EACtB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,mBAAmB,CAAC,CAiC9B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CA2EnE"}
|
package/dist/account/builder.js
CHANGED
|
@@ -3,19 +3,43 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This module provides functionality to create multisig accounts.
|
|
5
5
|
*/
|
|
6
|
-
import { AccountBuilder,
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
import { AccountBuilder, AccountStorageMode, AuthGuardedMultisigConfig, ProcedureThreshold, Word, createAuthGuardedMultisig, } from "@miden-sdk/miden-sdk";
|
|
7
|
+
import { getProcedureRoot } from "../procedures.js";
|
|
8
|
+
import { normalizeSignerCommitment } from "../utils/signature.js";
|
|
9
|
+
/**
|
|
10
|
+
* Discriminants of the SDK's wasm `AuthScheme` enum, which `AuthGuardedMultisigConfig` takes.
|
|
11
|
+
*
|
|
12
|
+
* They are inlined rather than imported because the package root exports two different things
|
|
13
|
+
* named `AuthScheme`: the wasm enum, and a string-valued convenience const from `api-types`
|
|
14
|
+
* that is re-exported second and therefore wins. Importing the name yields the string const,
|
|
15
|
+
* whose members are `undefined` here, and the constructor rejects that as an invalid enum value.
|
|
16
|
+
* Source: `crates/web-client/src/models/auth_scheme.rs`.
|
|
17
|
+
*/
|
|
18
|
+
const AUTH_SCHEME = { ecdsa: 1, falcon: 2 };
|
|
19
|
+
/**
|
|
20
|
+
* Builds the guarded-multisig component from the upstream standard component.
|
|
21
|
+
*
|
|
22
|
+
* Compiling an equivalent MASM source ourselves would link the standards package dynamically and
|
|
23
|
+
* yield a different `auth_tx` root, which `AccountComponentInterface::from_procedures` cannot
|
|
24
|
+
* classify — the client then declines to attach fee conversion info and every transaction fails
|
|
25
|
+
* on a fee-charging chain.
|
|
26
|
+
*
|
|
27
|
+
* Per-procedure thresholds are keyed by procedure root. The roots come from the pinned table,
|
|
28
|
+
* not from the component: a `ProcedureName` is this package's own vocabulary and does not match
|
|
29
|
+
* the component's MASM export names (`update_signers` is exported as `update_signers_and_threshold`),
|
|
30
|
+
* and `send_asset`/`receive_asset` are `BasicWallet` procedures that the auth component never
|
|
31
|
+
* exports at all. `procedure_roots_match_upstream_component` pins the table to the component.
|
|
32
|
+
*/
|
|
33
|
+
function buildGuardedMultisigComponent(config) {
|
|
34
|
+
const approvers = config.signerCommitments.map((commitment) => Word.fromHex(normalizeSignerCommitment(commitment)));
|
|
35
|
+
const guardian = Word.fromHex(normalizeSignerCommitment(config.guardianCommitment));
|
|
36
|
+
const scheme = AUTH_SCHEME[config.signatureScheme === "ecdsa" ? "ecdsa" : "falcon"];
|
|
37
|
+
const baseConfig = new AuthGuardedMultisigConfig(approvers, config.threshold, guardian, scheme);
|
|
38
|
+
if (!config.procedureThresholds?.length) {
|
|
39
|
+
return createAuthGuardedMultisig(baseConfig).withSupportsAllTypes();
|
|
40
|
+
}
|
|
41
|
+
const thresholds = config.procedureThresholds.map((entry) => new ProcedureThreshold(Word.fromHex(getProcedureRoot(entry.procedure)), entry.threshold));
|
|
42
|
+
return createAuthGuardedMultisig(baseConfig.withProcThresholds(thresholds)).withSupportsAllTypes();
|
|
19
43
|
}
|
|
20
44
|
/**
|
|
21
45
|
* Creates a multisig account with GUARDIAN authentication.
|
|
@@ -27,15 +51,13 @@ function buildGuardedMultisigComponent(authBuilder, config) {
|
|
|
27
51
|
*/
|
|
28
52
|
export async function createMultisigAccount(midenClient, config, midenRpcEndpoint) {
|
|
29
53
|
validateMultisigConfig(config);
|
|
30
|
-
const
|
|
31
|
-
const authBuilder = await rawClient.createCodeBuilder();
|
|
32
|
-
const authComponent = buildGuardedMultisigComponent(authBuilder, config);
|
|
54
|
+
const authComponent = buildGuardedMultisigComponent(config);
|
|
33
55
|
let seed = config.seed;
|
|
34
56
|
// Generate random seed if not provided
|
|
35
57
|
if (!seed) {
|
|
36
58
|
seed = crypto.getRandomValues(new Uint8Array(32));
|
|
37
59
|
}
|
|
38
|
-
const storageMode = config.storageMode ===
|
|
60
|
+
const storageMode = config.storageMode === "public"
|
|
39
61
|
? AccountStorageMode.public()
|
|
40
62
|
: AccountStorageMode.private();
|
|
41
63
|
// Miden 0.15: the account-ID no longer encodes account type; visibility is set
|
|
@@ -45,7 +67,10 @@ export async function createMultisigAccount(midenClient, config, midenRpcEndpoin
|
|
|
45
67
|
.withAuthComponent(authComponent)
|
|
46
68
|
.withBasicWalletComponent();
|
|
47
69
|
const result = accountBuilder.buildWithoutSchemaCommitment();
|
|
48
|
-
await midenClient.accounts.insert({
|
|
70
|
+
await midenClient.accounts.insert({
|
|
71
|
+
account: result.account,
|
|
72
|
+
overwrite: false,
|
|
73
|
+
});
|
|
49
74
|
return {
|
|
50
75
|
account: result.account,
|
|
51
76
|
seed,
|
|
@@ -59,10 +84,10 @@ export async function createMultisigAccount(midenClient, config, midenRpcEndpoin
|
|
|
59
84
|
*/
|
|
60
85
|
export function validateMultisigConfig(config) {
|
|
61
86
|
if (config.threshold === 0) {
|
|
62
|
-
throw new Error(
|
|
87
|
+
throw new Error("threshold must be greater than 0");
|
|
63
88
|
}
|
|
64
89
|
if (config.signerCommitments.length === 0) {
|
|
65
|
-
throw new Error(
|
|
90
|
+
throw new Error("at least one signer commitment is required");
|
|
66
91
|
}
|
|
67
92
|
const signerCommitments = new Set();
|
|
68
93
|
for (const signerCommitment of config.signerCommitments) {
|
|
@@ -76,17 +101,17 @@ export function validateMultisigConfig(config) {
|
|
|
76
101
|
throw new Error(`threshold (${config.threshold}) cannot exceed number of signers (${config.signerCommitments.length})`);
|
|
77
102
|
}
|
|
78
103
|
if (!config.guardianCommitment) {
|
|
79
|
-
throw new Error(
|
|
104
|
+
throw new Error("GUARDIAN commitment is required");
|
|
80
105
|
}
|
|
81
106
|
if (signerCommitments.has(normalizeSignerCommitment(config.guardianCommitment))) {
|
|
82
|
-
throw new Error(
|
|
107
|
+
throw new Error("GUARDIAN commitment must be different from all signer commitments");
|
|
83
108
|
}
|
|
84
109
|
// Validate procedure thresholds if provided
|
|
85
110
|
if (config.procedureThresholds) {
|
|
86
111
|
const seen = new Set();
|
|
87
112
|
for (const pt of config.procedureThresholds) {
|
|
88
113
|
if (pt.threshold < 1) {
|
|
89
|
-
throw new Error(
|
|
114
|
+
throw new Error("procedure threshold must be at least 1");
|
|
90
115
|
}
|
|
91
116
|
if (pt.threshold > config.signerCommitments.length) {
|
|
92
117
|
throw new Error(`procedure threshold (${pt.threshold}) cannot exceed number of signers (${config.signerCommitments.length})`);
|
|
@@ -103,7 +128,7 @@ export function validateMultisigConfig(config) {
|
|
|
103
128
|
// a 2-of-5 with `send_asset: 4` is a 2-of-5 spend lock, not a 4-of-5 one.
|
|
104
129
|
// Mirrors `AuthMultisig::new` in miden-standards, which rejects the same
|
|
105
130
|
// shape, so Rust cannot build an account TypeScript would otherwise allow.
|
|
106
|
-
const setterOverride = config.procedureThresholds.find((pt) => pt.procedure ===
|
|
131
|
+
const setterOverride = config.procedureThresholds.find((pt) => pt.procedure === "update_procedure_threshold")?.threshold;
|
|
107
132
|
const setterThreshold = setterOverride ?? config.threshold;
|
|
108
133
|
for (const pt of config.procedureThresholds) {
|
|
109
134
|
if (pt.threshold > setterThreshold) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/account/builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/account/builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EAEd,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,IAAI,EACJ,yBAAyB,GAE1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE;;;;;;;;GAQG;AACH,MAAM,WAAW,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAW,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,SAAS,6BAA6B,CACpC,MAAsB;IAEtB,MAAM,SAAS,GAAG,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAC5D,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC,CACpD,CAAC;IACF,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAC3B,yBAAyB,CAAC,MAAM,CAAC,kBAAkB,CAAC,CACrD,CAAC;IACF,MAAM,MAAM,GACV,WAAW,CAAC,MAAM,CAAC,eAAe,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAEvE,MAAM,UAAU,GAAG,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AAM,eAAe,GAAG,cAAc,IAAI,MAAM,CAAC,SAAS,CAAC;QAE3D,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,mBAAmB,EAAE,CAAC;YAC5C,IAAI,EAAE,CAAC,SAAS,GAAG,eAAe,EAAE,CAAC;gBACnC,MAAM,IAAI,KAAK,CACb,oCAAoC,EAAE,CAAC,SAAS,KAAK,EAAE,CAAC,SAAS,gBAAgB;oBAC/E,gBAAgB,eAAe,mDAAmD;oBAClF,oFAAoF;oBACpF,wBAAwB,EAAE,CAAC,SAAS,yBAAyB,CAChE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/connectivity.d.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* be reached or did not answer with a Guardian error object.
|
|
8
8
|
*/
|
|
9
9
|
export type ConnectivityCategory = 'network' | 'unreachable' | 'timeout';
|
|
10
|
+
/** Best-effort human-readable message from an unknown thrown value. */
|
|
11
|
+
export declare function errorMessage(err: unknown): string;
|
|
10
12
|
/**
|
|
11
13
|
* Does this error look like a codeless transport/connectivity failure (vs a
|
|
12
14
|
* semantic Guardian error)? String heuristic — see module docs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectivity.d.ts","sourceRoot":"","sources":["../src/connectivity.ts"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"connectivity.d.ts","sourceRoot":"","sources":["../src/connectivity.ts"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;AAiBzE,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAIjD;AAYD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAY1D;AAED,oFAAoF;AACpF,MAAM,WAAW,eAAe;IAC9B,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAc/D"}
|
package/dist/connectivity.js
CHANGED
|
@@ -30,12 +30,16 @@ function isDefinitelyOffline() {
|
|
|
30
30
|
return false;
|
|
31
31
|
return navigator.onLine === false;
|
|
32
32
|
}
|
|
33
|
+
/** Best-effort human-readable message from an unknown thrown value. */
|
|
34
|
+
export function errorMessage(err) {
|
|
35
|
+
const message = typeof err === 'object' && err !== null && 'message' in err ? err.message : undefined;
|
|
36
|
+
return typeof message === 'string' ? message : String(message ?? err ?? '');
|
|
37
|
+
}
|
|
33
38
|
/** Classify a codeless transport failure into a {@link ConnectivityCategory}. */
|
|
34
39
|
function classifyTransportError(err) {
|
|
35
40
|
if (isDefinitelyOffline())
|
|
36
41
|
return 'network';
|
|
37
|
-
const
|
|
38
|
-
const lower = message.toLowerCase();
|
|
42
|
+
const lower = errorMessage(err).toLowerCase();
|
|
39
43
|
if (lower.includes('timeout') || lower.includes('timed out') || lower.includes('abort')) {
|
|
40
44
|
return 'timeout';
|
|
41
45
|
}
|
|
@@ -46,8 +50,7 @@ function classifyTransportError(err) {
|
|
|
46
50
|
* semantic Guardian error)? String heuristic — see module docs.
|
|
47
51
|
*/
|
|
48
52
|
export function isLikelyNetworkError(err) {
|
|
49
|
-
const
|
|
50
|
-
const lower = message.toLowerCase();
|
|
53
|
+
const lower = errorMessage(err).toLowerCase();
|
|
51
54
|
if (lower.includes('failed to fetch'))
|
|
52
55
|
return true;
|
|
53
56
|
if (lower.includes('networkerror'))
|
package/dist/connectivity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectivity.js","sourceRoot":"","sources":["../src/connectivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAYlE,MAAM,oBAAoB,GAAG,sEAAsE,CAAC;AACpG,MAAM,eAAe,GAAG,yCAAyC,CAAC;AAElE;;;;;GAKG;AACH,SAAS,mBAAmB;IAC1B,IAAI,OAAO,SAAS,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IACnD,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACxD,OAAO,SAAS,CAAC,MAAM,KAAK,KAAK,CAAC;AACpC,CAAC;AAED,
|
|
1
|
+
{"version":3,"file":"connectivity.js","sourceRoot":"","sources":["../src/connectivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAYlE,MAAM,oBAAoB,GAAG,sEAAsE,CAAC;AACpG,MAAM,eAAe,GAAG,yCAAyC,CAAC;AAElE;;;;;GAKG;AACH,SAAS,mBAAmB;IAC1B,IAAI,OAAO,SAAS,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IACnD,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACxD,OAAO,SAAS,CAAC,MAAM,KAAK,KAAK,CAAC;AACpC,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,MAAM,OAAO,GACX,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACxF,OAAO,OAAO,OAAO,KAAK,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,cAAc,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/E,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO,KAAK,CAAC;AACf,CAAC;AAcD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC5C,IAAI,GAAG,YAAY,iBAAiB,EAAE,CAAC;QACrC,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;YAChC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QACtE,CAAC;QACD,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;YACtB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,oBAAoB,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QACpF,CAAC;QACD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IACtD,CAAC;IACD,IAAI,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,QAAQ,EAAE,sBAAsB,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IAClG,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AACtD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -44,12 +44,15 @@
|
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
export { MultisigClient, type MultisigClientConfig, type RecoveredAccount, } from './client.js';
|
|
47
|
+
export type { TransportRecoveryReport, TransportRecoveryStatus, } from './recovery/transportDrain.js';
|
|
47
48
|
export type { ProverConfig, ProverRetryPolicy } from './prover/config.js';
|
|
48
49
|
export type { RpcConfig, RpcRetryPolicy } from './rpc/config.js';
|
|
49
50
|
export { lookupAuthDigest } from './lookupAuth.js';
|
|
50
51
|
export { Multisig, type AccountState, type CreateProposalOptions, type CreateSignerProposalOptions, type CreateP2idProposalOptions, } from './multisig.js';
|
|
51
52
|
export { AccountInspector, type DetectedMultisigConfig, type VaultBalance } from './inspector.js';
|
|
52
|
-
export { chainAnchorFromBase64, chainAnchorToBase64, executeForSummary, executeForSummaryAt,
|
|
53
|
+
export { chainAnchorFromBase64, chainAnchorToBase64, executeForSummary, executeForSummaryAt, summaryAuthArg, buildUpdateSignersTransactionRequest, buildUpdateProcedureThresholdTransactionRequest, buildUpdateGuardianTransactionRequest, buildConsumeNotesTransactionRequest, buildP2idTransactionRequest, parseP2idNoteType, p2idNoteTypeToMetadata, type P2idTransactionOptions, type P2ideHeightOptions, } from './transaction.js';
|
|
54
|
+
export { computeCommitmentFromTxSummary } from './multisig/helpers.js';
|
|
55
|
+
export type { SignatureOptions } from './transaction/options.js';
|
|
53
56
|
export { GuardianHttpClient, GuardianHttpError } from '@openzeppelin/guardian-client';
|
|
54
57
|
export type { GuardianErrorMeta } from '@openzeppelin/guardian-client';
|
|
55
58
|
export { GUARDIAN_ERROR_CODES, isGuardianErrorCode, normalizeGuardianErrorCode, } from '@openzeppelin/guardian-client';
|
|
@@ -57,6 +60,9 @@ export type { GuardianErrorCode } from '@openzeppelin/guardian-client';
|
|
|
57
60
|
export type { HistoryDecodeSection, HistoryDecodeWarning, HistoryEntry, HistoryEntryStatus, HistoryNote, HistoryNoteAsset, HistoryNoteTag, HistoryNoteVisibility, HistoryOptions, HistoryPage, } from '@openzeppelin/guardian-client';
|
|
58
61
|
export { isLikelyNetworkError, toUserFacingError } from './connectivity.js';
|
|
59
62
|
export type { ConnectivityCategory, UserFacingError } from './connectivity.js';
|
|
63
|
+
export type { NoteImportOutcome, NoteImportSource, NoteImportStatus, } from './recovery/proposalNoteImport.js';
|
|
64
|
+
export type { BlockRange, PublicBackfillReport } from './recovery/publicNoteBackfill.js';
|
|
65
|
+
export type { NoteRecoveryReport, RecoverNotesOptions, RecoveryStep, RecoveryStepProblem, } from './recovery/recoverNotes.js';
|
|
60
66
|
export { FalconSigner, EcdsaSigner, ParaSigner, MidenWalletSigner, type ParaSigningContext, type WalletSigningContext, } from './signer.js';
|
|
61
67
|
export { PublicKeyFormat } from './utils/key.js';
|
|
62
68
|
export { EcdsaFormat } from './utils/ecdsa.js';
|
|
@@ -65,6 +71,7 @@ export { createMultisigAccount, validateMultisigConfig, buildMultisigStorageSlot
|
|
|
65
71
|
export { CONSUME_NOTES_METADATA_VERSION_V2, MAX_CONSUME_NOTES_METADATA_BYTES, isConsumeNotesV1, isConsumeNotesV2, isP2idNoteVisibility, type P2idNoteVisibility, MAX_P2IDE_BLOCK_HEIGHT, parseP2ideHeight, } from './types/proposal.js';
|
|
66
72
|
export { LEGACY_CONSUME_NOTES_ENABLED, } from './multisig/config.js';
|
|
67
73
|
export { type ConsumeNotesErrorCode, NoteBindingMismatchError, UnsupportedMetadataVersionError, ConsumeNotesMetadataOversizeError, LegacyConsumeNotesNoteMissingError, } from './multisig/consumeNotesErrors.js';
|
|
74
|
+
export { type AuthArgErrorCode, ProposalAuthArgUnresolvableError, ProposalSaltMalformedError, } from './multisig/authArgErrors.js';
|
|
68
75
|
export { noteToBase64, noteFromBase64, } from './utils/encoding.js';
|
|
69
76
|
export { PROCEDURE_ROOTS, getProcedureRoot, isProcedureName, getProcedureNames, type ProcedureName, } from './procedures.js';
|
|
70
77
|
export type { MultisigAccountState, MultisigConfig, CreateAccountResult, ProcedureThreshold, Proposal, ProposalStatus, ProposalSignatureEntry, ProposalMetadata, ProposalType, ExportedProposal, ExportedTransactionProposal, SignTransactionProposalParams, TransactionProposal, TransactionProposalSignature, TransactionProposalStatus, TransactionType, ConsumableNote, NoteAsset, FalconSignature, Signer, SignatureScheme, AuthConfig, DeltaObject, DeltaStatus, StateObject, CosignerSignature, ConfigureRequest, ConfigureResponse, DeltaProposalRequest, DeltaProposalResponse, ProposalsResponse, PubkeyResponse, SignProposalRequest, } from './types.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACL,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,GAC/B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,YAAY,EAAE,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,CAAC;AAEzB,YAAY,EAEV,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAGlB,QAAQ,EACR,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAC3B,6BAA6B,EAC7B,mBAAmB,EACnB,4BAA4B,EAC5B,yBAAyB,EAGzB,eAAe,EAGf,cAAc,EACd,SAAS,EAGT,eAAe,EACf,MAAM,EACN,eAAe,EAGf,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,iBAAiB,EAGjB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -47,7 +47,12 @@ export { MultisigClient, } from './client.js';
|
|
|
47
47
|
export { lookupAuthDigest } from './lookupAuth.js';
|
|
48
48
|
export { Multisig, } from './multisig.js';
|
|
49
49
|
export { AccountInspector } from './inspector.js';
|
|
50
|
-
export { chainAnchorFromBase64, chainAnchorToBase64, executeForSummary, executeForSummaryAt,
|
|
50
|
+
export { chainAnchorFromBase64, chainAnchorToBase64, executeForSummary, executeForSummaryAt, summaryAuthArg, buildUpdateSignersTransactionRequest, buildUpdateProcedureThresholdTransactionRequest, buildUpdateGuardianTransactionRequest, buildConsumeNotesTransactionRequest, buildP2idTransactionRequest, parseP2idNoteType, p2idNoteTypeToMetadata, } from './transaction.js';
|
|
51
|
+
// Commitment derivation for hand-rolled export/import flows (issue #433):
|
|
52
|
+
// the proposal id is the tx summary's commitment, recomputed from the
|
|
53
|
+
// serialized summary exactly as import verification does. Returns normalized
|
|
54
|
+
// hex, directly comparable to `ExportedProposal.commitment` / `Proposal.id`.
|
|
55
|
+
export { computeCommitmentFromTxSummary } from './multisig/helpers.js';
|
|
51
56
|
export { GuardianHttpClient, GuardianHttpError } from '@openzeppelin/guardian-client';
|
|
52
57
|
// Typed error-code vocabulary (issue #318): branch on GuardianErrorCode,
|
|
53
58
|
// never on message text; unknown wire codes surface via rawCode.
|
|
@@ -62,6 +67,7 @@ export { createMultisigAccount, validateMultisigConfig, buildMultisigStorageSlot
|
|
|
62
67
|
export { CONSUME_NOTES_METADATA_VERSION_V2, MAX_CONSUME_NOTES_METADATA_BYTES, isConsumeNotesV1, isConsumeNotesV2, isP2idNoteVisibility, MAX_P2IDE_BLOCK_HEIGHT, parseP2ideHeight, } from './types/proposal.js';
|
|
63
68
|
export { LEGACY_CONSUME_NOTES_ENABLED, } from './multisig/config.js';
|
|
64
69
|
export { NoteBindingMismatchError, UnsupportedMetadataVersionError, ConsumeNotesMetadataOversizeError, LegacyConsumeNotesNoteMissingError, } from './multisig/consumeNotesErrors.js';
|
|
70
|
+
export { ProposalAuthArgUnresolvableError, ProposalSaltMalformedError, } from './multisig/authArgErrors.js';
|
|
65
71
|
export { noteToBase64, noteFromBase64, } from './utils/encoding.js';
|
|
66
72
|
export { PROCEDURE_ROOTS, getProcedureRoot, isProcedureName, getProcedureNames, } from './procedures.js';
|
|
67
73
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EACL,cAAc,GAGf,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EACL,cAAc,GAGf,MAAM,aAAa,CAAC;AAOrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACL,QAAQ,GAKT,MAAM,eAAe,CAAC;AACvB,OAAO,EAA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AC/B,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAEL,gCAAgC,EAChC,0BAA0B,GAC3B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,YAAY,EACZ,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAElB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Stable error identifiers for auth-arg recovery failures. */
|
|
2
|
+
export type AuthArgErrorCode = 'proposal_auth_arg_unresolvable' | 'proposal_salt_malformed' | 'fee_faucet_anchor_mismatch';
|
|
3
|
+
/**
|
|
4
|
+
* A proposal's recorded salt is not a readable 32-byte word, so no rebuild can
|
|
5
|
+
* use it.
|
|
6
|
+
*
|
|
7
|
+
* Coded for the same reason as {@link ProposalAuthArgUnresolvableError}, and
|
|
8
|
+
* recoverable in the same one place: a `switch_guardian`'s salt is served by the
|
|
9
|
+
* GUARDIAN being switched away from, which can make it unreadable as easily as
|
|
10
|
+
* it can make it wrong. Treating only the latter as recoverable would leave that
|
|
11
|
+
* GUARDIAN able to strand a fully signed switch.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ProposalSaltMalformedError extends Error {
|
|
14
|
+
readonly code: AuthArgErrorCode;
|
|
15
|
+
readonly proposalId: string;
|
|
16
|
+
/**
|
|
17
|
+
* Exactly what GUARDIAN served, so not necessarily a string and not
|
|
18
|
+
* necessarily bounded. Non-enumerable, because the default logging paths
|
|
19
|
+
* (`util.inspect`, `JSON.stringify`) would otherwise re-expose the unbounded
|
|
20
|
+
* value the message deliberately truncates. The message quotes it already.
|
|
21
|
+
*/
|
|
22
|
+
readonly saltHex: unknown;
|
|
23
|
+
constructor(details: {
|
|
24
|
+
proposalId: string;
|
|
25
|
+
saltHex: unknown;
|
|
26
|
+
reason: string;
|
|
27
|
+
cause?: unknown;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A proposal's signed auth arg is not the fee-conversion commitment its recorded
|
|
32
|
+
* salt and anchored fee faucet derive, so no reconstruction from that salt
|
|
33
|
+
* succeeds. Raised before the rebuild, so the proposal fails on the value that is
|
|
34
|
+
* actually wrong rather than on an `ERR_FEE_CONVERSION_INFO_MISSING` abort at
|
|
35
|
+
* proving.
|
|
36
|
+
*
|
|
37
|
+
* `switch_guardian` is the exception, and deliberately so: it rebuilds from the
|
|
38
|
+
* summary's own auth arg, which reproduces the signed word but not the fee
|
|
39
|
+
* preimage behind it, so it executes only on a zero-fee chain.
|
|
40
|
+
*
|
|
41
|
+
* Coded because one caller acts on it rather than reporting it:
|
|
42
|
+
* `switch_guardian` recovery falls back to the summary's own auth arg when it
|
|
43
|
+
* sees this or {@link ProposalSaltMalformedError}, and must not extend that
|
|
44
|
+
* treatment to an unreadable anchor or a WASM failure.
|
|
45
|
+
*/
|
|
46
|
+
export declare class ProposalAuthArgUnresolvableError extends Error {
|
|
47
|
+
readonly code: AuthArgErrorCode;
|
|
48
|
+
readonly proposalId: string;
|
|
49
|
+
readonly signedAuthArgHex: string;
|
|
50
|
+
readonly saltHex: string;
|
|
51
|
+
readonly feeFaucetIdHex: string;
|
|
52
|
+
constructor(details: {
|
|
53
|
+
proposalId: string;
|
|
54
|
+
signedAuthArgHex: string;
|
|
55
|
+
saltHex: string;
|
|
56
|
+
feeFaucetIdHex: string;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=authArgErrors.d.ts.map
|