@otoplo/wallet-common 0.1.4 → 0.1.6
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 -140
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/seed.ts +5 -3
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";
|
|
@@ -14,7 +13,10 @@ export function isMnemonicValid(mnemonic: string): boolean {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
async function deriveKey(password: string, salt: Uint8Array): Promise<Uint8Array> {
|
|
17
|
-
|
|
16
|
+
const start = performance.now();
|
|
17
|
+
const key = await argon2idAsync(password, salt, { t: 2, m: 19456, p: 1, dkLen: 32 });
|
|
18
|
+
console.log(performance.now() - start);
|
|
19
|
+
return key;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export async function encryptMnemonic(phrase: string, password: string): Promise<string> {
|