mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-22 08:25:53 -05:00
Fixing typos
This commit is contained in:
parent
0311220eae
commit
5de95955c1
43
68.md
43
68.md
|
@ -13,18 +13,18 @@ Every shared replaceable MUST be signed with its own private key. The event owns
|
||||||
The event's private key MUST be shared with all editors through `p` tags. The key is [NIP-44](44.md)-encrypted to each editor and placed as the 4th element in a regular `p` tag.
|
The event's private key MUST be shared with all editors through `p` tags. The key is [NIP-44](44.md)-encrypted to each editor and placed as the 4th element in a regular `p` tag.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
val edittingKeyPair = nostr.generateKeyPair()
|
val editingKeyPair = nostr.generateKeyPair()
|
||||||
|
|
||||||
{
|
{
|
||||||
"pubkey": edittingKeyPair.publicKey
|
"pubkey": editingKeyPair.publicKey
|
||||||
"kind": 3xxxx or 1xxxx,
|
"kind": 3xxxx or 1xxxx,
|
||||||
"tags": [
|
"tags": [
|
||||||
["d", "<unique identifier>"]
|
["d", "<unique identifier>"]
|
||||||
["p", "<pubkey 1>", "<relay url>", nip44Encrypt(edittingKeyPair.privateKeyHex, edittingKeyPair.privateKey, "<pubkey 1>") ]
|
["p", "<pubkey 1>", "<relay url>", nip44Encrypt(editingKeyPair.privateKeyHex, editingKeyPair.privateKey, "<pubkey 1>") ]
|
||||||
["p", "<pubkey 2>", "<relay url>", nip44Encrypt(edittingKeyPair.privateKeyHex, edittingKeyPair.privateKey, "<pubkey 2>") ]
|
["p", "<pubkey 2>", "<relay url>", nip44Encrypt(editingKeyPair.privateKeyHex, editingKeyPair.privateKey, "<pubkey 2>") ]
|
||||||
],
|
],
|
||||||
"content": "",
|
"content": "",
|
||||||
"sig": signWith(edittingKeyPair.privateKey)
|
"sig": signWith(editingKeyPair.privateKey)
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -47,20 +47,20 @@ Both keys are shared as encrypted `p` tags between the editing key and each user
|
||||||
The `.content` is then encrypted from the editing private key to the viewing public key.
|
The `.content` is then encrypted from the editing private key to the viewing public key.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
val edittingKeyPair = nostr.generateKeyPair()
|
val editingKeyPair = nostr.generateKeyPair()
|
||||||
val viewingKeyPair = nostr.generateKeyPair()
|
val viewingKeyPair = nostr.generateKeyPair()
|
||||||
|
|
||||||
{
|
{
|
||||||
"pubkey": edittingKeyPair.publicKey
|
"pubkey": editingKeyPair.publicKey
|
||||||
"kind": 3xxxx or 1xxxx,
|
"kind": 3xxxx or 1xxxx,
|
||||||
"tags": [
|
"tags": [
|
||||||
["d", "<unique identifier>"]
|
["d", "<unique identifier>"]
|
||||||
["p", "<pubkey 1>", "<relay url>", nip44Encrypt(edittingKeyPair.privateKeyHex, edittingKeyPair.privateKey, "<pubkey 1>") ]
|
["p", "<pubkey 1>", "<relay url>", nip44Encrypt(editingKeyPair.privateKeyHex, editingKeyPair.privateKey, "<pubkey 1>") ]
|
||||||
["p", "<pubkey 2>", "<relay url>", nip44Encrypt(edittingKeyPair.privateKeyHex, edittingKeyPair.privateKey, "<pubkey 2>") ]
|
["p", "<pubkey 2>", "<relay url>", nip44Encrypt(editingKeyPair.privateKeyHex, editingKeyPair.privateKey, "<pubkey 2>") ]
|
||||||
["p", "<pubkey 3>", "<relay url>", nip44Encrypt(viewingKeyPair.privateKeyHex, edittingKeyPair.privateKey, "<pubkey 3>") ] // view only
|
["p", "<pubkey 3>", "<relay url>", nip44Encrypt(viewingKeyPair.privateKeyHex, editingKeyPair.privateKey, "<pubkey 3>") ] // view only
|
||||||
],
|
],
|
||||||
"content": nip44Encrypt("some text", edittingKeyPair.privateKey, viewingKeyPair.publicKey),
|
"content": nip44Encrypt("some text", editingKeyPair.privateKey, viewingKeyPair.publicKey),
|
||||||
"sig": signWith(edittingKeyPair.privateKey)
|
"sig": signWith(editingKeyPair.privateKey)
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -71,30 +71,31 @@ To decrypt the event, all receivers MUST:
|
||||||
3. calculate the public key of the shared key.
|
3. calculate the public key of the shared key.
|
||||||
4. if the public key is the same as `.pubkey`, this is an editing key, if not this is the viewing key
|
4. if the public key is the same as `.pubkey`, this is an editing key, if not this is the viewing key
|
||||||
5. if it is the editing key, decrypt all the other `p`-tag keys and find the viewing key
|
5. if it is the editing key, decrypt all the other `p`-tag keys and find the viewing key
|
||||||
6. once both keys are known, decrypt the `.content` with `nip44Decrypt(event.content, viewingKeyPair.privatekey, event.pubkey)`
|
6. once the viewing key is known, decrypt the `.content` with `nip44Decrypt(event.content, viewingKeyPair.privatekey, event.pubkey)`
|
||||||
|
7. use the editing key to sign if known
|
||||||
|
|
||||||
### Special Case: No Viewing Keys
|
### Special Case: No Viewing Keys
|
||||||
|
|
||||||
If the group if users that only have viewing permissions is empty there won't be a `p`-tag to host the viewing key. In those cases, the `.content` MUST then be encrypted to the editing public key.
|
When the group of users with viewing permissions is empty, there won't be a `p`-tag to host the viewing key. In those cases, the `.content` MUST be encrypted to the editing public key.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
val edittingKeyPair = nostr.generateKeyPair()
|
val editingKeyPair = nostr.generateKeyPair()
|
||||||
|
|
||||||
{
|
{
|
||||||
"pubkey": edittingKeyPair.publicKey
|
"pubkey": editingKeyPair.publicKey
|
||||||
"kind": 3xxxx or 1xxxx,
|
"kind": 3xxxx or 1xxxx,
|
||||||
"tags": [
|
"tags": [
|
||||||
["d", "<unique identifier>"]
|
["d", "<unique identifier>"]
|
||||||
["p", "<pubkey 1>", "<relay url>", nip44Encrypt(edittingKeyPair.privateKeyHex, edittingKeyPair.privateKey, "<pubkey 1>") ]
|
["p", "<pubkey 1>", "<relay url>", nip44Encrypt(editingKeyPair.privateKeyHex, editingKeyPair.privateKey, "<pubkey 1>") ]
|
||||||
["p", "<pubkey 2>", "<relay url>", nip44Encrypt(edittingKeyPair.privateKeyHex, edittingKeyPair.privateKey, "<pubkey 2>") ]
|
["p", "<pubkey 2>", "<relay url>", nip44Encrypt(editingKeyPair.privateKeyHex, editingKeyPair.privateKey, "<pubkey 2>") ]
|
||||||
],
|
],
|
||||||
"content": nip44Encrypt("some text", edittingKeyPair.privateKey, edittingKeyPair.publicKey),
|
"content": nip44Encrypt("some text", editingKeyPair.privateKey, editingKeyPair.publicKey),
|
||||||
"sig": signWith(edittingKeyPair.privateKey)
|
"sig": signWith(editingKeyPair.privateKey)
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Similarly, when decrypting the `.content`, if the receiver client can't find a viewing key, it SHOULD use the editing key to decrypt: `nip44Decrypt(event.content, edittingKeyPair.privateKey, edittingKeyPair.publcKey)`
|
Similarly, if the receiving client can't find a viewing key, it SHOULD use the editing public key to decrypt: `nip44Decrypt(event.content, editingKeyPair.privateKey, editingKeyPair.publcKey)`
|
||||||
|
|
||||||
## Final Considerations
|
## Final Considerations
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user