Skip to content

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

Update email queries and refactor all webapi calls to use central v2 prefix in mobile app (#2159)

Leendert de Borst03e0f7c8d478
diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/webapi/WebApiService.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/webapi/WebApiService.kt
index 030f2f28b..d5a7010b2 100644
--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/webapi/WebApiService.kt
+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/webapi/WebApiService.kt
@@ -143,19 +143,12 @@ class WebApiService(private val context: Context) {
}
/**
- * Get the API root URL (no version segment), for paths that carry their own.
- */
- private fun getApiRootUrl(): String {
- return getApiUrl().trimEnd('/') + "/"
- }
-
- /**
- * Get the base URL with /v1/ appended.
+ * Get the base URL with /v2/ appended.
*/
private fun getBaseUrl(): String {
val apiUrl = getApiUrl()
val trimmedUrl = apiUrl.trimEnd('/')
- return "$trimmedUrl/v1/"
+ return "$trimmedUrl/v2/"
}
// MARK: - Token Management
@@ -199,14 +192,12 @@ class WebApiService(private val context: Context) {
/**
* Execute a WebAPI request with support for authentication and token refresh.
*/
- @Suppress("LongParameterList") // One optional flag past the threshold; splitting the signature would hurt every caller
suspend fun executeRequest(
method: String,
endpoint: String,
body: String?,
headers: Map<String, String>,
requiresAuth: Boolean,
- versioned: Boolean = false,
): WebApiResponse = withContext(Dispatchers.IO) {
val requestHeaders = headers.toMutableMap()
@@ -227,7 +218,6 @@ class WebApiService(private val context: Context) {
endpoint = endpoint,
body = body,
headers = requestHeaders,
- versioned = versioned,
)
// Handle 401 Unauthorized - attempt token refresh
@@ -247,7 +237,6 @@ class WebApiService(private val context: Context) {
endpoint = endpoint,
body = body,
headers = retryHeaders,
- versioned = versioned,
)
return@withContext retryResponse
@@ -261,20 +250,6 @@ class WebApiService(private val context: Context) {
response
}
- /**
- * Execute a request whose path carries its own API version segment (e.g. `v2/Vault`), with
- * authentication and token refresh. This is what the Rust sync engine's HTTP commands go through.
- */
- suspend fun executeVersionedRequest(
- method: String,
- path: String,
- body: String?,
- headers: Map<String, String>,
- requiresAuth: Boolean,
- ): WebApiResponse {
- return executeRequest(method, path, body, headers, requiresAuth, versioned = true)
- }
-
/**
* Execute a raw HTTP request without token refresh logic.
*/
@@ -283,10 +258,8 @@ class WebApiService(private val context: Context) {
endpoint: String,
body: String?,
headers: Map<String, String>,
- versioned: Boolean = false,
): WebApiResponse = withContext(Dispatchers.IO) {
- val baseUrl = if (versioned) getApiRootUrl() else getBaseUrl()
- val urlString = "$baseUrl$endpoint"
+ val urlString = "${getBaseUrl()}$endpoint"
var connection: HttpURLConnection? = null
try {
diff --git a/apps/mobile-app/app/(tabs)/emails/index.tsx b/apps/mobile-app/app/(tabs)/emails/index.tsx
index 9235a614c..5a594ffaf 100644
--- a/apps/mobile-app/app/(tabs)/emails/index.tsx
+++ b/apps/mobile-app/app/(tabs)/emails/index.tsx
@@ -46,6 +46,25 @@ export default function EmailsScreen() : React.ReactNode {
const PAGE_SIZE = 50;
+ /**
+ * Get the vault's routable addresses on server-hosted domains; addresses on other domains are never sent to the server.
+ */
+ const getMailboxAddresses = useCallback(async () : Promise<string[]> => {
+ const sqliteClient = dbContext.sqliteClient;
+ if (!sqliteClient) {
+ return [];
+ }
+
+ const routableAddresses = await sqliteClient.items.getRoutableEmailAddresses();
+ try {
+ const metadata = await sqliteClient.getVaultMetadata();
+ const hostedDomains = [...metadata.privateEmailDomains, ...(metadata.hiddenPrivateEmailDomains ?? [])].map(domain => domain.toLowerCase());
+ return routableAddresses.filter(address => hostedDomains.some(domain => address.toLowerCase().endsWith(`@${domain}`)));
+ } catch {
+ return [];
+ }
+ }, [dbContext.sqliteClient]);
+
/**
* Load emails.
*/
@@ -63,8 +82,8 @@ export default function EmailsScreen() : React.ReactNode {
return;
}
- // Get unique email addresses from all items
- const emailAddresses = await dbContext.sqliteClient.items.getRoutableEmailAddresses();
+ // Get the addresses this vault has enabled claims for.
+ const emailAddresses = await getMailboxAddresses();
try {
const data = await webApi.post<MailboxBulkRequest, MailboxBulkResponse>('EmailBox/bulk', {
@@ -108,7 +127,7 @@ export default function EmailsScreen() : React.ReactNode {
} catch (err) {
setError(err instanceof Error ? err.message : t('common.error'));
}
- }, [dbContext, webApi, setIsLoading, t, PAGE_SIZE]);
+ }, [dbContext, webApi, setIsLoading, t, PAGE_SIZE, getMailboxAddresses]);
/**
* Load more emails (next page).
@@ -122,7 +141,7 @@ export default function EmailsScreen() : React.ReactNode {
setIsLoadingMore(true);
setError(null);
- const emailAddresses = await dbContext.sqliteClient.items.getRoutableEmailAddresses();
+ const emailAddresses = await getMailboxAddresses();
const nextPage = currentPage + 1;
const data = await webApi.post<MailboxBulkRequest, MailboxBulkResponse>('EmailBox/bulk', {
@@ -152,7 +171,7 @@ export default function EmailsScreen() : React.ReactNode {
} finally {
setIsLoadingMore(false);
}
- }, [isLoadingMore, dbContext.sqliteClient, dbContext.isOffline, webApi, currentPage, PAGE_SIZE, t]);
+ }, [isLoadingMore, dbContext.sqliteClient, dbContext.isOffline, webApi, currentPage, PAGE_SIZE, t, getMailboxAddresses]);
useEffect(() => {
const unsubscribeFocus = navigation.addListener('focus', () => {
diff --git a/apps/mobile-app/components/EmailCard.tsx b/apps/mobile-app/components/EmailCard.tsx
index 2ffb50b6e..8b45b8c79 100644
--- a/apps/mobile-app/components/EmailCard.tsx
+++ b/apps/mobile-app/components/EmailCard.tsx
@@ -1,3 +1,4 @@
+import { MaterialIcons } from '@expo/vector-icons';
import { router } from 'expo-router';
import { useEffect, useState } from 'react';
import { StyleSheet, View } from 'react-native';
@@ -85,6 +86,10 @@ export function EmailCard({ email }: EmailCardProps) : React.ReactNode {
};
const styles = StyleSheet.create({
+ attachmentIcon: {
+ marginRight: 2,
+ opacity: 0.6,
+ },
emailCard: {
backgroundColor: colors.accentBackground,
borderRadius: 8,
@@ -110,6 +115,11 @@ export function EmailCard({ email }: EmailCardProps) : React.ReactNode {
justifyContent: 'space-between',
marginBottom: 8,
},
+ emailMeta: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ flexShrink: 0,
+ },
emailPreview: {
color: colors.text,
fontSize: 14,
@@ -145,9 +155,14 @@ export function EmailCard({ email }: EmailCardProps) : React.ReactNode {
<ThemedText style={styles.emailSubject} numberOfLines={1}>
{email.subject}
</ThemedText>
- <ThemedText style={styles.emailDate}>
- {formatEmailDate(email.dateSystem)}
- </ThemedText>
+ <View style={styles.emailMeta}>
+ {email.hasAttachments && (
+ <MaterialIcons name="attach-file" size={14} color={colors.textMuted} style={styles.attachmentIcon} />
+ )}
+ <ThemedText style={styles.emailDate}>
+ {formatEmailDate(email.dateSystem)}
+ </ThemedText>
+ </View>
</View>
<ThemedText style={styles.emailPreview} numberOfLines={2}>
{email.messagePreview}
diff --git a/apps/mobile-app/components/items/details/EmailPreview.tsx b/apps/mobile-app/components/items/details/EmailPreview.tsx
index e8565a770..b67b96821 100644
--- a/apps/mobile-app/components/items/details/EmailPreview.tsx
+++ b/apps/mobile-app/components/items/details/EmailPreview.tsx
@@ -119,7 +119,8 @@ export const EmailPreview: React.FC<EmailPreviewProps> = ({ email }) : React.Rea
const isPublic = await isPublicDomain(email);
const isPrivate = await isPrivateDomain(email);
- const isSupported = isPublic || isPrivate;
+ const isRoutable = !isPrivate || (await dbContext.sqliteClient?.items.isEmailAddressRoutable(email) ?? false);
+ const isSupported = (isPublic || isPrivate) && isRoutable;
setIsSpamOk(isPublic);
setIsSupportedDomain(isSupported);
diff --git a/apps/mobile-app/ios/VaultStoreKit/Services/WebApiService.swift b/apps/mobile-app/ios/VaultStoreKit/Services/WebApiService.swift
index b6598fc86..fd7996907 100644
--- a/apps/mobile-app/ios/VaultStoreKit/Services/WebApiService.swift
+++ b/apps/mobile-app/ios/VaultStoreKit/Services/WebApiService.swift
@@ -101,18 +101,12 @@ public class WebApiService {
}
/**
- * Get the base URL with /v1/ appended
+ * Get the base URL with /v2/ appended
*/
- private func getApiRootUrl() -> String {
- let apiUrl = getApiUrl()
- let trimmedUrl = apiUrl.hasSuffix("/") ? String(apiUrl.dropLast()) : apiUrl
- return "\(trimmedUrl)/"
- }
-
private func getBaseUrl() -> String {
let apiUrl = getApiUrl()
let trimmedUrl = apiUrl.hasSuffix("/") ? String(apiUrl.dropLast()) : apiUrl
- return "\(trimmedUrl)/v1/"
+ return "\(trimmedUrl)/v2/"
}
// MARK: - Token Management
@@ -159,8 +153,7 @@ public class WebApiService {
endpoint: String,
body: String?,
headers: [String: String],
- requiresAuth: Bool,
- versioned: Bool = false
+ requiresAuth: Bool
) async throws -> WebApiResponse {
var requestHeaders = headers
@@ -177,8 +170,7 @@ public class WebApiService {
method: method,
endpoint: endpoint,
body: body,
- headers: requestHeaders,
- versioned: versioned
+ headers: requestHeaders
)
// Handle 401 Unauthorized - attempt token refresh
@@ -194,8 +186,7 @@ public class WebApiService {
method: method,
endpoint: endpoint,
body: body,
- headers: retryHeaders,
- versioned: versioned
+ headers: retryHeaders
)
return retryResponse
@@ -209,20 +200,6 @@ public class WebApiService {
return response
}
- /**
- * Execute a request whose path carries its own API version segment (e.g. `v2/Vault`), with
- * authentication and token refresh. This is what the Rust sync engine's HTTP commands go through.
- */
- public func executeVersionedRequest(
- method: String,
- path: String,
- body: String?,
- headers: [String: String],
- requiresAuth: Bool
- ) async throws -> WebApiResponse {
- return try await executeRequest(method: method, endpoint: path, body: body, headers: headers, requiresAuth: requiresAuth, versioned: true)
- }
-
/**
* Execute a raw HTTP request without token refresh logic
*/
@@ -230,11 +207,9 @@ public class WebApiService {
method: String,
endpoint: String,
body: String?,
- headers: [String: String],
- versioned: Bool = false
+ headers: [String: String]
) async throws -> WebApiResponse {
- let baseUrl = versioned ? getApiRootUrl() : getBaseUrl()
- let urlString = "\(baseUrl)\(endpoint)"
+ let urlString = "\(getBaseUrl())\(endpoint)"
guard let url = URL(string: urlString) else {
throw NSError(
diff --git a/apps/mobile-app/specs/NativeVaultManager.ts b/apps/mobile-app/specs/NativeVaultManager.ts
index 72da528d7..331ebed7f 100644
--- a/apps/mobile-app/specs/NativeVaultManager.ts
+++ b/apps/mobile-app/specs/NativeVaultManager.ts
@@ -15,7 +15,7 @@ export interface Spec extends TurboModule {
setCustomProxyHeaders(headersJson: string): Promise<void>;
getCustomProxyHeaders(): Promise<string>;
- // WebAPI request execution
+ // WebAPI request execution against the v2 API base URL.
executeWebApiRequest(method: string, endpoint: string, body: string | null, headers: string, requiresAuth: boolean): Promise<string>;
// Vault state management
diff --git a/apps/mobile-app/utils/EncryptionUtility.ts b/apps/mobile-app/utils/EncryptionUtility.ts
index 2c3670ca6..2bbc583fc 100644
--- a/apps/mobile-app/utils/EncryptionUtility.ts
+++ b/apps/mobile-app/utils/EncryptionUtility.ts
@@ -370,13 +370,16 @@ class EncryptionUtility {
/**
* Decrypts a list of emails based on the provided public/private key pairs. The publicKeys table is the one the
* API sent alongside the emails; each email's decryption keys reference it by index.
+ *
+ * Emails that cannot be decrypted are skipped rather than failing the batch, so one unreadable record cannot
+ * break the whole list view.
*/
public static async decryptEmailList(
emails: MailboxEmail[],
publicKeys: string[],
encryptionKeys: EncryptionKey[]
): Promise<MailboxEmail[]> {
- return Promise.all(emails.map(async email => {
+ const results = await Promise.all(emails.map(async email => {
try {
const symmetricKeyBase64 = await EncryptionUtility.resolveEmailSymmetricKey(email.decryptionKeys, publicKeys, encryptionKeys);
@@ -395,9 +398,12 @@ class EncryptionUtility {
return decryptedEmail;
} catch (err) {
- throw new Error(err instanceof Error ? err.message : 'Failed to decrypt email');
+ console.warn(`[Email] Skipping email ${email.id}, it could not be decrypted:`, err);
+ return null;
}
}));
+
+ return results.filter((email): email is MailboxEmail => email !== null);
}
/**
diff --git a/apps/mobile-app/utils/WebApiService.ts b/apps/mobile-app/utils/WebApiService.ts
index 8253f27f2..b635f19f8 100644
--- a/apps/mobile-app/utils/WebApiService.ts
+++ b/apps/mobile-app/utils/WebApiService.ts
@@ -24,7 +24,7 @@ type NativeWebApiResponse = {
/**
* Service class for interacting with the web API.
- * This class now acts as a proxy to the native layer, where all WebAPI calls are executed.
+ * Endpoints are unversioned (e.g. `Email/1`); the native layer resolves them against the current base URL (v2).
*/
export class WebApiService {
/**
@@ -32,7 +32,7 @@ export class WebApiService {
*/
public async getBaseUrl(): Promise<string> {
const apiUrl = await this.getApiUrl();
- return apiUrl.replace(/\/$/, '') + '/v1/';
+ return apiUrl.replace(/\/$/, '') + '/v2/';
}
/**
@@ -47,7 +47,6 @@ export class WebApiService {
/**
* Fetch data from the API with authentication headers and access token refresh retry.
- * This method now proxies to the native layer which handles auth and token refresh.
*/
public async authFetch<T>(
endpoint: string,
@@ -81,13 +80,12 @@ export class WebApiService {
endpoint,
options.body as string | null ?? null,
JSON.stringify(headers),
- true // requiresAuth
+ true, // requiresAuth
);
const response: NativeWebApiResponse = JSON.parse(responseJson);
- // If native layer returns 401 session is truly expired
- // The native layer has already tried to refresh the token, so this is a final failure
+ // If native layer returns 401 session is truly expired (native layer already attempted token refresh automatically).
if (response.statusCode === 401) {
logoutEventEmitter.emit('auth.errors.sessionExpired');
throw new Error(i18n.t('auth.errors.sessionExpired'));
@@ -121,7 +119,6 @@ export class WebApiService {
/**
* Fetch data from the API without authentication headers and without access token refresh retry.
- * This method now proxies to the native layer.
*/
public async rawFetch(
endpoint: string,
@@ -152,7 +149,7 @@ export class WebApiService {
endpoint,
options.body as string | null ?? null,
JSON.stringify(headers),
- false // requiresAuth = false
+ false, // requiresAuth
);
const nativeResponse: NativeWebApiResponse = JSON.parse(responseJson);
@@ -232,7 +229,7 @@ export class WebApiService {
endpoint,
null,
JSON.stringify(headers),
- true // requiresAuth
+ true, // requiresAuth
);
const response: NativeWebApiResponse = JSON.parse(responseJson);
diff --git a/core/client/src/api/WebApiService.ts b/core/client/src/api/WebApiService.ts
index b5259d7d5..e675a7213 100644
--- a/core/client/src/api/WebApiService.ts
+++ b/core/client/src/api/WebApiService.ts
@@ -206,7 +206,7 @@ export class WebApiService {
* Run a request on behalf of the Rust sync engine.
*/
public async engineRequest(method: string, path: string, body: string | undefined, requiresAuth: boolean, largeTransfer: boolean): Promise<EngineHttpResponse> {
- const url = (await this.getApiUrl()).replace(/\/$/, '') + '/' + path.replace(/^\/+/, '');
+ const url = await this.getBaseUrl() + path.replace(/^\/+/, '');
const headers = new Headers({ Accept: 'application/json' });
if (body !== undefined) {
headers.set('Content-Type', 'application/json');
diff --git a/core/rust/src/vault_sync/http.rs b/core/rust/src/vault_sync/http.rs
index 179dd6fe5..c4c5920f6 100644
--- a/core/rust/src/vault_sync/http.rs
+++ b/core/rust/src/vault_sync/http.rs
@@ -32,31 +32,27 @@ fn parse<T: DeserializeOwned>(body: &str) -> SyncResult<T> {
serde_json::from_str(body).map_err(|e| SyncError::Other(format!("Unexpected API response: {}", e)))
}
-fn v2(path: &str) -> String {
- format!("v2/{}", path)
-}
-
/// Authenticated GET of a v2 endpoint.
pub(crate) async fn get<T: DeserializeOwned>(host: &Host, path: &str, large_transfer: bool) -> SyncResult<T> {
- let body = check(send(host, HttpMethod::Get, &v2(path), None, true, large_transfer).await?)?;
+ let body = check(send(host, HttpMethod::Get, path, None, true, large_transfer).await?)?;
parse(&body)
}
/// Authenticated POST of a v2 endpoint with a JSON body.
pub(crate) async fn post<B: Serialize, T: DeserializeOwned>(host: &Host, path: &str, body: &B, large_transfer: bool) -> SyncResult<T> {
- let body = check(send(host, HttpMethod::Post, &v2(path), Some(serde_json::to_string(body)?), true, large_transfer).await?)?;
+ let body = check(send(host, HttpMethod::Post, path, Some(serde_json::to_string(body)?), true, large_transfer).await?)?;
parse(&body)
}
/// Authenticated POST that returns no body.
pub(crate) async fn post_no_content<B: Serialize>(host: &Host, path: &str, body: &B) -> SyncResult<()> {
- check(send(host, HttpMethod::Post, &v2(path), Some(serde_json::to_string(body)?), true, false).await?)?;
+ check(send(host, HttpMethod::Post, path, Some(serde_json::to_string(body)?), true, false).await?)?;
Ok(())
}
/// Authenticated DELETE of a v2 endpoint.
pub(crate) async fn delete(host: &Host, path: &str) -> SyncResult<()> {
- check(send(host, HttpMethod::Delete, &v2(path), None, true, false).await?)?;
+ check(send(host, HttpMethod::Delete, path, None, true, false).await?)?;
Ok(())
}
diff --git a/core/rust/src/vault_sync/tests/mod.rs b/core/rust/src/vault_sync/tests/mod.rs
index 96f3ff071..3cc665ef7 100644
--- a/core/rust/src/vault_sync/tests/mod.rs
+++ b/core/rust/src/vault_sync/tests/mod.rs
@@ -102,8 +102,8 @@ fn fresh_client_pulls_and_materializes_the_server_vault() {
let server_db = test_host::open_schema_db(&host.schema_sql);
insert_item(&server_db, "aaaaaaaa-0000-4000-8000-000000000001", "Server item", PERSONAL_MANIFEST_ID);
let (status, vault) = snapshot_of(&server_db, &vek, 7, &vault_codec::generate_manifest_salt());
- host.respond("GET", "v2/Status", status);
- host.respond("GET", "v2/Vault", vault);
+ host.respond("GET", "Status", status);
+ host.respond("GET", "Vault", vault);
let session = SyncSession::new(&request("fullSync", &vek, false, 0)).unwrap();
let result = host.drive(&session);
@@ -118,7 +118,7 @@ fn fresh_client_pulls_and_materializes_the_server_vault() {
assert_eq!(host.state[state::SERVER_MANIFEST_REVISIONS][PERSONAL_MANIFEST_ID], 7);
assert_eq!(host.state[state::VAULT_PERSONAL_MANIFEST_ID], PERSONAL_MANIFEST_ID);
assert!(host.state[state::VAULT_CONTENT_FINGERPRINTS].as_object().unwrap().contains_key(&format!("manifest:{}", PERSONAL_MANIFEST_ID)));
- assert!(host.requests_to("v2/Vault").len() == 1);
+ assert!(host.requests_to("Vault").len() == 1);
}
#[test]
@@ -129,14 +129,14 @@ fn clean_client_in_sync_does_nothing() {
host.state.insert(state::SERVER_MANIFEST_REVISIONS.to_string(), json!({ PERSONAL_MANIFEST_ID: 3 }));
host.state.insert(state::VAULT_PERSONAL_MANIFEST_ID.to_string(), json!(PERSONAL_MANIFEST_ID));
host.store_local_as_blob();
- host.respond("GET", "v2/Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 3 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
+ host.respond("GET", "Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 3 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
let session = SyncSession::new(&request("fullSync", &vek, false, 0)).unwrap();
let result = host.drive(&session);
assert_eq!(result["success"], true, "{}", result);
assert_eq!(result["hasNewVault"], false);
- assert!(host.requests_to("v2/Vault").is_empty());
+ assert!(host.requests_to("Vault").is_empty());
assert!(host.store_calls.is_empty());
}
@@ -151,21 +151,21 @@ fn dirty_client_pushes_only_what_changed() {
insert_item(&server_db, "aaaaaaaa-0000-4000-8000-000000000001", "Server item", PERSONAL_MANIFEST_ID);
let (status, vault) = snapshot_of(&server_db, &vek, 7, &salt);
host.state.insert(state::ENCRYPTED_ACCOUNT_KEY.to_string(), json!("wrapped"));
- host.respond("GET", "v2/Status", status.clone());
- host.respond("GET", "v2/Vault", vault);
+ host.respond("GET", "Status", status.clone());
+ host.respond("GET", "Vault", vault);
host.drive(&SyncSession::new(&request("fullSync", &vek, false, 0)).unwrap());
insert_item(&host.local, "aaaaaaaa-0000-4000-8000-000000000002", "Local item", PERSONAL_MANIFEST_ID);
host.store_local_as_blob();
host.mutation_sequence = 1;
host.is_dirty = true;
- host.respond("POST", "v2/Vault/blobs/missing", json!({ "missing": [] }));
- host.respond("POST", "v2/Vault", json!({ "status": 0, "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 8 }], "bucketRevisions": [], "missingBlobHashes": [] }));
+ host.respond("POST", "Vault/blobs/missing", json!({ "missing": [] }));
+ host.respond("POST", "Vault", json!({ "status": 0, "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 8 }], "bucketRevisions": [], "missingBlobHashes": [] }));
let result = host.drive(&SyncSession::new(&request("fullSync", &vek, true, 1)).unwrap());
assert_eq!(result["success"], true, "{}", result);
- let writes = host.requests_to("v2/Vault");
+ let writes = host.requests_to("Vault");
let posts: Vec<_> = writes.iter().filter(|r| r.method == "POST").collect();
assert_eq!(posts.len(), 1, "one write expected");
let body = posts[0].body.as_ref().unwrap();
@@ -194,8 +194,8 @@ fn no_op_mutation_clears_the_dirty_flag_without_a_write() {
insert_item(&server_db, "aaaaaaaa-0000-4000-8000-000000000001", "Server item", PERSONAL_MANIFEST_ID);
let (status, vault) = snapshot_of(&server_db, &vek, 7, &vault_codec::generate_manifest_salt());
host.state.insert(state::ENCRYPTED_ACCOUNT_KEY.to_string(), json!("wrapped"));
- host.respond("GET", "v2/Status", status);
- host.respond("GET", "v2/Vault", vault);
+ host.respond("GET", "Status", status);
+ host.respond("GET", "Vault", vault);
host.drive(&SyncSession::new(&request("fullSync", &vek, false, 0)).unwrap());
// Marked dirty, nothing actually changed.
@@ -218,8 +218,8 @@ fn outdated_push_merges_the_server_change_and_retries() {
insert_item(&server_db, "aaaaaaaa-0000-4000-8000-000000000001", "Server item", PERSONAL_MANIFEST_ID);
let (status, vault) = snapshot_of(&server_db, &vek, 7, &salt);
host.state.insert(state::ENCRYPTED_ACCOUNT_KEY.to_string(), json!("wrapped"));
- host.respond("GET", "v2/Status", status);
- host.respond("GET", "v2/Vault", vault);
+ host.respond("GET", "Status", status);
+ host.respond("GET", "Vault", vault);
host.drive(&SyncSession::new(&request("fullSync", &vek, false, 0)).unwrap());
// Another client adds an item on the server (revision 8) while this one adds a different item locally.
@@ -231,11 +231,11 @@ fn outdated_push_merges_the_server_change_and_retries() {
host.is_dirty = true;
host.responders.clear();
- host.respond("GET", "v2/Status", status8);
- host.respond("GET", "v2/Vault", vault8);
- host.respond("POST", "v2/Vault/blobs/missing", json!({ "missing": [] }));
+ host.respond("GET", "Status", status8);
+ host.respond("GET", "Vault", vault8);
+ host.respond("POST", "Vault/blobs/missing", json!({ "missing": [] }));
host.respond_with(Box::new(|method, path, body| {
- if method != "POST" || path != "v2/Vault" {
+ if method != "POST" || path != "Vault" {
return None;
}
let current = body.and_then(|b| b["manifests"][0]["currentRevision"].as_i64()).unwrap_or(-1);
@@ -252,7 +252,7 @@ fn outdated_push_merges_the_server_change_and_retries() {
assert_eq!(result["hasNewVault"], true);
assert_eq!(item_names(&host.local), vec!["Local item", "Other device item", "Server item"]);
assert_eq!(host.state[state::SERVER_MANIFEST_REVISIONS][PERSONAL_MANIFEST_ID], 9);
- let posts: Vec<_> = host.requests_to("v2/Vault").into_iter().filter(|r| r.method == "POST").collect();
+ let posts: Vec<_> = host.requests_to("Vault").into_iter().filter(|r| r.method == "POST").collect();
assert_eq!(posts.last().unwrap().body.as_ref().unwrap()["manifests"][0]["currentRevision"], 8);
let merged: Value = {
let blob = posts.last().unwrap().body.as_ref().unwrap()["manifests"][0]["manifestBlob"].as_str().unwrap();
@@ -279,7 +279,7 @@ fn unreachable_server_with_a_local_vault_goes_offline() {
fn expired_session_requires_logout() {
let vek = crypto::generate_key_base64();
let mut host = TestHost::new(&vek);
- host.respond_with(Box::new(|_, path, _| if path == "v2/Status" { Some((401, json!({}))) } else { None }));
+ host.respond_with(Box::new(|_, path, _| if path == "Status" { Some((401, json!({}))) } else { None }));
let result = host.drive(&SyncSession::new(&request("fullSync", &vek, false, 0)).unwrap());
@@ -293,7 +293,7 @@ fn password_changed_elsewhere_requires_logout() {
let vek = crypto::generate_key_base64();
let mut host = TestHost::new(&vek);
host.state.insert(state::ENCRYPTION_KEY_DERIVATION_PARAMS.to_string(), json!({ "salt": "old-salt", "encryptionType": "Argon2Id", "encryptionSettings": "{}" }));
- host.respond("GET", "v2/Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "new-salt" }));
+ host.respond("GET", "Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "new-salt" }));
let result = host.drive(&SyncSession::new(&request("fullSync", &vek, false, 0)).unwrap());
@@ -308,7 +308,7 @@ fn legacy_account_without_vault_key_reports_the_manifest_migration() {
host.state.insert(state::SERVER_MANIFEST_REVISIONS.to_string(), json!({ PERSONAL_MANIFEST_ID: 3 }));
host.state.insert(state::VAULT_PERSONAL_MANIFEST_ID.to_string(), json!(PERSONAL_MANIFEST_ID));
host.store_local_as_blob();
- host.respond("GET", "v2/Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 3 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
+ host.respond("GET", "Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 3 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
let result = host.drive(&SyncSession::new(&request("fullSync", &kek, false, 0)).unwrap());
@@ -329,9 +329,9 @@ fn manifest_migration_generates_the_key_hierarchy_and_pushes() {
host.state.insert(state::SERVER_MANIFEST_REVISIONS.to_string(), json!({ PERSONAL_MANIFEST_ID: 3 }));
host.state.insert(state::VAULT_PERSONAL_MANIFEST_ID.to_string(), json!(PERSONAL_MANIFEST_ID));
host.state.insert(state::VAULT_MANIFEST_SALT.to_string(), json!(salt));
- host.respond_with(Box::new(|method, path, _| if method == "GET" && path == "v2/VaultKey/Password" { Some((200, json!({ "vaultKey": null }))) } else { None }));
- host.respond("POST", "v2/Vault/blobs/missing", json!({ "missing": [] }));
- host.respond("POST", "v2/Vault", json!({ "status": 0, "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "bucketRevisions": [], "missingBlobHashes": [] }));
+ host.respond_with(Box::new(|method, path, _| if method == "GET" && path == "VaultKey/Password" { Some((200, json!({ "vaultKey": null }))) } else { None }));
+ host.respond("POST", "Vault/blobs/missing", json!({ "missing": [] }));
+ host.respond("POST", "Vault", json!({ "status": 0, "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "bucketRevisions": [], "missingBlobHashes": [] }));
let result = host.drive(&SyncSession::new(&request("migrateManifest", &kek, false, 0)).unwrap());
@@ -339,7 +339,7 @@ fn manifest_migration_generates_the_key_hierarchy_and_pushes() {
assert_eq!(result["pushed"], true);
let new_key = result["sessionUpdates"]["encryptionKey"].as_str().expect("the session adopts the new VEK");
assert_ne!(new_key, kek);
- let posts: Vec<_> = host.requests_to("v2/Vault").into_iter().filter(|r| r.method == "POST").collect();
+ let posts: Vec<_> = host.requests_to("Vault").into_iter().filter(|r| r.method == "POST").collect();
let body = posts[0].body.as_ref().unwrap();
assert!(body["accountKeys"]["encryptedAccountKey"].is_string(), "the migration push carries the key hierarchy");
let (vek, _) = crypto::resolve_vault_encryption_key(body["accountKeys"]["encryptedAccountKey"].as_str().unwrap(), body["accountKeys"]["encryptedVek"].as_str().unwrap(), &kek).unwrap();
@@ -366,8 +366,8 @@ fn schema_rebuild_of_a_stale_vault_pushes_without_touching_the_key_hierarchy() {
host.state.insert(state::SERVER_MANIFEST_REVISIONS.to_string(), json!({ PERSONAL_MANIFEST_ID: 3 }));
host.state.insert(state::VAULT_PERSONAL_MANIFEST_ID.to_string(), json!(PERSONAL_MANIFEST_ID));
host.state.insert(state::VAULT_MANIFEST_SALT.to_string(), json!(vault_codec::generate_manifest_salt()));
- host.respond("POST", "v2/Vault/blobs/missing", json!({ "missing": [] }));
- host.respond("POST", "v2/Vault", json!({ "status": 0, "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "bucketRevisions": [], "missingBlobHashes": [] }));
+ host.respond("POST", "Vault/blobs/missing", json!({ "missing": [] }));
+ host.respond("POST", "Vault", json!({ "status": 0, "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "bucketRevisions": [], "missingBlobHashes": [] }));
let status = host.drive(&SyncSession::new(&request("migrationStatus", &vek, false, 0)).unwrap());
assert_eq!(status["kind"], "schema-rebuild");
@@ -378,8 +378,8 @@ fn schema_rebuild_of_a_stale_vault_pushes_without_touching_the_key_hierarchy() {
assert_eq!(result["pushed"], true);
assert_eq!(latest_migration_id(&host.local), current_stamp, "the local vault is rebuilt onto the current schema");
assert_eq!(item_names(&host.local), vec!["Kept item"]);
- assert!(host.requests_to("v2/VaultKey/Password").is_empty(), "a migrated account is not probed for a key hierarchy");
- let posts: Vec<_> = host.requests_to("v2/Vault").into_iter().filter(|r| r.method == "POST").collect();
+ assert!(host.requests_to("VaultKey/Password").is_empty(), "a migrated account is not probed for a key hierarchy");
+ let posts: Vec<_> = host.requests_to("Vault").into_iter().filter(|r| r.method == "POST").collect();
assert!(posts[0].body.as_ref().unwrap()["accountKeys"].is_null(), "no key hierarchy is minted");
assert!(result["sessionUpdates"]["encryptionKey"].is_null(), "the session key stays the VEK");
}
@@ -405,10 +405,10 @@ fn pre_format_session_host(kek: &str, local_item: &str, server_item: &str) -> Te
host.store_local_as_blob();
let server_db = test_host::open_schema_db(&host.schema_sql);
insert_item(&server_db, "aaaaaaaa-0000-4000-8000-000000000002", server_item, PERSONAL_MANIFEST_ID);
- host.respond("GET", "v2/Vault", legacy_snapshot_of(&server_db, kek, 3));
- host.respond_with(Box::new(|method, path, _| if method == "GET" && path == "v2/VaultKey/Password" { Some((200, json!({ "vaultKey": null }))) } else { None }));
- host.respond("POST", "v2/Vault/blobs/missing", json!({ "missing": [] }));
- host.respond("POST", "v2/Vault", json!({ "status": 0, "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "bucketRevisions": [], "missingBlobHashes": [] }));
+ host.respond("GET", "Vault", legacy_snapshot_of(&server_db, kek, 3));
+ host.respond_with(Box::new(|method, path, _| if method == "GET" && path == "VaultKey/Password" { Some((200, json!({ "vaultKey": null }))) } else { None }));
+ host.respond("POST", "Vault/blobs/missing", json!({ "missing": [] }));
+ host.respond("POST", "Vault", json!({ "status": 0, "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "bucketRevisions": [], "missingBlobHashes": [] }));
host
}
@@ -421,10 +421,10 @@ fn manifest_migration_of_a_pre_format_session_pulls_the_server_vault_first() {
assert_eq!(result["success"], true, "{}", result);
assert_eq!(result["pushed"], true);
- assert_eq!(host.requests_to("v2/Vault").iter().filter(|r| r.method == "GET").count(), 1, "the baseline is pulled once");
+ assert_eq!(host.requests_to("Vault").iter().filter(|r| r.method == "GET").count(), 1, "the baseline is pulled once");
assert_eq!(host.state[state::VAULT_PERSONAL_MANIFEST_ID], PERSONAL_MANIFEST_ID);
assert_eq!(item_names(&host.local), vec!["Server item"], "a clean local vault is replaced by the server's, like a login does");
- let posts: Vec<_> = host.requests_to("v2/Vault").into_iter().filter(|r| r.method == "POST").collect();
+ let posts: Vec<_> = host.requests_to("Vault").into_iter().filter(|r| r.method == "POST").collect();
let body = posts[0].body.as_ref().unwrap();
assert_eq!(body["manifests"][0]["currentRevision"], 3, "the migration push names the revision the server holds");
assert!(body["accountKeys"]["encryptedAccountKey"].is_string());
@@ -443,7 +443,7 @@ fn manifest_migration_of_a_dirty_pre_format_session_keeps_the_local_vault() {
assert_eq!(result["pushed"], true);
assert_eq!(host.state[state::VAULT_PERSONAL_MANIFEST_ID], PERSONAL_MANIFEST_ID);
assert_eq!(item_names(&host.local), vec!["Local item"], "pending local changes are not thrown away");
- let posts: Vec<_> = host.requests_to("v2/Vault").into_iter().filter(|r| r.method == "POST").collect();
+ let posts: Vec<_> = host.requests_to("Vault").into_iter().filter(|r| r.method == "POST").collect();
let body = posts[0].body.as_ref().unwrap();
assert_eq!(body["manifests"][0]["currentRevision"], 3, "the baseline still comes from the server");
let manifest_json = crypto::symmetric_decrypt_bytes(&crate::encoding::base64_decode(body["manifests"][0]["manifestBlob"].as_str().unwrap()).unwrap(), result["sessionUpdates"]["encryptionKey"].as_str().unwrap()).unwrap();
@@ -459,7 +459,7 @@ fn session_reports_when_a_response_is_missing() {
session.resume("{}").unwrap();
let second: Value = serde_json::from_str(&session.next_command().unwrap()).unwrap();
assert_eq!(second["kind"], "http");
- assert_eq!(second["path"], "v2/Status");
+ assert_eq!(second["path"], "Status");
}
#[test]
@@ -475,7 +475,7 @@ fn status_check_reports_newer_server_state_without_touching_the_vault() {
let vek = crypto::generate_key_base64();
let mut host = TestHost::new(&vek);
host.state.insert(state::SERVER_MANIFEST_REVISIONS.to_string(), json!({ PERSONAL_MANIFEST_ID: 3 }));
- host.respond("GET", "v2/Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
+ host.respond("GET", "Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
let result = host.drive(&SyncSession::new(&request("statusCheck", &vek, true, 2)).unwrap());
@@ -484,7 +484,7 @@ fn status_check_reports_newer_server_state_without_touching_the_vault() {
assert_eq!(result["hasDirtyChanges"], true);
assert_eq!(result["isOffline"], false);
assert!(host.store_calls.is_empty());
- assert!(host.requests.iter().all(|r| r.path == "v2/Status"));
+ assert!(host.requests.iter().all(|r| r.path == "Status"));
}
/// The `GET v2/VaultKey/Password` answer for a hierarchy the server holds.
@@ -506,9 +506,9 @@ fn a_hierarchy_created_on_another_device_is_adopted_on_the_next_pull() {
let server_db = test_host::open_schema_db(&host.schema_sql);
insert_item(&server_db, "aaaaaaaa-0000-4000-8000-000000000001", "Server item", PERSONAL_MANIFEST_ID);
let (status, vault) = snapshot_of(&server_db, &vek, 7, &vault_codec::generate_manifest_salt());
- host.respond("GET", "v2/Status", status);
- host.respond("GET", "v2/VaultKey/Password", vault_key_body(&hierarchy));
- host.respond("GET", "v2/Vault", vault);
+ host.respond("GET", "Status", status);
+ host.respond("GET", "VaultKey/Password", vault_key_body(&hierarchy));
+ host.respond("GET", "Vault", vault);
let result = host.drive(&SyncSession::new(&request("fullSync", &kek, false, 0)).unwrap());
@@ -529,7 +529,7 @@ fn resolve_vault_key_opens_the_chain_from_the_server() {
let kek = crypto::generate_key_base64();
let hierarchy = crypto::create_account_key_hierarchy(&kek).unwrap();
let mut host = TestHost::new(&kek);
- host.respond("GET", "v2/VaultKey/Password", vault_key_body(&hierarchy));
+ host.respond("GET", "VaultKey/Password", vault_key_body(&hierarchy));
let result = host.drive(&SyncSession::new(&request("resolveVaultKey", &kek, false, 0)).unwrap());
@@ -548,7 +548,7 @@ fn resolve_vault_key_keeps_the_kek_for_a_legacy_account() {
let kek = crypto::generate_key_base64();
let mut host = TestHost::new(&kek);
host.state.insert(state::ENCRYPTED_ACCOUNT_KEY.to_string(), json!("stale"));
- host.respond("GET", "v2/VaultKey/Password", json!({ "vaultKey": null }));
+ host.respond("GET", "VaultKey/Password", json!({ "vaultKey": null }));
let result = host.drive(&SyncSession::new(&request("resolveVaultKey", &kek, false, 0)).unwrap());
@@ -581,7 +581,7 @@ fn resolve_vault_key_refuses_a_key_that_does_not_open_the_chain() {
let hierarchy = crypto::create_account_key_hierarchy(&crypto::generate_key_base64()).unwrap();
let wrong_kek = crypto::generate_key_base64();
let mut host = TestHost::new(&wrong_kek);
- host.respond("GET", "v2/VaultKey/Password", vault_key_body(&hierarchy));
+ host.respond("GET", "VaultKey/Password", vault_key_body(&hierarchy));
let result = host.drive(&SyncSession::new(&request("resolveVaultKey", &wrong_kek, false, 0)).unwrap());
@@ -602,12 +602,12 @@ fn a_kek_session_on_a_migrated_device_is_not_upgraded_by_the_sync() {
host.state.insert(state::ENCRYPTED_ACCOUNT_KEY.to_string(), json!(hierarchy.account_keys.encrypted_account_key));
host.state.insert(state::ENCRYPTED_VEK.to_string(), json!(hierarchy.account_keys.encrypted_vek));
host.state.insert(state::SERVER_MANIFEST_REVISIONS.to_string(), json!({ PERSONAL_MANIFEST_ID: 3 }));
- host.respond("GET", "v2/Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
+ host.respond("GET", "Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
let result = host.drive(&SyncSession::new(&request("fullSync", &kek, false, 0)).unwrap());
assert!(result["sessionUpdates"].get("encryptionKey").is_none());
- assert!(host.requests_to("v2/VaultKey/Password").is_empty(), "a device with a cached chain is never probed");
+ assert!(host.requests_to("VaultKey/Password").is_empty(), "a device with a cached chain is never probed");
}
/// The VEK itself opens nothing in the chain and stands as the session key.
@@ -621,7 +621,7 @@ fn a_vek_session_key_is_left_alone() {
host.state.insert(state::ENCRYPTED_ACCOUNT_KEY.to_string(), json!(hierarchy.account_keys.encrypted_account_key));
host.state.insert(state::ENCRYPTED_VEK.to_string(), json!(hierarchy.account_keys.encrypted_vek));
host.state.insert(state::SERVER_MANIFEST_REVISIONS.to_string(), json!({ PERSONAL_MANIFEST_ID: 3 }));
- host.respond("GET", "v2/Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 3 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
+ host.respond("GET", "Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 3 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
let result = host.drive(&SyncSession::new(&request("fullSync", &vek, false, 0)).unwrap());
@@ -638,12 +638,12 @@ fn clean_legacy_account_in_sync_is_not_probed_for_a_vault_key() {
host.store_local_as_blob();
host.state.insert(state::SERVER_MANIFEST_REVISIONS.to_string(), json!({ PERSONAL_MANIFEST_ID: 3 }));
host.state.insert(state::VAULT_PERSONAL_MANIFEST_ID.to_string(), json!(PERSONAL_MANIFEST_ID));
- host.respond("GET", "v2/Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 3 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
+ host.respond("GET", "Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 3 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
let result = host.drive(&SyncSession::new(&request("fullSync", &kek, false, 0)).unwrap());
assert_eq!(result["success"], true, "{}", result);
- assert!(host.requests_to("v2/VaultKey/Password").is_empty());
+ assert!(host.requests_to("VaultKey/Password").is_empty());
}
/// A dirty legacy account probes the server for a vault key once per run, not once per step.
@@ -657,14 +657,14 @@ fn dirty_legacy_account_probes_for_a_vault_key_once_per_run() {
host.state.insert(state::SERVER_MANIFEST_REVISIONS.to_string(), json!({ PERSONAL_MANIFEST_ID: 3 }));
host.state.insert(state::VAULT_PERSONAL_MANIFEST_ID.to_string(), json!(PERSONAL_MANIFEST_ID));
host.state.insert(state::VAULT_MANIFEST_SALT.to_string(), json!(salt));
- host.respond("GET", "v2/Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 3 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
- host.respond("GET", "v2/VaultKey/Password", json!({ "vaultKey": null }));
- host.respond("POST", "v2/Vault/blobs/missing", json!({ "missing": [] }));
- host.respond("POST", "v2/Vault", json!({ "status": 0, "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "bucketRevisions": [], "missingBlobHashes": [] }));
+ host.respond("GET", "Status", json!({ "clientVersionSupported": true, "serverVersion": "0.31.0", "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 3 }], "personalManifestId": PERSONAL_MANIFEST_ID, "srpSalt": "salt" }));
+ host.respond("GET", "VaultKey/Password", json!({ "vaultKey": null }));
+ host.respond("POST", "Vault/blobs/missing", json!({ "missing": [] }));
+ host.respond("POST", "Vault", json!({ "status": 0, "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "bucketRevisions": [], "missingBlobHashes": [] }));
let result = host.drive(&SyncSession::new(&request("fullSync", &kek, true, 1)).unwrap());
assert_eq!(result["success"], true, "{}", result);
- assert_eq!(host.requests_to("v2/VaultKey/Password").len(), 1);
+ assert_eq!(host.requests_to("VaultKey/Password").len(), 1);
}