Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update passkey creation and authentication flow for new items structure (#1404)
Leendert de Borst9fc8ce3decff
diff --git a/apps/browser-extension/src/entrypoints/popup/components/Credentials/Details/AttachmentUploader.tsx b/apps/browser-extension/src/entrypoints/popup/components/Credentials/Details/AttachmentUploader.tsxindex e88a7a45a..da3b7e125 100644--- a/apps/browser-extension/src/entrypoints/popup/components/Credentials/Details/AttachmentUploader.tsx+++ b/apps/browser-extension/src/entrypoints/popup/components/Credentials/Details/AttachmentUploader.tsx@@ -40,7 +40,7 @@ const AttachmentUploader: React.FC<AttachmentUploaderProps> = ({Id: crypto.randomUUID(),Filename: file.name,Blob: byteArray,- CredentialId: '', // Will be set when saving credential+ ItemId: '', // Will be set when saving itemCreatedAt: new Date().toISOString(),UpdatedAt: new Date().toISOString(),IsDeleted: false,diff --git a/apps/browser-extension/src/entrypoints/popup/components/Credentials/Details/TotpEditor.tsx b/apps/browser-extension/src/entrypoints/popup/components/Credentials/Details/TotpEditor.tsxindex 2c5328807..39efc5e26 100644--- a/apps/browser-extension/src/entrypoints/popup/components/Credentials/Details/TotpEditor.tsx+++ b/apps/browser-extension/src/entrypoints/popup/components/Credentials/Details/TotpEditor.tsx@@ -125,7 +125,7 @@ const TotpEditor: React.FC<TotpEditorProps> = ({Id: crypto.randomUUID().toUpperCase(),Name: name,SecretKey: secretKey,- CredentialId: '' // Will be set when saving the credential+ ItemId: '' // Will be set when saving the item};// Add to the listdiff --git a/apps/browser-extension/src/entrypoints/popup/pages/credentials/CredentialAddEdit.tsx b/apps/browser-extension/src/entrypoints/popup/pages/credentials/CredentialAddEdit.tsxindex 4c504ad72..7e9e8b87a 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/credentials/CredentialAddEdit.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/credentials/CredentialAddEdit.tsx@@ -598,7 +598,7 @@ const CredentialAddEdit: React.FC = () => {// Delete passkeys if marked for deletionif (passkeyMarkedForDeletion) {- await dbContext.sqliteClient!.deletePasskeysByCredentialId(data.Id);+ await dbContext.sqliteClient!.deletePasskeysByItemId(data.Id);}} else {const credentialId = await dbContext.sqliteClient!.createCredential(data, attachments, totpCodes);diff --git a/apps/browser-extension/src/entrypoints/popup/pages/passkeys/PasskeyCreate.tsx b/apps/browser-extension/src/entrypoints/popup/pages/passkeys/PasskeyCreate.tsxindex 2b995cf47..d0455040e 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/passkeys/PasskeyCreate.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/passkeys/PasskeyCreate.tsx@@ -261,13 +261,13 @@ const PasskeyCreate: React.FC = () => {// Use vault mutation to store both credential and passkeyawait executeVaultMutationAsync(async () => {if (selectedPasskeyToReplace) {- // Replace existing passkey: update the credential and passkey+ // Replace existing passkey: update the item and passkeyconst existingPasskey = dbContext.sqliteClient!.getPasskeyById(selectedPasskeyToReplace);if (existingPasskey) {- // Update the parent credential with new favicon and user-provided display name+ // Update the parent item with new favicon and user-provided display nameawait dbContext.sqliteClient!.updateCredentialById({- Id: existingPasskey.CredentialId,+ Id: existingPasskey.ItemId,ServiceName: displayName,ServiceUrl: request.origin,Username: request.publicKey.user.name,@@ -291,7 +291,7 @@ const PasskeyCreate: React.FC = () => {await dbContext.sqliteClient!.deletePasskeyById(selectedPasskeyToReplace);/**- * Create new passkey with same credential+ * Create new passkey with same item* Convert userId from base64 string to byte array for database storage*/let userHandleBytes: Uint8Array | null = null;@@ -306,7 +306,7 @@ const PasskeyCreate: React.FC = () => {await dbContext.sqliteClient!.createPasskey({Id: newPasskeyGuid,- CredentialId: existingPasskey.CredentialId,+ ItemId: existingPasskey.ItemId,RpId: stored.rpId,UserHandle: userHandleBytes,PublicKey: JSON.stringify(stored.publicKey),@@ -317,8 +317,8 @@ const PasskeyCreate: React.FC = () => {});}} else {- // Create new credential and passkey- const credentialId = await dbContext.sqliteClient!.createCredential(+ // Create new item and passkey+ const itemId = await dbContext.sqliteClient!.createCredential({Id: '',ServiceName: displayName,@@ -340,7 +340,7 @@ const PasskeyCreate: React.FC = () => {);/**- * Create the Passkey linked to the credential+ * Create the Passkey linked to the item* Note: We let the database generate a GUID for Id, which we'll convert to base64url for the RP* Convert userId from base64 string to byte array for database storage*/@@ -356,7 +356,7 @@ const PasskeyCreate: React.FC = () => {await dbContext.sqliteClient!.createPasskey({Id: newPasskeyGuid,- CredentialId: credentialId,+ ItemId: itemId,RpId: stored.rpId,UserHandle: userHandleBytes,PublicKey: JSON.stringify(stored.publicKey),diff --git a/apps/browser-extension/src/utils/SqliteClient.ts b/apps/browser-extension/src/utils/SqliteClient.tsindex 8e0e9a18b..d36a131b3 100644--- a/apps/browser-extension/src/utils/SqliteClient.ts+++ b/apps/browser-extension/src/utils/SqliteClient.ts@@ -863,10 +863,10 @@ export class SqliteClient {}/**- * Create a new credential with associated entities+ * Create a new credential with associated entities (using new field-based schema)* @param credential The credential object to insert* @param attachments The attachments to insert- * @returns The ID of the created credential+ * @returns The ID of the created item*/public async createCredential(credential: Credential, attachments: Attachment[], totpCodes: TotpCode[] = []): Promise<string> {if (!this.db) {@@ -876,10 +876,14 @@ export class SqliteClient {try {this.beginTransaction();- // 1. Insert Service- let logoData = null;- try {- if (credential.Logo) {+ const currentDateTime = dateFormatter.now();+ const itemId = crypto.randomUUID().toUpperCase();++ // 1. Handle Logo - insert into Logos table if provided+ let logoId: string | null = null;+ if (credential.Logo) {+ let logoData = null;+ try {// Handle object-like array conversionif (typeof credential.Logo === 'object' && !ArrayBuffer.isView(credential.Logo)) {const values = Object.values(credential.Logo);@@ -888,82 +892,85 @@ export class SqliteClient {} else if (Array.isArray(credential.Logo) || credential.Logo instanceof ArrayBuffer || credential.Logo instanceof Uint8Array) {logoData = new Uint8Array(credential.Logo);}+ } catch (error) {+ console.warn('Failed to convert logo to Uint8Array:', error);+ logoData = null;+ }++ if (logoData) {+ logoId = crypto.randomUUID().toUpperCase();+ const logoQuery = `+ INSERT INTO Logos (Id, FileData, CreatedAt, UpdatedAt, IsDeleted)+ VALUES (?, ?, ?, ?, ?)`;+ this.executeUpdate(logoQuery, [+ logoId,+ logoData,+ currentDateTime,+ currentDateTime,+ 0+ ]);}- } catch (error) {- console.warn('Failed to convert logo to Uint8Array:', error);- logoData = null;}- const serviceQuery = `- INSERT INTO Services (Id, Name, Url, Logo, CreatedAt, UpdatedAt, IsDeleted)- VALUES (?, ?, ?, ?, ?, ?, ?)`;- const serviceId = crypto.randomUUID().toUpperCase();- const currentDateTime = dateFormatter.now();- this.executeUpdate(serviceQuery, [- serviceId,- credential.ServiceName,- credential.ServiceUrl ?? null,- logoData,- currentDateTime,- currentDateTime,- 0- ]);+ // 2. Insert Item+ const itemQuery = `+ INSERT INTO Items (Id, Name, ItemType, LogoId, FolderId, CreatedAt, UpdatedAt, IsDeleted)+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`;- // 2. Insert Alias- const aliasQuery = `- INSERT INTO Aliases (Id, FirstName, LastName, NickName, BirthDate, Gender, Email, CreatedAt, UpdatedAt, IsDeleted)- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`;- const aliasId = crypto.randomUUID().toUpperCase();- this.executeUpdate(aliasQuery, [- aliasId,- credential.Alias.FirstName ?? null,- credential.Alias.LastName ?? null,- credential.Alias.NickName ?? null,- credential.Alias.BirthDate ?? null,- credential.Alias.Gender ?? null,- credential.Alias.Email ?? null,+ this.executeUpdate(itemQuery, [+ itemId,+ credential.ServiceName ?? null,+ 'Login', // ItemType+ logoId,+ null, // FolderIdcurrentDateTime,currentDateTime,0]);- // 3. Insert Credential- const credentialQuery = `- INSERT INTO Credentials (Id, Username, Notes, ServiceId, AliasId, CreatedAt, UpdatedAt, IsDeleted)- VALUES (?, ?, ?, ?, ?, ?, ?, ?)`;- const credentialId = crypto.randomUUID().toUpperCase();- this.executeUpdate(credentialQuery, [- credentialId,- credential.Username ?? null,- credential.Notes ?? null,- serviceId,- aliasId,- currentDateTime,- currentDateTime,- 0- ]);+ // 3. Insert FieldValues for credential fields+ const fieldsToInsert: Array<{ key: string; value: string | null }> = [+ { key: FieldKey.LoginUsername, value: credential.Username ?? null },+ { key: FieldKey.LoginPassword, value: credential.Password ?? null },+ { key: FieldKey.LoginUrl, value: credential.ServiceUrl ?? null },+ { key: FieldKey.LoginNotes, value: credential.Notes ?? null },+ { key: FieldKey.AliasFirstName, value: credential.Alias?.FirstName ?? null },+ { key: FieldKey.AliasLastName, value: credential.Alias?.LastName ?? null },+ { key: FieldKey.AliasNickname, value: credential.Alias?.NickName ?? null },+ { key: FieldKey.AliasBirthdate, value: credential.Alias?.BirthDate ?? null },+ { key: FieldKey.AliasGender, value: credential.Alias?.Gender ?? null },+ { key: FieldKey.AliasEmail, value: credential.Alias?.Email ?? null },+ ];++ for (const field of fieldsToInsert) {+ // Skip empty fields+ if (!field.value || (typeof field.value === 'string' && field.value.trim() === '')) {+ continue;+ }++ const fieldValueId = crypto.randomUUID().toUpperCase();+ const fieldQuery = `+ INSERT INTO FieldValues (Id, ItemId, FieldDefinitionId, FieldKey, Value, Weight, CreatedAt, UpdatedAt, IsDeleted)+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`;- // 4. Insert Password- if (credential.Password) {- const passwordQuery = `- INSERT INTO Passwords (Id, Value, CredentialId, CreatedAt, UpdatedAt, IsDeleted)- VALUES (?, ?, ?, ?, ?, ?)`;- const passwordId = crypto.randomUUID().toUpperCase();- this.executeUpdate(passwordQuery, [- passwordId,- credential.Password,- credentialId,+ this.executeUpdate(fieldQuery, [+ fieldValueId,+ itemId,+ null, // FieldDefinitionId is null for system fields+ field.key, // FieldKey+ field.value,+ 0, // WeightcurrentDateTime,currentDateTime,0]);}- // 5. Insert Attachment+ // 4. Insert Attachmentsif (attachments) {for (const attachment of attachments) {const attachmentQuery = `- INSERT INTO Attachments (Id, Filename, Blob, CredentialId, CreatedAt, UpdatedAt, IsDeleted)+ INSERT INTO Attachments (Id, Filename, Blob, ItemId, CreatedAt, UpdatedAt, IsDeleted)VALUES (?, ?, ?, ?, ?, ?, ?)`;const attachmentId = crypto.randomUUID().toUpperCase();@@ -971,7 +978,7 @@ export class SqliteClient {attachmentId,attachment.Filename,attachment.Blob as Uint8Array,- credentialId,+ itemId,currentDateTime,currentDateTime,0@@ -979,7 +986,7 @@ export class SqliteClient {}}- // 6. Insert TOTP codes+ // 5. Insert TOTP codesif (totpCodes) {for (const totpCode of totpCodes) {// Skip deleted codes@@ -988,14 +995,14 @@ export class SqliteClient {}const totpCodeQuery = `- INSERT INTO TotpCodes (Id, Name, SecretKey, CredentialId, CreatedAt, UpdatedAt, IsDeleted)+ INSERT INTO TotpCodes (Id, Name, SecretKey, ItemId, CreatedAt, UpdatedAt, IsDeleted)VALUES (?, ?, ?, ?, ?, ?, ?)`;this.executeUpdate(totpCodeQuery, [totpCode.Id || crypto.randomUUID().toUpperCase(),totpCode.Name,totpCode.SecretKey,- credentialId,+ itemId,currentDateTime,currentDateTime,0@@ -1004,7 +1011,7 @@ export class SqliteClient {}await this.commitTransaction();- return credentialId;+ return itemId;} catch (error) {this.rollbackTransaction();@@ -1105,8 +1112,8 @@ export class SqliteClient {}/**- * Get TOTP codes for a credential- * @param credentialId - The ID of the credential to get TOTP codes for+ * Get TOTP codes for a credential (alias for getTotpCodesForItem)+ * @param credentialId - The ID of the item to get TOTP codes for* @returns Array of TotpCode objects*/public getTotpCodesForCredential(credentialId: string): TotpCode[] {@@ -1129,9 +1136,9 @@ export class SqliteClient {Id,Name,SecretKey,- CredentialId+ ItemIdFROM TotpCodes- WHERE CredentialId = ? AND IsDeleted = 0`;+ WHERE ItemId = ? AND IsDeleted = 0`;return this.executeQuery<TotpCode>(query, [credentialId]);} catch (error) {@@ -1142,9 +1149,9 @@ export class SqliteClient {}/**- * Get attachments for a specific credential- * @param credentialId - The ID of the credential- * @returns Array of attachments for the credential+ * Get attachments for a specific credential (alias for getAttachmentsForItem)+ * @param credentialId - The ID of the item+ * @returns Array of attachments for the item*/public getAttachmentsForCredential(credentialId: string): Attachment[] {if (!this.db) {@@ -1161,12 +1168,12 @@ export class SqliteClient {Id,Filename,Blob,- CredentialId,+ ItemId,CreatedAt,UpdatedAt,IsDeletedFROM Attachments- WHERE CredentialId = ? AND IsDeleted = 0`;+ WHERE ItemId = ? AND IsDeleted = 0`;return this.executeQuery<Attachment>(query, [credentialId]);} catch (error) {console.error('Error getting attachments:', error);@@ -1284,7 +1291,7 @@ export class SqliteClient {UPDATE PasskeysSET IsDeleted = 1,UpdatedAt = ?- WHERE CredentialId = ?`;+ WHERE ItemId = ?`;const results = this.executeUpdate(query, [currentDateTime, credentialId]);this.executeUpdate(aliasQuery, [currentDateTime, credentialId]);@@ -1473,7 +1480,7 @@ export class SqliteClient {if (!isExistingAttachment) {// Insert new attachmentconst insertQuery = `- INSERT INTO Attachments (Id, Filename, Blob, CredentialId, CreatedAt, UpdatedAt, IsDeleted)+ INSERT INTO Attachments (Id, Filename, Blob, ItemId, CreatedAt, UpdatedAt, IsDeleted)VALUES (?, ?, ?, ?, ?, ?, ?)`;this.executeUpdate(insertQuery, [attachment.Id,@@ -1529,7 +1536,7 @@ export class SqliteClient {if (!isExistingTotpCode) {// Insert new TOTP codeconst insertQuery = `- INSERT INTO TotpCodes (Id, Name, SecretKey, CredentialId, CreatedAt, UpdatedAt, IsDeleted)+ INSERT INTO TotpCodes (Id, Name, SecretKey, ItemId, CreatedAt, UpdatedAt, IsDeleted)VALUES (?, ?, ?, ?, ?, ?, ?)`;this.executeUpdate(insertQuery, [totpCode.Id || crypto.randomUUID().toUpperCase(),@@ -1730,7 +1737,7 @@ export class SqliteClient {const query = `SELECTp.Id,- p.CredentialId,+ p.ItemId,p.RpId,p.UserHandle,p.PublicKey,@@ -1741,11 +1748,10 @@ export class SqliteClient {p.CreatedAt,p.UpdatedAt,p.IsDeleted,- c.Username,- s.Name as ServiceName+ i.Name as ServiceName,+ (SELECT fv.Value FROM FieldValues fv WHERE fv.ItemId = i.Id AND fv.FieldKey = '${FieldKey.LoginUsername}' AND fv.IsDeleted = 0 LIMIT 1) as UsernameFROM Passkeys p- LEFT JOIN Credentials c ON p.CredentialId = c.Id- LEFT JOIN Services s ON c.ServiceId = s.Id+ LEFT JOIN Items i ON p.ItemId = i.IdWHERE p.RpId = ? AND p.IsDeleted = 0ORDER BY p.CreatedAt DESC`;@@ -1755,7 +1761,7 @@ export class SqliteClient {// eslint-disable-next-line @typescript-eslint/no-explicit-anyreturn results.map((row: any) => ({Id: row.Id,- CredentialId: row.CredentialId,+ ItemId: row.ItemId,RpId: row.RpId,UserHandle: row.UserHandle,PublicKey: row.PublicKey,@@ -1784,7 +1790,7 @@ export class SqliteClient {const query = `SELECTp.Id,- p.CredentialId,+ p.ItemId,p.RpId,p.UserHandle,p.PublicKey,@@ -1795,11 +1801,10 @@ export class SqliteClient {p.CreatedAt,p.UpdatedAt,p.IsDeleted,- c.Username,- s.Name as ServiceName+ i.Name as ServiceName,+ (SELECT fv.Value FROM FieldValues fv WHERE fv.ItemId = i.Id AND fv.FieldKey = '${FieldKey.LoginUsername}' AND fv.IsDeleted = 0 LIMIT 1) as UsernameFROM Passkeys p- LEFT JOIN Credentials c ON p.CredentialId = c.Id- LEFT JOIN Services s ON c.ServiceId = s.Id+ LEFT JOIN Items i ON p.ItemId = i.IdWHERE p.Id = ? AND p.IsDeleted = 0`;@@ -1813,7 +1818,7 @@ export class SqliteClient {const row: any = results[0];return {Id: row.Id,- CredentialId: row.CredentialId,+ ItemId: row.ItemId,RpId: row.RpId,UserHandle: row.UserHandle,PublicKey: row.PublicKey,@@ -1830,11 +1835,11 @@ export class SqliteClient {}/**- * Get all passkeys for a specific credential- * @param credentialId - The credential ID+ * Get all passkeys for a specific item+ * @param itemId - The item ID* @returns Array of passkey objects*/- public getPasskeysByCredentialId(credentialId: string): Passkey[] {+ public getPasskeysByItemId(itemId: string): Passkey[] {if (!this.db) {throw new Error('Database not initialized');}@@ -1842,7 +1847,7 @@ export class SqliteClient {const query = `SELECTp.Id,- p.CredentialId,+ p.ItemId,p.RpId,p.UserHandle,p.PublicKey,@@ -1854,16 +1859,16 @@ export class SqliteClient {p.UpdatedAt,p.IsDeletedFROM Passkeys p- WHERE p.CredentialId = ? AND p.IsDeleted = 0+ WHERE p.ItemId = ? AND p.IsDeleted = 0ORDER BY p.CreatedAt DESC`;- const results = this.executeQuery(query, [credentialId]);+ const results = this.executeQuery(query, [itemId]);// eslint-disable-next-line @typescript-eslint/no-explicit-anyreturn results.map((row: any) => ({Id: row.Id,- CredentialId: row.CredentialId,+ ItemId: row.ItemId,RpId: row.RpId,UserHandle: row.UserHandle,PublicKey: row.PublicKey,@@ -1878,7 +1883,7 @@ export class SqliteClient {}/**- * Create a new passkey linked to a credential+ * Create a new passkey linked to an item* @param passkey - The passkey object to create*/public async createPasskey(passkey: Omit<Passkey, 'CreatedAt' | 'UpdatedAt' | 'IsDeleted'>): Promise<void> {@@ -1893,7 +1898,7 @@ export class SqliteClient {const query = `INSERT INTO Passkeys (- Id, CredentialId, RpId, UserHandle, PublicKey, PrivateKey,+ Id, ItemId, RpId, UserHandle, PublicKey, PrivateKey,PrfKey, DisplayName, AdditionalData, CreatedAt, UpdatedAt, IsDeleted)VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)@@ -1913,7 +1918,7 @@ export class SqliteClient {this.executeUpdate(query, [passkey.Id,- passkey.CredentialId,+ passkey.ItemId,passkey.RpId,userHandleData,passkey.PublicKey,@@ -1968,11 +1973,11 @@ export class SqliteClient {}/**- * Delete all passkeys for a specific credential (soft delete)- * @param credentialId - The ID of the credential+ * Delete all passkeys for a specific item (soft delete)+ * @param itemId - The ID of the item* @returns The number of rows updated*/- public async deletePasskeysByCredentialId(credentialId: string): Promise<number> {+ public async deletePasskeysByItemId(itemId: string): Promise<number> {if (!this.db) {throw new Error('Database not initialized');}@@ -1986,16 +1991,16 @@ export class SqliteClient {UPDATE PasskeysSET IsDeleted = 1,UpdatedAt = ?- WHERE CredentialId = ?+ WHERE ItemId = ?`;- const result = this.executeUpdate(query, [currentDateTime, credentialId]);+ const result = this.executeUpdate(query, [currentDateTime, itemId]);await this.commitTransaction();return result;} catch (error) {this.rollbackTransaction();- console.error('Error deleting passkeys for credential:', error);+ console.error('Error deleting passkeys for item:', error);throw error;}}diff --git a/apps/browser-extension/src/utils/dist/core/models/vault/index.d.ts b/apps/browser-extension/src/utils/dist/core/models/vault/index.d.tsindex 8093f9f8b..f449be9f3 100644--- a/apps/browser-extension/src/utils/dist/core/models/vault/index.d.ts+++ b/apps/browser-extension/src/utils/dist/core/models/vault/index.d.ts@@ -48,8 +48,8 @@ type TotpCode = {Name: string;/** The secret key for the TOTP code */SecretKey: string;- /** The credential ID this TOTP code belongs to */- CredentialId: string;+ /** The item ID this TOTP code belongs to */+ ItemId: string;/** Whether the TOTP code has been deleted (soft delete) */IsDeleted?: boolean;};@@ -94,7 +94,7 @@ type Attachment = {Id: string;Filename: string;Blob: Uint8Array | number[];- CredentialId: string;+ ItemId: string;CreatedAt: string;UpdatedAt: string;IsDeleted?: boolean;@@ -106,8 +106,8 @@ type Attachment = {type Passkey = {/** The ID of the passkey */Id: string;- /** The credential ID foreign key */- CredentialId: string;+ /** The item ID foreign key */+ ItemId: string;/** The relying party identifier */RpId: string;/** The user handle (user ID) provided by the relying party - stored as byte array (BLOB) */@@ -443,10 +443,6 @@ type FieldCategory = typeof FieldCategories[keyof typeof FieldCategories];* System field definition with metadata.* System fields are predefined fields with immutable keys like 'login.username'.* Their metadata (type, etc.) is defined here in code, not in the database.- *- * NOTE: Labels are NOT included here. Each client must implement their own- * translations based on the FieldKey. If no translation exists, the FieldKey- * can be displayed as a fallback.*/type SystemFieldDefinition = {/** Unique system field key (e.g., 'login.username') */diff --git a/apps/mobile-app/utils/dist/core/models/vault/index.d.ts b/apps/mobile-app/utils/dist/core/models/vault/index.d.tsindex 8093f9f8b..f449be9f3 100644--- a/apps/mobile-app/utils/dist/core/models/vault/index.d.ts+++ b/apps/mobile-app/utils/dist/core/models/vault/index.d.ts@@ -48,8 +48,8 @@ type TotpCode = {Name: string;/** The secret key for the TOTP code */SecretKey: string;- /** The credential ID this TOTP code belongs to */- CredentialId: string;+ /** The item ID this TOTP code belongs to */+ ItemId: string;/** Whether the TOTP code has been deleted (soft delete) */IsDeleted?: boolean;};@@ -94,7 +94,7 @@ type Attachment = {Id: string;Filename: string;Blob: Uint8Array | number[];- CredentialId: string;+ ItemId: string;CreatedAt: string;UpdatedAt: string;IsDeleted?: boolean;@@ -106,8 +106,8 @@ type Attachment = {type Passkey = {/** The ID of the passkey */Id: string;- /** The credential ID foreign key */- CredentialId: string;+ /** The item ID foreign key */+ ItemId: string;/** The relying party identifier */RpId: string;/** The user handle (user ID) provided by the relying party - stored as byte array (BLOB) */@@ -443,10 +443,6 @@ type FieldCategory = typeof FieldCategories[keyof typeof FieldCategories];* System field definition with metadata.* System fields are predefined fields with immutable keys like 'login.username'.* Their metadata (type, etc.) is defined here in code, not in the database.- *- * NOTE: Labels are NOT included here. Each client must implement their own- * translations based on the FieldKey. If no translation exists, the FieldKey- * can be displayed as a fallback.*/type SystemFieldDefinition = {/** Unique system field key (e.g., 'login.username') */diff --git a/core/models/src/vault/Attachment.ts b/core/models/src/vault/Attachment.tsindex 3bd1b8a81..33d567e53 100644--- a/core/models/src/vault/Attachment.ts+++ b/core/models/src/vault/Attachment.ts@@ -5,7 +5,7 @@ export type Attachment = {Id: string;Filename: string;Blob: Uint8Array | number[];- CredentialId: string;+ ItemId: string;CreatedAt: string;UpdatedAt: string;IsDeleted?: boolean;diff --git a/core/models/src/vault/Passkey.ts b/core/models/src/vault/Passkey.tsindex f2bf76afc..eca1cec28 100644--- a/core/models/src/vault/Passkey.ts+++ b/core/models/src/vault/Passkey.ts@@ -5,8 +5,8 @@ export type Passkey = {/** The ID of the passkey */Id: string;- /** The credential ID foreign key */- CredentialId: string;+ /** The item ID foreign key */+ ItemId: string;/** The relying party identifier */RpId: string;diff --git a/core/models/src/vault/TotpCode.ts b/core/models/src/vault/TotpCode.tsindex e97b13fcf..13de7de7b 100644--- a/core/models/src/vault/TotpCode.ts+++ b/core/models/src/vault/TotpCode.ts@@ -11,8 +11,8 @@ export type TotpCode = {/** The secret key for the TOTP code */SecretKey: string;- /** The credential ID this TOTP code belongs to */- CredentialId: string;+ /** The item ID this TOTP code belongs to */+ ItemId: string;/** Whether the TOTP code has been deleted (soft delete) */IsDeleted?: boolean;