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 🙏

© 2025 – Pkg Stats / Ryan Hefner

luaseal

v1.0.33

Published

LuaSeal API Wrapper

Downloads

3,200

Readme

LuaSeal

An Api Wrapper used for LuaSeal, it provides a secure and minimal interface for managing everything related to your profect. Making custom usage of the api very easy.

Version License


Installation

Install LuaSeal via npm:

npm install luaseal


Usage

const LuaSeal = require("luaseal");

const seal = new LuaSeal("seal_yourApiKeyHere", "yourProjectId");

function getFutureUnix(days) {
    return Math.floor(Date.now() / 1000) + days * 86400;
}

(async () => {
    const key = await seal.generateKey({ key_days: 31 });
    console.log("Generated Key:", key);

    // await seal.generateKey({ key_days: getFutureUnix(31) }); // will be a specific unix timestamp instead of just amount of days
    // await seal.whitelistDiscordUser("314159265358979", { key_days: 10, note: "Auto linked to discord ID" }); // instead of just generating a unclaimed key, it will automatically link the generated key to the given ID

    await seal.updateKey(key, { discord_id: "314159265358979" });
    console.log("Key updated");

    await seal.blacklistKey(key);
    console.log("Key blacklisted");

    // await seal.blacklistKey(key, { expire_time: 31, reason: "Broke TOS" }); // this will blacklist the key for 31 days instead of a lifetime blacklist
    
    await seal.unblacklistKey(key);
    console.log("Key unblacklisted");

    try {
        await seal.resetKeyHwid(key, { force: true }); // There is a automatic system where users can only reset their hwid once a week, if they try reset it before 7 days this function will error responding "You must wait x day(s) before resetting HWID again" so to avoid this and bypass that cooldown you can use force. 
        console.log("HWID reset");
    } catch (error) {
        if (error.unix) { // error.unix will be avaiable if the user is on reset cooldown and "force" wasn't set true
            console.log(`You are current on cooldown from resetting your hwid, this cooldown will expire <t:${error.unix}:R>.`);
        } else {
            console.log("Error resetting HWID:", error.message);
        }
    }

    const info = await seal.getKeyInfo({ user_key: key }); 
    console.log(info);
    console.log(info[0].user_key);
    console.log(info[0].banned);

    const allKeys = await seal.getAllKeys();
    const randomEntry = allKeys[Math.floor(Math.random() * allKeys.length)];
    console.log(allKeys[randomEntry].user_key);
    console.log(allKeys[randomEntry].discord_id)

    // Note: getKeyInfo and getAllKeys always return arrays. 
    // Make sure to access the correct entry by index or other methods.

    await seal.unwhitelistKey(key);
})();

API

new LuaSeal(api_key: string, project_id: string)

Creates a new LuaSeal instance.

  • api_key — Must be a valid API key.
  • project_id — Must be a valid Project ID.

Throws on invalid arguments.


Key Management

Method | Parameters | Description ------ | ---------- | ----------- generateKey | options? { key_days?: number, note?: string } | Generates a new API key. All fields in options are optional. updateKey | user_key: string, options? { key_days?: number, discord_id?: string, note?: string } | Updates metadata for a key. user_key is required; all fields in options are optional. blacklistKey | user_key: string, options? { reason?: string, expire_time?: number } | Blacklists a key. user_key is required; reason and expire_time are optional. unblacklistKey | user_key: string | Removes a key from the blacklist. user_key is required. resetKeyHwid | user_key: string, options? { force?: boolean } | Resets the HWID of a key. user_key is required; force is optional.


User Management

Method | Parameters | Description ------ | ---------- | ----------- whitelistDiscordUser | discord_id: string, options? { key_days?: number, note?: string } | Whitelists a Discord user. discord_id is required; options are optional. importMassKeys | [ { key_value: string, discord_id?: string; key_days?: number; note?: string } ] | Mass imports keys to the selected project, key_value is required; everything else isn't unwhitelistKey | user_key: string | Removes a key from whitelist. user_key is required. getKeyInfo | options? { user_key?: string, discord_id?: string, hwid?: string } | Retrieves information about a key or user. All fields in options are optional. getAllKeys | - | Retrieves all keys for the project. No parameters required.


Error Handling

All errors are instances of LuaSealError. Network errors, timeouts, and backend responses provide descriptive messages.

try {
    await seal.resetKeyHwid("invalidKey");
} catch (error) {
    console.log(error.message); // e.g. "No HWID is set for this key"
}

Requirements

  • Node.js (or TypeScript)
  • Valid LuaSeal API key

License

MIT © LuaSeal


Useful Links