Secp256k1Keypair
@iota/iota-sdk / keypairs/secp256k1 / Secp256k1Keypair
Class: Secp256k1Keypair
Defined in: sdk/typescript/src/keypairs/secp256k1/keypair.ts:30
An Secp256k1 Keypair used for signing transactions.
Extends
Constructors
Constructor
new Secp256k1Keypair(
keypair?):Secp256k1Keypair
Defined in: sdk/typescript/src/keypairs/secp256k1/keypair.ts:39
Create a new keypair instance. Generate random keypair if no Secp256k1Keypair is provided.
Parameters
keypair?
secp256k1 keypair
Returns
Secp256k1Keypair
Overrides
Methods
getKeyScheme()
getKeyScheme():
SignatureScheme
Defined in: sdk/typescript/src/keypairs/secp256k1/keypair.ts:54
Get the key scheme of the keypair Secp256k1
Returns
Overrides
getPublicKey()
getPublicKey():
PublicKey
Defined in: sdk/typescript/src/keypairs/secp256k1/keypair.ts:118
The public key for this keypair
Returns
Overrides
getSecretKey()
getSecretKey():
string
Defined in: sdk/typescript/src/keypairs/secp256k1/keypair.ts:124
The Bech32 secret key string for this Secp256k1 keypair
Returns
string
Overrides
sign()
sign(
data):Promise<Uint8Array<ArrayBufferLike>>
Defined in: sdk/typescript/src/keypairs/secp256k1/keypair.ts:131
Return the signature for the provided data.
Parameters
data
Uint8Array
Returns
Promise<Uint8Array<ArrayBufferLike>>
Overrides
signPersonalMessage()
signPersonalMessage(
bytes):Promise<{bytes:string;signature:string; }>
Defined in: sdk/typescript/src/cryptography/keypair.ts:73
Signs provided personal message by calling signWithIntent() with a PersonalMessage provided as intent scope
Parameters
bytes
Uint8Array
Returns
Promise<{ bytes: string; signature: string; }>
Inherited from
signTransaction()
signTransaction(
bytes):Promise<SignatureWithBytes>
Defined in: sdk/typescript/src/cryptography/keypair.ts:67
Signs provided transaction by calling signWithIntent() with a TransactionData provided as intent scope
Parameters
bytes
Uint8Array
Returns
Promise<SignatureWithBytes>
Inherited from
signWithIntent()
signWithIntent(
bytes,intent):Promise<SignatureWithBytes>
Defined in: sdk/typescript/src/cryptography/keypair.ts:50
Sign messages with a specific intent. By combining the message bytes with the intent before hashing and signing, it ensures that a signed message is tied to a specific purpose and domain separator is provided
Parameters
bytes
Uint8Array
intent
Returns
Promise<SignatureWithBytes>
Inherited from
toIotaAddress()
toIotaAddress():
string
Defined in: sdk/typescript/src/cryptography/keypair.ts:85
Returns
string
Inherited from
deriveKeypair()
staticderiveKeypair(mnemonics,path?):Secp256k1Keypair
Defined in: sdk/typescript/src/keypairs/secp256k1/keypair.ts:146
Derive Secp256k1 keypair from mnemonics and path. The mnemonics must be normalized and validated against the english wordlist.
If path is none, it will default to m/54'/4218'/0'/0/0, otherwise the path must be compliant to BIP-32 in form m/54'/4218'/{account_index}'/{change_index}/{address_index}.
Parameters
mnemonics
string
path?
string
Returns
Secp256k1Keypair
fromSecretKey()
staticfromSecretKey(secretKey,options?):Secp256k1Keypair
Defined in: sdk/typescript/src/keypairs/secp256k1/keypair.ts:78
Create a keypair from a raw secret key byte array.
This method should only be used to recreate a keypair from a previously generated secret key. Generating keypairs from a random seed should be done with the Keypair.fromSeed method.
Parameters
secretKey
string | Uint8Array<ArrayBufferLike>
secret key byte array or Bech32 secret key string
options?
skipValidation?
boolean
Returns
Secp256k1Keypair
Throws
error if the provided secret key is invalid and validation is not skipped.
fromSeed()
staticfromSeed(seed):Secp256k1Keypair
Defined in: sdk/typescript/src/keypairs/secp256k1/keypair.ts:110
Generate a keypair from a 32 byte seed.
Parameters
seed
Uint8Array
seed byte array
Returns
Secp256k1Keypair
generate()
staticgenerate():Secp256k1Keypair
Defined in: sdk/typescript/src/keypairs/secp256k1/keypair.ts:61
Generate a new random keypair
Returns
Secp256k1Keypair
signingDigest()
staticsigningDigest(bytes,intent):Uint8Array
Defined in: sdk/typescript/src/cryptography/keypair.ts:40
Sign messages with a specific intent. By combining the message bytes with the intent before hashing. Returns the digest.
Parameters
bytes
Uint8Array
intent
Returns
Uint8Array