decodeNeventToMap method
Decodes the given bech32
nprofile id to a map with pubkey and relays.
You can encode a map to a nprofile id with encodeNProfile.
Example:
final nEventDecodedMap = Nostr.instance.utilsService.decodeNeventToMap(
"nevent1:..."
);
print(nEventDecodedMap); // ...
Implementation
@override
Map<String, dynamic> decodeNeventToMap(String bech32) {
final decodedBech32 = decodeBech32(bech32);
final dataString = decodedBech32[0];
final data = HEX.decode(dataString);
final tlvList = tlv.decode(Uint8List.fromList(data));
final resultMap = _parseNeventTlvList(tlvList);
if (resultMap['eventId'].length != 64) {
throw Exception('Invalid pubkey length');
}
return resultMap;
}