E2E encryption (prototype) (#601)

Prototype E2E encryption
This commit is contained in:
Zef Hemel
2023-12-17 11:46:18 +01:00
committed by GitHub
parent bcf29968ce
commit 5a7a35c759
18 changed files with 702 additions and 210 deletions
+18 -1
View File
@@ -22,6 +22,7 @@ export async function serveCommand(
key?: string;
reindex?: boolean;
syncOnly?: boolean;
clientEncryption?: boolean;
},
folder?: string,
) {
@@ -29,7 +30,22 @@ export async function serveCommand(
"127.0.0.1";
const port = options.port ||
(Deno.env.get("SB_PORT") && +Deno.env.get("SB_PORT")!) || 3000;
const clientEncryption = options.clientEncryption ||
!!Deno.env.get("SB_CLIENT_ENCRYPTION");
if (clientEncryption) {
console.log(
"Running in client encryption mode, this will implicitly enable sync-only mode",
);
}
const syncOnly = options.syncOnly || !!Deno.env.get("SB_SYNC_ONLY");
if (syncOnly) {
console.log("Running in sync-only mode (no backend processing)");
}
const app = new Application();
if (!folder) {
@@ -69,6 +85,8 @@ To allow outside connections, pass -L 0.0.0.0 as a flag, and put a TLS terminato
namespace: "*",
auth: userCredentials,
authToken: Deno.env.get("SB_AUTH_TOKEN"),
syncOnly,
clientEncryption,
pagesPath: folder,
});
@@ -79,7 +97,6 @@ To allow outside connections, pass -L 0.0.0.0 as a flag, and put a TLS terminato
clientAssetBundle: new AssetBundle(clientAssetBundle as AssetJson),
plugAssetBundle: new AssetBundle(plugAssetBundle as AssetJson),
baseKvPrimitives,
syncOnly,
keyFile: options.key,
certFile: options.cert,
configs,