oclaw/uds-auth/lib/identity-cache.js
oliver 5b5c0a1418
Some checks are pending
ci / test (push) Waiting to run
ci / test-postgresql (push) Waiting to run
Bridge uds-auth session identity for Desktop dsh-app://.
Cookie-less Desktop needs localStorage bridge headers/WS params plus ALS enterWith and identity cache so login and history stay authenticated.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-09 22:46:37 +08:00

22 lines
569 B
JavaScript

/**
* Last verified browser identity (bridge or cookie).
* Desktop mux follow/history often runs with empty ALS; fall back here after
* a successful /uds-auth HTTP auth or WS upgrade bind.
*/
/** @type {object|null} */
let lastBrowserIdentity = null
export function rememberBrowserIdentity(identity) {
const emp = identity?.empNo || identity?.userContext?.empNo
if (!emp) return
lastBrowserIdentity = identity
}
export function clearBrowserIdentity() {
lastBrowserIdentity = null
}
export function peekBrowserIdentity() {
return lastBrowserIdentity
}