Abstraction of various authentication mechanism.
Auth is a server-side interface that identifies an user from some kind of identification. (e.g. access tokens)
interface Auth<User> {
function authenticate():Promise<Option<User>>;
}Delegate is a client side interface that allows user to login/logout and generates authentication tokens
interface Delegate<SignUpInfo, Credentials, Profile, ProfilePatch> {
final status:Observable<Status<User<Profile, ProfilePatch>>>;
function signUp(info:SignUpInfo):Promise<Noise>;
function signIn(credentials:Credentials):Promise<Noise>;
function signOut():Promise<Noise>;
function forgetPassword(id:String):Promise<Noise>;
function resetPassword(id:String, code:String, password:String):Promise<Noise>;
function confirmSignUp(id:String, code:String):Promise<Noise>;
}
interface User<Profile, ProfilePatch> {
final profile:Observable<Profile>;
function getToken():Promise<String>;
function updateProfile(patch:ProfilePatch):Promise<Noise>;
function changePassword(oldPassword:String, newPassword:String):Promise<Noise>;
}
enum Status<Profile> {
Initializing;
SignedOut;
SignedIn(profile:Profile);
Errored(e:Error);
}Auth
CognitoAuthauthenticates users using AWS Cognito ID tokenFirebaseAuthauthenticates users using Firebase ID token
Delegate
AmplifyDelegatean implementation for AWS AmplifyDummyDelegatea dummy implementation that exposes the interface methods in a functional programming approach
AuthSession.hxAn implementation fortink_web'sSessionwhich allows usingwhy.Authimplementations as authentication providers.DelegateClient.hxAn implementation fortink_http'sClientwhich allows usingwhy.Delegateimplementations as the provider to generate aAUTHORIZATIONHTTP header.