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 🙏

© 2026 – Pkg Stats / Ryan Hefner

discord-token-decrypt

v0.0.8

Published

A utility for retrieving and decrypting Discord token on macOS.

Readme

discord-token-decrypt

A Node.js package for retrieving and decrypting Discord token on macOS. This utility allows you to programmatically access your Discord token for automation, testing, or API integration purposes.

Description

discord-token-decrypt provides a simple API to access the encrypted Discord token from the local Discord installation on macOS. It handles all the complexity of:

  • Accessing the Discord LevelDB database
  • Retrieving the encryption key from macOS Keychain
  • Decrypting the token using Discord's encryption algorithm

Installation

NPM

npm i discord-token-decrypt

GitHub

npm i https://github.com/lacherogwu/discord-token-decrypt

Requirements

  • macOS (this package is not compatible with Windows or Linux)
  • Node.js 16 or higher
  • Discord desktop application installed on the system
  • You must be logged in to Discord on your desktop application

Usage

import { getDiscordToken } from 'discord-token-decrypt';

// Get the Discord token
const token = await getDiscordToken();
console.log(token);

// You can now use this token for Discord API calls

API

getDiscordToken(): Promise<string>

Retrieves and decrypts your Discord authentication token.

  • Returns:
    • Promise resolving to a string containing your Discord token

getDiscorBasedRequestHeaders(): Object

Provides HTTP headers that mimic an official Discord client request.

  • Returns:
    • An object containing HTTP headers for Discord API requests
// Example: Making an authenticated request to Discord API
import { getDiscordToken, getDiscorBasedRequestHeaders } from 'discord-token-decrypt';

const headers = getDiscorBasedRequestHeaders();
headers.Authorization = await getDiscordToken();

const response = await fetch('https://discord.com/api/v9/users/@me', { headers });
const userData = await response.json();

makeDiscordKey(key: string): string

Creates a properly formatted key for the Discord LevelDB database.

  • Parameters:
    • key: The base key string to format
  • Returns:
    • A complete Discord LevelDB key with the proper prefix

withDiscordLocalStorage<T>(callback: (db: Level) => Promise<T>): Promise<T>

Provides safe access to the Discord LevelDB database by creating a temporary copy.

  • Parameters:
    • callback: A function that receives the Level database instance and returns a promise
  • Returns:
    • A promise resolving to the value returned by the callback
  • Note:
    • Ensures proper cleanup of resources regardless of success or failure
// Example: Reading custom data from Discord's local storage
import { withDiscordLocalStorage, makeDiscordKey } from 'discord-token-decrypt';

const customData = await withDiscordLocalStorage(async db => {
	const key = makeDiscordKey('custom_data_key');
	return await db.get(key).catch(() => null);
});

How It Works

This package works by:

  1. Copying Discord's LevelDB database to a temporary location
  2. Retrieving the raw encrypted token from the database
  3. Getting the encryption key from macOS Keychain
  4. Decrypting the token using the appropriate algorithm

Security Notice

Your Discord token grants full access to your Discord account. Never share your token with others or include it in any public code repositories. This tool is intended for personal automation use only.

License

MIT