UNPKG

@signiant/media-shuttle-sdk

Version:

The SDK for supporting file transfer to and from Media Shuttle

87 lines 3.46 kB
import Credentials from './Credentials'; import RefreshingCredentials from './RefreshingCredentials'; /** * An interface defining options required for initiating Platform MFA */ export interface MfaRequest { /** * Identifier of the Signiant account containing Media Shuttle service. */ accountId: string; } /** * An interface defining options required for Platform MFA redemption */ export interface RedeemMfaRequest extends MfaRequest { /** * MFA verification code to be redeemed or verified */ verificationCode: string; } /** * Constructor options for the LoginCredentials class. */ export interface LoginCredentialsOptions { /** * The username of the user logging in. * @example example-user@signiant.com */ username: string; /** * The password associated with the username: * * @example sample-pass */ password: string; } /** * This credentials class allow the user to use the SDK by providing * username and password as authentication parameters. */ declare class LoginCredentials implements Credentials { private _credentials; private _baseUrl; private readonly _username; private readonly _password; /** * Constructor of the class * @param {object} credentials including the login details * @param {string} credentials.username user email of a user that belongs to a Signiant Account * @param {string} credentials.password user password */ constructor({ username, password }: LoginCredentialsOptions); /** * Requests the authentication token, the first time a login request is done, * after that if a valid refresh token is available we use it to get a new token. * @returns {string} valid token to make requests to the Platform API */ getAuthToken(): Promise<string>; /** * Should make a call to the Platform API to login the user. * @returns {RefreshingCredentials} */ login(): Promise<RefreshingCredentials>; /** * @hidden * Sets the base url to be used when requesting tokens. * @param {string} url base url of the Platform API */ set baseUrl(url: string | undefined); /** * Requests an MFA verification code the user can redeem as part of Platform MFA verification. * @param {MfaRequest} requestObject - Request Object | Include the required parameters in order to initiate MFA verification * @param {string} requestObject.accountId - **accountId**: Identifier of the Signiant account requiring MFA verification */ initiateMfa({ accountId }: MfaRequest): Promise<void>; /** * Redeems an MFA verification code as part of Platform MFA verification to get new MFA verified token * @param {RedeemMfaRequest} requestObject - Request Object | Include the required parameters in order to redeem an MFA token * @param {string} requestObject.accountId - **accountId**: Identifier of the Signiant account requiring MFA verification * @param {string} requestObject.verificationCode - **verificationCode**: verification code to redeem as part of Platform MFA verification * @returns {string} valid token to make requests to the Platform API for MFA protected account resources */ redeemMfa({ accountId, verificationCode }: RedeemMfaRequest): Promise<string>; logout(): Promise<any>; } export default LoginCredentials; //# sourceMappingURL=LoginCredentials.d.ts.map