mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-12-09 00:28:51 +00:00
Compare commits
14 Commits
zap-sender
...
nip46-crea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60c3e9fab7 | ||
|
|
f38b7ab619 | ||
|
|
667254eb7f | ||
|
|
db93c0d05f | ||
|
|
5868d4f67a | ||
|
|
7dc72f967c | ||
|
|
a411c4ac7f | ||
|
|
b3c0c4f64a | ||
|
|
74a586d6ae | ||
|
|
2409f821a4 | ||
|
|
3e05545952 | ||
|
|
8bfcbebae4 | ||
|
|
402c330ce9 | ||
|
|
27fef638e2 |
2
01.md
2
01.md
@@ -116,7 +116,7 @@ Clients can send 3 types of messages, which must be JSON arrays, according to th
|
||||
* `["REQ", <subscription_id>, <filters1>, <filters2>, ...]`, used to request events and subscribe to new updates.
|
||||
* `["CLOSE", <subscription_id>]`, used to stop previous subscriptions.
|
||||
|
||||
`<subscription_id>` is an arbitrary, non-empty string of max length 64 chars. It represents a subscription per connection. Relays MUST manage `<subscription_id>`s independently for each WebSocket connection. `<subscription_id>`s are not guarantueed to be globally unique.
|
||||
`<subscription_id>` is an arbitrary, non-empty string of max length 64 chars. It represents a subscription per connection. Relays MUST manage `<subscription_id>`s independently for each WebSocket connection. `<subscription_id>`s are not guaranteed to be globally unique.
|
||||
|
||||
`<filtersX>` is a JSON object that determines what events will be sent in that subscription, it can have the following attributes:
|
||||
|
||||
|
||||
4
44.md
4
44.md
@@ -161,7 +161,7 @@ validation rules, refer to BIP-340.
|
||||
### Implementation pseudocode
|
||||
|
||||
The following is a collection of python-like pseudocode functions which implement the above primitives,
|
||||
intended to guide impelmenters. A collection of implementations in different languages is available at https://github.com/paulmillr/nip44.
|
||||
intended to guide implementers. A collection of implementations in different languages is available at https://github.com/paulmillr/nip44.
|
||||
|
||||
```py
|
||||
# Calculates length of the padded byte array.
|
||||
@@ -286,7 +286,7 @@ Example of a test vector from the file:
|
||||
The file also contains intermediate values. A quick guidance with regards to its usage:
|
||||
|
||||
- `valid.get_conversation_key`: calculate conversation_key from secret key sec1 and public key pub2
|
||||
- `valid.get_message_keys`: calculate chacha_key, chacha_nocne, hmac_key from conversation_key and nonce
|
||||
- `valid.get_message_keys`: calculate chacha_key, chacha_nonce, hmac_key from conversation_key and nonce
|
||||
- `valid.calc_padded_len`: take unpadded length (first value), calculate padded length (second value)
|
||||
- `valid.encrypt_decrypt`: emulate real conversation. Calculate pub2 from sec2, verify conversation_key from (sec1, pub2), encrypt, verify payload, then calculate pub1 from sec1, verify conversation_key from (sec2, pub1), decrypt, verify plaintext.
|
||||
- `valid.encrypt_decrypt_long_msg`: same as previous step, but instead of a full plaintext and payload, their checksum is provided.
|
||||
|
||||
27
46.md
27
46.md
@@ -32,6 +32,10 @@ nostrconnect://<client-key-hex>?relay=wss://...&metadata={"name":"...", "url": "
|
||||
|
||||
The signer scans the QR code and sends a `connect` message to the client in the specified relays.
|
||||
|
||||
### Using a NIP-05
|
||||
|
||||
Clients can choose to connect with a backend with just a NIP-05 for the target user. The user enters a NIP-05 Nostr Address, which the client uses to resolve to a pubkey. NIP-05's nostr.json SHOULD include a `nip46` root element of the pubkey and the relays that should be used to communicate with the remote signer for this pubkey.
|
||||
|
||||
## Event payloads
|
||||
|
||||
Event payloads are [NIP-04](04.md)-encrypted JSON blobs that look like JSONRPC messages (their format is specified inside the `.content` of the event formats nelow).
|
||||
@@ -64,6 +68,23 @@ And the events the remote signer sends to the client have the following format:
|
||||
|
||||
The signer key will always be the key of the user who controls the signer device.
|
||||
|
||||
### Auth URL response
|
||||
A signer can reply with a `result: "auth_url", error: "<url>"`. This response can provide an easier way for the user to authorize this client to perform an action. Clients can redirect/popup this URL so the user can take an action directly on the signer backend.
|
||||
|
||||
When redirecting, the client can choose to add a `callbackUrl` query string parameter to tell the signer where to send the user after an action has been performed.
|
||||
|
||||
#### Example flow:
|
||||
|
||||
* User goes to a new client
|
||||
* Logins by typing their nip-05 "hello@example.com"
|
||||
* Client gets example.com/.well-known/nostr.json?name=hello
|
||||
* Client finds nip46 relays wss://relay.example.com and pubkey <123>
|
||||
* Client sends `connect` with remote pubkey `<123>`
|
||||
* Signer sends back `result: "auth_url", error: "https://auth.example.com/some-long-secret-path"`
|
||||
* Client opens popup for `auth_url` (for example `https://auth.example.com/ABCD`)
|
||||
* User authorizes the client to sign on behalf of pubkey <123>
|
||||
* Client's `connect` RPC call is `ack`ed.
|
||||
|
||||
### Methods
|
||||
|
||||
- **connect**
|
||||
@@ -96,4 +117,10 @@ The signer key will always be the key of the user who controls the signer device
|
||||
- **ping**
|
||||
- params: []
|
||||
- result: `"pong"`
|
||||
- **create_account**
|
||||
- params: `["name", "domain", "email"]
|
||||
- result: `generated-pubkey`
|
||||
|
||||
#### Account creation
|
||||
This method creates a new key inside the backend. All params are optional. Username+domain can be specified so a NIP-05 record is created to point to this key. Email is an optional parameter that allows the backend to check if this user has already created an account in this backend. The `create_account` method should be sent to the pubkey of the bunker, which should match the root NIP-05 entry (`_@domain`).
|
||||
|
||||
|
||||
2
50.md
2
50.md
@@ -41,7 +41,7 @@ implementation details between relays.
|
||||
Clients MAY verify that events returned by a relay match the specified query in a way that suits the
|
||||
client's use case, and MAY stop querying relays that have low precision.
|
||||
|
||||
Relays SHOULD exclude spam from search results by default if they supports some form of spam filtering.
|
||||
Relays SHOULD exclude spam from search results by default if they support some form of spam filtering.
|
||||
|
||||
## Extensions
|
||||
|
||||
|
||||
2
53.md
2
53.md
@@ -94,7 +94,7 @@ Common use cases include meeting rooms/workshops, watch-together activities, or
|
||||
["title", "Adult Swim Metalocalypse"],
|
||||
["summary", "Live stream from IPTV-ORG collection"],
|
||||
["streaming", "https://adultswim-vodlive.cdn.turner.com/live/metalocalypse/stream.m3u8"],
|
||||
["starts", "1687182672"]
|
||||
["starts", "1687182672"],
|
||||
["status", "live"],
|
||||
["t", "animation"],
|
||||
["t", "iptv"],
|
||||
|
||||
Reference in New Issue
Block a user