feat: wire role-scoped device creds

This commit is contained in:
Peter Steinberger committed 2026-01-20 13:04:19 +00:00
1 parent dfbf6ac263
commit d8cc7db5e6
17 files changed
+633 -26

No files matched your search

+19
View File
@@ -102,3 +102,22 @@ export function storeDeviceAuthToken(params: {
writeStore(filePath, next);
return entry;
}
export function clearDeviceAuthToken(params: {
deviceId: string;
role: string;
env?: NodeJS.ProcessEnv;
}): void {
const filePath = resolveDeviceAuthPath(params.env);
const store = readStore(filePath);
if (!store || store.deviceId !== params.deviceId) return;
const role = normalizeRole(params.role);
if (!store.tokens[role]) return;
const next: DeviceAuthStore = {
version: 1,
deviceId: store.deviceId,
tokens: { ...store.tokens },
};
delete next.tokens[role];
writeStore(filePath, next);
}