Ed25519PrivateKey class
Implementation of Ed25519 private key.
The key keeps its 32-byte seed, from which the signing key is derived. marshal writes the seed followed by the public key (64 bytes), the format that go-libp2p writes and reads.
- Implemented types
Constructors
- Ed25519PrivateKey.withPublicKey(SimpleKeyPair _keyPair, Ed25519PublicKey _publicKey, [Uint8List? _privateKeyBytes])
- Creates an Ed25519PrivateKey with a public key.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- publicKey → PublicKey
-
Gets the public key corresponding to this private key
no setteroverride
- raw → Uint8List
-
The 32-byte seed. (go-libp2p's
Raw()returns the seed followed by the public key; fromRawBytes accepts both.)no setteroverride - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → KeyType
-
Returns the key's type
no setteroverride
Methods
-
equals(
PrivateKey other) → Future< bool> -
Checks if this private key is equal to another
override
-
marshal(
) → Uint8List -
The protobuf form: type Ed25519 and data = seed || public key
(64 bytes), as go-libp2p writes it.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sign(
Uint8List data) → Future< Uint8List> -
Signs the given data
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
create(
SimpleKeyPair keyPair, [Uint8List? privateKeyBytes]) → Future< Ed25519PrivateKey> -
Creates a private key from a
cryptographykey pair. -
fromRawBytes(
Uint8List bytes) → Future< Ed25519PrivateKey> -
Creates an Ed25519PrivateKey from raw bytes: the 32-byte seed, the seed
followed by the public key (64 bytes, as go-libp2p's
Raw()returns it), or go-libp2p's legacy 96-byte form, which repeats the public key. -
generateKeyPair(
) → Future< KeyPair> - Generate a new Ed25519 key pair
-
generateKeyPairFromSeed(
Uint8List seed) → Future< KeyPair> - Generate a new Ed25519 key pair
-
unmarshal(
Uint8List bytes) → Future< PrivateKey> -
Creates an Ed25519PrivateKey from its protobuf bytes, as marshal and
go-libp2p's
crypto.MarshalPrivateKeywrite them.