1.2.0 • Published 7 months ago
@acusti/webcrypto v1.2.0
@acusti/webcrypto
webcrypto exports window.crypto / self.crypto for use in a browser
environment (regular or worker) and the equivalent of
require('node:crypto').webcrypto for use in node.js.
When used in node, it requires node.js v15.0.0 or later.
Usage
npm install @acusti/webcrypto
# or
yarn add @acusti/webcryptoimport webcrypto from '@acusti/webcrypto';
const uuid = webcrypto.randomUUID();
const data = new TextEncoder().encode('data to hash');
const digest = await webcrypto.subtle.digest({ name: 'SHA-256' }, data);