Skip to main content

Ed25519

Ed25519 is a utils class for creating Ed25519 key pair. This is used for signing and verifying messages with cloud node.

Import

import * as dkls from '@silencelaboratories/react-native-two-party-ecdsa';

// Then you can use it as
dkls.Ed25519

Usage

// Create a new signing key
const ed = await dkls.Ed25519.create();

// Get verifying key
const verifyingKey = await ed.getVerifyingKey();

// Sign a message
const signature = await ed.signMessage('base64Message');

// Verify a message
const signature = await ed.verify('base64Message', signature);

Constructors

new Ed25519()

protected new Ed25519(privateKeyB64, publicKeyB64): Ed25519

Create a new Ed25519 object

Parameters

privateKeyB64

string

publicKeyB64

string

Returns

Ed25519

Accessors

privateKeyB64

Get Signature

get privateKeyB64(): string

Get the private key in base64 string

Returns

string


publicKeyB64

Get Signature

get publicKeyB64(): string

Get the public key in base64 string

Returns

string

Methods

sign()

sign(msgB64): Promise<string>

Sign a message with a private key

Parameters

msgB64

string

The message base64 string

Returns

Promise<string>

The signature in base64 string


verify()

verify(messageB64, signatureB64): Promise<boolean>

Verify a signature is valid

Parameters

messageB64

string

signatureB64

string

Returns

Promise<boolean>


create()

static create(): Promise<Ed25519>

Create a new Ed25519 private key and public key pair

Returns

Promise<Ed25519>