π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Use
Manav Rathi302d373af19a
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsxindex e78c7dcd15..85c1ad47b3 100644--- a/web/apps/photos/src/pages/shared-albums.tsx+++ b/web/apps/photos/src/pages/shared-albums.tsx@@ -8,11 +8,13 @@ import {useIsTouchscreen,} from "@/base/components/utils/hooks";import { sharedCryptoWorker } from "@/base/crypto";+import { isHTTP401Error } from "@/base/http";import log from "@/base/log";import { downloadManager } from "@/gallery/services/download";import { updateShouldDisableCFUploadProxy } from "@/gallery/services/upload";import type { Collection } from "@/media/collection";import { type EnteFile, mergeMetadata } from "@/media/file";+import { verifyPublicCollectionPassword } from "@/new/albums/services/publicCollection";import {GalleryItemsHeaderAdapter,GalleryItemsSummary,@@ -72,7 +74,6 @@ import {removePublicFiles,savePublicCollectionPassword,syncPublicFiles,- verifyPublicCollectionPassword,} from "services/publicCollectionService";import uploadManager from "services/upload/uploadManager";import {@@ -400,10 +401,10 @@ export default function PublicCollectionGallery() {) => {try {const cryptoWorker = await sharedCryptoWorker();- let hashedPassword: string = null;+ let passwordHash: string = null;try {const publicUrl = publicCollection.publicURLs[0];- hashedPassword = await cryptoWorker.deriveKey(+ passwordHash = await cryptoWorker.deriveKey(password,publicUrl.nonce,publicUrl.opsLimit,@@ -417,8 +418,8 @@ export default function PublicCollectionGallery() {const collectionUID = getPublicCollectionUID(token.current);try {const jwtToken = await verifyPublicCollectionPassword(+ passwordHash,token.current,- hashedPassword,);passwordJWTToken.current = jwtToken;downloadManager.setPublicAlbumsCredentials(@@ -427,8 +428,7 @@ export default function PublicCollectionGallery() {);await savePublicCollectionPassword(collectionUID, jwtToken);} catch (e) {- const parsedError = parseSharingErrorCodes(e);- if (parsedError.message === CustomError.TOKEN_EXPIRED) {+ if (isHTTP401Error(e)) {setFieldError(t("INCORRECT_PASSPHRASE"));return;}diff --git a/web/apps/photos/src/services/publicCollectionService.ts b/web/apps/photos/src/services/publicCollectionService.tsindex 3c02e344d9..bca52c733a 100644--- a/web/apps/photos/src/services/publicCollectionService.ts+++ b/web/apps/photos/src/services/publicCollectionService.ts@@ -362,25 +362,6 @@ export const getPublicCollection = async (}};-export const verifyPublicCollectionPassword = async (- token: string,- passwordHash: string,-): Promise<string> => {- try {- const resp = await HTTPService.post(- await apiURL("/public-collection/verify-password"),- { passHash: passwordHash },- null,- { "X-Auth-Access-Token": token },- );- const jwtToken = resp.data.jwtToken;- return jwtToken;- } catch (e) {- log.error("failed to verify public collection password", e);- throw e;- }-};-export const removePublicCollectionWithFiles = async (collectionUID: string,collectionKey: string,diff --git a/web/packages/new/albums/services/publicCollection.ts b/web/packages/new/albums/services/publicCollection.tsindex cc4d562a9f..1003815fae 100644--- a/web/packages/new/albums/services/publicCollection.ts+++ b/web/packages/new/albums/services/publicCollection.ts@@ -4,11 +4,14 @@ import { z } from "zod";/*** Verify with remote that the password (hash) entered by the user is the same- * as the password that was set by the person who shared the album. If they- * match, remote will provide us with another token that can be used to make API- * calls for this password protected public album.+ * as the password that was set by the person who shared the album.*- * See: [Note: Password token for public albums requests]+ * If they match, remote will provide us with another token that can be used to+ * make API calls for this password protected public album. See: [Note: Password+ * token for public albums requests].+ *+ * If they don't match, or if {@link accessToken} itself has expired, then+ * remote will return a HTTP 401.** @param passwordHash The hash of the password entered by the user.*