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 EthPrivateKey from the web3dart package.
  • Signer.raw – wraps a 32-byte Uint8List raw 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 by web3dart.
Implementers
Available extensions
Annotations
  • @freezed

Constructors

Signer.eth(EthPrivateKey ethPrivateKey)
const
factory
Signer.raw(Uint8List rawPrivateKey)
const
factory

Properties

ethPrivateKey → EthPrivateKey

Available on Signer, provided by the SignerX extension

Returns the EthPrivateKey associated 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

A switch-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 of map that fallback to returning null.
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 of map that fallback to returning orElse.
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 of when that fallback to an orElse callback.
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>

Available on Signer, provided by the SignerX extension

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

A switch-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 of when that fallback to returning null

Operators

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