mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 12:37:40 +00:00
fix(gateway): clear pairing state on device token mismatch (#22071)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: ad38d1a529
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
This commit is contained in:
@@ -620,3 +620,16 @@ export async function revokeDeviceToken(params: {
|
||||
return entry;
|
||||
});
|
||||
}
|
||||
|
||||
export async function clearDevicePairing(deviceId: string, baseDir?: string): Promise<boolean> {
|
||||
return await withLock(async () => {
|
||||
const state = await loadState(baseDir);
|
||||
const normalizedId = normalizeDeviceId(deviceId);
|
||||
if (!state.pairedByDeviceId[normalizedId]) {
|
||||
return false;
|
||||
}
|
||||
delete state.pairedByDeviceId[normalizedId];
|
||||
await persistState(state, baseDir);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user