diff options
| author | greenart7c3 <115044884+greenart7c3@users.noreply.github.com> | 2025-12-18 10:18:54 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-18 08:18:54 -0500 |
| commit | 7cafdbb0cf115db81c6edd5a4846921085108ff7 (patch) | |
| tree | fce2ed366318bdaebb414e4c5790e0f8120ba7eb | |
| parent | 862c7c0fe971c3754115fcac92a5dcc99845f67a (diff) | |
NIP-55: Try to explain how to correctly initiate a connection (#2166)
| -rw-r--r-- | 55.md | 34 |
1 files changed, 7 insertions, 27 deletions
| @@ -107,6 +107,13 @@ Send the Intent: | |||
| 107 | launcher.launch(intent) | 107 | launcher.launch(intent) |
| 108 | ``` | 108 | ``` |
| 109 | 109 | ||
| 110 | ### Initiating a connection | ||
| 111 | |||
| 112 | - Client send a get_public_key `Intent` | ||
| 113 | - Signer responds with the user `pubkey` and it's `packageName` | ||
| 114 | - Client saves the `pubkey` and `packageName` somewhere and NEVER calls `get_public_key` again | ||
| 115 | - Client now can send `content resolvers` and `Intents` for the other methods | ||
| 116 | |||
| 110 | #### Methods | 117 | #### Methods |
| 111 | 118 | ||
| 112 | - **get_public_key** | 119 | - **get_public_key** |
| @@ -299,33 +306,6 @@ Clients SHOULD save the user pubkey locally and avoid calling the `get_public_ke | |||
| 299 | 306 | ||
| 300 | #### Methods | 307 | #### Methods |
| 301 | 308 | ||
| 302 | - **get_public_key** | ||
| 303 | - params: | ||
| 304 | |||
| 305 | ```kotlin | ||
| 306 | val result = context.contentResolver.query( | ||
| 307 | Uri.parse("content://com.example.signer.GET_PUBLIC_KEY"), | ||
| 308 | listOf(hex_pub_key), | ||
| 309 | null, | ||
| 310 | null, | ||
| 311 | null | ||
| 312 | ) | ||
| 313 | ``` | ||
| 314 | - result: | ||
| 315 | - Will return the **pubkey** in the result column | ||
| 316 | |||
| 317 | ```kotlin | ||
| 318 | if (result == null) return | ||
| 319 | |||
| 320 | if (it.getColumnIndex("rejected") > -1) return | ||
| 321 | |||
| 322 | if (result.moveToFirst()) { | ||
| 323 | val index = it.getColumnIndex("result") | ||
| 324 | if (index < 0) return | ||
| 325 | val pubkey = it.getString(index) | ||
| 326 | } | ||
| 327 | ``` | ||
| 328 | |||
| 329 | - **sign_event** | 309 | - **sign_event** |
| 330 | - params: | 310 | - params: |
| 331 | 311 | ||