diff options
Diffstat (limited to '55.md')
| -rw-r--r-- | 55.md | 16 |
1 files changed, 8 insertions, 8 deletions
| @@ -8,7 +8,7 @@ Android Signer Application | |||
| 8 | 8 | ||
| 9 | This NIP describes a method for 2-way communication between an Android signer and any Nostr client on Android. The Android signer is an Android Application and the client can be a web client or an Android application. | 9 | This NIP describes a method for 2-way communication between an Android signer and any Nostr client on Android. The Android signer is an Android Application and the client can be a web client or an Android application. |
| 10 | 10 | ||
| 11 | # Usage for Android applications | 11 | ## Usage for Android applications |
| 12 | 12 | ||
| 13 | The Android signer uses Intents (to accept/reject permissions manually) and Content Resolvers (to accept/reject permissions automatically in background if the user allowed it) to communicate between applications. | 13 | The Android signer uses Intents (to accept/reject permissions manually) and Content Resolvers (to accept/reject permissions automatically in background if the user allowed it) to communicate between applications. |
| 14 | 14 | ||
| @@ -38,7 +38,7 @@ fun isExternalSignerInstalled(context: Context): Boolean { | |||
| 38 | } | 38 | } |
| 39 | ``` | 39 | ``` |
| 40 | 40 | ||
| 41 | ## Using Intents | 41 | ### Using Intents |
| 42 | 42 | ||
| 43 | To get the result back from the Signer Application you should use `registerForActivityResult` or `rememberLauncherForActivityResult` in Kotlin. If you are using another framework check the documentation of your framework or a third party library to get the result. | 43 | To get the result back from the Signer Application you should use `registerForActivityResult` or `rememberLauncherForActivityResult` in Kotlin. If you are using another framework check the documentation of your framework or a third party library to get the result. |
| 44 | 44 | ||
| @@ -107,7 +107,7 @@ Send the Intent: | |||
| 107 | launcher.launch(intent) | 107 | launcher.launch(intent) |
| 108 | ``` | 108 | ``` |
| 109 | 109 | ||
| 110 | ### Methods | 110 | #### Methods |
| 111 | 111 | ||
| 112 | - **get_public_key** | 112 | - **get_public_key** |
| 113 | - params: | 113 | - params: |
| @@ -283,7 +283,7 @@ launcher.launch(intent) | |||
| 283 | val id = intent.data?.getStringExtra("id") | 283 | val id = intent.data?.getStringExtra("id") |
| 284 | ``` | 284 | ``` |
| 285 | 285 | ||
| 286 | ## Using Content Resolver | 286 | ### Using Content Resolver |
| 287 | 287 | ||
| 288 | To get the result back from Signer Application you should use contentResolver.query in Kotlin. If you are using another framework check the documentation of your framework or a third party library to get the result. | 288 | To get the result back from Signer Application you should use contentResolver.query in Kotlin. If you are using another framework check the documentation of your framework or a third party library to get the result. |
| 289 | 289 | ||
| @@ -295,7 +295,7 @@ For the other types Signer Application returns the column "result" | |||
| 295 | 295 | ||
| 296 | If the user chose to always reject the event, signer application will return the column "rejected" and you should not open signer application | 296 | If the user chose to always reject the event, signer application will return the column "rejected" and you should not open signer application |
| 297 | 297 | ||
| 298 | ### Methods | 298 | #### Methods |
| 299 | 299 | ||
| 300 | - **get_public_key** | 300 | - **get_public_key** |
| 301 | - params: | 301 | - params: |
| @@ -482,7 +482,7 @@ If the user chose to always reject the event, signer application will return the | |||
| 482 | } | 482 | } |
| 483 | ``` | 483 | ``` |
| 484 | 484 | ||
| 485 | # Usage for Web Applications | 485 | ## Usage for Web Applications |
| 486 | 486 | ||
| 487 | You should consider using [NIP-46: Nostr Connect](46.md) for a better experience for web applications. When using this approach, the web app can't call the signer in the background, so the user will see a popup for every event you try to sign. | 487 | You should consider using [NIP-46: Nostr Connect](46.md) for a better experience for web applications. When using this approach, the web app can't call the signer in the background, so the user will see a popup for every event you try to sign. |
| 488 | 488 | ||
| @@ -496,7 +496,7 @@ You can configure the `returnType` to be **signature** or **event**. | |||
| 496 | 496 | ||
| 497 | Android intents and browser urls have limitations, so if you are using the `returnType` of **event** consider using the parameter **compressionType=gzip** that will return "Signer1" + Base64 gzip encoded event json | 497 | Android intents and browser urls have limitations, so if you are using the `returnType` of **event** consider using the parameter **compressionType=gzip** that will return "Signer1" + Base64 gzip encoded event json |
| 498 | 498 | ||
| 499 | ## Methods | 499 | ### Methods |
| 500 | 500 | ||
| 501 | - **get_public_key** | 501 | - **get_public_key** |
| 502 | - params: | 502 | - params: |
| @@ -547,7 +547,7 @@ Android intents and browser urls have limitations, so if you are using the `retu | |||
| 547 | window.href = `nostrsigner:${eventJson}?compressionType=none&returnType=signature&type=decrypt_zap_event&callbackUrl=https://example.com/?event=`; | 547 | window.href = `nostrsigner:${eventJson}?compressionType=none&returnType=signature&type=decrypt_zap_event&callbackUrl=https://example.com/?event=`; |
| 548 | ``` | 548 | ``` |
| 549 | 549 | ||
| 550 | ## Example | 550 | ### Example |
| 551 | 551 | ||
| 552 | ```js | 552 | ```js |
| 553 | <!DOCTYPE html> | 553 | <!DOCTYPE html> |