Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Open normal popup for item create instead of content script (#776)
Leendert de Borst62d1876e8cb7
diff --git a/apps/browser-extension/src/entrypoints/background.ts b/apps/browser-extension/src/entrypoints/background.tsindex 881bbe14a..e46ac74a3 100644--- a/apps/browser-extension/src/entrypoints/background.ts+++ b/apps/browser-extension/src/entrypoints/background.ts@@ -9,7 +9,7 @@ import { handleGetWebAuthnSettings, handleWebAuthnCreate, handleWebAuthnGet, hanimport { handleOpenPopup, handlePopupWithItem, handleOpenPopupCreateCredential, handleToggleContextMenu } from '@/entrypoints/background/PopupMessageHandler';import { handleStoreSavePromptState, handleGetSavePromptState, handleClearSavePromptState, handleStoreLastAutofilled, handleGetLastAutofilled, handleClearLastAutofilled } from '@/entrypoints/background/SavePromptStateHandler';import { handleStoreTwoFactorState, handleGetTwoFactorState, handleClearTwoFactorState } from '@/entrypoints/background/TwoFactorStateHandler';-import { handleCheckAuthStatus, handleClearPersistedFormValues, handleClearSession, handleClearVaultData, handleLockVault, handleCreateItem, handleGetFilteredItems, handleGetSearchItems, handleGetDefaultEmailDomain, handleGetDefaultIdentitySettings, handleGetEncryptionKey, handleGetEncryptionKeyDerivationParams, handleGetPasswordSettings, handleGeneratePassword, handleGetPersistedFormValues, handleGetVault, handlePersistFormValues, handleStoreEncryptionKey, handleStoreEncryptionKeyDerivationParams, handleStoreVaultMetadata, handleSyncVault, handleUploadVault, handleGetEncryptedVault, handleStoreEncryptedVault, handleGetSyncState, handleMarkVaultClean, handleGetServerRevision, handleCheckSyncStatus, handleFullVaultSync, handleCheckLoginDuplicate, handleSaveLoginCredential, handleAddUrlToCredential, handleIsUrlLinkedToCredential, handleGetLoginSaveSettings, handleSetLoginSaveEnabled, handleGetItemsWithTotp, handleSearchItemsWithTotp, handleGetTotpSecrets, handleGenerateTotpCode, handleSetRecentlySelected, handleGetRecentlySelected } from '@/entrypoints/background/VaultMessageHandler';+import { handleCheckAuthStatus, handleClearPersistedFormValues, handleClearSession, handleClearVaultData, handleLockVault, handleGetFilteredItems, handleGetSearchItems, handleGetDefaultEmailDomain, handleGetDefaultIdentitySettings, handleGetEncryptionKey, handleGetEncryptionKeyDerivationParams, handleGetPasswordSettings, handleGeneratePassword, handleGetPersistedFormValues, handleGetVault, handlePersistFormValues, handleStoreEncryptionKey, handleStoreEncryptionKeyDerivationParams, handleStoreVaultMetadata, handleSyncVault, handleUploadVault, handleGetEncryptedVault, handleStoreEncryptedVault, handleGetSyncState, handleMarkVaultClean, handleGetServerRevision, handleCheckSyncStatus, handleFullVaultSync, handleCheckLoginDuplicate, handleSaveLoginCredential, handleAddUrlToCredential, handleIsUrlLinkedToCredential, handleGetLoginSaveSettings, handleSetLoginSaveEnabled, handleGetItemsWithTotp, handleSearchItemsWithTotp, handleGetTotpSecrets, handleGenerateTotpCode, handleSetRecentlySelected, handleGetRecentlySelected } from '@/entrypoints/background/VaultMessageHandler';import { LocalPreferencesService } from '@/utils/LocalPreferencesService';import { onMessage, sendMessage } from "@/utils/messaging/ExtensionMessaging";@@ -245,7 +245,6 @@ export default defineBackground({onMessage('MARK_VAULT_CLEAN', ({ data }) => handleMarkVaultClean(data));onMessage('GET_SERVER_REVISION', () => handleGetServerRevision());- onMessage('CREATE_ITEM', ({ data }) => handleCreateItem(data));onMessage('UPLOAD_VAULT', () => handleUploadVault());onMessage('SYNC_VAULT', () => handleSyncVault());onMessage('CHECK_SYNC_STATUS', () => handleCheckSyncStatus());@@ -256,7 +255,7 @@ export default defineBackground({onMessage('OPEN_POPUP', () => handleOpenPopup());onMessage('OPEN_POPUP_WITH_ITEM', ({ data }) => handlePopupWithItem(data));- onMessage('OPEN_POPUP_CREATE_CREDENTIAL', ({ data }) => handleOpenPopupCreateCredential(data));+ onMessage('OPEN_POPUP_CREATE_CREDENTIAL', ({ data, sender }) => handleOpenPopupCreateCredential(data, sender));onMessage('TOGGLE_CONTEXT_MENU', ({ data }) => handleToggleContextMenu(data));onMessage('PERSIST_FORM_VALUES', ({ data }) => handlePersistFormValues(data));diff --git a/apps/browser-extension/src/entrypoints/background/PopupMessageHandler.ts b/apps/browser-extension/src/entrypoints/background/PopupMessageHandler.tsindex 4e99f6885..33b3c104b 100644--- a/apps/browser-extension/src/entrypoints/background/PopupMessageHandler.ts+++ b/apps/browser-extension/src/entrypoints/background/PopupMessageHandler.ts@@ -39,20 +39,23 @@ export function handlePopupWithItem(message: any) : Promise<BoolResponse> {}/**- * Handle opening the popup on create item page with prefilled service name.+ * Handle opening the popup on create item page with a prefilled item title.*/-export function handleOpenPopupCreateCredential(message: any) : Promise<BoolResponse> {+export function handleOpenPopupCreateCredential(message: any, sender?: any) : Promise<BoolResponse> {return (async () : Promise<BoolResponse> => {- const serviceName = encodeURIComponent(message.serviceName || '');+ const itemTitle = message.itemTitle || '';+ const currentUrl = message.currentUrl || '';+ const sourceTabId = sender?.tab?.id;+ const elementIdentifier = message.elementIdentifier;- // Use the URL passed from the content script (current page URL)+ // Derive the service URL (origin + pathname) from the page URL passed by the content script.let serviceUrl = '';- if (message.currentUrl) {+ if (currentUrl) {try {- const url = new URL(message.currentUrl);+ const url = new URL(currentUrl);// Only include http/https URLsif (url.protocol === 'http:' || url.protocol === 'https:') {- serviceUrl = encodeURIComponent(url.origin + url.pathname);+ serviceUrl = url.origin + url.pathname;}} catch (error) {console.error('Error parsing current URL:', error);@@ -62,27 +65,44 @@ export function handleOpenPopupCreateCredential(message: any) : Promise<BoolResp// Set a localStorage flag to skip restoring previously persisted form values as we want to start fresh with this explicit create item request.await LocalPreferencesService.setSkipFormRestore(true);- const urlParams = new URLSearchParams();- urlParams.set('expanded', 'true');- if (serviceName) {- urlParams.set('name', serviceName);+ const hashParams = new URLSearchParams();+ if (itemTitle) {+ hashParams.set('itemTitle', itemTitle);}if (serviceUrl) {- urlParams.set('serviceUrl', serviceUrl);+ hashParams.set('serviceUrl', serviceUrl);}- if (message.currentUrl) {- urlParams.set('currentUrl', message.currentUrl);+ if (currentUrl) {+ hashParams.set('currentUrl', currentUrl);}// Default to Login type for quick create from content script- urlParams.set('type', 'Login');+ hashParams.set('type', 'Login');- browser.windows.create({- url: browser.runtime.getURL(`/popup.html?${urlParams.toString()}#/items/add`),+ if (sourceTabId !== undefined && sourceTabId !== null) {+ hashParams.set('sourceTabId', String(sourceTabId));+ }+ if (elementIdentifier) {+ hashParams.set('elementIdentifier', String(elementIdentifier));+ }++ const createOptions: Parameters<typeof browser.windows.create>[0] = {+ url: browser.runtime.getURL(`/popup.html?expanded=true#/items/add?${hashParams.toString()}`),type: 'popup',width: 400,height: 600,focused: true- });+ };++ /*+ * Position the window near where the user clicked (passed by the content script, already clamped+ * to the screen). When absent, the browser picks a default position.+ */+ if (typeof message.left === 'number' && typeof message.top === 'number') {+ createOptions.left = Math.round(message.left);+ createOptions.top = Math.round(message.top);+ }++ browser.windows.create(createOptions);return { success: true };})();}diff --git a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.tsindex ffe823b44..6ebd2cd84 100644--- a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts+++ b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts@@ -329,37 +329,6 @@ export async function handleClearVaultData(): Promise<messageBoolResponse> {return { success: true };}-/**- * Create a new item in the vault.- * Uses the native Item type with field-based structure.- */-export async function handleCreateItem(- message: any,-) : Promise<messageBoolResponse> {- const encryptionKey = await handleGetEncryptionKey();-- if (!encryptionKey) {- // E-202: Vault is locked- return { success: false, error: formatErrorWithCode(await t('common.errors.vaultIsLocked'), AppErrorCode.VAULT_LOCKED) };- }-- try {- const sqliteClient = await createVaultSqliteClient();-- // Add the new item to the vault/database.- await sqliteClient.items.create(message.item, message.attachments || [], message.totpCodes || []);-- // Persist locally and sync in the background (doesn't block when server is offline).- await persistLocalVaultMutation(sqliteClient, encryptionKey);-- return { success: true };- } catch (error) {- console.error('Failed to create item:', error);- // E-301: Item create failed- return { success: false, error: formatErrorWithCode(await t('common.errors.unknownError'), AppErrorCode.ITEM_CREATE_FAILED) };- }-}-/*** Filter items by URL matching.*diff --git a/apps/browser-extension/src/entrypoints/content.ts b/apps/browser-extension/src/entrypoints/content.tsindex 5088a544d..fbc6191c5 100644--- a/apps/browser-extension/src/entrypoints/content.ts+++ b/apps/browser-extension/src/entrypoints/content.ts@@ -4,13 +4,14 @@import '@/entrypoints/contentScript/style.css';import { CONDITIONAL_PASSKEYS_UPDATED_EVENT, hasPendingConditionalRequest, refreshConditionalPasskeyOptions } from '@/entrypoints/contentScript/ConditionalPasskey';-import { injectIcon, popupDebounceTimeHasPassed, validateInputField } from '@/entrypoints/contentScript/Form';-import { openAutofillPopup, openTotpPopup, removeExistingPopup, createUpgradeRequiredPopup } from '@/entrypoints/contentScript/Popup';+import { fillItem, injectIcon, popupDebounceTimeHasPassed, validateInputField } from '@/entrypoints/contentScript/Form';+import { getLastAutofillInput, openAutofillPopup, openTotpPopup, removeExistingPopup, createUpgradeRequiredPopup } from '@/entrypoints/contentScript/Popup';import { showSavePrompt, showAddUrlPrompt, isSavePromptVisible, updateSavePromptLogin, getPersistedSavePromptState, restoreSavePromptFromState, restoreAddUrlPromptFromState } from '@/entrypoints/contentScript/SavePrompt';import { initializeWebAuthnInterceptor } from '@/entrypoints/contentScript/WebAuthnInterceptor';import { isAvAutofillAllowed, isAvSuppressSave } from '@/utils/autofill/Autofill';import { DEFAULT_POPUP_TYPE, isPopupType, popupTypeForFieldType, POPUP_TYPES, type PopupType } from '@/utils/autofill/PopupTypes';+import type { Item } from '@/utils/dist/core/models/vault';import { FormDetector } from '@/utils/formDetector/FormDetector';import { LocalPreferencesService } from '@/utils/LocalPreferencesService';import { LoginDetector } from '@/utils/loginDetector';@@ -634,6 +635,45 @@ export default defineContentScript({return { success: true };});+ /*+ * A credential was created in the full popup window (opened from this page's "create new+ * item" flow). Autofill it back into the page form, mirroring the inline quick-create UX.+ */+ onMessage('AUTOFILL_CREATED_ITEM', async ({ data }) => {+ const { item, elementIdentifier } = data;++ if (!item) {+ return { success: false, error: 'No item provided' };+ }++ /*+ * Resolve the target input: prefer the explicit element identifier, then fall back to+ * the input the autofill popup was most recently shown for on this page.+ */+ let resolvedInput: HTMLInputElement | null = null;+ if (elementIdentifier) {+ const target = document.getElementById(elementIdentifier) ?? document.getElementsByName(elementIdentifier)[0] ?? null;+ const { isValid, inputElement } = validateInputField(target);+ if (isValid && inputElement) {+ resolvedInput = inputElement;+ }+ }+ if (!resolvedInput) {+ resolvedInput = getLastAutofillInput();+ }++ if (!resolvedInput) {+ return { success: false, error: 'No target input found' };+ }++ // Close any open inline popup before filling.+ removeExistingPopup(container);++ await fillItem(item as Item, resolvedInput);++ return { success: true };+ });+// When the vault is unlocked, re-query any pending conditional passkey requestsonMessage('VAULT_UNLOCKED', async () => {if (ctx.isInvalid || !hasPendingConditionalRequest()) {diff --git a/apps/browser-extension/src/entrypoints/contentScript/Popup.ts b/apps/browser-extension/src/entrypoints/contentScript/Popup.tsindex ea5df9dde..b034633cc 100644--- a/apps/browser-extension/src/entrypoints/contentScript/Popup.ts+++ b/apps/browser-extension/src/entrypoints/contentScript/Popup.ts@@ -2,14 +2,11 @@ import * as OTPAuth from 'otpauth';import { fillItem, fillTotpCode } from '@/entrypoints/contentScript/Form';-import { CreateIdentityGenerator, IdentityHelperUtils } from '@/utils/dist/core/identity-generator';import { ItemTypeIconSvgs } from '@/utils/dist/core/models/icons';-import type { Item, ItemField, PasswordSettings } from '@/utils/dist/core/models/vault';-import { ItemTypes, FieldKey, createSystemField, getFieldValue } from '@/utils/dist/core/models/vault';-import { getAllFaviconLinks } from '@/utils/favicon';+import type { Item } from '@/utils/dist/core/models/vault';+import { FieldKey, getFieldValue } from '@/utils/dist/core/models/vault';import { LocalPreferencesService } from '@/utils/LocalPreferencesService';import { sendMessage } from '@/utils/messaging/ExtensionMessaging';-import { sliderToLength, lengthToSlider, SLIDER_MIN, SLIDER_MAX } from '@/utils/PasswordLengthSlider';import { ClickValidator } from '@/utils/security/ClickValidator';import { ServiceDetectionUtility } from '@/utils/serviceDetection/ServiceDetectionUtility';import { SqliteClient } from '@/utils/SqliteClient';@@ -20,13 +17,47 @@ import { getCurrentAutofillFrameUrl } from './AutofillFrameUrl';import { completeConditionalWithPasskey, getConditionalPasskeyOptions, hasPendingConditionalRequest } from './ConditionalPasskey';/**- * Generate a password from the given settings via the background (which runs the Rust core).- * The content script cannot load the WASM core itself, so generation is delegated.+ * The input element the autofill popup was most recently shown for. Used as a fallback fill+ * target when a credential is created in the full popup window and filled back into the page.*/-const generatePasswordFromSettings = async (settings: PasswordSettings): Promise<string> => {- const response = await sendMessage('GENERATE_PASSWORD', { settings });- return response.password ?? '';-};+let lastAutofillInput: HTMLInputElement | null = null;++/**+ * Get the input element the autofill popup was most recently shown for (may be null).+ */+export function getLastAutofillInput(): HTMLInputElement | null {+ return lastAutofillInput;+}++/*+ * Dimensions of the create-credential popup window (must match browser.windows.create in the+ * background's handleOpenPopupCreateCredential), used to keep it fully on-screen when positioning.+ */+const CREATE_POPUP_WIDTH = 400;+const CREATE_POPUP_HEIGHT = 600;++/**+ * Compute an on-screen top-left position for the create-credential window from a click event, so it+ * opens centered on where the user clicked rather than in the screen corner. Returns null when no+ * pointer position is available (e.g. keyboard activation), letting the browser pick a default.+ */+function getCreatePopupPosition(e: Event): { left: number; top: number } | null {+ const mouse = e as MouseEvent;+ if (!mouse.screenX && !mouse.screenY) {+ return null;+ }++ // availLeft/availTop are non-standard but widely supported; fall back to 0 when absent.+ const screenInfo = window.screen as Screen & { availLeft?: number; availTop?: number };+ const availLeft = screenInfo.availLeft ?? 0;+ const availTop = screenInfo.availTop ?? 0;++ // Center the window on the cursor, then clamp so the whole window stays within the screen.+ const left = Math.max(availLeft, Math.min(mouse.screenX - CREATE_POPUP_WIDTH / 2, availLeft + screenInfo.availWidth - CREATE_POPUP_WIDTH));+ const top = Math.max(availTop, Math.min(mouse.screenY - CREATE_POPUP_HEIGHT / 2, availTop + screenInfo.availHeight - CREATE_POPUP_HEIGHT));++ return { left: Math.round(left), top: Math.round(top) };+}/*** WeakMap to store event listeners for popup containers@@ -79,41 +110,6 @@ function getTotpRemainingSeconds(): number {return 30 - (Math.floor(Date.now() / 1000) % 30);}-/**- * Create a suggestion pill element using safe DOM methods.- */-const createSuggestionPill = (value: string): HTMLElement => {- const pill = document.createElement('span');- pill.className = 'av-suggestion-pill';-- const textSpan = document.createElement('span');- textSpan.className = 'av-suggestion-pill-text';- textSpan.dataset.value = value;- textSpan.textContent = value;-- const deleteSpan = document.createElement('span');- deleteSpan.className = 'av-suggestion-pill-delete';- deleteSpan.dataset.value = value;- deleteSpan.title = 'Remove';- deleteSpan.textContent = '×';-- pill.appendChild(textSpan);- pill.appendChild(deleteSpan);-- return pill;-};--/**- * Create a suggested name element using safe DOM methods.- */-const createSuggestedNameSpan = (name: string): HTMLElement => {- const span = document.createElement('span');- span.className = 'av-suggested-name';- span.dataset.name = name;- span.textContent = name;- return span;-};-/*** Check if an outside-click event originated from AliasVault UI controls.*/@@ -835,15 +831,15 @@ function hasFillableLoginField(item: Item): boolean {* Create auto-fill popup*/export async function createAutofillPopup(input: HTMLInputElement, items: Item[] | undefined, rootContainer: HTMLElement, recentlySelectedId?: string | null) : Promise<void> {+ // Remember the input so a credential created in the full popup window can be filled back here.+ lastAutofillInput = input;+// Get all translations firstconst newText = await t('content.new');const searchPlaceholder = await t('content.searchVault');const hideFor1HourText = await t('content.hideFor1Hour');const hidePermanentlyText = await t('content.hidePermanently');const noMatchesText = await t('content.noMatchesFound');- const creatingAliasText = await t('content.creatingNewAlias');- const creatingCredentialText = await t('content.creatingNewCredential');- const failedText = await t('content.failedToCreateIdentity');const popup = createBasePopup(input, rootContainer);@@ -891,136 +887,37 @@ export async function createAutofillPopup(input: HTMLInputElement, items: Item[]`;/**- * Handle create button click+ * Handle create button click: open the full create-item popup (defaults to Login) prefilled with+ * the detected service name + page URL. The user can switch to an Alias (or any type) there using+ * the normal UI, and the created credential is autofilled back into this page on save.*/- const handleCreateClick = async (e: Event) : Promise<void> => {+ const handleCreateClick = (e: Event) : void => {e.preventDefault();e.stopPropagation();e.stopImmediatePropagation();- const serviceInfo = ServiceDetectionUtility.getServiceInfo(document, window.location);- const result = await createAliasCreationPopup(serviceInfo.suggestedNames, rootContainer);-- if (!result) {- // User cancelled- return;+ // Ensure the field has a stable id so the created credential can be filled back into it.+ if (!input.id) {+ input.id = `aliasvault-input-${Math.random().toString(36).substring(2, 11)}`;}- const loadingPopup = createLoadingPopup(input, `${result.isCustomCredential ? creatingCredentialText : creatingAliasText}...`, rootContainer);-- try {- // Sync with api to ensure we have the latest vault.- await sendMessage('SYNC_VAULT');-- // Retrieve default email domain from background- const response = await sendMessage('GET_DEFAULT_EMAIL_DOMAIN');- const domain = response.value;-- let newItem: Item;- const currentDateTime = new Date().toISOString();-- if (result.isCustomCredential) {- // Create custom item with information provided by user in popup.- const faviconBytes = await getFaviconBytes(document);- const serviceUrl = getValidServiceUrl();-- // Build fields using factory - only include non-empty values- const fields: ItemField[] = [];- if (serviceUrl) {- fields.push(createSystemField(FieldKey.LoginUrl, { value: serviceUrl }));- }- if (result.customUsername) {- fields.push(createSystemField(FieldKey.LoginUsername, { value: result.customUsername }));- }- if (result.customEmail) {- fields.push(createSystemField(FieldKey.LoginEmail, { value: result.customEmail }));- }- if (result.customPassword) {- fields.push(createSystemField(FieldKey.LoginPassword, { value: result.customPassword }));- }-- newItem = {- Id: '',- Name: result.serviceName ?? '',- ItemType: ItemTypes.Login,- Logo: faviconBytes ?? undefined,- Fields: fields,- CreatedAt: currentDateTime,- UpdatedAt: currentDateTime- };- } else {- // Generate new random identity using identity generator.- const identitySettings = await sendMessage('GET_DEFAULT_IDENTITY_SETTINGS');- const identityGenerator = CreateIdentityGenerator(identitySettings.settings?.language ?? 'en');- const identity = identityGenerator.generateRandomIdentity(identitySettings.settings?.gender);-- // Get password settings from background- const passwordSettingsResponse = await sendMessage('GET_PASSWORD_SETTINGS');-- // Generate a password from the retrieved settings via the Rust core (background).- const passwordSettings = passwordSettingsResponse.settings ?? {- Length: 12,- UseLowercase: true,- UseUppercase: true,- UseNumbers: true,- UseSpecialChars: true,- UseNonAmbiguousChars: true- };- const password = await generatePasswordFromSettings(passwordSettings);-- // Extract favicon from page and get the bytes- const faviconBytes = await getFaviconBytes(document);- const serviceUrl = getValidServiceUrl();-- const fields: ItemField[] = [];- if (serviceUrl) {- fields.push(createSystemField(FieldKey.LoginUrl, { value: serviceUrl }));- }- fields.push(createSystemField(FieldKey.LoginUsername, { value: identity.nickName }));- fields.push(createSystemField(FieldKey.LoginEmail, { value: domain ? `${identity.emailPrefix}@${domain}` : identity.emailPrefix }));- fields.push(createSystemField(FieldKey.LoginPassword, { value: password }));- fields.push(createSystemField(FieldKey.AliasFirstName, { value: identity.firstName }));- fields.push(createSystemField(FieldKey.AliasLastName, { value: identity.lastName }));- fields.push(createSystemField(FieldKey.AliasBirthdate, { value: IdentityHelperUtils.normalizeBirthDate(identity.birthDate.toISOString()) }));- fields.push(createSystemField(FieldKey.AliasGender, { value: identity.gender }));-- newItem = {- Id: '',- Name: result.serviceName ?? '',- ItemType: ItemTypes.Alias,- Logo: faviconBytes ?? undefined,- Fields: fields,- CreatedAt: currentDateTime,- UpdatedAt: currentDateTime- };- }-- // Create item in background.- const createResponse = await sendMessage('CREATE_ITEM', {- item: JSON.parse(JSON.stringify(newItem))- });-- // Check if item creation succeeded- if (!createResponse.success) {- throw new Error(createResponse.error || 'Failed to create item');- }+ /*+ * Position the create-credential window near the click so it opens in the user's line of focus+ * instead of the screen corner. Mouse screen coordinates are clamped so the whole window stays+ * on-screen; falls back to the browser default when no pointer position is available (keyboard).+ */+ const position = getCreatePopupPosition(e);- // Close popup.- removeExistingPopup(rootContainer);+ const serviceInfo = ServiceDetectionUtility.getServiceInfo(document, window.location);+ sendMessage('OPEN_POPUP_CREATE_CREDENTIAL', {+ itemTitle: serviceInfo.suggestedNames[0] || '',+ currentUrl: serviceInfo.currentUrl,+ elementIdentifier: input.id,+ left: position?.left,+ top: position?.top+ });- // Fill the form with the new item immediately.- fillItem(newItem, input);- } catch (error) {- console.error('Error creating item:', error);- loadingPopup.innerHTML = `- <div style="padding: 16px; color: #ef4444;">- ${failedText}- </div>- `;- setTimeout(() => {- removeExistingPopup(rootContainer);- }, 2000);- }+ removeExistingPopup(rootContainer);};// Add click listener with capture and prevent removal and security validation.@@ -1626,1029 +1523,6 @@ export async function disableAutoShowPopup(temporary: boolean = false): Promise<}}-/**- * Create alias creation popup where user can choose between random alias and custom alias.- */-export async function createAliasCreationPopup(suggestedNames: string[], rootContainer: HTMLElement): Promise<{ serviceName: string | null, isCustomCredential: boolean, customEmail?: string, customUsername?: string, customPassword?: string } | null> {- // Close existing popup- removeExistingPopup(rootContainer);-- // Load history- const emailHistory = await LocalPreferencesService.getCustomEmailHistory();- const usernameHistory = await LocalPreferencesService.getCustomUsernameHistory();-- return new Promise((resolve) => {- (async (): Promise<void> => {- // Create modal overlay- const overlay = document.createElement('div');- overlay.id = 'aliasvault-create-popup';- overlay.className = 'av-create-popup-overlay';-- const popup = document.createElement('div');- popup.className = 'av-create-popup';-- // Define input method base variables- const randomIdentityIcon = `- <svg class="av-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">- <rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>- <circle cx="8" cy="8" r="1"/>- <circle cx="16" cy="8" r="1"/>- <circle cx="12" cy="12" r="1"/>- <circle cx="8" cy="16" r="1"/>- <circle cx="16" cy="16" r="1"/>- </svg>- `;- const randomIdentitySubtext = await t('content.randomIdentityDescription');- const randomIdentityTitle = await t('content.createRandomAlias');- const randomIdentityTitleDropdown = await t('content.randomAlias');- const randomIdentitySubtextDropdown = await t('content.randomIdentityDescriptionDropdown');-- const manualUsernamePasswordIcon = `- <svg class="av-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">- <circle cx="12" cy="7" r="4"/>- <path d="M5.5 20a6.5 6.5 0 0 1 13 0"/>- </svg>- `;- const manualUsernamePasswordSubtext = await t('content.manualCredentialDescription');- const manualUsernamePasswordTitle = await t('content.createUsernamePassword');- const manualUsernamePasswordTitleDropdown = await t('content.usernamePassword');- const manualUsernamePasswordSubtextDropdown = await t('content.manualCredentialDescriptionDropdown');-- // Get all translated strings first- const serviceNameText = await t('common.serviceName');- const enterServiceNameText = await t('content.enterServiceName');- const cancelText = await t('common.cancel');- const createAndSaveAliasText = await t('content.createAndSaveAlias');- const emailText = await t('common.email');- const enterEmailAddressText = await t('content.enterEmailAddress');- const usernameText = await t('common.username');- const enterUsernameText = await t('content.enterUsername');- const passwordText = await t('common.password');- const generateNewPasswordText = await t('content.generateNewPassword');- const togglePasswordVisibilityText = await t('content.togglePasswordVisibility');- const createAndSaveCredentialText = await t('content.createAndSaveCredential');- const passwordLengthText = await t('items.passwordLength');- const changePasswordComplexityText = await t('items.changePasswordComplexity');-- // Create the main content- popup.innerHTML = `- <div class="av-create-popup-header">- <div class="av-create-popup-title-container">- <div class="av-create-popup-title-wrapper">- ${randomIdentityIcon}- <h3 class="av-create-popup-title">${randomIdentityTitle}</h3>- </div>- <div class="av-create-popup-header-buttons">- <button class="av-create-popup-mode-dropdown">- <svg class="av-icon" viewBox="0 0 24 24">- <path d="M6 9l6 6 6-6"/>- </svg>- </button>- <button class="av-create-popup-popout" title="Open in main popup">- <svg class="av-icon" viewBox="0 0 24 24">- <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>- <polyline points="15 3 21 3 21 9"></polyline>- <line x1="10" y1="14" x2="21" y2="3"></line>- </svg>- </button>- </div>- </div>- </div>-- <div class="av-create-popup-mode-dropdown-menu" style="display: none;">- <button class="av-create-popup-mode-option" data-mode="random">- <div class="av-create-popup-mode-icon">- ${randomIdentityIcon}- </div>- <div class="av-create-popup-mode-content">- <h4>${randomIdentityTitleDropdown}</h4>- <p>${randomIdentitySubtextDropdown}</p>- </div>- </button>-- <button class="av-create-popup-mode-option" data-mode="custom">- <div class="av-create-popup-mode-icon">- ${manualUsernamePasswordIcon}- </div>- <div class="av-create-popup-mode-content">- <h4>${manualUsernamePasswordTitleDropdown}</h4>- <p>${manualUsernamePasswordSubtextDropdown}</p>- </div>- </button>- </div>-- <div class="av-create-popup-help-text">${randomIdentitySubtext}</div>-- <div class="av-create-popup-field-group">- <label for="service-name-input">${serviceNameText}</label>- <input- type="text"- id="service-name-input"- value="${suggestedNames[0] ?? ''}"- class="av-create-popup-input"- placeholder="${enterServiceNameText}"- >- ${suggestedNames.length > 1 ? '<div class="av-suggested-names"></div>' : ''}- </div>-- <div class="av-create-popup-mode av-create-popup-random-mode">- <div class="av-create-popup-actions">- <button id="cancel-btn" class="av-create-popup-cancel">${cancelText}</button>- <button id="save-btn" class="av-create-popup-save">${createAndSaveAliasText}</button>- </div>- </div>-- <div class="av-create-popup-mode av-create-popup-custom-mode" style="display: none;">- <div class="av-create-popup-field-group">- <label for="custom-email">${emailText}</label>- <input- type="email"- id="custom-email"- class="av-create-popup-input"- placeholder="${enterEmailAddressText}"- >- <div class="av-field-suggestions" id="email-suggestions"></div>- </div>- <div class="av-create-popup-field-group">- <label for="custom-username">${usernameText}</label>- <input- type="text"- id="custom-username"- class="av-create-popup-input"- placeholder="${enterUsernameText}"- >- <div class="av-field-suggestions" id="username-suggestions"></div>- </div>- <div class="av-create-popup-field-group">- <label>${passwordText}</label>- <div class="av-create-popup-password-preview">- <input- type="text"- id="password-preview"- class="av-create-popup-input"- data-is-generated="true"- >- <button id="toggle-password-visibility" class="av-create-popup-visibility-btn" title="${togglePasswordVisibilityText}">- <svg class="av-icon" viewBox="0 0 24 24">- <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>- <circle cx="12" cy="12" r="3"></circle>- </svg>- </button>- <button id="regenerate-password" class="av-create-popup-regenerate-btn" title="${generateNewPasswordText}">- <svg class="av-icon" viewBox="0 0 24 24">- <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"></path>- <path d="M3 3v5h5"></path>- </svg>- </button>- </div>-- <div class="av-password-length-container">- <div class="av-password-length-header">- <label for="password-length-slider">${passwordLengthText}</label>- <div class="av-password-length-controls">- <span id="password-length-value" class="av-password-length-value">12</span>- <button id="password-config-btn" class="av-password-config-btn" title="${changePasswordComplexityText}">- <svg class="av-icon" viewBox="0 0 24 24">- <path d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path>- <path d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>- </svg>- </button>- </div>- </div>- <input type="range" id="password-length-slider" min="${SLIDER_MIN}" max="${SLIDER_MAX}" step="0.1" value="${lengthToSlider(12)}" class="av-password-length-slider">- </div>- </div>- <div class="av-create-popup-actions">- <button id="custom-cancel-btn" class="av-create-popup-cancel">${cancelText}</button>- <button id="custom-save-btn" class="av-create-popup-save">${createAndSaveCredentialText}</button>- </div>- </div>- `;-- overlay.appendChild(popup);- rootContainer.appendChild(overlay);-- // Animate in- requestAnimationFrame(() => {- popup.classList.add('show');- });-- // Get all the elements- const randomMode = popup.querySelector('.av-create-popup-random-mode') as HTMLElement;- const customMode = popup.querySelector('.av-create-popup-custom-mode') as HTMLElement;- const dropdownMenu = popup.querySelector('.av-create-popup-mode-dropdown-menu') as HTMLElement;- const titleContainer = popup.querySelector('.av-create-popup-title-container') as HTMLElement;- const popoutBtn = popup.querySelector('.av-create-popup-popout') as HTMLButtonElement;- const cancelBtn = popup.querySelector('#cancel-btn') as HTMLButtonElement;- const customCancelBtn = popup.querySelector('#custom-cancel-btn') as HTMLButtonElement;- const saveBtn = popup.querySelector('#save-btn') as HTMLButtonElement;- const customSaveBtn = popup.querySelector('#custom-save-btn') as HTMLButtonElement;- const inputServiceName = popup.querySelector('#service-name-input') as HTMLInputElement;- const customEmail = popup.querySelector('#custom-email') as HTMLInputElement;- const customUsername = popup.querySelector('#custom-username') as HTMLInputElement;- const passwordPreview = popup.querySelector('#password-preview') as HTMLInputElement;- const regenerateBtn = popup.querySelector('#regenerate-password') as HTMLButtonElement;- const toggleVisibilityBtn = popup.querySelector('#toggle-password-visibility') as HTMLButtonElement;- const emailSuggestions = popup.querySelector('#email-suggestions') as HTMLElement;- const usernameSuggestions = popup.querySelector('#username-suggestions') as HTMLElement;-- // Populate suggested names- const suggestedNamesContainer = popup.querySelector('.av-suggested-names') as HTMLElement;- if (suggestedNamesContainer) {- await populateSuggestedNames(suggestedNamesContainer, suggestedNames, suggestedNames[0] ?? '');- }-- /**- * Update history with new value (max 2 unique entries)- */- const updateHistory = async (value: string, historyType: 'email' | 'username', maxItems: number = 2): Promise<string[]> => {- const history = historyType === 'email'- ? await LocalPreferencesService.getCustomEmailHistory()- : await LocalPreferencesService.getCustomUsernameHistory();-- // Remove the value if it already exists- const filteredHistory = history.filter((item: string) => item !== value);-- // Add the new value at the beginning- if (value.trim()) {- filteredHistory.unshift(value);- }-- // Keep only the first maxItems- const updatedHistory = filteredHistory.slice(0, maxItems);-- // Save the updated history- if (historyType === 'email') {- await LocalPreferencesService.setCustomEmailHistory(updatedHistory);- } else {- await LocalPreferencesService.setCustomUsernameHistory(updatedHistory);- }-- return updatedHistory;- };-- /**- * Remove item from history- */- const removeFromHistory = async (value: string, historyType: 'email' | 'username'): Promise<string[]> => {- const history = historyType === 'email'- ? await LocalPreferencesService.getCustomEmailHistory()- : await LocalPreferencesService.getCustomUsernameHistory();- const updatedHistory = history.filter((item: string) => item !== value);- if (historyType === 'email') {- await LocalPreferencesService.setCustomEmailHistory(updatedHistory);- } else {- await LocalPreferencesService.setCustomUsernameHistory(updatedHistory);- }- return updatedHistory;- };-- /**- * Update suggestions display using safe DOM methods.- */- const updateSuggestions = (input: HTMLInputElement, suggestionsContainer: HTMLElement, history: string[]): void => {- const currentValue = input.value.trim();-- // Filter out the current value from history and limit to 2 items- const filteredHistory = history- .filter(item => item.toLowerCase() !== currentValue.toLowerCase())- .slice(0, 2);-- // Clear existing content- suggestionsContainer.textContent = '';-- if (filteredHistory.length === 0) {- suggestionsContainer.style.display = 'none';- return;- }-- // Build pill elements- filteredHistory.forEach((item, index) => {- if (index > 0) {- suggestionsContainer.appendChild(document.createTextNode(' '));- }- suggestionsContainer.appendChild(createSuggestionPill(item));- });-- suggestionsContainer.style.display = 'flex';- };-- // Initial display of suggestions- updateSuggestions(customEmail, emailSuggestions, emailHistory);- updateSuggestions(customUsername, usernameSuggestions, usernameHistory);-- // Handle popout button click- popoutBtn.addEventListener('click', (e) => {- e.preventDefault();- e.stopPropagation();- const serviceName = inputServiceName.value.trim();- const encodedServiceInfo = ServiceDetectionUtility.getEncodedServiceInfo(document, window.location);- sendMessage('OPEN_POPUP_CREATE_CREDENTIAL', {- serviceName: serviceName || encodedServiceInfo.serviceName,- currentUrl: encodedServiceInfo.currentUrl- });- closePopup(null);- });-- // Handle email input- customEmail.addEventListener('input', () => {- updateSuggestions(customEmail, emailSuggestions, emailHistory);- });-- // Handle username input- customUsername.addEventListener('input', () => {- updateSuggestions(customUsername, usernameSuggestions, usernameHistory);- });-- // Handle suggestion clicks for email- emailSuggestions.addEventListener('click', async (e) => {- e.preventDefault();- e.stopPropagation();- const target = e.target as HTMLElement;-- // Check if delete button was clicked- if (target.classList.contains('av-suggestion-pill-delete')) {- const value = target.dataset.value;- if (value) {- const updatedHistory = await removeFromHistory(value, 'email');- emailHistory.splice(0, emailHistory.length, ...updatedHistory);- updateSuggestions(customEmail, emailSuggestions, emailHistory);- }- } else {- // Check if pill or pill text was clicked- let pillElement = target.closest('.av-suggestion-pill') as HTMLElement;- if (pillElement) {- const textElement = pillElement.querySelector('.av-suggestion-pill-text') as HTMLElement;- const value = textElement?.dataset.value;- if (value) {- customEmail.value = value;- updateSuggestions(customEmail, emailSuggestions, emailHistory);- }- }- }- });-- // Handle suggestion clicks for username- usernameSuggestions.addEventListener('click', async (e) => {- e.preventDefault();- e.stopPropagation();- const target = e.target as HTMLElement;-- // Check if delete button was clicked- if (target.classList.contains('av-suggestion-pill-delete')) {- const value = target.dataset.value;- if (value) {- const updatedHistory = await removeFromHistory(value, 'username');- usernameHistory.splice(0, usernameHistory.length, ...updatedHistory);- updateSuggestions(customUsername, usernameSuggestions, usernameHistory);- }- } else {- // Check if pill or pill text was clicked- let pillElement = target.closest('.av-suggestion-pill') as HTMLElement;- if (pillElement) {- const textElement = pillElement.querySelector('.av-suggestion-pill-text') as HTMLElement;- const value = textElement?.dataset.value;- if (value) {- customUsername.value = value;- updateSuggestions(customUsername, usernameSuggestions, usernameHistory);- }- }- }- });-- // Get password settings from background- let currentPasswordSettings: PasswordSettings = {- Length: 12,- UseLowercase: true,- UseUppercase: true,- UseNumbers: true,- UseSpecialChars: true,- UseNonAmbiguousChars: true- };- // Becomes true once settings have loaded, so generation isn't attempted too early.- let passwordSettingsLoaded = false;-- sendMessage('GET_PASSWORD_SETTINGS').then((passwordSettingsResponse) => {- currentPasswordSettings = passwordSettingsResponse.settings ?? currentPasswordSettings;- passwordSettingsLoaded = true;-- // Update UI with loaded settings- const lengthSlider = popup.querySelector('#password-length-slider') as HTMLInputElement;- const lengthValue = popup.querySelector('#password-length-value') as HTMLSpanElement;- lengthSlider.value = lengthToSlider(currentPasswordSettings.Length).toString();- lengthValue.textContent = currentPasswordSettings.Length.toString();-- // Generate initial password after settings are loaded- void generatePassword();- });-- /**- * Generate and set password.- */- const generatePassword = async () : Promise<void> => {- if (!passwordSettingsLoaded) {- return;- }-- passwordPreview.value = await generatePasswordFromSettings(currentPasswordSettings);- passwordPreview.type = 'text';- passwordPreview.dataset.isGenerated = 'true';- updateVisibilityIcon(true);- };-- // Handle regenerate button click- regenerateBtn.addEventListener('click', () => void generatePassword());-- // Handle password length slider- const lengthSlider = popup.querySelector('#password-length-slider') as HTMLInputElement;- const lengthValue = popup.querySelector('#password-length-value') as HTMLSpanElement;-- lengthSlider.addEventListener('input', () => {- const sliderValue = parseFloat(lengthSlider.value);- const newLength = sliderToLength(sliderValue);- currentPasswordSettings.Length = newLength;- lengthValue.textContent = newLength.toString();-- // Regenerate password with new settings- void generatePassword();- });-- // Handle advanced configuration button- const configBtn = popup.querySelector('#password-config-btn') as HTMLButtonElement;- configBtn.addEventListener('click', () => {- showPasswordConfigDialog();- });-- // Add password visibility toggle functionality- const passwordInput = popup.querySelector('#password-preview') as HTMLInputElement;-- /**- * Toggle password visibility icon- */- const updateVisibilityIcon = (isVisible: boolean): void => {- toggleVisibilityBtn.innerHTML = isVisible ? `- <svg class="av-icon" viewBox="0 0 24 24">- <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>- <circle cx="12" cy="12" r="3"></circle>- </svg>- ` : `- <svg class="av-icon" viewBox="0 0 24 24">- <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path>- <line x1="1" y1="1" x2="23" y2="23"></line>- </svg>- `;- };-- /**- * Toggle password visibility- */- const togglePasswordVisibility = (): void => {- const isVisible = passwordInput.type === 'text';- passwordInput.type = isVisible ? 'password' : 'text';- updateVisibilityIcon(!isVisible);- };-- toggleVisibilityBtn.addEventListener('click', togglePasswordVisibility);-- /**- * Show password configuration dialog- */- const showPasswordConfigDialog = async (): Promise<void> => {- // Get all translations first- const changePasswordComplexityText = await t('items.changePasswordComplexity');- const generateNewPreviewText = await t('common.generate');- const includeLowercaseText = await t('items.includeLowercase');- const includeUppercaseText = await t('items.includeUppercase');- const includeNumbersText = await t('items.includeNumbers');- const includeSpecialCharsText = await t('items.includeSpecialChars');- const avoidAmbiguousCharsText = await t('items.avoidAmbiguousChars');- const useText = await t('common.use');-- // Create dialog overlay- const dialogOverlay = document.createElement('div');- dialogOverlay.className = 'av-password-config-overlay';-- const dialog = document.createElement('div');- dialog.className = 'av-password-config-dialog';-- dialog.innerHTML = `- <div class="av-password-config-header">- <h3>${changePasswordComplexityText}</h3>- <button class="av-password-config-close">- <svg class="av-icon" viewBox="0 0 24 24">- <path d="M6 18L18 6M6 6l12 12"/>- </svg>- </button>- </div>-- <div class="av-password-config-content">- <div class="av-password-preview-section">- <input type="text" id="config-preview" class="av-password-config-preview" readonly>- <button id="config-refresh" class="av-password-config-refresh" title="${generateNewPreviewText}">- <svg class="av-icon" viewBox="0 0 24 24">- <path d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path>- </svg>- </button>- </div>-- <div class="av-password-config-options">- <div class="av-password-config-toggles">- <button class="av-password-config-toggle ${currentPasswordSettings.UseLowercase ? 'active' : ''}" data-setting="UseLowercase" title="${includeLowercaseText}">- <span>a-z</span>- </button>- <button class="av-password-config-toggle ${currentPasswordSettings.UseUppercase ? 'active' : ''}" data-setting="UseUppercase" title="${includeUppercaseText}">- <span>A-Z</span>- </button>- <button class="av-password-config-toggle ${currentPasswordSettings.UseNumbers ? 'active' : ''}" data-setting="UseNumbers" title="${includeNumbersText}">- <span>0-9</span>- </button>- <button class="av-password-config-toggle ${currentPasswordSettings.UseSpecialChars ? 'active' : ''}" data-setting="UseSpecialChars" title="${includeSpecialCharsText}">- <span>!@#</span>- </button>- </div>-- <div class="av-password-config-checkbox">- <label>- <input type="checkbox" id="avoid-ambiguous" ${currentPasswordSettings.UseNonAmbiguousChars ? 'checked' : ''}>- <span>${avoidAmbiguousCharsText}</span>- </label>- </div>- </div>-- <div class="av-password-config-actions">- <button id="config-use-btn" class="av-password-config-use">- <svg class="av-icon" viewBox="0 0 24 24">- <path d="M15 13l-3 3m0 0l-3-3m3 3V8m0 13a9 9 0 110-18 9 9 0 010 18z"/>- </svg>- ${useText}- </button>- </div>- </div>- `;-- dialogOverlay.appendChild(dialog);- popup.appendChild(dialogOverlay);-- // Generate initial preview- const configPreview = dialog.querySelector('#config-preview') as HTMLInputElement;- /**- * Update the config preview.- */- const updateConfigPreview = async (): Promise<void> => {- configPreview.value = await generatePasswordFromSettings(currentPasswordSettings);- };- void updateConfigPreview();-- // Handle toggle buttons- dialog.querySelectorAll('.av-password-config-toggle').forEach(toggle => {- toggle.addEventListener('click', () => {- const setting = (toggle as HTMLElement).dataset.setting;- if (setting) {- switch (setting) {- case 'UseLowercase':- currentPasswordSettings.UseLowercase = !currentPasswordSettings.UseLowercase;- toggle.classList.toggle('active', currentPasswordSettings.UseLowercase);- break;- case 'UseUppercase':- currentPasswordSettings.UseUppercase = !currentPasswordSettings.UseUppercase;- toggle.classList.toggle('active', currentPasswordSettings.UseUppercase);- break;- case 'UseNumbers':- currentPasswordSettings.UseNumbers = !currentPasswordSettings.UseNumbers;- toggle.classList.toggle('active', currentPasswordSettings.UseNumbers);- break;- case 'UseSpecialChars':- currentPasswordSettings.UseSpecialChars = !currentPasswordSettings.UseSpecialChars;- toggle.classList.toggle('active', currentPasswordSettings.UseSpecialChars);- break;- }- void updateConfigPreview();- }- });- });-- // Handle checkbox- const avoidAmbiguousCheckbox = dialog.querySelector('#avoid-ambiguous') as HTMLInputElement;- avoidAmbiguousCheckbox.addEventListener('change', () => {- currentPasswordSettings.UseNonAmbiguousChars = avoidAmbiguousCheckbox.checked;- void updateConfigPreview();- });-- // Handle refresh button- const refreshBtn = dialog.querySelector('#config-refresh') as HTMLButtonElement;- refreshBtn.addEventListener('click', () => void updateConfigPreview());-- // Handle use button- const useBtn = dialog.querySelector('#config-use-btn') as HTMLButtonElement;- useBtn.addEventListener('click', () => {- passwordPreview.value = configPreview.value;- passwordPreview.type = 'text';- passwordPreview.dataset.isGenerated = 'true';- updateVisibilityIcon(true);-- // Update slider value- lengthSlider.value = lengthToSlider(currentPasswordSettings.Length).toString();- lengthValue.textContent = currentPasswordSettings.Length.toString();-- // Close dialog- dialogOverlay.remove();- });-- // Handle close button- const closeBtn = dialog.querySelector('.av-password-config-close') as HTMLButtonElement;- closeBtn.addEventListener('click', () => {- dialogOverlay.remove();- });-- // Handle click outside to close- dialogOverlay.addEventListener('click', (e) => {- if (e.target === dialogOverlay) {- dialogOverlay.remove();- }- });- };-- /**- * Handle password input changes- */- const handlePasswordChange = (e: Event): void => {- const target = e.target as HTMLInputElement;- const isGenerated = target.dataset.isGenerated === 'true';- const isEmpty = target.value.trim().length <= 1;-- // If manually cleared (empty or single char) and was previously generated, switch to password type- if (isEmpty && isGenerated) {- target.type = 'password';- target.dataset.isGenerated = 'false';- updateVisibilityIcon(false);- }- };-- /**- * Handle paste events- */- const handlePasswordPaste = (): void => {- passwordInput.dataset.isGenerated = 'false';- passwordInput.type = 'password';- updateVisibilityIcon(false);- };-- passwordInput.addEventListener('input', handlePasswordChange);- passwordInput.addEventListener('paste', handlePasswordPaste);-- /**- * Toggle dropdown visibility.- */- const toggleDropdown = () : void => {- dropdownMenu.style.display = dropdownMenu.style.display === 'none' ? 'block' : 'none';- };-- // Make title container clickable to trigger the dropdown- titleContainer.addEventListener('click', (e) => {- e.stopPropagation();- toggleDropdown();- });-- // Close dropdown when clicking outside- document.addEventListener('click', (e) => {- if (!titleContainer.contains(e.target as Node) && !dropdownMenu.contains(e.target as Node)) {- dropdownMenu.style.display = 'none';- }- });-- // Handle mode option clicks- dropdownMenu.querySelectorAll('.av-create-popup-mode-option').forEach(option => {- option.addEventListener('click', () => {- const mode = (option as HTMLElement).dataset.mode;- const titleWrapper = popup.querySelector('.av-create-popup-title-wrapper') as HTMLElement;- if (mode === 'random') {- titleWrapper.innerHTML = `- ${randomIdentityIcon}- <h3 class="av-create-popup-title">${randomIdentityTitle}</h3>- `;- popup.querySelector('.av-create-popup-help-text')!.textContent = randomIdentitySubtext;- randomMode.style.display = 'block';- customMode.style.display = 'none';- } else if (mode === 'custom') {- titleWrapper.innerHTML = `- ${manualUsernamePasswordIcon}- <h3 class="av-create-popup-title">${manualUsernamePasswordTitle}</h3>- `;- popup.querySelector('.av-create-popup-help-text')!.textContent = manualUsernamePasswordSubtext;- randomMode.style.display = 'none';- customMode.style.display = 'block';- }- dropdownMenu.style.display = 'none';- });- });-- /**- * Close the popup.- */- const closePopup = (value: { serviceName: string | null, isCustomCredential: boolean, customEmail?: string, customUsername?: string, customPassword?: string } | null) : void => {- popup.classList.remove('show');- setTimeout(() => {- overlay.remove();- resolve(value);- }, 200);- };-- // Handle save buttons- saveBtn.addEventListener('click', () => {- const serviceName = inputServiceName.value.trim();- if (serviceName) {- closePopup({- serviceName,- isCustomCredential: false- });- }- });-- /**- * Handle custom save button click.- */- const handleCustomSave = async () : Promise<void> => {- const serviceName = inputServiceName.value.trim();- if (serviceName) {- const email = customEmail.value.trim();- const username = customUsername.value.trim();- const finalEmail = email;- const finalUsername = username;-- if (!finalEmail && !finalUsername) {- // Add error styling to fields- customEmail.classList.add('av-create-popup-input-error');- customUsername.classList.add('av-create-popup-input-error');-- // Add error messages after labels- const emailLabel = customEmail.previousElementSibling as HTMLLabelElement;- const usernameLabel = customUsername.previousElementSibling as HTMLLabelElement;-- if (!emailLabel.querySelector('.av-create-popup-error-text')) {- const emailError = document.createElement('span');- emailError.className = 'av-create-popup-error-text';- emailError.textContent = await t('content.enterEmailAndOrUsername');- emailLabel.appendChild(emailError);- }-- if (!usernameLabel.querySelector('.av-create-popup-error-text')) {- const usernameError = document.createElement('span');- usernameError.className = 'av-create-popup-error-text';- usernameError.textContent = await t('content.enterEmailAndOrUsername');- usernameLabel.appendChild(usernameError);- }-- /**- * Remove error styling.- */- const removeError = () : void => {- customEmail.classList.remove('av-create-popup-input-error');- customUsername.classList.remove('av-create-popup-input-error');- const emailError = emailLabel.querySelector('.av-create-popup-error-text');- const usernameError = usernameLabel.querySelector('.av-create-popup-error-text');- if (emailError) {- emailError.remove();- }- if (usernameError) {- usernameError.remove();- }- };-- customEmail.addEventListener('input', removeError, { once: true });- customUsername.addEventListener('input', removeError, { once: true });-- return;- }-- // Update history when saving- if (finalEmail) {- await updateHistory(finalEmail, 'email');- }- if (finalUsername) {- await updateHistory(finalUsername, 'username');- }-- closePopup({- serviceName,- isCustomCredential: true,- customEmail: finalEmail,- customUsername: finalUsername,- customPassword: passwordPreview.value- });- }- }-- customSaveBtn.addEventListener('click', handleCustomSave);-- /**- * Handle custom form input enter key press to submit the form.- */- const handleCustomEnter = (e: KeyboardEvent) : void => {- if (e.key === 'Enter') {- handleCustomSave();- }- };-- inputServiceName.addEventListener('keyup', handleCustomEnter);- customEmail.addEventListener('keyup', handleCustomEnter);- customUsername.addEventListener('keyup', handleCustomEnter);- passwordPreview.addEventListener('keyup', handleCustomEnter);-- // Handle cancel buttons- cancelBtn.addEventListener('click', () => {- closePopup(null);- });-- customCancelBtn.addEventListener('click', () => {- closePopup(null);- });-- // Handle Enter key- inputServiceName.addEventListener('keyup', (e) => {- if (e.key === 'Enter') {- const serviceName = inputServiceName.value.trim();- if (serviceName) {- closePopup({- serviceName,- isCustomCredential: false- });- }- }- });-- /**- * Handle click outside.- */- const handleClickOutside = (event: MouseEvent): void => {- const target = event.target as Node;- if (target === overlay) {- closePopup(null);- }- };-- // Use mousedown instead of click to prevent closing when dragging text- overlay.addEventListener('mousedown', handleClickOutside);-- /**- * Handle suggested name click.- */- const handleSuggestedNameClick = async (e: Event) : Promise<void> => {- const target = e.target as HTMLElement;- if (target.classList.contains('av-suggested-name')) {- const name = target.dataset.name;- if (name) {- // Update the service name input- inputServiceName.value = name;-- // Update the suggested names section- const suggestedNamesContainer = target.closest('.av-suggested-names') as HTMLElement;- if (suggestedNamesContainer) {- await populateSuggestedNames(suggestedNamesContainer, suggestedNames, name);- }- }- }- };-- popup.addEventListener('click', handleSuggestedNameClick);-- // Focus the input field- inputServiceName.select();- })();- });-}--/**- * Populate a suggested names container using safe DOM methods.- */-async function populateSuggestedNames(container: HTMLElement, suggestedNames: string[], currentValue: string): Promise<void> {- // Filter out the current value and create unique set of remaining suggestions- const filteredSuggestions = [...new Set(suggestedNames.filter(n => n !== currentValue))];-- // Clear existing content- container.textContent = '';-- if (filteredSuggestions.length === 0) {- return;- }-- const orLabel = await t('content.or');-- // Add "or" label as text node- container.appendChild(document.createTextNode(orLabel + ' '));-- // Add each suggestion- filteredSuggestions.forEach((name, index) => {- container.appendChild(createSuggestedNameSpan(name));- if (index < filteredSuggestions.length - 1) {- container.appendChild(document.createTextNode(', '));- }- });-- container.appendChild(document.createTextNode('?'));-}--/**- * Get favicon bytes from page and resize if necessary.- * Uses the shared FaviconExtractor utility for consistent favicon URL extraction.- */-async function getFaviconBytes(doc: Document): Promise<Uint8Array | null> {- const MAX_SIZE_BYTES = 50 * 1024; // 50KB max size before resizing- const TARGET_WIDTH = 96; // Resize target width-- // Use shared utility for consistent favicon extraction across the extension- const faviconLinks = getAllFaviconLinks(doc);-- for (const link of faviconLinks) {- const imageData = await fetchAndProcessFavicon(link.href, MAX_SIZE_BYTES, TARGET_WIDTH);- if (imageData) {- return imageData;- }- }-- return null;-}--/**- * Attempt to fetch and process a favicon from a given URL- */-async function fetchAndProcessFavicon(url: string, maxSize: number, targetWidth: number): Promise<Uint8Array | null> {- try {- const response = await fetch(url);- if (!response.ok) {- return null;- }-- const contentType = response.headers.get('content-type');- if (!contentType?.startsWith('image/')) {- return null;- }-- const arrayBuffer = await response.arrayBuffer();- if (arrayBuffer.byteLength === 0) {- return null;- }-- let imageData = new Uint8Array(arrayBuffer);-- // If image is too large, attempt to resize- if (imageData.byteLength > maxSize) {- const resizedBlob = await resizeImage(imageData, contentType, targetWidth);- if (resizedBlob) {- imageData = new Uint8Array(await resizedBlob.arrayBuffer());- }- }-- // Return only if within size limits- return imageData.byteLength <= maxSize ? imageData : null;- } catch (error) {- console.error('Error fetching favicon:', url, error);- return null;- }-}--/**- * Resizes an image using OffscreenCanvas and compresses it.- */-async function resizeImage(imageData: Uint8Array, contentType: string, targetWidth: number): Promise<Blob | null> {- return new Promise((resolve) => {- // Convert Uint8Array to ArrayBuffer to ensure compatibility with Blob- const arrayBuffer = imageData.buffer.slice(- imageData.byteOffset,- imageData.byteOffset + imageData.byteLength- ) as ArrayBuffer; // Assert as ArrayBuffer to ensure type compatibility- const blob = new Blob([arrayBuffer], { type: contentType });- const img = new Image();-- /**- * Handle image load.- */- img.onload = () : void => {- const scale = targetWidth / img.width;- const targetHeight = Math.floor(img.height * scale);-- const canvas = new OffscreenCanvas(targetWidth, targetHeight);- const ctx = canvas.getContext("2d");-- if (!ctx) {- resolve(null);- return;- }-- ctx.drawImage(img, 0, 0, targetWidth, targetHeight);- canvas.convertToBlob({ type: "image/png", quality: 0.7 }).then(resolve).catch(() => resolve(null));- };-- /**- * Handle image load error.- */- img.onerror = () : void => {- resolve(null);- };-- img.src = URL.createObjectURL(blob);- });-}-/*** Dismiss vault locked popup for 4 hours if user is logged in, or for 3 days if user is not logged in.*/@@ -2667,35 +1541,6 @@ export async function dismissVaultLockedPopup(): Promise<void> {}}-/**- * Get a valid service URL from the current page.- */-function getValidServiceUrl(): string {- try {- // Check if we're in an iframe with invalid/null source- if (window !== window.top && (!window.location.href || window.location.href === 'about:srcdoc')) {- return '';- }-- const url = new URL(window.location.href);-- // Validate the domain/origin- if (!url.origin || url.origin === 'null' || !url.hostname) {- return '';- }-- // Check for valid protocol (only http/https)- if (!(/^https?:$/).exec(url.protocol)) {- return '';- }-- return url.origin + url.pathname;- } catch (error) {- console.debug('Error validating service URL:', error);- return '';- }-}-/*** Add click handler with mousedown/mouseup backup for better click reliability in shadow DOM.* Now includes optional security validation.diff --git a/apps/browser-extension/src/entrypoints/popup/hooks/useServiceDetection.ts b/apps/browser-extension/src/entrypoints/popup/hooks/useServiceDetection.tsindex 6bd2a4624..5c06ce5c9 100644--- a/apps/browser-extension/src/entrypoints/popup/hooks/useServiceDetection.ts+++ b/apps/browser-extension/src/entrypoints/popup/hooks/useServiceDetection.ts@@ -13,13 +13,15 @@ type ServiceDetectionResult = {serviceName: string;/** Detected service URL (origin + pathname) */serviceUrl: string;+ /** Alternative service name suggestions derived from the page title/domain */+ suggestedNames: string[];};/*** Hook for detecting service information from URL parameters or the active browser tab.** Service detection sources (in priority order):- * 1. URL parameters (serviceName, serviceUrl, currentUrl) - e.g., from content script popout+ * 1. URL parameters (serviceUrl, currentUrl) + the provided title - e.g., from the content script create flow* 2. Active browser tab - for dashboard/popup opened directly*/const useServiceDetection = (): {@@ -36,28 +38,27 @@ const useServiceDetection = (): {const detectService = useCallback(async (fallbackName?: string | null): Promise<ServiceDetectionResult> => {let detectedName = fallbackName || '';let detectedUrl = '';+ let suggestedNames: string[] = [];try {- // Get URL parameters (e.g., from content script popout)- const serviceNameFromUrl = searchParams.get('serviceName');+ // Get URL parameters (e.g., from content script create flow)const serviceUrlFromUrl = searchParams.get('serviceUrl');const currentUrl = searchParams.get('currentUrl');// If URL parameters are present, use them- if (serviceNameFromUrl || serviceUrlFromUrl || currentUrl) {- if (serviceNameFromUrl) {- detectedName = decodeURIComponent(serviceNameFromUrl);- }+ if (serviceUrlFromUrl || currentUrl) {if (serviceUrlFromUrl) {detectedUrl = decodeURIComponent(serviceUrlFromUrl);}- // If we have currentUrl but missing serviceName or serviceUrl, derive them- if (currentUrl && (!serviceNameFromUrl || !serviceUrlFromUrl)) {+ // If we have currentUrl, derive url/suggestions from it (and a name only as a fallback)+ if (currentUrl) {const decodedCurrentUrl = decodeURIComponent(currentUrl);const serviceInfo: ServiceInfo = ServiceDetectionUtility.getServiceInfoFromTab(decodedCurrentUrl);+ suggestedNames = serviceInfo.suggestedNames;- if (!serviceNameFromUrl && serviceInfo.suggestedNames.length > 0) {+ // Only fall back to a URL-derived name when no explicit title was provided.+ if (!detectedName && serviceInfo.suggestedNames.length > 0) {detectedName = serviceInfo.suggestedNames[0];}if (!serviceUrlFromUrl && serviceInfo.serviceUrl) {@@ -73,6 +74,7 @@ const useServiceDetection = (): {activeTab.url,activeTab.title);+ suggestedNames = serviceInfo.suggestedNames;if (serviceInfo.suggestedNames.length > 0 && !detectedName) {detectedName = serviceInfo.suggestedNames[0];@@ -89,6 +91,7 @@ const useServiceDetection = (): {return {serviceName: detectedName,serviceUrl: detectedUrl,+ suggestedNames,};}, [searchParams]);diff --git a/apps/browser-extension/src/entrypoints/popup/pages/items/ItemAddEdit.tsx b/apps/browser-extension/src/entrypoints/popup/pages/items/ItemAddEdit.tsxindex b595ff9a7..cb8c8f05c 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/items/ItemAddEdit.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/items/ItemAddEdit.tsx@@ -34,6 +34,9 @@ import type { Item, ItemField, ItemType, FieldType, Attachment, TotpCode, Passwoimport { FieldCategories, FieldTypes, ItemTypes, getSystemFieldsForItemType, getOptionalFieldsForItemType, isFieldShownByDefault, getSystemField, fieldAppliesToType } from '@/utils/dist/core/models/vault';import { FaviconService } from '@/utils/FaviconService';import { LocalPreferencesService } from '@/utils/LocalPreferencesService';+import { sendMessage } from '@/utils/messaging/ExtensionMessaging';++import { browser } from '#imports';// Valid item types from the shared modelconst VALID_ITEM_TYPES: ItemType[] = [ItemTypes.Login, ItemTypes.Alias, ItemTypes.CreditCard, ItemTypes.Note];@@ -76,11 +79,14 @@ const ItemAddEdit: React.FC = () => {const dbContext = useDb();const isEditMode = id !== undefined && id.length > 0;- // Get item type, name, and folder from URL parameters (for create mode)+ // Get item type, title, and folder from URL parameters (for create mode)const itemTypeParam = searchParams.get('type') as ItemType | null;- const itemNameParam = searchParams.get('name');+ const itemTitleParam = searchParams.get('itemTitle');const folderIdParam = searchParams.get('folderId');+ const sourceTabIdParam = searchParams.get('sourceTabId');+ const fillBackElementIdentifier = searchParams.get('elementIdentifier');+const { executeVaultMutationAsync } = useVaultMutate();const { setHeaderButtons, setBackButtonTitle } = useHeaderButtons();const { setIsInitialLoading } = useLoading();@@ -103,6 +109,9 @@ const ItemAddEdit: React.FC = () => {// Folder selection stateconst [folders, setFolders] = useState<Array<{ Id: string; Name: string }>>([]);+ // Alternative service-name suggestions (create mode) derived from the page title/domain.+ const [suggestedNames, setSuggestedNames] = useState<string[]>([]);+// UI visibility stateconst [showTypeDropdown, setShowTypeDropdown] = useState(false);const [show2FA, setShow2FA] = useState(false);@@ -333,8 +342,9 @@ const ItemAddEdit: React.FC = () => {* Initialize create mode with service detection from URL params or active tab.*/const initializeCreateMode = async (): Promise<void> => {- // Use the service detection hook to get name and URL- const { serviceName, serviceUrl } = await detectService(itemNameParam);+ // Use the service detection hook to get name, URL and alternative name suggestions+ const { serviceName, serviceUrl, suggestedNames: detectedSuggestedNames } = await detectService(itemTitleParam);+ setSuggestedNames(detectedSuggestedNames);// Create the new item with detected valuesconst newItem: Item = {@@ -480,7 +490,7 @@ const ItemAddEdit: React.FC = () => {};void initializeEditMode();- }, [dbContext?.sqliteClient, id, isEditMode, itemTypeParam, itemNameParam, folderIdParam, navigate, setIsInitialLoading, detectService, loadPersistedValues]);+ }, [dbContext?.sqliteClient, id, isEditMode, itemTypeParam, itemTitleParam, folderIdParam, navigate, setIsInitialLoading, detectService, loadPersistedValues]);/*** Handle generating alias and populating fields.@@ -653,6 +663,47 @@ const ItemAddEdit: React.FC = () => {}));}, []);+ /**+ * After creating a credential from a page's "create new item" flow, autofill the freshly+ * created item back into the originating tab and close this popup window. Returns true when the+ * fill-back path handled the post-save behaviour (so the caller should skip normal navigation).+ */+ const fillBackAndCloseWindow = useCallback(async (savedItem: Item): Promise<boolean> => {+ if (isEditMode || !sourceTabIdParam) {+ return false;+ }++ const tabId = Number(sourceTabIdParam);+ if (!Number.isInteger(tabId)) {+ return false;+ }++ try {+ // Strip the binary logo before sending as its not used by autofill and prevents message serialization errors.+ const fillPayload = JSON.parse(JSON.stringify({ ...savedItem, Logo: undefined }));+ await sendMessage('AUTOFILL_CREATED_ITEM', {+ item: fillPayload,+ elementIdentifier: fillBackElementIdentifier ?? undefined+ }, tabId);+ } catch (err) {+ console.error('Error autofilling created item into page:', err);+ }++ // Close this popup window (it was opened as a standalone window from the content script).+ try {+ const currentWindow = await browser.windows.getCurrent();+ if (currentWindow.id !== undefined) {+ await browser.windows.remove(currentWindow.id);+ } else {+ window.close();+ }+ } catch {+ window.close();+ }++ return true;+ }, [isEditMode, sourceTabIdParam, fillBackElementIdentifier]);+/*** Handle form submission.*/@@ -775,6 +826,14 @@ const ItemAddEdit: React.FC = () => {// Clear persisted form values after successful saveawait clearPersistedValues();+ /*+ * If this create was launched from a page's "create new item" flow, autofill the new+ * credential back into the originating tab and close this window instead of navigating.+ */+ if (await fillBackAndCloseWindow(updatedItem)) {+ return;+ }+/** Navigate after save:* - Edit mode and came from details: navigate(-1) so back from details goes to list (no duplicate details).@@ -790,7 +849,7 @@ const ItemAddEdit: React.FC = () => {console.error('Error saving item:', err);setIsSaving(false);}- }, [item, isSaving, fieldValues, applicableSystemFields, customFields, dbContext, isEditMode, executeVaultMutationAsync, navigate, location.state, originalAttachmentIds, attachments, originalTotpCodeIds, totpCodes, passkeyIdsMarkedForDeletion, webApi, clearPersistedValues]);+ }, [item, isSaving, fieldValues, applicableSystemFields, customFields, dbContext, isEditMode, executeVaultMutationAsync, navigate, location.state, originalAttachmentIds, attachments, originalTotpCodeIds, totpCodes, passkeyIdsMarkedForDeletion, webApi, clearPersistedValues, fillBackAndCloseWindow]);/*** Handle delete action.@@ -1322,6 +1381,28 @@ const ItemAddEdit: React.FC = () => {selectedFolderId={item.FolderId}onFolderChange={(folderId) => setItem({ ...item, FolderId: folderId })}/>+ {/* Alternative item title suggestions (create mode) */}+ {!isEditMode && ((): React.ReactNode => {+ const nameSuggestions = suggestedNames.filter(name => name && name !== item.Name).slice(0, 3);+ if (nameSuggestions.length === 0) {+ return null;+ }+ return (+ <div className="mt-2 flex flex-wrap items-center gap-1.5">+ <span className="text-xs text-gray-500 dark:text-gray-400">{t('items.suggestions')}:</span>+ {nameSuggestions.map(name => (+ <button+ key={name}+ type="button"+ onClick={() => setItem(prev => prev ? { ...prev, Name: name } : prev)}+ className="px-2 py-0.5 text-xs rounded-full bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-primary-100 dark:hover:bg-primary-900/40 hover:text-primary-700 dark:hover:text-primary-300 transition-colors"+ >+ {name}+ </button>+ ))}+ </div>+ );+ })()}{/* Primary fields (like URL) shown below name */}{primaryFields.map(field => (<div key={field.FieldKey}>diff --git a/apps/browser-extension/src/entrypoints/popup/pages/items/ItemTypeSelector.tsx b/apps/browser-extension/src/entrypoints/popup/pages/items/ItemTypeSelector.tsxindex e8abcfe98..f908892c7 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/items/ItemTypeSelector.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/items/ItemTypeSelector.tsx@@ -84,7 +84,7 @@ const ItemTypeSelector: React.FC = () => {const params = new URLSearchParams();params.set('type', selectedType);if (itemName.trim()) {- params.set('name', itemName.trim());+ params.set('itemTitle', itemName.trim());}navigate(`/items/add?${params.toString()}`);}, [selectedType, itemName, navigate]);diff --git a/apps/browser-extension/src/i18n/locales/en.json b/apps/browser-extension/src/i18n/locales/en.jsonindex 9b432c9c5..cbce7c43f 100644--- a/apps/browser-extension/src/i18n/locales/en.json+++ b/apps/browser-extension/src/i18n/locales/en.json@@ -189,6 +189,7 @@"items": {"title": "Items","itemName": "Name",+ "suggestions": "Suggestions","loginCredentials": "Login Credentials","cardInformation": "Card Information","addItem": "Add Item",diff --git a/apps/browser-extension/src/utils/messaging/ExtensionMessaging.ts b/apps/browser-extension/src/utils/messaging/ExtensionMessaging.tsindex 708f6d0ac..445525bf2 100644--- a/apps/browser-extension/src/utils/messaging/ExtensionMessaging.ts+++ b/apps/browser-extension/src/utils/messaging/ExtensionMessaging.ts@@ -32,7 +32,8 @@ import type { VaultUploadResponse } from '@/utils/types/messaging/VaultUploadRes* the response shape (promises are unwrapped automatically by the library).*/export interface IExtensionMessageProtocol {- ADD_URL_TO_CREDENTIAL(data: { itemId: string; url: string }): { success: boolean; error?: string };+ ADD_URL_TO_CREDENTIAL(data: { itemId: string; url: string }): { success: boolean; error?: string };+ AUTOFILL_CREATED_ITEM(data: { item: any; elementIdentifier?: string }): BoolResponse;CANCEL_CLIPBOARD_CLEAR(): void;CHECK_AUTH_STATUS(): { isLoggedIn: boolean; isVaultLocked: boolean; hasPendingMigrations: boolean; error?: string };CHECK_LOGIN_DUPLICATE(data: { domain: string; username: string }): DuplicateCheckResponse;@@ -48,7 +49,6 @@ export interface IExtensionMessageProtocol {CLIPBOARD_COPIED_FROM_CONTEXT(): void;CLIPBOARD_COUNTDOWN(data: { remaining: number; total: number; id: number }): void;CLIPBOARD_COUNTDOWN_CANCELLED(data: Record<string, never>): void;- CREATE_ITEM(data: any): BoolResponse;FULL_VAULT_SYNC(): FullVaultSyncResult;GENERATE_PASSWORD(data: { settings: PasswordSettings }): { success: boolean; password?: string; error?: string };GENERATE_TOTP_CODE(data: { itemId: string }): { success: boolean; code?: string; error?: string };@@ -81,7 +81,7 @@ export interface IExtensionMessageProtocol {MARK_VAULT_CLEAN(data: { mutationSeqAtStart: number; newServerRevision: number }): { cleared: boolean; currentMutationSeq: number };OPEN_AUTOFILL_POPUP(data: { elementIdentifier: string; popupType?: string }): BoolResponse;OPEN_POPUP(): BoolResponse;- OPEN_POPUP_CREATE_CREDENTIAL(data: any): BoolResponse;+ OPEN_POPUP_CREATE_CREDENTIAL(data: { itemTitle?: string; currentUrl?: string; elementIdentifier?: string; left?: number; top?: number }): BoolResponse;OPEN_POPUP_WITH_ITEM(data: any): BoolResponse;PASSKEY_POPUP_RESPONSE(data: any): { success: boolean };PERSIST_FORM_VALUES(data: any): void;