Skip to content

Commit db999f5

Browse files
authored
Remove scream test around argon2 call (#1941)
2 parents 8e86c0f + 8b72a4d commit db999f5

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ and this project adheres to
1313
@noble/hashes and @scure/bip39 to v2. ([#1935])
1414
- @cosmjs/crypto: Use pure-JS implementation of Argon2id from @noble/hashes.
1515
([#1938])
16+
- @cosmjs/amino, @cosmjs/proto-signing: Remove scream test around argon2 call in
17+
wallet serialization/deserialization which is not needed anymore after
18+
[#1938].
1619

1720
[#1935]: https://github.com/cosmos/cosmjs/pull/1935
1821
[#1938]: https://github.com/cosmos/cosmjs/issues/1938

packages/amino/src/wallet.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
Xchacha20poly1305Ietf,
77
} from "@cosmjs/crypto";
88
import { toAscii } from "@cosmjs/encoding";
9-
import { sleep } from "@cosmjs/utils";
109

1110
/**
1211
* A fixed salt is chosen to archive a deterministic password to key derivation.
@@ -33,13 +32,7 @@ export async function executeKdf(password: string, configuration: KdfConfigurati
3332
case "argon2id": {
3433
const options = configuration.params;
3534
if (!isArgon2idOptions(options)) throw new Error("Invalid format of argon2id params");
36-
37-
// Emulate a slower implementation. The fast WASM code may get removed.
38-
// This approximates the speed of using a pure JS implementation (@noble/hashes) in Node 22.
39-
const screamTest = sleep(options.opsLimit * 250);
40-
const result = await Argon2id.execute(password, cosmjsSalt, options);
41-
await screamTest;
42-
return result;
35+
return await Argon2id.execute(password, cosmjsSalt, options);
4336
}
4437
default:
4538
throw new Error("Unsupported KDF algorithm");

packages/proto-signing/src/wallet.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
Xchacha20poly1305Ietf,
77
} from "@cosmjs/crypto";
88
import { toAscii } from "@cosmjs/encoding";
9-
import { sleep } from "@cosmjs/utils";
109

1110
/**
1211
* A fixed salt is chosen to archive a deterministic password to key derivation.
@@ -33,13 +32,7 @@ export async function executeKdf(password: string, configuration: KdfConfigurati
3332
case "argon2id": {
3433
const options = configuration.params;
3534
if (!isArgon2idOptions(options)) throw new Error("Invalid format of argon2id params");
36-
37-
// Emulate a slower implementation. The fast WASM code may get removed.
38-
// This approximates the speed of using a pure JS implementation (@noble/hashes) in Node 22.
39-
const screamTest = sleep(options.opsLimit * 250);
40-
const result = await Argon2id.execute(password, cosmjsSalt, options);
41-
await screamTest;
42-
return result;
35+
return await Argon2id.execute(password, cosmjsSalt, options);
4336
}
4437
default:
4538
throw new Error("Unsupported KDF algorithm");

0 commit comments

Comments
 (0)