A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: `writeEncrypted` -> `writeEncryptedBase64`
Abdullah Atta29608099db22
diff --git a/apps/web/src/interfaces/fs.js b/apps/web/src/interfaces/fs.jsindex 4852f438d..d662c7759 100644--- a/apps/web/src/interfaces/fs.js+++ b/apps/web/src/interfaces/fs.js@@ -98,18 +98,19 @@ async function writeEncryptedFile(file, key, hash) {/*** We perform 4 steps here:- * 1. We convert base64 to Uint8Array (if we get base64, that is)+ * 1. We convert base64 to Uint8Array* 2. We hash the Uint8Array.* 3. We encrypt the Uint8Array* 4. We save the encrypted Uint8Array*/-async function writeEncrypted(filename, { data, type, key, mimeType }) {- if (type === "base64") data = new Uint8Array(Buffer.from(data, "base64"));+async function writeEncryptedBase64(metadata) {+ const { data, key, mimeType } = metadata;- const { hash, type: hashType } = await hashBuffer(data);- if (!filename) filename = hash;+ const bytes = new Uint8Array(Buffer.from(data, "base64"));- const file = new File([data.buffer], filename, {+ const { hash, type: hashType } = await hashBuffer(bytes);++ const file = new File([bytes.buffer], hash, {type: mimeType || "application/octet-stream"});@@ -461,7 +462,7 @@ function clearFileStorage() {}const FS = {- writeEncrypted,+ writeEncryptedBase64,readEncrypted,uploadFile: cancellable(uploadFile),downloadFile: cancellable(downloadFile),