Skip to main content

Ed25519Keypair

@iota/iota-sdk


@iota/iota-sdk / keypairs/ed25519 / Ed25519Keypair

Class: Ed25519Keypair

Defined in: sdk/typescript/src/keypairs/ed25519/keypair.ts:32

An Ed25519 Keypair used for signing transactions.

Extends​

Constructors​

Constructor​

new Ed25519Keypair(keypair?): Ed25519Keypair

Defined in: sdk/typescript/src/keypairs/ed25519/keypair.ts:41

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

Parameters​

keypair?​

Ed25519KeypairData

Ed25519 keypair

Returns​

Ed25519Keypair

Overrides​

Keypair.constructor

Methods​

getKeyScheme()​

getKeyScheme(): SignatureScheme

Defined in: sdk/typescript/src/keypairs/ed25519/keypair.ts:62

Get the key scheme of the keypair ED25519

Returns​

SignatureScheme

Overrides​

Keypair.getKeyScheme


getPublicKey()​

getPublicKey(): Ed25519PublicKey

Defined in: sdk/typescript/src/keypairs/ed25519/keypair.ts:126

The public key for this Ed25519 keypair

Returns​

Ed25519PublicKey

Overrides​

Keypair.getPublicKey


getSecretKey()​

getSecretKey(): string

Defined in: sdk/typescript/src/keypairs/ed25519/keypair.ts:133

The Bech32 secret key string for this Ed25519 keypair

Returns​

string

Overrides​

Keypair.getSecretKey


sign()​

sign(data): Promise<Uint8Array<ArrayBufferLike>>

Defined in: sdk/typescript/src/keypairs/ed25519/keypair.ts:143

Return the signature for the provided data using Ed25519.

Parameters​

data​

Uint8Array

Returns​

Promise<Uint8Array<ArrayBufferLike>>

Overrides​

Keypair.sign


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​

Keypair.signPersonalMessage


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​

Keypair.signTransaction


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​

IntentScope

Returns​

Promise<SignatureWithBytes>

Inherited from​

Keypair.signWithIntent


toIotaAddress()​

toIotaAddress(): string

Defined in: sdk/typescript/src/cryptography/keypair.ts:85

Returns​

string

Inherited from​

Keypair.toIotaAddress


deriveKeypair()​

static deriveKeypair(mnemonics, path?): Ed25519Keypair

Defined in: sdk/typescript/src/keypairs/ed25519/keypair.ts:154

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​

mnemonics​

string

path?​

string

Returns​

Ed25519Keypair


deriveKeypairFromSeed()​

static deriveKeypairFromSeed(seedHex, path?): Ed25519Keypair

Defined in: sdk/typescript/src/keypairs/ed25519/keypair.ts:172

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​

seedHex​

string

path?​

string

Returns​

Ed25519Keypair


fromSecretKey()​

static fromSecretKey(secretKey, options?): Ed25519Keypair

Defined in: sdk/typescript/src/keypairs/ed25519/keypair.ts:87

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​

secretKey​

string | Uint8Array<ArrayBufferLike>

secret key as a byte array or Bech32 secret key string

options?​
skipValidation?​

boolean

Returns​

Ed25519Keypair

Throws​

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


generate()​

static generate(): Ed25519Keypair

Defined in: sdk/typescript/src/keypairs/ed25519/keypair.ts:69

Generate a new random Ed25519 keypair

Returns​

Ed25519Keypair


signingDigest()​

static signingDigest(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​

IntentScope

Returns​

Uint8Array

Inherited from​

Keypair.signingDigest