Skip to content

Seed your Unkey API with expired keys and perform a fast, efficient cleanup of those keys with a single command

License

Notifications You must be signed in to change notification settings

unrenamed/unkey-expired-keys-cleanup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Batch Management of Expired Unkey API Keys

This lightweight toolkit enables you to seed your Unkey API with expired keys and showcases how to effortlessly clean them up in one swift command. Enhanced with a visually appealing terminal progress bar, it offers real-time feedback during the cleanup process, ensuring you can manage expired API keys efficiently.

Quickstart Guide

Create a Unkey Root Key

  1. Navigate to Unkey Root Keys and click "Create New Root Key".
  2. Name your root key.
  3. Select the following workspace permissions:
    • create_key
    • read_key
    • encrypt_key
    • decrypt_key
  4. Click "Create" and save your root key securely.

Create a Unkey API

  1. Go to Unkey APIs and click "Create New API".
  2. Enter a name for the API.
  3. Click "Create".

Run the example locally

  1. Clone the repository to your local machine:

    git clone git@github.com:unrenamed/unkey-expired-keys-cleanup
    cd unkey-expired-keys-cleanup
  2. Create a .env file in the root directory and populate it with the following environment variables:

    UNKEY_ROOT_KEY=your-unkey-root-key
    UNKEY_API_ID=your-unkey-api-id

    Ensure you replace your-unkey-* with your actual Unkey credentials.

  3. Seed your API with 500 expired API keys in batches:

    pnpm dev:seed
    

    Open seed.ts to refine the batch size and total keys number.

  4. Delete all expired keys from your API in batches:

    pnpm dev:cleanup
    

    Open cleanup.ts to refine the batch size.

About

Seed your Unkey API with expired keys and perform a fast, efficient cleanup of those keys with a single command

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published