Skip to content

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

Update models (#2159)

Leendert de Borst888695a3d74d
diff --git a/apps/browser-extension/src/utils/PendingActionProcessor.ts b/apps/browser-extension/src/utils/PendingActionProcessor.ts
index d49e8865b..7e29c5b97 100644
--- a/apps/browser-extension/src/utils/PendingActionProcessor.ts
+++ b/apps/browser-extension/src/utils/PendingActionProcessor.ts
@@ -1,5 +1,5 @@
import { devLog, devWarn } from '@/utils/devLogger/DevLogger';
-import type { StatusResponseV2 } from '@/utils/dist/core/models/webapi';
+import type { PendingClientAction, StatusResponseV2 } from '@/utils/dist/core/models/webapi';
import { SharingService } from '@/utils/SharingService';
import type { SqliteClient } from '@/utils/SqliteClient';
import type { WebApiService } from '@/utils/WebApiService';
@@ -8,14 +8,6 @@ import type { WebApiService } from '@/utils/WebApiService';
* Carries out work the server hands this client with the status response.
*/
-/** One piece of work the server is asking this client to carry out. */
-export type PendingClientAction = {
- id: string;
- type: string;
- manifestId?: string | null;
- payload?: string | null;
-};
-
/**
* The action types this build knows how to carry out. The tokens are the server's `ClientActionType` names.
*/
@@ -35,7 +27,7 @@ export class PendingActionProcessor {
* @param status - the status response of the sync in progress.
*/
public static pendingActions(status: StatusResponseV2): PendingClientAction[] {
- return (status as StatusResponseV2 & { pendingActions?: PendingClientAction[] }).pendingActions ?? [];
+ return status.pendingActions ?? [];
}
/**
diff --git a/apps/browser-extension/src/utils/WebApiService.ts b/apps/browser-extension/src/utils/WebApiService.ts
index d611e5f58..1abf9c321 100644
--- a/apps/browser-extension/src/utils/WebApiService.ts
+++ b/apps/browser-extension/src/utils/WebApiService.ts
@@ -27,6 +27,14 @@ const DEFAULT_REQUEST_TIMEOUT_MS = 5000;
*/
const VAULT_TRANSFER_TIMEOUT_MS = 180000;
+/**
+ * Path prefix whose requests carry vault ciphertext and therefore run on {@link VAULT_TRANSFER_TIMEOUT_MS}:
+ * `Vault` itself and every subpath of it, which includes the single-manifest fetch and the batched blob
+ * upload/download calls that run to several MB per request. Matched lowercased and unslashed, so sibling
+ * endpoints such as `VaultKey` keep the short timeout.
+ */
+const LARGE_TRANSFER_PATH = 'vault';
+
/**
* Type for the token response from the API.
*/
@@ -201,7 +209,7 @@ export class WebApiService {
*/
private buildTimeoutSignal(endpoint: string, headers: Headers, callerSignal?: AbortSignal | null): AbortSignal {
const path = endpoint.split('?')[0].replace(/^\/+|\/+$/g, '').toLowerCase();
- const isLargeTransfer = path === 'vault' ||
+ const isLargeTransfer = path === LARGE_TRANSFER_PATH || path.startsWith(`${LARGE_TRANSFER_PATH}/`) ||
(headers.get('Accept') ?? '').toLowerCase().includes('application/octet-stream');
const timeoutSignal = AbortSignal.timeout(
isLargeTransfer ? VAULT_TRANSFER_TIMEOUT_MS : DEFAULT_REQUEST_TIMEOUT_MS
diff --git a/apps/browser-extension/src/utils/dist/core/models/webapi/index.d.ts b/apps/browser-extension/src/utils/dist/core/models/webapi/index.d.ts
index bc4a7203d..18951f9ce 100644
--- a/apps/browser-extension/src/utils/dist/core/models/webapi/index.d.ts
+++ b/apps/browser-extension/src/utils/dist/core/models/webapi/index.d.ts
@@ -75,6 +75,24 @@ type ManifestRevision = {
manifestId: string;
revision: number;
};
+/**
+ * The latest revision of a single data bucket, addressed by the manifest that owns it and its category.
+ */
+type BucketRevision = {
+ manifestId: string;
+ category: string;
+ revision: number;
+};
+/**
+ * A piece of work the server needs this client to carry out, because it needs something only a client holds
+ * (vault content, a vault key, a private key).
+ */
+type PendingClientAction = {
+ id: string;
+ type: string;
+ manifestId?: string | null;
+ payload?: string | null;
+};
/**
* Status response type (v2).
*/
@@ -85,6 +103,8 @@ type StatusResponseV2 = {
personalManifestId: string | null;
srpSalt: string;
capabilities?: Record<string, string>;
+ bucketRevisions?: BucketRevision[];
+ pendingActions?: PendingClientAction[];
};
/**
@@ -674,4 +694,4 @@ type CapabilityKey = typeof CapabilityKeys[keyof typeof CapabilityKeys];
*/
declare function isCapabilityEnabled(value: string | undefined): boolean;
-export { type ApiErrorResponse, AuthEventType, type AuthLogModel, type BadRequestResponse, type CapabilityKey, CapabilityKeys, type CreateSharedManifestRequest, type CreateSharedManifestResponse, type DeleteAccountInitiateRequest, type DeleteAccountInitiateResponse, type DeleteAccountRequest, type DeleteSharedManifestInitiateResponse, type DeleteSharedManifestRequest, type Email, type EmailAttachment, type EmailDecryptionKey, type FaviconExtractModel, type GrantManifestAccessRequest, type GrantManifestAccessResponse, type GroupInfo, type GroupMemberInfo, type GroupOverviewResponse, type GroupRole, type LoginRequest, type LoginResponse, type MailboxBulkRequest, type MailboxBulkResponse, type MailboxEmail, type ManifestGrant, ManifestKeyType, type ManifestKeyTypeValue, type ManifestRevision, type MobileLoginInitiateRequest, type MobileLoginInitiateResponse, type MobileLoginPollResponse, type MobileLoginSubmitRequest, type PasswordChangeInitiateResponse, type ReceivedManifestInvitation, type RefreshToken, type SentManifestInvitation, type SharedManifestInfo, type StatusResponse, type StatusResponseV2, type TokenModel, UnlockMethodType, type UnlockMethodTypeValue, type ValidateLoginRequest, type ValidateLoginRequest2Fa, type ValidateLoginResponse, type Vault, VaultKeyAlgorithm, type VaultKeyAlgorithmValue, type VaultKeyGetResponse, type VaultKeyResponse, type VaultPasswordChangeRequest, type VaultPostResponse, type VaultResponse, isCapabilityEnabled };
+export { type ApiErrorResponse, AuthEventType, type AuthLogModel, type BadRequestResponse, type BucketRevision, type CapabilityKey, CapabilityKeys, type CreateSharedManifestRequest, type CreateSharedManifestResponse, type DeleteAccountInitiateRequest, type DeleteAccountInitiateResponse, type DeleteAccountRequest, type DeleteSharedManifestInitiateResponse, type DeleteSharedManifestRequest, type Email, type EmailAttachment, type EmailDecryptionKey, type FaviconExtractModel, type GrantManifestAccessRequest, type GrantManifestAccessResponse, type GroupInfo, type GroupMemberInfo, type GroupOverviewResponse, type GroupRole, type LoginRequest, type LoginResponse, type MailboxBulkRequest, type MailboxBulkResponse, type MailboxEmail, type ManifestGrant, ManifestKeyType, type ManifestKeyTypeValue, type ManifestRevision, type MobileLoginInitiateRequest, type MobileLoginInitiateResponse, type MobileLoginPollResponse, type MobileLoginSubmitRequest, type PasswordChangeInitiateResponse, type PendingClientAction, type ReceivedManifestInvitation, type RefreshToken, type SentManifestInvitation, type SharedManifestInfo, type StatusResponse, type StatusResponseV2, type TokenModel, UnlockMethodType, type UnlockMethodTypeValue, type ValidateLoginRequest, type ValidateLoginRequest2Fa, type ValidateLoginResponse, type Vault, VaultKeyAlgorithm, type VaultKeyAlgorithmValue, type VaultKeyGetResponse, type VaultKeyResponse, type VaultPasswordChangeRequest, type VaultPostResponse, type VaultResponse, isCapabilityEnabled };
diff --git a/apps/mobile-app/utils/dist/core/models/webapi/index.d.ts b/apps/mobile-app/utils/dist/core/models/webapi/index.d.ts
index bc4a7203d..18951f9ce 100644
--- a/apps/mobile-app/utils/dist/core/models/webapi/index.d.ts
+++ b/apps/mobile-app/utils/dist/core/models/webapi/index.d.ts
@@ -75,6 +75,24 @@ type ManifestRevision = {
manifestId: string;
revision: number;
};
+/**
+ * The latest revision of a single data bucket, addressed by the manifest that owns it and its category.
+ */
+type BucketRevision = {
+ manifestId: string;
+ category: string;
+ revision: number;
+};
+/**
+ * A piece of work the server needs this client to carry out, because it needs something only a client holds
+ * (vault content, a vault key, a private key).
+ */
+type PendingClientAction = {
+ id: string;
+ type: string;
+ manifestId?: string | null;
+ payload?: string | null;
+};
/**
* Status response type (v2).
*/
@@ -85,6 +103,8 @@ type StatusResponseV2 = {
personalManifestId: string | null;
srpSalt: string;
capabilities?: Record<string, string>;
+ bucketRevisions?: BucketRevision[];
+ pendingActions?: PendingClientAction[];
};
/**
@@ -674,4 +694,4 @@ type CapabilityKey = typeof CapabilityKeys[keyof typeof CapabilityKeys];
*/
declare function isCapabilityEnabled(value: string | undefined): boolean;
-export { type ApiErrorResponse, AuthEventType, type AuthLogModel, type BadRequestResponse, type CapabilityKey, CapabilityKeys, type CreateSharedManifestRequest, type CreateSharedManifestResponse, type DeleteAccountInitiateRequest, type DeleteAccountInitiateResponse, type DeleteAccountRequest, type DeleteSharedManifestInitiateResponse, type DeleteSharedManifestRequest, type Email, type EmailAttachment, type EmailDecryptionKey, type FaviconExtractModel, type GrantManifestAccessRequest, type GrantManifestAccessResponse, type GroupInfo, type GroupMemberInfo, type GroupOverviewResponse, type GroupRole, type LoginRequest, type LoginResponse, type MailboxBulkRequest, type MailboxBulkResponse, type MailboxEmail, type ManifestGrant, ManifestKeyType, type ManifestKeyTypeValue, type ManifestRevision, type MobileLoginInitiateRequest, type MobileLoginInitiateResponse, type MobileLoginPollResponse, type MobileLoginSubmitRequest, type PasswordChangeInitiateResponse, type ReceivedManifestInvitation, type RefreshToken, type SentManifestInvitation, type SharedManifestInfo, type StatusResponse, type StatusResponseV2, type TokenModel, UnlockMethodType, type UnlockMethodTypeValue, type ValidateLoginRequest, type ValidateLoginRequest2Fa, type ValidateLoginResponse, type Vault, VaultKeyAlgorithm, type VaultKeyAlgorithmValue, type VaultKeyGetResponse, type VaultKeyResponse, type VaultPasswordChangeRequest, type VaultPostResponse, type VaultResponse, isCapabilityEnabled };
+export { type ApiErrorResponse, AuthEventType, type AuthLogModel, type BadRequestResponse, type BucketRevision, type CapabilityKey, CapabilityKeys, type CreateSharedManifestRequest, type CreateSharedManifestResponse, type DeleteAccountInitiateRequest, type DeleteAccountInitiateResponse, type DeleteAccountRequest, type DeleteSharedManifestInitiateResponse, type DeleteSharedManifestRequest, type Email, type EmailAttachment, type EmailDecryptionKey, type FaviconExtractModel, type GrantManifestAccessRequest, type GrantManifestAccessResponse, type GroupInfo, type GroupMemberInfo, type GroupOverviewResponse, type GroupRole, type LoginRequest, type LoginResponse, type MailboxBulkRequest, type MailboxBulkResponse, type MailboxEmail, type ManifestGrant, ManifestKeyType, type ManifestKeyTypeValue, type ManifestRevision, type MobileLoginInitiateRequest, type MobileLoginInitiateResponse, type MobileLoginPollResponse, type MobileLoginSubmitRequest, type PasswordChangeInitiateResponse, type PendingClientAction, type ReceivedManifestInvitation, type RefreshToken, type SentManifestInvitation, type SharedManifestInfo, type StatusResponse, type StatusResponseV2, type TokenModel, UnlockMethodType, type UnlockMethodTypeValue, type ValidateLoginRequest, type ValidateLoginRequest2Fa, type ValidateLoginResponse, type Vault, VaultKeyAlgorithm, type VaultKeyAlgorithmValue, type VaultKeyGetResponse, type VaultKeyResponse, type VaultPasswordChangeRequest, type VaultPostResponse, type VaultResponse, isCapabilityEnabled };
diff --git a/core/models/src/webapi/StatusResponseV2.ts b/core/models/src/webapi/StatusResponseV2.ts
index a8b7220b9..729d0000b 100644
--- a/core/models/src/webapi/StatusResponseV2.ts
+++ b/core/models/src/webapi/StatusResponseV2.ts
@@ -6,6 +6,26 @@ export type ManifestRevision = {
revision: number;
}
+/**
+ * The latest revision of a single data bucket, addressed by the manifest that owns it and its category.
+ */
+export type BucketRevision = {
+ manifestId: string;
+ category: string;
+ revision: number;
+}
+
+/**
+ * A piece of work the server needs this client to carry out, because it needs something only a client holds
+ * (vault content, a vault key, a private key).
+ */
+export type PendingClientAction = {
+ id: string;
+ type: string;
+ manifestId?: string | null;
+ payload?: string | null;
+}
+
/**
* Status response type (v2).
*/
@@ -16,4 +36,6 @@ export type StatusResponseV2 = {
personalManifestId: string | null;
srpSalt: string;
capabilities?: Record<string, string>;
+ bucketRevisions?: BucketRevision[];
+ pendingActions?: PendingClientAction[];
}