API 密钥生成器
生成各种格式的安全 API 密钥。从 UUID、十六进制、base64、字母数字或自定义前缀密钥中选择。
API Key Best Practices
- Use prefixes to identify key types (live vs test, public vs secret)
- Minimum recommended length is 32 characters for security
- Store API keys securely - never in source code or logs
- Implement key rotation and expiration policies
- Use environment variables or secret management services
API 密钥安全 - 技术详情
API 密钥用于验证对 API 的请求。它们应该足够长(32 个以上字符)以抵抗暴力攻击,并使用加密安全的随机生成。前缀有助于识别密钥类型并帮助密钥扫描。
命令行替代方案
# Generate random key with openssl
openssl rand -hex 32
# Generate UUID
uuidgen
# Or with Node.js
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"