npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

keyauth-js-module

v1.0.1

Published

KeyAuth Authentication JS Module

Downloads

2

Readme

KeyAuth JS Module

Code

import * as KeyAuth from 'keyauth-js-module'
import readline from "readline";
import moment from "moment"

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})

KeyAuth.api(
    "", // Application Name
    "", // OwnerID
    "", // Application Secret
    "1.0" // Application Version
)

await KeyAuth.cls();
await KeyAuth.init();

if (!KeyAuth.response.success) {
    KeyAuth.error("Status: " + KeyAuth.response.message)
}

KeyAuth.Title("KeyAuth JS Example - 1.1 API")
console.log("\n Application Data:")
console.log(` Number of users: ${KeyAuth.app_data.numUsers}`)
console.log(` Number of online users: ${KeyAuth.app_data.numOnlineUsers}`)
console.log(` Number of keys: ${KeyAuth.app_data.numKeys}`)
console.log(` Application Version: ${KeyAuth.app_data.version}`)
console.log(` Customer panel link: ${KeyAuth.app_data.customerPanelLInk}\n`)
await KeyAuth.check();
await KeyAuth.Sleep(1200);
console.log(` Current Session Validation Status: ${KeyAuth.response.message}`);
console.log(` Blacklisted: ${await KeyAuth.checkblacklist()}`);

await rl.question("\n [1] Login\n [2] Register\n [3] Upgrade\n [4] License key only\n\n Choose option: ", async function(choice) {
    if (choice === "1") {
        rl.question("Whats your username: ", async function(username) {
            rl.question("Whats your password: ", async function(password) {
                await KeyAuth.Login(username, password);
                if (!KeyAuth.response.success) {
                    KeyAuth.error("Status: " + KeyAuth.response.message)
                }
                loggedin();
                rl.close();
            })
        })
    } 
    else if (choice === "2") {
        rl.question("Whats your username: ", async function(username) {
            rl.question("Whats your password: ", async function(password) {
                rl.question("Whats your License: ", async function(key) {
                    await KeyAuth.Register(username, password, key);
                    if (!KeyAuth.response.success) {
                        KeyAuth.error("Status: " + KeyAuth.response.message)
                    }
                    loggedin();
                    rl.close();
                })
            })
        })
    }
    else if (choice === "3") {
        rl.question("Whats your username: ", async function(username) {
            rl.question("Whats your License: ", async function(key) {
                await KeyAuth.Upgrade(username, key);
                if (!KeyAuth.response.success) {
                    KeyAuth.error("Status: " + KeyAuth.response.message)
                }
                loggedin();
                rl.close();
            })
        })
    }
    else if (choice === "4") {
        rl.question("Whats your License: ", async function(key) {
            await KeyAuth.License(key);
            if (!KeyAuth.response.success) {
                KeyAuth.error("Status: " + KeyAuth.response.message)
            }
            loggedin();
            rl.close();
        })
    }
    else {
        console.log("?")
        rl.close();
    }
})

async function loggedin() {
    console.log("\n Logged In!")

    console.log(` Username: ${KeyAuth.user_data.username}`)
    console.log(` IP address: ${KeyAuth.user_data.ip}`)
    console.log(` Hardware-Id: ${KeyAuth.user_data.hwid}`)
    console.log(` Created at: ${moment.unix(KeyAuth.user_data.createdate).format("DD-MM-YYYY - HH:mm:ss")}`)
    console.log(` Last Login: ${moment.unix(KeyAuth.user_data.lastlogin).format("DD-MM-YYYY - HH:mm:ss")}`)


    for (var i = 0; i < KeyAuth.user_data.subscriptions.length; i++)
    {
        console.log(` [${i}] Subscription name: ${KeyAuth.user_data.subscriptions[i].subscription} | Expires at: ${moment.unix(KeyAuth.user_data.subscriptions[i].expiry).format("DD-MM-YYYY - HH:mm:ss")} | Time left in seconds ${KeyAuth.user_data.subscriptions[i].timeleft}`)
    }


    KeyAuth.check();
    console.log(` Current Session Validation Status: ${KeyAuth.response.message}`);

    console.log("\n\n Closing in 10 seconds...")
    await KeyAuth.Sleep(10000);
    process.exit(0);
}

Credits

# readline - https://www.npmjs.com/package/readline
# moment - https://www.npmjs.com/package/moment
# Axios - https://www.npmjs.com/package/axios
# Systeminformation - https://www.npmjs.com/package/systeminformation
# Querystring - https://www.npmjs.com/package/querystring

Creator

mazkdevf - mazk9145