Kukks / NNostr

A Nostr Relay and Client written in C#
MIT License
113 stars 32 forks source link

Wll there be an /admin command to generate NIP-67 events for nostr clients or will just relaying be used? #28

Open johnheenan opened 5 hours ago

johnheenan commented 5 hours ago

NIP-67 in this code is a confirmatory event to provide NIP-47 nostr+walletconnect:// URI strings to nostr clients.

Will there be an /admin command, issued through a nostr DM from a nostr client, to generate this NIP-67 event for nostr clients?

How will security be handled? Such as only issued to clients whose public key matches the public key of the AdminKey?

Is it expected such techniques will be used by btcpay plugins?

I have commented on code here at https://github.com/Kukks/BTCPayServerPlugins/issues/63#issuecomment-2354632246, specifically from the NIP67.cs file: https://github.com/Kukks/NNostr/blob/78753daa9c0a81adebab1b50ebea923de654036a/NNostr.Client/Protocols/NIP67.cs#L110

NIP67 is, so far, a private nostr nip, which is suppose means there is intention to use this event in servers that use NNostr, in particulat BTCPay.

I have also posed a question https://github.com/Kukks/BTCPayServerPlugins/issues/63#issuecomment-2372553206 as to whether btcpay plugins can work in a low resource manner as nostr clients.

johnheenan commented 4 hours ago

Or is it just sufficient for the nostr client to construct a NIP-67 event and have the relay automatically relay it and rely on encryption with a known secret key to ensure security, such as the nostr server/relay AdminKey, also used as secret key for clients?

Maybe the mechanism suggested above, using an /admin command can also be used?

I am drawing a distinction between the nostr server as a server and as a relay. As a server the server can issue its own events to itself as a relay from interpreting an /admin command or it can simply relay a constructed NIP-67 event from a nostr client to whichever other nostr clients can interpret it and have requested it.

I know I should really test if sending a constructed NIP-67 event from a nostr client is relayed by a NNostr relay and report back. If there was a sample nostr client btcpay plugin or a sample standalone desktop app using NNostr client code with source code then this would be an easy test to construct, by adapting the source code.

johnheenan commented 11 minutes ago

The code provides a very useful NNostr.Tests directory for xUnit unit tests with a considerable number of tests. There is also a NNostr.UI directory which contains just the start of a UI with no useful functionality.

There is an incomplete and unfactored in test for NIP-67 with NIP-47. When factored in, the line below causes a unit test failure because the scheme passed, nostr+walletauth, to the next line is not the expected one. It should be nostr+walletconnect. https://github.com/Kukks/NNostr/blob/78753daa9c0a81adebab1b50ebea923de654036a/NNostr.Tests/ClientTests.cs#L26