Add json Marshalers

This commit is contained in:
arnaucube
2021-01-17 19:33:56 +01:00
parent becff7b647
commit 6b93980674
6 changed files with 283 additions and 86 deletions

Binary file not shown.

View File

@@ -3,25 +3,36 @@ function test() {
console.log("using: https://sci-hub.do/10.1109/ICCKE.2013.6682844");
// R would be received from the Signer
let signerRx = "59371873487402651110657306418818354906476102545298559461791300717696053835454";
let signerRy = "98322875246066710654579302898391677189379767946198239290895789444110962324342";
let blindRes = blind(m, signerRx, signerRy);
let signerRx = "17814783168156809976981325336969869272256267559847863501362979416582031885685";
let signerRy = "30466749656160766323378925376290982172805224557687141285291181575233995759897";
let blindRes = wasmBlind(m, signerRx, signerRy);
console.log("blind", blindRes);
// Q & sBlind would be received from the Signer
let signerQx = "26613296432153871833441195158297038913673464785502568519907582377915678491093";
let signerQy = "81940194042971427014176158889809922552127995083760111384335138546589994227275";
let sBlind = "7240298625621589352655632414257224668430424461224914067754717095121139699933353374227084479180038954015287518505167995306229258561275087198611946596619855";
let unblindRes = unblind(sBlind, m, blindRes.uA, blindRes.uB, blindRes.uFx, blindRes.uFy);
let signerQx = "91217724741799691300838336208439702708830781279546234509900618215893368170964";
let signerQy = "10647409378909561143830454293907272341812664755625953321604115356883317910171";
let sBlind = "1559989683738317700055715706344460781046571016142996697444777749433194958666958401306508176561868963591508234625762518936896506645022493420447764027537091595268073646775253821735958788229615883133396107736168033688269069669796190509031136746898237132145138091815479880246793211708356184248484212425679897377";
let unblindRes = wasmUnblind(sBlind, m, blindRes.uA, blindRes.uB, blindRes.uFx, blindRes.uFy);
console.log("unblind", unblindRes);
// wasmVerify method not used here because the hardcoded values would
// not match with the random generated values from the 'blind' method
// let verified = wasmVerify(m, unblindRes.s, unblindRes.fx, unblindRes.fy, signerQx, signerQy);
// console.log("verify", verified);
// ---
// v0
console.log("using: http://www.isecure-journal.com/article_39171_47f9ec605dd3918c2793565ec21fcd7a.pdf");
// Q & R would be received from the Signer
blindRes = blindv0(m, signerQx, signerQy, signerRx, signerRy);
blindRes = wasmBlindv0(m, signerQx, signerQy, signerRx, signerRy);
console.log("blindv0", blindRes);
// sBlind would be received from the Signer
unblindRes = unblindv0(sBlind, m, blindRes.uB, blindRes.uC, blindRes.uFx, blindRes.uFy);
unblindRes = wasmUnblindv0(sBlind, m, blindRes.uB, blindRes.uC, blindRes.uFx, blindRes.uFy);
console.log("unblindv0", unblindRes);
// wasmVerifyv0 method not used here because the hardcoded values would
// not match with the random generated values from the 'blind' method
// let verified = wasmVerifyv0(m, unblindRes.s, unblindRes.fx, unblindRes.fy, signerQx, signerQy);
// console.log("verify", verified);
}