@playo/auth

0.3.1 • 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

}

/@playo/auth/

    Package Sidebar

    Install

    npm i @playo/auth

    Weekly Downloads

    31

    Version

    0.3.1

    License

    ISC

    Unpacked Size

    7.14 kB

    Total Files

    3

    Last publish

    Collaborators

    • rishabh09
    • umashankar_playo