Signer class
Represents a signing source used to produce ECDSA signatures for EIP-7702 authorization messages and typed transactions.
Two variants are supported:
- Signer.eth – wraps an
EthPrivateKeyfrom theweb3dartpackage. - Signer.raw – wraps a 32-byte
Uint8Listraw private key.
Both variants are treated equivalently by signing utilities; callers do not need to differentiate between them.
Example:
final signer = Signer.raw(myPrivateKeyBytes);
final signature = signer.signDigest(messageHash);
See also:
EthPrivateKey– the key type used byweb3dart.
- Implementers
- Available extensions
- Annotations
-
- @freezed
Constructors
- Signer.eth(EthPrivateKey ethPrivateKey)
-
constfactory
- Signer.raw(Uint8List rawPrivateKey)
-
constfactory
Properties
- ethPrivateKey → EthPrivateKey
-
Available on Signer, provided by the SignerX extension
Returns theEthPrivateKeyassociated with this signer.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
map<
TResult extends Object?> ({required TResult raw(RawSigner value), required TResult eth(EthSigner value)}) → TResult -
Available on Signer, provided by the SignerPatterns extension
Aswitch-like method, using callbacks. -
mapOrNull<
TResult extends Object?> ({TResult? raw(RawSigner value)?, TResult? eth(EthSigner value)?}) → TResult? -
Available on Signer, provided by the SignerPatterns extension
A variant ofmapthat fallback to returningnull. -
maybeMap<
TResult extends Object?> ({TResult raw(RawSigner value)?, TResult eth(EthSigner value)?, required TResult orElse()}) → TResult -
Available on Signer, provided by the SignerPatterns extension
A variant ofmapthat fallback to returningorElse. -
maybeWhen<
TResult extends Object?> ({TResult raw(Uint8List rawPrivateKey)?, TResult eth(EthPrivateKey ethPrivateKey)?, required TResult orElse()}) → TResult -
Available on Signer, provided by the SignerPatterns extension
A variant ofwhenthat fallback to anorElsecallback. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sign(
Uint8List preImage) → EIP7702MsgSignature -
Available on Signer, provided by the SignerX extension
Signs the given preimage using this signer’s underlying private key and returns an EIP7702MsgSignature. -
signAsync(
Uint8List preImage) → Future< EIP7702MsgSignature> - Asynchronously signs the given preimage using this signer’s underlying private key.
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> ({required TResult raw(Uint8List rawPrivateKey), required TResult eth(EthPrivateKey ethPrivateKey)}) → TResult -
Available on Signer, provided by the SignerPatterns extension
Aswitch-like method, using callbacks. -
whenOrNull<
TResult extends Object?> ({TResult? raw(Uint8List rawPrivateKey)?, TResult? eth(EthPrivateKey ethPrivateKey)?}) → TResult? -
Available on Signer, provided by the SignerPatterns extension
A variant ofwhenthat fallback to returningnull
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited