harperdb
Version:
HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.
36 lines (35 loc) • 1.17 kB
TypeScript
interface JWTRSAKeys {
publicKey: string;
privateKey: string;
passphrase: string;
}
interface AuthObject {
username?: string;
password?: string;
role?: string;
expires_in?: string | number;
}
interface TokenObject {
refresh_token: string;
}
interface JWTTokens {
operation_token: string;
refresh_token?: string;
}
export declare function getJWTRSAKeys(): Promise<JWTRSAKeys>;
/**
* Creates a new operation token and refresh token.
* If there is no username and password, the hdb_user making the request is used in the token.
* An optional role can be provided which will be saved in the token payload.
* The token expires in the time specified in the expires_in field or the default time.
* @param authObj
*/
export declare function createTokens(authObj: AuthObject): Promise<JWTTokens>;
/**
* Refreshes the operation token using the refresh token.
* @param tokenObj
*/
export declare function refreshOperationToken(tokenObj: TokenObject): Promise<JWTTokens>;
export declare function validateOperationToken(token: string): Promise<any>;
export declare function validateRefreshToken(token: string): Promise<any>;
export {};