How to use the webcrypto-core.BufferSourceConverter.toArrayBuffer function in webcrypto-core

To help you get started, we’ve selected a few webcrypto-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PeculiarVentures / node-webcrypto-p11 / src / utils.ts View on Github external
export function prepareData(data: BufferSource): Buffer {
  return Buffer.from(BufferSourceConverter.toArrayBuffer(data));
}
github PeculiarVentures / node-webcrypto-p11 / src / utils.ts View on Github external
export function digest(algorithm: string, data: BufferSource): Buffer {
  const hash = crypto.createHash(algorithm.replace("-", ""));
  hash.update(prepareData(Buffer.from(BufferSourceConverter.toArrayBuffer(data))));
  return hash.digest();
}