encodeNProfile method

  1. @override
String encodeNProfile({
  1. required String pubkey,
  2. List<String> userRelays = const [],
})
override

Generates a nprofile id from the given pubkey and relays, if no relays are given, it will be an empty list. You can decode the generated nprofile id with decodeNprofileToMap.

Example:

final nProfileId = Nostr.instance.utilsService.encodePubKeyToNProfile(
 pubkey: "pubkey in hex format",
userRelays: ["relay1", "relay2"],
);

print(nProfileId); // ...

Implementation

@override
String encodeNProfile({
  required String pubkey,
  List<String> userRelays = const [],
}) {
  final map = <String, dynamic>{'pubkey': pubkey, 'relays': userRelays};

  return _nProfileMapToBech32(map);
}