feat(ext): sync now button + device register from popup; vault tab parity
Closes three audit gaps in one pass: 1. Sync now button in the popup settings view (📤). Triggers the existing { type: 'sync' } SW message and surfaces success / failure inline. The SW message was already wired but had no UI entry point. 2. Device registration from the popup. The "Register this device" button on the devices view used to error out with a "not yet implemented" message; it now opens an inline name input (default = browser+OS), and on confirm sends a new register_this_device SW message that generates an ed25519 keypair via WASM, persists private_key + name to chrome.storage.local, and writes the public key to the remote devices.json. No setup-wizard detour. 3. Vault tab is now an authorized sender for popup-only SW messages. The router accepts vault.html alongside popup.html, so the fullscreen tab can drive the same flows. Test covers acceptance from the vault tab. New SW message: register_this_device { name }. Added to PopupMessage and POPUP_ONLY_TYPES, handled in router/popup-only.ts. Tests: 5 new vitest cases (3 in settings.test.ts, 2 in devices.test.ts) + 1 router test for vault-tab acceptance. All 194 extension tests pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,7 @@ export type PopupMessage =
|
||||
| { type: 'download_attachment'; itemId: string; attachmentId: string }
|
||||
| { type: 'list_devices' }
|
||||
| { type: 'add_device'; name: string; public_key: string }
|
||||
| { type: 'register_this_device'; name: string }
|
||||
| { type: 'revoke_device'; name: string }
|
||||
| { type: 'list_trashed' }
|
||||
| { type: 'restore_item'; id: ItemId }
|
||||
@@ -148,7 +149,7 @@ export const POPUP_ONLY_TYPES: ReadonlySet<PopupMessage['type']> = new Set([
|
||||
'ack_autofill_origin', 'get_settings', 'update_settings',
|
||||
'get_vault_settings', 'update_vault_settings', 'get_blacklist',
|
||||
'remove_blacklist', 'upload_attachment', 'download_attachment',
|
||||
'list_devices', 'add_device', 'revoke_device',
|
||||
'list_devices', 'add_device', 'register_this_device', 'revoke_device',
|
||||
'list_trashed', 'restore_item', 'purge_item', 'purge_all_trash',
|
||||
'get_field_history',
|
||||
'get_session_config', 'update_session_config',
|
||||
|
||||
Reference in New Issue
Block a user