Open johnheenan opened 3 days ago
Here is the answer: https://github.com/Kukks/NNostr/blob/78753daa9c0a81adebab1b50ebea923de654036a/NNostr.Client/Protocols/NIP67.cs#L110
return (NIP47.CreateUri(e.GetPublicKey(), key,relay, lud16:payload.Lud16), payload);
NIP67 is the name @Kukks has given to code to construct the Network Wallet Connect URI. He has assigned NIP67 one nostr event kind so far: 33194.
The static function below in the same file is used for unit tests: https://github.com/Kukks/NNostr/blob/78753daa9c0a81adebab1b50ebea923de654036a/NNostr.Client/Protocols/NIP67.cs#L40
What does this mean in practice?
I guess Kukks want an extension to NIP47 to include the wallet service can also be discovered by nostr, not just QR code, deeplink or pasting a URI.
https://github.com/Kukks/NNostr/blob/master/README.md#relay shows how to add in a nostr relay to BTCPay with the NIP67 extension.
So nostr clients that want to use NWC with BTCPay will need to generate a custom event and probably include the BTCPay server as a relay to ensure the event does not get ignored.
NIP47 is implmented by the nostr plugin.
NIP47 specifes an implementation must provide a connection URI for nostr clients to use at https://github.com/nostr-protocol/nips/blob/master/47.md#theory-of-operation
I assume the conection URI is then used to build a call to the function below through a nostr relay event:
https://github.com/Kukks/BTCPayServerPlugins/blob/5cfe2e5acd40cd4b982c34871c2e084cdc0467fe/Plugins/BTCPayServer.Plugins.NIP05/NostrWalletConnectLightningConnectionStringHandler.cs#L20
I cannot find a way to determine the connection URI.
From https://github.com/nostr-protocol/nips/blob/master/47.md#nostr-wallet-connect-uri
Nostr Wallet Connect URI
client discovers wallet service by scanning a QR code, handling a deeplink or pasting in a URI.
The wallet service generates this connection URI with protocol
nostr+walletconnect://
and base path it's hex-encodedpubkey
with the following query string parameters:relay
Required. URL of the relay where the wallet service is connected and will be listening for events. May be more than one.secret
Required. 32-byte randomly generated hex encoded string. The client MUST use this to sign events and encrypt payloads when communicating with the wallet service.lud16
Recommended. A lightning address that clients can use to automatically setup thelud16
field on the user's profile if they have none configured.The client should then store this connection and use it when the user wants to perform actions like paying an invoice. Due to this NIP using ephemeral events, it is recommended to pick relays that do not close connections on inactivity to not drop events.
Example connection string