decodeNsecKeyToPrivateKey method

  1. @override
String decodeNsecKeyToPrivateKey(
  1. String nsecKey
)
override

Decodes a Nostr nsecKey to a private key.

final privateKey = Nostr.instance.keysService.decodeNsecKeyToPrivateKey(yourNsecKey);
print(privateKey); // ...

Implementation

@override
String decodeNsecKeyToPrivateKey(String nsecKey) {
  assert(nsecKey.startsWith(NostrConstants.nsec));
  final List<String> decodedKeyComponents =
      Nostr.instance.utilsService.decodeBech32(nsecKey);
  return decodedKeyComponents.first;
}