Repository
Current version released
2 years ago
Dependencies
std
RSA for WebAssembly
WebAssembly port of RustCrypto’s RSA, a Rust implementation of RSA encryption and signatures.
npm i @hazae41/paimon
Next.js CodeSandbox 🪣 • Deno CodeSandbox 🪣 • Node CodeSandbox 🪣
Usage
import { Paimon, PaddingScheme, RsaPrivateKey } from "@hazae41/paimon";
// Wait for WASM to load
Paimon.initSyncBundledOnce()
// Generate an identity
const keypair = new RsaPrivateKey(1024)
const identity = keypair.to_public_key()
// Define bytes to sign and padding to use
const bytes = new TextEncoder().encode("hello world")
const padding = PaddingScheme.new_pkcs1v15_sign_raw()
// Sign and verify
const proof = keypair.sign(padding, bytes)
const verified = identity.verify(padding, bytes, proof)
Building
- Install Deno
- Install binaryen (for wasm-opt) and add it your PATH
https://github.com/WebAssembly/binaryen/releases
- Install wasm-pack
cargo install wasm-pack
- Install dependencies
npm install
- Build wasm and module
npm run build