fake-authentication
v1.0.0
Published
A Fake Authentication System Using LocalStorage
Downloads
7
Readme
Fake Authentication
Overview
A Fake Authentication System Using LocalStorage.
Features
- Handles SignUp, SignIn, SignOut and Persistent Authenticated State
- Passwords are encrypted with PBKDF2
- Each user is assigned with an unique id
Usage
If you're using yarn, yarn add fake-authentication
If you're using npm, npm install fake-authentication
import fakeAuth from "fake-authentication";
// For SignUp
fakeAuth
.signUp("[email protected]", "password")
.then(resp => console.log(resp)) // { message: "User Created Successfully", uid: "some-uid" }
.catch(err => console.log(err)); // { message: "User Already Exists" }
// For SignIn
fakeAuth
.signIn("[email protected]", "password")
.then(resp => console.log(resp)) // { message: "SignIn Successful", uid: "some-uid" }
.catch(err => console.log(err)); // { message: "Password Did Not Match || User Doesn't Exist" }
// Check AuthState
fakeAuth
.isAuthenticated()
.then(resp => console.log(resp)) // { message: "Authenticated", isAuth: true, data: { email: "[email protected]", uid: "some-uid" } }
.catch(err => console.log(err)); // { message: "Not Authenticated", isAuth: false, data: "" }
// For SignOut
fakeAuth.signOut();