ed25519_edwards library
Package ed25519 implements the Ed25519 signature algorithm. See https://ed25519.cr.yp.to/.
These functions are also compatible with the “Ed25519” function defined in RFC 8032. However, unlike RFC 8032's formulation, this package's private key representation includes a public key suffix to make multiple signing operations with the same key more efficient. This package refers to the RFC 8032 private key as the “seed”.
Classes
- KeyPair
- KeyPair is the type of Ed25519 public/private key pair.
- PrivateKey
- PrivateKey is the type of Ed25519 private keys.
- PublicKey
- PublicKey is the type of Ed25519 public keys.
Constants
- PrivateKeySize → const int
- PrivateKeySize is the size, in bytes, of private keys as used in this package.
- PublicKeySize → const int
- PublicKeySize is the size, in bytes, of public keys as used in this package.
- SeedSize → const int
- SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032.
- SignatureSize → const int
- SignatureSize is the size, in bytes, of signatures generated and verified by this package.
Functions
-
generateKey(
) → KeyPair - GenerateKey generates a public/private key pair using entropy from secure random.
-
newKeyFromSeed(
Uint8List seed) → PrivateKey - NewKeyFromSeed calculates a private key from a seed. It will throw ArgumentError if seed.length is not SeedSize. This function is provided for interoperability with RFC 8032. RFC 8032's private keys correspond to seeds in this package.
-
public(
PrivateKey privateKey) → PublicKey - public returns the PublicKey corresponding to PrivateKey.
-
seed(
PrivateKey privateKey) → Uint8List - Seed returns the private key seed corresponding to priv. It is provided for interoperability with RFC 8032. RFC 8032's private keys correspond to seeds in this package.
-
sign(
PrivateKey privateKey, Uint8List message) → Uint8List - Sign signs the message with privateKey and returns a signature. It will throw ArumentError if privateKey.bytes.length is not PrivateKeySize.
-
verify(
PublicKey publicKey, Uint8List message, Uint8List sig) → bool - Verify reports whether sig is a valid signature of message by publicKey. It will throw ArgumentError if publicKey.bytes.length is not PublicKeySize.