Skip to content

Repository files navigation

WebCrypt

Zero-dependency end-to-end cryptography suite for the modern web.

npm versionlicensetestscoverage

AES-256-GCM symmetric encryption, RSA-4096 hybrid asymmetric encryption, ECDH key agreement, digital signatures, JWE compact serialization (RFC 7516), and WebRTC insertable streams — built natively for browser and Node.js Web Crypto API environments.


Interactive Live Demo & Documentation


Installation

npm install webcrypt

Quick Start Code Examples

1. Symmetric Text Encryption (AES-256-GCM)

import{WebCrypt}from"webcrypt";constwc=newWebCrypt();constencrypted=awaitwc.encryptText("Secret message","my-password");constdecrypted=awaitwc.decryptText(encrypted,"my-password");

2. Large File Streaming Encryption (8MB Chunking)

const{ blob, filename }=awaitwc.encryptFile(file,"my-password",{parallelChunks: 4});constdecrypted=awaitwc.decryptFile(blob,"my-password");

3. Public-Key Hybrid Encryption (RSA-4096)

import{WebCryptAsym}from"webcrypt";constwca=newWebCryptAsym();constkeys=awaitwca.generateKeyPair(4096);constencrypted=awaitwca.encryptText("Secret payload",keys.publicKey);constdecrypted=awaitwca.decryptText(encrypted,keys.privateKey);

4. ECDH Key Agreement & One-Step Encryption

constaliceKeys=awaitwca.generateECDHKeyPair("P-256");constbobKeys=awaitwca.generateECDHKeyPair("P-256");constencrypted=awaitwca.encryptWithECDH("Confidential data",aliceKeys.privateKey,bobKeys.publicKey);constdecrypted=awaitwca.decryptWithECDH(encrypted,bobKeys.privateKey,aliceKeys.publicKey);

5. Digital Signatures (ECDSA P-256 / P-384)

constsigningKeys=awaitwca.generateSigningKeyPair("P-256");constsignature=awaitwca.signText("Tamper-proof payload",signingKeys.privateKey);constisValid=awaitwca.verifyText("Tamper-proof payload",signature,signingKeys.publicKey);

Complete API & Technical Documentation

For complete method signatures, options, and advanced usage, see our detailed documentation sub-documents:


License

MIT © PuterVision LLC

About

Zero-dependency JavaScript AES-256-GCM & RSA-4096 cryptography suite for text, files & WebRTC E2EE. Powered by native Web Crypto API.

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages