diff options
-rw-r--r-- | examples/sha.js | 15 | ||||
-rw-r--r-- | packages/bun-types/bun.d.ts | 8 | ||||
-rw-r--r-- | src/bun.js/api/bun.zig | 16 | ||||
-rw-r--r-- | src/bun.js/api/crypto.classes.ts | 3 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h | 3 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h | 3 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h | 6 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h | 7 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses.cpp | 320 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses.h | 50 | ||||
-rw-r--r-- | src/bun.js/bindings/generated_classes.zig | 86 | ||||
-rw-r--r-- | src/bun.js/bindings/generated_classes_list.zig | 1 |
12 files changed, 503 insertions, 15 deletions
diff --git a/examples/sha.js b/examples/sha.js index ab3b21164..0155aecc4 100644 --- a/examples/sha.js +++ b/examples/sha.js @@ -1,4 +1,14 @@ -import { SHA1, SHA256, SHA512, SHA384, SHA512_256, MD5, MD4, sha } from "bun"; +import { + SHA1, + SHA256, + SHA512, + SHA384, + SHA512_256, + MD5, + MD4, + RIPEMD160, + sha, +} from "bun"; const input = "Hello World"; const [first, second] = input.split(" "); @@ -16,6 +26,7 @@ log("SHA256", SHA256.hash(input, "hex")); log("SHA384", SHA384.hash(input, "hex")); log("SHA512", SHA512.hash(input, "hex")); log("SHA512_256", SHA512_256.hash(input, "hex")); +log("RIPEMD160", RIPEMD160.hash(input, "hex")); console.log(""); console.log("---- Chunked ----"); @@ -23,7 +34,7 @@ console.log(""); // You can also do updates in chunks: // const hash = new Hash(); -for (let Hash of [SHA1, SHA256, SHA384, SHA512, SHA512_256]) { +for (let Hash of [SHA1, SHA256, SHA384, SHA512, SHA512_256, RIPEMD160]) { const hash = new Hash(); hash.update(first); hash.update(" " + second); diff --git a/packages/bun-types/bun.d.ts b/packages/bun-types/bun.d.ts index 6978a10fd..2d93cf8a8 100644 --- a/packages/bun-types/bun.d.ts +++ b/packages/bun-types/bun.d.ts @@ -2045,6 +2045,14 @@ declare module "bun" { */ static readonly byteLength: 32; } + export class RIPEMD160 extends CryptoHashInterface<RIPEMD160> { + constructor(); + + /** + * The number of bytes the hash will produce + */ + static readonly byteLength: 20; + } /** Compression options for `Bun.deflateSync` and `Bun.gzipSync` */ export type ZlibCompressionOptions = { diff --git a/src/bun.js/api/bun.zig b/src/bun.js/api/bun.zig index ee2763d92..fc66098a4 100644 --- a/src/bun.js/api/bun.zig +++ b/src/bun.js/api/bun.zig @@ -1279,6 +1279,9 @@ pub const Class = NewClass( .SHA256 = .{ .get = Crypto.SHA256.getter, }, + .RIPEMD160 = .{ + .get = Crypto.RIPEMD160.getter, + }, .SHA512_256 = .{ .get = Crypto.SHA512_256.getter, }, @@ -1396,7 +1399,11 @@ pub const Crypto = struct { ) JSC.JSValue { var output_digest_buf: Hasher.Digest = undefined; - Hasher.hash(input.slice(), &output_digest_buf, JSC.VirtualMachine.get().rareData().boringEngine()); + if (comptime @typeInfo(@TypeOf(Hasher.hash)).Fn.params.len == 3) { + Hasher.hash(input.slice(), &output_digest_buf, JSC.VirtualMachine.get().rareData().boringEngine()); + } else { + Hasher.hash(input.slice(), &output_digest_buf); + } return encoding.encodeWithSize(globalThis, Hasher.digest, &output_digest_buf); } @@ -1417,7 +1424,11 @@ pub const Crypto = struct { output_digest_slice = bytes[0..Hasher.digest]; } - Hasher.hash(input.slice(), output_digest_slice, JSC.VirtualMachine.get().rareData().boringEngine()); + if (comptime @typeInfo(@TypeOf(Hasher.hash)).Fn.params.len == 3) { + Hasher.hash(input.slice(), output_digest_slice, JSC.VirtualMachine.get().rareData().boringEngine()); + } else { + Hasher.hash(input.slice(), output_digest_slice); + } if (output) |output_buf| { return output_buf.value; @@ -1571,6 +1582,7 @@ pub const Crypto = struct { pub const SHA384 = CryptoHasher(Hashers.SHA384, "SHA384"); pub const SHA256 = CryptoHasher(Hashers.SHA256, "SHA256"); pub const SHA512_256 = CryptoHasher(Hashers.SHA512_256, "SHA512_256"); + pub const RIPEMD160 = CryptoHasher(Hashers.Hashers.RIPEMD160, "RIPEMD160"); }; pub fn nanoseconds( diff --git a/src/bun.js/api/crypto.classes.ts b/src/bun.js/api/crypto.classes.ts index 212e991a0..8ddd11caf 100644 --- a/src/bun.js/api/crypto.classes.ts +++ b/src/bun.js/api/crypto.classes.ts @@ -9,6 +9,7 @@ const names = [ "SHA384", "SHA256", "SHA512_256", + "RIPEMD160", ]; export default names.map((name) => { return define({ @@ -32,7 +33,7 @@ export default names.map((name) => { }, update: { fn: "update", - length: 0, + length: 1, }, byteLength: { getter: "getByteLength", diff --git a/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h b/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h index 15a1d9111..484ae9c48 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h @@ -10,7 +10,8 @@ std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA224Constructor;std: std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA384; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA384Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA256; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA256Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512_256; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512_256Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServerWebSocket; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512_256Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRIPEMD160; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRIPEMD160Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServerWebSocket; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServerWebSocketConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemRouter; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemRouterConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMatchedRoute; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpect; diff --git a/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h b/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h index 273a699c5..ebbb2f7b7 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h @@ -10,7 +10,8 @@ std::unique_ptr<IsoSubspace> m_subspaceForSHA224Constructor;std::unique_ptr<IsoS std::unique_ptr<IsoSubspace> m_subspaceForSHA512Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA384; std::unique_ptr<IsoSubspace> m_subspaceForSHA384Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA256; std::unique_ptr<IsoSubspace> m_subspaceForSHA256Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA512_256; -std::unique_ptr<IsoSubspace> m_subspaceForSHA512_256Constructor;std::unique_ptr<IsoSubspace> m_subspaceForServerWebSocket; +std::unique_ptr<IsoSubspace> m_subspaceForSHA512_256Constructor;std::unique_ptr<IsoSubspace> m_subspaceForRIPEMD160; +std::unique_ptr<IsoSubspace> m_subspaceForRIPEMD160Constructor;std::unique_ptr<IsoSubspace> m_subspaceForServerWebSocket; std::unique_ptr<IsoSubspace> m_subspaceForServerWebSocketConstructor;std::unique_ptr<IsoSubspace> m_subspaceForFileSystemRouter; std::unique_ptr<IsoSubspace> m_subspaceForFileSystemRouterConstructor;std::unique_ptr<IsoSubspace> m_subspaceForMatchedRoute; std::unique_ptr<IsoSubspace> m_subspaceForExpect; diff --git a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h index cefb58178..73b96e5f6 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h @@ -70,6 +70,12 @@ JSC::Structure* JSSHA512_256Structure() { return m_JSSHA512_256.getInitializedOn JSC::LazyClassStructure m_JSSHA512_256; bool hasJSSHA512_256SetterValue { false }; mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA512_256SetterValue; +JSC::Structure* JSRIPEMD160Structure() { return m_JSRIPEMD160.getInitializedOnMainThread(this); } + JSC::JSObject* JSRIPEMD160Constructor() { return m_JSRIPEMD160.constructorInitializedOnMainThread(this); } + JSC::JSValue JSRIPEMD160Prototype() { return m_JSRIPEMD160.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSRIPEMD160; + bool hasJSRIPEMD160SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSRIPEMD160SetterValue; JSC::Structure* JSServerWebSocketStructure() { return m_JSServerWebSocket.getInitializedOnMainThread(this); } JSC::JSObject* JSServerWebSocketConstructor() { return m_JSServerWebSocket.constructorInitializedOnMainThread(this); } JSC::JSValue JSServerWebSocketPrototype() { return m_JSServerWebSocket.prototypeInitializedOnMainThread(this); } diff --git a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h index 64e0bb9b2..e0a13622a 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h @@ -71,6 +71,12 @@ void GlobalObject::initGeneratedLazyClasses() { init.setStructure(WebCore::JSSHA512_256::createStructure(init.vm, init.global, init.prototype)); init.setConstructor(WebCore::JSSHA512_256::createConstructor(init.vm, init.global, init.prototype)); }); + m_JSRIPEMD160.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSRIPEMD160::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSRIPEMD160::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSRIPEMD160::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSServerWebSocket.initLater( [](LazyClassStructure::Initializer& init) { init.setPrototype(WebCore::JSServerWebSocket::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); @@ -147,6 +153,7 @@ void GlobalObject::visitGeneratedLazyClasses(GlobalObject *thisObject, Visitor& thisObject->m_JSSHA384.visit(visitor); visitor.append(thisObject->m_JSSHA384SetterValue); thisObject->m_JSSHA256.visit(visitor); visitor.append(thisObject->m_JSSHA256SetterValue); thisObject->m_JSSHA512_256.visit(visitor); visitor.append(thisObject->m_JSSHA512_256SetterValue); + thisObject->m_JSRIPEMD160.visit(visitor); visitor.append(thisObject->m_JSRIPEMD160SetterValue); thisObject->m_JSServerWebSocket.visit(visitor); visitor.append(thisObject->m_JSServerWebSocketSetterValue); thisObject->m_JSFileSystemRouter.visit(visitor); visitor.append(thisObject->m_JSFileSystemRouterSetterValue); thisObject->m_JSMatchedRoute.visit(visitor); visitor.append(thisObject->m_JSMatchedRouteSetterValue); diff --git a/src/bun.js/bindings/ZigGeneratedClasses.cpp b/src/bun.js/bindings/ZigGeneratedClasses.cpp index c80251c13..df82bb7f0 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.cpp +++ b/src/bun.js/bindings/ZigGeneratedClasses.cpp @@ -1919,7 +1919,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA1Prototype, JSSHA1Prototype::Base); static const HashTableValue JSSHA1PrototypeTableValues[] = { { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA1Prototype__byteLengthGetterWrap, 0 } }, { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__updateCallback, 0 } } + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__updateCallback, 1 } } }; const ClassInfo JSSHA1Prototype::s_info = { "SHA1"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1Prototype) }; @@ -2223,7 +2223,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMD5Prototype, JSMD5Prototype::Base); static const HashTableValue JSMD5PrototypeTableValues[] = { { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, MD5Prototype__byteLengthGetterWrap, 0 } }, { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Prototype__updateCallback, 0 } } + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Prototype__updateCallback, 1 } } }; const ClassInfo JSMD5Prototype::s_info = { "MD5"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5Prototype) }; @@ -2527,7 +2527,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMD4Prototype, JSMD4Prototype::Base); static const HashTableValue JSMD4PrototypeTableValues[] = { { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, MD4Prototype__byteLengthGetterWrap, 0 } }, { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__updateCallback, 0 } } + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__updateCallback, 1 } } }; const ClassInfo JSMD4Prototype::s_info = { "MD4"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4Prototype) }; @@ -2831,7 +2831,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA224Prototype, JSSHA224Prototype::Base); static const HashTableValue JSSHA224PrototypeTableValues[] = { { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA224Prototype__byteLengthGetterWrap, 0 } }, { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Prototype__updateCallback, 0 } } + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Prototype__updateCallback, 1 } } }; const ClassInfo JSSHA224Prototype::s_info = { "SHA224"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA224Prototype) }; @@ -3135,7 +3135,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA512Prototype, JSSHA512Prototype::Base); static const HashTableValue JSSHA512PrototypeTableValues[] = { { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512Prototype__byteLengthGetterWrap, 0 } }, { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Prototype__updateCallback, 0 } } + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Prototype__updateCallback, 1 } } }; const ClassInfo JSSHA512Prototype::s_info = { "SHA512"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512Prototype) }; @@ -3439,7 +3439,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA384Prototype, JSSHA384Prototype::Base); static const HashTableValue JSSHA384PrototypeTableValues[] = { { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA384Prototype__byteLengthGetterWrap, 0 } }, { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__updateCallback, 0 } } + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__updateCallback, 1 } } }; const ClassInfo JSSHA384Prototype::s_info = { "SHA384"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384Prototype) }; @@ -3743,7 +3743,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA256Prototype, JSSHA256Prototype::Base); static const HashTableValue JSSHA256PrototypeTableValues[] = { { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA256Prototype__byteLengthGetterWrap, 0 } }, { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Prototype__updateCallback, 0 } } + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Prototype__updateCallback, 1 } } }; const ClassInfo JSSHA256Prototype::s_info = { "SHA256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256Prototype) }; @@ -4047,7 +4047,7 @@ STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA512_256Prototype, JSSHA512_256Prototype static const HashTableValue JSSHA512_256PrototypeTableValues[] = { { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512_256Prototype__byteLengthGetterWrap, 0 } }, { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Prototype__updateCallback, 0 } } + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Prototype__updateCallback, 1 } } }; const ClassInfo JSSHA512_256Prototype::s_info = { "SHA512_256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256Prototype) }; @@ -4265,6 +4265,310 @@ extern "C" EncodedJSValue SHA512_256__create(Zig::GlobalObject* globalObject, vo return JSValue::encode(instance); } +class JSRIPEMD160Prototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + + static JSRIPEMD160Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSRIPEMD160Prototype* ptr = new (NotNull, JSC::allocateCell<JSRIPEMD160Prototype>(vm)) JSRIPEMD160Prototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + +private: + JSRIPEMD160Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); +}; + +class JSRIPEMD160Constructor final : public JSC::InternalFunction { +public: + using Base = JSC::InternalFunction; + static JSRIPEMD160Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSRIPEMD160Prototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSRIPEMD160Constructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForRIPEMD160Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForRIPEMD160Constructor = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForRIPEMD160Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForRIPEMD160Constructor = WTFMove(space); }); + } + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSRIPEMD160Prototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + +private: + JSRIPEMD160Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSRIPEMD160Prototype* prototype); +}; + +extern "C" void* RIPEMD160Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsRIPEMD160Constructor); +extern "C" void RIPEMD160Class__finalize(void*); + +extern "C" JSC::EncodedJSValue RIPEMD160Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(RIPEMD160Prototype__byteLengthGetterWrap); + +extern "C" EncodedJSValue RIPEMD160Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(RIPEMD160Prototype__digestCallback); + +extern "C" EncodedJSValue RIPEMD160Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(RIPEMD160Prototype__updateCallback); + +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSRIPEMD160Prototype, JSRIPEMD160Prototype::Base); + +static const HashTableValue JSRIPEMD160PrototypeTableValues[] = { + { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, RIPEMD160Prototype__byteLengthGetterWrap, 0 } }, + { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, RIPEMD160Prototype__digestCallback, 0 } }, + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, RIPEMD160Prototype__updateCallback, 1 } } +}; + +const ClassInfo JSRIPEMD160Prototype::s_info = { "RIPEMD160"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRIPEMD160Prototype) }; + +JSC_DEFINE_CUSTOM_GETTER(jsRIPEMD160Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSRIPEMD160Prototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSRIPEMD160Constructor()); +} + +JSC_DEFINE_CUSTOM_GETTER(RIPEMD160Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSRIPEMD160* thisObject = jsCast<JSRIPEMD160*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = RIPEMD160Prototype__getByteLength(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} + +JSC_DEFINE_HOST_FUNCTION(RIPEMD160Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSRIPEMD160* thisObject = jsDynamicCast<JSRIPEMD160*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return RIPEMD160Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(RIPEMD160Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSRIPEMD160* thisObject = jsDynamicCast<JSRIPEMD160*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return RIPEMD160Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +void JSRIPEMD160Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSRIPEMD160::info(), JSRIPEMD160PrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +extern "C" JSC_DECLARE_CUSTOM_GETTER(RIPEMD160Class__getByteLengthStatic); +extern "C" JSC_DECLARE_HOST_FUNCTION(RIPEMD160Class__hash); + +static const HashTableValue JSRIPEMD160ConstructorTableValues[] = { + { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, RIPEMD160Class__getByteLengthStatic, 0 } }, + { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, RIPEMD160Class__hash, 2 } } +}; + +void JSRIPEMD160Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSRIPEMD160Prototype* prototype) +{ + Base::finishCreation(vm, 0, "RIPEMD160"_s, PropertyAdditionMode::WithoutStructureTransition); + reifyStaticProperties(vm, &JSRIPEMD160Constructor::s_info, JSRIPEMD160ConstructorTableValues, *this); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); +} + +JSRIPEMD160Constructor::JSRIPEMD160Constructor(JSC::VM& vm, JSC::Structure* structure) + : Base(vm, structure, construct, construct) +{ +} + +JSRIPEMD160Constructor* JSRIPEMD160Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSRIPEMD160Prototype* prototype) +{ + JSRIPEMD160Constructor* ptr = new (NotNull, JSC::allocateCell<JSRIPEMD160Constructor>(vm)) JSRIPEMD160Constructor(vm, structure); + ptr->finishCreation(vm, globalObject, prototype); + return ptr; +} + +JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSRIPEMD160Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +{ + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM& vm = globalObject->vm(); + JSObject* newTarget = asObject(callFrame->newTarget()); + auto* constructor = globalObject->JSRIPEMD160Constructor(); + Structure* structure = globalObject->JSRIPEMD160Structure(); + if (constructor != newTarget) { + auto scope = DECLARE_THROW_SCOPE(vm); + + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget)); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSRIPEMD160Structure()); + } + + void* ptr = RIPEMD160Class__construct(globalObject, callFrame); + + if (UNLIKELY(!ptr)) { + return JSValue::encode(JSC::jsUndefined()); + } + + JSRIPEMD160* instance = JSRIPEMD160::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + +void JSRIPEMD160Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSRIPEMD160Prototype* prototype) +{ +} + +const ClassInfo JSRIPEMD160Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRIPEMD160Constructor) }; + +extern "C" EncodedJSValue RIPEMD160__getConstructor(Zig::GlobalObject* globalObject) +{ + return JSValue::encode(globalObject->JSRIPEMD160Constructor()); +} + +JSRIPEMD160::~JSRIPEMD160() +{ + if (m_ctx) { + RIPEMD160Class__finalize(m_ctx); + } +} +void JSRIPEMD160::destroy(JSCell* cell) +{ + static_cast<JSRIPEMD160*>(cell)->JSRIPEMD160::~JSRIPEMD160(); +} + +const ClassInfo JSRIPEMD160::s_info = { "RIPEMD160"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRIPEMD160) }; + +void JSRIPEMD160::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); +} + +JSRIPEMD160* JSRIPEMD160::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +{ + JSRIPEMD160* ptr = new (NotNull, JSC::allocateCell<JSRIPEMD160>(vm)) JSRIPEMD160(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} + +extern "C" void* RIPEMD160__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (!decodedValue || decodedValue.isUndefinedOrNull()) + return nullptr; + + JSRIPEMD160* object = JSC::jsDynamicCast<JSRIPEMD160*>(decodedValue); + + if (!object) + return nullptr; + + return object->wrapped(); +} + +extern "C" bool RIPEMD160__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +{ + JSRIPEMD160* object = JSC::jsDynamicCast<JSRIPEMD160*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; +} + +extern "C" const size_t RIPEMD160__ptrOffset = JSRIPEMD160::offsetOfWrapped(); + +void JSRIPEMD160::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSRIPEMD160*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, analyzer); +} + +JSObject* JSRIPEMD160::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +{ + return WebCore::JSRIPEMD160Constructor::create(vm, globalObject, WebCore::JSRIPEMD160Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSRIPEMD160Prototype*>(prototype)); +} + +JSObject* JSRIPEMD160::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSRIPEMD160Prototype::create(vm, globalObject, JSRIPEMD160Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} + +extern "C" EncodedJSValue RIPEMD160__create(Zig::GlobalObject* globalObject, void* ptr) +{ + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSRIPEMD160Structure(); + JSRIPEMD160* instance = JSRIPEMD160::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} class JSServerWebSocketPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; diff --git a/src/bun.js/bindings/ZigGeneratedClasses.h b/src/bun.js/bindings/ZigGeneratedClasses.h index 3f34fc978..9046a002e 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.h +++ b/src/bun.js/bindings/ZigGeneratedClasses.h @@ -725,6 +725,56 @@ public: void finishCreation(JSC::VM&); }; +class JSRIPEMD160 final : public JSC::JSDestructibleObject { +public: + using Base = JSC::JSDestructibleObject; + static JSRIPEMD160* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSRIPEMD160, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForRIPEMD160.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForRIPEMD160 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForRIPEMD160.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForRIPEMD160 = WTFMove(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSRIPEMD160(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSRIPEMD160, m_ctx); } + + void* m_ctx { nullptr }; + + JSRIPEMD160(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + } + + void finishCreation(JSC::VM&); +}; + class JSServerWebSocket final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; diff --git a/src/bun.js/bindings/generated_classes.zig b/src/bun.js/bindings/generated_classes.zig index e38870229..87ab124ce 100644 --- a/src/bun.js/bindings/generated_classes.zig +++ b/src/bun.js/bindings/generated_classes.zig @@ -1284,6 +1284,91 @@ pub const JSSHA512_256 = struct { } } }; +pub const JSRIPEMD160 = struct { + const RIPEMD160 = Classes.RIPEMD160; + const GetterType = fn (*RIPEMD160, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn (*RIPEMD160, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*RIPEMD160, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn (*RIPEMD160, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*RIPEMD160, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*RIPEMD160 { + JSC.markBinding(@src()); + return RIPEMD160__fromJS(value); + } + + /// Get the RIPEMD160 constructor value. + /// This loads lazily from the global object. + pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + return RIPEMD160__getConstructor(globalObject); + } + + /// Create a new instance of RIPEMD160 + pub fn toJS(this: *RIPEMD160, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = RIPEMD160__create(globalObject, this); + std.debug.assert(value__.as(RIPEMD160).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return RIPEMD160__create(globalObject, this); + } + } + + /// Modify the internal ptr to point to a new instance of RIPEMD160. + pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*RIPEMD160) bool { + JSC.markBinding(@src()); + return RIPEMD160__dangerouslySetPtr(value, ptr); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *RIPEMD160, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(RIPEMD160__dangerouslySetPtr(value, null)); + } + + extern fn RIPEMD160__fromJS(JSC.JSValue) ?*RIPEMD160; + extern fn RIPEMD160__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn RIPEMD160__create(globalObject: *JSC.JSGlobalObject, ptr: ?*RIPEMD160) JSC.JSValue; + + extern fn RIPEMD160__dangerouslySetPtr(JSC.JSValue, ?*RIPEMD160) bool; + + comptime { + if (@TypeOf(RIPEMD160.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*RIPEMD160)) { + @compileLog("RIPEMD160.constructor is not a constructor"); + } + + if (@TypeOf(RIPEMD160.finalize) != (fn (*RIPEMD160) callconv(.C) void)) { + @compileLog("RIPEMD160.finalize is not a finalizer"); + } + + if (@TypeOf(RIPEMD160.getByteLength) != GetterType) + @compileLog("Expected RIPEMD160.getByteLength to be a getter"); + + if (@TypeOf(RIPEMD160.digest) != CallbackType) + @compileLog("Expected RIPEMD160.digest to be a callback but received " ++ @typeName(@TypeOf(RIPEMD160.digest))); + if (@TypeOf(RIPEMD160.update) != CallbackType) + @compileLog("Expected RIPEMD160.update to be a callback but received " ++ @typeName(@TypeOf(RIPEMD160.update))); + if (@TypeOf(RIPEMD160.getByteLengthStatic) != StaticGetterType) + @compileLog("Expected RIPEMD160.getByteLengthStatic to be a static getter"); + + if (@TypeOf(RIPEMD160.hash) != StaticCallbackType) + @compileLog("Expected RIPEMD160.hash to be a static callback"); + if (!JSC.is_bindgen) { + @export(RIPEMD160.constructor, .{ .name = "RIPEMD160Class__construct" }); + @export(RIPEMD160.digest, .{ .name = "RIPEMD160Prototype__digest" }); + @export(RIPEMD160.finalize, .{ .name = "RIPEMD160Class__finalize" }); + @export(RIPEMD160.getByteLength, .{ .name = "RIPEMD160Prototype__getByteLength" }); + @export(RIPEMD160.getByteLengthStatic, .{ .name = "RIPEMD160Class__getByteLengthStatic" }); + @export(RIPEMD160.hash, .{ .name = "RIPEMD160Class__hash" }); + @export(RIPEMD160.update, .{ .name = "RIPEMD160Prototype__update" }); + } + } +}; pub const JSServerWebSocket = struct { const ServerWebSocket = Classes.ServerWebSocket; const GetterType = fn (*ServerWebSocket, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; @@ -3191,6 +3276,7 @@ comptime { _ = JSSHA384; _ = JSSHA256; _ = JSSHA512_256; + _ = JSRIPEMD160; _ = JSServerWebSocket; _ = JSFileSystemRouter; _ = JSMatchedRoute; diff --git a/src/bun.js/bindings/generated_classes_list.zig b/src/bun.js/bindings/generated_classes_list.zig index 53019d178..bb386816d 100644 --- a/src/bun.js/bindings/generated_classes_list.zig +++ b/src/bun.js/bindings/generated_classes_list.zig @@ -11,6 +11,7 @@ pub const Classes = struct { pub const SHA384 = JSC.API.Bun.Crypto.SHA384; pub const SHA256 = JSC.API.Bun.Crypto.SHA256; pub const SHA512_256 = JSC.API.Bun.Crypto.SHA512_256; + pub const RIPEMD160 = JSC.API.Bun.Crypto.RIPEMD160; pub const TextDecoder = JSC.WebCore.TextDecoder; pub const Blob = JSC.WebCore.Blob; pub const Subprocess = JSC.Subprocess; |