Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 17 additions & 3 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,32 @@ shell.cp("./recrypt_wasm_binding.d.ts", "./pkg");

//Compile our wasm-bindgen shim from TS to ES6 JS
shell.exec(
"./node_modules/typescript/bin/tsc --lib es6 --target ES2015 --sourceMap false --module nodenext --moduleResolution nodenext --outDir ./pkg lib/Api256Shim.ts"
"./node_modules/typescript/bin/tsc --lib es6 --target ES2015 --sourceMap false --module esnext --skipLibCheck true --outDir ./pkg lib/Api256Shim.ts"
);
//Tweak wasm-bindgen import location since we moved the file to the same directory as the wasm-bindgen produced shim
// WARNING: if the above module type changes to nodenext from esnext, this will go from an import to a require
// and will need to be updated.
const before = shell.exec(`shasum ./pkg/Api256Shim.js`, {silent: true}).stdout;
shell.sed("-i", `from "../target/`, `from "./`, "./pkg/Api256Shim.js");
const after = shell.exec(`shasum ./pkg/Api256Shim.js`, {silent: true}).stdout;
if (before === after) {
console.error("Error: failed to correct Api256Shim.js wasm import.");
process.exit(1);
}

//We need to tweak the wasm-pack generated package.json file since we have our own shim that fronts wasm-bindgen
const generatedPackageJson = require("./pkg/package.json");
generatedPackageJson.main = "Api256Shim.js";
delete generatedPackageJson.module;
delete generatedPackageJson.type;
delete generatedPackageJson.files;
generatedPackageJson.types = "recrypt_wasm_binding.d.ts";

fs.writeFileSync("./pkg/package.json", JSON.stringify(generatedPackageJson, null, 2));
try {
fs.writeFileSync("./pkg/package.json", JSON.stringify(generatedPackageJson, null, 2));
console.log("File written successfully");
} catch (err) {
console.error("Write failed:", err);
process.exit(1);
}

shell.cp("./LICENSE", "./pkg");
1 change: 0 additions & 1 deletion lib/Api256Shim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ export const addPrivateKeys = (privateKeyA: Uint8Array, privateKeyB: Uint8Array)
*/
export const subtractPrivateKeys = (privateKeyA: Uint8Array, privateKeyB: Uint8Array): Uint8Array => Recrypt.subtractPrivateKeys(privateKeyA, privateKeyB);


/**
* Export the entire EncryptedSearch struct out directly. No need to shim this at any level.
*/
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"noEmitOnError": true,
"noUnusedLocals": true,
"declaration": false,
"skipLibCheck": true,
"target": "ES2015",
"module": "nodenext",
"moduleResolution": "nodenext",
Expand Down
Loading