Skip to content

Commit d4c2cba

Browse files
authored
Merge pull request #701 from ckb-js/replace-node-crypto-randomBytes
feat: add lumos crypto.randomBytes to replace node's
2 parents 8d11c75 + 57977b8 commit d4c2cba

38 files changed

+198
-51
lines changed

.changeset/tough-beers-roll.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@ckb-lumos/crypto": minor
3+
"@ckb-lumos/lumos": minor
4+
---
5+
6+
feat: add crypto.randomBytes to replace Node's crypto.randomBytes

.github/.codecov.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ coverage:
1212
target: auto
1313
threshold: 1%
1414
base: auto
15+
patch:
16+
default:
17+
# basic settings
18+
target: auto
19+
threshold: 1%
20+
base: auto
1521

1622
parsers:
1723
gcov:

.github/workflows/ci.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ jobs:
99
- uses: pnpm/action-setup@v2
1010
with:
1111
version: 8.6.1
12-
- uses: actions/setup-node@v3
12+
- uses: actions/setup-node@v4
1313
with:
1414
cache: "pnpm"
15+
node-version: '18'
1516

1617
- name: Install project dependencies and build
1718
run: |
@@ -38,9 +39,10 @@ jobs:
3839
- uses: pnpm/action-setup@v2
3940
with:
4041
version: 8.6.1
41-
- uses: actions/setup-node@v3
42+
- uses: actions/setup-node@v4
4243
with:
4344
cache: "pnpm"
45+
node-version: '18'
4446

4547
- name: Install project dependencies and build
4648
run: |
@@ -60,7 +62,7 @@ jobs:
6062
- uses: pnpm/action-setup@v2
6163
with:
6264
version: 8.6.1
63-
- uses: actions/setup-node@v3
65+
- uses: actions/setup-node@v4
6466
with:
6567
cache: "pnpm"
6668

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const scopeEnumValues = [
22
"base",
33
"bi",
4+
"crypto",
45
"ckb-indexer",
56
"common-scripts",
67
"config-manager",

packages/ckb-indexer/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"events": "^3.3.0"
2929
},
3030
"devDependencies": {
31+
"@ckb-lumos/crypto": "0.23.0",
3132
"@ckb-lumos/testkit": "0.23.0",
3233
"@types/lodash.uniqby": "^4.7.7",
3334
"@types/request": "^2.48.8",

packages/ckb-indexer/tests/transaction_collector.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { randomBytes } from "crypto";
21
import test from "ava";
2+
import { randomBytes } from "@ckb-lumos/crypto";
33
import { Indexer, TransactionCollector } from "../src";
44
import {
55
indexerTransactionListThatHaveOneIoTypeInput,

packages/codec/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
]
4646
},
4747
"devDependencies": {
48+
"@ckb-lumos/crypto": "0.23.0",
4849
"escape-string-regexp": "^4.0.0",
4950
"js-yaml": "^4.1.0"
5051
}

packages/codec/tests/bytes-like.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import test from "ava";
22
import { molecule, number } from "../src";
33
import { Byte32 } from "../src/blockchain";
4-
import { randomBytes } from "crypto";
4+
import { randomBytes } from "@ckb-lumos/crypto";
55
import { equal, concat, hexify } from "../src/bytes";
66
import { BI } from "@ckb-lumos/bi";
77
import { bytify } from "../lib/bytes";

packages/common-scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
]
5656
},
5757
"devDependencies": {
58+
"@ckb-lumos/crypto": "0.23.0",
5859
"@ckb-lumos/debugger": "0.23.0",
5960
"@ckb-lumos/hd": "0.23.0",
6061
"@types/keccak": "^3.0.1",

packages/common-scripts/tests/dao-with-custom-lock.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { dao } from "../src";
1313
import { Config, predefined } from "@ckb-lumos/config-manager";
1414
import { hexify } from "@ckb-lumos/codec/lib/bytes";
1515
import { Uint64 } from "@ckb-lumos/codec/lib/number";
16-
import { randomBytes } from "node:crypto";
16+
import { randomBytes } from "@ckb-lumos/crypto";
1717

1818
const { LINA } = predefined;
1919

0 commit comments

Comments
 (0)