Skip to main content

Class: Ed25519Keypair

An Ed25519 Keypair used for signing transactions.

Extends

Constructors

Constructor

new Ed25519Keypair(keypair?): Ed25519Keypair;

Create a new Ed25519 keypair instance. Generate random keypair if no Ed25519Keypair is provided.

Parameters

ParameterTypeDescription
keypair?Ed25519KeypairDataEd25519 keypair

Returns

Ed25519Keypair

Overrides

Keypair.constructor

Methods

signingDigest()

static signingDigest(bytes, intent): Uint8Array;

Sign messages with a specific intent. By combining the message bytes with the intent before hashing. Returns the digest.

Parameters

ParameterType
bytesUint8Array
intentIntentScope

Returns

Uint8Array

Inherited from

Keypair.signingDigest


signWithIntent()

signWithIntent(bytes, intent): Promise<SignatureWithBytes>;

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

ParameterType
bytesUint8Array
intentIntentScope

Returns

Promise<SignatureWithBytes>

Inherited from

Keypair.signWithIntent


signTransaction()

signTransaction(bytes): Promise<SignatureWithBytes>;

Signs provided transaction by calling signWithIntent() with a TransactionData provided as intent scope

Parameters

ParameterType
bytesUint8Array

Returns

Promise<SignatureWithBytes>

Inherited from

Keypair.signTransaction


signPersonalMessage()

signPersonalMessage(bytes): Promise<{
bytes: string;
signature: string;
}>;

Signs provided personal message by calling signWithIntent() with a PersonalMessage provided as intent scope

Parameters

ParameterType
bytesUint8Array

Returns

Promise<{ bytes: string; signature: string; }>

Inherited from

Keypair.signPersonalMessage


toIotaAddress()

toIotaAddress(): string;

Returns

string

Inherited from

Keypair.toIotaAddress


getKeyScheme()

getKeyScheme(): SignatureScheme;

Get the key scheme of the keypair ED25519

Returns

SignatureScheme

Overrides

Keypair.getKeyScheme


generate()

static generate(): Ed25519Keypair;

Generate a new random Ed25519 keypair

Returns

Ed25519Keypair


fromSecretKey()

static fromSecretKey(secretKey, options?): Ed25519Keypair;

Create a Ed25519 keypair from a raw secret key byte array, also known as seed. This is NOT the private scalar which is result of hashing and bit clamping of the raw secret key.

Parameters

ParameterTypeDescription
secretKeystring | Uint8Arraysecret key as a byte array or Bech32 secret key string
options?{ skipValidation?: boolean; }-
options.skipValidation?boolean-

Returns

Ed25519Keypair

Throws

error if the provided secret key is invalid and validation is not skipped.


getPublicKey()

getPublicKey(): Ed25519PublicKey;

The public key for this Ed25519 keypair

Returns

Ed25519PublicKey

Overrides

Keypair.getPublicKey


getSecretKey()

getSecretKey(): string;

The Bech32 secret key string for this Ed25519 keypair

Returns

string

Overrides

Keypair.getSecretKey


sign()

sign(data): Promise<Uint8Array>;

Return the signature for the provided data using Ed25519.

Parameters

ParameterType
dataUint8Array

Returns

Promise<Uint8Array>

Overrides

Keypair.sign


deriveKeypair()

static deriveKeypair(mnemonics, path?): Ed25519Keypair;

Derive Ed25519 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/44'/4218'/0'/0'/0', otherwise the path must be compliant to SLIP-0010 in form m/44'/4218'/{account_index}'/{change_index}'/{address_index}'.

Parameters

ParameterType
mnemonicsstring
path?string

Returns

Ed25519Keypair


deriveKeypairFromSeed()

static deriveKeypairFromSeed(seedHex, path?): Ed25519Keypair;

Derive Ed25519 keypair from mnemonicSeed and path.

If path is none, it will default to m/44'/4218'/0'/0'/0', otherwise the path must be compliant to SLIP-0010 in form m/44'/4218'/{account_index}'/{change_index}'/{address_index}'.

Parameters

ParameterType
seedHexstring
path?string

Returns

Ed25519Keypair