Skip to content

Commit

Permalink
use static string to test signMessage easier
Browse files Browse the repository at this point in the history
  • Loading branch information
nickcruz committed Feb 23, 2023
1 parent 4358e5c commit 0ad636a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# macOS finder
.DS_Store
.idea/
3 changes: 3 additions & 0 deletions .idea/.gitignore

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
Expand Up @@ -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)
Expand Down Expand Up @@ -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])}")
signedMessages = result.signedPayloads
} catch (e: ExecutionException) {
when (val cause = e.cause) {
Expand Down

0 comments on commit 0ad636a

Please sign in to comment.