Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ and this project adheres to
@noble/hashes and @scure/bip39 to v2. ([#1935])
- @cosmjs/crypto: Use pure-JS implementation of Argon2id from @noble/hashes.
([#1938])
- @cosmjs/amino, @cosmjs/proto-signing: Remove scream test around argon2 call in
wallet serialization/deserialization which is not needed anymore after
[#1938].

[#1935]: https://github.com/cosmos/cosmjs/pull/1935
[#1938]: https://github.com/cosmos/cosmjs/issues/1938
Expand Down
9 changes: 1 addition & 8 deletions packages/amino/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
Xchacha20poly1305Ietf,
} from "@cosmjs/crypto";
import { toAscii } from "@cosmjs/encoding";
import { sleep } from "@cosmjs/utils";

/**
* A fixed salt is chosen to archive a deterministic password to key derivation.
Expand All @@ -33,13 +32,7 @@ export async function executeKdf(password: string, configuration: KdfConfigurati
case "argon2id": {
const options = configuration.params;
if (!isArgon2idOptions(options)) throw new Error("Invalid format of argon2id params");

// Emulate a slower implementation. The fast WASM code may get removed.
// This approximates the speed of using a pure JS implementation (@noble/hashes) in Node 22.
const screamTest = sleep(options.opsLimit * 250);
const result = await Argon2id.execute(password, cosmjsSalt, options);
await screamTest;
return result;
return await Argon2id.execute(password, cosmjsSalt, options);
}
default:
throw new Error("Unsupported KDF algorithm");
Expand Down
9 changes: 1 addition & 8 deletions packages/proto-signing/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
Xchacha20poly1305Ietf,
} from "@cosmjs/crypto";
import { toAscii } from "@cosmjs/encoding";
import { sleep } from "@cosmjs/utils";

/**
* A fixed salt is chosen to archive a deterministic password to key derivation.
Expand All @@ -33,13 +32,7 @@ export async function executeKdf(password: string, configuration: KdfConfigurati
case "argon2id": {
const options = configuration.params;
if (!isArgon2idOptions(options)) throw new Error("Invalid format of argon2id params");

// Emulate a slower implementation. The fast WASM code may get removed.
// This approximates the speed of using a pure JS implementation (@noble/hashes) in Node 22.
const screamTest = sleep(options.opsLimit * 250);
const result = await Argon2id.execute(password, cosmjsSalt, options);
await screamTest;
return result;
return await Argon2id.execute(password, cosmjsSalt, options);
}
default:
throw new Error("Unsupported KDF algorithm");
Expand Down
Loading