Class: PrivateKey
Defined in: @nimiq/core/types/wasm/web.d.ts:1525
The secret (private) part of an asymmetric key pair that is typically used to digitally sign or decrypt data.
Constructors
new PrivateKey()
new PrivateKey(
bytes
):PrivateKey
Defined in: @nimiq/core/types/wasm/web.d.ts:1542
Creates a new private key from a byte array.
Throws when the byte array is not exactly 32 bytes long.
Parameters
bytes
Uint8Array
Returns
Properties
serializedSize
readonly
serializedSize:number
Defined in: @nimiq/core/types/wasm/web.d.ts:1563
PURPOSE_ID
readonly
static
PURPOSE_ID:number
Defined in: @nimiq/core/types/wasm/web.d.ts:1561
SIZE
readonly
static
SIZE:number
Defined in: @nimiq/core/types/wasm/web.d.ts:1562
Methods
equals()
equals(
other
):boolean
Defined in: @nimiq/core/types/wasm/web.d.ts:1560
Returns if this private key is equal to the other private key.
Parameters
other
Returns
boolean
free()
free():
void
Defined in: @nimiq/core/types/wasm/web.d.ts:1526
Returns
void
serialize()
serialize():
Uint8Array
Defined in: @nimiq/core/types/wasm/web.d.ts:1546
Serializes the private key to a byte array.
Returns
Uint8Array
toHex()
toHex():
string
Defined in: @nimiq/core/types/wasm/web.d.ts:1556
Formats the private key into a hex string.
Returns
string
deserialize()
static
deserialize(bytes
):PrivateKey
Defined in: @nimiq/core/types/wasm/web.d.ts:1536
Deserializes a private key from a byte array.
Throws when the byte array contains less than 32 bytes.
Parameters
bytes
Uint8Array
Returns
fromHex()
static
fromHex(hex
):PrivateKey
Defined in: @nimiq/core/types/wasm/web.d.ts:1552
Parses a private key from its hex representation.
Throws when the string is not valid hex format or when it represents less than 32 bytes.
Parameters
hex
string
Returns
generate()
static
generate():PrivateKey
Defined in: @nimiq/core/types/wasm/web.d.ts:1530
Generates a new private key from secure randomness.