@curvenote/cli
Version:
CLI Client library for Curvenote
43 lines • 1.79 kB
TypeScript
import type { ISession, Token, TokenConfig, TokenData, TokenPayload } from './types.js';
import type { Logger } from 'myst-cli-utils';
export declare function decodeTokenAndCheckExpiry(token: string, log: ISession['log'], throwErrors?: boolean, kindForExpiryCheck?: 'user' | 'session'): {
decoded: TokenPayload;
expired: boolean | 'soon';
};
export declare function validateSessionToken(token: string, log: ISession['log']): Token;
/**
* Return `current` token and `saved` available tokens
*
* Curvenote tokens can come from 2 places:
* - CURVENOTE_TOKEN environment variable
* - Curvenote config file saved to your system
*
* The curvenote config may have a list of available tokens and a current token;
* this function will return the available tokens as `saved` and the `current` token.
*
* If CURVENOTE_TOKEN environment variable is found, it will be returned as `current`,
* taking priority over any current token in your config file. The field `environment`
* will be set to `true`, indicating current came from the environment variable.
*/
export declare function getTokens(log?: Logger): {
saved?: TokenData[];
current?: string;
environment?: boolean;
};
/**
* Write token config data to file
*/
export declare function writeConfigFile(data: TokenConfig): void;
/**
* Replace current token in saved config file
*/
export declare function updateCurrentTokenConfig(log: Logger, token?: string): void;
export declare function summarizeAsString({ note, username, email, api }: Omit<TokenData, 'token'>): string;
export declare function getCurrentTokenRecord(tokens?: ReturnType<typeof getTokens>): TokenData | {
token: string;
api: string;
email: any;
username: any;
note: string;
} | undefined;
//# sourceMappingURL=tokens.d.ts.map