@arcblock/did-ext 1.28.5 → 1.28.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/index.js +2 -3
- package/package.json +20 -22
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
11
|
```terminal
|
|
12
|
-
|
|
12
|
+
bun install @arcblock/did-ext
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
```javascript
|
|
@@ -17,7 +17,7 @@ const { WalletType } = require('@ocap/wallet');
|
|
|
17
17
|
const { fromAppDid } = require('@arcblock/did-ext');
|
|
18
18
|
|
|
19
19
|
const type = WalletType({ role: types.RoleType.ROLE_ACCOUNT });
|
|
20
|
-
const rootSk = '0x07abfceff5cdfb0cd164d2da98099c15b7223fc5a1b8c02c2cf1f74670c72aac27e1d28ed47cf4f2c4330a6e6e1dc0724721e80fa56177fdba926937a253fe7e';
|
|
20
|
+
const rootSk = '0x07abfceff5cdfb0cd164d2da98099c15b7223fc5a1b8c02c2cf1f74670c72aac27e1d28ed47cf4f2c4330a6e6e1dc0724721e80fa56177fdba926937a253fe7e';
|
|
21
21
|
let wallet = fromAppDid('', rootSk, type);
|
|
22
22
|
console.log(wallet.toJSON());
|
|
23
23
|
wallet = fromAppDid('zNKdqQxDUVz2YkfArfqc1CzjbX2QSNnMk1iW', rootSk, type);
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-bitwise */
|
|
2
1
|
const hdkey = require('@wangshijun/hdkey');
|
|
3
2
|
const Mcrypto = require('@ocap/mcrypto');
|
|
4
3
|
const { fromSecretKey, WalletType } = require('@ocap/wallet');
|
|
@@ -29,8 +28,8 @@ const fromAppDid = (appDid, rootSk, type = { role: types.RoleType.ROLE_ACCOUNT }
|
|
|
29
28
|
const s1 = hashSlice.slice(0, 8);
|
|
30
29
|
const s2 = hashSlice.slice(8, 16);
|
|
31
30
|
|
|
32
|
-
const n1 = parseInt(Number(`0x${s1}`), 10) & 0x7fffffff;
|
|
33
|
-
const n2 = parseInt(Number(`0x${s2}`), 10) & 0x7fffffff;
|
|
31
|
+
const n1 = Number.parseInt(Number(`0x${s1}`), 10) & 0x7fffffff;
|
|
32
|
+
const n2 = Number.parseInt(Number(`0x${s2}`), 10) & 0x7fffffff;
|
|
34
33
|
|
|
35
34
|
const seedHex = stripHexPrefix(isHexStrict(rootSk) ? rootSk : toHex(rootSk));
|
|
36
35
|
const master = hdkey.fromMasterSeed(Buffer.from(seedHex, 'hex'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/did-ext",
|
|
3
|
-
"version": "1.28.
|
|
3
|
+
"version": "1.28.7",
|
|
4
4
|
"description": "Extension to work with ArcBlock DID",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arcblock",
|
|
@@ -24,35 +24,33 @@
|
|
|
24
24
|
"files": [
|
|
25
25
|
"lib"
|
|
26
26
|
],
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"jest": "^29.7.0"
|
|
29
|
-
},
|
|
27
|
+
"devDependencies": {},
|
|
30
28
|
"repository": {
|
|
31
29
|
"type": "git",
|
|
32
30
|
"url": "git+https://github.com/ArcBlock/blockchain.git"
|
|
33
31
|
},
|
|
34
|
-
"bugs": {
|
|
35
|
-
"url": "https://github.com/ArcBlock/blockchain/issues"
|
|
36
|
-
},
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"@wangshijun/hdkey": "^2.0.5",
|
|
39
|
-
"bn.js": "^5.2.1",
|
|
40
|
-
"debug": "^4.3.6",
|
|
41
|
-
"lodash": "^4.17.21",
|
|
42
|
-
"@arcblock/did": "1.28.5",
|
|
43
|
-
"@ocap/mcrypto": "1.28.5",
|
|
44
|
-
"@ocap/util": "1.28.5",
|
|
45
|
-
"@ocap/wallet": "1.28.5"
|
|
46
|
-
},
|
|
47
32
|
"scripts": {
|
|
48
|
-
"lint": "
|
|
49
|
-
"lint:fix": "
|
|
50
|
-
"docs": "
|
|
33
|
+
"lint": "biome check",
|
|
34
|
+
"lint:fix": "biome check --write",
|
|
35
|
+
"docs": "bun run gen-dts && bun run gen-docs && bun run cleanup-docs && bun run format-docs",
|
|
51
36
|
"cleanup-docs": "node ../../scripts/cleanup-docs.js docs/README.md $npm_package_name",
|
|
52
37
|
"gen-docs": "jsdoc2md lib/index.js > docs/README.md",
|
|
53
38
|
"gen-dts": "j2d lib/index.js",
|
|
54
39
|
"format-docs": "remark . -o",
|
|
55
|
-
"test": "
|
|
40
|
+
"test": "bun test",
|
|
56
41
|
"coverage": "npm run test -- --coverage"
|
|
42
|
+
},
|
|
43
|
+
"bugs": {
|
|
44
|
+
"url": "https://github.com/ArcBlock/blockchain/issues"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@arcblock/did": "1.28.7",
|
|
48
|
+
"@ocap/mcrypto": "1.28.7",
|
|
49
|
+
"@ocap/util": "1.28.7",
|
|
50
|
+
"@ocap/wallet": "1.28.7",
|
|
51
|
+
"@wangshijun/hdkey": "^2.0.5",
|
|
52
|
+
"bn.js": "5.2.2",
|
|
53
|
+
"debug": "^4.3.6",
|
|
54
|
+
"lodash": "^4.17.21"
|
|
57
55
|
}
|
|
58
|
-
}
|
|
56
|
+
}
|