bam-sdk test app
Surfaces every browser-safe export of the bam-sdk package as a poke-the-button playground. Demo data is prefilled so each function is one click from a result.
Protocol version 0.1 · entrypoint bam-sdk/browser
Hex Helpers
hexToBytes / bytesToHex — strict (throws on odd length / non-hex chars).
Message Primitives
computeMessageHash / computeMessageId (ERC-8180). `contents` is an opaque app body; `contentTag` is supplied separately and bound into the hash.
ECDSA — Scheme 0x01 (EIP-712 over BAMMessage)
Headless: generateECDSAPrivateKey, signECDSAWithKey, verifyECDSA. Wallet: signECDSA against an injected viem WalletClient.
No injected wallet detected. Install MetaMask / Rabby / similar to enable this path.
Verifies against (no sender) on chain 11155111. Routing follows the path that produced the current signature (manual / headless fallback); editing the box by hand falls back to the headless inputs.
BLS — Scheme 0x02 building blocks
generateBLSPrivateKey / deriveBLSPublicKey / signBLS / verifyBLS / aggregateBLS / verifyAggregateBLS
Note: BLS sign/verify are async. Hex helpers reachable via bytesToHex/hexToBytes (used internally: 0xaaaaaaaaaaaaaaaa…).
Batch Codec
encodeBatch / decodeBatch / estimateBatchSize. Each line below becomes a message; a fresh ECDSA key signs it.
Exposure Batch
buildRawMessageBytes / encodeExposureBatch / decodeExposureBatch — on-chain raw layout for KZG-verifiable exposure.
BPE Codec
buildBPEDictionary / serializeBPEDictionary / bpeEncode / bpeDecode — pure-TS 12-bit byte-pair encoder.
roundtrip helper: hexToBytes reachable for manual testing.1
BPE Batch Codec
encodeBatchBPE / decodeBatchBPE — wire format read by the on-chain BPEDecoder. Pick a dictionary source (built locally, bundled v1, or fetched from the deployed Sepolia BPEDictionary), then encode and optionally decode via eth_call on the matching deployed decoder.
Compression (Zstd)
decompress / isCompressed / getDecompressedSize / compressionRatio. Compression itself is Node-only in the SDK today; decompress runs in the browser via fzstd.