@lucid-evolution/wallet 0.3.0 → 0.4.1
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/dist/index.cjs +22 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +22 -2
- package/package.json +7 -10
package/dist/index.cjs
CHANGED
|
@@ -44,10 +44,30 @@ var import_utils = require("@lucid-evolution/utils");
|
|
|
44
44
|
var import_core_utils = require("@lucid-evolution/core-utils");
|
|
45
45
|
|
|
46
46
|
// src/core.ts
|
|
47
|
-
var CML = __toESM(require("@
|
|
47
|
+
var CML = __toESM(require("@lucid-evolution/cml"), 1);
|
|
48
48
|
|
|
49
49
|
// src/wallet.ts
|
|
50
50
|
var import_bip39 = require("bip39");
|
|
51
|
+
|
|
52
|
+
// src/root_key.ts
|
|
53
|
+
var nodePbkdf2Sync = (() => {
|
|
54
|
+
try {
|
|
55
|
+
return globalThis.process?.getBuiltinModule?.("node:crypto")?.pbkdf2Sync;
|
|
56
|
+
} catch {
|
|
57
|
+
return void 0;
|
|
58
|
+
}
|
|
59
|
+
})();
|
|
60
|
+
var bip32RootKeyFromEntropy = (entropy, password) => {
|
|
61
|
+
if (!nodePbkdf2Sync)
|
|
62
|
+
return CML.Bip32PrivateKey.from_bip39_entropy(entropy, password);
|
|
63
|
+
const key = nodePbkdf2Sync(password, entropy, 4096, 96, "sha512");
|
|
64
|
+
key[0] &= 248;
|
|
65
|
+
key[31] &= 31;
|
|
66
|
+
key[31] |= 64;
|
|
67
|
+
return CML.Bip32PrivateKey.from_raw_bytes(key);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/wallet.ts
|
|
51
71
|
function walletFromSeed(seed, options = {}) {
|
|
52
72
|
const {
|
|
53
73
|
addressType = "Base",
|
|
@@ -59,7 +79,7 @@ function walletFromSeed(seed, options = {}) {
|
|
|
59
79
|
return 2147483648 + num;
|
|
60
80
|
}
|
|
61
81
|
const entropy = (0, import_bip39.mnemonicToEntropy)(seed);
|
|
62
|
-
const rootKey =
|
|
82
|
+
const rootKey = bip32RootKeyFromEntropy(
|
|
63
83
|
(0, import_core_utils.fromHex)(entropy),
|
|
64
84
|
options?.password ? new TextEncoder().encode(options.password) : new Uint8Array()
|
|
65
85
|
);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, RewardAddress, PrivateKey, KeyHash, UTxO, Network, Provider, WalletApi, Wallet } from '@lucid-evolution/core-types';
|
|
2
|
-
import * as CML from '@
|
|
2
|
+
import * as CML from '@lucid-evolution/cml';
|
|
3
3
|
|
|
4
4
|
type FromSeed = {
|
|
5
5
|
address: Address;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, RewardAddress, PrivateKey, KeyHash, UTxO, Network, Provider, WalletApi, Wallet } from '@lucid-evolution/core-types';
|
|
2
|
-
import * as CML from '@
|
|
2
|
+
import * as CML from '@lucid-evolution/cml';
|
|
3
3
|
|
|
4
4
|
type FromSeed = {
|
|
5
5
|
address: Address;
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,30 @@ import { getAddressDetails } from "@lucid-evolution/utils";
|
|
|
3
3
|
import { fromHex, withCMLScope } from "@lucid-evolution/core-utils";
|
|
4
4
|
|
|
5
5
|
// src/core.ts
|
|
6
|
-
import * as CML from "@
|
|
6
|
+
import * as CML from "@lucid-evolution/cml";
|
|
7
7
|
|
|
8
8
|
// src/wallet.ts
|
|
9
9
|
import { mnemonicToEntropy } from "bip39";
|
|
10
|
+
|
|
11
|
+
// src/root_key.ts
|
|
12
|
+
var nodePbkdf2Sync = (() => {
|
|
13
|
+
try {
|
|
14
|
+
return globalThis.process?.getBuiltinModule?.("node:crypto")?.pbkdf2Sync;
|
|
15
|
+
} catch {
|
|
16
|
+
return void 0;
|
|
17
|
+
}
|
|
18
|
+
})();
|
|
19
|
+
var bip32RootKeyFromEntropy = (entropy, password) => {
|
|
20
|
+
if (!nodePbkdf2Sync)
|
|
21
|
+
return CML.Bip32PrivateKey.from_bip39_entropy(entropy, password);
|
|
22
|
+
const key = nodePbkdf2Sync(password, entropy, 4096, 96, "sha512");
|
|
23
|
+
key[0] &= 248;
|
|
24
|
+
key[31] &= 31;
|
|
25
|
+
key[31] |= 64;
|
|
26
|
+
return CML.Bip32PrivateKey.from_raw_bytes(key);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// src/wallet.ts
|
|
10
30
|
function walletFromSeed(seed, options = {}) {
|
|
11
31
|
const {
|
|
12
32
|
addressType = "Base",
|
|
@@ -18,7 +38,7 @@ function walletFromSeed(seed, options = {}) {
|
|
|
18
38
|
return 2147483648 + num;
|
|
19
39
|
}
|
|
20
40
|
const entropy = mnemonicToEntropy(seed);
|
|
21
|
-
const rootKey =
|
|
41
|
+
const rootKey = bip32RootKeyFromEntropy(
|
|
22
42
|
fromHex(entropy),
|
|
23
43
|
options?.password ? new TextEncoder().encode(options.password) : new Uint8Array()
|
|
24
44
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucid-evolution/wallet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,20 +21,17 @@
|
|
|
21
21
|
"keywords": [],
|
|
22
22
|
"author": "",
|
|
23
23
|
"license": "MIT",
|
|
24
|
-
"browser": {
|
|
25
|
-
"@anastasia-labs/cardano-multiplatform-lib-nodejs": "@anastasia-labs/cardano-multiplatform-lib-browser"
|
|
26
|
-
},
|
|
27
24
|
"dependencies": {
|
|
28
|
-
"@anastasia-labs/cardano-multiplatform-lib-browser": "6.2.0-1",
|
|
29
|
-
"@anastasia-labs/cardano-multiplatform-lib-nodejs": "6.2.0-1",
|
|
30
25
|
"bip39": "^3.1.0",
|
|
31
|
-
"@lucid-evolution/core-types": "0.
|
|
32
|
-
"@lucid-evolution/core-utils": "0.1
|
|
33
|
-
"@lucid-evolution/
|
|
34
|
-
"@lucid-evolution/
|
|
26
|
+
"@lucid-evolution/core-types": "0.5.1",
|
|
27
|
+
"@lucid-evolution/core-utils": "0.2.1",
|
|
28
|
+
"@lucid-evolution/cml": "0.1.1",
|
|
29
|
+
"@lucid-evolution/sign_data": "0.2.1",
|
|
30
|
+
"@lucid-evolution/utils": "0.2.1"
|
|
35
31
|
},
|
|
36
32
|
"devDependencies": {
|
|
37
33
|
"@types/node": "^20.12.8",
|
|
34
|
+
"effect": "^3.12.7",
|
|
38
35
|
"tsup": "^8.0.2",
|
|
39
36
|
"typescript": "^5.4.5",
|
|
40
37
|
"vitest": "^2.1.8"
|