- passphrase
Utilities for converting keys to passphrases using bip39 or niceware
- DEFAULT_SEED_SIZE :
number Default seed size in bytes.
- hmac(message, key) ⇒
Uint8Array Implementation of HMAC SHA512 from https://github.com/dchest/tweetnacl-auth-js
- getHKDF(ikm, info, extractLength, [salt]) ⇒
Uint8Array Returns HKDF output according to rfc5869 using sha512
- getSeed([size]) ⇒
Uint8Array Generates a random seed.
- deriveSigningKeysFromSeed(seed, [salt]) ⇒
Object Derives an Ed25519 keypair given a random seed and an optional HKDF salt. Returns a nacl.sign keypair object: https://github.com/dchest/tweetnacl-js#naclsignkeypair
- uint8ToHex(arr) ⇒
string Converts Uint8Array or Buffer to a hex string.
- hexToUint8([hex]) ⇒
Uint8Array Converts hex string to a Uint8Array.
Utilities for converting keys to passphrases using bip39 or niceware
Kind: global variable
- passphrase
- .NICEWARE_32_BYTE_WORD_COUNT :
number - .BIP39_32_BYTE_WORD_COUNT :
number - .fromBytesOrHex(bytes, [useNiceware]) ⇒
string - .toBytes32(passphrase) ⇒
Uint8Array - .toHex32(passphrase) ⇒
string
- .NICEWARE_32_BYTE_WORD_COUNT :
Number of niceware words corresponding to 32 bytes
Kind: static constant of passphrase
Default: 16
Number of niceware words corresponding to 32 bytes
Kind: static constant of passphrase
Default: 24
Converts bytes to passphrase using bip39 (default) or niceware
Kind: static method of passphrase
| Param | Type | Description |
|---|---|---|
| bytes | Uint8Array | Buffer | string |
Uint8Array / Buffer / hex to convert |
| [useNiceware] | boolean |
Whether to use Niceware; defaults to false |
Converts a 32-byte passphrase to uint8array bytes. Infers whether the passphrase is bip39 or niceware based on length.
Kind: static method of passphrase
| Param | Type | Description |
|---|---|---|
| passphrase | string |
bip39/niceware phrase to convert |
Converts a 32-byte passphrase to hex. Infers whether the passphrase is bip39 or niceware based on length.
Kind: static method of passphrase
| Param | Type | Description |
|---|---|---|
| passphrase | string |
bip39/niceware phrase to convert |
Default seed size in bytes.
Kind: global constant
Default: 32
Implementation of HMAC SHA512 from https://github.com/dchest/tweetnacl-auth-js
Kind: global function
| Param | Type | Description |
|---|---|---|
| message | Uint8Array |
message to HMAC |
| key | Uint8Array |
the HMAC key |
Returns HKDF output according to rfc5869 using sha512
Kind: global function
| Param | Type | Description |
|---|---|---|
| ikm | Uint8Array |
input keying material |
| info | Uint8Array |
context-specific info |
| extractLength | number |
length of extracted output keying material in octets |
| [salt] | Uint8Array |
optional salt |
Generates a random seed.
Kind: global function
| Param | Type | Description |
|---|---|---|
| [size] | number |
seed size in bytes; defaults to 32 |
Derives an Ed25519 keypair given a random seed and an optional HKDF salt. Returns a nacl.sign keypair object: https://github.com/dchest/tweetnacl-js#naclsignkeypair
Kind: global function
| Param | Type | Description |
|---|---|---|
| seed | Uint8Array |
random seed, recommended length 32 |
| [salt] | Uint8Array |
random salt, recommended length 64 |
Converts Uint8Array or Buffer to a hex string.
Kind: global function
| Param | Type | Description |
|---|---|---|
| arr | Uint8Array | Buffer |
Uint8Array / Buffer to convert |
Converts hex string to a Uint8Array.
Kind: global function
| Param | Type | Description |
|---|---|---|
| [hex] | string |
Hex string to convert; defaults to '' |