Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
///
import {Provider, WebCrypto } from "node-webcrypto-ossl";
// Webcrypto constructor
let crypto = new WebCrypto({
library: "softhsm2.so",
name: "SoftHSM",
slot: 0,
sessionFlags: 6,
pin: "psw"
});
// Webcrypto getRandomValues
crypto.getRandomValues(new Buffer(16));
crypto.getRandomValues(new Uint8Array(16));
crypto.getRandomValues(new Uint8Array(16).buffer);
// Webcrypto Storage
let key: NodeWebcryptoPkcs11.CryptoKey;
key = crypto.keyStorage.getItem("keyname");
crypto.keyStorage.length === 0;