π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix anonymous reactions and improve feed display
Anand Baburajan9d0e1c82eaf7
diff --git a/web/packages/gallery/components/viewer/FeedSidebar.tsx b/web/packages/gallery/components/viewer/FeedSidebar.tsxindex eaf90560ff..e9c1926899 100644--- a/web/packages/gallery/components/viewer/FeedSidebar.tsx+++ b/web/packages/gallery/components/viewer/FeedSidebar.tsx@@ -19,6 +19,7 @@ import type { EnteFile } from "ente-media/file";import type { Comment } from "ente-new/photos/services/comment";import {getAlbumFeed,+ getAnonProfiles,type UnifiedReaction,} from "ente-new/photos/services/social";import React, { useEffect, useMemo, useState } from "react";@@ -275,7 +276,9 @@ type ThumbnailCache = Map<number, string>;// =============================================================================/**- * Get the display name for a user, showing "Anonymous" for anonymous users.+ * Get the display name for a user.+ * For anonymous users, uses their entered name from userName.+ * Falls back to "Anonymous" only if userName is empty.*/const getUserDisplayName = (userID: number,@@ -283,7 +286,7 @@ const getUserDisplayName = (anonUserID?: string,): string => {if (userID === -1 || userID === 0 || anonUserID) {- return "Anonymous";+ return userName || "Anonymous";}return userName;};@@ -312,6 +315,7 @@ const processFeedItems = (_files: EnteFile[],thumbnailCache: ThumbnailCache,users: Map<number, string>,+ anonUserNames: Map<string, string>,currentUserID: number,): FeedItem[] => {const feedItems: FeedItem[] = [];@@ -320,6 +324,13 @@ const processFeedItems = (const getUserName = (userID: number): string =>users.get(userID) ?? "Unknown";+ // Helper to get display name for anonymous users+ const getAnonUserName = (anonUserID: string | undefined): string =>+ anonUserID+ ? (anonUserNames.get(anonUserID) ??+ `Anonymous ${anonUserID.slice(-4)}`)+ : "Anonymous";+// Helper to get thumbnail URL from cacheconst getThumbnailURL = (fileID: number | undefined): string | undefined =>fileID ? thumbnailCache.get(fileID) : undefined;@@ -393,11 +404,19 @@ const processFeedItems = (for (const r of reactions) {if (r.isDeleted) continue;- const email = getUserName(r.userID);+ // For anonymous users, look up name from anonUserNames map+ const isAnonymous = !!r.anonUserID;+ const userName = isAnonymous+ ? getAnonUserName(r.anonUserID)+ : getUserName(r.userID);+ // Use anonUserID for avatar color (consistent with LikesSidebar)+ const email = isAnonymous+ ? (r.anonUserID ?? "anonymous")+ : getUserName(r.userID);const user: FeedUser = {userID: r.userID,anonUserID: r.anonUserID,- userName: email,+ userName,email,};@@ -645,6 +664,9 @@ export const FeedSidebar: React.FC<FeedSidebarProps> = ({);const [comments, setComments] = useState<Comment[]>([]);const [reactions, setReactions] = useState<UnifiedReaction[]>([]);+ const [anonUserNames, setAnonUserNames] = useState<Map<string, string>>(+ new Map(),+ );const [isLoading, setIsLoading] = useState(false);// Load thumbnails for files that have reactions/comments@@ -691,16 +713,22 @@ export const FeedSidebar: React.FC<FeedSidebarProps> = ({setIsLoading(true);try {- const {- comments: fetchedComments,- reactions: fetchedReactions,- } = await getAlbumFeed(collection.id, collection.key);- setComments(fetchedComments);- setReactions(fetchedReactions);+ const hasPublicLink = (collection.publicURLs?.length ?? 0) > 0;+ const [feedData, anonProfiles] = await Promise.all([+ getAlbumFeed(collection.id, collection.key),+ // Only fetch anon profiles if collection has public links+ hasPublicLink+ ? getAnonProfiles(collection.id, collection.key)+ : Promise.resolve(new Map<string, string>()),+ ]);+ setComments(feedData.comments);+ setReactions(feedData.reactions);+ setAnonUserNames(anonProfiles);} catch (e) {log.error("Failed to fetch album feed", e);setComments([]);setReactions([]);+ setAnonUserNames(new Map());} finally {setIsLoading(false);}@@ -717,6 +745,7 @@ export const FeedSidebar: React.FC<FeedSidebarProps> = ({files,thumbnailCache,emailByUserID,+ anonUserNames,currentUserID,),[@@ -725,6 +754,7 @@ export const FeedSidebar: React.FC<FeedSidebarProps> = ({files,thumbnailCache,emailByUserID,+ anonUserNames,currentUserID,],);diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsxindex b71eb4cf55..e28da4ac8e 100644--- a/web/packages/gallery/components/viewer/FileViewer.tsx+++ b/web/packages/gallery/components/viewer/FileViewer.tsx@@ -47,6 +47,7 @@ import {addPublicReaction,createAnonIdentity,deletePublicReaction,+ getPublicAnonProfiles,getPublicFileReactions,getStoredAnonIdentity,} from "ente-new/albums/services/public-reaction";@@ -59,6 +60,7 @@ import type { CollectionSummaries } from "ente-new/photos/services/collection-suimport { type Comment } from "ente-new/photos/services/comment";import { addReaction, deleteReaction } from "ente-new/photos/services/reaction";import {+ getAnonProfiles,getUnifiedSocialDiff,type UnifiedReaction,} from "ente-new/photos/services/social";@@ -453,6 +455,11 @@ export const FileViewer: React.FC<FileViewerProps> = ({new Map(),);+ // Map of anon user ID to decrypted user name for anonymous users.+ const [anonUserNames, setAnonUserNames] = useState<Map<string, string>>(+ new Map(),+ );+// Ref for fileComments to use in callbacksconst fileCommentsRef = useRef(fileComments);useEffect(() => {@@ -502,14 +509,14 @@ export const FileViewer: React.FC<FileViewerProps> = ({const fileReactionsMap = allReactionsRef.current.get(fileId);if (!fileReactionsMap) return [];- // Get stored anonymous identity for public album users- const storedAnonIdentity = getStoredAnonIdentity();-const userReactions: {collectionId: number;reactionId: string;}[] = [];for (const [collectionId, reactions] of fileReactionsMap) {+ // Get stored anonymous identity for this specific collection+ const storedAnonIdentity = getStoredAnonIdentity(collectionId);+const userFileReaction = reactions.find((r) => {if (r.commentID ||@@ -706,7 +713,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({const fileId = file.id;const collectionId = file.collectionID;- const storedAnonIdentity = getStoredAnonIdentity();+ const storedAnonIdentity = getStoredAnonIdentity(collectionId);// Check if already liked by current anon userconst fileReactionsMap = allReactionsRef.current.get(fileId);@@ -725,6 +732,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({try {await deletePublicReaction(publicAlbumsCredentials,+ collectionId,existingReaction.id,);log.info(@@ -766,6 +774,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({}const reactionId = await addPublicReaction(publicAlbumsCredentials,+ collectionId,fileId,"green_heart",collectionKey,@@ -1204,11 +1213,12 @@ export const FileViewer: React.FC<FileViewerProps> = ({void (async () => {try {- // Check if we already have an anon identity, otherwise create one- let identity = getStoredAnonIdentity();+ // Check if we already have an anon identity for this collection, otherwise create one+ let identity = getStoredAnonIdentity(collectionId);if (!identity) {identity = await createAnonIdentity(publicAlbumsCredentials,+ collectionId,name,collectionKey,);@@ -1220,6 +1230,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({// Add the public reactionconst reactionId = await addPublicReaction(publicAlbumsCredentials,+ collectionId,fileId,"green_heart",collectionKey,@@ -1546,11 +1557,11 @@ export const FileViewer: React.FC<FileViewerProps> = ({const fileReactionsMap = allReactions.get(file.id);const likedAlbumIDs = new Set<number>();- // Get stored anonymous identity for public album users- const storedAnonIdentity = getStoredAnonIdentity();-if (fileReactionsMap) {for (const [collectionId, reactions] of fileReactionsMap) {+ // Get stored anonymous identity for this specific collection+ const storedAnonIdentity = getStoredAnonIdentity(collectionId);+const hasUserLike = reactions.some((r) => {if (r.commentID || r.reactionType !== "green_heart")return false;@@ -1616,11 +1627,11 @@ export const FileViewer: React.FC<FileViewerProps> = ({const fileReactionsMap = allReactions.get(file.id);if (!fileReactionsMap) return false;- // Get stored anonymous identity for public album users- const storedAnonIdentity = getStoredAnonIdentity();-// Check if user has liked this file in any collection- for (const reactions of fileReactionsMap.values()) {+ for (const [collectionId, reactions] of fileReactionsMap) {+ // Get stored anonymous identity for this specific collection+ const storedAnonIdentity = getStoredAnonIdentity(collectionId);+const hasUserLike = reactions.some((r) => {if (r.commentID || r.reactionType !== "green_heart")return false;@@ -1925,6 +1936,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({const commentsMap = new Map<number, Comment[]>();const reactionsMap = new Map<number, UnifiedReaction[]>();const newUserIDToEmail = new Map<number, string>();+ const newAnonUserNames = new Map<string, string>();const collectionIDs = isGalleryView? (fileNormalCollectionIDs?.get(activeFileID) ?? [])@@ -1957,6 +1969,24 @@ export const FileViewer: React.FC<FileViewerProps> = ({commentsMap.set(collectionId, comments);reactionsMap.set(collectionId, reactions);++ // Fetch anonymous user profiles only if collection has public links+ if (collection.publicURLs.length > 0) {+ try {+ const anonProfiles = await getAnonProfiles(+ collectionId,+ collection.key,+ );+ for (const [+ anonUserID,+ userName,+ ] of anonProfiles) {+ newAnonUserNames.set(anonUserID, userName);+ }+ } catch {+ // Ignore anon profiles fetch failures+ }+ }} catch {// Skip collections that fail to fetch}@@ -1981,6 +2011,14 @@ export const FileViewer: React.FC<FileViewerProps> = ({}return next;});++ setAnonUserNames((prev) => {+ const next = new Map(prev);+ for (const [id, name] of newAnonUserNames) {+ next.set(id, name);+ }+ return next;+ });} catch (e) {log.error("Failed to fetch social data", e);setFileComments((prev) => {@@ -2049,6 +2087,23 @@ export const FileViewer: React.FC<FileViewerProps> = ({next.set(activeFileID, reactionsMap);return next;});++ // Fetch anonymous user profiles for public albums+ try {+ const anonProfiles = await getPublicAnonProfiles(+ publicAlbumsCredentials,+ collectionKey,+ );+ setAnonUserNames((prev) => {+ const next = new Map(prev);+ for (const [id, name] of anonProfiles) {+ next.set(id, name);+ }+ return next;+ });+ } catch {+ // Ignore anon profiles fetch failures+ }} catch (e) {log.error("Failed to fetch public reactions", e);}@@ -2197,6 +2252,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({activeAnnotatedFile.file.id,)}prefetchedUserIDToEmail={userIDToEmail}+ anonUserNames={anonUserNames}/><LikeAlbumSelectorModalopen={openLikeAlbumSelector}diff --git a/web/packages/gallery/components/viewer/LikesSidebar.tsx b/web/packages/gallery/components/viewer/LikesSidebar.tsxindex d41e1860b6..0b624465b3 100644--- a/web/packages/gallery/components/viewer/LikesSidebar.tsx+++ b/web/packages/gallery/components/viewer/LikesSidebar.tsx@@ -76,6 +76,8 @@ interface Liker {userName: string;/** The actual email for avatar color, even when userName is "You". */email: string;+ /** The first letter of the actual name (not "You") for the avatar. */+ avatarInitial: string;}/** Collection info for the dropdown. */@@ -119,6 +121,10 @@ export interface LikesSidebarProps extends ModalVisibilityProps {* Pre-fetched user ID to email mapping.*/prefetchedUserIDToEmail?: Map<number, string>;+ /**+ * Map of anonymous user ID to decrypted user name.+ */+ anonUserNames?: Map<string, string>;}/**@@ -134,6 +140,7 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({currentUserID,prefetchedReactions,prefetchedUserIDToEmail,+ anonUserNames,}) => {const [loading, setLoading] = useState(false);const [collectionDropdownOpen, setCollectionDropdownOpen] = useState(false);@@ -219,11 +226,14 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({const reactions =reactionsByCollection.get(selectedCollectionInfo.id) ?? [];- // Get stored anonymous identity to check if current anon user- const storedAnonIdentity = getStoredAnonIdentity();+ // Get stored anonymous identity for this collection to check if current anon user+ const storedAnonIdentity = getStoredAnonIdentity(+ selectedCollectionInfo.id,+ );return reactions.filter((r) => r.reactionType === "green_heart")+ .sort((a, b) => b.createdAt - a.createdAt) // Most recent first.map((r) => {// Check if this is an anonymous userconst isAnonymous =@@ -237,16 +247,26 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({let email: string;let userName: string;+ let actualName: string;if (isAnonymous) {email = r.anonUserID ?? "anonymous";- userName =- isCurrentAnonUser ? "You" : `Anonymous ${r.anonUserID?.slice(-4) ?? ""}`;+ // Use decrypted name from anonUserNames if available+ const decryptedName = r.anonUserID+ ? anonUserNames?.get(r.anonUserID)+ : undefined;+ actualName =+ decryptedName ??+ `Anonymous ${r.anonUserID?.slice(-4) ?? ""}`;+ userName = isCurrentAnonUser ? "You" : actualName;} else {- email =- prefetchedUserIDToEmail?.get(r.userID) ??- `User ${r.userID}`;- userName = isCurrentUser ? "You" : email;+ const emailFromMap = prefetchedUserIDToEmail?.get(r.userID);+ // Use userID as string for unique avatar color+ email = emailFromMap ?? String(r.userID);+ // In public albums (no currentUserID), non-anonymous+ // users are album owner or collaborators+ actualName = emailFromMap ?? "Anonymous";+ userName = isCurrentUser ? "You" : actualName;}return {@@ -255,6 +275,7 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({anonUserID: r.anonUserID,userName,email,+ avatarInitial: actualName[0]?.toUpperCase() ?? "?",};});}, [@@ -262,6 +283,7 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({reactionsByCollection,currentUserID,prefetchedUserIDToEmail,+ anonUserNames,]);// Load reactions from prefetched data@@ -551,7 +573,7 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({color: "#fff",}}>- {liker.email[0]?.toUpperCase() ?? "?"}+ {liker.avatarInitial}</Avatar><LikerName>{liker.userName}</LikerName><HeartFilledIcon />diff --git a/web/packages/new/albums/services/public-reaction.ts b/web/packages/new/albums/services/public-reaction.tsindex ac0b5962b1..61db662973 100644--- a/web/packages/new/albums/services/public-reaction.ts+++ b/web/packages/new/albums/services/public-reaction.ts@@ -37,16 +37,27 @@ export interface AnonIdentity {}/**- * Storage key for anonymous identity in local storage.+ * Storage key prefix for anonymous identity in local storage.+ * The full key is `${prefix}_${collectionID}`.*/-const ANON_IDENTITY_STORAGE_KEY = "ente_anon_identity";+const ANON_IDENTITY_STORAGE_KEY_PREFIX = "ente_anon_identity";/**- * Get the stored anonymous identity from local storage, if any.+ * Get the storage key for a specific collection's anonymous identity.*/-export const getStoredAnonIdentity = (): AnonIdentity | undefined => {+const getStorageKey = (collectionID: number): string =>+ `${ANON_IDENTITY_STORAGE_KEY_PREFIX}_${collectionID}`;++/**+ * Get the stored anonymous identity for a specific collection from local storage.+ *+ * @param collectionID The collection ID to get the identity for.+ */+export const getStoredAnonIdentity = (+ collectionID: number,+): AnonIdentity | undefined => {if (typeof window === "undefined") return undefined;- const stored = localStorage.getItem(ANON_IDENTITY_STORAGE_KEY);+ const stored = localStorage.getItem(getStorageKey(collectionID));if (!stored) return undefined;try {return JSON.parse(stored) as AnonIdentity;@@ -56,19 +67,27 @@ export const getStoredAnonIdentity = (): AnonIdentity | undefined => {};/**- * Store the anonymous identity in local storage.+ * Store the anonymous identity for a specific collection in local storage.+ *+ * @param collectionID The collection ID to store the identity for.+ * @param identity The anonymous identity to store.*/-export const storeAnonIdentity = (identity: AnonIdentity): void => {+export const storeAnonIdentity = (+ collectionID: number,+ identity: AnonIdentity,+): void => {if (typeof window === "undefined") return;- localStorage.setItem(ANON_IDENTITY_STORAGE_KEY, JSON.stringify(identity));+ localStorage.setItem(getStorageKey(collectionID), JSON.stringify(identity));};/**- * Clear the stored anonymous identity from local storage.+ * Clear the stored anonymous identity for a specific collection from local storage.+ *+ * @param collectionID The collection ID to clear the identity for.*/-export const clearAnonIdentity = (): void => {+export const clearAnonIdentity = (collectionID: number): void => {if (typeof window === "undefined") return;- localStorage.removeItem(ANON_IDENTITY_STORAGE_KEY);+ localStorage.removeItem(getStorageKey(collectionID));};/**@@ -79,12 +98,14 @@ export const clearAnonIdentity = (): void => {* anonymous user.** @param credentials Public album credentials (access token).+ * @param collectionID The collection ID this identity is for.* @param userName The name entered by the user.* @param collectionKey The decrypted collection key (base64 encoded).* @returns The anonymous identity containing anonUserID and token.*/export const createAnonIdentity = async (credentials: PublicAlbumsCredentials,+ collectionID: number,userName: string,collectionKey: string,): Promise<AnonIdentity> => {@@ -105,8 +126,8 @@ export const createAnonIdentity = async (ensureOk(res);const identity = AnonIdentityResponse.parse(await res.json());- // Store the identity for future use- storeAnonIdentity(identity);+ // Store the identity for this collection+ storeAnonIdentity(collectionID, identity);return identity;};@@ -121,6 +142,7 @@ const AnonIdentityResponse = z.object({* Add a reaction to a file in a public album (as an anonymous user).** @param credentials Public album credentials (access token).+ * @param collectionID The collection ID for looking up stored identity.* @param fileID The ID of the file to react to.* @param reactionType The type of reaction (e.g., "green_heart").* @param collectionKey The decrypted collection key (base64 encoded).@@ -129,12 +151,13 @@ const AnonIdentityResponse = z.object({*/export const addPublicReaction = async (credentials: PublicAlbumsCredentials,+ collectionID: number,fileID: number,reactionType: string,collectionKey: string,anonIdentity?: AnonIdentity,): Promise<string> => {- const identity = anonIdentity ?? getStoredAnonIdentity();+ const identity = anonIdentity ?? getStoredAnonIdentity(collectionID);if (!identity) {throw new Error("No anonymous identity available");}@@ -167,15 +190,17 @@ export const addPublicReaction = async (* Delete a reaction from a public album (as an anonymous user).** @param credentials Public album credentials (access token).+ * @param collectionID The collection ID for looking up stored identity.* @param reactionID The ID of the reaction to delete.* @param anonIdentity Optional anonymous identity. If not provided, will use stored identity.*/export const deletePublicReaction = async (credentials: PublicAlbumsCredentials,+ collectionID: number,reactionID: string,anonIdentity?: AnonIdentity,): Promise<void> => {- const identity = anonIdentity ?? getStoredAnonIdentity();+ const identity = anonIdentity ?? getStoredAnonIdentity(collectionID);if (!identity) {throw new Error("No anonymous identity available");}@@ -256,7 +281,7 @@ export const getPublicFileReactions = async ();decryptedReactions.push({id: reaction.id,- fileID: reaction.fileID,+ fileID: reaction.fileID ?? fileID,commentID: reaction.commentID ?? undefined,reactionType,userID: reaction.userID,@@ -275,7 +300,7 @@ export const getPublicFileReactions = async (const RemotePublicReaction = z.object({id: z.string(),collectionID: z.number(),- fileID: z.number(),+ fileID: z.number().nullish(),commentID: z.string().nullish(),userID: z.number(),anonUserID: z.string().nullish(),@@ -290,3 +315,66 @@ const GetPublicReactionsResponse = z.object({reactions: z.array(RemotePublicReaction),hasMore: z.boolean(),});++/**+ * An anonymous user profile (encrypted).+ */+export interface AnonProfile {+ anonUserID: string;+ userName: string;+}++/**+ * Get anonymous user profiles for a public album.+ *+ * @param credentials Public album credentials (access token).+ * @param collectionKey The decrypted collection key (base64 encoded).+ * @returns Map of anonUserID to decrypted userName.+ */+export const getPublicAnonProfiles = async (+ credentials: PublicAlbumsCredentials,+ collectionKey: string,+): Promise<Map<string, string>> => {+ const res = await fetch(+ await apiURL("/public-collection/anon-profiles"),+ {+ headers: authenticatedPublicAlbumsRequestHeaders(credentials),+ },+ );+ ensureOk(res);+ const { profiles } = GetAnonProfilesResponse.parse(await res.json());++ const anonUserNames = new Map<string, string>();+ for (const profile of profiles) {+ if (!profile.cipher || !profile.nonce) continue;+ try {+ const decryptedB64 = await decryptBox(+ { encryptedData: profile.cipher, nonce: profile.nonce },+ collectionKey,+ );+ const decryptedStr = new TextDecoder().decode(+ Uint8Array.from(atob(decryptedB64), (c) => c.charCodeAt(0)),+ );+ const data = JSON.parse(decryptedStr) as { userName?: string };+ if (data.userName) {+ anonUserNames.set(profile.anonUserID, data.userName);+ }+ } catch {+ // Skip profiles that fail to decrypt+ }+ }+ return anonUserNames;+};++const RemoteAnonProfile = z.object({+ anonUserID: z.string(),+ collectionID: z.number(),+ cipher: z.string().nullish(),+ nonce: z.string().nullish(),+ createdAt: z.number(),+ updatedAt: z.number(),+});++const GetAnonProfilesResponse = z.object({+ profiles: z.array(RemoteAnonProfile),+});diff --git a/web/packages/new/photos/services/social.ts b/web/packages/new/photos/services/social.tsindex 41cddef006..2507eba23e 100644--- a/web/packages/new/photos/services/social.ts+++ b/web/packages/new/photos/services/social.ts@@ -225,3 +225,59 @@ const UnifiedDiffResponse = z.object({hasMoreComments: z.boolean(),hasMoreReactions: z.boolean(),});++/**+ * Get anonymous user profiles for a collection.+ *+ * @param collectionID The ID of the collection.+ * @param collectionKey The decrypted collection key (base64 encoded).+ * @returns Map of anonUserID to decrypted userName.+ */+export const getAnonProfiles = async (+ collectionID: number,+ collectionKey: string,+): Promise<Map<string, string>> => {+ const res = await fetch(+ await apiURL("/social/anon-profiles", { collectionID }),+ { headers: await authenticatedRequestHeaders() },+ );+ ensureOk(res);+ const { profiles } = GetAnonProfilesResponse.parse(await res.json());++ const anonUserNames = new Map<string, string>();+ for (const profile of profiles) {+ if (!profile.cipher || !profile.nonce) continue;+ try {+ const decryptedB64 = await decryptBox(+ { encryptedData: profile.cipher, nonce: profile.nonce },+ collectionKey,+ );+ const decryptedStr = new TextDecoder().decode(+ Uint8Array.from(atob(decryptedB64), (c) => c.charCodeAt(0)),+ );+ const data = JSON.parse(decryptedStr) as { userName?: string };+ if (data.userName) {+ anonUserNames.set(profile.anonUserID, data.userName);+ }+ } catch {+ // Skip profiles that fail to decrypt+ }+ }+ return anonUserNames;+};++const RemoteAnonProfile = z.object({+ anonUserID: z.string(),+ collectionID: z.number(),+ cipher: z.string().nullish(),+ nonce: z.string().nullish(),+ createdAt: z.number(),+ updatedAt: z.number(),+});++const GetAnonProfilesResponse = z.object({+ profiles: z+ .array(RemoteAnonProfile)+ .nullish()+ .transform((v) => v ?? []),+});