diff --git a/packages/sdk38/src/secp256k1wallet.ts b/packages/sdk38/src/secp256k1wallet.ts index c12382c8..ab50b477 100644 --- a/packages/sdk38/src/secp256k1wallet.ts +++ b/packages/sdk38/src/secp256k1wallet.ts @@ -12,7 +12,7 @@ import { xchacha20NonceLength, Xchacha20poly1305Ietf, } from "@cosmjs/crypto"; -import { fromBase64, fromHex, fromUtf8, toAscii, toBase64, toHex, toUtf8 } from "@cosmjs/encoding"; +import { fromBase64, fromHex, fromUtf8, toBase64, toHex, toUtf8 } from "@cosmjs/encoding"; import { assert, isNonNullObject } from "@cosmjs/utils"; import { rawSecp256k1PubkeyToAddress } from "./address"; @@ -21,6 +21,7 @@ import { StdSignature } from "./types"; import { AccountData, Algo, + cosmjsSalt, executeKdf, KdfConfiguration, makeCosmoshubPath, @@ -31,13 +32,6 @@ import { const serializationTypeV1 = "secp256k1wallet-v1"; -/** - * A fixed salt is chosen to archive a deterministic password to key derivation. - * This reduces the scope of a potential rainbow attack to all CosmJS users. - * Must be 16 bytes due to implementation limitations. - */ -const cosmjsSalt = toAscii("The CosmJS salt."); - /** * A KDF configuration that is not very strong but can be used on the main thread. * It takes about 1 second in Node.js 12.15 and should have similar runtimes in other modern Wasm hosts. diff --git a/packages/sdk38/src/wallet.ts b/packages/sdk38/src/wallet.ts index d7b43262..7378636b 100644 --- a/packages/sdk38/src/wallet.ts +++ b/packages/sdk38/src/wallet.ts @@ -59,7 +59,7 @@ export function makeCosmoshubPath(a: number): readonly Slip10RawIndex[] { * This reduces the scope of a potential rainbow attack to all CosmJS users. * Must be 16 bytes due to implementation limitations. */ -const cosmjsSalt = toAscii("The CosmJS salt."); +export const cosmjsSalt = toAscii("The CosmJS salt."); export interface KdfConfiguration { /** diff --git a/packages/sdk38/types/wallet.d.ts b/packages/sdk38/types/wallet.d.ts index 19fe5696..8075062c 100644 --- a/packages/sdk38/types/wallet.d.ts +++ b/packages/sdk38/types/wallet.d.ts @@ -23,6 +23,12 @@ export declare function prehash(bytes: Uint8Array, type: PrehashType): Uint8Arra * with 0-based account index `a`. */ export declare function makeCosmoshubPath(a: number): readonly Slip10RawIndex[]; +/** + * A fixed salt is chosen to archive a deterministic password to key derivation. + * This reduces the scope of a potential rainbow attack to all CosmJS users. + * Must be 16 bytes due to implementation limitations. + */ +export declare const cosmjsSalt: Uint8Array; export interface KdfConfiguration { /** * An algorithm identifier, such as "argon2id" or "scrypt".