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:
@@ -11,6 +11,7 @@ import { createGitHost, base64ToUint8Array } from '../git-host';
|
||||
import * as vault from '../vault';
|
||||
import * as session from '../session';
|
||||
import * as devices from '../devices';
|
||||
import * as sessionTimer from '../session-timer';
|
||||
|
||||
// --- Shared ambient state owned by the SW module ---
|
||||
//
|
||||
@@ -353,6 +354,16 @@ export async function handle(
|
||||
const history = state.wasm.get_field_history(JSON.stringify(item));
|
||||
return { ok: true, data: { history } };
|
||||
}
|
||||
|
||||
case 'get_session_config':
|
||||
return { ok: true, data: { config: sessionTimer.getConfig() } };
|
||||
|
||||
case 'update_session_config': {
|
||||
sessionTimer.setConfig(msg.config);
|
||||
sessionTimer.resetTimer();
|
||||
await chrome.storage.local.set({ sessionTimeoutConfig: msg.config });
|
||||
return { ok: true };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user