verify library

Subpath library: package:era_connect/verify.dart.

"Did the device sign exactly what I sent?" — run these between parsing a reply and broadcasting it. Kept out of the root library's hot path so the curve arithmetic is only linked by apps that import it (do).

Every type an argument object DECLARES is exported here, so an app that imports this library alone can name the values it hands the verifiers and catch what the parsers throw.

Classes

CardanoWitness
One [vkey, signature] pair from the reply's witness set.
DecodedBchInput
One decoded input of a legacy-serialized transaction.
DecodedBchOutput
One decoded output of a legacy-serialized transaction.
DecodedBchTx
A decoded legacy-serialized Bitcoin Cash transaction.
EvmDataType
eth-sign-request dataType (CBOR key 3).
Failed
The check ran and failed.
ParsedPsbt
A structurally parsed PSBT v0.
PsbtInputType
PSBT per-input key types the verification guard cares about.
PsbtKeyValue
One key/value entry of a PSBT map.
SignedTronTx
The two halves of a signed Tron network Transaction frame.
TonDataType
ton-sign-request dataType (CBOR key 3).
TronLatestBlock
A live now-block anchor for a Tron transaction.
Unverifiable
Nothing client-side is verifiable for this input (EIP-712 typed data: the digest is the hash of the structure, which only the device computes). The UR-type pin and the request-id echo are the whole binding.
Verified
Verified cryptographically / byte-for-byte.
VerifyBchInput
One request input, as named to the device.
VerifyBchOutput
One request output, as named to the device.
VerifyBchSignedTxArgs
Inputs for verifyBchSignedTx.
VerifyBtcMessageHeaderArgs
Inputs for verifyBtcMessageHeader.
VerifyCardanoAccount
The linked account's key material, from accounts.cardano(): the account xpub halves and its path.
VerifyCardanoSignatureArgs
Inputs for verifyCardanoSignature.
VerifyCosmosSignatureArgs
Args for verifyCosmosSignature.
VerifyEvmSignatureArgs
Arguments for verifyEvmSignature.
VerifyResult
Outcome of a verification helper. Helpers return, never throw, on mismatches.
VerifySignedPsbtArgs
Inputs for verifySignedPsbt.
VerifySolanaSignatureArgs
Inputs for verifySolanaSignature.
VerifySuiSignatureArgs
Inputs for verifySuiSignature.
VerifyTonSignatureArgs
Arguments for verifyTonSignature.
VerifyTronSignatureArgs
Inputs for verifyTronSignature.
VerifyXrpSignatureArgs
Inputs for verifyXrpSignature.

Enums

CosmosDigest
Digest family for verifyCosmosSignature: vanilla Cosmos zones hash with sha256; Ethermint chains (Injective, Evmos, Dymension) with keccak256.

Constants

verified → const VerifyResult
Verified cryptographically / byte-for-byte.

Functions

bocRootHash(Uint8List boc) Uint8List
Representation hash of the ROOT cell of a BoC — the bytes TON signs.
computeBchSighash({required DecodedBchTx tx, required int inputIndex, required Uint8List scriptCode, required BigInt value, int? hashType}) Uint8List
BIP-143 sighash preimage with FORKID, exactly as consensus defines it: version ‖ hashPrevouts ‖ hashSequence ‖ outpoint ‖ scriptCode ‖ value ‖ sequence ‖ hashOutputs ‖ locktime ‖ hashType(LE), double-SHA256d.
decodeBchRawTx(String rawTxHex) DecodedBchTx
Hardened reader for the legacy (non-witness) transaction serialization.
failed(String reason) VerifyResult
The check ran and failed.
parsePsbt(Uint8List bytes) ParsedPsbt
Parse bytes as a PSBT v0, refusing anything structurally off.
unverifiable(String reason) VerifyResult
Nothing client-side is verifiable for this input.
verifyBchSignedTx(VerifyBchSignedTxArgs args) VerifyResult
Verify a signed BCH transaction against the request that asked for it.
verifyBtcMessageHeader(VerifyBtcMessageHeaderArgs args) VerifyResult
BIP-137: the recovery header names the address type a verifier derives before comparing. A header of the wrong range produces a signature that LOOKS fine (65 bytes, valid base64) but fails every verifier downstream — this check is the only place that difference is visible.
verifyCardanoSignature(VerifyCardanoSignatureArgs args) VerifyResult
Recompute the digest the device signs — BLAKE2b-256 of the ENCODED FIRST ELEMENT of the transaction CBOR array (the tx body) — and verify every [vkey, signature] pair against it. With account + signerPaths, the vkeys are additionally required to be exactly the soft-derived children of YOUR linked account at the request's own paths.
verifyCosmosSignature(VerifyCosmosSignatureArgs args) VerifyResult
Verify a Cosmos/Ethermint reply signature against the SignDoc bytes.
verifyEvmSignature(VerifyEvmSignatureArgs args) VerifyResult
"Did the device sign exactly what I sent, with the key I expected?" keccak digest + public-key recovery; the recovered address must equal the request's. Run it before broadcasting.
verifySignedPsbt(VerifySignedPsbtArgs args) VerifyResult
The crypto-psbt reply carries NO request id — this comparison IS the anti-replay binding for Bitcoin. It is not optional.
verifySolanaSignature(VerifySolanaSignatureArgs args) VerifyResult
Check a sol-signature against the request it answers.
verifySuiSignature(VerifySuiSignatureArgs args) VerifyResult
BLAKE2b-256 of the intent message (or the given hash) + Ed25519 verification.
verifyTonSignature(VerifyTonSignatureArgs args) VerifyResult
Recompute the exact digest the device signs — the BoC ROOT CELL's representation hash for a transaction, or the TON Connect proof digest sha256(0xFFFF || "ton-connect" || sha256(payload)) — and verify the Ed25519 signature against the linked key.
verifyTronSignature(VerifyTronSignatureArgs args) VerifyResult
The Tron reply is a fully signed transaction broadcast VERBATIM, so it is checked on both counts: every signature must recover to the owner address, and the transaction must move what the user approved.
verifyXrpSignature(VerifyXrpSignatureArgs args) VerifyResult
XRP has no request id — this check IS the binding. The signed binary is split into its canonical fields; TxnSignature is removed; the remainder (prefixed with the XRPL signing tag STX\0) is hashed with SHA-512-half and the DER signature is verified against SigningPubKey, which must also equal the key your request carried.

Exceptions / Errors

EraSdkError
Every error thrown by this SDK.