From d35faf1c93ec9f624e308e1d160228b21c52ea8a Mon Sep 17 00:00:00 2001 From: Padreug Date: Sat, 15 Aug 2026 12:30:45 +0200 Subject: [PATCH] feat(access): add End Session button to re-lock a tap-in session A Bolt Card tap loads the holder's card for the whole session, so an unattended idle menu is transactable by the next person until the 60s IDLE_LOCK_TIMEOUT fires. Give the holder an explicit re-lock: - END_SESSION event on `idle`, guarded to the active gate, targets `locked` (whose entry already clears the access session + loaded card). No-op on a gate-disabled machine that rests at idle. - endSession() store action; IdleView shows a destructive-styled "End Session" button top-right only while accessControl.enabled. - Tests: END_SESSION re-locks when the gate is active; no-op when off. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_018ivBosaWmv8vwFE7ejrdHW --- apps/machine/src/stores/atm.ts | 10 ++++++++++ apps/machine/src/views/IdleView.vue | 15 +++++++++++++++ .../src/__tests__/access-control.test.ts | 19 +++++++++++++++++++ packages/state-machine/src/machine.ts | 5 +++++ packages/state-machine/src/types.ts | 4 ++++ 5 files changed, 53 insertions(+) diff --git a/apps/machine/src/stores/atm.ts b/apps/machine/src/stores/atm.ts index a65f900..f1764e0 100644 --- a/apps/machine/src/stores/atm.ts +++ b/apps/machine/src/stores/atm.ts @@ -1639,6 +1639,15 @@ export const useAtmStore = defineStore('atm', () => { send({ type: 'DEV_UNLOCK' }) } + /** + * End the current tap-in session on demand and re-lock immediately (drops the + * loaded Bolt Card via `locked`'s entry), instead of waiting out the idle + * timeout. No-op unless the gate is active and we're on the idle menu. + */ + function endSession() { + send({ type: 'END_SESSION' }) + } + // Convenience methods for common events function selectCashIn() { send({ type: 'SELECT_CASH_IN' }) @@ -1799,6 +1808,7 @@ export const useAtmStore = defineStore('atm', () => { grantAccess, denyAccess, devUnlock, + endSession, // Actions initialize, diff --git a/apps/machine/src/views/IdleView.vue b/apps/machine/src/views/IdleView.vue index 3465cc1..a538ff2 100644 --- a/apps/machine/src/views/IdleView.vue +++ b/apps/machine/src/views/IdleView.vue @@ -183,6 +183,21 @@ function handleCashOut() { ? + + +