diff --git a/crates/lox-wasm/index.js b/crates/lox-wasm/index.js index 6b62307..8aa6a2a 100644 --- a/crates/lox-wasm/index.js +++ b/crates/lox-wasm/index.js @@ -1,18 +1,20 @@ import init, { open_invite, set_panic_hook } from "./pkg/lox_wasm.js"; -var pubkeys = request_pubkeys().then((pubkeys) => { - pubkeys -}); -console.log(pubkeys) -init().then(() => { +let pubkeys = await request_pubkeys(); +console.log(pubkeys); + + +let requested = await init().then(() => { set_panic_hook(); -requested = request_open_invite().then((token) => { - open_invite(token); + let requested = request_open_invite().then((token) => { + return open_invite(token); }); + return requested; // unsigned_open_lox_credential = handle_new_lox_credential(requested, pubkeys); // lox_credential = request_new_lox_credential(request_cred[0]).then((lox_cred) => { // handle_new_lox_credential(request_cred[1], response, pubkey); // }) }); +console.log("Got request and state "+requested); function request_open_invite() { return new Promise((fulfill, reject) => { diff --git a/crates/lox-wasm/src/lib.rs b/crates/lox-wasm/src/lib.rs index b5fa0ba..10eb93d 100644 --- a/crates/lox-wasm/src/lib.rs +++ b/crates/lox-wasm/src/lib.rs @@ -56,7 +56,7 @@ fn deconcat_string(concatString: String) -> (String, String) { #[wasm_bindgen] -pub fn handle_new_lox_credential(open_lox_result: String, lox_pub: String) -> Result { +pub fn handle_new_lox_credential(open_lox_result: String, open_lox_response: String, lox_pub: String) -> Result { unsafe { log(&format!("Using server response: {:?}", open_lox_result)); }