mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-12-19 13:08:50 +00:00
NIP-55: Try to explain how to correctly initiate a connection (#2166)
This commit is contained in:
34
55.md
34
55.md
@@ -107,6 +107,13 @@ Send the Intent:
|
|||||||
launcher.launch(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
|
#### Methods
|
||||||
|
|
||||||
- **get_public_key**
|
- **get_public_key**
|
||||||
@@ -299,33 +306,6 @@ Clients SHOULD save the user pubkey locally and avoid calling the `get_public_ke
|
|||||||
|
|
||||||
#### Methods
|
#### 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**
|
- **sign_event**
|
||||||
- params:
|
- params:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user