Star on
RELEASE v0.6.5 โ€ข ZERO DEPENDENCIES โ€ข PURE WEB CRYPTO API

Zero-Dependency Web Cryptography Suite

High-performance AES-256-GCM encryption for text, files, and WebRTC E2EE insertable streams. Built natively for browser and Node.js Web Crypto environments.

๐Ÿ”’

AES-256-GCM Encryption

Authenticated symmetric encryption with unique 128-bit salt and 96-bit IV per payload for max integrity and secrecy.

๐Ÿ”‘

RSA-4096 Hybrid Mode

Asymmetric public-key encryption combining RSA-OAEP key wrapping with high-speed AES-256-GCM payload encryption.

๐Ÿ“ก

WebRTC E2EE Streams

Real-time video/audio media frame encryption using WebRTC Insertable Streams and transform streams.

โšก

Zero Dependencies

100% native Web Crypto API (`globalThis.crypto.subtle`) execution in Chrome, Edge, Firefox, Safari, and Node.js 18+.

๐Ÿ›ก๏ธ

OWASP 2025+ Compliant

Quantum-safe key derivation using PBKDF2 with 600,000 iterations and timing-attack resistant comparisons.

๐Ÿ“

File & Stream Chunks

Chunked file encryption with constant memory usage, streaming support, and automatic unref'd key caching.

Interactive Browser Workbench

Live Web Cryptography Tools

Ready for zero-dependency AES-256-GCM execution
Generate a key pair to begin asymmetric testing
256 Bits Cryptographic Entropy
Ready for HMAC authentication

Live inspection of your current browser runtime environment (`globalThis.crypto.subtle` capabilities and native Web Crypto features):

Code Quickstart & Examples

Comprehensive Suite Examples

1. Symmetric AES-256-GCM Text & Data

import { WebCrypt } from "webcrypt"; const crypt = new WebCrypt(); // Encrypt text with password (OWASP 600k PBKDF2 + AES-256-GCM) const encryptedB64 = await crypt.encryptText( "Confidential data payload", "StrongUserPassword123!" ); // Decrypt text back to plaintext const decryptedText = await crypt.decryptText( encryptedB64, "StrongUserPassword123!" ); console.log(decryptedText); // "Confidential data payload"

2. Asymmetric RSA-4096 Hybrid Public Key Encryption

import { WebCryptAsym } from "webcrypt/webcrypt-asym"; const asym = new WebCryptAsym(); const keys = await asym.generateKeyPair(); // Encrypt text with public key const encrypted = await asym.encryptText("Top Secret Document", keys.publicKey); // Decrypt text with private key const decrypted = await asym.decryptText(encrypted, keys.privateKey);

3. Deterministic HMAC Authentication (SHA-256 / SHA-3)

const key = await crypt.generateHmacKey("my-secret-password", "SHA-256"); const tag = await crypt.computeHmac("Message to sign", key); const isValid = await crypt.verifyHmac("Message to sign", tag, key);
Complete API Reference

Exported Modules & Signatures

Module Method Description
`WebCrypt` `encryptText(text, password)` AES-256-GCM text encryption returning Base64 salt+iv+ciphertext.
`WebCrypt` `decryptText(b64, password)` Decrypts Base64 string back to plain text.
`WebCrypt` `encryptFile(file, password)` Streaming file encryption returning encrypted Blob.
`WebCrypt` `generateHmacKey(password, hash, salt)` Derives deterministic HMAC key using PBKDF2.
`WebCryptAsym` `generateKeyPair()` Generates 4096-bit RSA-OAEP key pair.
`WebCryptAsym` `encryptText(text, publicKey)` Hybrid RSA-4096 + AES-256-GCM text encryption.
`TimingSafeHelper` `constantTimeCompareBuffers(a, b)` Constant-time buffer comparison preventing timing oracles.
Security & Legal Policy

Limitation of Liability & License

WebCrypt is maintained by PuterVision LLC and released under the MIT License.

DISCLAIMER OF WARRANTY & LIMITATION OF LIABILITY WEBCRYPT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL PUTERVISION LLC, ITS AFFILIATES, OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.