@umashankar_playo/auth

0.4.0 • Public • Published

Playo auth

Example

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

}

/@umashankar_playo/auth/

    Package Sidebar

    Install

    npm i @umashankar_playo/auth

    Weekly Downloads

    1

    Version

    0.4.0

    License

    ISC

    Unpacked Size

    6.11 kB

    Total Files

    3

    Last publish

    Collaborators

    • umashankar_playo