-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
24 lines (21 loc) · 1005 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package main
import (
"fmt"
"syscall/js"
"wasm.ethscrow/ethscrow"
)
// init is called even before main is called. This ensures that as soon as our WebAssembly module is ready in the browser, it runs and prints "Hello, webAssembly!" to the console. It then proceeds to create a new channel. The aim of this channel is to keep our Go app running until we tell it to abort.
func init() {
fmt.Println("Go running...")
}
func main() {
js.Global().Set("generateKeyPair", js.FuncOf(ethscrow.GenerateKeyPair))
js.Global().Set("sign", js.FuncOf(ethscrow.Sign))
js.Global().Set("encrypt", js.FuncOf(ethscrow.Encrypt))
js.Global().Set("decrypt", js.FuncOf(ethscrow.Decrypt))
js.Global().Set("generateThresholdKey", js.FuncOf(ethscrow.GenerateThreshold))
js.Global().Set("generateEscrowAddress", js.FuncOf(ethscrow.GenerateEscrowAddress))
js.Global().Set("generateEscrowPrivateKey", js.FuncOf(ethscrow.GenerateEscrowPrivateKey))
js.Global().Set("signEthTx", js.FuncOf(ethscrow.SignEthTx))
select {}
}