Skip to content

Class: Entropy

Extends

Constructors

new Entropy()

new Entropy(arg): Entropy

Creates a new Entropy from a byte array.

Parameters

arg: Uint8Array

Returns

Entropy

Overrides

Secret.constructor

Defined in

@nimiq/core/lib/index.d.ts:213

Properties

ENCRYPTION_CHECKSUM_SIZE

static ENCRYPTION_CHECKSUM_SIZE: number

Inherited from

Secret.ENCRYPTION_CHECKSUM_SIZE

Defined in

@nimiq/core/lib/index.d.ts:181


ENCRYPTION_CHECKSUM_SIZE_V3

static ENCRYPTION_CHECKSUM_SIZE_V3: number

Inherited from

Secret.ENCRYPTION_CHECKSUM_SIZE_V3

Defined in

@nimiq/core/lib/index.d.ts:182


ENCRYPTION_KDF_ROUNDS

static ENCRYPTION_KDF_ROUNDS: number

Inherited from

Secret.ENCRYPTION_KDF_ROUNDS

Defined in

@nimiq/core/lib/index.d.ts:180


ENCRYPTION_SALT_SIZE

static ENCRYPTION_SALT_SIZE: number

Inherited from

Secret.ENCRYPTION_SALT_SIZE

Defined in

@nimiq/core/lib/index.d.ts:179


PURPOSE_ID

static PURPOSE_ID: number

Defined in

@nimiq/core/lib/index.d.ts:208


SIZE

static SIZE: number

Overrides

Secret.SIZE

Defined in

@nimiq/core/lib/index.d.ts:207

Accessors

encryptedSize

Get Signature

get encryptedSize(): number

Returns the serialized size of this object when encrypted.

Returns

number

Inherited from

Secret.encryptedSize

Defined in

@nimiq/core/lib/index.d.ts:196


serializedSize

Get Signature

get serializedSize(): number

Returns the serialized size of this Entropy.

Returns

number

Defined in

@nimiq/core/lib/index.d.ts:241

Methods

compare()

compare(o): number

Compares this object to another object.

Returns a negative number if this is smaller than o, a positive number if this is larger than o, and zero if equal.

Parameters

o: Serializable

Returns

number

Inherited from

Secret.compare

Defined in

@nimiq/core/lib/index.d.ts:97


equals()

equals(o): boolean

Checks for equality with another Entropy.

Parameters

o: unknown

Returns

boolean

Overrides

Secret.equals

Defined in

@nimiq/core/lib/index.d.ts:249


exportEncrypted()

exportEncrypted(key): Promise<SerialBuffer>

Encrypts the Secret with a password.

Parameters

key: Uint8Array

Returns

Promise<SerialBuffer>

Inherited from

Secret.exportEncrypted

Defined in

@nimiq/core/lib/index.d.ts:192


overwrite()

overwrite(entropy): void

Overwrites this Entropy's bytes with a replacement in-memory

Parameters

entropy: Entropy

Returns

void

Defined in

@nimiq/core/lib/index.d.ts:245


serialize()

serialize(buf?): SerialBuffer

Serializes the Entropy to a byte array.

Parameters

buf?: SerialBuffer

Returns

SerialBuffer

Overrides

Secret.serialize

Defined in

@nimiq/core/lib/index.d.ts:237


toBase64()

toBase64(): string

Formats the object into a base64 string.

Returns

string

Inherited from

Secret.toBase64

Defined in

@nimiq/core/lib/index.d.ts:106


toExtendedPrivateKey()

toExtendedPrivateKey(password?, wordlist?): ExtendedPrivateKey

Derives an ExtendedPrivateKey from the Entropy.

Parameters

password?: string

wordlist?: string[]

Returns

ExtendedPrivateKey

Defined in

@nimiq/core/lib/index.d.ts:221


toHex()

toHex(): string

Formats the object into a hex string.

Returns

string

Inherited from

Secret.toHex

Defined in

@nimiq/core/lib/index.d.ts:110


toMnemonic()

toMnemonic(wordlist?): string[]

Converts the Entropy into a mnemonic.

Parameters

wordlist?: string[]

Returns

string[]

Defined in

@nimiq/core/lib/index.d.ts:225


toString()

toString(): string

Formats the object into a hex string.

Returns

string

Inherited from

Secret.toString

Defined in

@nimiq/core/lib/index.d.ts:102


deserialize()

static deserialize(buf): Entropy

Deserializes an Entropy object from a byte array.

Parameters

buf: SerialBuffer

Returns

Entropy

Defined in

@nimiq/core/lib/index.d.ts:229


exportEncrypted()

static exportEncrypted(secret, key): Promise<SerialBuffer>

Parameters

secret: PrivateKey | Secret

key: Uint8Array

Returns

Promise<SerialBuffer>

Inherited from

Secret.exportEncrypted

Defined in

@nimiq/core/lib/index.d.ts:188


fromEncrypted()

static fromEncrypted(buf, key): Promise<PrivateKey | Entropy>

Decrypts a Secret from an encrypted byte array and its password.

Parameters

buf: SerialBuffer

key: Uint8Array

Returns

Promise<PrivateKey | Entropy>

Inherited from

Secret.fromEncrypted

Defined in

@nimiq/core/lib/index.d.ts:187


fromHex()

static fromHex(hex): Entropy

Deserializes an Entropy object from a hex string.

Parameters

hex: string

Returns

Entropy

Defined in

@nimiq/core/lib/index.d.ts:233


generate()

static generate(): Entropy

Generates a new Entropy object from secure randomness.

Returns

Entropy

Defined in

@nimiq/core/lib/index.d.ts:217