Norse Polytheistic Mythology

    @playo/auth

    0.5.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
    
    }

    Keywords

    none

    Install

    npm i @playo/auth

    DownloadsWeekly Downloads

    6

    Version

    0.5.0

    License

    ISC

    Unpacked Size

    6.77 kB

    Total Files

    3

    Last publish

    Collaborators

    • rishabh09
    • umashankar_playo