diff options
| -rw-r--r-- | 07.md | 1 | ||||
| -rw-r--r-- | 46.md | 1 | ||||
| -rw-r--r-- | 55.md | 56 |
3 files changed, 0 insertions, 58 deletions
| @@ -17,7 +17,6 @@ async window.nostr.signEvent(event: { created_at: number, kind: number, tags: st | |||
| 17 | 17 | ||
| 18 | Aside from these two basic above, the following functions can also be implemented optionally: | 18 | Aside from these two basic above, the following functions can also be implemented optionally: |
| 19 | ``` | 19 | ``` |
| 20 | async window.nostr.getRelays(): { [url: string]: {read: boolean, write: boolean} } // returns a basic map of relay urls to relay policies | ||
| 21 | async window.nostr.nip04.encrypt(pubkey, plaintext): string // returns ciphertext and iv as specified in nip-04 (deprecated) | 20 | async window.nostr.nip04.encrypt(pubkey, plaintext): string // returns ciphertext and iv as specified in nip-04 (deprecated) |
| 22 | async window.nostr.nip04.decrypt(pubkey, ciphertext): string // takes ciphertext and iv as specified in nip-04 (deprecated) | 21 | async window.nostr.nip04.decrypt(pubkey, ciphertext): string // takes ciphertext and iv as specified in nip-04 (deprecated) |
| 23 | async window.nostr.nip44.encrypt(pubkey, plaintext): string // returns ciphertext as specified in nip-44 | 22 | async window.nostr.nip44.encrypt(pubkey, plaintext): string // returns ciphertext as specified in nip-44 |
| @@ -100,7 +100,6 @@ Each of the following are methods that the _client_ sends to the _remote-signer_ | |||
| 100 | | `connect` | `[<remote-signer-pubkey>, <optional_secret>, <optional_requested_permissions>]` | "ack" OR `<required-secret-value>` | | 100 | | `connect` | `[<remote-signer-pubkey>, <optional_secret>, <optional_requested_permissions>]` | "ack" OR `<required-secret-value>` | |
| 101 | | `sign_event` | `[<{kind, content, tags, created_at}>]` | `json_stringified(<signed_event>)` | | 101 | | `sign_event` | `[<{kind, content, tags, created_at}>]` | `json_stringified(<signed_event>)` | |
| 102 | | `ping` | `[]` | "pong" | | 102 | | `ping` | `[]` | "pong" | |
| 103 | | `get_relays` | `[]` | `json_stringified({<relay_url>: {read: <boolean>, write: <boolean>}})` | | ||
| 104 | | `get_public_key` | `[]` | `<user-pubkey>` | | 103 | | `get_public_key` | `[]` | `<user-pubkey>` | |
| 105 | | `nip04_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip04_ciphertext>` | | 104 | | `nip04_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip04_ciphertext>` | |
| 106 | | `nip04_decrypt` | `[<third_party_pubkey>, <nip04_ciphertext_to_decrypt>]` | `<plaintext>` | | 105 | | `nip04_decrypt` | `[<third_party_pubkey>, <nip04_ciphertext_to_decrypt>]` | `<plaintext>` | |
| @@ -262,29 +262,6 @@ launcher.launch(intent) | |||
| 262 | val id = intent.data?.getStringExtra("id") | 262 | val id = intent.data?.getStringExtra("id") |
| 263 | ``` | 263 | ``` |
| 264 | 264 | ||
| 265 | - **get_relays** | ||
| 266 | - params: | ||
| 267 | |||
| 268 | ```kotlin | ||
| 269 | val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:")) | ||
| 270 | intent.`package` = "com.example.signer" | ||
| 271 | intent.putExtra("type", "get_relays") | ||
| 272 | // to control the result in your application in case you are not waiting the result before sending another intent | ||
| 273 | intent.putExtra("id", "some_id") | ||
| 274 | // Send the current logged in user pubkey | ||
| 275 | intent.putExtra("current_user", account.keyPair.pubkey) | ||
| 276 | |||
| 277 | context.startActivity(intent) | ||
| 278 | ``` | ||
| 279 | - result: | ||
| 280 | - If the user approved intent it will return the **result** and **id** fields | ||
| 281 | |||
| 282 | ```kotlin | ||
| 283 | val relayJsonText = intent.data?.getStringExtra("result") | ||
| 284 | // the id you sent | ||
| 285 | val id = intent.data?.getStringExtra("id") | ||
| 286 | ``` | ||
| 287 | |||
| 288 | - **decrypt_zap_event** | 265 | - **decrypt_zap_event** |
| 289 | - params: | 266 | - params: |
| 290 | 267 | ||
| @@ -480,32 +457,6 @@ If the user chose to always reject the event, signer application will return the | |||
| 480 | } | 457 | } |
| 481 | ``` | 458 | ``` |
| 482 | 459 | ||
| 483 | - **get_relays** | ||
| 484 | - params: | ||
| 485 | |||
| 486 | ```kotlin | ||
| 487 | val result = context.contentResolver.query( | ||
| 488 | Uri.parse("content://com.example.signer.GET_RELAYS"), | ||
| 489 | listOf("${logged_in_user_pubkey}"), | ||
| 490 | null, | ||
| 491 | null, | ||
| 492 | null | ||
| 493 | ) | ||
| 494 | ``` | ||
| 495 | - result: | ||
| 496 | - Will return the **result** column | ||
| 497 | |||
| 498 | ```kotlin | ||
| 499 | if (result == null) return | ||
| 500 | |||
| 501 | if (it.getColumnIndex("rejected") > -1) return | ||
| 502 | |||
| 503 | if (result.moveToFirst()) { | ||
| 504 | val index = it.getColumnIndex("result") | ||
| 505 | val relayJsonText = it.getString(index) | ||
| 506 | } | ||
| 507 | ``` | ||
| 508 | |||
| 509 | - **decrypt_zap_event** | 460 | - **decrypt_zap_event** |
| 510 | - params: | 461 | - params: |
| 511 | 462 | ||
| @@ -588,13 +539,6 @@ Android intents and browser urls have limitations, so if you are using the `retu | |||
| 588 | window.href = `nostrsigner:${encryptedText}?pubkey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip44_decrypt&callbackUrl=https://example.com/?event=`; | 539 | window.href = `nostrsigner:${encryptedText}?pubkey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip44_decrypt&callbackUrl=https://example.com/?event=`; |
| 589 | ``` | 540 | ``` |
| 590 | 541 | ||
| 591 | - **get_relays** | ||
| 592 | - params: | ||
| 593 | |||
| 594 | ```js | ||
| 595 | window.href = `nostrsigner:?compressionType=none&returnType=signature&type=get_relays&callbackUrl=https://example.com/?event=`; | ||
| 596 | ``` | ||
| 597 | |||
| 598 | - **decrypt_zap_event** | 542 | - **decrypt_zap_event** |
| 599 | - params: | 543 | - params: |
| 600 | 544 | ||