Skip to content

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

Update models build (#900)

Leendert de Borstaba377ac6514
diff --git a/apps/browser-extension/src/utils/shared/models/index.d.mts b/apps/browser-extension/src/utils/shared/models/index.d.mts
deleted file mode 100644
index da562a555..000000000
--- a/apps/browser-extension/src/utils/shared/models/index.d.mts
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 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;
-};
-
-export type { VaultResponse };
diff --git a/apps/browser-extension/src/utils/shared/models/index.d.ts b/apps/browser-extension/src/utils/shared/models/index.d.ts
new file mode 100644
index 000000000..92234656a
--- /dev/null
+++ b/apps/browser-extension/src/utils/shared/models/index.d.ts
@@ -0,0 +1,302 @@
+/**
+ * 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;
+};
+
+export type { Attachment, AuthLogModel, DeleteAccountInitiateRequest, DeleteAccountInitiateResponse, DeleteAccountRequest, Email, FaviconExtractModel, LoginRequest, LoginResponse, MailboxBulkRequest, MailboxBulkResponse, MailboxEmail, PasswordChangeInitiateResponse, RefreshToken, StatusResponse, ValidateLoginRequest, ValidateLoginRequest2Fa, ValidateLoginResponse, Vault, VaultPasswordChangeRequest, VaultPostResponse, VaultResponse };
diff --git a/apps/browser-extension/src/utils/shared/models/index.js b/apps/browser-extension/src/utils/shared/models/index.js
new file mode 100644
index 000000000..a41e52c7b
--- /dev/null
+++ b/apps/browser-extension/src/utils/shared/models/index.js
@@ -0,0 +1,3 @@
+
+//# sourceMappingURL=index.js.map
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/apps/browser-extension/src/utils/shared/models/index.mjs b/apps/browser-extension/src/utils/shared/models/index.mjs
deleted file mode 100644
index dcbf9aae6..000000000
--- a/apps/browser-extension/src/utils/shared/models/index.mjs
+++ /dev/null
@@ -1,4 +0,0 @@
-// <auto-generated>
-// This file was automatically generated. Do not edit manually.
-
-//# sourceMappingURL=index.mjs.map
\ No newline at end of file
diff --git a/shared/models/build.sh b/shared/models/build.sh
index 1c797390d..2f69283e2 100755
--- a/shared/models/build.sh
+++ b/shared/models/build.sh
@@ -16,7 +16,7 @@ echo "📦 Building $package_name..."
npm install && npm run lint && npm run build
dist_path="dist"
-files_to_copy=("index.d.mts" "index.mjs")
+files_to_copy=("index.d.ts" "index.js" "index.js.map")
for target in "${TARGETS[@]}"; do
echo "📂 Copying $package_name → $target"
diff --git a/shared/models/package.json b/shared/models/package.json
index 647bc7626..3d26ecb7d 100644
--- a/shared/models/package.json
+++ b/shared/models/package.json
@@ -1,8 +1,9 @@
{
"name": "@aliasvault/models",
"version": "1.0.0",
- "main": "dist/index.js",
- "types": "dist/index.d.ts",
+ "type": "module",
+ "main": "dist/index.mjs",
+ "types": "dist/index.d.mts",
"scripts": {
"build": "tsup",
"clean": "rm -rf dist",
diff --git a/shared/models/src/index.ts b/shared/models/src/index.ts
index 8b9b9b587..3fcb2b95f 100644
--- a/shared/models/src/index.ts
+++ b/shared/models/src/index.ts
@@ -1 +1,18 @@
+// 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';
diff --git a/shared/models/tsconfig.json b/shared/models/tsconfig.json
index 2cf9d1e86..030ed8b9c 100644
--- a/shared/models/tsconfig.json
+++ b/shared/models/tsconfig.json
@@ -12,7 +12,8 @@
"esModuleInterop": true,
"isolatedModules": true,
"forceConsistentCasingInFileNames": true,
- "baseUrl": "."
+ "baseUrl": ".",
+ "skipLibCheck": true,
},
- "include": ["src/**/*.ts"]
+ "include": ["src/**/*"]
}
\ No newline at end of file
diff --git a/shared/models/tsup.config.ts b/shared/models/tsup.config.ts
index bfe9757ee..f8ca19cc4 100644
--- a/shared/models/tsup.config.ts
+++ b/shared/models/tsup.config.ts
@@ -3,12 +3,13 @@ import { defineConfig } from 'tsup';
export default defineConfig({
entry: ['src/index.ts'],
format: ['esm'],
- target: 'es2020',
dts: true,
- clean: true,
splitting: false,
- minify: false,
sourcemap: true,
+ clean: true,
+ treeshake: true,
+ target: 'es2020',
+ minify: false,
banner: {
js: '// <auto-generated>\n// This file was automatically generated. Do not edit manually.\n',
}