@mgcloud/uncrypto
v0.0.1
Published
Single API for Web Crypto API and Crypto Subtle working in Node.js, Browsers and other runtimes
Readme
🚀 @mgcloud/uncrypto
This library provides a single api to use web-crypto and Subtle Crypto in both Node.js using Crypto Module and Web targets using Web Crypto API using Conditional Exports.
Requirements:
- Node.js: Version 15 and above (this library provides no polyfills for older versions!)
- Browser: Secure Context (HTTPS/Localhost) in Supported Browsers
- Other Runtimes: Exposed
globalThis.cryptoandglobalThis.crypto.subtle. (you can polyfill if neeeded)
Usage
Install package:
# pnpm
pnpm install @mgcloud/uncryptoImport:
// ESM
import { subtle, randomUUID, getRandomValues } from '@mgcloud/uncrypto'
// CommonJS
const { subtle, randomUUID, getRandomValues } = require('@mgcloud/uncrypto')