New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@lowerdeck/api-key

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lowerdeck/api-key

Create and parse structured API keys with embedded configuration. Supports versioning, type prefixes, and automatic validation for secure key management.

latest
npmnpm
Version
1.0.3
Version published
Weekly downloads
49
-15.52%
Maintainers
2
Weekly downloads
 
Created
Source

@lowerdeck/api-key

Create and parse structured API keys with embedded configuration. Supports versioning, type prefixes, and automatic validation for secure key management.

Installation

npm install @lowerdeck/api-key
yarn add @lowerdeck/api-key
bun add @lowerdeck/api-key
pnpm add @lowerdeck/api-key

Usage

import { createApiKeyGenerator } from '@lowerdeck/api-key';

// Define your key types
const keyTypes = {
  uk: 'user_auth_token',
  ak: 'app_access_token',
  sk: 'secret_key'
} as const;

// Create a key generator
const ApiKey = createApiKeyGenerator(keyTypes, {
  prefix: 'myapp',
  secretLength: 60
});

// Create a new API key
const key = ApiKey.create({
  type: 'user_auth_token',
  config: {
    url: 'https://api.example.com'
  }
});

console.log(key.toString()); // myapp_uk_<60-char-secret><encoded-config>v1

// Parse an existing key
const parsed = ApiKey.from('myapp_uk_...');
if (parsed) {
  console.log(parsed.type); // 'user_auth_token'
  console.log(parsed.config.url); // 'https://api.example.com'
}

// Redact keys for logging
const redacted = ApiKey.redact(key);
console.log(redacted); // myapp_uk_abcd...xyz9

License

This project is licensed under the Apache License 2.0.

Built with ❤️ by Metorial

FAQs

Package last updated on 14 Apr 2026

Related posts