Skip to content

feat: bip32account bip32ed25519 dependency injection LW-12941 #1630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 30, 2025

Conversation

mkazlauskas
Copy link
Member

Context

We need to be able to replace the key derivation function, because the one that is using libsodium is performing poorly in mobile environment

Proposed Solution

Main commit: 7faaab4

Important Changes Introduced

See commit messages

for example, TransactionHash is a Hash32ByteBase16 which is a HexBlob

therefore:
let hash: TransactionHash;
let blob: HexBlob = hash; // this is valid, all hashes are hex blobs
hash = blob; // this is still invalid, not all hex blobs are hashes

in order to implement this, custom OpaqueString and OpaqueNumber
implementation was replaced with Tagged type from type-fest

BREAKING CHANGE: remove Hash28ByteBase16.fromEd25519KeyHashHex
@mkazlauskas mkazlauskas changed the title refactor: bip32account bip32ed25519 dependency injection LW-12941 feat: bip32account bip32ed25519 dependency injection LW-12941 May 29, 2025
@mkazlauskas mkazlauskas requested a review from mirceahasegan May 29, 2025 16:45
@mkazlauskas mkazlauskas force-pushed the refactor/bip32account-bip32ed25519-di branch from 63462b1 to 71a93b5 Compare May 29, 2025 16:47
@mkazlauskas mkazlauskas requested review from a team and removed request for mirceahasegan May 29, 2025 16:47
mobile (react native) applications benefit from using native modules
for cryptography; main reason for doing this is to prepare for DI

besides that, it ended up a nice code simplification, as new blake2b
interface is easier to use due to simpler API and type inference
our libsodium-based key derivation performs poorly when running in mobile

BREAKING CHANGE: add a new 'dependencies' parameter in Bip32Account ctor
implementation of those methods no longer requires them to be async
@mkazlauskas mkazlauskas force-pushed the refactor/bip32account-bip32ed25519-di branch from 71a93b5 to b56110c Compare May 29, 2025 20:34
Copy link
Member

@AngelCastilloB AngelCastilloB left a comment

Choose a reason for hiding this comment

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

Changes to Bip32Account.ts look good to me @mkazlauskas

@mkazlauskas mkazlauskas requested a review from a team May 30, 2025 05:32
Copy link
Collaborator

@mirceahasegan mirceahasegan left a comment

Choose a reason for hiding this comment

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

Great work @mkazlauskas 🚀

@mkazlauskas mkazlauskas merged commit f1b42d1 into master May 30, 2025
10 of 11 checks passed
@mkazlauskas mkazlauskas deleted the refactor/bip32account-bip32ed25519-di branch May 30, 2025 12:25
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.

3 participants