Skip to content

Commit

Permalink
add permissions and flags for multiple events
Browse files Browse the repository at this point in the history
  • Loading branch information
greenart7c3 committed Nov 29, 2023
1 parent 22e097f commit 646637b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,31 @@ intent.`package` = "com.greenart7c3.nostrsigner"
```kotlin
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:"))
intent.`package` = "com.greenart7c3.nostrsigner"

// You can send some default permissions for the user authorize for ever
val permissions = listOf(
Permission(
"sign_event",
22242
),
Permission(
"nip04_encrypt"
),
Permission(
"nip04_decrypt"
),
Permission(
"nip44_encrypt"
),
Permission(
"nip44_decrypt"
),
Permission(
"decrypt_zap_event"
),
)
intent.putExtra("permissions", permissions.toJson())

intent.putExtra("type", "get_public_key")
context.startActivity(intent)
```
Expand All @@ -70,6 +95,9 @@ intent.`package` = "com.greenart7c3.nostrsigner"
// Send the current logged in user npub
intent.putExtra("current_user", account.keyPair.pubKey.toNpub())

// If you are sending multiple intents without awaiting you can add some intent flags to sign all events withou opening multiple screens
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP)

context.startActivity(intent)
```
- result:
Expand Down

0 comments on commit 646637b

Please sign in to comment.