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
Name | Type | Description |
---|---|---|
privateKey | Uint8Array | The 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
Name | Type | Description |
---|---|---|
seed | Uint8Array | The seed to generate the key pair for. |
Returns
Object
The key pair.
Name | Type | Description |
---|---|---|
publicKey | Uint8Array | The private key generated from the seed. |
privateKey | Uint8Array | The public key generated from the seed. |
privateKeyFromSeed
▸ Static
privateKeyFromSeed(seed
): Uint8Array
Calculates a private key from a seed.
Parameters
Name | Type | Description |
---|---|---|
seed | Uint8Array | The 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
Name | Type | Description |
---|---|---|
privateKey | Uint8Array | The private key. |
block | Uint8Array | The 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
Name | Type | Description |
---|---|---|
publicKey | Uint8Array | The public key to verify the signature. |
block | Uint8Array | The block for the signature. |
sig | Uint8Array | The signature. |
Returns
boolean
True if the signature matches.
Constructors
constructor
• new Ed25519()