Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
hhio618 committed May 27, 2022
1 parent 45415ac commit 46164a8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/src/test/java/ai/elimu/crowdsource/ExampleUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.web3j.utils.Numeric;

import java.nio.charset.StandardCharsets;

import ai.elimu.crowdsource.ui.authentication.SignInWithWeb3Activity;
import ai.elimu.crowdsource.util.EthersUtils;
Expand All @@ -18,7 +21,7 @@ public void web3recover_SanityCheck() {
String signature = "382a3e04daf88f322730f6a2972475fc5646ea8c4a7f3b5e83a90b10ba08a7364cd2f55348f2b6d210fbed7fc485abf19ecb2f3967e410d6349dd7dd1d4487751b";
String message = "0x63f9a92d8d61b48a9fff8d58080425a3012d05c8igwyk4r1o7o";
String digest = "0x438d6abe3d60b1a1f3f1e0c606ba249bc30e221001b9269f96be450c393c2f7c";
assertEquals(EthersUtils.hashMessage(message), digest);
assertEquals(Numeric.toHexString(EthersUtils.hashMessage(message)), digest);
assertEquals(EthersUtils.recoverAddress(EthersUtils.hashMessage(message), signature), "0x63f9a92d8d61b48a9fff8d58080425a3012d05c8");
}
}

0 comments on commit 46164a8

Please sign in to comment.