@basetime/a2w-api-ts
Version:
Client library that communicates with the addtowallet API.
28 lines (27 loc) • 921 B
TypeScript
import { Logger } from '../Logger';
import { Authed } from '../types/Authed';
import BaseAuthProvider from './BaseAuthProvider';
/**
* Authenticates with the a2w API using an API key and secret.
*
* Posts the supplied key/secret pair to `/auth/apiGrant` to obtain an `Authed`. The
* shared {@link BaseAuthProvider} machinery handles caching, in-flight dedup,
* clock-skew margin, and refresh-token exchange.
*/
export default class KeysProvider extends BaseAuthProvider {
private readonly key;
private readonly secret;
/**
* Constructor.
*
* @param key The API key.
* @param secret The API secret.
* @param logger The logger to use.
* @param baseUrl The API base URL to send the grant request to.
*/
constructor(key: string, secret: string, logger?: Logger, baseUrl?: string);
/**
* @inheritdoc
*/
protected fetchAuthed: () => Promise<Authed>;
}