NostrWalletConnectUri.parseConnectionUri constructor

NostrWalletConnectUri.parseConnectionUri(
  1. String uri
)

Implementation

factory NostrWalletConnectUri.parseConnectionUri(String uri) {
  Uri parsedUri = Uri.parse(uri);

  String? pubkey = _extractPubkey(parsedUri.toString());
  String? relayUrl = parsedUri.queryParameters['relay'];
  String? secret = parsedUri.queryParameters['secret'];
  String? lud16 = parsedUri.queryParameters['lud16'];

  if (pubkey == null || relayUrl == null || secret == null) {
    throw Exception(
        "Required fields (pubkey, relay, secret) are missing in the connection URI.");
  }

  return NostrWalletConnectUri(
    walletPubkey: pubkey,
    relay: relayUrl,
    secret: secret,
    lud16: lud16,
  );
}