mirror of
https://github.com/arnaucube/go-blindsecp256k1.git
synced 2026-02-07 03:26:40 +01:00
Add WASM wrappers & compiled
This commit is contained in:
BIN
wasm/webtest/blindsecp256k1.wasm
Executable file
BIN
wasm/webtest/blindsecp256k1.wasm
Executable file
Binary file not shown.
18
wasm/webtest/index.html
Normal file
18
wasm/webtest/index.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>blindsecp256k1 WASM wrappers</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="wasm_exec.js"></script>
|
||||
<script>
|
||||
const go = new Go();
|
||||
WebAssembly.instantiateStreaming(fetch('blindsecp256k1.wasm'), go.importObject).then(function(dat) {
|
||||
go.run(dat.instance);
|
||||
});
|
||||
</script>
|
||||
<h3>Open the browser console to see the logs</h3>
|
||||
<button onClick="test();">test()</button>
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
16
wasm/webtest/index.js
Normal file
16
wasm/webtest/index.js
Normal file
@@ -0,0 +1,16 @@
|
||||
function test() {
|
||||
let m = "1952805748";
|
||||
|
||||
// Q & R would be received from the Signer
|
||||
let signerQx = "26613296432153871833441195158297038913673464785502568519907582377915678491093";
|
||||
let signerQy = "81940194042971427014176158889809922552127995083760111384335138546589994227275";
|
||||
let signerRx = "59371873487402651110657306418818354906476102545298559461791300717696053835454";
|
||||
let signerRy = "98322875246066710654579302898391677189379767946198239290895789444110962324342";
|
||||
let blindRes = blind(m, signerQx, signerQy, signerRx, signerRy);
|
||||
console.log("blind", blindRes);
|
||||
|
||||
// sBlind would be received from the Signer
|
||||
let sBlind = "7240298625621589352655632414257224668430424461224914067754717095121139699933353374227084479180038954015287518505167995306229258561275087198611946596619855";
|
||||
let unblindRes = unblind(sBlind, m, blindRes.uB, blindRes.uC, blindRes.uFx, blindRes.uFy);
|
||||
console.log("unblind", unblindRes);
|
||||
}
|
||||
Reference in New Issue
Block a user