mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 04:47:03 -06:00
fix(gateway): restore revokeAttachGrantsForSession used by cloud-workers
#106332 landed using revokeAttachGrantsForSession after #106038 removed it
as dead, breaking prod-types compile on every PR merge ref. Restores the
helper verbatim from 2deb696ef4 with a doc comment.
This commit is contained in:
@@ -122,6 +122,19 @@ export function revokeAttachGrant(token: string): boolean {
|
||||
return grantsByToken.delete(token);
|
||||
}
|
||||
|
||||
/** Revokes every attach grant minted for one session. Returns the count removed. */
|
||||
export function revokeAttachGrantsForSession(sessionKey: string): number {
|
||||
const key = sessionKey.trim();
|
||||
let removed = 0;
|
||||
for (const [token, grant] of grantsByToken) {
|
||||
if (grant.sessionKey === key) {
|
||||
grantsByToken.delete(token);
|
||||
removed += 1;
|
||||
}
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
function sweepExpiredAttachGrants(nowMs: number = Date.now()): number {
|
||||
let removed = 0;
|
||||
for (const [token, grant] of grantsByToken) {
|
||||
|
||||
Reference in New Issue
Block a user