Evolution SDK

Bip32PrivateKey.ts

Bip32PrivateKey overview


Table of contents


bip32

derive

Derive a child private key using multiple indices.

Signature

export declare const derive: (bip32PrivateKey: Bip32PrivateKey, indices: Array<number>) => Bip32PrivateKey

Added in v2.0.0

deriveChild

Derive a child private key using a single derivation index (V2 scheme). Supports hardened (index >= 0x80000000) and soft derivation.

Signature

export declare const deriveChild: (bip32PrivateKey: Bip32PrivateKey, index: number) => Bip32PrivateKey

Added in v2.0.0

derivePath

Derive a child private key using a BIP32 path string. Supports paths like "m/1852'/1815'/0'/0/0" or "1852'/1815'/0'/0/0".

Signature

export declare const derivePath: (bip32PrivateKey: Bip32PrivateKey, path: string) => Bip32PrivateKey

Added in v2.0.0

bip39

fromBip39Entropy

Create a Bip32PrivateKey from BIP39 entropy with PBKDF2 key stretching.

Signature

export declare const fromBip39Entropy: (entropy: Uint8Array, password?: string) => Bip32PrivateKey

Added in v2.0.0

cml-compatibility

from128XPRV

Create from CML-compatible 128-byte format.

Signature

export declare const from128XPRV: (bytes: Uint8Array) => Bip32PrivateKey

Added in v2.0.0

to128XPRV

Serialize to CML-compatible 128-byte format: [scalar(32) | iv(32) | publicKey(32) | chainCode(32)].

Signature

export declare const to128XPRV: (bip32PrivateKey: Bip32PrivateKey) => Uint8Array

Added in v2.0.0

conversion

toPrivateKey

Convert to standard (non-extended) PrivateKey (first 64 bytes: scalar + IV).

Signature

export declare const toPrivateKey: (bip32PrivateKey: Bip32PrivateKey) => PrivateKey.PrivateKey

Added in v2.0.0

cryptography

toPublicKey

Derive the corresponding Bip32PublicKey.

Signature

export declare const toPublicKey: (bip32PrivateKey: Bip32PrivateKey) => Bip32PublicKey.Bip32PublicKey

Added in v2.0.0

encoding

toBytes

Convert a Bip32PrivateKey to raw bytes.

Signature

export declare const toBytes: (a: Bip32PrivateKey, overrideOptions?: ParseOptions) => Uint8Array

Added in v2.0.0

toHex

Convert a Bip32PrivateKey to hex string.

Signature

export declare const toHex: (a: Bip32PrivateKey, overrideOptions?: ParseOptions) => string

Added in v2.0.0

errors

Bip32PrivateKeyError (class)

Error class for Bip32PrivateKey related operations.

Signature

export declare class Bip32PrivateKeyError

Added in v2.0.0

parsing

fromBytes

Parse a Bip32PrivateKey from raw bytes.

Signature

export declare const fromBytes: (i: Uint8Array, overrideOptions?: ParseOptions) => Bip32PrivateKey

Added in v2.0.0

fromHex

Parse a Bip32PrivateKey from hex string.

Signature

export declare const fromHex: (i: string, overrideOptions?: ParseOptions) => Bip32PrivateKey

Added in v2.0.0

schemas

Bip32PrivateKey (class)

Schema for Bip32PrivateKey representing a BIP32-Ed25519 extended private key. Always 96 bytes: 32-byte scalar + 32-byte IV + 32-byte chain code. Derivation implements the V2 scheme for CML compatibility.

Signature

export declare class Bip32PrivateKey

Added in v2.0.0

toJSON (method)

Signature

toJSON()

toString (method)

Signature

toString(): string

[Inspectable.NodeInspectSymbol] (method)

Signature

[Inspectable.NodeInspectSymbol](): unknown

[Equal.symbol] (method)

Signature

[Equal.symbol](that: unknown): boolean

[Hash.symbol] (method)

Signature

[Hash.symbol](): number

FromBytes

Schema for transforming between Uint8Array and Bip32PrivateKey.

Signature

export declare const FromBytes: Schema.transform<
  Schema.SchemaClass<Uint8Array, Uint8Array, never>,
  Schema.SchemaClass<Bip32PrivateKey, Bip32PrivateKey, never>
>

Added in v2.0.0

FromHex

Schema for transforming between hex string and Bip32PrivateKey.

Signature

export declare const FromHex: Schema.transform<
  Schema.filter<Schema.Schema<Uint8Array, string, never>>,
  Schema.transform<
    Schema.SchemaClass<Uint8Array, Uint8Array, never>,
    Schema.SchemaClass<Bip32PrivateKey, Bip32PrivateKey, never>
  >
>

Added in v2.0.0

utils

CardanoPath

Utility functions to build Cardano BIP44 derivation indices. Standard path: m/1852'/1815'/account'/role/index

Signature

export declare const CardanoPath: {
  harden: (n: number) => number
  indices: (account?: number, role?: 0 | 2, index?: number) => Array<number>
  paymentIndices: (account?: number, index?: number) => Array<number>
  stakeIndices: (account?: number, index?: number) => Array<number>
}

Either (namespace)

arbitrary

Signature

export declare const arbitrary: FastCheck.Arbitrary<Bip32PrivateKey>