Merge pull request #1367 from greenart7c3/nip_55_flags

NIP-55: Add intent flags to open the signer once when sending multiple events
This commit is contained in:
Vitor Pamplona 2024-11-01 08:54:46 -04:00 committed by GitHub
commit c275ae74eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

29
55.md
View File

@ -72,6 +72,35 @@ Set the Signer package name:
intent.`package` = "com.example.signer"
```
If you are sending multiple intents without awaiting you can add some intent flags to sign all events without opening multiple times the signer
```kotlin
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP)
```
If you are developing a signer application them you need to add this to your AndroidManifest.xml so clients can use the intent flags above
```kotlin
android:launchMode="singleTop"
```
Signer MUST answer multiple permissions with an array of results
```kotlin
val results = listOf(
Result(
package = signerPackageName,
result = eventSignture,
id = intentId
)
)
val json = results.toJson()
intent.putExtra("results", json)
```
Send the Intent:
```kotlin