feat(ext/sw): add session inactivity timer with configurable timeout
Implements a service-worker-side session timer that locks the vault after a configurable period of inactivity (default 15 min). Supports two modes: 'inactivity' (timer-based) and 'every_time' (no timer). Config persists via chrome.storage.local and is exposed through get_session_config / update_session_config popup messages. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,12 @@ import type {
|
||||
FieldHistoryView,
|
||||
} from './types';
|
||||
|
||||
// --- Session timeout config ---
|
||||
|
||||
export type SessionTimeoutConfig =
|
||||
| { mode: 'inactivity'; minutes: number }
|
||||
| { mode: 'every_time' };
|
||||
|
||||
// --- Messages a popup (or setup page) may send ---
|
||||
|
||||
export type PopupMessage =
|
||||
@@ -39,7 +45,9 @@ export type PopupMessage =
|
||||
| { type: 'restore_item'; id: ItemId }
|
||||
| { type: 'purge_item'; id: ItemId }
|
||||
| { type: 'purge_all_trash' }
|
||||
| { type: 'get_field_history'; id: ItemId };
|
||||
| { type: 'get_field_history'; id: ItemId }
|
||||
| { type: 'get_session_config' }
|
||||
| { type: 'update_session_config'; config: SessionTimeoutConfig };
|
||||
|
||||
// --- Messages a content script may send ---
|
||||
|
||||
@@ -143,6 +151,7 @@ export const POPUP_ONLY_TYPES: ReadonlySet<PopupMessage['type']> = new Set([
|
||||
'list_devices', 'add_device', 'revoke_device',
|
||||
'list_trashed', 'restore_item', 'purge_item', 'purge_all_trash',
|
||||
'get_field_history',
|
||||
'get_session_config', 'update_session_config',
|
||||
] as PopupMessage['type'][]);
|
||||
|
||||
export const CONTENT_CALLABLE_TYPES: ReadonlySet<ContentMessage['type']> = new Set([
|
||||
|
||||
Reference in New Issue
Block a user