@j2inn/scram
Version:
TypeScript client SCRAM authentication library
40 lines (39 loc) • 1.28 kB
TypeScript
import { AuthResponse } from './ScramAuth';
export { AuthResponse } from './ScramAuth';
export { ScramError, ScramErrorOptions, ScramStage } from './ScramError';
/**
* Parameters used for authentication.
*/
export interface AuthParams {
/**
* The username used in authentication.
*/
username: string;
/**
* The password used in in authentication.
*/
password: string;
/**
* Optional server URI to authenticate with (defaults to /).
*/
uri?: string;
/**
* Optional fetch function implementation.
*/
fetch?: typeof fetch;
}
/**
* Authenticate with a server using SCRAM.
*
* - https://tools.ietf.org/html/rfc5802
* - http://www.alienfactory.co.uk/articles/skyspark-scram-over-sasl
*
* @param options.username The username.
* @param options.password The password.
* @param options.uri Optional server URI to authenticate with (defaults to /).
* @param options.fetch Optional alternative fetch function.
* @returns If successful, the final client authentication information is returned.
* @throws If the authentication is not successful or if there's an error.
*/
export declare function authenticate({ username, password, uri, fetch, }: AuthParams): Promise<AuthResponse>;
export default authenticate;