-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use static string to test signMessage easier #233
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# macOS finder | ||
.DS_Store | ||
.idea/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,10 +190,8 @@ class MainViewModel(application: Application) : AndroidViewModel(application) { | |
if (!authorized) { | ||
return@localAssociateAndExecute null | ||
} | ||
val messages = Array(numMessages) { | ||
Random.nextBytes(1232) | ||
} | ||
doSignMessages(client, messages, arrayOf(_uiState.value.publicKey!!)) | ||
val message = "To avoid digital dognappers, sign below to authenticate with CryptoCorgis.".toByteArray(Charsets.UTF_8) | ||
doSignMessages(client, arrayOf(message), arrayOf(_uiState.value.publicKey!!)) | ||
} | ||
|
||
showMessage(if (signedMessages != null) R.string.msg_request_succeeded else R.string.msg_request_failed) | ||
|
@@ -444,7 +442,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) { | |
var signedMessages: Array<ByteArray>? = null | ||
try { | ||
val result = client.signMessages(messages, addresses).get() | ||
Log.d(TAG, "Signed message(s): $result") | ||
Log.d(TAG, "Signed message base58: ${Base58EncodeUseCase(result.signedPayloads[0])}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd love to print out all the payloads here. not just the 0'th one. |
||
signedMessages = result.signedPayloads | ||
} catch (e: ExecutionException) { | ||
when (val cause = e.cause) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change will send only 1 message, irrespective of the value of the
numMessages
parameter. What if instead we did:This will append the message index to the string, ensuring that each message is unique (and thus that each signature will be unique as well)