UNPKG

@signiant/media-shuttle-sdk

Version:

The SDK for supporting file transfer to and from Media Shuttle

61 lines 1.79 kB
import Credentials from './Credentials'; /** * @ignore. */ export interface RefreshingCredentialsConstructorOptions { refreshToken: string; clientId: string; domain: string; } /** * @ignore */ export interface LoginResponse { idToken: string; refreshToken: string; domain: string; clientId: string; expiresInSeconds: number; } /** * @ignore * The refresh credentials is used to get new auth token to make REST call for Upload and Download requests. * * Most callers are recommended to use the {@link LoginCredentials} class. */ declare class RefreshingCredentials implements Credentials { /** * A token which will be used to get a new authorization token. */ private readonly _refreshToken; /** * ClientId associated with the refresh token. */ private readonly _clientId; /** * Domain/endpoint where the refreshToken will be used to get the next token from. */ private readonly _domain; /** * Token obtained using refreshToken. */ _token: string; /** * Sort of a debounce mechanism when getAuthToken is called in quick succession. */ _tokenFetchPromise: Promise<void>; _currentTokenExpiryTime: Number; /** * @param {object} options Options for this constructor. */ constructor({ refreshToken, clientId, domain }: RefreshingCredentialsConstructorOptions); getAuthToken(): Promise<string>; static fromAuthenticationResponse(response: LoginResponse): RefreshingCredentials; private static getCurrentTokenExpiryTime; private checkIfTokenNeedsRefresh; private getNewToken; private reFetchToken; logout(): Promise<any>; } export default RefreshingCredentials; //# sourceMappingURL=RefreshingCredentials.d.ts.map