diff options
| author | Vitor Pamplona <vitor@vitorpamplona.com> | 2024-10-23 09:05:17 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-23 09:05:17 -0400 |
| commit | bef7fc1cf4d1e853a590f95f60615f42eee211b0 (patch) | |
| tree | b335d1d852b66714cc815518542165f7ea9c0901 | |
| parent | 07de7ea7e5d2934afac1eb86db0cd0a0200039a0 (diff) | |
| parent | 30f39d35d18f49adc86c483c34b232560772d75c (diff) | |
Merge pull request #1533 from greenart7c3/nip_55_result
[NIP-55] - Change return field from signature to result
| -rw-r--r-- | 55.md | 68 |
1 files changed, 34 insertions, 34 deletions
| @@ -53,8 +53,8 @@ val launcher = rememberLauncherForActivityResult( | |||
| 53 | Toast.LENGTH_SHORT | 53 | Toast.LENGTH_SHORT |
| 54 | ).show() | 54 | ).show() |
| 55 | } else { | 55 | } else { |
| 56 | val signature = activityResult.data?.getStringExtra("signature") | 56 | val result = activityResult.data?.getStringExtra("result") |
| 57 | // Do something with signature ... | 57 | // Do something with result ... |
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | ) | 60 | ) |
| @@ -101,10 +101,10 @@ launcher.launch(intent) | |||
| 101 | context.startActivity(intent) | 101 | context.startActivity(intent) |
| 102 | ``` | 102 | ``` |
| 103 | - result: | 103 | - result: |
| 104 | - If the user approved intent it will return the **pubkey** in the signature field | 104 | - If the user approved intent it will return the **pubkey** in the result field |
| 105 | 105 | ||
| 106 | ```kotlin | 106 | ```kotlin |
| 107 | val pubkey = intent.data?.getStringExtra("signature") | 107 | val pubkey = intent.data?.getStringExtra("result") |
| 108 | // The package name of the signer application | 108 | // The package name of the signer application |
| 109 | val packageName = intent.data?.getStringExtra("package") | 109 | val packageName = intent.data?.getStringExtra("package") |
| 110 | ``` | 110 | ``` |
| @@ -124,10 +124,10 @@ launcher.launch(intent) | |||
| 124 | context.startActivity(intent) | 124 | context.startActivity(intent) |
| 125 | ``` | 125 | ``` |
| 126 | - result: | 126 | - result: |
| 127 | - If the user approved intent it will return the **signature**, **id** and **event** fields | 127 | - If the user approved intent it will return the **result**, **id** and **event** fields |
| 128 | 128 | ||
| 129 | ```kotlin | 129 | ```kotlin |
| 130 | val signature = intent.data?.getStringExtra("signature") | 130 | val signature = intent.data?.getStringExtra("result") |
| 131 | // The id you sent | 131 | // The id you sent |
| 132 | val id = intent.data?.getStringExtra("id") | 132 | val id = intent.data?.getStringExtra("id") |
| 133 | val signedEventJson = intent.data?.getStringExtra("event") | 133 | val signedEventJson = intent.data?.getStringExtra("event") |
| @@ -150,10 +150,10 @@ launcher.launch(intent) | |||
| 150 | context.startActivity(intent) | 150 | context.startActivity(intent) |
| 151 | ``` | 151 | ``` |
| 152 | - result: | 152 | - result: |
| 153 | - If the user approved intent it will return the **signature** and **id** fields | 153 | - If the user approved intent it will return the **result** and **id** fields |
| 154 | 154 | ||
| 155 | ```kotlin | 155 | ```kotlin |
| 156 | val encryptedText = intent.data?.getStringExtra("signature") | 156 | val encryptedText = intent.data?.getStringExtra("result") |
| 157 | // the id you sent | 157 | // the id you sent |
| 158 | val id = intent.data?.getStringExtra("id") | 158 | val id = intent.data?.getStringExtra("id") |
| 159 | ``` | 159 | ``` |
| @@ -200,10 +200,10 @@ launcher.launch(intent) | |||
| 200 | context.startActivity(intent) | 200 | context.startActivity(intent) |
| 201 | ``` | 201 | ``` |
| 202 | - result: | 202 | - result: |
| 203 | - If the user approved intent it will return the **signature** and **id** fields | 203 | - If the user approved intent it will return the **result** and **id** fields |
| 204 | 204 | ||
| 205 | ```kotlin | 205 | ```kotlin |
| 206 | val plainText = intent.data?.getStringExtra("signature") | 206 | val plainText = intent.data?.getStringExtra("result") |
| 207 | // the id you sent | 207 | // the id you sent |
| 208 | val id = intent.data?.getStringExtra("id") | 208 | val id = intent.data?.getStringExtra("id") |
| 209 | ``` | 209 | ``` |
| @@ -225,10 +225,10 @@ launcher.launch(intent) | |||
| 225 | context.startActivity(intent) | 225 | context.startActivity(intent) |
| 226 | ``` | 226 | ``` |
| 227 | - result: | 227 | - result: |
| 228 | - If the user approved intent it will return the **signature** and **id** fields | 228 | - If the user approved intent it will return the **result** and **id** fields |
| 229 | 229 | ||
| 230 | ```kotlin | 230 | ```kotlin |
| 231 | val plainText = intent.data?.getStringExtra("signature") | 231 | val plainText = intent.data?.getStringExtra("result") |
| 232 | // the id you sent | 232 | // the id you sent |
| 233 | val id = intent.data?.getStringExtra("id") | 233 | val id = intent.data?.getStringExtra("id") |
| 234 | ``` | 234 | ``` |
| @@ -248,10 +248,10 @@ launcher.launch(intent) | |||
| 248 | context.startActivity(intent) | 248 | context.startActivity(intent) |
| 249 | ``` | 249 | ``` |
| 250 | - result: | 250 | - result: |
| 251 | - If the user approved intent it will return the **signature** and **id** fields | 251 | - If the user approved intent it will return the **result** and **id** fields |
| 252 | 252 | ||
| 253 | ```kotlin | 253 | ```kotlin |
| 254 | val relayJsonText = intent.data?.getStringExtra("signature") | 254 | val relayJsonText = intent.data?.getStringExtra("result") |
| 255 | // the id you sent | 255 | // the id you sent |
| 256 | val id = intent.data?.getStringExtra("id") | 256 | val id = intent.data?.getStringExtra("id") |
| 257 | ``` | 257 | ``` |
| @@ -270,10 +270,10 @@ launcher.launch(intent) | |||
| 270 | context.startActivity(intent) | 270 | context.startActivity(intent) |
| 271 | ``` | 271 | ``` |
| 272 | - result: | 272 | - result: |
| 273 | - If the user approved intent it will return the **signature** and **id** fields | 273 | - If the user approved intent it will return the **result** and **id** fields |
| 274 | 274 | ||
| 275 | ```kotlin | 275 | ```kotlin |
| 276 | val eventJson = intent.data?.getStringExtra("signature") | 276 | val eventJson = intent.data?.getStringExtra("result") |
| 277 | // the id you sent | 277 | // the id you sent |
| 278 | val id = intent.data?.getStringExtra("id") | 278 | val id = intent.data?.getStringExtra("id") |
| 279 | ``` | 279 | ``` |
| @@ -284,9 +284,9 @@ To get the result back from Signer Application you should use contentResolver.qu | |||
| 284 | 284 | ||
| 285 | If the user did not check the "remember my choice" option, the pubkey is not in Signer Application or the signer type is not recognized the `contentResolver` will return null | 285 | If the user did not check the "remember my choice" option, the pubkey is not in Signer Application or the signer type is not recognized the `contentResolver` will return null |
| 286 | 286 | ||
| 287 | For the SIGN_EVENT type Signer Application returns two columns "signature" and "event". The column event is the signed event json | 287 | For the SIGN_EVENT type Signer Application returns two columns "result" and "event". The column event is the signed event json |
| 288 | 288 | ||
| 289 | For the other types Signer Application returns the column "signature" | 289 | For the other types Signer Application returns the column "result" |
| 290 | 290 | ||
| 291 | If the user chose to always reject the event, signer application will return the column "rejected" and you should not open signer application | 291 | If the user chose to always reject the event, signer application will return the column "rejected" and you should not open signer application |
| 292 | 292 | ||
| @@ -305,13 +305,13 @@ If the user chose to always reject the event, signer application will return the | |||
| 305 | ) | 305 | ) |
| 306 | ``` | 306 | ``` |
| 307 | - result: | 307 | - result: |
| 308 | - Will return the **pubkey** in the signature column | 308 | - Will return the **pubkey** in the result column |
| 309 | 309 | ||
| 310 | ```kotlin | 310 | ```kotlin |
| 311 | if (result == null) return | 311 | if (result == null) return |
| 312 | 312 | ||
| 313 | if (result.moveToFirst()) { | 313 | if (result.moveToFirst()) { |
| 314 | val index = it.getColumnIndex("signature") | 314 | val index = it.getColumnIndex("result") |
| 315 | if (index < 0) return | 315 | if (index < 0) return |
| 316 | val pubkey = it.getString(index) | 316 | val pubkey = it.getString(index) |
| 317 | } | 317 | } |
| @@ -330,13 +330,13 @@ If the user chose to always reject the event, signer application will return the | |||
| 330 | ) | 330 | ) |
| 331 | ``` | 331 | ``` |
| 332 | - result: | 332 | - result: |
| 333 | - Will return the **signature** and the **event** columns | 333 | - Will return the **result** and the **event** columns |
| 334 | 334 | ||
| 335 | ```kotlin | 335 | ```kotlin |
| 336 | if (result == null) return | 336 | if (result == null) return |
| 337 | 337 | ||
| 338 | if (result.moveToFirst()) { | 338 | if (result.moveToFirst()) { |
| 339 | val index = it.getColumnIndex("signature") | 339 | val index = it.getColumnIndex("result") |
| 340 | val indexJson = it.getColumnIndex("event") | 340 | val indexJson = it.getColumnIndex("event") |
| 341 | val signature = it.getString(index) | 341 | val signature = it.getString(index) |
| 342 | val eventJson = it.getString(indexJson) | 342 | val eventJson = it.getString(indexJson) |
| @@ -356,13 +356,13 @@ If the user chose to always reject the event, signer application will return the | |||
| 356 | ) | 356 | ) |
| 357 | ``` | 357 | ``` |
| 358 | - result: | 358 | - result: |
| 359 | - Will return the **signature** column | 359 | - Will return the **result** column |
| 360 | 360 | ||
| 361 | ```kotlin | 361 | ```kotlin |
| 362 | if (result == null) return | 362 | if (result == null) return |
| 363 | 363 | ||
| 364 | if (result.moveToFirst()) { | 364 | if (result.moveToFirst()) { |
| 365 | val index = it.getColumnIndex("signature") | 365 | val index = it.getColumnIndex("result") |
| 366 | val encryptedText = it.getString(index) | 366 | val encryptedText = it.getString(index) |
| 367 | } | 367 | } |
| 368 | ``` | 368 | ``` |
| @@ -380,13 +380,13 @@ If the user chose to always reject the event, signer application will return the | |||
| 380 | ) | 380 | ) |
| 381 | ``` | 381 | ``` |
| 382 | - result: | 382 | - result: |
| 383 | - Will return the **signature** column | 383 | - Will return the **result** column |
| 384 | 384 | ||
| 385 | ```kotlin | 385 | ```kotlin |
| 386 | if (result == null) return | 386 | if (result == null) return |
| 387 | 387 | ||
| 388 | if (result.moveToFirst()) { | 388 | if (result.moveToFirst()) { |
| 389 | val index = it.getColumnIndex("signature") | 389 | val index = it.getColumnIndex("result") |
| 390 | val encryptedText = it.getString(index) | 390 | val encryptedText = it.getString(index) |
| 391 | } | 391 | } |
| 392 | ``` | 392 | ``` |
| @@ -404,13 +404,13 @@ If the user chose to always reject the event, signer application will return the | |||
| 404 | ) | 404 | ) |
| 405 | ``` | 405 | ``` |
| 406 | - result: | 406 | - result: |
| 407 | - Will return the **signature** column | 407 | - Will return the **result** column |
| 408 | 408 | ||
| 409 | ```kotlin | 409 | ```kotlin |
| 410 | if (result == null) return | 410 | if (result == null) return |
| 411 | 411 | ||
| 412 | if (result.moveToFirst()) { | 412 | if (result.moveToFirst()) { |
| 413 | val index = it.getColumnIndex("signature") | 413 | val index = it.getColumnIndex("result") |
| 414 | val encryptedText = it.getString(index) | 414 | val encryptedText = it.getString(index) |
| 415 | } | 415 | } |
| 416 | ``` | 416 | ``` |
| @@ -428,13 +428,13 @@ If the user chose to always reject the event, signer application will return the | |||
| 428 | ) | 428 | ) |
| 429 | ``` | 429 | ``` |
| 430 | - result: | 430 | - result: |
| 431 | - Will return the **signature** column | 431 | - Will return the **result** column |
| 432 | 432 | ||
| 433 | ```kotlin | 433 | ```kotlin |
| 434 | if (result == null) return | 434 | if (result == null) return |
| 435 | 435 | ||
| 436 | if (result.moveToFirst()) { | 436 | if (result.moveToFirst()) { |
| 437 | val index = it.getColumnIndex("signature") | 437 | val index = it.getColumnIndex("result") |
| 438 | val encryptedText = it.getString(index) | 438 | val encryptedText = it.getString(index) |
| 439 | } | 439 | } |
| 440 | ``` | 440 | ``` |
| @@ -452,13 +452,13 @@ If the user chose to always reject the event, signer application will return the | |||
| 452 | ) | 452 | ) |
| 453 | ``` | 453 | ``` |
| 454 | - result: | 454 | - result: |
| 455 | - Will return the **signature** column | 455 | - Will return the **result** column |
| 456 | 456 | ||
| 457 | ```kotlin | 457 | ```kotlin |
| 458 | if (result == null) return | 458 | if (result == null) return |
| 459 | 459 | ||
| 460 | if (result.moveToFirst()) { | 460 | if (result.moveToFirst()) { |
| 461 | val index = it.getColumnIndex("signature") | 461 | val index = it.getColumnIndex("result") |
| 462 | val relayJsonText = it.getString(index) | 462 | val relayJsonText = it.getString(index) |
| 463 | } | 463 | } |
| 464 | ``` | 464 | ``` |
| @@ -476,13 +476,13 @@ If the user chose to always reject the event, signer application will return the | |||
| 476 | ) | 476 | ) |
| 477 | ``` | 477 | ``` |
| 478 | - result: | 478 | - result: |
| 479 | - Will return the **signature** column | 479 | - Will return the **result** column |
| 480 | 480 | ||
| 481 | ```kotlin | 481 | ```kotlin |
| 482 | if (result == null) return | 482 | if (result == null) return |
| 483 | 483 | ||
| 484 | if (result.moveToFirst()) { | 484 | if (result.moveToFirst()) { |
| 485 | val index = it.getColumnIndex("signature") | 485 | val index = it.getColumnIndex("result") |
| 486 | val eventJson = it.getString(index) | 486 | val eventJson = it.getString(index) |
| 487 | } | 487 | } |
| 488 | ``` | 488 | ``` |