From 1d2b52d15c6210171bb4ce08477bce31de7c5548 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Wed, 17 Aug 2022 21:37:54 -0700 Subject: Move the crypto hashers to the new bindings --- src/bun.js/api/crypto.classes.ts | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/bun.js/api/crypto.classes.ts (limited to 'src/bun.js/api/crypto.classes.ts') diff --git a/src/bun.js/api/crypto.classes.ts b/src/bun.js/api/crypto.classes.ts new file mode 100644 index 000000000..20e24c342 --- /dev/null +++ b/src/bun.js/api/crypto.classes.ts @@ -0,0 +1,43 @@ +import { define } from "../scripts/class-definitions"; + +const names = [ + "SHA1", + "MD5", + "MD4", + "SHA224", + "SHA512", + "SHA384", + "SHA256", + "SHA512_256", + "MD5_SHA1", +]; +export default names.map((name) => { + return define({ + name: name, + construct: true, + finalize: true, + klass: { + hash: { + fn: "hash", + length: 2, + }, + byteLength: { + getter: "getByteLengthStatic", + }, + }, + JSType: "0b11101110", + proto: { + digest: { + fn: "digest", + length: 0, + }, + update: { + fn: "update", + length: 0, + }, + byteLength: { + getter: "getByteLength", + }, + }, + }); +}); -- cgit v1.2.3