Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Api Key Management?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adityaaatiwari-api-key-management)
---
description: Build secure programmatic API keys with clear prefixes, salted hashes, narrow scopes, expiry, and zero-downtime rotation
profile: standard
tags: auth, security, api, backend
---
# API key management
Use when designing developer API tokens, service accounts, webhook secrets, or CLI access tokens.
## Generation and storage
- Prefix keys unambiguously (`app_live_...`, `app_test_...`) so secret scanners can identify leaks accurately before code hits Git.
- Display the raw secret **once** on creation only, and persist solely a SHA-256 (or HMAC) hash + non-secret short prefix/last-4 display suffix in the database.
- Enforce constant-time hash comparison during verification and cache invalidations cleanly.
## Scoping and lifecycle
- Bind every key to granular permission scopes, optional environment/workspace limits, and configurable expiration timestamps.
- Track `lastUsedAt` asynchronously without writing a blocking DB update on every API read.
- Support multiple active keys per integration so teams can roll keys safely with grace overlap before revoking old keys.
## Verify
Confirm plaintext tokens never persist in DB/logs, revoked/expired keys return `401`, out-of-scope keys return `403`, and overlapping key rotation succeeds cleanly.