@otoplo/wallet-common 0.1.4 → 0.1.5
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.js +140 -141
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/seed.ts +3 -4
package/package.json
CHANGED
package/src/utils/seed.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { gcm } from "@noble/ciphers/aes.js";
|
|
2
|
-
import {
|
|
3
|
-
import { sha256 } from "@noble/hashes/sha2.js";
|
|
2
|
+
import { argon2idAsync } from "@noble/hashes/argon2.js";
|
|
4
3
|
import { generateMnemonic, validateMnemonic } from "@scure/bip39";
|
|
5
4
|
import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
6
5
|
import { BufferUtils } from "libnexa-ts";
|
|
@@ -13,8 +12,8 @@ export function isMnemonicValid(mnemonic: string): boolean {
|
|
|
13
12
|
return validateMnemonic(mnemonic, wordlist);
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
return
|
|
15
|
+
function deriveKey(password: string, salt: Uint8Array): Promise<Uint8Array> {
|
|
16
|
+
return argon2idAsync(password, salt, { t: 2, m: 19456, p: 1, dkLen: 32 });
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
export async function encryptMnemonic(phrase: string, password: string): Promise<string> {
|