Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add family sharing UI scaffolding to mobile app (#2159)

Leendert de Borstab3d6d87eaa1
diff --git a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
index 15dbdc0dc..125930e1e 100644
--- a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
+++ b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
@@ -11,25 +11,22 @@ import { decryptVaultBlob, encryptVaultBlob } from '@aliasvault/client/crypto/Va
import { SqliteClient } from '@aliasvault/client/database/SqliteClient';
import { generateTotpCode } from '@aliasvault/client/items/TotpUtility';
import { filterItems, AutofillMatchingMode, extractRootDomain, isUrlAlreadyLinked, generatePassword } from '@aliasvault/client/rust/RustCore';
-import { multiManifestRendering } from '@aliasvault/client/sharing/MultiManifestRendering';
import { SharingService } from '@aliasvault/client/sharing/SharingService';
-import { recordManifestRevisions } from '@aliasvault/client/sync/ManifestRevisions';
import { clearDirtyScopes, getDirtyScopes } from '@aliasvault/client/sync/VaultDirtyState';
import { vaultRequiresManifestMigration, VaultMigrationKind } from '@aliasvault/client/sync/VaultManifestMigration';
import { type VaultMutationScope, DEFAULT_VAULT_MUTATION_SCOPE, hasUserVisibleScope } from '@aliasvault/client/sync/VaultMutationScope';
-import { hasSyncError, syncResult, VaultSync, type FullVaultSyncResult, type VaultManifestMigrationResult } from '@aliasvault/client/sync/VaultSync';
+import { hasSyncError, syncResult, VaultSync, type FullVaultSyncResult, type SharingOperationResult, type VaultManifestMigrationResult } from '@aliasvault/client/sync/VaultSync';
import { type IVaultSyncEngineHost, type VaultSyncOptions, type VaultSyncPhase as EngineSyncPhase, type VaultSyncStoreOutcome, type VaultSyncStoreRequest } from '@aliasvault/client/sync/VaultSyncEngine';
import { getVaultSyncHoldReason } from '@aliasvault/client/sync/VaultSyncHold';
import { base64ToBytes, bytesToBase64 } from '@aliasvault/client/utilities/Base64';
import { FieldKey, ItemTypes, VaultDataBucketCategory, createSystemField, type Item, type PasswordSettings } from '@aliasvault/models/vault';
-import { VaultKeyAlgorithm } from '@aliasvault/models/webapi';
import { storage } from 'wxt/utils/storage';
import { clearAllSavePromptState } from '@/entrypoints/background/SavePromptStateHandler';
import { handleClearTwoFactorState } from '@/entrypoints/background/TwoFactorStateHandler';
import { AUTH_STORAGE_KEYS, dirtyScopeStorageKey, SESSION_STORAGE_KEYS, StorageKeys, vaultDataStorageKeys, VAULT_LOCK_STORAGE_KEYS } from '@/utils/constants/storageKeys';
-import { devLog, devWarn } from '@/utils/devLogger/DevLogger';
+import { devLog } from '@/utils/devLogger/DevLogger';
import { LocalPreferencesService } from '@/utils/LocalPreferencesService';
import { sendMessage, type TotpSecret } from '@/utils/messaging/ExtensionMessaging';
import { RecentlySelectedItemService } from '@/utils/RecentlySelectedItemService';
@@ -1500,164 +1497,65 @@ export async function handleGetRecentlySelected(
}
/**
- * Create another shared manifest for a family, with this account as its first member.
- *
- * @param message - the family to create the vault for and the name to give it.
+ * What a sharing action reports back to the page that asked for it.
*/
-export async function handleGroupCreateVault(message: { groupId: string; name: string }): Promise<{ success: boolean; error?: string; apiErrorCode?: string }> {
- const encryptionKey = await handleGetEncryptionKey();
- if (!encryptionKey) {
- return { success: false, error: formatErrorWithCode(await t('common.errors.vaultIsLocked'), AppErrorCode.VAULT_LOCKED) };
- }
+type SharingActionResponse = { success: boolean; error?: string; apiErrorCode?: string };
- const name = message.name.trim();
- if (name.length === 0) {
- return { success: false, error: await t('sharing.family.errors.createVaultFailed') };
+/**
+ * Put the outcome of a sharing engine operation into the words the family sharing page shows.
+ * @param result - what the sync engine reported.
+ * @param failureKey - the translation key of the message for a failure without a more specific reason.
+ */
+async function sharingActionResponse(result: SharingOperationResult, failureKey: string): Promise<SharingActionResponse> {
+ if (result.success) {
+ return { success: true };
}
- try {
- const webApi = new WebApiService();
- const overview = await SharingService.getOverview(webApi);
- const group = overview.groups.find(candidate => candidate.groupId.toLowerCase() === message.groupId.toLowerCase());
-
- if (!group || group.role === 'Member') {
- console.error(`Failed to create shared manifest: group ${message.groupId} is not one this account administers.`);
- return { success: false, error: await t('sharing.family.errors.createVaultFailed') };
- }
-
- // The new vault's VEK is encrypted for this client's own account public key.
- const selfPublicKey = await VaultKeyService.getAccountPublicKey();
- if (!selfPublicKey) {
- return { success: false, error: await t('sharing.family.errors.vaultUpgradeRequired') };
- }
-
- const sqliteClient = await createVaultSqliteClient();
- if (await vaultRequiresManifestMigration(sqliteClient)) {
- return { success: false, error: await t('sharing.family.errors.vaultUpgradeRequired') };
- }
-
- // The name stays on this device: it rides into the vault below, never into the create request.
- const mapping = await SharingService.createSharedManifest(webApi, {
- groupId: group.groupId,
- selfPublicKey,
- }, crypto.randomUUID());
-
- await SharingService.addSharedManifestRecord({
- manifestId: mapping.manifestId,
- encryptedVek: mapping.encryptedVek,
- encryptionPublicKey: mapping.encryptionPublicKey,
- algorithm: mapping.algorithm,
- salt: mapping.salt,
- name,
- canAdminister: true,
- }, encryptionKey);
-
- await recordManifestRevisions({ [mapping.manifestId]: mapping.revision });
- await multiManifestRendering.render(sqliteClient, mapping.manifestId, name);
-
- // Mail to an alias in this vault is encrypted with the vault's own keypair, which is what makes it readable by every member.
- await SharingService.rotateManifestEncryptionKey(sqliteClient, mapping.manifestId);
- await persistLocalVaultMutation(sqliteClient, encryptionKey);
+ if (result.apiErrorCode) {
+ return { success: false, apiErrorCode: result.apiErrorCode };
+ }
- devLog(`[Sharing] Created shared manifest ${mapping.manifestId} ("${name}") for group ${group.groupId}.`);
- return { success: true };
- } catch (error) {
- console.error('Failed to create shared manifest:', error);
- if (error instanceof ApiRequestError && error.apiErrorCode) {
- return { success: false, apiErrorCode: error.apiErrorCode };
- }
+ if (result.vaultUpgradeRequired) {
+ return { success: false, error: await t('sharing.family.errors.vaultUpgradeRequired') };
+ }
- /*
- * Everything this can fail on (a vault that will not open, a key that will not import, a server that refuses
- * without a code) collapses into the same sentence otherwise, which leaves nothing to act on. The cause is
- * appended the way the upload path does it.
- */
- const detail = error instanceof Error && error.message.length > 0 ? ` [${error.message}]` : '';
- return { success: false, error: `${await t('sharing.family.errors.createVaultFailed')}${detail}` };
+ if (result.errorCode === AppErrorCode.VAULT_LOCKED) {
+ return { success: false, error: formatErrorWithCode(await t('common.errors.vaultIsLocked'), AppErrorCode.VAULT_LOCKED) };
}
+
+ /*
+ * Everything else this can fail on (a vault that will not open, a key that will not import, a server that refuses
+ * without a code) collapses into the same sentence otherwise, which leaves nothing to act on. The cause is
+ * appended the way the upload path does it.
+ */
+ const detail = result.error && result.error.length > 0 ? ` [${result.error}]` : '';
+ return { success: false, error: `${await t(failureKey)}${detail}` };
}
/**
- * Invite a member of a family to one of its shared manifests, handing them the manifest's key encrypted to their account keypair.
+ * Create another shared manifest for a family, with this account as its first member. The sync engine does the work,
+ * so every client creates one the same way.
*
- * The recipient is picked off the family's own roster, so this never names an account outside the family.
- * @param message - the family, the manifest, and the member being invited.
+ * @param message - the family to create the vault for and the name to give it.
*/
-export async function handleGroupInviteMember(message: { groupId: string; manifestId: string; userId: string }): Promise<{ success: boolean; error?: string; apiErrorCode?: string }> {
- const encryptionKey = await handleGetEncryptionKey();
- if (!encryptionKey) {
- return { success: false, error: formatErrorWithCode(await t('common.errors.vaultIsLocked'), AppErrorCode.VAULT_LOCKED) };
+export async function handleGroupCreateVault(message: { groupId: string; name: string }): Promise<SharingActionResponse> {
+ const result = await vaultSync.createSharedManifest(message.groupId, message.name);
+ if (result.success) {
+ // The engine left the new folder and keypair in a dirty vault; this pushes them.
+ void handleFullVaultSync().catch(error => console.error('Background sync after creating a shared manifest failed:', error));
}
- /**
- * Fail the invite with a reason.
- * @param reason - what was missing.
- */
- const failed = async (reason: string): Promise<{ success: boolean; error: string }> => {
- devWarn(`[Sharing] Could not invite ${message.userId} to vault ${message.manifestId}: ${reason}.`);
- return { success: false, error: `${await t('sharing.family.errors.inviteFailed')} [${reason}]` };
- };
-
- try {
- const webApi = new WebApiService();
- const overview = await SharingService.getOverview(webApi);
- const group = overview.groups.find(candidate => candidate.groupId.toLowerCase() === message.groupId.toLowerCase());
- const manifest = group?.manifests.find(candidate => candidate.manifestId.toLowerCase() === message.manifestId.toLowerCase());
- const member = group?.members.find(candidate => candidate.userId === message.userId);
-
- if (!group || group.role === 'Member') {
- return failed('not an administrator of the group');
- }
-
- if (!manifest) {
- return failed('the vault does not belong to the group');
- }
-
- if (!member) {
- return failed('the recipient is not a member of the group');
- }
-
- if (!member.publicKey) {
- return { success: false, apiErrorCode: 'INVITE_RECIPIENT_NOT_READY' };
- }
-
- // Find this account's own grant on the vault: a key that was never handed to this account cannot be passed on.
- let record = await SharingService.getSharedManifestRecord(manifest.manifestId);
- if (!record) {
- // Backstop: the records persist next to the vault, so a missing one means a desync only a pull repairs.
- devWarn(`[Sharing] No key record stored for vault ${manifest.manifestId}; pulling to re-record it before inviting.`);
- await handleFullVaultSync({ forcePull: true });
- record = await SharingService.getSharedManifestRecord(manifest.manifestId);
- }
-
- if (!record) {
- return failed('this account holds no key for the vault');
- }
-
- const sqliteClient = await createVaultSqliteClient();
- const manifestVek = await SharingService.openSharedManifestVek(sqliteClient, record);
- if (!manifestVek) {
- return failed('the key of the vault did not open');
- }
-
- const vaultName = multiManifestRendering.displayNames(sqliteClient)[manifest.manifestId.toLowerCase()] ?? record.name ?? null;
- const grant = await SharingService.encryptVekFor(manifestVek, member, vaultName);
- if (!grant) {
- return { success: false, apiErrorCode: 'INVITE_RECIPIENT_NOT_READY' };
- }
-
- await SharingService.inviteMember(webApi, group.groupId, manifest.manifestId, member.userId, grant, VaultKeyAlgorithm.RsaOaepSha256);
-
- devLog(`[Sharing] Invited ${member.userId} to vault ${manifest.manifestId} with its key encrypted for them.`);
- return { success: true };
- } catch (error) {
- if (error instanceof ApiRequestError && error.apiErrorCode) {
- return { success: false, apiErrorCode: error.apiErrorCode };
- }
+ return sharingActionResponse(result, 'sharing.family.errors.createVaultFailed');
+}
- console.error('Failed to invite member to shared manifest:', error);
- return { success: false, error: await t('sharing.family.errors.inviteFailed') };
- }
+/**
+ * Invite a member of a family to one of its shared manifests, handing them the manifest's key encrypted to their
+ * account keypair. The sync engine does the work, so every client invites the same way.
+ *
+ * @param message - the family, the manifest, and the member being invited.
+ */
+export async function handleGroupInviteMember(message: { groupId: string; manifestId: string; userId: string }): Promise<SharingActionResponse> {
+ return sharingActionResponse(await vaultSync.inviteToSharedManifest(message.groupId, message.manifestId, message.userId), 'sharing.family.errors.inviteFailed');
}
/**
@@ -1665,7 +1563,7 @@ export async function handleGroupInviteMember(message: { groupId: string; manife
*
* @param message - the family, the vault, and the member losing access.
*/
-export async function handleGroupRevokeAccess(message: { groupId: string; manifestId: string; userId: string }): Promise<{ success: boolean; error?: string; apiErrorCode?: string }> {
+export async function handleGroupRevokeAccess(message: { groupId: string; manifestId: string; userId: string }): Promise<SharingActionResponse> {
try {
const webApi = new WebApiService();
await SharingService.revokeAccess(webApi, message.groupId, message.manifestId, message.userId);
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/settings/FamilySharingSettings.tsx b/apps/browser-extension/src/entrypoints/popup/pages/settings/FamilySharingSettings.tsx
index ad8abe562..158fd5b57 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/settings/FamilySharingSettings.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/settings/FamilySharingSettings.tsx
@@ -1,4 +1,6 @@
import { ApiRequestError } from '@aliasvault/client/api/errors/ApiRequestError';
+import { MasterPasswordService } from '@aliasvault/client/auth/MasterPasswordService';
+import { canAdministerGroup, describeMemberAccess, holdsManifestKey, ownUserIdIn, roleTranslationKey, sharingErrorTranslationKey } from '@aliasvault/client/sharing/FamilySharingView';
import { multiManifestRendering } from '@aliasvault/client/sharing/MultiManifestRendering';
import { SharingService } from '@aliasvault/client/sharing/SharingService';
import React, { useCallback, useEffect, useState } from 'react';
@@ -118,17 +120,12 @@ const FamilySharingSettings: React.FC = () => {
? actionError.message
: actionError instanceof ApiRequestError ? actionError.apiErrorCode : null;
- switch (code) {
- case 'INVITE_RECIPIENT_NOT_READY': return t('sharing.family.errors.userNotReady');
- case 'NOT_GROUP_MEMBER': return t('sharing.family.errors.notFamilyMember');
- case 'ACCESS_ALREADY_GRANTED': return t('sharing.family.errors.alreadyHasAccess');
- case 'INVITATION_ALREADY_EXISTS': return t('sharing.family.errors.alreadyInvited');
- case 'INVITATION_NOT_FOUND': return t('sharing.family.errors.invitationGone');
- case 'INVITATION_KEY_OUTDATED': return t('sharing.family.errors.invitationKeyOutdated');
- case 'LAST_MANIFEST_GRANT_HOLDER': return t('sharing.family.errors.lastMemberWithAccess');
- case 'GROUP_MANIFEST_LIMIT_REACHED': return t('sharing.family.errors.vaultLimitReached');
- default: return code !== null ? `${fallback} [${code}]` : fallback;
+ const knownErrorKey = sharingErrorTranslationKey(code);
+ if (knownErrorKey) {
+ return t(knownErrorKey);
}
+
+ return code !== null ? `${fallback} [${code}]` : fallback;
};
/**
@@ -210,7 +207,7 @@ const FamilySharingSettings: React.FC = () => {
}
try {
- await SharingService.deleteSharedManifest(webApi, target.group.groupId, target.manifest.manifestId, password);
+ await SharingService.deleteSharedManifest(webApi, target.group.groupId, target.manifest.manifestId, async challenge => (await MasterPasswordService.answerSrpChallenge(challenge, password)).proof);
} catch (deleteError) {
if (deleteError instanceof ApiRequestError && deleteError.apiErrorCode === 'PASSWORD_MISMATCH') {
throw new Error(t('common.errors.wrongPassword'));
@@ -245,18 +242,6 @@ const FamilySharingSettings: React.FC = () => {
*/
const vaultLabel = (manifest: SharedManifestInfo): string => vaultNames[manifest.manifestId.toLowerCase()] ?? t('sharing.family.unnamedVault');
- /**
- * The role of a member as shown next to their name.
- * @param member - the member.
- */
- const roleLabel = (member: GroupMemberInfo): string => {
- switch (member.role) {
- case 'Owner': return t('sharing.owner');
- case 'Admin': return t('sharing.family.admin');
- default: return t('sharing.family.member');
- }
- };
-
/**
* The title and message of the confirmation dialog.
*/
@@ -365,8 +350,8 @@ const FamilySharingSettings: React.FC = () => {
)}
{groups.map(group => {
- const canAdminister = group.role === 'Owner' || group.role === 'Admin';
- const myUserId = group.members.find(member => member.username === app.username)?.userId ?? '';
+ const canAdminister = canAdministerGroup(group);
+ const myUserId = ownUserIdIn(group, app.username);
return (
<section key={group.groupId} className="space-y-3">
@@ -391,7 +376,7 @@ const FamilySharingSettings: React.FC = () => {
<p className="text-sm text-gray-900 dark:text-white truncate">
{member.username}{isSelf && ` (${t('sharing.family.you')})`}
</p>
- <p className="text-xs text-gray-500 dark:text-gray-400">{roleLabel(member)}</p>
+ <p className="text-xs text-gray-500 dark:text-gray-400">{t(roleTranslationKey(member))}</p>
</div>
</li>
);
@@ -406,7 +391,7 @@ const FamilySharingSettings: React.FC = () => {
<div className="space-y-2">
<h3 className="text-md font-semibold text-gray-900 dark:text-white">{t('sharing.family.sharedFolders')}</h3>
{group.manifests.map(manifest => {
- const iHoldKey = manifest.memberUserIds.includes(myUserId);
+ const iHoldKey = holdsManifestKey(manifest, myUserId);
return (
<div key={manifest.manifestId} className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-3 space-y-2">
@@ -452,10 +437,8 @@ const FamilySharingSettings: React.FC = () => {
<ul className="divide-y divide-gray-100 dark:divide-gray-700">
{group.members.map(member => {
- const isSelf = member.userId === myUserId;
- const hasAccess = manifest.memberUserIds.includes(member.userId);
- const isInvited = manifest.pendingInvitations.some(invitation => invitation.inviteeUserId === member.userId);
- const invitation = manifest.pendingInvitations.find(candidate => candidate.inviteeUserId === member.userId);
+ const access = describeMemberAccess(group, manifest, member, myUserId);
+ const { isSelf, invitation } = access;
return (
<li key={member.userId} className="flex items-center justify-between gap-2 py-1.5 first:pt-0 last:pb-0">
@@ -464,12 +447,11 @@ const FamilySharingSettings: React.FC = () => {
{member.username}{isSelf && ` (${t('sharing.family.you')})`}
</p>
<p className="text-xs text-gray-500 dark:text-gray-400">
- {hasAccess ? t('sharing.family.hasAccess') : isInvited ? t('sharing.family.invited') : t('sharing.family.noAccess')}
+ {t(access.statusKey)}
</p>
</div>
- {/* An admin's own grant stays put: it is the only copy of the key their duties, inviting others among them, need. */}
- {hasAccess && isSelf && !canAdminister && (
+ {access.canLeave && (
<button
disabled={busy}
onClick={() => setPendingRemoval({ group, manifest, member, isSelf })}
@@ -479,7 +461,7 @@ const FamilySharingSettings: React.FC = () => {
</button>
)}
- {hasAccess && !isSelf && canAdminister && (
+ {access.canRevoke && (
<button
disabled={busy}
onClick={() => setPendingRemoval({ group, manifest, member, isSelf })}
@@ -489,7 +471,7 @@ const FamilySharingSettings: React.FC = () => {
</button>
)}
- {isInvited && !isSelf && canAdminister && invitation && (
+ {access.canWithdraw && invitation && (
<button
disabled={busy}
onClick={() => run(() => SharingService.withdrawInvitation(webApi, invitation.id), t('sharing.family.errors.invitationGone'))}
@@ -499,10 +481,10 @@ const FamilySharingSettings: React.FC = () => {
</button>
)}
- {!hasAccess && !isInvited && !isSelf && canAdminister && iHoldKey && (
+ {access.canInvite && (
<button
- disabled={busy || !member.publicKey}
- title={member.publicKey ? undefined : t('sharing.family.errors.userNotReady')}
+ disabled={busy || !access.isReadyForInvite}
+ title={access.isReadyForInvite ? undefined : t('sharing.family.errors.userNotReady')}
onClick={() => inviteMember(group, manifest, member)}
className="shrink-0 px-2 py-1 text-xs rounded-md bg-primary-500 hover:bg-primary-600 disabled:opacity-50 text-white"
>
diff --git a/apps/mobile-app/app/(tabs)/settings/_layout.tsx b/apps/mobile-app/app/(tabs)/settings/_layout.tsx
index 9637d48c5..32a8307fb 100644
--- a/apps/mobile-app/app/(tabs)/settings/_layout.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/_layout.tsx
@@ -99,6 +99,14 @@ export default function SettingsLayout(): React.ReactNode {
...defaultHeaderOptions,
}}
/>
+ <Stack.Screen
+ name="family-sharing"
+ options={{
+ title: t('sharing.family.title'),
+ headerBackTitle: t('settings.title'),
+ ...defaultHeaderOptions,
+ }}
+ />
<Stack.Screen
name="security/index"
options={{
diff --git a/apps/mobile-app/app/(tabs)/settings/family-sharing.tsx b/apps/mobile-app/app/(tabs)/settings/family-sharing.tsx
new file mode 100644
index 000000000..842904053
--- /dev/null
+++ b/apps/mobile-app/app/(tabs)/settings/family-sharing.tsx
@@ -0,0 +1,573 @@
+import { Buffer } from 'buffer';
+
+import { ApiRequestError } from '@aliasvault/client/api/errors/ApiRequestError';
+import { SrpAuthService } from '@aliasvault/client/auth/SrpAuthService';
+import { canAdministerGroup, describeMemberAccess, holdsManifestKey, ownUserIdIn, roleTranslationKey, sharingErrorTranslationKey } from '@aliasvault/client/sharing/FamilySharingView';
+import { multiManifestRendering } from '@aliasvault/client/sharing/MultiManifestRendering';
+import { SharingService } from '@aliasvault/client/sharing/SharingService';
+import { CapabilityKeys } from '@aliasvault/models/webapi';
+import { Ionicons } from '@expo/vector-icons';
+import { Redirect } from 'expo-router';
+import { useCallback, useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { RefreshControl, StyleSheet, TextInput, TouchableOpacity, View } from 'react-native';
+
+import { HapticsUtility } from '@/utils/HapticsUtility';
+
+import { useColors } from '@/hooks/useColorScheme';
+import { useMinDurationLoading } from '@/hooks/useMinDurationLoading';
+import { useVaultSync } from '@/hooks/useVaultSync';
+
+import { ConfirmPasswordModal } from '@/components/common/ConfirmPasswordModal';
+import { ThemedContainer } from '@/components/themed/ThemedContainer';
+import { ThemedScrollView } from '@/components/themed/ThemedScrollView';
+import { ThemedText } from '@/components/themed/ThemedText';
+import { SkeletonLoader } from '@/components/ui/SkeletonLoader';
+import { useApp } from '@/context/AppContext';
+import { useCapabilityContext } from '@/context/CapabilityContext';
+import { useDb } from '@/context/DbContext';
+import { useDialog } from '@/context/DialogContext';
+import { useWebApi } from '@/context/WebApiContext';
+import NativeVaultManager from '@/specs/NativeVaultManager';
+
+import type { GroupInfo, GroupMemberInfo, GroupOverviewResponse, SharedManifestInfo } from '@aliasvault/models/webapi';
+
+/**
+ * The shared folder the password confirmation is about to delete.
+ */
+type PendingVaultDelete = { group: GroupInfo; manifest: SharedManifestInfo };
+
+/** A sharing operation that failed with a reason already put into words for the user. */
+class SharingOperationError extends Error {}
+
+/**
+ * Family sharing screen: create a family's shared folders, invite the members of that family to them, and answer the
+ * invitations others sent.
+ */
+export default function FamilySharingScreen(): React.ReactNode {
+ const colors = useColors();
+ const webApi = useWebApi();
+ const { t } = useTranslation();
+ const { username, verifyPassword } = useApp();
+ const { sqliteClient } = useDb();
+ const { isEnabled, isLoaded } = useCapabilityContext();
+ const { showConfirm } = useDialog();
+ const { syncVault } = useVaultSync();
+
+ const [overview, setOverview] = useState<GroupOverviewResponse | null>(null);
+ const [vaultNames, setVaultNames] = useState<Record<string, string>>({});
+ const [invitationNames, setInvitationNames] = useState<Record<string, string>>({});
+ const [error, setError] = useState<string | null>(null);
+ const [notice, setNotice] = useState<string | null>(null);
+ const [busy, setBusy] = useState(false);
+ const [isLoading, setIsLoading] = useMinDurationLoading(true, 200);
+ const [isRefreshing, setIsRefreshing] = useMinDurationLoading(false, 200);
+ const [expandedRosters, setExpandedRosters] = useState<Record<string, boolean>>({});
+ const [pendingVaultDelete, setPendingVaultDelete] = useState<PendingVaultDelete | null>(null);
+ const [newVaultNames, setNewVaultNames] = useState<Record<string, string>>({});
+
+ /**
+ * Load the families, their shared folders and the open invitations, plus the names this vault has for them.
+ */
+ const loadOverview = useCallback(async (): Promise<void> => {
+ try {
+ const loaded = await SharingService.getOverview(webApi);
+ setOverview(loaded);
+
+ if (sqliteClient) {
+ // A shared folder is named after the top-level folder it is rendered as.
+ const folders = await sqliteClient.folders.getAll();
+ setVaultNames(Object.fromEntries(folders.filter(folder => multiManifestRendering.isManifestRoot(folder)).map(folder => [folder.Id.toLowerCase(), folder.Name])));
+ setInvitationNames(await SharingService.openInvitationNamesWith(async publicKey => (await sqliteClient.encryptionKeys.getAccountKeypair(publicKey))?.PrivateKey ?? null, loaded.receivedInvitations));
+ }
+
+ setError(null);
+ } catch {
+ setError(t('sharing.family.errors.loadFailed'));
+ } finally {
+ setIsLoading(false);
+ }
+ }, [webApi, sqliteClient, t, setIsLoading]);
+
+ useEffect(() => {
+ // eslint-disable-next-line react-hooks/set-state-in-effect
+ loadOverview();
+ }, [loadOverview]);
+
+ /**
+ * The message to show for a failed action.
+ * @param actionError - the error thrown by the call.
+ * @param fallback - the message for everything else.
+ */
+ const apiErrorMessage = (actionError: unknown, fallback: string): string => {
+ if (actionError instanceof SharingOperationError) {
+ return actionError.message;
+ }
+
+ const code = actionError instanceof ApiRequestError ? actionError.apiErrorCode : null;
+ const knownErrorKey = sharingErrorTranslationKey(code);
+ if (knownErrorKey) {
+ return t(knownErrorKey);
+ }
+
+ return code !== null ? `${fallback} [${code}]` : fallback;
+ };
+
+ /**
+ * Run one action, then reload so the screen shows what the server holds now.
+ * @param action - the action to run.
+ * @param failureMessage - what to show when it fails without a more specific reason.
+ */
+ const run = async (action: () => Promise<void>, failureMessage: string): Promise<void> => {
+ setBusy(true);
+ setError(null);
+ setNotice(null);
+
+ let failure: string | null = null;
+ try {
+ await action();
+ } catch (actionError) {
+ failure = apiErrorMessage(actionError, failureMessage);
+ }
+
+ await loadOverview();
+
+ if (failure !== null) {
+ setError(failure);
+ }
+
+ setBusy(false);
+ };
+
+ /**
+ * Run one of the sync engine's sharing operations, which hold the vault keys this screen never sees.
+ * @param operation - the engine operation.
+ * @param params - what it acts on.
+ * @param fallback - the message for a failure without a more specific reason.
+ */
+ const runSharingOperation = async (operation: 'createSharedManifest' | 'inviteToSharedManifest', params: Record<string, string>, fallback: string): Promise<void> => {
+ const result = await NativeVaultManager.runSharingOperation(operation, JSON.stringify(params));
+ if (result.success) {
+ return;
+ }
+
+ if (result.vaultUpgradeRequired) {
+ throw new SharingOperationError(t('sharing.family.errors.vaultUpgradeRequired'));
+ }
+
+ const knownErrorKey = sharingErrorTranslationKey(result.apiErrorCode);
+ const code = result.apiErrorCode ?? result.error;
+ throw new SharingOperationError(knownErrorKey ? t(knownErrorKey) : code ? `${fallback} [${code}]` : fallback);
+ };
+
+ /**
+ * Create another shared folder for the family. The sync that follows pushes it to the server.
+ * @param group - the family to create it for.
+ */
+ const createSharedVault = (group: GroupInfo): Promise<void> => {
+ const name = (newVaultNames[group.groupId] ?? '').trim();
+ if (name.length === 0) {
+ return Promise.resolve();
+ }
+
+ return run(async () => {
+ await runSharingOperation('createSharedManifest', { groupId: group.groupId, name }, t('sharing.family.errors.createVaultFailed'));
+ setNewVaultNames(previous => ({ ...previous, [group.groupId]: '' }));
+ await syncVault();
+ }, t('sharing.family.errors.createVaultFailed'));
+ };
+
+ /**
+ * Invite one member to one shared folder.
+ * @param group - the family the shared folder belongs to.
+ * @param manifest - the shared folder.
+ * @param member - the member being invited.
+ */
+ const inviteMember = (group: GroupInfo, manifest: SharedManifestInfo, member: GroupMemberInfo): Promise<void> => run(async () => {
+ await runSharingOperation('inviteToSharedManifest', { groupId: group.groupId, manifestId: manifest.manifestId, userId: member.userId }, t('sharing.family.errors.inviteFailed'));
+ setNotice(t('sharing.family.invitationSent', { username: member.username }));
+ }, t('sharing.family.errors.inviteFailed'));
+
+ /**
+ * Accept an invitation. The sync that follows is what brings the shared folder into this vault.
+ * @param invitationId - the invitation to accept.
+ */
+ const acceptInvitation = (invitationId: string): Promise<void> => run(async () => {
+ await SharingService.acceptInvitation(webApi, invitationId);
+ await syncVault();
+ }, t('sharing.family.errors.invitationGone'));
+
+ /**
+ * What to call a shared folder on screen.
+ * @param manifest - the shared folder.
+ */
+ const vaultLabel = (manifest: SharedManifestInfo): string => vaultNames[manifest.manifestId.toLowerCase()] ?? t('sharing.family.unnamedVault');
+
+ /**
+ * Ask before taking a member's access away, or before giving up one's own.
+ */
+ const confirmRemoval = (group: GroupInfo, manifest: SharedManifestInfo, member: GroupMemberInfo, isSelf: boolean): void => {
+ const title = isSelf ? t('sharing.family.leaveVault') : t('sharing.revoke');
+ const message = isSelf
+ ? t('sharing.family.leaveVaultConfirm', { vault: vaultLabel(manifest) })
+ : `${t('sharing.family.revokeAccessConfirm', { username: member.username, vault: vaultLabel(manifest) })}\n\n${t('sharing.family.revokeAccessWarning')}`;
+
+ showConfirm(title, message, title, () => run(async () => {
+ await SharingService.revokeAccess(webApi, group.groupId, manifest.manifestId, member.userId);
+ await syncVault();
+ }, t('sharing.family.errors.revokeAccessFailed')), { confirmStyle: 'destructive' });
+ };
+
+ /**
+ * Ask before deleting a shared folder, then move on to the master password confirmation.
+ */
+ const confirmVaultDelete = (group: GroupInfo, manifest: SharedManifestInfo): void => {
+ showConfirm(
+ t('sharing.family.deleteVault'),
+ t('sharing.family.deleteVaultConfirm', { vault: vaultLabel(manifest) }),
+ t('common.delete'),
+ () => setPendingVaultDelete({ group, manifest }),
+ { confirmStyle: 'destructive' }
+ );
+ };
+
+ /**
+ * Delete a shared folder, proving the master password to the server the way the account deletion does.
+ * @param password - the entered master password.
+ */
+ const deleteSharedVault = async (password: string): Promise<void> => {
+ const target = pendingVaultDelete;
+ if (!target) {
+ return;
+ }
+
+ const passwordHashBase64 = await verifyPassword(password);
+ if (!passwordHashBase64) {
+ throw new Error(t('auth.errors.incorrectPassword'));
+ }
+
+ try {
+ await SharingService.deleteSharedManifest(webApi, target.group.groupId, target.manifest.manifestId, async (challenge) => {
+ const passwordHashString = Buffer.from(passwordHashBase64, 'base64').toString('hex').toUpperCase();
+ const proof = await SrpAuthService.deriveClientProof(challenge.salt, challenge.srpIdentity, passwordHashString, challenge.serverEphemeral);
+ return { clientPublicEphemeral: proof.clientPublicEphemeral, clientSessionProof: proof.clientSessionProof };
+ });
+ } catch (deleteError) {
+ if (deleteError instanceof ApiRequestError && deleteError.apiErrorCode === 'PASSWORD_MISMATCH') {
+ throw new Error(t('auth.errors.incorrectPassword'));
+ }
+
+ throw new Error(apiErrorMessage(deleteError, t('sharing.family.errors.deleteVaultFailed')));
+ }
+
+ setPendingVaultDelete(null);
+ await run(async () => {
+ await syncVault();
+ setNotice(t('sharing.family.vaultDeleted'));
+ }, t('sharing.family.errors.deleteVaultFailed'));
+ };
+
+ /**
+ * Refresh on pull to refresh.
+ */
+ const onRefresh = async (): Promise<void> => {
+ HapticsUtility.impact();
+ setIsRefreshing(true);
+ await loadOverview();
+ setIsRefreshing(false);
+ };
+
+ const styles = StyleSheet.create({
+ actionText: {
+ color: colors.primary,
+ fontSize: 14,
+ fontWeight: '600',
+ },
+ actionTextDestructive: {
+ color: colors.destructive,
+ },
+ banner: {
+ borderRadius: 10,
+ marginTop: 16,
+ padding: 12,
+ },
+ bannerError: {
+ backgroundColor: colors.errorBackground,
+ },
+ bannerErrorText: {
+ color: colors.errorText,
+ fontSize: 14,
+ },
+ bannerSuccess: {
+ backgroundColor: colors.successBackground,
+ },
+ bannerSuccessText: {
+ color: colors.success,
+ fontSize: 14,
+ },
+ betaBadge: {
+ backgroundColor: colors.primary,
+ borderRadius: 10,
+ paddingHorizontal: 8,
+ paddingVertical: 2,
+ },
+ betaBadgeText: {
+ color: colors.primarySurfaceText,
+ fontSize: 11,
+ fontWeight: '600',
+ textTransform: 'uppercase',
+ },
+ buttonRow: {
+ flexDirection: 'row',
+ gap: 16,
+ marginTop: 10,
+ },
+ card: {
+ backgroundColor: colors.accentBackground,
+ borderRadius: 10,
+ marginBottom: 12,
+ padding: 16,
+ },
+ cardHeader: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ },
+ cardTitle: {
+ color: colors.text,
+ flex: 1,
+ fontSize: 16,
+ fontWeight: '600',
+ },
+ createInput: {
+ backgroundColor: colors.background,
+ borderColor: colors.accentBorder,
+ borderRadius: 8,
+ borderWidth: 1,
+ color: colors.text,
+ flex: 1,
+ fontSize: 14,
+ paddingHorizontal: 12,
+ paddingVertical: 8,
+ },
+ createRow: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ gap: 12,
+ marginTop: 10,
+ },
+ disabled: {
+ opacity: 0.5,
+ },
+ headerRow: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ gap: 8,
+ },
+ headerText: {
+ color: colors.textMuted,
+ flex: 1,
+ fontSize: 13,
+ },
+ memberName: {
+ color: colors.text,
+ fontSize: 14,
+ },
+ memberRow: {
+ alignItems: 'center',
+ borderTopColor: colors.accentBorder,
+ borderTopWidth: StyleSheet.hairlineWidth,
+ flexDirection: 'row',
+ gap: 8,
+ justifyContent: 'space-between',
+ marginTop: 10,
+ paddingTop: 10,
+ },
+ memberText: {
+ flex: 1,
+ },
+ mutedText: {
+ color: colors.textMuted,
+ fontSize: 13,
+ },
+ section: {
+ marginTop: 20,
+ },
+ sectionTitle: {
+ color: colors.text,
+ fontSize: 15,
+ fontWeight: '600',
+ marginBottom: 8,
+ },
+ });
+
+ // Nothing is known before the stored capabilities are read, and redirecting on a guess would throw out a deep link.
+ if (!isLoaded) {
+ return null;
+ }
+
+ if (!isEnabled(CapabilityKeys.VaultSharing)) {
+ return <Redirect href="/(tabs)/settings" />;
+ }
+
+ const receivedInvitations = overview?.receivedInvitations ?? [];
+ const groups = overview?.groups ?? [];
+
+ /**
+ * One member of a family or of a shared folder, with whatever can be done about them on the right.
+ */
+ const renderMemberRow = (member: GroupMemberInfo, isSelf: boolean, detail: string, action?: React.ReactNode): React.ReactNode => (
+ <View key={member.userId} style={styles.memberRow}>
+ <View style={styles.memberText}>
+ <ThemedText style={styles.memberName} numberOfLines={1}>
+ {member.username}{isSelf && ` (${t('sharing.family.you')})`}
+ </ThemedText>
+ <ThemedText style={styles.mutedText}>{detail}</ThemedText>
+ </View>
+ {action}
+ </View>
+ );
+
+ /**
+ * A text button on the right of a row.
+ */
+ const renderAction = (label: string, onPress: () => void, destructive: boolean = false, enabled: boolean = true): React.ReactNode => (
+ <TouchableOpacity onPress={onPress} disabled={busy || !enabled} style={(busy || !enabled) && styles.disabled}>
+ <ThemedText style={[styles.actionText, destructive && styles.actionTextDestructive]}>{label}</ThemedText>
+ </TouchableOpacity>
+ );
+
+ return (
+ <ThemedContainer>
+ <ConfirmPasswordModal
+ isOpen={pendingVaultDelete !== null}
+ onClose={() => setPendingVaultDelete(null)}
+ onConfirm={deleteSharedVault}
+ title={t('sharing.family.deleteVault')}
+ message={t('sharing.family.deleteVaultPasswordPrompt', { vault: pendingVaultDelete ? vaultLabel(pendingVaultDelete.manifest) : '' })}
+ confirmText={t('common.delete')}
+ />
+
+ <ThemedScrollView refreshControl={<RefreshControl refreshing={isRefreshing} onRefresh={onRefresh} colors={[colors.primary]} tintColor={colors.primary} />}>
+ <View style={styles.headerRow}>
+ <ThemedText style={styles.headerText}>{t('sharing.family.description')}</ThemedText>
+ <View style={styles.betaBadge}>
+ <ThemedText style={styles.betaBadgeText}>{t('sharing.family.beta')}</ThemedText>
+ </View>
+ </View>
+
+ {error && (
+ <View style={[styles.banner, styles.bannerError]}>
+ <ThemedText style={styles.bannerErrorText}>{error}</ThemedText>
+ </View>
+ )}
+ {notice && (
+ <View style={[styles.banner, styles.bannerSuccess]}>
+ <ThemedText style={styles.bannerSuccessText}>{notice}</ThemedText>
+ </View>
+ )}
+
+ {isLoading ? (
+ <View style={styles.section}>
+ <SkeletonLoader count={2} height={100} parts={3} />
+ </View>
+ ) : (
+ <>
+ {receivedInvitations.length > 0 && (
+ <View style={styles.section}>
+ <ThemedText style={styles.sectionTitle}>{t('sharing.family.invitations')}</ThemedText>
+ {receivedInvitations.map(invitation => (
+ <View key={invitation.id} style={styles.card}>
+ <ThemedText style={styles.cardTitle}>{invitationNames[invitation.id] ?? t('sharing.family.unnamedVault')}</ThemedText>
+ <ThemedText style={styles.mutedText}>{t('sharing.family.invitedBy', { username: invitation.inviterUsername })}</ThemedText>
+ <View style={styles.buttonRow}>
+ {renderAction(t('sharing.family.accept'), () => acceptInvitation(invitation.id))}
+ {renderAction(t('sharing.family.decline'), () => run(() => SharingService.declineInvitation(webApi, invitation.id), t('sharing.family.errors.invitationGone')), true)}
+ </View>
+ </View>
+ ))}
+ </View>
+ )}
+
+ {groups.length === 0 && receivedInvitations.length === 0 && !error && (
+ <View style={styles.section}>
+ <ThemedText style={styles.mutedText}>{t('sharing.family.notAvailable')}</ThemedText>
+ </View>
+ )}
+
+ {groups.map((group) => {
+ const canAdminister = canAdministerGroup(group);
+ const myUserId = ownUserIdIn(group, username);
+ const isRosterExpanded = expandedRosters[group.groupId] ?? false;
+
+ return (
+ <View key={group.groupId} style={styles.section}>
+ {/* The family's members. */}
+ <View style={styles.card}>
+ <TouchableOpacity style={styles.cardHeader} onPress={() => setExpandedRosters(previous => ({ ...previous, [group.groupId]: !isRosterExpanded }))} activeOpacity={0.7}>
+ <ThemedText style={styles.cardTitle}>{t('sharing.members')} ({group.members.length})</ThemedText>
+ <Ionicons name={isRosterExpanded ? 'chevron-up' : 'chevron-down'} size={20} color={colors.textMuted} />
+ </TouchableOpacity>
+ {isRosterExpanded && group.members.map(member => renderMemberRow(member, member.userId === myUserId, t(roleTranslationKey(member))))}
+ </View>
+
+ {/* One card per shared folder, each with the members who can open it. */}
+ <ThemedText style={styles.sectionTitle}>{t('sharing.family.sharedFolders')}</ThemedText>
+ {group.manifests.length === 0 && (
+ <ThemedText style={styles.mutedText}>{canAdminister ? t('sharing.family.noSharedVaultAdmin') : t('sharing.family.noSharedVaultMember')}</ThemedText>
+ )}
+ {group.manifests.map(manifest => (
+ <View key={manifest.manifestId} style={styles.card}>
+ <View style={styles.cardHeader}>
+ <ThemedText style={styles.cardTitle} numberOfLines={1}>{vaultLabel(manifest)}</ThemedText>
+ {canAdminister && renderAction(t('sharing.family.deleteVault'), () => confirmVaultDelete(group, manifest), true)}
+ </View>
+
+ {/* Inviting somebody encrypts this folder's key for them, which an admin who holds no grant on it cannot do. */}
+ {canAdminister && !holdsManifestKey(manifest, myUserId) && (
+ <ThemedText style={styles.mutedText}>{t('sharing.family.cannotInviteWithoutAccess')}</ThemedText>
+ )}
+
+ {group.members.map((member) => {
+ const access = describeMemberAccess(group, manifest, member, myUserId);
+ const invitation = access.invitation;
+
+ return renderMemberRow(member, access.isSelf, t(access.statusKey), (
+ <>
+ {access.canLeave && renderAction(t('sharing.family.leaveVault'), () => confirmRemoval(group, manifest, member, true), true)}
+ {access.canRevoke && renderAction(t('sharing.revoke'), () => confirmRemoval(group, manifest, member, false), true)}
+ {access.canWithdraw && invitation && renderAction(t('sharing.family.withdraw'), () => run(() => SharingService.withdrawInvitation(webApi, invitation.id), t('sharing.family.errors.invitationGone')))}
+ {access.canInvite && renderAction(t('sharing.family.invite'), () => inviteMember(group, manifest, member), false, access.isReadyForInvite)}
+ </>
+ ));
+ })}
+ </View>
+ ))}
+
+ {/* Creating another shared folder. */}
+ {canAdminister && (
+ <View style={styles.card}>
+ <ThemedText style={styles.cardTitle}>{t('sharing.family.createSharedVault')}</ThemedText>
+ <View style={styles.createRow}>
+ <TextInput
+ style={styles.createInput}
+ value={newVaultNames[group.groupId] ?? ''}
+ onChangeText={text => setNewVaultNames(previous => ({ ...previous, [group.groupId]: text }))}
+ placeholder={t('sharing.family.vaultNamePlaceholder')}
+ placeholderTextColor={colors.textMuted}
+ editable={!busy}
+ onSubmitEditing={() => createSharedVault(group)}
+ />
+ {renderAction(t('sharing.family.create'), () => createSharedVault(group))}
+ </View>
+ </View>
+ )}
+ </View>
+ );
+ })}
+ </>
+ )}
+ </ThemedScrollView>
+ </ThemedContainer>
+ );
+}
diff --git a/apps/mobile-app/app/(tabs)/settings/index.tsx b/apps/mobile-app/app/(tabs)/settings/index.tsx
index 212711789..4ab6d2ce0 100644
--- a/apps/mobile-app/app/(tabs)/settings/index.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/index.tsx
@@ -1,4 +1,5 @@
import { AppInfo } from '@aliasvault/client/platform/AppInfo';
+import { CapabilityKeys } from '@aliasvault/models/webapi';
import { Ionicons } from '@expo/vector-icons';
import { router, useFocusEffect, useNavigation } from 'expo-router';
import { useEffect, useRef, useState, useCallback } from 'react';
@@ -23,6 +24,7 @@ import { InlineSkeletonLoader } from '@/components/ui/InlineSkeletonLoader';
import { TitleContainer } from '@/components/ui/TitleContainer';
import { UsernameDisplay } from '@/components/ui/UsernameDisplay';
import { useApp } from '@/context/AppContext';
+import { useCapabilities } from '@/context/CapabilityContext';
import { useDialog } from '@/context/DialogContext';
import { LocalPreferencesService } from '@/services/LocalPreferencesService';
import NativeVaultManager from '@/specs/NativeVaultManager';
@@ -37,6 +39,7 @@ export default function SettingsScreen() : React.ReactNode {
const insets = useSafeAreaInsets();
const { shouldShowAutofillReminder } = useApp();
const { getAutoLockTimeout } = useApp();
+ const hasCapability = useCapabilities();
const { logoutUserInitiated } = useLogout();
const { loadApiUrl, getDisplayUrl } = useApiUrl();
const navigate = useNavigationDebounce();
@@ -247,6 +250,19 @@ export default function SettingsScreen() : React.ReactNode {
};
const styles = StyleSheet.create({
+ betaBadge: {
+ backgroundColor: colors.primary,
+ borderRadius: 10,
+ paddingHorizontal: 6,
+ paddingVertical: 1,
+ },
+ betaBadgeText: {
+ color: colors.primarySurfaceText,
+ fontSize: 10,
+ fontWeight: '600',
+ lineHeight: 14,
+ textTransform: 'uppercase',
+ },
fab: {
alignItems: 'center',
backgroundColor: colors.primary,
@@ -317,6 +333,16 @@ export default function SettingsScreen() : React.ReactNode {
marginRight: 12,
width: 24,
},
+ settingItemLabel: {
+ alignItems: 'center',
+ flex: 1,
+ flexDirection: 'row',
+ gap: 8,
+ },
+ settingItemLabelText: {
+ color: colors.text,
+ fontSize: 16,
+ },
settingItemText: {
color: colors.text,
flex: 1,
@@ -379,6 +405,28 @@ export default function SettingsScreen() : React.ReactNode {
<TitleContainer title={t('settings.title')} onLogoPress={registerTap} />
<UsernameDisplay />
<View style={styles.section}>
+ {hasCapability(CapabilityKeys.VaultSharing) && (
+ <>
+ <TouchableOpacity
+ style={styles.settingItem}
+ onPress={() => navigate(() => router.push('/(tabs)/settings/family-sharing'))}
+ >
+ <View style={styles.settingItemIcon}>
+ <Ionicons name="people-outline" size={20} color={colors.text} />
+ </View>
+ <View style={styles.settingItemContent}>
+ <View style={styles.settingItemLabel}>
+ <ThemedText style={styles.settingItemLabelText}>{t('sharing.family.title')}</ThemedText>
+ <View style={styles.betaBadge}>
+ <ThemedText style={styles.betaBadgeText}>{t('sharing.family.beta')}</ThemedText>
+ </View>
+ </View>
+ <Ionicons name="chevron-forward" size={20} color={colors.textMuted} />
+ </View>
+ </TouchableOpacity>
+ <View style={styles.separator} />
+ </>
+ )}
{Platform.OS === 'ios' && (
<>
<TouchableOpacity
diff --git a/apps/mobile-app/i18n/locales/en.json b/apps/mobile-app/i18n/locales/en.json
index e52fc2e76..2f15c042f 100644
--- a/apps/mobile-app/i18n/locales/en.json
+++ b/apps/mobile-app/i18n/locales/en.json
@@ -337,6 +337,62 @@
}
}
},
+ "sharing": {
+ "members": "Family members",
+ "owner": "Owner",
+ "revoke": "Revoke",
+ "family": {
+ "title": "Family Sharing",
+ "beta": "Beta",
+ "description": "Share folders with the people in your family.",
+ "notAvailable": "Family sharing is not enabled for this account yet. Once a family has been set up for you, it appears here.",
+ "invitations": "Invitations",
+ "invitedBy": "Invited by {{username}}",
+ "accept": "Accept",
+ "decline": "Decline",
+ "noSharedVaultAdmin": "This family has no shared folder yet. Creating one adds a folder to your vault that every member you invite can see.",
+ "noSharedVaultMember": "Nobody has created a shared folder for this family yet.",
+ "createSharedVault": "Create a shared folder",
+ "sharedFolders": "Shared folders",
+ "hasAccess": "Has access",
+ "invited": "Invited",
+ "you": "You",
+ "admin": "Admin",
+ "member": "Member",
+ "withdraw": "Withdraw",
+ "leaveVault": "Leave folder",
+ "leaveVaultConfirm": "Leave “{{vault}}”? You lose access to it, but stay in the family.",
+ "cannotInviteWithoutAccess": "You do not have access to this folder, so you cannot invite anyone to it. Ask a member who has access to invite you first.",
+ "errors": {
+ "loadFailed": "Family sharing could not be loaded.",
+ "createVaultFailed": "The shared folder could not be created. Please try again.",
+ "vaultUpgradeRequired": "Your vault has to finish upgrading before it can be shared.",
+ "revokeAccessFailed": "The access could not be changed. Please try again.",
+ "inviteFailed": "The invitation could not be sent. Please try again.",
+ "userNotReady": "That account has to finish upgrading AliasVault before a folder can be shared with it.",
+ "alreadyInvited": "That person has already been invited.",
+ "invitationGone": "That invitation is no longer available.",
+ "invitationKeyOutdated": "This invitation is no longer valid because the shared folder's key has changed. Ask for a new invitation.",
+ "notFamilyMember": "That person is not in this family.",
+ "alreadyHasAccess": "That person already has access to this folder.",
+ "lastMemberWithAccess": "Somebody has to be able to open the shared folder. Give another member access to it first.",
+ "vaultLimitReached": "Max amount of shared folders reached.",
+ "deleteVaultFailed": "The shared folder could not be deleted. Please try again."
+ },
+ "vaultNamePlaceholder": "Folder name, for example Streaming",
+ "create": "Create",
+ "invite": "Invite",
+ "invitationSent": "Invitation sent to {{username}}.",
+ "noAccess": "No access",
+ "revokeAccessConfirm": "Take {{username}} out of “{{vault}}”? They lose access to it right away, but stay in the family.",
+ "revokeAccessWarning": "They keep any copy of this folder they already downloaded. Change the passwords in it that you do not want them to keep using.",
+ "deleteVault": "Delete folder",
+ "deleteVaultConfirm": "Permanently delete “{{vault}}”? Every member of the family loses this folder and everything in it. This cannot be undone.",
+ "deleteVaultPasswordPrompt": "Enter your master password to confirm deleting “{{vault}}” for the whole family.",
+ "vaultDeleted": "The shared folder has been deleted.",
+ "unnamedVault": "Shared folder"
+ }
+ },
"navigation": {
"vault": "Vault",
"emails": "Emails",
@@ -567,6 +623,7 @@
"deleteFolderKeepItemsDescription": "Items will be moved to the parent folder.",
"deleteFolderAndItems": "Delete folder and all items",
"deleteFolderAndItemsDescription": "{{count}} item(s) will be moved to Recently Deleted.",
+ "deleteSharedFolderHint": "This folder is shared with your family and cannot be deleted here. Leave it, or change who has access to it, in Family Sharing.",
"emptyFolderHint": "This folder is empty. To move items to this folder, edit the item and select this folder.",
"selectFolder": "Select Folder"
},