[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:
greenart7c3 2025-02-17 15:09:37 -03:00 committed by GitHub
parent 8e6f2c06c3
commit 330de34c7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

7
55.md
View File

@ -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")