decodeNpubKeyToPublicKey method

String decodeNpubKeyToPublicKey(
  1. String npubKey
)

Decodes a Nostr npubKey to a public key.

final publicKey = Nostr.instance.services.keys.decodeNpubKeyToPublicKey(yourNpubKey);
print(publicKey); // ...

Implementation

String decodeNpubKeyToPublicKey(String npubKey) {
  assert(npubKey.startsWith(NostrConstants.npub));

  final decodedKeyComponents = decodeBech32(npubKey);

  return decodedKeyComponents.first;
}