Skip to content
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

web-client: Enable HD wallet key derivation #2715

Open
wants to merge 16 commits into
base: albatross
Choose a base branch
from

Conversation

sisou
Copy link
Member

@sisou sisou commented Jun 27, 2024

Add classes/structs and methods to support HD wallet key derivation as was possible with the core-js library.

  • Review of encryption/decryption methods by @paberr and/or @hrxi for best practices
  • Move of CryptoUtils/hashing methods into their own worker so they don't block the main thread

@sisou sisou added WASM pow-compatibility Changes that ensure components are compatible with the PoW JS implementation. labels Jun 27, 2024
@sisou sisou requested a review from paberr June 27, 2024 16:53
@sisou sisou self-assigned this Jun 27, 2024
@sisou sisou force-pushed the soeren/web-client-key-derivation branch 4 times, most recently from 182d489 to 8d5d3a1 Compare July 11, 2024 16:11
@sisou sisou marked this pull request as ready for review July 11, 2024 16:11
@sisou sisou force-pushed the soeren/web-client-key-derivation branch from 8d5d3a1 to a3474e8 Compare July 11, 2024 21:33
Copy link
Member

@Eligioo Eligioo left a comment

Choose a reason for hiding this comment

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

Halfway through the review, already some comments.

key-derivation/src/lib.rs Outdated Show resolved Hide resolved
let rounds = 2u32.pow(rounds_log as u32);

match version {
1 => unimplemented!(),
Copy link
Member

Choose a reason for hiding this comment

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

Are we going to fully discard older versions?

Copy link
Member Author

Choose a reason for hiding this comment

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

The older versions use a KDF OTP function that core-rs-albatross no longer implements.

web-client/example/README.md Show resolved Hide resolved
@sisou sisou force-pushed the soeren/web-client-key-derivation branch 8 times, most recently from 59fabbf to afa49dd Compare October 16, 2024 15:07
That way these classes can be tree-shaken and do not blow up WASM size when not used.

Move CryptoUtils.otpKdf function into an auto-spawning worker, so it doesn't block the main thread, as it usually takes a few seconds to run, other than the other methods on the class.
Copied the relevant tests from core-js.
Wrapping String.prototype.isWellFormed or a replacement taken from the official polyfill.
@sisou sisou force-pushed the soeren/web-client-key-derivation branch from afa49dd to 3103f08 Compare October 16, 2024 15:10
sisou added a commit that referenced this pull request Oct 18, 2024
`wasm-pack build` runs wasm-opt automatically, which currently fails for an unknown reason.

The wasm tests are run with `wasm-pack test`, which compiles to a debug target and doesn't use wasm-opt, so doesn't trigger the problem.

The actual build will be tested as part of PR #2715.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pow-compatibility Changes that ensure components are compatible with the PoW JS implementation. WASM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants