Skip to main content

Class: Ed25519

Implementation of Ed25519.

Table of contents

Properties

Methods

Constructors

Properties

PUBLIC_KEY_SIZE

Static PUBLIC_KEY_SIZE: number = 32

PublicKeySize is the size, in bytes, of public keys as used in this package.


PRIVATE_KEY_SIZE

Static PRIVATE_KEY_SIZE: number = 64

PrivateKeySize is the size, in bytes, of private keys as used in this package.


SIGNATURE_SIZE

Static SIGNATURE_SIZE: number = 64

SignatureSize is the size, in bytes, of signatures generated and verified by this package.


SEED_SIZE

Static SEED_SIZE: number = 32

SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032.

Methods

publicKeyFromPrivateKey

Static publicKeyFromPrivateKey(privateKey): Uint8Array

Public returns the PublicKey corresponding to priv.

Parameters

NameTypeDescription
privateKeyUint8ArrayThe private key to get the corresponding public key.

Returns

Uint8Array

The public key.


keyPairFromSeed

Static keyPairFromSeed(seed): Object

Generate the key pair from the seed.

Parameters

NameTypeDescription
seedUint8ArrayThe seed to generate the key pair for.

Returns

Object

The key pair.

NameTypeDescription
publicKeyUint8ArrayThe private key generated from the seed.
privateKeyUint8ArrayThe public key generated from the seed.

privateKeyFromSeed

Static privateKeyFromSeed(seed): Uint8Array

Calculates a private key from a seed.

Parameters

NameTypeDescription
seedUint8ArrayThe seed to generate the private key from.

Returns

Uint8Array

The private key.


sign

Static sign(privateKey, block): Uint8Array

Sign the block with privateKey and returns a signature.

Parameters

NameTypeDescription
privateKeyUint8ArrayThe private key.
blockUint8ArrayThe block to sign.

Returns

Uint8Array

The signature.


verify

Static verify(publicKey, block, sig): boolean

Verify reports whether sig is a valid signature of block by publicKey.

Parameters

NameTypeDescription
publicKeyUint8ArrayThe public key to verify the signature.
blockUint8ArrayThe block for the signature.
sigUint8ArrayThe signature.

Returns

boolean

True if the signature matches.

Constructors

constructor

new Ed25519()