WDK logoWDK documentation

WDK Utils

Chain-aware address validation, mnemonic sharing, seed encryption, deterministic key derivation, and payment-request helpers for @tetherto/wdk-utils

WDK Utils provides CAIP-2-aware and chain-specific validation helpers for Bitcoin, EVM, Lightning, Solana, Spark, Tron, and UMA identifiers, Shamir-based mnemonic sharing, passphrase-based seed encryption, deterministic HKDF-SHA256 and Ed25519 key derivation, BIP-21 Bitcoin payment URI helpers, BOLT11 invoice helpers, and EIP-681 request parsing for token transfer deep links. Powered by @tetherto/wdk-utils.

Features

  • Chain-aware address validation: Dispatch to Bitcoin, EVM, Solana, Spark, or Tron validation with a CAIP-2 chain ID, including network checks for Bitcoin and Spark.
  • Address validation helpers: Validate Bitcoin, EVM, Lightning invoice, LNURL, Lightning address, Solana, Spark, Tron, and UMA inputs before you hand them to a wallet flow.
  • Mnemonic sharing helpers: Split an English BIP-39 mnemonic into threshold-based Shamir shares and combine enough shares to recover it.
  • BIP-21 payment URI helpers: Detect, parse, and encode bitcoin: payment URIs with optional amount, label, and message fields.
  • Seed encryption helpers: Encrypt and decrypt seed phrases or other strings with AES-256-GCM and scrypt-derived keys.
  • Seed key derivation: Derive domain-separated byte keys or deterministic Ed25519 keypairs from high-entropy seed bytes.
  • Lightning payment parsing: Decode LNURL strings and BOLT11 invoices before you display or route payment details.
  • BOLT11 invoice helpers: Validate, decode, hash, sign, and encode BOLT11 invoices for Bitcoin, testnet, regtest, and signet flows.
  • EIP-681 request parsing: Detect request-shaped EIP-681 strings and parse transfer payloads into recipient, tokenAddress, chainId, and amountSmallest.
  • No runtime setup: Import the functions you need. The package has no constructor or runtime configuration.
  • TypeScript support: The published package ships typed exports for every validator and parser.
  • Bare runtime export: The package publishes a bare entrypoint in addition to the default module entrypoint.

Why this matters

  • Validate user input early, optionally against its CAIP-2 chain, and return machine-readable failure reasons before you attempt a transaction or resolution flow.
  • Split a mnemonic across separate storage or recovery locations without making every share sufficient on its own.
  • Pair these helpers with the P2P Address Book when a wallet stores user-selected destinations for later use.
  • Protect seed phrases or other local strings with passphrase-based encryption before storing them in app-managed persistence.
  • Derive separate application keys from one high-entropy seed without reusing the same key material across purposes.
  • Parse and encode BIP-21 Bitcoin payment links before pre-filling send forms.
  • Inspect BOLT11 invoice metadata, fallback addresses, routing information, and feature bits before presenting payment details.
  • Normalize EIP-681 payment links into structured transfer data that wallet UIs can inspect before execution.
  • Reuse the same helpers across Node.js and Bare-based environments without adding a larger wallet module dependency.

Need Help?

On this page