Skip to content

Commit

Permalink
[mod] Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn.
Browse files Browse the repository at this point in the history
  • Loading branch information
stef committed Mar 25, 2023
1 parent 6f3b11c commit a4209e3
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 140 deletions.
244 changes: 146 additions & 98 deletions js/dist/libopaque.debug.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dist/libopaque.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/test/libopaque-munit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
// Navigate to http://localhost:8080/munit-opaque.html in a web browser. View
// the console in developer tools for output.

require("../../src/tests/opaque-munit.js");
require("../opaque-munit.js");
2 changes: 1 addition & 1 deletion js/test/libopaque-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
// Navigate to http://localhost:8080/opaque.html in a web browser. View the
// console in developer tools for output.

require("../../src/tests/opaque-test.js");
require("../opaque-test.js");
18 changes: 8 additions & 10 deletions js/test/libopaquejs-test-1-step-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ const opaque = require("../dist/libopaque.debug.js");
ids,
context,
});
const {
sk: sk1,
authU,
export_key: export_key1,
} = opaque.recoverCredentials({
resp,
sec: secU,
context,
ids,
});
const { sk: sk1, authU, export_key: export_key1 } = opaque.recoverCredentials(
{
resp,
sec: secU,
context,
ids,
}
);
if (!opaque.userAuth({ sec: secS, authU }))
throw new Error("userAuth failed!");
if (!opaque.uint8ArrayEquals(export_key, export_key1))
Expand Down
20 changes: 9 additions & 11 deletions js/test/libopaquejs-test-global-pkS.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,16 @@ const opaque = require("../dist/libopaque.debug.js");
pub,
rec,
ids,
context
}));
const {
sk: sk1,
authU,
export_key: export_key1,
} = opaque.recoverCredentials({
resp,
sec: secU,
context,
ids,
});
}));
const { sk: sk1, authU, export_key: export_key1 } = opaque.recoverCredentials(
{
resp,
sec: secU,
context,
ids,
}
);
if (!opaque.userAuth({ sec: secS, authU }))
throw new Error("userAuth failed!");
if (!opaque.uint8ArrayEquals(export_key, export_key1))
Expand Down
20 changes: 9 additions & 11 deletions js/test/libopaquejs-test-per-user-pkS.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ const opaque = require("../dist/libopaque.js");
pub,
rec,
ids,
context
}));
const {
sk: sk1,
authU,
export_key: export_key1,
} = opaque.recoverCredentials({
resp,
sec: secU,
context,
ids,
});
}));
const { sk: sk1, authU, export_key: export_key1 } = opaque.recoverCredentials(
{
resp,
sec: secU,
context,
ids,
}
);
if (!opaque.userAuth({ sec: secS, authU }))
throw new Error("userAuth failed!");
if (!opaque.uint8ArrayEquals(export_key, export_key1))
Expand Down
17 changes: 11 additions & 6 deletions js/wrapper/libopaque-pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,9 @@
function createRegistrationResponse(module, params) {
const pointers = [];
try {
const { M, // required
skS, // optional
const {
M, // required
skS, // optional
} = params;
validateUint8Arrays({ M });
const M_pointer = AllocatedBuf.fromUint8Array(
Expand Down Expand Up @@ -753,7 +754,11 @@
);
pointers.push(recU_pointer);

module.StoreUserRecord(sec_pointer.address, rec_pointer.address, recU_pointer.address);
module.StoreUserRecord(
sec_pointer.address,
rec_pointer.address,
recU_pointer.address
);
return {
rec: recU_pointer.toUint8Array(),
};
Expand Down Expand Up @@ -895,8 +900,8 @@
};

AllocatedBuf.prototype.zero = function () {
for(var i = 0; i < this.length; i++){
this.module.setValue(this.address + i, 0, "i8");
for (var i = 0; i < this.length; i++) {
this.module.setValue(this.address + i, 0, "i8");
}
return;
};
Expand Down Expand Up @@ -934,7 +939,7 @@
}

function zeroAndFree(pointers) {
for(var i = 0; i < pointers.length; i++){
for (var i = 0; i < pointers.length; i++) {
pointers[i].zeroAndFree();
}
return;
Expand Down
2 changes: 1 addition & 1 deletion js/wrapper/opaquejs.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int opaquejs_CreateCredentialResponse(

int opaquejs_RecoverCredentials(
const uint8_t resp[OPAQUE_SERVER_SESSION_LEN],
const uint8_t sec[OPAQUE_USER_SESSION_SECRET_LEN/*+pwdU_len*/],
const uint8_t sec[OPAQUE_USER_SESSION_SECRET_LEN /*+pwdU_len*/],
const uint8_t *ctx,
const uint16_t ctx_len,
const uint8_t *ids_idU,
Expand Down

0 comments on commit a4209e3

Please sign in to comment.