Skip to content

Commit

Permalink
Fix a missing conversion at the boundary that was causing the test to…
Browse files Browse the repository at this point in the history
… crash
  • Loading branch information
msprotz committed Jun 13, 2024
1 parent ba07738 commit 3c89fd0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/MLS_JS.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let _ =
| Success (key_package, hash, priv_key) ->
Js.some (object%js
val keyPackage = uint8array_of_bytes key_package
val privKey = priv_key
val privKey = uint8array_of_bytes priv_key
val hash = uint8array_of_bytes hash
end)
| InternalError s ->
Expand Down Expand Up @@ -139,7 +139,9 @@ let _ =
let payload = bytes_of_uint8array payload in
let lookup hash =
let priv: _ Js.Opt.t = Js.Unsafe.fun_call lookup [| Js.Unsafe.inject (uint8array_of_bytes hash) |] in
Option.map bytes_of_uint8array (Js.Opt.to_option priv)
let priv = Js.Opt.to_option priv in
Printf.printf "lookup was successful? %b\n" (Option.is_some priv);
Option.map bytes_of_uint8array priv
in
let key_pair = bytes_of_uint8array keyPair##.pubKey, keyPair##.privKey in
match MLS.process_welcome_message (FStar_Seq_Base.empty (), payload) key_pair lookup with
Expand Down
5 changes: 5 additions & 0 deletions js/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ var test_main = () => {
({ state: state_B, groupId } = MLS.processWelcomeMessage(welcomeMessage.payload, signKeyPair_B,
(hash) => {
console.log("looking into B's store", hash);
let v = store_B[hash];
if (!v)
console.log("hash not found in B's store");
else
console.log("hash found in B's store, value is", v);
return (store_B[hash] || null)
}));
console.log("B joined the group", groupId);
Expand Down

0 comments on commit 3c89fd0

Please sign in to comment.