Skip to main content

PrivateKey

@opcat-labs/scrypt-ts-opcat v1.0.4


@opcat-labs/scrypt-ts-opcat / PrivateKey

Class: PrivateKey

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:10

Instantiate a PrivateKey from a BN, Buffer or WIF string.

Param​

The encoded data in various formats

Param​

a Network object, or a string with the network name

Constructors​

new PrivateKey()​

new PrivateKey(data, network?): PrivateKey

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:20

Instantiate a PrivateKey from a BN, Buffer or WIF string.

Parameters​

data​

any

The encoded data in various formats

network?​

any

a Network object, or a string with the network name

Returns​

PrivateKey

A new valid instance of an PrivateKey

Properties​

_pubkey​

_pubkey: PublicKey

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:60


toObject()​

toObject: () => any

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:72

Returns​

any

A plain object representation

Accessors​

compressed​

Get Signature​

get compressed(): any

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:23

Returns​

any


network​

Get Signature​

get network(): any

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:22

Returns​

any


publicKey​

Get Signature​

get publicKey(): PublicKey

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:21

Returns​

PublicKey

Methods​

inspect()​

inspect(): string

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:79

Will return a string formatted for the console

Returns​

string

Private key


toAddress()​

toAddress(network?): Address

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:68

Will return an address for the private key

Parameters​

network?​

any

optional parameter specifying the desired network for the address

Returns​

Address

An address generated from the private key


toBigNumber()​

toBigNumber(): BN

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:42

Will return the private key as a BN instance

Returns​

BN

A BN instance of the private key


toBuffer()​

toBuffer(): Buffer

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:48

Will return the private key as a BN buffer

Returns​

Buffer

A buffer of the private key


toHex()​

toHex(): string

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:53

Converts the private key to a hexadecimal string representation.

Returns​

string

Hexadecimal string of the private key.


toJSON()​

toJSON(): any

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:73

Returns​

any


toPublicKey()​

toPublicKey(): PublicKey

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:59

Will return the corresponding public key

Returns​

PublicKey

A public key generated from the private key


toString()​

toString(): string

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:30

Will output the PrivateKey in WIF

Returns​

string


toWIF()​

toWIF(): string

Defined in: node_modules/@opcat-labs/opcat/types/privatekey.d.cts:36

Will output the PrivateKey to a WIF string

Returns​

string

A WIP representation of the private key