NIP-55: Try to explain how to correctly initiate a connection (#2166)

This commit is contained in:
greenart7c3
2025-12-18 10:18:54 -03:00
committed by GitHub
parent 862c7c0fe9
commit 7cafdbb0cf

34
55.md
View File

@@ -107,6 +107,13 @@ Send the Intent:
launcher.launch(intent)
```
### Initiating a connection
- Client send a get_public_key `Intent`
- Signer responds with the user `pubkey` and it's `packageName`
- Client saves the `pubkey` and `packageName` somewhere and NEVER calls `get_public_key` again
- Client now can send `content resolvers` and `Intents` for the other methods
#### Methods
- **get_public_key**
@@ -299,33 +306,6 @@ Clients SHOULD save the user pubkey locally and avoid calling the `get_public_ke
#### Methods
- **get_public_key**
- params:
```kotlin
val result = context.contentResolver.query(
Uri.parse("content://com.example.signer.GET_PUBLIC_KEY"),
listOf(hex_pub_key),
null,
null,
null
)
```
- result:
- Will return the **pubkey** in the result column
```kotlin
if (result == null) return
if (it.getColumnIndex("rejected") > -1) return
if (result.moveToFirst()) {
val index = it.getColumnIndex("result")
if (index < 0) return
val pubkey = it.getString(index)
}
```
- **sign_event**
- params: