@vigilbase/cli
Version:
Vigilbase CLI — security scanners, agent tools, and Vigilbase One from the terminal.
31 lines (30 loc) • 2.25 kB
TypeScript
import type { CliConfig } from '../lib/config.js';
import type { OneCredentials } from './types.js';
export declare function boundIdentityCredentials(config: CliConfig, one: OneCredentials): boolean;
/** Library callers may omit or mistype timeoutMs; NaN would make the wait unbounded. */
export declare function credentialsLockWaitMs(timeoutMs: unknown): number;
/** credentials.json.lock is held: by a running command, by one that was interrupted, or it is damaged. */
export declare class CredentialsLockedError extends Error {
constructor(message: string);
}
/**
* credentials.json.lock guards both credentials files; CLI 0.2.0 takes the same lock.
* Only login and logout (`replaceDeadLock`) replace a lock whose owner has exited, or an old damaged one: a crashed
* refresh may have consumed the rotating token, and both start over without it. Other commands fail at once on a
* dead owner. With `wait` false, a held lock fails at once instead of after the lock wait.
*/
export declare function withCredentialsLock<T>(config: Pick<CliConfig, 'configDir'> & Partial<Pick<CliConfig, 'timeoutMs'>>, callback: () => Promise<T>, replaceDeadLock?: boolean, wait?: boolean): Promise<T>;
export declare function managedAccessToken(config: CliConfig, failedToken?: string): Promise<string | null>;
/**
* Revoke one saved refresh grant. Identity answers 400 (`invalid_request` or `invalid_grant`) for a token it no
* longer knows or has already revoked, for example after a browser sign-out ended the session that approved it,
* or a refresh rotated it; nothing is left to revoke then. Other failures throw.
*/
export declare function revokeIdentityGrant(config: CliConfig, one: OneCredentials): Promise<void>;
/**
* Revoke every saved Identity grant, then remove its file. A failed revocation keeps every file. A safe file that
* can't be parsed has no grant to revoke; the login that calls this replaces it. Callers hold the lock.
*/
export declare function revokeIdentityCredentials(config: CliConfig): Promise<boolean>;
/** Revoke and remove every credentials file. A failed Identity revocation keeps them all. */
export declare function revokeSavedCredentials(config: CliConfig, onWarning?: (message: string) => void): Promise<boolean>;