decodeNpubKeyToPublicKey method

  1. @override
String decodeNpubKeyToPublicKey(
  1. String npubKey
)
override

Decodes a Nostr npubKey to a public key.

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

Implementation

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

  final List<String> decodedKeyComponents =
      Nostr.instance.utilsService.decodeBech32(npubKey);
  return decodedKeyComponents.first;
}