@vigilbase/cli
Version:
Vigilbase CLI — security scanners, agent tools, and Vigilbase One from the terminal.
54 lines (53 loc) • 1.5 kB
TypeScript
/**
* Credential shapes for Vigilbase One CLI auth.
*
* Intended to store tokens from Better Auth's device authorization grant
* (RFC 8628): https://better-auth.com/docs/plugins/device-authorization
*/
export type StoredUser = {
id?: string;
email?: string;
name?: string;
};
export type OneCredentials = {
/** Origin that issued this token. Missing on credentials from older CLI versions. */
oneBaseUrl?: string;
issuer?: string;
clientId?: string;
resource?: string;
refreshToken?: string;
refreshTokenExpiresAt?: string;
refreshPending?: boolean;
orgId?: string;
accessToken: string;
tokenType?: string;
scope?: string;
/** ISO timestamp when the access token expires, if known. */
expiresAt?: string;
user?: StoredUser;
/** When these credentials were written. */
obtainedAt: string;
};
export type CredentialsFile = {
version: 1 | 2;
one?: OneCredentials | null;
};
export type DeviceCodeResponse = {
device_code: string;
user_code: string;
verification_uri: string;
verification_uri_complete?: string;
expires_in: number;
interval?: number;
};
export type DeviceTokenSuccess = {
access_token: string;
token_type?: string;
expires_in?: number;
refresh_token?: string;
scope?: string;
};
export type DeviceTokenPendingError = {
error: 'authorization_pending' | 'slow_down' | 'access_denied' | 'expired_token' | string;
error_description?: string;
};