diff --git a/07.md b/07.md index 6c66322..0d5bfa8 100644 --- a/07.md +++ b/07.md @@ -18,10 +18,10 @@ async window.nostr.signEvent(event: { created_at: number, kind: number, tags: st Aside from these two basic above, the following functions can also be implemented optionally: ``` async window.nostr.getRelays(): { [url: string]: {read: boolean, write: boolean} } // returns a basic map of relay urls to relay policies -async window.nostr.nip04.encrypt(pubkey, plaintext): string // returns ciphertext and iv as specified in nip-04 (deprecated) -async window.nostr.nip04.decrypt(pubkey, ciphertext): string // takes ciphertext and iv as specified in nip-04 (deprecated) -async window.nostr.nip44.encrypt(pubkey, plaintext): string // returns ciphertext as specified in nip-44 -async window.nostr.nip44.decrypt(pubkey, ciphertext): string // takes ciphertext as specified in nip-44 +async window.nostr.nip04.encrypt(pubkey, plaintext, optional_kind): string // returns ciphertext and iv as specified in nip-04 (deprecated) +async window.nostr.nip04.decrypt(pubkey, ciphertext, optional_kind): string // takes ciphertext and iv as specified in nip-04 (deprecated) +async window.nostr.nip44.encrypt(pubkey, plaintext, optional_kind): string // returns ciphertext as specified in nip-44 +async window.nostr.nip44.decrypt(pubkey, ciphertext, optional_kind): string // takes ciphertext as specified in nip-44 ``` ### Implementation diff --git a/46.md b/46.md index 1528116..749001c 100644 --- a/46.md +++ b/46.md @@ -126,10 +126,10 @@ Each of the following are methods that the client sends to the remote signer. | `ping` | `[]` | "pong" | | `get_relays` | `[]` | `json_stringified({: {read: , write: }})` | | `get_public_key` | `[]` | `` | -| `nip04_encrypt` | `[, ]` | `` | -| `nip04_decrypt` | `[, ]` | `` | -| `nip44_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip44_ciphertext>` | -| `nip44_decrypt` | `[<third_party_pubkey>, <nip44_ciphertext_to_decrypt>]` | `<plaintext>` | +| `nip04_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>, <optional_kind>]` | `<nip04_ciphertext>` | +| `nip04_decrypt` | `[<third_party_pubkey>, <nip04_ciphertext_to_decrypt>, <optional_kind>]` | `<plaintext>` | +| `nip44_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>, <optional_kind>]` | `<nip44_ciphertext>` | +| `nip44_decrypt` | `[<third_party_pubkey>, <nip44_ciphertext_to_decrypt>, <optional_kind>]` | `<plaintext>` | ### Requested permissions diff --git a/55.md b/55.md index 4565e8c..7c1e91d 100644 --- a/55.md +++ b/55.md @@ -144,6 +144,8 @@ launcher.launch(intent) intent.putExtra("current_user", account.keyPair.pubKey.toNpub()) // Send the hex pubKey that will be used for encrypting the data intent.putExtra("pubKey", pubKey) + // Optionally send the event kind you want to encrypt + intent.putExtra("kind", kind) context.startActivity(intent) ``` @@ -169,6 +171,8 @@ launcher.launch(intent) intent.putExtra("current_user", account.keyPair.pubKey.toNpub()) // Send the hex pubKey that will be used for encrypting the data intent.putExtra("pubKey", pubKey) + // Optionally send the event kind you want to encrypt + intent.putExtra("kind", kind) context.startActivity(intent) ``` @@ -194,6 +198,8 @@ launcher.launch(intent) intent.putExtra("current_user", account.keyPair.pubKey.toNpub()) // Send the hex pubKey that will be used for decrypting the data intent.putExtra("pubKey", pubKey) + // Optionally send the event kind you want to decrypt + intent.putExtra("kind", kind) context.startActivity(intent) ``` @@ -219,6 +225,8 @@ launcher.launch(intent) intent.putExtra("current_user", account.keyPair.pubKey.toNpub()) // Send the hex pubKey that will be used for decrypting the data intent.putExtra("pubKey", pubKey) + // Optionally send the event kind you want to decrypt + intent.putExtra("kind", kind) context.startActivity(intent) ``` @@ -470,28 +478,28 @@ Android intents and browser urls have limitations, so if you are using the `retu - params: ```js - window.href = `nostrsigner:${plainText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip04_encrypt&callbackUrl=https://example.com/?event=`; + window.href = `nostrsigner:${plainText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip04_encrypt&kind=10000&callbackUrl=https://example.com/?event=`; ``` - **nip44_encrypt** - params: ```js - window.href = `nostrsigner:${plainText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip44_encrypt&callbackUrl=https://example.com/?event=`; + window.href = `nostrsigner:${plainText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip44_encrypt&kind=10000&callbackUrl=https://example.com/?event=`; ``` - **nip04_decrypt** - params: ```js - window.href = `nostrsigner:${encryptedText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip04_decrypt&callbackUrl=https://example.com/?event=`; + window.href = `nostrsigner:${encryptedText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip04_decrypt&kind=10000&callbackUrl=https://example.com/?event=`; ``` - **nip44_decrypt** - params: ```js - window.href = `nostrsigner:${encryptedText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip44_decrypt&callbackUrl=https://example.com/?event=`; + window.href = `nostrsigner:${encryptedText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip44_decrypt&kind=10000&callbackUrl=https://example.com/?event=`; ``` - **decrypt_zap_event**