A PASETO implementation in Rust with WebAssembly (WASM) bindings
npm install paseto-wasmpaseto-wasm)paseto by Filip Skokan - Node.js only
paseto.js by Samuel Judson - Uses deprecated PASETO v1 and v2 implementations
paseto-ts library for browser-based PASETO implementation. For better performance, consider paseto-wasm, which leverages WebAssembly.
pasetors crate by Johannes, which includes WASM support but lacks comprehensive testing. After evaluating options, I chose the rusty-paseto crate for its reliable WASM support.
paseto-wasm library, compatible with both JavaScript browsers and Node.js.
sh
npm install paseto-wasm # npm
yarn add paseto-wasm # yarn
pnpm add paseto-wasm # pnpm
bun add paseto-wasm # bun
`
API Methods
$3
The following methods are available by default:
- encrypt_v4_local, decrypt_v4_local
- sign_v4_public, verify_v4_public
- generate_v4_local_key, generate_v4_public_key_pair
- key_to_paserk_local, paserk_local_to_key
- key_to_paserk_secret, paserk_secret_to_key
- key_to_paserk_public, paserk_public_to_key
- get_local_key_id, get_public_key_id, get_secret_key_id
$3
Access v3 implementations via paseto-wasm/v3:
- encrypt_v3_local, decrypt_v3_local
- sign_v3_public, verify_v3_public
- generate_v3_local_key, generate_v3_public_key_pair
- key_to_paserk_v3_local, paserk_v3_local_to_key
- key_to_paserk_v3_secret, paserk_v3_secret_to_key
- key_to_paserk_v3_public, paserk_v3_public_to_key
- get_v3_local_key_id, get_v3_public_key_id, get_v3_secret_key_id
Documentation
Example usage is available in the test file. Comprehensive documentation is currently a work in progress.
๐ Contributing
$3
`sh
pnpm run build:wasm
`
$3
`sh
Node.js environment
pnpm run test:wasm:node
Browser environment
pnpm run test:wasm:web
pnpm run test:wasm:web:v3
`
For detailed contribution guidelines, please see CONTRIBUTING.md.
๐ ๏ธ Built With
- wasm-bindgen - Facilitates communication between WebAssembly and JavaScript
- rusty-paseto - PASETO implementation in Rust
๐ Roadmap
- [ ] Complete documentation
- [ ] Support PASERK in sign/verify operations
- [ ] Implement custom allocator (e.g., lol_alloc or talc) for improved performance and reduced file size