Fix javascript to handle values properly

This commit is contained in:
onyinyang 2023-01-26 00:17:14 -05:00
parent 5852a53c2b
commit a2e329ddf5
No known key found for this signature in database
GPG Key ID: 156A6435430C2036
2 changed files with 10 additions and 8 deletions

View File

@ -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) => {

View File

@ -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<String, JsValue> {
pub fn handle_new_lox_credential(open_lox_result: String, open_lox_response: String, lox_pub: String) -> Result<String, JsValue> {
unsafe {
log(&format!("Using server response: {:?}", open_lox_result));
}