wasm-crypto-box

Crates.iowasm-crypto-box
lib.rswasm-crypto-box
version0.1.0
created_at2025-12-30 21:22:53.758336+00
updated_at2025-12-30 21:22:53.758336+00
descriptionBrowser-safe WebAssembly wrapper for ed25519 signing and verification
homepagehttps://github.com//wasm-crypto-box
repositoryhttps://github.com//wasm-crypto-box
max_upload_size
id2013328
size20,950
(mohtashimnawaz)

documentation

https://docs.rs/wasm-crypto-box

README

wasm-crypto-box 🛡️

Browser-safe WASM wrapper around ed25519 for use in web apps and extensions.

Features

  • ed25519 keypair generation (uses browser RNG via getrandom)
  • Message signing and verification
  • WASM-friendly types (Uint8Array for keys and signatures)

Quickstart (Web)

  1. Build with wasm-pack:
wasm-pack build --target web
  1. In your web app (after bundling the pkg output):
import init, { generate_keypair, sign, verify } from './pkg/wasm_crypto_box.js';

await init();

const { secretKey, publicKey } = generate_keypair(); // Uint8Array fields
const msg = new TextEncoder().encode('hello');
const sig = sign(msg, secretKey);
const ok = verify(msg, sig, publicKey);
console.log('verified?', ok);

Security Notes

  • Keep secret keys confidential — do not send or expose them to untrusted contexts.
  • This crate does not implement an authenticated key store; integrate with WebCrypto or extension secure storage for production.

Development

  • Run cargo check / cargo test (native tests)
  • Use wasm-pack build --target web to generate pkg/ for browser usage

Publishing to crates.io

Before publishing, update Cargo.toml with your repository and homepage fields (if needed) and set an appropriate authors field.

Validate packaging locally:

cargo publish --dry-run

When ready, publish:

cargo publish

You can automate publishing on GitHub by setting a CARGO_REGISTRY_TOKEN secret and using the included .github/workflows/publish.yml which triggers on v* tags.

License

MIT

Commit count: 0

cargo fmt