public async Task <bool> IsValid(KzPaymailClient pc) { var key = pubkey == null ? (KzPubKey)null : new KzPubKey(pubkey); var(ok, _) = await pc.IsValidSignature(GetMessage(), signature, senderHandle, key); return(ok); }
public async Task VerifyMessageSignature() { var r = new KzPaymailClient(); foreach (var tc in new[] { //new { p = "*****@*****.**", k = "02fe6a13c0734578b77d28680aac58a78eb1722dd654117451b8820c9380b10e68" }, new { r = true, p = "*****@*****.**", m = "[email protected]:55:57.562ZPayment with Money Button", s = "H4Q8tvj632hXiirmiiDJkuUN9Z20zDu3KaFuwY8cInZiLhgVJKJdKrZx1RZN06E/AARnFX7Fn618OUBQigCis4M=" }, new { r = true, p = "*****@*****.**", m = "[email protected]:24:04.260Z", s = "IJ1C3gXhnUxKpU8JOIjGHC8talwIgfIXKMmRZ5mjysb0eHjLPQP5Tlx29Xi5KNDZuOsOPk8HiVtwKAefq1pJVDs=" }, }) { var(ok, pubkey) = await r.IsValidSignature(tc.m, tc.s, tc.p, null); Assert.True(ok); (ok, _) = await r.IsValidSignature(tc.m, tc.s, tc.p, pubkey); Assert.True(ok); } }