@basetime/a2w-api-ts
Version:
Client library that communicates with the addtowallet API.
42 lines (41 loc) • 1.03 kB
TypeScript
import { Logger } from '../Logger';
import { Authed } from '../types/Authed';
import { AuthProvider } from './AuthProvider';
/**
* Authenticates the with the a2w API using an API key and secret.
*
* Used to make authentication requests to a2w in order to obtain tokens. The
* tokens will be used for future requests to the API.
*/
export default class KeysProvider implements AuthProvider {
private readonly key;
private readonly secret;
/**
* The successful last authentication.
*/
private authed?;
/**
* The logger.
*/
private logger;
/**
* Constructor.
*
* @param key The API key.
* @param secret The API secret.
* @param logger The logger to use.
*/
constructor(key: string, secret: string, logger?: Logger);
/**
* @inheritdoc
*/
setLogger: (logger: Logger) => void;
/**
* @inheritdoc
*/
getAuthed: () => Authed | undefined;
/**
* @inheritdoc
*/
authenticate: () => Promise<string>;
}