Browse Source

Fix account creation failure (#1651)

Manav Rathi 1 year ago
parent
commit
9859d4e723
6 changed files with 43 additions and 18 deletions
  1. 1 1
      apps/photos/.env.development
  2. 0 2
      apps/photos/package.json
  3. 22 0
      docs/dependencies.md
  4. 2 1
      package.json
  5. 5 1
      packages/utils/package.json
  6. 13 13
      yarn.lock

+ 1 - 1
apps/photos/.env.development

@@ -10,7 +10,7 @@
 #
 # Alternatively, these variables can be provided as environment variables, say:
 #
-#     NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:3000 yarn dev:photos
+#     NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:8080 NEXT_PUBLIC_ENTE_DIRECT_UPLOAD=true yarn dev:photos
 #
 # Variables prefixed with NEXT_PUBLIC_ are made available when Next.js runs our
 # code in the browser (Behind the scenes, Next.js just hardcodes occurrences of

+ 0 - 2
apps/photos/package.json

@@ -41,7 +41,6 @@
         "jszip": "3.10.1",
         "leaflet": "^1.9.4",
         "leaflet-defaulticon-compatibility": "^0.1.1",
-        "libsodium-wrappers": "^0.7.8",
         "localforage": "^1.9.0",
         "memoize-one": "^6.0.0",
         "ml-matrix": "^6.10.4",
@@ -71,7 +70,6 @@
         "@next/bundle-analyzer": "^14.1",
         "@types/bs58": "^4.0.1",
         "@types/leaflet": "^1.9.3",
-        "@types/libsodium-wrappers": "^0.7.8",
         "@types/node": "^14.6.4",
         "@types/photoswipe": "^4.1.1",
         "@types/react": "^18",

+ 22 - 0
docs/dependencies.md

@@ -16,6 +16,28 @@ They also need some support packages:
 
 ## Utils
 
+### Crypto
+
+We use [libsodium](https://libsodium.gitbook.io/doc/) for encryption, key
+generation etc. Specifically, we use its WebAssembly and JS wrappers made using
+Emscripten, maintained by the original authors of libsodium themselves -
+[libsodium-wrappers](https://github.com/jedisct1/libsodium.js).
+
+Currently, we've pinned the version to 0.7.9 since later versions remove the
+crypto_pwhash_* functionality that we use (they've not been deprecated, they've
+just been moved to a different NPM package). From the (upstream) [release
+notes](https://github.com/jedisct1/libsodium/releases/tag/1.0.19-RELEASE):
+
+> Emscripten: the crypto_pwhash_*() functions have been removed from Sumo
+> builds, as they reserve a substantial amount of JavaScript memory, even when
+> not used.
+
+This wording is a bit incorrect, they've actually been _added_ to the sumo
+builds (See this [issue](https://github.com/jedisct1/libsodium.js/issues/326)).
+
+Updating it is not a big problem, it is just a pending chore - we want to test a
+bit more exhaustively when changing the crypto layer.
+
 ## UI
 
 The UI package uses "react". This is our core framework. We do use layers on top

+ 2 - 1
package.json

@@ -37,6 +37,7 @@
         "typescript": "^5"
     },
     "resolutions": {
-        "@sentry/cli": "1.75.0"
+        "@sentry/cli": "1.75.0",
+        "libsodium": "0.7.9"
     }
 }

+ 5 - 1
packages/utils/package.json

@@ -3,6 +3,10 @@
     "version": "0.0.0",
     "private": true,
     "devDependencies": {
-        "@/build-config": "*"
+        "@/build-config": "*",
+        "@types/libsodium-wrappers": "0.7.9"
+    },
+    "dependencies": {
+        "libsodium-wrappers": "0.7.9"
     }
 }

+ 13 - 13
yarn.lock

@@ -799,10 +799,10 @@
   dependencies:
     "@types/geojson" "*"
 
-"@types/libsodium-wrappers@^0.7.8":
-  version "0.7.13"
-  resolved "https://registry.yarnpkg.com/@types/libsodium-wrappers/-/libsodium-wrappers-0.7.13.tgz#769c4ea01de96bb297207586a70777ebf066dcb4"
-  integrity sha512-KeAKtlObirLJk/na6jHBFEdTDjDfFS6Vcr0eG2FjiHKn3Nw8axJFfIu0Y9TpwaauRldQBj/pZm/MHtK76r6OWg==
+"@types/libsodium-wrappers@0.7.9":
+  version "0.7.9"
+  resolved "https://registry.yarnpkg.com/@types/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz#89c3ad2156d5143e64bce86cfeb0045a983aeccc"
+  integrity sha512-LisgKLlYQk19baQwjkBZZXdJL0KbeTpdEnrAfz5hQACbklCY0gVFnsKUyjfNWF1UQsCSjw93Sj5jSbiO8RPfdw==
 
 "@types/lodash.memoize@^4.1.7":
   version "4.1.9"
@@ -2979,17 +2979,17 @@ libheif-js@^1.17.1:
   resolved "https://registry.yarnpkg.com/libheif-js/-/libheif-js-1.17.1.tgz#7772cc5a31098df0354f0fadb49a939030765acd"
   integrity sha512-g9wBm/CasGZMjmH3B2sD9+AO7Y5+79F0oPS+sdAulSxQeYeCeiTIP+lDqvlPofD+y76wvfVtotKZ8AuvZQnWgg==
 
-libsodium-wrappers@^0.7.8:
-  version "0.7.13"
-  resolved "https://registry.yarnpkg.com/libsodium-wrappers/-/libsodium-wrappers-0.7.13.tgz#83299e06ee1466057ba0e64e532777d2929b90d3"
-  integrity sha512-kasvDsEi/r1fMzKouIDv7B8I6vNmknXwGiYodErGuESoFTohGSKZplFtVxZqHaoQ217AynyIFgnOVRitpHs0Qw==
+libsodium-wrappers@0.7.9:
+  version "0.7.9"
+  resolved "https://registry.yarnpkg.com/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz#4ffc2b69b8f7c7c7c5594a93a4803f80f6d0f346"
+  integrity sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==
   dependencies:
-    libsodium "^0.7.13"
+    libsodium "^0.7.0"
 
-libsodium@^0.7.13:
-  version "0.7.13"
-  resolved "https://registry.yarnpkg.com/libsodium/-/libsodium-0.7.13.tgz#230712ec0b7447c57b39489c48a4af01985fb393"
-  integrity sha512-mK8ju0fnrKXXfleL53vtp9xiPq5hKM0zbDQtcxQIsSmxNgSxqCj6R7Hl9PkrNe2j29T4yoDaF7DJLK9/i5iWUw==
+libsodium@0.7.9, libsodium@^0.7.0:
+  version "0.7.9"
+  resolved "https://registry.yarnpkg.com/libsodium/-/libsodium-0.7.9.tgz#4bb7bcbf662ddd920d8795c227ae25bbbfa3821b"
+  integrity sha512-gfeADtR4D/CM0oRUviKBViMGXZDgnFdMKMzHsvBdqLBHd9ySi6EtYnmuhHVDDYgYpAO8eU8hEY+F8vIUAPh08A==
 
 lie@3.1.1:
   version "3.1.1"