NostrKeys class

This class is responsible for generating key pairs and deriving public keys from private keys..

Implemented types

Constructors

NostrKeys()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decodeNpubKeyToPublicKey(String npubKey) String
Decodes a Nostr npubKey to a public key.
override
decodeNsecKeyToPrivateKey(String nsecKey) String
Decodes a Nostr nsecKey to a private key.
override
derivePublicKey({required String privateKey}) String
Derives a public key from a privateKey directly, use this if you want a quick way to get a public key from a private key.
override
encodePrivateKeyToNsec(String privateKey) String
Encodes a Nostr privateKey to an nsec key (bech32 encoding).
override
encodePublicKeyToNpub(String publicKey) String
Encodes a Nostr publicKey to an npub key (bech32 encoding).
override
generateKeyPair() NostrKeyPairs
You can use this method to generate a key pair for your end users.
override
generateKeyPairFromExistingPrivateKey(String privateKey) NostrKeyPairs
Generates a key pair from an existing privateKey, use this if you want to generate a key pair from an existing private key.
override
generatePrivateKey() String
You can use this method to generate a key pair for your end users. it returns the private key of the generated key pair.
override
isValidPrivateKey(String key) bool
Weither the key is a valid Nostr private key or not.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sign({required String privateKey, required String message}) String
You can use this method to sign a message with a privateKey.
override
toString() String
A string representation of this object.
inherited
verify({required String publicKey, required String message, required String signature}) bool
You can use this method to verify a message with a publicKey and it's signature. it returns a bool that indicates if the message is verified or not.

Operators

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

Static Methods

getPrivateKeyFromMnemonic(String mnemonic) String
isMnemonicValid(String text) bool
Wether the given text is a valid mnemonic or not.