Try it Live
Run Signature examples in the interactive playground
WASM
WebAssembly bindings for signature operations.Overview
Signature primitive is pure TypeScript without WASM bindings. Cryptographic operations (signing, verification, key recovery) are handled by the crypto module, which provides both native and WASM implementations.Architecture
Signature Primitive (TypeScript)
The Signature primitive provides:- Type definitions (BrandedSignature)
- Format conversions (compact, DER)
- Validation (canonicality checking)
- Component extraction (getR, getS, getV)
src/primitives/Signature/
No WASM: Signature manipulation doesn’t require WASM
Crypto Module (Zig + WASM)
Cryptographic operations provided by crypto module:- Signing (secp256k1, P-256, Ed25519)
- Verification
- Public key recovery
- Key generation
src/crypto/
WASM Available: Yes (via crypto module)
Usage Pattern
Why No WASM for Signature?
Signature Operations Are Fast
Signature primitive operations are simple byte manipulations:WASM Shines for Crypto Operations
Performance Comparison
Signature Primitive (TypeScript)
| Operation | TypeScript | WASM (hypothetical) | Winner |
|---|---|---|---|
| fromSecp256k1 | 0.001ms | 0.005ms (call overhead) | TypeScript |
| normalize | 0.005ms | 0.010ms (call overhead) | TypeScript |
| toDER | 0.010ms | 0.015ms (call overhead) | TypeScript |
| isCanonical | 0.001ms | 0.005ms (call overhead) | TypeScript |
Crypto Operations (via crypto module)
| Operation | TypeScript | WASM | Winner |
|---|---|---|---|
| sign | 0.5ms | 0.1ms | WASM (5x) |
| verify | 1.0ms | 0.15ms | WASM (6.7x) |
| recover | 1.5ms | 0.12ms | WASM (12.5x) |
Integration with Crypto Module
Signing (WASM)
Verification (WASM)
Recovery (WASM)
Complete Example
End-to-End Signature Flow
Crypto Module WASM API
secp256k1 WASM
P-256 WASM
Ed25519 WASM
Build Configuration
Crypto Module WASM Build
Tree-Shaking
Bundle Sizes
Signature Primitive (TypeScript)
Crypto Module WASM
When to Use WASM
Use TypeScript (Signature Primitive)
- Format conversions (DER, compact)
- Component extraction (getR, getS, getV)
- Validation (isCanonical, normalize)
- Type checking (is, equals)
- Serialization
Use WASM (Crypto Module)
- Signing messages
- Verifying signatures
- Recovering public keys
- Key generation
- Key derivation
Migration Guide
Before (hypothetical WASM signature primitive)
After (actual TypeScript + crypto WASM)
- No WASM call overhead for simple operations
- Synchronous API for signature primitive
- WASM where it matters (crypto operations)
Browser Support
TypeScript (Signature Primitive)
- All modern browsers
- Node.js 14+
- Deno
- Bun
WASM (Crypto Module)
- Chrome 57+
- Firefox 52+
- Safari 11+
- Edge 16+
See Also
- Signature Overview - TypeScript API
- Constructors - Creating signatures
- Utilities - Helper functions
- Crypto Module Documentation - WASM signing/verification

