Options
All
  • Public
  • Public/Protected
  • All
Menu

Module index

Index

Type aliases

Bit

Bit: 0 | 1

Properties

ENGLISH_WORDLIST

ENGLISH_WORDLIST: string[]

Variables

Const base58

base58: BaseConverter = ...

Const secp256k1

secp256k1: ec = ...

Functions

Const bitsToBuffer

  • bitsToBuffer(bits: Bit[]): Uint8Array

Const bufferToBits

  • bufferToBits(buffer: Uint8Array): Bit[]

Const chunk

  • chunk<T>(array: T[], size: number): T[][]

Const compressPublicKey

  • compressPublicKey(publicKey: Uint8Array): Uint8Array
  • Compress a public key. This function takes both compressed and uncompressed public keys, and always returns the compressed variant.

    Parameters

    • publicKey: Uint8Array

    Returns Uint8Array

Const concat

  • concat(buffers: Uint8Array[]): Uint8Array
  • Safe function to merge multiple Uint8Arrays into a single Uint8array.

    Parameters

    • buffers: Uint8Array[]

    Returns Uint8Array

Const decodeBase58

  • decodeBase58(encoded: string): Uint8Array
  • Decode a Base58 string to a Buffer. Throws an error if the checksum is invalid.

    Parameters

    • encoded: string

    Returns Uint8Array

Const decompressPublicKey

  • decompressPublicKey(publicKey: Uint8Array): Uint8Array
  • Decompress a public key. This function takes both compressed and uncompressed public keys, and always returns the decompressed variant.

    Parameters

    • publicKey: Uint8Array

    Returns Uint8Array

Const encodeBase58

  • encodeBase58(data: Uint8Array): string
  • Encode a Buffer as Base58 string with a checksum applied.

    Parameters

    • data: Uint8Array

    Returns string

Const entropyToMnemonic

  • entropyToMnemonic(entropy: Uint8Array): string
  • Get a mnemonic phrase from pre-generated entropy. Note that the entropy should be sufficiently random in order for the mnemonic phrase to be secure.

    Parameters

    • entropy: Uint8Array

    Returns string

Const fromHex

  • fromHex(data: string): Uint8Array
  • Get a hexadecimal string as Uint8Array.

    Parameters

    • data: string

    Returns Uint8Array

Const fromUtf8

  • fromUtf8(data: string): Uint8Array
  • Get a UTF-8 encoded string as buffer.

    Parameters

    • data: string

    Returns Uint8Array

Const generateMnemonic

  • generateMnemonic(size: number): string

Const getAddress

  • getAddress(publicKey: Uint8Array): string
  • Get the Ethereum address for a public key.

    Parameters

    • publicKey: Uint8Array

    Returns string

Const getChecksum

  • getChecksum(entropy: Uint8Array): Bit[]

Const getExtendedKeyVersion

Const getFingerprint

  • getFingerprint(publicKey: Uint8Array): number
  • Get the fingerprint from a public key.

    Parameters

    • publicKey: Uint8Array

    Returns number

Const getIndex

  • getIndex(level: string): number

Const getMnemonicWord

  • getMnemonicWord(bits: Bit[]): string

Const getPublicKey

  • getPublicKey(privateKey: Uint8Array): Uint8Array
  • Get the public key for a private key.

    Parameters

    • privateKey: Uint8Array

    Returns Uint8Array

Const getRandomBytes

  • getRandomBytes(length: number): Uint8Array

Const hmacSHA512

  • hmacSHA512(key: Uint8Array, buffer: Uint8Array): Uint8Array
  • Hash a buffer with provided key using HMAC-SHA512.

    Parameters

    • key: Uint8Array
    • buffer: Uint8Array

    Returns Uint8Array

Const isExtendedKey

  • isExtendedKey(extendedKey: string): boolean

Const isValidMnemonic

  • isValidMnemonic(mnemonic: string): boolean

Const keccak256

  • keccak256(input: string | number | bigint | ArrayBufferLike | number[]): Uint8Array
  • Returns the Keccak-256 hash of a string, as a hexadecimal string.

    Parameters

    • input: string | number | bigint | ArrayBufferLike | number[]

    Returns Uint8Array

Const mnemonicToEntropy

  • mnemonicToEntropy(mnemonic: string): Uint8Array
  • Get the initial entropy from a mnemonic phrase. Throws an error if the mnemonic phrase is invalid.

    Parameters

    • mnemonic: string

    Returns Uint8Array

Const mnemonicToSeed

  • mnemonicToSeed(mnemonic: string, passphrase?: string): Uint8Array
  • Derive a seed from a mnemonic phrase. This does not validate if a mnemonic phrase is valid.

    Parameters

    • mnemonic: string
    • Optional passphrase: string

    Returns Uint8Array

Const numberToBuffer

  • numberToBuffer(data: number, byteLength: 1 | 2 | 4): Uint8Array
  • Write a number to a Uint8Array with arbitrary length.

    Parameters

    • data: number
    • byteLength: 1 | 2 | 4

    Returns Uint8Array

Const pbkdf2

  • pbkdf2(buffer: Uint8Array, salt: Uint8Array, iterations?: number, length?: number, digest?: string): Uint8Array
  • Derive a key from a buffer and salt. Defaults to 2048 iterations, 64 byte key length and SHA512 as digest.

    Parameters

    • buffer: Uint8Array
    • salt: Uint8Array
    • iterations: number = 2048
    • length: number = 64
    • digest: string = 'sha512'

    Returns Uint8Array

Const pointToBuffer

  • pointToBuffer(point: BasePoint, compact: boolean): Uint8Array
  • Get a Uint8Array for a point.

    Parameters

    • point: BasePoint
    • compact: boolean

    Returns Uint8Array

Const privateAdd

  • privateAdd(privateKey: Uint8Array, tweak: Uint8Array): Uint8Array
  • Add a tweak to a private key. This function throws if the result is invalid.

    Parameters

    • privateKey: Uint8Array
    • tweak: Uint8Array

    Returns Uint8Array

Const privateToBuffer

  • privateToBuffer(keyPair: KeyPair): Uint8Array
  • Get a Uint8Array for a private key.

    Parameters

    • keyPair: KeyPair

    Returns Uint8Array

Const publicAdd

  • publicAdd(publicKey: Uint8Array, tweak: Uint8Array): Uint8Array
  • Add a point to a public key. This function throws if the result is invalid.

    Parameters

    • publicKey: Uint8Array
    • tweak: Uint8Array

    Returns Uint8Array

Const publicToBuffer

  • publicToBuffer(keyPair: KeyPair, compact: boolean): Uint8Array
  • Get a Uint8Array for a public key.

    Parameters

    • keyPair: KeyPair
    • compact: boolean

    Returns Uint8Array

Const ripemd160

  • ripemd160(buffer: Uint8Array): Uint8Array
  • Hash a buffer using RIPEMD160.

    Parameters

    • buffer: Uint8Array

    Returns Uint8Array

Const sha256

  • sha256(buffer: Uint8Array): Uint8Array
  • Hash a buffer using SHA256.

    Parameters

    • buffer: Uint8Array

    Returns Uint8Array

Const stripPrefix

  • stripPrefix(value: string): string
  • Parameters

    • value: string

    Returns string

Const toBuffer

  • toBuffer(data: string | number | bigint | ArrayBufferLike | number[]): Uint8Array
  • Attempt to parse a value as Uint8Array.

    Parameters

    • data: string | number | bigint | ArrayBufferLike | number[]

    Returns Uint8Array

Const toChecksumAddress

  • toChecksumAddress(address: string): string
  • Get the checksummed version of an address.

    Parameters

    • address: string

    Returns string

Const toHex

  • toHex(data: Uint8Array): string
  • Get a Uint8Array as hexadecimal string

    Parameters

    • data: Uint8Array

    Returns string

Const toUtf8

  • toUtf8(data: Uint8Array): string
  • Get a buffer as UTF-8 encoded string.

    Parameters

    • data: Uint8Array

    Returns string

Generated using TypeDoc