uncrypto
Version:
Single API for Web Crypto API and Crypto Subtle working in Node.js, Browsers and other runtimes
17 lines (14 loc) • 380 B
JavaScript
import nodeCrypto from 'node:crypto';
const subtle = nodeCrypto.webcrypto?.subtle || {};
const randomUUID = () => {
return nodeCrypto.randomUUID();
};
const getRandomValues = (array) => {
return nodeCrypto.webcrypto.getRandomValues(array);
};
const _crypto = {
randomUUID,
getRandomValues,
subtle
};
export { _crypto as default, getRandomValues, randomUUID, subtle };