@salesforce/core
Version:
Core libraries to interact with SFDX projects, orgs, and APIs.
64 lines (63 loc) • 1.51 kB
TypeScript
import { AsyncOptionalCreatable } from '@salesforce/kit';
import { JsonMap, Optional } from '@salesforce/ts-types';
export type SfToken = {
token: string;
url: string;
user?: string;
timestamp: string;
} & JsonMap;
export type SfTokens = {
[key: string]: SfToken;
};
export declare class TokenAccessor extends AsyncOptionalCreatable {
private config;
/**
* Return all tokens.
*
* @param decrypt
* @returns {SfTokens}
*/
getAll(decrypt?: boolean): SfTokens;
/**
* Return a token for the provided name.
*
* @param name
* @param decrypt
* @returns {Optional<SfToken>}
*/
get(name: string, decrypt?: boolean): Optional<SfToken>;
/**
* Return true if a given name has a token associated with it.
*
* @param name
* @returns {boolean}
*/
has(name: string): boolean;
/**
* Set the token for the provided name.
*
* @param name
* @param token
*/
set(name: string, token: Partial<SfToken>): void;
/**
* Update the token for the provided name.
*
* @param name
* @param token
*/
update(name: string, token: Partial<SfToken>): void;
/**
* Unet the token for the provided name.
*
* @param name
*/
unset(name: string): void;
/**
* Write the contents to the token file.
*
* @returns {Promise<SfTokens>}
*/
write(): Promise<SfTokens>;
protected init(): Promise<void>;
}