mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-02-22 05:09:00 +00:00
[NIP-55] Make it clear how to use the package name and what is the purpose of the intents and content resolvers (#1791)
This commit is contained in:
parent
8e6f2c06c3
commit
330de34c7c
7
55.md
7
55.md
@ -10,7 +10,7 @@ This NIP describes a method for 2-way communication between an Android signer an
|
||||
|
||||
# Usage for Android applications
|
||||
|
||||
The Android signer uses Intents and Content Resolvers to communicate between applications.
|
||||
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.
|
||||
|
||||
To be able to use the Android signer in your application you should add this to your AndroidManifest.xml:
|
||||
|
||||
@ -66,7 +66,7 @@ Create the Intent using the **nostrsigner** scheme:
|
||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:$content"))
|
||||
```
|
||||
|
||||
Set the Signer package name:
|
||||
Set the Signer package name after you receive the response from **get_public_key** method:
|
||||
|
||||
```kotlin
|
||||
intent.`package` = "com.example.signer"
|
||||
@ -114,7 +114,6 @@ launcher.launch(intent)
|
||||
|
||||
```kotlin
|
||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:"))
|
||||
intent.`package` = "com.example.signer"
|
||||
intent.putExtra("type", "get_public_key")
|
||||
// You can send some default permissions for the user to authorize for ever
|
||||
val permissions = listOf(
|
||||
@ -130,7 +129,7 @@ launcher.launch(intent)
|
||||
context.startActivity(intent)
|
||||
```
|
||||
- result:
|
||||
- If the user approved intent it will return the **pubkey** in the result field
|
||||
- If the user approved the intent it will return the **pubkey** in the result field and the signer packageName in the **package** field
|
||||
|
||||
```kotlin
|
||||
val pubkey = intent.data?.getStringExtra("result")
|
||||
|
Loading…
Reference in New Issue
Block a user