|
12 | 12 | * never decides authorization. It only reshapes evidence the caller already |
13 | 13 | * has, sorts it deterministically and digests it so a tamper is visible. |
14 | 14 | * VERIFIED ≠ SAFE. |
| 15 | + * |
| 16 | + * Snapshot fields (all caller-supplied): |
| 17 | + * network "testnet" | "mainnet" | "futurenet" |
| 18 | + * accountId string, required |
| 19 | + * masterWeight non-negative integer; 0 means the master key is disabled |
| 20 | + * thresholds { low, medium, high }, non-negative integers, |
| 21 | + * low <= medium <= high and high > 0 |
| 22 | + * signers[] non-empty; each { key | publicKey | address, |
| 23 | + * kind? (defaults to ed25519), weight } |
| 24 | + * presentedSigners[] optional; each { key | publicKey | address, weight? }, |
| 25 | + * defaults to the full signer set with its weights. |
| 26 | + * An unknown key is a refusal, never a silent drop. |
| 27 | + * soroban optional; { entry { contractId, functionName, |
| 28 | + * argsDigest, signatureExpirationLedger, |
| 29 | + * rootInvocation?, subInvocations? }, |
| 30 | + * expected { contractId, functionName, argsDigest }, |
| 31 | + * currentLedger, allowedContracts? } |
| 32 | + * options.level optional "low" | "medium" | "high" (default: high) |
| 33 | + * |
| 34 | + * Result: { ok: true, spec, boundary, network, accountId, snapshotDigest, |
| 35 | + * inputs: { signers, thresholds, sorobanAuth }, toolCalls[] } |
| 36 | + * snapshotDigest covers network, account, the presented set and soroban, so a |
| 37 | + * changed weight, signer kind, presented weight or expiration ledger changes it. |
| 38 | + * toolCalls holds 2 entries, or 3 when `soroban` is supplied. |
| 39 | + * |
| 40 | + * Refusal codes (returned as { ok: false, spec, error: { code, detail, field? } }, |
| 41 | + * with no toolCalls produced): |
| 42 | + * INVALID_SNAPSHOT snapshot is not an object |
| 43 | + * UNSUPPORTED_NETWORK network is not testnet/mainnet/futurenet |
| 44 | + * MISSING_ACCOUNT_ID accountId is empty |
| 45 | + * INVALID_MASTER_WEIGHT masterWeight is not a non-negative integer |
| 46 | + * INVALID_THRESHOLDS a threshold is not a non-negative integer |
| 47 | + * THRESHOLD_ORDER thresholds violate low <= medium <= high, or high <= 0 |
| 48 | + * NO_SIGNERS signers is missing or empty |
| 49 | + * INVALID_SIGNER a signers[] entry is not an object |
| 50 | + * MISSING_SIGNER_KEY a signer has no key/publicKey/address |
| 51 | + * INVALID_WEIGHT a weight is not a non-negative integer |
| 52 | + * DUPLICATE_SIGNER the same key appears twice |
| 53 | + * INVALID_PRESENTED_SIGNERS presentedSigners is not an array |
| 54 | + * INVALID_PRESENTED_SIGNER a presentedSigners[] entry is not an object |
| 55 | + * UNKNOWN_PRESENTED_SIGNER a presented key is absent from the signer set |
| 56 | + * INVALID_LEVEL level is not low/medium/high |
| 57 | + * INVALID_SOROBAN soroban is present but not an object |
| 58 | + * SOROBAN_ENTRY_MISSING soroban.entry is missing |
| 59 | + * SOROBAN_EXPECTED_MISSING soroban.expected is missing |
| 60 | + * CURRENT_LEDGER_MISSING soroban.currentLedger is not a non-negative integer |
15 | 61 | */ |
16 | 62 |
|
17 | 63 | import { canonicalJson, digestOf } from "./wave6.mjs"; |
|
0 commit comments