KeyPair class abstract

Represents a cryptographic key pair for signing and verifying data.

This class provides methods for creating key pairs from seeds or BIP39 mnemonics, signing messages, and verifying message signatures. It also includes a method to obtain the Substrate address encoded in SS58 format.

Example usages are provided for each function below.

Implementers

Constructors

KeyPair(KeyPairType keyPairType)
constructor

Properties

address String
Get the Substrate address encoded in SS58 format.
no setter
hashCode int
Returns the hash code of the KeyPair.
no setteroverride
isLocked bool
Returns true if the KeyPair is locked.
no setter
keyPairType KeyPairType
final
publicKey PublicKey
Get the public key.
no setter
rawAddress String
Get the raw address of the KeyPair.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
ss58Format int
getter/setter pair

Methods

bytes([bool compressed = true]) Uint8List
fromMnemonic(String uri, [String? password]) Future<KeyPair>
Generate a KeyPair from a BIP39 mnemonic.
fromSeed(Uint8List seed) KeyPair
Create a new KeyPair from a given seed.
fromUri(String uri, [String? password]) Future<KeyPair>
Generate a KeyPair from a uri.
lock() → void
Add lock functionality to a KeyPair.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sign(Uint8List message) Uint8List
Sign a given message with the private key.
toString() String
A string representation of this object.
inherited
unlockFromMnemonic(String mnemonic, [String? password]) Future<void>
Unlock a KeyPair from a given BIP39 mnemonic.
unlockFromSeed(Uint8List seed) → void
Unlock a KeyPair from a given seed.
unlockFromUri(String uri, [String? password]) Future<void>
Unlock a KeyPair from a given uri.
verify(Uint8List message, Uint8List signature) bool
Verify a message's signature using the public key.

Operators

operator ==(Object other) bool
Returns true if the KeyPair matches with the other object.
override

Static Properties

ecdsa EcdsaKeyPair
no setter
ed25519 Ed25519KeyPair
no setter
sr25519 Sr25519KeyPair
no setter