@piplabs/cdr-crypto
v0.2.1
Published
Cryptographic primitives for the CDR (Confidential Data Rails) protocol on Story L1: TDH2 threshold encryption (via WASM), ECIES partial decryption, validator partial-signature verification, and file encryption.
Downloads
1,518
Keywords
Readme
@piplabs/cdr-crypto
Cryptographic primitives for the CDR (Confidential Data Rails) protocol on Story L1: TDH2 threshold encryption (via WASM), ECIES partial decryption, validator partial-signature verification, and file encryption.
This package is a building block for @piplabs/cdr-sdk. Most users should install the SDK instead — it re-exports everything from this package.
Install
npm install @piplabs/cdr-cryptoExports
tdh2Encrypt,tdh2Verify,tdh2Combine,tdh2ExtractLabel— TDH2 threshold encryption (implementation in WASM)decryptPartial,generateEphemeralKeyPair— ECIES helpers used to receive partial decryptionsverifyPartialSignature— secp256k1 ECDSA verification of a validator's partial-decryption signature (RLP encode the response fields, keccak256, recover, address compare againstcommPubKey)encryptFile,decryptFile— AES-256-GCM single-pass file encryption (Uint8Arrayin /Uint8Arrayout, ciphertext format:IV || encrypted || GCM tag)initWasm,resetWasm,getWasm,setWasmForTesting,CURVE_ED25519— WASM module lifecycle (must callinitWasm()once before any TDH2 op)
WASM bundle
The TDH2 implementation is compiled to cb-mpc-tdh2.wasm shipped in dist/wasm/. Bundlers must be able to copy or fetch this file at runtime.
License
MIT — see LICENSE.
