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

feat: add lumos crypto.randomBytes to replace node's #701

Merged
merged 15 commits into from
Jun 6, 2024

Conversation

twhy
Copy link
Contributor

@twhy twhy commented May 30, 2024

Description

  1. Add ckb-lumos/crypto package which has a randomBytes method to replace node crypto.randomBytes.
  2. export ckb-lumos/crypto in ckb-lumos/lumos

Type of change

  • New feature (non-breaking change which adds functionality)
  • Refactor (non-breaking change)

How Has This Been Tested?

Unit tests

Copy link

vercel bot commented May 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
lumos-website ✅ Ready (Inspect) Visit Preview Jun 6, 2024 6:09am

Copy link

codecov bot commented May 30, 2024

Codecov Report

Attention: Patch coverage is 91.17647% with 3 lines in your changes missing coverage. Please review.

Project coverage is 87.06%. Comparing base (8d11c75) to head (57977b8).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #701      +/-   ##
===========================================
+ Coverage    85.67%   87.06%   +1.38%     
===========================================
  Files          131      132       +1     
  Lines        25247    25246       -1     
  Branches      2663     2738      +75     
===========================================
+ Hits         21631    21981     +350     
+ Misses        3576     3225     -351     
  Partials        40       40              
Files Coverage Δ
packages/crypto/src/index.ts 100.00% <100.00%> (ø)
packages/debugger/src/context.ts 92.51% <100.00%> (-0.04%) ⬇️
packages/debugger/src/executor.ts 97.93% <100.00%> (+0.02%) ⬆️
packages/hd/src/keystore.ts 91.69% <100.00%> (+0.06%) ⬆️
packages/hd/src/mnemonic/index.ts 34.97% <75.00%> (+0.21%) ⬆️

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d11c75...57977b8. Read the comment docs.

packages/codec/tests/bytes-like.test.ts Outdated Show resolved Hide resolved
.github/.codecov.yml Outdated Show resolved Hide resolved
packages/crypto/package.json Outdated Show resolved Hide resolved
packages/crypto/src/index.ts Outdated Show resolved Hide resolved
packages/crypto/src/index.ts Outdated Show resolved Hide resolved
.github/.codecov.yml Outdated Show resolved Hide resolved
@twhy
Copy link
Contributor Author

twhy commented Jun 6, 2024

@homura Can this PR be merged into develop ?

@homura
Copy link
Collaborator

homura commented Jun 6, 2024

Can this PR be merged into develop ?

Not yet. We'll publish 0.23 first

@twhy
Copy link
Contributor Author

twhy commented Jun 6, 2024

Can this PR be merged into develop ?

Not yet. We'll publish 0.23 first

Let's merge this and move forward.

@homura
Copy link
Collaborator

homura commented Jun 6, 2024

Let's merge this and move forward.

Maybe it's better to target this PR to the 'browser-compatibility' branch first until the node modules, such as 'buffer' and 'crypto', are fully dropped. Then, check if it works properly with Vite, CRA, and Next.js.

@twhy
Copy link
Contributor Author

twhy commented Jun 6, 2024

The plan is to replace Node crypto first, then replace Buffer with Uint8Array

Now the first PR is done, and it's safe to merge it. The second is ready locally.

metioned in #645
image

@twhy twhy marked this pull request as draft June 6, 2024 09:10
@twhy twhy marked this pull request as ready for review June 6, 2024 09:11
@twhy twhy changed the base branch from develop to browser June 6, 2024 09:11
@twhy
Copy link
Contributor Author

twhy commented Jun 6, 2024

Let's merge this and move forward.

Maybe it's better to target this PR to the 'browser-compatibility' branch first until the node modules, such as 'buffer' and 'crypto', are fully dropped. Then, check if it works properly with Vite, CRA, and Next.js.

I will merge this PR into a newly created branch browser first.

@twhy twhy merged commit d4c2cba into browser Jun 6, 2024
8 checks passed
@twhy twhy deleted the replace-node-crypto-randomBytes branch June 6, 2024 09:15
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