Class: PrivateKey

Hierarchy

  • PrivateKey

Index

Constructors

Methods

Constructors

constructor

+ new PrivateKey(key: Key, ec: EC): PrivateKey

Parameters:

Name Type
key Key
ec EC

Returns: PrivateKey

Methods

getPublicKey

getPublicKey(): PublicKey

Returns: PublicKey


getType

getType(): KeyType

Returns: KeyType


isValid

isValid(): boolean

Returns: boolean


sign

sign(data: BNInput, shouldHash: boolean, encoding: BufferEncoding): Signature

Parameters:

Name Type Default
data BNInput -
shouldHash boolean true
encoding BufferEncoding "utf8"

Returns: Signature


toElliptic

toElliptic(): EC.KeyPair

Returns: EC.KeyPair


toLegacyString

toLegacyString(): string

Returns: string


toString

toString(): string

Returns: string


Static fromElliptic

fromElliptic(privKey: EC.KeyPair, keyType: KeyType, ec?: EC): PrivateKey

Parameters:

Name Type
privKey EC.KeyPair
keyType KeyType
ec? EC

Returns: PrivateKey


Static fromString

fromString(keyString: string, ec?: EC): PrivateKey

Parameters:

Name Type
keyString string
ec? EC

Returns: PrivateKey