PayloadEncryptor class

Seals and opens payloads with one identity's key.

Constructors

PayloadEncryptor.fromEd25519Seed(Uint8List seed)
From the identity's Ed25519 seed (32 bytes).
PayloadEncryptor.fromLibp2pKey(PrivateKey key)
From a libp2p private key. Only a key that still holds its seed can be used: dart-libp2p keeps it for keys built from a seed with Ed25519PrivateKey.fromRawBytes, and not for others.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
x25519PublicKey → Uint8List
This identity's X25519 public key, for tests and diagnostics.
no setter

Methods

decryptBound(Uint8List encrypted, PayloadBinding want, PeerId sender) → Future<DecryptedPayload>
Opens a ciphertext and checks that it was sealed for exactly the message it arrived as (want). A legacy ciphertext still opens and is reported as unbound.
encryptBound(Uint8List payload, PayloadBinding binding, PeerId recipient, {Uint8List? nonce}) → Future<Uint8List>
Seals payload for recipient, tied to binding. This is what the client sends. A caller-supplied nonce is for test vectors only.
encryptLegacy(Uint8List payload, PeerId recipient, {Uint8List? nonce}) → Future<Uint8List>
Seals payload in the legacy unbound format: nonce ‖ box(payload). Nothing ties it to a message; the client sends encryptBound.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited