Skip to content

Comments

fix the native blake2 bindings issue#14

Open
kamalbuilds wants to merge 2 commits intoAtomaAI:mainfrom
kamalbuilds:fix/sdk
Open

fix the native blake2 bindings issue#14
kamalbuilds wants to merge 2 commits intoAtomaAI:mainfrom
kamalbuilds:fix/sdk

Conversation

@kamalbuilds
Copy link

Fixes #13

The issue is that the sdk is trying to use the native blake2 Node.js module which requires C++ bindings, but those bindings aren't available.

However, there are pure JavaScript/TypeScript implementations of BLAKE2 that we can use instead and in this PR uses it.

The advantages of this approach are:

  1. No native dependencies required
  2. Pure JavaScript implementation that works in all environments
  3. Well-maintained and secure implementation
  4. TypeScript support out of the box

The @noble/hashes library is a popular choice for cryptographic hashes in JavaScript/TypeScript projects and provides a more portable solution than the native blake2 module. It implements the same BLAKE2b algorithm, so the cryptographic properties and output will be identical to the native version.

@maschad maschad requested a review from Copilot March 31, 2025 16:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request replaces the native Node.js C++ BLAKE2 bindings with a pure JavaScript implementation using the @noble/hashes library to improve portability and remove native dependencies.

  • Removed the native blake2 import and usage.
  • Added the @noble/hashes/blake2b implementation with the appropriate digest length configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TS Sdk has a hashing bug due to which it gives error while using it

1 participant