@playo/auth
0.3.1 • Public • Published
const PlayoAuth = require("@playo/auth");
const auth = new PlayoAuth({
redisUrl: "", // default localhost
redisPort: "", // default 6379
ttl: "" // default 7776000s (3 months)
});
async loginFunc() {
const authData = await auth.login(userId) // userId will always be uuid
/*
authData
{
token: 'token' || null
error: null || error message
}
*/
}
async logoutFunc() {
const authData = await auth.logout(token) // token will always be `uuid:uuid`
/*
authData
{
status: boolean // true if user is logged out successfully
error: null || error message
}
*/
}
async verifyFunc() {
const authData = await auth.verify(token) // token will always be `uuid:uuid`
/*
authData
{
status: boolean // true if token is valid
error: null || error message
}
*/
}
async expireAll() {
const authDate = await auth.expireAll(userId) // userId will always be UUID
/**
authDate
{
status:boolean // true if all the tokens are expired
}
* /
}
checkDB () => {
const isConnected = auth.checkConnection() // boolean
}
Readme
Keywords
nonePackage Sidebar
Install
Weekly Downloads