Skip to content

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

Refactor shared models to subdir structure (#900)

Leendert de Borst3576b3282177
diff --git a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
index 2e4683d05..29598238c 100644
--- a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
+++ b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
@@ -2,7 +2,7 @@
import { storage } from 'wxt/utils/storage';
import { EncryptionUtility } from '@/utils/EncryptionUtility';
-import type { Vault, VaultResponse, VaultPostResponse } from '@/utils/shared/models';
+import type { Vault, VaultResponse, VaultPostResponse } from '@/utils/shared/models/webapi';
import { SqliteClient } from '@/utils/SqliteClient';
import { BoolResponse as messageBoolResponse } from '@/utils/types/messaging/BoolResponse';
import { CredentialsResponse as messageCredentialsResponse } from '@/utils/types/messaging/CredentialsResponse';
diff --git a/apps/browser-extension/src/entrypoints/popup/components/EmailPreview.tsx b/apps/browser-extension/src/entrypoints/popup/components/EmailPreview.tsx
index 9e4d4e120..bb1cad4f4 100644
--- a/apps/browser-extension/src/entrypoints/popup/components/EmailPreview.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/components/EmailPreview.tsx
@@ -6,7 +6,7 @@ import { useWebApi } from '@/entrypoints/popup/context/WebApiContext';
import { AppInfo } from '@/utils/AppInfo';
import { EncryptionUtility } from '@/utils/EncryptionUtility';
-import type { MailboxEmail } from '@/utils/shared/models';
+import type { MailboxEmail } from '@/utils/shared/models/webapi';
import { storage } from '#imports';
diff --git a/apps/browser-extension/src/entrypoints/popup/context/DbContext.tsx b/apps/browser-extension/src/entrypoints/popup/context/DbContext.tsx
index e8703a1a3..3754d2917 100644
--- a/apps/browser-extension/src/entrypoints/popup/context/DbContext.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/context/DbContext.tsx
@@ -2,7 +2,7 @@ import React, { createContext, useContext, useState, useEffect, useCallback, use
import { sendMessage } from 'webext-bridge/popup';
import EncryptionUtility from '@/utils/EncryptionUtility';
-import type { VaultResponse } from '@/utils/shared/models';
+import type { VaultResponse } from '@/utils/shared/models/webapi';
import SqliteClient from '@/utils/SqliteClient';
import { VaultResponse as messageVaultResponse } from '@/utils/types/messaging/VaultResponse';
diff --git a/apps/browser-extension/src/entrypoints/popup/hooks/useVaultSync.ts b/apps/browser-extension/src/entrypoints/popup/hooks/useVaultSync.ts
index 7ca7f860c..ff16435b7 100644
--- a/apps/browser-extension/src/entrypoints/popup/hooks/useVaultSync.ts
+++ b/apps/browser-extension/src/entrypoints/popup/hooks/useVaultSync.ts
@@ -5,7 +5,7 @@ import { useDb } from '@/entrypoints/popup/context/DbContext';
import { useWebApi } from '@/entrypoints/popup/context/WebApiContext';
import { AppInfo } from '@/utils/AppInfo';
-import type { VaultResponse } from '@/utils/shared/models';
+import type { VaultResponse } from '@/utils/shared/models/webapi';
/**
* Utility function to ensure a minimum time has elapsed for an operation
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx b/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx
index 5e7552ec8..290c9c67c 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx
@@ -8,7 +8,7 @@ import { useDb } from '@/entrypoints/popup/context/DbContext';
import { useLoading } from '@/entrypoints/popup/context/LoadingContext';
import { useWebApi } from '@/entrypoints/popup/context/WebApiContext';
-import type { VaultResponse } from '@/utils/shared/models';
+import type { VaultResponse } from '@/utils/shared/models/webapi';
import { Credential } from '@/utils/types/Credential';
import { useMinDurationLoading } from '@/hooks/useMinDurationLoading';
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/EmailDetails.tsx b/apps/browser-extension/src/entrypoints/popup/pages/EmailDetails.tsx
index e3771634c..dcc88283a 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/EmailDetails.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/EmailDetails.tsx
@@ -8,7 +8,7 @@ import { useWebApi } from '@/entrypoints/popup/context/WebApiContext';
import ConversionUtility from '@/entrypoints/popup/utils/ConversionUtility';
import EncryptionUtility from '@/utils/EncryptionUtility';
-import type { Attachment, Email } from '@/utils/shared/models';
+import type { Attachment, Email } from '@/utils/shared/models/webapi';
import { useMinDurationLoading } from '@/hooks/useMinDurationLoading';
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/EmailsList.tsx b/apps/browser-extension/src/entrypoints/popup/pages/EmailsList.tsx
index 73acc99c2..8252382b2 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/EmailsList.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/EmailsList.tsx
@@ -7,7 +7,7 @@ import { useDb } from '@/entrypoints/popup/context/DbContext';
import { useWebApi } from '@/entrypoints/popup/context/WebApiContext';
import EncryptionUtility from '@/utils/EncryptionUtility';
-import type { MailboxBulkRequest, MailboxBulkResponse, MailboxEmail } from '@/utils/shared/models';
+import type { MailboxBulkRequest, MailboxBulkResponse, MailboxEmail } from '@/utils/shared/models/webapi';
import { useMinDurationLoading } from '@/hooks/useMinDurationLoading';
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/Login.tsx b/apps/browser-extension/src/entrypoints/popup/pages/Login.tsx
index 46149eaad..ebb2ed107 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/Login.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/Login.tsx
@@ -12,7 +12,7 @@ import SrpUtility from '@/entrypoints/popup/utils/SrpUtility';
import { AppInfo } from '@/utils/AppInfo';
import EncryptionUtility from '@/utils/EncryptionUtility';
-import type { VaultResponse, LoginResponse } from '@/utils/shared/models';
+import type { VaultResponse, LoginResponse } from '@/utils/shared/models/webapi';
import { ApiAuthError } from '@/utils/types/errors/ApiAuthError';
import ConversionUtility from '../utils/ConversionUtility';
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/Unlock.tsx b/apps/browser-extension/src/entrypoints/popup/pages/Unlock.tsx
index 644b8f69f..73d6eb512 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/Unlock.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/Unlock.tsx
@@ -12,7 +12,7 @@ import SrpUtility from '@/entrypoints/popup/utils/SrpUtility';
import { VAULT_LOCKED_DISMISS_UNTIL_KEY } from '@/utils/Constants';
import EncryptionUtility from '@/utils/EncryptionUtility';
-import type { VaultResponse } from '@/utils/shared/models';
+import type { VaultResponse } from '@/utils/shared/models/webapi';
import { storage } from '#imports';
diff --git a/apps/browser-extension/src/entrypoints/popup/utils/SrpUtility.ts b/apps/browser-extension/src/entrypoints/popup/utils/SrpUtility.ts
index 7d169ad30..80b518d0e 100644
--- a/apps/browser-extension/src/entrypoints/popup/utils/SrpUtility.ts
+++ b/apps/browser-extension/src/entrypoints/popup/utils/SrpUtility.ts
@@ -1,6 +1,6 @@
import srp from 'secure-remote-password/client'
-import type { LoginRequest, LoginResponse, ValidateLoginRequest, ValidateLoginRequest2Fa, ValidateLoginResponse, BadRequestResponse } from '@/utils/shared/models';
+import type { LoginRequest, LoginResponse, ValidateLoginRequest, ValidateLoginRequest2Fa, ValidateLoginResponse, BadRequestResponse } from '@/utils/shared/models/webapi';
import { ApiAuthError } from '@/utils/types/errors/ApiAuthError';
import { WebApiService } from '@/utils/WebApiService';
diff --git a/apps/browser-extension/src/utils/EncryptionUtility.ts b/apps/browser-extension/src/utils/EncryptionUtility.ts
index 8c976aed8..76a0b0117 100644
--- a/apps/browser-extension/src/utils/EncryptionUtility.ts
+++ b/apps/browser-extension/src/utils/EncryptionUtility.ts
@@ -2,7 +2,7 @@ import { Buffer } from 'buffer';
import argon2 from 'argon2-browser/dist/argon2-bundled.min.js';
-import type { Email, MailboxEmail } from '@/utils/shared/models';
+import type { Email, MailboxEmail } from '@/utils/shared/models/webapi';
import { EncryptionKey } from './types/EncryptionKey';
diff --git a/apps/browser-extension/src/utils/WebApiService.ts b/apps/browser-extension/src/utils/WebApiService.ts
index 038c6fe2c..425a06aa0 100644
--- a/apps/browser-extension/src/utils/WebApiService.ts
+++ b/apps/browser-extension/src/utils/WebApiService.ts
@@ -1,4 +1,4 @@
-import type { StatusResponse, VaultResponse } from '@/utils/shared/models';
+import type { StatusResponse, VaultResponse } from '@/utils/shared/models/webapi';
import { AppInfo } from "./AppInfo";
diff --git a/apps/browser-extension/src/utils/shared/models/index.d.ts b/apps/browser-extension/src/utils/shared/models/index.d.ts
index 475810070..223e65e89 100644
--- a/apps/browser-extension/src/utils/shared/models/index.d.ts
+++ b/apps/browser-extension/src/utils/shared/models/index.d.ts
@@ -1,356 +1,2 @@
-/**
- * Vault type.
- */
-type Vault = {
- blob: string;
- createdAt: string;
- credentialsCount: number;
- currentRevisionNumber: number;
- emailAddressList: string[];
- privateEmailDomainList: string[];
- publicEmailDomainList: string[];
- encryptionPublicKey: string;
- updatedAt: string;
- username: string;
- version: string;
- client: string;
-};
-/**
- * Vault response type.
- */
-type VaultResponse = {
- status: number;
- vault: Vault;
-};
-
-/**
- * Vault post response type returned after uploading a new vault to the server.
- */
-type VaultPostResponse = {
- status: number;
- newRevisionNumber: number;
-};
-
-/**
- * Status response type.
- */
-type StatusResponse = {
- clientVersionSupported: boolean;
- serverVersion: string;
- vaultRevision: number;
-};
-
-/**
- * Login request type.
- */
-type LoginRequest = {
- username: string;
-};
-/**
- * Login response type.
- */
-type LoginResponse = {
- salt: string;
- serverEphemeral: string;
- encryptionType: string;
- encryptionSettings: string;
-};
-
-/**
- * Validate login request type.
- */
-type ValidateLoginRequest = {
- username: string;
- rememberMe: boolean;
- clientPublicEphemeral: string;
- clientSessionProof: string;
-};
-/**
- * Validate login request type for 2FA.
- */
-type ValidateLoginRequest2Fa = {
- username: string;
- code2Fa: number;
- rememberMe: boolean;
- clientPublicEphemeral: string;
- clientSessionProof: string;
-};
-/**
- * Validate login response type.
- */
-type ValidateLoginResponse = {
- requiresTwoFactor: boolean;
- token?: {
- token: string;
- refreshToken: string;
- };
- serverSessionProof: string;
-};
-
-type MailboxEmail = {
- /** The preview of the email message */
- messagePreview: string;
- /** Indicates whether the email has attachments */
- hasAttachments: boolean;
- /** The ID of the email */
- id: number;
- /** The subject of the email */
- subject: string;
- /** The display name of the sender */
- fromDisplay: string;
- /** The domain of the sender's email address */
- fromDomain: string;
- /** The local part of the sender's email address */
- fromLocal: string;
- /** The domain of the recipient's email address */
- toDomain: string;
- /** The local part of the recipient's email address */
- toLocal: string;
- /** The date of the email */
- date: string;
- /** The system date of the email */
- dateSystem: string;
- /** The number of seconds ago the email was received */
- secondsAgo: number;
- /**
- * The encrypted symmetric key which was used to encrypt the email message.
- * This key is encrypted with the public key of the user.
- */
- encryptedSymmetricKey: string;
- /** The public key of the user used to encrypt the symmetric key */
- encryptionKey: string;
-};
-
-/**
- * Mailbox bulk request type.
- */
-type MailboxBulkRequest = {
- addresses: string[];
- page: number;
- pageSize: number;
-};
-/**
- * Mailbox bulk response type.
- */
-type MailboxBulkResponse = {
- addresses: string[];
- currentPage: number;
- pageSize: number;
- totalRecords: number;
- mails: MailboxEmail[];
-};
-
-/**
- * Email attachment type.
- */
-type Attachment = {
- /** The ID of the attachment */
- id: number;
- /** The ID of the email the attachment belongs to */
- emailId: number;
- /** The filename of the attachment */
- filename: string;
- /** The MIME type of the attachment */
- mimeType: string;
- /** The size of the attachment in bytes */
- filesize: number;
-};
-
-type Email = {
- /** The body of the email message */
- messageHtml: string;
- /** The plain text body of the email message */
- messagePlain: string;
- /** The ID of the email */
- id: number;
- /** The subject of the email */
- subject: string;
- /** The display name of the sender */
- fromDisplay: string;
- /** The domain of the sender's email address */
- fromDomain: string;
- /** The local part of the sender's email address */
- fromLocal: string;
- /** The domain of the recipient's email address */
- toDomain: string;
- /** The local part of the recipient's email address */
- toLocal: string;
- /** The date of the email */
- date: string;
- /** The system date of the email */
- dateSystem: string;
- /** The number of seconds ago the email was received */
- secondsAgo: number;
- /**
- * The encrypted symmetric key which was used to encrypt the email message.
- * This key is encrypted with the public key of the user.
- */
- encryptedSymmetricKey: string;
- /** The public key of the user used to encrypt the symmetric key */
- encryptionKey: string;
- /** The attachments of the email */
- attachments: Attachment[];
-};
-
-/**
- * Auth Log model.
- */
-type AuthLogModel = {
- /**
- * Gets or sets the primary key for the auth log entry.
- */
- id: number;
- /**
- * Gets or sets the timestamp of the auth log entry.
- */
- timestamp: string;
- /**
- * Gets or sets the type of authentication event.
- */
- eventType: number;
- /**
- * Gets or sets the username associated with the auth log entry.
- */
- username: string;
- /**
- * Gets or sets the IP address from which the authentication attempt was made.
- */
- ipAddress: string;
- /**
- * Gets or sets the user agent string of the device used for the authentication attempt.
- */
- userAgent: string;
- /**
- * Gets or sets the client application name and version.
- */
- client: string;
- /**
- * Gets or sets a value indicating whether the authentication attempt was successful.
- */
- isSuccess: boolean;
-};
-
-type RefreshToken = {
- /**
- * Gets or sets the unique identifier for the refresh token.
- */
- id: string;
- /**
- * Gets or sets the device identifier associated with the refresh token.
- */
- deviceIdentifier: string;
- /**
- * Gets or sets the expiration date of the refresh token.
- */
- expireDate: string;
- /**
- * Gets or sets the creation date of the refresh token.
- */
- createdAt: string;
-};
-
-type FaviconExtractModel = {
- image: string | null;
-};
-
-/**
- * Represents a delete account initiate response.
- */
-type DeleteAccountInitiateRequest = {
- username: string;
-};
-/**
- * Represents a delete account initiate response.
- */
-type DeleteAccountInitiateResponse = {
- salt: string;
- serverEphemeral: string;
- encryptionType: string;
- encryptionSettings: string;
-};
-
-/**
- * Represents a delete account request.
- */
-type DeleteAccountRequest = {
- username: string;
- clientPublicEphemeral: string;
- clientSessionProof: string;
-};
-
-/**
- * Represents a password change initiate response.
- */
-type PasswordChangeInitiateResponse = {
- salt: string;
- serverEphemeral: string;
- encryptionType: string;
- encryptionSettings: string;
-};
-
-/**
- * Represents a request to change the users password including a new vault that is encrypted with the new password.
- */
-type VaultPasswordChangeRequest = Vault & {
- currentClientPublicEphemeral: string;
- currentClientSessionProof: string;
- newPasswordSalt: string;
- newPasswordVerifier: string;
-};
-
-type BadRequestResponse = {
- type: string;
- title: string;
- status: number;
- errors: Record<string, string[]>;
- traceId: string;
-};
-
-/**
- * Represents the type of authentication event.
- */
-declare enum AuthEventType {
- /**
- * Represents a standard login attempt.
- */
- Login = 1,
- /**
- * Represents a two-factor authentication attempt.
- */
- TwoFactorAuthentication = 2,
- /**
- * Represents a user logout event.
- */
- Logout = 3,
- /**
- * Represents JWT access token refresh event issued by client to API.
- */
- TokenRefresh = 10,
- /**
- * Represents a password reset event.
- */
- PasswordReset = 20,
- /**
- * Represents a password change event.
- */
- PasswordChange = 21,
- /**
- * Represents enabling two-factor authentication in settings.
- */
- TwoFactorAuthEnable = 22,
- /**
- * Represents disabling two-factor authentication in settings.
- */
- TwoFactorAuthDisable = 23,
- /**
- * Represents a user registration event.
- */
- Register = 30,
- /**
- * Represents a user account deletion event.
- */
- AccountDeletion = 99
-}
-
-export { type Attachment, AuthEventType, type AuthLogModel, type BadRequestResponse, type DeleteAccountInitiateRequest, type DeleteAccountInitiateResponse, type DeleteAccountRequest, type Email, type FaviconExtractModel, type LoginRequest, type LoginResponse, type MailboxBulkRequest, type MailboxBulkResponse, type MailboxEmail, type PasswordChangeInitiateResponse, type RefreshToken, type StatusResponse, type ValidateLoginRequest, type ValidateLoginRequest2Fa, type ValidateLoginResponse, type Vault, type VaultPasswordChangeRequest, type VaultPostResponse, type VaultResponse };
+export { }
diff --git a/apps/browser-extension/src/utils/shared/models/index.js b/apps/browser-extension/src/utils/shared/models/index.js
index 501fdc30b..a41e52c7b 100644
--- a/apps/browser-extension/src/utils/shared/models/index.js
+++ b/apps/browser-extension/src/utils/shared/models/index.js
@@ -1,22 +1,3 @@
-// <auto-generated>
-// This file was automatically generated. Do not edit manually.
-
-// src/webapi/AuthEventType.ts
-var AuthEventType = /* @__PURE__ */ ((AuthEventType2) => {
- AuthEventType2[AuthEventType2["Login"] = 1] = "Login";
- AuthEventType2[AuthEventType2["TwoFactorAuthentication"] = 2] = "TwoFactorAuthentication";
- AuthEventType2[AuthEventType2["Logout"] = 3] = "Logout";
- AuthEventType2[AuthEventType2["TokenRefresh"] = 10] = "TokenRefresh";
- AuthEventType2[AuthEventType2["PasswordReset"] = 20] = "PasswordReset";
- AuthEventType2[AuthEventType2["PasswordChange"] = 21] = "PasswordChange";
- AuthEventType2[AuthEventType2["TwoFactorAuthEnable"] = 22] = "TwoFactorAuthEnable";
- AuthEventType2[AuthEventType2["TwoFactorAuthDisable"] = 23] = "TwoFactorAuthDisable";
- AuthEventType2[AuthEventType2["Register"] = 30] = "Register";
- AuthEventType2[AuthEventType2["AccountDeletion"] = 99] = "AccountDeletion";
- return AuthEventType2;
-})(AuthEventType || {});
-
-export { AuthEventType };
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/apps/browser-extension/src/utils/shared/models/vault/index.d.ts b/apps/browser-extension/src/utils/shared/models/vault/index.d.ts
new file mode 100644
index 000000000..5693b65b4
--- /dev/null
+++ b/apps/browser-extension/src/utils/shared/models/vault/index.d.ts
@@ -0,0 +1,80 @@
+/**
+ * Encryption key SQLite database type.
+ */
+type EncryptionKey = {
+ Id: string;
+ PublicKey: string;
+ PrivateKey: string;
+ IsPrimary: boolean;
+};
+
+/**
+ * Settings for password generation stored in SQLite database settings table as string.
+ */
+type PasswordSettings = {
+ /**
+ * The length of the password.
+ */
+ Length: number;
+ /**
+ * Whether to use lowercase letters.
+ */
+ UseLowercase: boolean;
+ /**
+ * Whether to use uppercase letters.
+ */
+ UseUppercase: boolean;
+ /**
+ * Whether to use numbers.
+ */
+ UseNumbers: boolean;
+ /**
+ * Whether to use special characters.
+ */
+ UseSpecialChars: boolean;
+ /**
+ * Whether to use non-ambiguous characters.
+ */
+ UseNonAmbiguousChars: boolean;
+};
+
+/**
+ * TotpCode SQLite database type.
+ */
+type TotpCode = {
+ /** The ID of the TOTP code */
+ Id: string;
+ /** The name of the TOTP code */
+ Name: string;
+ /** The secret key for the TOTP code */
+ SecretKey: string;
+ /** The credential ID this TOTP code belongs to */
+ CredentialId: string;
+};
+
+/**
+ * Credential SQLite database type.
+ */
+type Credential = {
+ Id: string;
+ Username?: string;
+ Password: string;
+ ServiceName: string;
+ ServiceUrl?: string;
+ Logo?: Uint8Array | number[];
+ Notes?: string;
+ Alias: Alias;
+};
+/**
+ * Alias SQLite database type.
+ */
+type Alias = {
+ FirstName?: string;
+ LastName?: string;
+ NickName?: string;
+ BirthDate: string;
+ Gender?: string;
+ Email?: string;
+};
+
+export type { Alias, Credential, EncryptionKey, PasswordSettings, TotpCode };
diff --git a/apps/browser-extension/src/utils/shared/models/vault/index.js b/apps/browser-extension/src/utils/shared/models/vault/index.js
new file mode 100644
index 000000000..a41e52c7b
--- /dev/null
+++ b/apps/browser-extension/src/utils/shared/models/vault/index.js
@@ -0,0 +1,3 @@
+
+//# sourceMappingURL=index.js.map
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/apps/mobile-app/utils/shared/models/index.d.ts b/apps/browser-extension/src/utils/shared/models/webapi/index.d.ts
similarity index 100%
rename from apps/mobile-app/utils/shared/models/index.d.ts
rename to apps/browser-extension/src/utils/shared/models/webapi/index.d.ts
diff --git a/apps/mobile-app/utils/shared/models/index.js b/apps/browser-extension/src/utils/shared/models/webapi/index.js
similarity index 100%
rename from apps/mobile-app/utils/shared/models/index.js
rename to apps/browser-extension/src/utils/shared/models/webapi/index.js
diff --git a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx
index c005e44b2..d6b5b7de3 100644
--- a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx
+++ b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx
@@ -10,7 +10,7 @@ import Toast from 'react-native-toast-message';
import emitter from '@/utils/EventEmitter';
import { CreateIdentityGenerator, IdentityHelperUtils, IdentityGenerator } from '@/utils/shared/identity-generator';
-import type { FaviconExtractModel } from '@/utils/shared/models';
+import type { FaviconExtractModel } from '@/utils/shared/models/webapi';
import { CreatePasswordGenerator, PasswordGenerator } from '@/utils/shared/password-generator';
import { Credential } from '@/utils/types/Credential';
import { extractServiceNameFromUrl } from '@/utils/UrlUtility';
diff --git a/apps/mobile-app/app/(tabs)/emails/[id].tsx b/apps/mobile-app/app/(tabs)/emails/[id].tsx
index 9aa4ac201..b3147eb4a 100644
--- a/apps/mobile-app/app/(tabs)/emails/[id].tsx
+++ b/apps/mobile-app/app/(tabs)/emails/[id].tsx
@@ -7,7 +7,7 @@ import { WebView } from 'react-native-webview';
import EncryptionUtility from '@/utils/EncryptionUtility';
import emitter from '@/utils/EventEmitter';
-import type { Email } from '@/utils/shared/models';
+import type { Email } from '@/utils/shared/models/webapi';
import type { Credential } from '@/utils/types/Credential';
import { useColors } from '@/hooks/useColorScheme';
diff --git a/apps/mobile-app/app/(tabs)/emails/index.tsx b/apps/mobile-app/app/(tabs)/emails/index.tsx
index f8961530c..aa47baaca 100644
--- a/apps/mobile-app/app/(tabs)/emails/index.tsx
+++ b/apps/mobile-app/app/(tabs)/emails/index.tsx
@@ -7,7 +7,7 @@ import Toast from 'react-native-toast-message';
import EncryptionUtility from '@/utils/EncryptionUtility';
import emitter from '@/utils/EventEmitter';
-import type { MailboxBulkRequest, MailboxBulkResponse, MailboxEmail } from '@/utils/shared/models';
+import type { MailboxBulkRequest, MailboxBulkResponse, MailboxEmail } from '@/utils/shared/models/webapi';
import { useColors } from '@/hooks/useColorScheme';
import { useMinDurationLoading } from '@/hooks/useMinDurationLoading';
diff --git a/apps/mobile-app/app/(tabs)/settings/security/active-sessions.tsx b/apps/mobile-app/app/(tabs)/settings/security/active-sessions.tsx
index 3349e7032..1273b6def 100644
--- a/apps/mobile-app/app/(tabs)/settings/security/active-sessions.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/security/active-sessions.tsx
@@ -3,7 +3,7 @@ import { useState, useEffect, useCallback } from 'react';
import { StyleSheet, View, TouchableOpacity, Alert, RefreshControl, Platform } from 'react-native';
import Toast from 'react-native-toast-message';
-import type { RefreshToken } from '@/utils/shared/models';
+import type { RefreshToken } from '@/utils/shared/models/webapi';
import { useColors } from '@/hooks/useColorScheme';
import { useMinDurationLoading } from '@/hooks/useMinDurationLoading';
diff --git a/apps/mobile-app/app/(tabs)/settings/security/auth-logs.tsx b/apps/mobile-app/app/(tabs)/settings/security/auth-logs.tsx
index 156f04041..5f4379360 100644
--- a/apps/mobile-app/app/(tabs)/settings/security/auth-logs.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/security/auth-logs.tsx
@@ -3,8 +3,8 @@ import { useState, useEffect, useCallback } from 'react';
import { StyleSheet, View, RefreshControl, Platform } from 'react-native';
import Toast from 'react-native-toast-message';
-import type { AuthLogModel } from '@/utils/shared/models';
-import { AuthEventType } from '@/utils/shared/models';
+import type { AuthLogModel } from '@/utils/shared/models/webapi';
+import { AuthEventType } from '@/utils/shared/models/webapi';
import { useColors } from '@/hooks/useColorScheme';
import { useMinDurationLoading } from '@/hooks/useMinDurationLoading';
diff --git a/apps/mobile-app/app/(tabs)/settings/security/delete-account.tsx b/apps/mobile-app/app/(tabs)/settings/security/delete-account.tsx
index faa727cab..fc2344aa9 100644
--- a/apps/mobile-app/app/(tabs)/settings/security/delete-account.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/security/delete-account.tsx
@@ -3,7 +3,7 @@ import { useState } from 'react';
import { StyleSheet, View, Alert, KeyboardAvoidingView, Platform } from 'react-native';
import srp from 'secure-remote-password/client';
-import type { DeleteAccountInitiateRequest, DeleteAccountInitiateResponse, DeleteAccountRequest } from '@/utils/shared/models';
+import type { DeleteAccountInitiateRequest, DeleteAccountInitiateResponse, DeleteAccountRequest } from '@/utils/shared/models/webapi';
import { useColors } from '@/hooks/useColorScheme';
diff --git a/apps/mobile-app/app/login.tsx b/apps/mobile-app/app/login.tsx
index 4f288125a..f92c0df28 100644
--- a/apps/mobile-app/app/login.tsx
+++ b/apps/mobile-app/app/login.tsx
@@ -11,7 +11,7 @@ import { StyleSheet, View, Text, SafeAreaView, TextInput, TouchableOpacity, Acti
import { AppInfo } from '@/utils/AppInfo';
import ConversionUtility from '@/utils/ConversionUtility';
import EncryptionUtility from '@/utils/EncryptionUtility';
-import type { LoginResponse, VaultResponse } from '@/utils/shared/models';
+import type { LoginResponse, VaultResponse } from '@/utils/shared/models/webapi';
import { SrpUtility } from '@/utils/SrpUtility';
import { ApiAuthError } from '@/utils/types/errors/ApiAuthError';
import { EncryptionKeyDerivationParams } from '@/utils/types/messaging/EncryptionKeyDerivationParams';
diff --git a/apps/mobile-app/components/EmailCard.tsx b/apps/mobile-app/components/EmailCard.tsx
index fdcac3a12..e7478e0c7 100644
--- a/apps/mobile-app/components/EmailCard.tsx
+++ b/apps/mobile-app/components/EmailCard.tsx
@@ -2,7 +2,7 @@ import { router } from 'expo-router';
import { useEffect, useState } from 'react';
import { StyleSheet, View, TouchableOpacity } from 'react-native';
-import type { MailboxEmail } from '@/utils/shared/models';
+import type { MailboxEmail } from '@/utils/shared/models/webapi';
import { Credential } from '@/utils/types/Credential';
import { useColors } from '@/hooks/useColorScheme';
diff --git a/apps/mobile-app/components/credentials/details/EmailPreview.tsx b/apps/mobile-app/components/credentials/details/EmailPreview.tsx
index 5d5bc499e..0f8915379 100644
--- a/apps/mobile-app/components/credentials/details/EmailPreview.tsx
+++ b/apps/mobile-app/components/credentials/details/EmailPreview.tsx
@@ -5,7 +5,7 @@ import { View, StyleSheet, TouchableOpacity, Linking, AppState } from 'react-nat
import { AppInfo } from '@/utils/AppInfo';
import EncryptionUtility from '@/utils/EncryptionUtility';
-import type { MailboxBulkRequest, MailboxBulkResponse, MailboxEmail } from '@/utils/shared/models';
+import type { MailboxBulkRequest, MailboxBulkResponse, MailboxEmail } from '@/utils/shared/models/webapi';
import { useColors } from '@/hooks/useColorScheme';
diff --git a/apps/mobile-app/context/DbContext.tsx b/apps/mobile-app/context/DbContext.tsx
index 6648e72b3..509f13a1f 100644
--- a/apps/mobile-app/context/DbContext.tsx
+++ b/apps/mobile-app/context/DbContext.tsx
@@ -1,6 +1,6 @@
import React, { createContext, useContext, useState, useEffect, useCallback, useMemo } from 'react';
-import type { VaultResponse } from '@/utils/shared/models';
+import type { VaultResponse } from '@/utils/shared/models/webapi';
import SqliteClient from '@/utils/SqliteClient';
import { EncryptionKeyDerivationParams } from '@/utils/types/messaging/EncryptionKeyDerivationParams';
import { VaultMetadata } from '@/utils/types/messaging/VaultMetadata';
diff --git a/apps/mobile-app/hooks/useVaultMutate.ts b/apps/mobile-app/hooks/useVaultMutate.ts
index f5180153f..bc79b1dcc 100644
--- a/apps/mobile-app/hooks/useVaultMutate.ts
+++ b/apps/mobile-app/hooks/useVaultMutate.ts
@@ -3,7 +3,7 @@ import Toast from 'react-native-toast-message';
import srp from 'secure-remote-password/client';
import EncryptionUtility from '@/utils/EncryptionUtility';
-import type { PasswordChangeInitiateResponse, Vault, VaultPasswordChangeRequest } from '@/utils/shared/models';
+import type { PasswordChangeInitiateResponse, Vault, VaultPasswordChangeRequest } from '@/utils/shared/models/webapi';
import { EncryptionKeyDerivationParams } from '@/utils/types/messaging/EncryptionKeyDerivationParams';
import { useVaultSync } from '@/hooks/useVaultSync';
diff --git a/apps/mobile-app/hooks/useVaultSync.ts b/apps/mobile-app/hooks/useVaultSync.ts
index ed00aac2d..225cda13c 100644
--- a/apps/mobile-app/hooks/useVaultSync.ts
+++ b/apps/mobile-app/hooks/useVaultSync.ts
@@ -1,7 +1,7 @@
import { useCallback } from 'react';
import { AppInfo } from '@/utils/AppInfo';
-import type { VaultResponse } from '@/utils/shared/models';
+import type { VaultResponse } from '@/utils/shared/models/webapi';
import { useAuth } from '@/context/AuthContext';
import { useDb } from '@/context/DbContext';
diff --git a/apps/mobile-app/utils/EncryptionUtility.tsx b/apps/mobile-app/utils/EncryptionUtility.tsx
index 0fc6f0a32..53308c3f4 100644
--- a/apps/mobile-app/utils/EncryptionUtility.tsx
+++ b/apps/mobile-app/utils/EncryptionUtility.tsx
@@ -3,7 +3,7 @@ import { Buffer } from 'buffer';
import AesGcmCrypto from 'react-native-aes-gcm-crypto';
import argon2 from 'react-native-argon2';
-import type { Email, MailboxEmail } from '@/utils/shared/models';
+import type { Email, MailboxEmail } from '@/utils/shared/models/webapi';
import { EncryptionKey } from './types/EncryptionKey';
diff --git a/apps/mobile-app/utils/SrpUtility.tsx b/apps/mobile-app/utils/SrpUtility.tsx
index 24f39defd..4304e37fb 100644
--- a/apps/mobile-app/utils/SrpUtility.tsx
+++ b/apps/mobile-app/utils/SrpUtility.tsx
@@ -1,6 +1,6 @@
import srp from 'secure-remote-password/client';
-import type { BadRequestResponse, LoginResponse, ValidateLoginRequest2Fa, ValidateLoginResponse } from '@/utils/shared/models';
+import type { BadRequestResponse, LoginResponse, ValidateLoginRequest2Fa, ValidateLoginResponse } from '@/utils/shared/models/webapi';
import { ApiAuthError } from '@/utils/types/errors/ApiAuthError';
import { WebApiService } from '@/utils/WebApiService';
diff --git a/apps/mobile-app/utils/WebApiService.ts b/apps/mobile-app/utils/WebApiService.ts
index 4a9167304..5e19d31eb 100644
--- a/apps/mobile-app/utils/WebApiService.ts
+++ b/apps/mobile-app/utils/WebApiService.ts
@@ -1,7 +1,7 @@
import AsyncStorage from '@react-native-async-storage/async-storage';
import { AppInfo } from '@/utils/AppInfo';
-import type { StatusResponse, VaultResponse, AuthLogModel, RefreshToken } from '@/utils/shared/models';
+import type { StatusResponse, VaultResponse, AuthLogModel, RefreshToken } from '@/utils/shared/models/webapi';
type RequestInit = globalThis.RequestInit;
diff --git a/apps/mobile-app/utils/shared/models/vault/index.d.ts b/apps/mobile-app/utils/shared/models/vault/index.d.ts
new file mode 100644
index 000000000..5693b65b4
--- /dev/null
+++ b/apps/mobile-app/utils/shared/models/vault/index.d.ts
@@ -0,0 +1,80 @@
+/**
+ * Encryption key SQLite database type.
+ */
+type EncryptionKey = {
+ Id: string;
+ PublicKey: string;
+ PrivateKey: string;
+ IsPrimary: boolean;
+};
+
+/**
+ * Settings for password generation stored in SQLite database settings table as string.
+ */
+type PasswordSettings = {
+ /**
+ * The length of the password.
+ */
+ Length: number;
+ /**
+ * Whether to use lowercase letters.
+ */
+ UseLowercase: boolean;
+ /**
+ * Whether to use uppercase letters.
+ */
+ UseUppercase: boolean;
+ /**
+ * Whether to use numbers.
+ */
+ UseNumbers: boolean;
+ /**
+ * Whether to use special characters.
+ */
+ UseSpecialChars: boolean;
+ /**
+ * Whether to use non-ambiguous characters.
+ */
+ UseNonAmbiguousChars: boolean;
+};
+
+/**
+ * TotpCode SQLite database type.
+ */
+type TotpCode = {
+ /** The ID of the TOTP code */
+ Id: string;
+ /** The name of the TOTP code */
+ Name: string;
+ /** The secret key for the TOTP code */
+ SecretKey: string;
+ /** The credential ID this TOTP code belongs to */
+ CredentialId: string;
+};
+
+/**
+ * Credential SQLite database type.
+ */
+type Credential = {
+ Id: string;
+ Username?: string;
+ Password: string;
+ ServiceName: string;
+ ServiceUrl?: string;
+ Logo?: Uint8Array | number[];
+ Notes?: string;
+ Alias: Alias;
+};
+/**
+ * Alias SQLite database type.
+ */
+type Alias = {
+ FirstName?: string;
+ LastName?: string;
+ NickName?: string;
+ BirthDate: string;
+ Gender?: string;
+ Email?: string;
+};
+
+export type { Alias, Credential, EncryptionKey, PasswordSettings, TotpCode };
diff --git a/apps/mobile-app/utils/shared/models/vault/index.js b/apps/mobile-app/utils/shared/models/vault/index.js
new file mode 100644
index 000000000..a41e52c7b
--- /dev/null
+++ b/apps/mobile-app/utils/shared/models/vault/index.js
@@ -0,0 +1,3 @@
+
+//# sourceMappingURL=index.js.map
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/apps/mobile-app/utils/shared/models/webapi/index.d.ts b/apps/mobile-app/utils/shared/models/webapi/index.d.ts
new file mode 100644
index 000000000..475810070
--- /dev/null
+++ b/apps/mobile-app/utils/shared/models/webapi/index.d.ts
@@ -0,0 +1,356 @@
+/**
+ * Vault type.
+ */
+type Vault = {
+ blob: string;
+ createdAt: string;
+ credentialsCount: number;
+ currentRevisionNumber: number;
+ emailAddressList: string[];
+ privateEmailDomainList: string[];
+ publicEmailDomainList: string[];
+ encryptionPublicKey: string;
+ updatedAt: string;
+ username: string;
+ version: string;
+ client: string;
+};
+
+/**
+ * Vault response type.
+ */
+type VaultResponse = {
+ status: number;
+ vault: Vault;
+};
+
+/**
+ * Vault post response type returned after uploading a new vault to the server.
+ */
+type VaultPostResponse = {
+ status: number;
+ newRevisionNumber: number;
+};
+
+/**
+ * Status response type.
+ */
+type StatusResponse = {
+ clientVersionSupported: boolean;
+ serverVersion: string;
+ vaultRevision: number;
+};
+
+/**
+ * Login request type.
+ */
+type LoginRequest = {
+ username: string;
+};
+/**
+ * Login response type.
+ */
+type LoginResponse = {
+ salt: string;
+ serverEphemeral: string;
+ encryptionType: string;
+ encryptionSettings: string;
+};
+
+/**
+ * Validate login request type.
+ */
+type ValidateLoginRequest = {
+ username: string;
+ rememberMe: boolean;
+ clientPublicEphemeral: string;
+ clientSessionProof: string;
+};
+/**
+ * Validate login request type for 2FA.
+ */
+type ValidateLoginRequest2Fa = {
+ username: string;
+ code2Fa: number;
+ rememberMe: boolean;
+ clientPublicEphemeral: string;
+ clientSessionProof: string;
+};
+/**
+ * Validate login response type.
+ */
+type ValidateLoginResponse = {
+ requiresTwoFactor: boolean;
+ token?: {
+ token: string;
+ refreshToken: string;
+ };
+ serverSessionProof: string;
+};
+
+type MailboxEmail = {
+ /** The preview of the email message */
+ messagePreview: string;
+ /** Indicates whether the email has attachments */
+ hasAttachments: boolean;
+ /** The ID of the email */
+ id: number;
+ /** The subject of the email */
+ subject: string;
+ /** The display name of the sender */
+ fromDisplay: string;
+ /** The domain of the sender's email address */
+ fromDomain: string;
+ /** The local part of the sender's email address */
+ fromLocal: string;
+ /** The domain of the recipient's email address */
+ toDomain: string;
+ /** The local part of the recipient's email address */
+ toLocal: string;
+ /** The date of the email */
+ date: string;
+ /** The system date of the email */
+ dateSystem: string;
+ /** The number of seconds ago the email was received */
+ secondsAgo: number;
+ /**
+ * The encrypted symmetric key which was used to encrypt the email message.
+ * This key is encrypted with the public key of the user.
+ */
+ encryptedSymmetricKey: string;
+ /** The public key of the user used to encrypt the symmetric key */
+ encryptionKey: string;
+};
+
+/**
+ * Mailbox bulk request type.
+ */
+type MailboxBulkRequest = {
+ addresses: string[];
+ page: number;
+ pageSize: number;
+};
+/**
+ * Mailbox bulk response type.
+ */
+type MailboxBulkResponse = {
+ addresses: string[];
+ currentPage: number;
+ pageSize: number;
+ totalRecords: number;
+ mails: MailboxEmail[];
+};
+
+/**
+ * Email attachment type.
+ */
+type Attachment = {
+ /** The ID of the attachment */
+ id: number;
+ /** The ID of the email the attachment belongs to */
+ emailId: number;
+ /** The filename of the attachment */
+ filename: string;
+ /** The MIME type of the attachment */
+ mimeType: string;
+ /** The size of the attachment in bytes */
+ filesize: number;
+};
+
+type Email = {
+ /** The body of the email message */
+ messageHtml: string;
+ /** The plain text body of the email message */
+ messagePlain: string;
+ /** The ID of the email */
+ id: number;
+ /** The subject of the email */
+ subject: string;
+ /** The display name of the sender */
+ fromDisplay: string;
+ /** The domain of the sender's email address */
+ fromDomain: string;
+ /** The local part of the sender's email address */
+ fromLocal: string;
+ /** The domain of the recipient's email address */
+ toDomain: string;
+ /** The local part of the recipient's email address */
+ toLocal: string;
+ /** The date of the email */
+ date: string;
+ /** The system date of the email */
+ dateSystem: string;
+ /** The number of seconds ago the email was received */
+ secondsAgo: number;
+ /**
+ * The encrypted symmetric key which was used to encrypt the email message.
+ * This key is encrypted with the public key of the user.
+ */
+ encryptedSymmetricKey: string;
+ /** The public key of the user used to encrypt the symmetric key */
+ encryptionKey: string;
+ /** The attachments of the email */
+ attachments: Attachment[];
+};
+
+/**
+ * Auth Log model.
+ */
+type AuthLogModel = {
+ /**
+ * Gets or sets the primary key for the auth log entry.
+ */
+ id: number;
+ /**
+ * Gets or sets the timestamp of the auth log entry.
+ */
+ timestamp: string;
+ /**
+ * Gets or sets the type of authentication event.
+ */
+ eventType: number;
+ /**
+ * Gets or sets the username associated with the auth log entry.
+ */
+ username: string;
+ /**
+ * Gets or sets the IP address from which the authentication attempt was made.
+ */
+ ipAddress: string;
+ /**
+ * Gets or sets the user agent string of the device used for the authentication attempt.
+ */
+ userAgent: string;
+ /**
+ * Gets or sets the client application name and version.
+ */
+ client: string;
+ /**
+ * Gets or sets a value indicating whether the authentication attempt was successful.
+ */
+ isSuccess: boolean;
+};
+
+type RefreshToken = {
+ /**
+ * Gets or sets the unique identifier for the refresh token.
+ */
+ id: string;
+ /**
+ * Gets or sets the device identifier associated with the refresh token.
+ */
+ deviceIdentifier: string;
+ /**
+ * Gets or sets the expiration date of the refresh token.
+ */
+ expireDate: string;
+ /**
+ * Gets or sets the creation date of the refresh token.
+ */
+ createdAt: string;
+};
+
+type FaviconExtractModel = {
+ image: string | null;
+};
+
+/**
+ * Represents a delete account initiate response.
+ */
+type DeleteAccountInitiateRequest = {
+ username: string;
+};
+/**
+ * Represents a delete account initiate response.
+ */
+type DeleteAccountInitiateResponse = {
+ salt: string;
+ serverEphemeral: string;
+ encryptionType: string;
+ encryptionSettings: string;
+};
+
+/**
+ * Represents a delete account request.
+ */
+type DeleteAccountRequest = {
+ username: string;
+ clientPublicEphemeral: string;
+ clientSessionProof: string;
+};
+
+/**
+ * Represents a password change initiate response.
+ */
+type PasswordChangeInitiateResponse = {
+ salt: string;
+ serverEphemeral: string;
+ encryptionType: string;
+ encryptionSettings: string;
+};
+
+/**
+ * Represents a request to change the users password including a new vault that is encrypted with the new password.
+ */
+type VaultPasswordChangeRequest = Vault & {
+ currentClientPublicEphemeral: string;
+ currentClientSessionProof: string;
+ newPasswordSalt: string;
+ newPasswordVerifier: string;
+};
+
+type BadRequestResponse = {
+ type: string;
+ title: string;
+ status: number;
+ errors: Record<string, string[]>;
+ traceId: string;
+};
+
+/**
+ * Represents the type of authentication event.
+ */
+declare enum AuthEventType {
+ /**
+ * Represents a standard login attempt.
+ */
+ Login = 1,
+ /**
+ * Represents a two-factor authentication attempt.
+ */
+ TwoFactorAuthentication = 2,
+ /**
+ * Represents a user logout event.
+ */
+ Logout = 3,
+ /**
+ * Represents JWT access token refresh event issued by client to API.
+ */
+ TokenRefresh = 10,
+ /**
+ * Represents a password reset event.
+ */
+ PasswordReset = 20,
+ /**
+ * Represents a password change event.
+ */
+ PasswordChange = 21,
+ /**
+ * Represents enabling two-factor authentication in settings.
+ */
+ TwoFactorAuthEnable = 22,
+ /**
+ * Represents disabling two-factor authentication in settings.
+ */
+ TwoFactorAuthDisable = 23,
+ /**
+ * Represents a user registration event.
+ */
+ Register = 30,
+ /**
+ * Represents a user account deletion event.
+ */
+ AccountDeletion = 99
+}
+
+export { type Attachment, AuthEventType, type AuthLogModel, type BadRequestResponse, type DeleteAccountInitiateRequest, type DeleteAccountInitiateResponse, type DeleteAccountRequest, type Email, type FaviconExtractModel, type LoginRequest, type LoginResponse, type MailboxBulkRequest, type MailboxBulkResponse, type MailboxEmail, type PasswordChangeInitiateResponse, type RefreshToken, type StatusResponse, type ValidateLoginRequest, type ValidateLoginRequest2Fa, type ValidateLoginResponse, type Vault, type VaultPasswordChangeRequest, type VaultPostResponse, type VaultResponse };
diff --git a/apps/mobile-app/utils/shared/models/webapi/index.js b/apps/mobile-app/utils/shared/models/webapi/index.js
new file mode 100644
index 000000000..501fdc30b
--- /dev/null
+++ b/apps/mobile-app/utils/shared/models/webapi/index.js
@@ -0,0 +1,22 @@
+// <auto-generated>
+// This file was automatically generated. Do not edit manually.
+
+
+// src/webapi/AuthEventType.ts
+var AuthEventType = /* @__PURE__ */ ((AuthEventType2) => {
+ AuthEventType2[AuthEventType2["Login"] = 1] = "Login";
+ AuthEventType2[AuthEventType2["TwoFactorAuthentication"] = 2] = "TwoFactorAuthentication";
+ AuthEventType2[AuthEventType2["Logout"] = 3] = "Logout";
+ AuthEventType2[AuthEventType2["TokenRefresh"] = 10] = "TokenRefresh";
+ AuthEventType2[AuthEventType2["PasswordReset"] = 20] = "PasswordReset";
+ AuthEventType2[AuthEventType2["PasswordChange"] = 21] = "PasswordChange";
+ AuthEventType2[AuthEventType2["TwoFactorAuthEnable"] = 22] = "TwoFactorAuthEnable";
+ AuthEventType2[AuthEventType2["TwoFactorAuthDisable"] = 23] = "TwoFactorAuthDisable";
+ AuthEventType2[AuthEventType2["Register"] = 30] = "Register";
+ AuthEventType2[AuthEventType2["AccountDeletion"] = 99] = "AccountDeletion";
+ return AuthEventType2;
+})(AuthEventType || {});
+
+export { AuthEventType };
+//# sourceMappingURL=index.js.map
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/shared/identity-generator/build.sh b/shared/identity-generator/build.sh
index d03c56962..a9b5963cc 100755
--- a/shared/identity-generator/build.sh
+++ b/shared/identity-generator/build.sh
@@ -24,6 +24,9 @@ for target in "${TARGETS[@]}"; do
echo "πŸ“‚ Copying $package_name β†’ $target"
mkdir -p "$target"
+ # Remove any existing files in the target directory
+ rm -rf "$target/*"
+
# Copy specific build outputs
for file in "${files_to_copy[@]}"; do
cp "$dist_path/$file" "$target/"
diff --git a/shared/models/build.sh b/shared/models/build.sh
index ee5ff68b3..ba278abc2 100755
--- a/shared/models/build.sh
+++ b/shared/models/build.sh
@@ -17,15 +17,18 @@ echo "πŸ“¦ Building $package_name..."
npm install && npm run lint && npm run build
dist_path="dist"
-files_to_copy=("index.d.ts" "index.js" "index.js.map")
+files_to_copy=("webapi" "vault")
for target in "${TARGETS[@]}"; do
echo "πŸ“‚ Copying $package_name β†’ $target"
mkdir -p "$target"
- # Copy specific build outputs
+ # Remove any existing files in the target directory
+ rm -rf "$target/*"
+
+ # Copy specific build outputs (files and folders)
for file in "${files_to_copy[@]}"; do
- cp "$dist_path/$file" "$target/"
+ cp -R "$dist_path/$file" "$target/"
done
# Write README
diff --git a/shared/models/src/index.ts b/shared/models/src/index.ts
deleted file mode 100644
index 4fb035a5e..000000000
--- a/shared/models/src/index.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-// Export all types from webapi
-export * from './webapi/VaultResponse';
-export * from './webapi/Vault';
-export * from './webapi/VaultPostResponse';
-export * from './webapi/StatusResponse';
-export * from './webapi/Login';
-export * from './webapi/ValidateLogin';
-export * from './webapi/MailboxBulk';
-export * from './webapi/MailboxEmail';
-export * from './webapi/Email';
-export * from './webapi/Attachment';
-export * from './webapi/AuthLog';
-export * from './webapi/RefreshToken';
-export * from './webapi/FaviconExtractModel';
-export * from './webapi/DeleteAccountInitiate';
-export * from './webapi/DeleteAccountRequest';
-export * from './webapi/PasswordChangeInitiateResponse';
-export * from './webapi/VaultPasswordChangeRequest';
-export * from './webapi/BadRequestResponse';
-export * from './webapi/AuthEventType';
diff --git a/shared/models/src/vault/Credential.ts b/shared/models/src/vault/Credential.ts
new file mode 100644
index 000000000..22a4c15e3
--- /dev/null
+++ b/shared/models/src/vault/Credential.ts
@@ -0,0 +1,25 @@
+/**
+ * Credential SQLite database type.
+ */
+export type Credential = {
+ Id: string;
+ Username?: string;
+ Password: string;
+ ServiceName: string;
+ ServiceUrl?: string;
+ Logo?: Uint8Array | number[];
+ Notes?: string;
+ Alias: Alias;
+}
+
+/**
+ * Alias SQLite database type.
+ */
+export type Alias = {
+ FirstName?: string;
+ LastName?: string;
+ NickName?: string;
+ BirthDate: string;
+ Gender?: string;
+ Email?: string;
+}
\ No newline at end of file
diff --git a/shared/models/src/vault/EncryptionKey.ts b/shared/models/src/vault/EncryptionKey.ts
new file mode 100644
index 000000000..7dc64d603
--- /dev/null
+++ b/shared/models/src/vault/EncryptionKey.ts
@@ -0,0 +1,9 @@
+/**
+ * Encryption key SQLite database type.
+ */
+export type EncryptionKey = {
+ Id: string;
+ PublicKey: string;
+ PrivateKey: string;
+ IsPrimary: boolean;
+}
diff --git a/shared/models/src/vault/PasswordSettings.ts b/shared/models/src/vault/PasswordSettings.ts
new file mode 100644
index 000000000..5d35860ef
--- /dev/null
+++ b/shared/models/src/vault/PasswordSettings.ts
@@ -0,0 +1,34 @@
+/**
+ * Settings for password generation stored in SQLite database settings table as string.
+ */
+export type PasswordSettings = {
+ /**
+ * The length of the password.
+ */
+ Length: number;
+
+ /**
+ * Whether to use lowercase letters.
+ */
+ UseLowercase: boolean;
+
+ /**
+ * Whether to use uppercase letters.
+ */
+ UseUppercase: boolean;
+
+ /**
+ * Whether to use numbers.
+ */
+ UseNumbers: boolean;
+
+ /**
+ * Whether to use special characters.
+ */
+ UseSpecialChars: boolean;
+
+ /**
+ * Whether to use non-ambiguous characters.
+ */
+ UseNonAmbiguousChars: boolean;
+}
diff --git a/shared/models/src/vault/TotpCode.ts b/shared/models/src/vault/TotpCode.ts
new file mode 100644
index 000000000..914948d03
--- /dev/null
+++ b/shared/models/src/vault/TotpCode.ts
@@ -0,0 +1,16 @@
+/**
+ * TotpCode SQLite database type.
+ */
+export type TotpCode = {
+ /** The ID of the TOTP code */
+ Id: string;
+
+ /** The name of the TOTP code */
+ Name: string;
+
+ /** The secret key for the TOTP code */
+ SecretKey: string;
+
+ /** The credential ID this TOTP code belongs to */
+ CredentialId: string;
+}
diff --git a/shared/models/src/vault/index.ts b/shared/models/src/vault/index.ts
new file mode 100644
index 000000000..2320f6873
--- /dev/null
+++ b/shared/models/src/vault/index.ts
@@ -0,0 +1,4 @@
+export * from './EncryptionKey';
+export * from './PasswordSettings';
+export * from './TotpCode';
+export * from './Credential';
diff --git a/shared/models/src/webapi/index.ts b/shared/models/src/webapi/index.ts
new file mode 100644
index 000000000..83d2384cb
--- /dev/null
+++ b/shared/models/src/webapi/index.ts
@@ -0,0 +1,19 @@
+export * from './VaultResponse';
+export * from './Vault';
+export * from './VaultPostResponse';
+export * from './StatusResponse';
+export * from './Login';
+export * from './ValidateLogin';
+export * from './MailboxBulk';
+export * from './MailboxEmail';
+export * from './Email';
+export * from './Attachment';
+export * from './AuthLog';
+export * from './RefreshToken';
+export * from './FaviconExtractModel';
+export * from './DeleteAccountInitiate';
+export * from './DeleteAccountRequest';
+export * from './PasswordChangeInitiateResponse';
+export * from './VaultPasswordChangeRequest';
+export * from './BadRequestResponse';
+export * from './AuthEventType';
diff --git a/shared/models/tsup.config.ts b/shared/models/tsup.config.ts
index f8ca19cc4..108c87d18 100644
--- a/shared/models/tsup.config.ts
+++ b/shared/models/tsup.config.ts
@@ -1,7 +1,7 @@
import { defineConfig } from 'tsup';
export default defineConfig({
- entry: ['src/index.ts'],
+ entry: ['src/**/index.ts'],
format: ['esm'],
dts: true,
splitting: false,
diff --git a/shared/password-generator/build.sh b/shared/password-generator/build.sh
index 02f333333..5de549041 100755
--- a/shared/password-generator/build.sh
+++ b/shared/password-generator/build.sh
@@ -24,6 +24,9 @@ for target in "${TARGETS[@]}"; do
echo "πŸ“‚ Copying $package_name β†’ $target"
mkdir -p "$target"
+ # Remove any existing files in the target directory
+ rm -rf "$target/*"
+
# Copy specific build outputs
for file in "${files_to_copy[@]}"; do
cp "$dist_path/$file" "$target/"