-
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
Conversation
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.
Seems reasonable! @sdlaver?
Whoops, missed this, thanks for tagging me. Reviewing now. |
@@ -432,7 +431,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 comment
The 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.
Perhaps leave the original Log statement (to dump the whole object, in case we add fields to it in the future), followed by iterating through each payload and printint out the base58 signature?
} | ||
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!!)) |
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:
val messages = Array(numMessages) { i ->
"To avoid digital dognappers, sign below to authenticate with CryptoCorgis. [$i]".toByteArray(Charsets.UTF_8)
}
doSignMessages(client, messages, arrayOf(_uiState.value.publicKey!!))
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)
5115eba
to
0ad636a
Compare
Superseded by #407 |
FYI it might be easier for other wallets / dapps to test signMessage if you have:
So instead of the UTF-8 encoding of the randomBytes from before (left), you get something like this (right)
So instead of this:
you log this: