From 0337f0adcdad88b2f31d7614a1ea5752a4b3000c Mon Sep 17 00:00:00 2001 From: Olivier Goulet Date: Sun, 12 Dec 2021 22:12:01 -0500 Subject: [PATCH] Add route for addfile --- client/src/electron/main.ts | 1 + client/src/shared/Api/vault/addAFile.ts | 2 +- client/src/shared/data/encryption.ts | 1 + client/yarn.lock | 127 +++++++++++++++++++++++- 4 files changed, 127 insertions(+), 4 deletions(-) diff --git a/client/src/electron/main.ts b/client/src/electron/main.ts index 03d8048..bf01051 100644 --- a/client/src/electron/main.ts +++ b/client/src/electron/main.ts @@ -14,6 +14,7 @@ const handleReady = () => { createMainWindow(); process.env.IV = 'c5846a3159f24227'; process.env.ENCRYPTION_SALT = '3IdG3N5dv2kCLa0h7cXE'; + console.log(process.env.IV); }; const gotTheLock = app.requestSingleInstanceLock(); diff --git a/client/src/shared/Api/vault/addAFile.ts b/client/src/shared/Api/vault/addAFile.ts index f6d4f14..ef31135 100644 --- a/client/src/shared/Api/vault/addAFile.ts +++ b/client/src/shared/Api/vault/addAFile.ts @@ -29,7 +29,7 @@ export const addAFile = async ( let structureMeta = prepareMetadata(notebookStructureItem); try { - await axios.post('http://localhost:8080/api/vault/add', { + await axios.post('https://privanote.herokuapp.com/api/vault/add', { item: fileMeta, notebookStructure: structureMeta }); diff --git a/client/src/shared/data/encryption.ts b/client/src/shared/data/encryption.ts index a8068b7..ef416ef 100644 --- a/client/src/shared/data/encryption.ts +++ b/client/src/shared/data/encryption.ts @@ -2,6 +2,7 @@ import { pbkdf2Sync, createCipheriv, createDecipheriv } from 'crypto'; export const generateEncryptionKey = (password: string) => { if (process.env.ENCRYPTION_SALT) { + // used to be process.env.salt thing return pbkdf2Sync( password, process.env.ENCRYPTION_SALT, diff --git a/client/yarn.lock b/client/yarn.lock index 49f0950..b08a8b3 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -1752,6 +1752,14 @@ "resolved" "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz" "version" "4.0.0" +"@types/plist@^3.0.1": + "integrity" "sha512-ULqvZNGMv0zRFvqn8/4LSPtnmN4MfhlPNtJCTpKuIIxGVGZ2rYWzFXrvEBoh9CVyqSE7D6YFRJ1hydLHI6kbWw==" + "resolved" "https://registry.npmjs.org/@types/plist/-/plist-3.0.2.tgz" + "version" "3.0.2" + dependencies: + "@types/node" "*" + "xmlbuilder" ">=11.0.1" + "@types/prettier@^2.1.5": "integrity" "sha512-Fo79ojj3vdEZOHg3wR9ksAMRz4P3S5fDB5e/YWZiFnyFQI1WY2Vftu9XoXVVtJfxB7Bpce/QTqWSSntkz2Znrw==" "resolved" "https://registry.npmjs.org/@types/prettier/-/prettier-2.4.1.tgz" @@ -1843,6 +1851,11 @@ "resolved" "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz" "version" "2.0.6" +"@types/verror@^1.10.3": + "integrity" "sha512-9UjMCHK5GPgQRoNbqdLIAvAy0EInuiqbW0PBMtVP6B5B2HQJlvoJHM+KodPZMEjOa5VkSc+5LH7xy+cUzQdmHw==" + "resolved" "https://registry.npmjs.org/@types/verror/-/verror-1.10.5.tgz" + "version" "1.10.5" + "@types/yargs-parser@*": "integrity" "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==" "resolved" "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz" @@ -2081,7 +2094,7 @@ "resolved" "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz" "version" "3.5.2" -"ajv@^6.12.0", "ajv@^6.12.5", "ajv@^6.9.1": +"ajv@^6.10.0", "ajv@^6.12.0", "ajv@^6.12.5", "ajv@^6.9.1": "integrity" "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==" "resolved" "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" "version" "6.12.6" @@ -2254,6 +2267,16 @@ optionalDependencies: "@types/glob" "^7.1.1" +"assert-plus@^1.0.0": + "integrity" "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + "resolved" "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz" + "version" "1.0.0" + +"astral-regex@^2.0.0": + "integrity" "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==" + "resolved" "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz" + "version" "2.0.0" + "async-exit-hook@^2.0.1": "integrity" "sha512-NW2cX8m1Q7KPA7a5M2ULQeZ2wR5qI5PAbw5L0UOMxdioVk9PMZ0h1TmyZEkPYrCvYjDlFICusOu1dlEKAAeXBw==" "resolved" "https://registry.npmjs.org/async-exit-hook/-/async-exit-hook-2.0.1.tgz" @@ -2613,7 +2636,7 @@ "resolved" "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" "version" "1.0.2" -"base64-js@^1.3.0", "base64-js@^1.5.1": +"base64-js@^1.3.0", "base64-js@^1.3.1", "base64-js@^1.5.1": "integrity" "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" "resolved" "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz" "version" "1.5.1" @@ -2779,6 +2802,14 @@ "resolved" "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" "version" "1.1.2" +"buffer@^5.1.0": + "integrity" "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==" + "resolved" "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz" + "version" "5.7.1" + dependencies: + "base64-js" "^1.3.1" + "ieee754" "^1.1.13" + "builder-util-runtime@8.9.1": "integrity" "sha512-c8a8J3wK6BIVLW7ls+7TRK9igspTbzWmUqxFbgK0m40Ggm6efUbxtWVCGIjc+dtchyr5qAMAUL6iEGRdS/6vwg==" "resolved" "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-8.9.1.tgz" @@ -3070,6 +3101,14 @@ dependencies: "restore-cursor" "^3.1.0" +"cli-truncate@^2.1.0": + "integrity" "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==" + "resolved" "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz" + "version" "2.1.0" + dependencies: + "slice-ansi" "^3.0.0" + "string-width" "^4.2.0" + "cli-width@^3.0.0": "integrity" "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==" "resolved" "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz" @@ -3334,6 +3373,11 @@ "resolved" "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz" "version" "1.0.3" +"core-util-is@1.0.2": + "integrity" "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "resolved" "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" + "version" "1.0.2" + "cosmiconfig@^7.0.0", "cosmiconfig@^7.0.1": "integrity" "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==" "resolved" "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz" @@ -3350,6 +3394,13 @@ "resolved" "https://registry.npmjs.org/country-flag-icons/-/country-flag-icons-1.4.15.tgz" "version" "1.4.15" +"crc@^3.8.0": + "integrity" "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==" + "resolved" "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz" + "version" "3.8.0" + dependencies: + "buffer" "^5.1.0" + "create-error-class@^3.0.0": "integrity" "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=" "resolved" "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz" @@ -3712,6 +3763,20 @@ optionalDependencies: "dmg-license" "^1.0.9" +"dmg-license@^1.0.9": + "integrity" "sha512-SVeeyiOeinV5JCPHXMdKOgK1YVbak/4+8WL2rBnfqRYpA5FaeFaQnQWb25x628am1w70CbipGDv9S51biph63A==" + "resolved" "https://registry.npmjs.org/dmg-license/-/dmg-license-1.0.10.tgz" + "version" "1.0.10" + dependencies: + "@types/plist" "^3.0.1" + "@types/verror" "^1.10.3" + "ajv" "^6.10.0" + "crc" "^3.8.0" + "iconv-corefoundation" "^1.1.7" + "plist" "^3.0.4" + "smart-buffer" "^4.0.2" + "verror" "^1.10.0" + "dom-accessibility-api@^0.5.6": "integrity" "sha512-ml3lJIq9YjUfM9TUnEPvEYWFSwivwIGBPKpewX7tii7fwCazA8yCioGdqQcNsItPpfFvSJ3VIdMQPj60LJhcQA==" "resolved" "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.7.tgz" @@ -4196,6 +4261,11 @@ "mkdirp" "^0.5.4" "yauzl" "^2.10.0" +"extsprintf@^1.2.0": + "integrity" "sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==" + "resolved" "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz" + "version" "1.4.1" + "fast-deep-equal@^3.1.1": "integrity" "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" "resolved" "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" @@ -4397,6 +4467,11 @@ "resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" "version" "1.0.0" +"fsevents@^2.3.2", "fsevents@~2.3.2": + "integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==" + "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" + "version" "2.3.2" + "function-bind@^1.1.1": "integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" "resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" @@ -4963,6 +5038,14 @@ "resolved" "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz" "version" "1.0.4" +"iconv-corefoundation@^1.1.7": + "integrity" "sha512-T10qvkw0zz4wnm560lOEg0PovVqUXuOFhhHAkixw8/sycy7TJt7v/RrkEKEQnAw2viPSJu6iAkErxnzR0g8PpQ==" + "resolved" "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz" + "version" "1.1.7" + dependencies: + "cli-truncate" "^2.1.0" + "node-addon-api" "^1.6.3" + "iconv-lite@^0.4.24", "iconv-lite@0.4.24": "integrity" "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==" "resolved" "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz" @@ -4982,6 +5065,11 @@ "resolved" "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz" "version" "5.1.0" +"ieee754@^1.1.13": + "integrity" "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + "resolved" "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" + "version" "1.2.1" + "ignore@^5.1.4": "integrity" "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==" "resolved" "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz" @@ -6641,6 +6729,11 @@ "lower-case" "^2.0.2" "tslib" "^2.0.3" +"node-addon-api@^1.6.3": + "integrity" "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==" + "resolved" "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz" + "version" "1.7.2" + "node-emoji@^1.11.0": "integrity" "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==" "resolved" "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz" @@ -7081,7 +7174,7 @@ dependencies: "find-up" "^4.0.0" -"plist@^3.0.1": +"plist@^3.0.1", "plist@^3.0.4": "integrity" "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==" "resolved" "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz" "version" "3.0.4" @@ -8078,6 +8171,20 @@ "resolved" "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" "version" "3.0.0" +"slice-ansi@^3.0.0": + "integrity" "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==" + "resolved" "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz" + "version" "3.0.0" + dependencies: + "ansi-styles" "^4.0.0" + "astral-regex" "^2.0.0" + "is-fullwidth-code-point" "^3.0.0" + +"smart-buffer@^4.0.2": + "integrity" "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==" + "resolved" "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz" + "version" "4.2.0" + "smpltmpl@^1.0.2": "integrity" "sha512-Hq23NNgeZigOzIiX1dkb6W3gFn2/XQj43KhPxu65IMieG/gIwf/lQb1IudjYv0c/5LwJeS/mPayYzyo+8WJMxQ==" "resolved" "https://registry.npmjs.org/smpltmpl/-/smpltmpl-1.0.2.tgz" @@ -9028,6 +9135,15 @@ "resolved" "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz" "version" "1.0.1" +"verror@^1.10.0": + "integrity" "sha512-veufcmxri4e3XSrT0xwfUR7kguIkaxBeosDg00yDWhk49wdwkSUrvvsm7nc75e1PUyvIeZj6nS8VQRYz2/S4Xg==" + "resolved" "https://registry.npmjs.org/verror/-/verror-1.10.1.tgz" + "version" "1.10.1" + dependencies: + "assert-plus" "^1.0.0" + "core-util-is" "1.0.2" + "extsprintf" "^1.2.0" + "w3c-hr-time@^1.0.2": "integrity" "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==" "resolved" "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz" @@ -9291,6 +9407,11 @@ "resolved" "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz" "version" "9.0.7" +"xmlbuilder@>=11.0.1": + "integrity" "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==" + "resolved" "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz" + "version" "15.1.1" + "xmlchars@^2.2.0": "integrity" "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==" "resolved" "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz"