From 8ed878ea8aa5eab761649e696d61e81b088f89af Mon Sep 17 00:00:00 2001
From: Jono Wenger <jono@elixxir.io>
Date: Thu, 8 Sep 2022 09:45:00 -0700
Subject: [PATCH] Fix authCallbacks argument conversion to JS and WrapCB
 argument expanding

---
 wasm/e2e.go   | 9 ++++++---
 wasm/utils.go | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/wasm/e2e.go b/wasm/e2e.go
index 9ae1551b..98203fc7 100644
--- a/wasm/e2e.go
+++ b/wasm/e2e.go
@@ -210,20 +210,23 @@ func newAuthCallbacks(value js.Value) *authCallbacks {
 func (a *authCallbacks) Request(
 	contact, receptionId []byte, ephemeralId, roundId int64) {
 	if a.request != nil {
-		a.request(contact, receptionId, ephemeralId, roundId)
+		a.request(CopyBytesToJS(contact), CopyBytesToJS(receptionId),
+			ephemeralId, roundId)
 	}
 }
 
 func (a *authCallbacks) Confirm(
 	contact, receptionId []byte, ephemeralId, roundId int64) {
 	if a.confirm != nil {
-		a.confirm(contact, receptionId, ephemeralId, roundId)
+		a.confirm(CopyBytesToJS(contact), CopyBytesToJS(receptionId),
+			ephemeralId, roundId)
 	}
 
 }
 func (a *authCallbacks) Reset(
 	contact, receptionId []byte, ephemeralId, roundId int64) {
 	if a.reset != nil {
-		a.reset(contact, receptionId, ephemeralId, roundId)
+		a.reset(CopyBytesToJS(contact), CopyBytesToJS(receptionId),
+			ephemeralId, roundId)
 	}
 }
diff --git a/wasm/utils.go b/wasm/utils.go
index 7959879b..5c7a62ad 100644
--- a/wasm/utils.go
+++ b/wasm/utils.go
@@ -45,7 +45,7 @@ func WrapCB(parent js.Value, m string) func(args ...interface{}) js.Value {
 	}
 
 	return func(args ...interface{}) js.Value {
-		return parent.Call(m, args)
+		return parent.Call(m, args...)
 	}
 }
 
-- 
GitLab