nip46: simple public key login using kind:10046

This commit is contained in:
fiatjaf 2024-11-11 22:03:06 -03:00
parent 2838e3bd51
commit 35f6a880f1

24
46.md
View File

@ -191,6 +191,30 @@ _client_ should display (in a popup or new tab) the URL from the `error` field a
![signing-example-with-auth-challenge](https://i.nostr.build/W3aj.png) ![signing-example-with-auth-challenge](https://i.nostr.build/W3aj.png)
## Pure public key login
A _client_ SHOULD support logins with just an `npub`, an `nprofile` or a NIP-05 address instead of requiring a full `bunker://...` URI. In order to do that, it can follow these steps:
1. Read _user-pubkey_ from the provided NIP-05, `nprofile` or `npub` code;
2. Acquire the list of outbox relays for _user_ (either by fetching the user's `kind:10002` relay list from relay hints or hardcoded relays or by other means);
3. Query these relay for a `kind:10046` event from _user_;
4. Read NIP-46 bunker connection metadata from that event -- then proceed as if the user had typed that bunker URI.
For this to work _user_ must have somehow published such `kind:10046` event beforehand (which might be a job for the bunker provider or app directly or not).
### `kind:10046` event format:
```jsonc
{
"pubkey": "<user-pubkey>",
"kind": 10046,
"tags": [
["relays", "<remote-signer-relay-url>", "<any-number-of-other-relay-urls...>"],
["pubkey", "<remote-signer-pubkey>"]
]
}
```
## Appendix ## Appendix
### Announcing _remote-signer_ metadata ### Announcing _remote-signer_ metadata