@tevm/voltaire / crypto/Bip39
crypto/Bip39
Classes
Bip39Error
Defined in: src/crypto/Bip39/errors.js:21 Base error for BIP-39 operationsSee
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Extends
Extended by
Constructors
Constructor
new Bip39Error(Defined in: src/crypto/Bip39/errors.js:26message?,options?):Bip39Error
Parameters
message?
string
options?
cause?
Error
code?
string
context?
Record<string, unknown>
docsPath?
string
Returns
Bip39Error
Overrides
CryptoError.constructor
Properties
cause?
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)optionalcause:Error
Inherited from
CryptoError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39
Machine-readable error code for programmatic handling
Example
Inherited from
CryptoError.code
context?
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debuggingoptionalcontext:Record<string,unknown>
Example
Inherited from
CryptoError.context
docsPath?
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this erroroptionaldocsPath:string
Example
Inherited from
CryptoError.docsPath
name
name: string
Defined in: src/crypto/Bip39/errors.js:33
Inherited from
CryptoError.name
Methods
getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94
Get full error chain as string for logging
Returns
string
Inherited from
CryptoError.getErrorChain
toJSON()
toJSON():Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetryRecord<string,unknown>
Returns
Record<string, unknown>
Inherited from
CryptoError.toJSON
InvalidEntropyError
Defined in: src/crypto/Bip39/errors.js:87 Error thrown when entropy is invalidSee
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Extends
Constructors
Constructor
new InvalidEntropyError(Defined in: src/crypto/Bip39/errors.js:92message?,options?):InvalidEntropyError
Parameters
message?
string
options?
cause?
Error
code?
string
context?
Record<string, unknown>
docsPath?
string
Returns
InvalidEntropyError
Overrides
Bip39Error.constructor
Properties
cause?
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)optionalcause:Error
Inherited from
Bip39Error.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39
Machine-readable error code for programmatic handling
Example
Inherited from
Bip39Error.code
context?
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debuggingoptionalcontext:Record<string,unknown>
Example
Inherited from
Bip39Error.context
docsPath?
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this erroroptionaldocsPath:string
Example
Inherited from
Bip39Error.docsPath
name
name: string
Defined in: src/crypto/Bip39/errors.js:99
Inherited from
Bip39Error.name
Methods
getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94
Get full error chain as string for logging
Returns
string
Inherited from
Bip39Error.getErrorChain
toJSON()
toJSON():Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetryRecord<string,unknown>
Returns
Record<string, unknown>
Inherited from
Bip39Error.toJSON
InvalidMnemonicError
Defined in: src/crypto/Bip39/errors.js:53 Error thrown when mnemonic is invalidSee
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Extends
Constructors
Constructor
new InvalidMnemonicError(Defined in: src/crypto/Bip39/errors.js:58message?,options?):InvalidMnemonicError
Parameters
message?
string
options?
cause?
Error
code?
string
context?
Record<string, unknown>
docsPath?
string
Returns
InvalidMnemonicError
Overrides
InvalidFormatError.constructor
Properties
cause?
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)optionalcause:Error
Inherited from
InvalidFormatError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39
Machine-readable error code for programmatic handling
Example
Inherited from
InvalidFormatError.code
context?
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debuggingoptionalcontext:Record<string,unknown>
Example
Inherited from
InvalidFormatError.context
docsPath?
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this erroroptionaldocsPath:string
Example
Inherited from
InvalidFormatError.docsPath
expected
expected: string
Defined in: src/primitives/errors/ValidationError.ts:19
Inherited from
InvalidFormatError.expected
name
name: string
Defined in: src/crypto/Bip39/errors.js:67
Inherited from
InvalidFormatError.name
value
value: unknown
Defined in: src/primitives/errors/ValidationError.ts:18
Inherited from
InvalidFormatError.value
Methods
getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94
Get full error chain as string for logging
Returns
string
Inherited from
InvalidFormatError.getErrorChain
toJSON()
toJSON():Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetryRecord<string,unknown>
Returns
Record<string, unknown>
Inherited from
InvalidFormatError.toJSON
Type Aliases
Entropy
Entropy = Uint8Array
Defined in: src/crypto/Bip39/EntropyType.ts:13
Entropy bytes for BIP-39 mnemonic generation
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Mnemonic
Mnemonic = string
Defined in: src/crypto/Bip39/MnemonicType.ts:13
BIP-39 mnemonic phrase (12-24 words)
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Seed
Seed = Uint8Array
Defined in: src/crypto/Bip39/SeedType.ts:13
BIP-39 seed (64 bytes / 512 bits)
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Variables
Bip39
Defined in: src/crypto/Bip39/Bip39.js:59 BIP-39 Mnemonic Implementation Provides mnemonic generation, validation, and seed derivation following the BIP-39 standard for deterministic key generation.constBip39:object
Type Declaration
assertValidMnemonic()
assertValidMnemonic: (Validate mnemonic or throw errormnemonic,wl?) =>void
Parameters
mnemonic
string
Mnemonic phrase to validate
wl?
string[] = wordlist
Optional wordlist (defaults to English)
Returns
void
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If mnemonic is invalidExample
ENTROPY_128
ENTROPY_128: number
128 bits entropy = 12 words
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
ENTROPY_160
ENTROPY_160: number
160 bits entropy = 15 words
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
ENTROPY_192
ENTROPY_192: number
192 bits entropy = 18 words
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
ENTROPY_224
ENTROPY_224: number
224 bits entropy = 21 words
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
ENTROPY_256
ENTROPY_256: number
256 bits entropy = 24 words
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
entropyToMnemonic()
entropyToMnemonic: (Generate mnemonic from custom entropyentropy,wl?) =>string
Parameters
entropy
Entropy
Entropy bytes (16, 20, 24, 28, or 32 bytes)
wl?
string[] = wordlist
Optional wordlist (defaults to English)
Returns
string
Mnemonic phrase
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If entropy size is invalidThrows
If conversion failsExample
generateMnemonic()
generateMnemonic: (Generate a BIP-39 mnemonic phrasestrength?,wl?) =>string
Parameters
strength?
Entropy strength in bits (128=12 words, 256=24 words)128 | 160 | 192 | 224 | 256
wl?
string[] = wordlist
Optional wordlist (defaults to English)
Returns
string
Mnemonic phrase
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If mnemonic generation failsExample
getEntropyBits()
getEntropyBits: (Get entropy bits from word countwordCount) =>number
Parameters
wordCount
number
Number of words
Returns
number
Entropy in bits
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If word count is invalidExample
getWordCount()
getWordCount: (Get word count from entropy bitsentropyBits) =>number
Parameters
entropyBits
number
Entropy in bits
Returns
number
Number of words in mnemonic
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If entropy bits value is invalidExample
mnemonicToSeed()
mnemonicToSeed: (Convert mnemonic to seed (async)mnemonic,passphrase?) =>Promise<Seed>
Parameters
mnemonic
string
BIP-39 mnemonic phrase
passphrase?
string = ""
Optional passphrase for additional security
Returns
Promise<Seed>
64-byte seed
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If mnemonic is invalidThrows
If seed derivation failsExample
mnemonicToSeedSync()
mnemonicToSeedSync: (Convert mnemonic to seed (sync)mnemonic,passphrase?) =>Seed
Parameters
mnemonic
string
BIP-39 mnemonic phrase
passphrase?
string = ""
Optional passphrase for additional security
Returns
Seed
64-byte seed
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If mnemonic is invalidThrows
If seed derivation failsExample
SEED_LENGTH
SEED_LENGTH: number
BIP-39 seed length (512 bits / 64 bytes)
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
validateMnemonic()
validateMnemonic: (Validate a BIP-39 mnemonic phrasemnemonic,wl?) =>boolean
Parameters
mnemonic
string
Mnemonic phrase to validate
wl?
string[] = wordlist
Optional wordlist (defaults to English)
Returns
boolean
True if valid, false otherwise
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Example
ENTROPY_128
Defined in: src/crypto/Bip39/constants.js:13 128 bits entropy = 12 wordsconstENTROPY_128:128=128
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
ENTROPY_160
Defined in: src/crypto/Bip39/constants.js:27 160 bits entropy = 15 wordsconstENTROPY_160:160=160
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
ENTROPY_192
Defined in: src/crypto/Bip39/constants.js:41 192 bits entropy = 18 wordsconstENTROPY_192:192=192
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
ENTROPY_224
Defined in: src/crypto/Bip39/constants.js:55 224 bits entropy = 21 wordsconstENTROPY_224:224=224
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
ENTROPY_256
Defined in: src/crypto/Bip39/constants.js:69 256 bits entropy = 24 wordsconstENTROPY_256:256=256
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
SEED_LENGTH
Defined in: src/crypto/Bip39/constants.js:84 BIP-39 seed length (512 bits / 64 bytes)constSEED_LENGTH:64=64
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Functions
assertValidMnemonic()
assertValidMnemonic(Defined in: src/crypto/Bip39/assertValidMnemonic.js:24 Validate mnemonic or throw errormnemonic,wl?):void
Parameters
mnemonic
string
Mnemonic phrase to validate
wl?
string[] = wordlist
Optional wordlist (defaults to English)
Returns
void
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If mnemonic is invalidExample
entropyToMnemonic()
entropyToMnemonic(Defined in: src/crypto/Bip39/entropyToMnemonic.js:22 Generate mnemonic from custom entropyentropy,wl?):string
Parameters
entropy
Entropy
Entropy bytes (16, 20, 24, 28, or 32 bytes)
wl?
string[] = wordlist
Optional wordlist (defaults to English)
Returns
string
Mnemonic phrase
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If entropy size is invalidThrows
If conversion failsExample
generateMnemonic()
generateMnemonic(Defined in: src/crypto/Bip39/generateMnemonic.js:23 Generate a BIP-39 mnemonic phrasestrength?,wl?):string
Parameters
strength?
Entropy strength in bits (128=12 words, 256=24 words)128 | 160 | 192 | 224 | 256
wl?
string[] = wordlist
Optional wordlist (defaults to English)
Returns
string
Mnemonic phrase
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If mnemonic generation failsExample
getEntropyBits()
getEntropyBits(Defined in: src/crypto/Bip39/getEntropyBits.js:18 Get entropy bits from word countwordCount):number
Parameters
wordCount
number
Number of words
Returns
number
Entropy in bits
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If word count is invalidExample
getWordCount()
getWordCount(Defined in: src/crypto/Bip39/getWordCount.js:18 Get word count from entropy bitsentropyBits):number
Parameters
entropyBits
number
Entropy in bits
Returns
number
Number of words in mnemonic
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If entropy bits value is invalidExample
mnemonicToSeed()
mnemonicToSeed(Defined in: src/crypto/Bip39/mnemonicToSeed.js:21 Convert mnemonic to seed (async)mnemonic,passphrase?):Promise<Seed>
Parameters
mnemonic
string
BIP-39 mnemonic phrase
passphrase?
string = ""
Optional passphrase for additional security
Returns
Promise<Seed>
64-byte seed
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If mnemonic is invalidThrows
If seed derivation failsExample
mnemonicToSeedSync()
mnemonicToSeedSync(Defined in: src/crypto/Bip39/mnemonicToSeedSync.js:21 Convert mnemonic to seed (sync)mnemonic,passphrase?):Seed
Parameters
mnemonic
string
BIP-39 mnemonic phrase
passphrase?
string = ""
Optional passphrase for additional security
Returns
Seed
64-byte seed
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If mnemonic is invalidThrows
If seed derivation failsExample
validateMnemonic()
validateMnemonic(Defined in: src/crypto/Bip39/validateMnemonic.js:22 Validate a BIP-39 mnemonic phrasemnemonic,wl?):boolean
Parameters
mnemonic
string
Mnemonic phrase to validate
wl?
string[] = wordlist
Optional wordlist (defaults to English)
Returns
boolean
True if valid, false otherwise

