Uncrypto is a lightweight JavaScript library that provides a unified, cross-runtime API for cryptographic operations, abstracting the differences between the Web Crypto API in browsers and Node.js's native `crypto` module. Currently at version 0.1.3, it offers direct access to `SubtleCrypto` functionalities, `randomUUID`, and `getRandomValues` through a single import. The library leverages Node.js conditional exports to automatically adapt to the target environment (Node.js 15+ or modern browsers in secure contexts) without providing polyfills for older versions, thus maintaining a small footprint. Its primary differentiator is simplifying cryptographic development by eliminating environment-specific branching, allowing developers to write once and deploy across various JavaScript runtimes. The release cadence appears to be driven by feature enhancements and maintenance, reflecting its early-stage development and active development cycle.
npm install uncryptoVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing and using `subtle`, `randomUUID`, and `getRandomValues` to generate a UUID, secure random numbers, and perform a basic AES-GCM encryption operation.
Upgrade your Node.js environment to version 15 or newer. For projects that must support older Node.js, consider polyfilling `globalThis.crypto` manually or using a different library.
Ensure your web application is served over HTTPS or accessed via `localhost` during development to enable the Web Crypto API.
For unsupported runtimes, manually polyfill `globalThis.crypto` and `globalThis.crypto.subtle` according to the Web Crypto API specification or use a compatible polyfill library.
Pin to exact versions (`"uncrypto": "0.1.3"`) or use caret ranges (`"^0.1.3"`) with caution and regularly review release notes for updates.
Change your import statements to use ESM syntax: `import { subtle } from 'uncrypto';` instead of `const { subtle } = require('uncrypto');`.Ensure you are running in Node.js 15+ or a modern browser in a secure context. For other runtimes, you must manually polyfill `globalThis.crypto`.
Serve your web application over HTTPS or access it via `localhost` during development to enable the secure context required by the Web Crypto API.
No dependency data recorded yet.