This document outlines best practices for securely storing and managing API keys in Inkwoven.
Inkwoven uses multiple layers of security to protect API keys:
- Client-side encryption for API keys stored in localStorage
- GitHub Secrets for CI/CD workflows
- Environment variables for build-time configuration (optional)
API keys entered in the application UI are automatically encrypted before being stored in localStorage using the Web Crypto API:
- Algorithm: AES-GCM (256-bit)
- Key Derivation: PBKDF2 with 100,000 iterations
- Storage: Encrypted values stored in localStorage
- Decryption: Keys are decrypted in memory when needed
- When a user enters an API key, it's encrypted using a device-specific key
- The encrypted value is stored in localStorage
- When the API key is needed, it's decrypted in memory
- The decrypted key is never persisted to disk
- Accidental exposure in browser DevTools
- Basic malware that reads localStorage
- XSS attacks that access localStorage
❌ Client-side encryption does NOT protect against:
- Malicious browser extensions
- Advanced malware with browser access
- Server-side attacks (if you add a backend)
For maximum security, consider implementing a backend proxy that stores API keys server-side.
For CI/CD workflows (like the Figma token sync), use GitHub Secrets:
- Go to your repository on GitHub
- Navigate to Settings > Secrets and variables > Actions
- Click New repository secret
- Add the following secrets:
FIGMA_FILE_KEY: Your Figma file keyFIGMA_API_TOKEN: Your Figma API token
Secrets are accessed in workflow files using:
${{ secrets.SECRET_NAME }}Never commit secrets directly in workflow files or code.
For build-time configuration, you can use environment variables:
- Copy
.env.exampleto.env - Add your environment variables (optional)
- Access in code using
import.meta.env.VITE_*
- Environment variables prefixed with
VITE_are exposed to the client - Never put sensitive API keys in
VITE_*variables if the code is public - Use environment variables only for non-sensitive configuration
- Store API keys encrypted in localStorage
- Use GitHub Secrets for CI/CD
- Rotate API keys regularly
- Use separate API keys for development and production
- Monitor API key usage for suspicious activity
- Use environment variables only for non-sensitive config
- Commit API keys to version control
- Share API keys in plain text
- Use the same API key across multiple projects
- Store API keys in code comments
- Expose API keys in client-side environment variables (if code is public)
- Share API keys via email or chat
If an API key is compromised:
- Immediately revoke the key in the provider's dashboard
- Generate a new API key
- Update the key in the application
- Review access logs for suspicious activity
If you discover a security vulnerability, please:
- Do NOT open a public issue
- Email security concerns to the repository maintainers
- Provide details about the vulnerability
- Allow time for the issue to be addressed before public disclosure