mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Reuse cosmjsSalt from wallet.ts
This commit is contained in:
parent
0ea2babd74
commit
e949d92097
@ -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.
|
||||
|
@ -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 {
|
||||
/**
|
||||
|
6
packages/sdk38/types/wallet.d.ts
vendored
6
packages/sdk38/types/wallet.d.ts
vendored
@ -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".
|
||||
|
Loading…
x
Reference in New Issue
Block a user