mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Improve Bip39.encode docs
This commit is contained in:
parent
1ae9ac2e4c
commit
325a28d8ec
@ -6,6 +6,21 @@ import * as unorm from "unorm";
|
||||
import { EnglishMnemonic } from "./englishmnemonic";
|
||||
|
||||
export class Bip39 {
|
||||
/**
|
||||
* Encodes raw entropy of length 16, 20, 24, 28 or 32 bytes as an English mnemonic between 12 and 24 words.
|
||||
*
|
||||
* | Entropy | Words |
|
||||
* |--------------------|-------|
|
||||
* | 128 bit (16 bytes) | 12 |
|
||||
* | 160 bit (20 bytes) | 15 |
|
||||
* | 192 bit (24 bytes) | 18 |
|
||||
* | 224 bit (28 bytes) | 21 |
|
||||
* | 256 bit (32 bytes) | 24 |
|
||||
*
|
||||
*
|
||||
* @see https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#generating-the-mnemonic
|
||||
* @param entropy The entropy to be encoded. This must be cryptographically secure.
|
||||
*/
|
||||
public static encode(entropy: Uint8Array): EnglishMnemonic {
|
||||
const allowedEntropyLengths: readonly number[] = [16, 20, 24, 28, 32];
|
||||
|
||||
|
15
packages/crypto/types/bip39.d.ts
vendored
15
packages/crypto/types/bip39.d.ts
vendored
@ -1,5 +1,20 @@
|
||||
import { EnglishMnemonic } from "./englishmnemonic";
|
||||
export declare class Bip39 {
|
||||
/**
|
||||
* Encodes raw entropy of length 16, 20, 24, 28 or 32 bytes as an English mnemonic between 12 and 24 words.
|
||||
*
|
||||
* | Entropy | Words |
|
||||
* |--------------------|-------|
|
||||
* | 128 bit (16 bytes) | 12 |
|
||||
* | 160 bit (20 bytes) | 15 |
|
||||
* | 192 bit (24 bytes) | 18 |
|
||||
* | 224 bit (28 bytes) | 21 |
|
||||
* | 256 bit (32 bytes) | 24 |
|
||||
*
|
||||
*
|
||||
* @see https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#generating-the-mnemonic
|
||||
* @param entropy The entropy to be encoded. This must be cryptographically secure.
|
||||
*/
|
||||
static encode(entropy: Uint8Array): EnglishMnemonic;
|
||||
static decode(mnemonic: EnglishMnemonic): Uint8Array;
|
||||
static mnemonicToSeed(mnemonic: EnglishMnemonic, password?: string): Promise<Uint8Array>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user