AK - API Key Manager
A cross-platform C++17 command-line tool for managing API keys securely across different services.
๐ Features
- Cross-Platform: Runs on Linux, macOS, and Windows
- Secure Storage: Encrypted API key storage with local vault
- Service Integration: Built-in support for popular APIs (OpenAI, GitHub, AWS, etc.)
- Test Coverage: Comprehensive test suite with coverage reporting
- Easy Installation: Simple build and install process
- Shell Completions: Bash, Zsh, and Fish shell completions
๐ฆ Installation
APT Repository (Ubuntu/Debian) - Recommended โ
Note: Use the GitHub Pages repository below. The Launchpad PPA is currently experiencing access issues.
Quick Install (Recommended)
curl -fsSL https://apertacodex.github.io/ak/setup-repository.sh | bash
sudo apt install akManual Setup
# Add GPG key (secure method) sudo mkdir -p /usr/share/keyrings curl -fsSL https://apertacodex.github.io/ak/ak-repository-key.gpg | sudo tee /usr/share/keyrings/ak-archive-keyring.gpg > /dev/null # Add GitHub Pages repository echo "deb [signed-by=/usr/share/keyrings/ak-archive-keyring.gpg] https://apertacodex.github.io/ak/ak-apt-repo/ stable main" | sudo tee /etc/apt/sources.list.d/ak.list # Update and install sudo apt update && sudo apt install ak
Direct Package Download
# Download latest .deb package (check for newest version) wget https://apertacodex.github.io/ak/ak-apt-repo/pool/main/ak_4.10.6_amd64.deb sudo dpkg -i ak_4.10.6_amd64.deb # Fix dependencies if needed sudo apt-get install -f
โ ๏ธ PPA Alternative (Currently Unavailable)
# NOTE: Launchpad PPA currently returns 403 errors # Use GitHub Pages repository above instead # sudo add-apt-repository ppa:apertacodex/ak # โ Don't use this
Verification
# Check version ak --version # Test functionality ak --help # Shell completions work after restart ak --<TAB><TAB>
๐ง Building from Source
Prerequisites
- CMake 3.16+
- C++17 compatible compiler (GCC 7+, Clang 8+, MSVC 2019+)
- Git (for dependencies and version management)
Platform-Specific Setup
Linux (Ubuntu/Debian)
sudo apt update sudo apt install build-essential cmake git
macOS
# Using Homebrew brew install cmake git # Xcode command line tools xcode-select --install
Windows
- Install Visual Studio 2019+ with C++ tools
- Install CMake
- Install Git for Windows
๐ง Building
Quick Build (All Platforms)
Linux/macOS:
Windows (PowerShell):
Manual CMake Build
# Configure mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release # Build cmake --build . --parallel # Test ./ak_tests # Install (Linux/macOS) sudo cmake --build . --target install
Build Options
Linux/macOS Build Script:
./build.sh --help # Show help ./build.sh # Release build ./build.sh --debug # Debug build ./build.sh --coverage test coverage # Coverage build with report ./build.sh all # Full build and test cycle ./build.sh clean # Clean build directory
Windows PowerShell:
.\build.ps1 -Help # Show help .\build.ps1 # Release build .\build.ps1 -Debug # Debug build .\build.ps1 -Targets test # Run tests only .\build.ps1 -Targets all # Full build and test cycle .\build.ps1 -Targets clean # Clean build directory
CMake Targets:
# Basic targets cmake --build . --target ak # Build main binary cmake --build . --target ak_tests # Build tests cmake --build . --target run_tests # Build and run tests # Coverage (Linux/macOS only) cmake --build . --target coverage # Generate coverage report # Publishing (requires git repository) cmake --build . --target bump-patch # Bump patch version cmake --build . --target bump-minor # Bump minor version cmake --build . --target bump-major # Bump major version cmake --build . --target publish # Publish patch release
๐งช Testing
The project includes a comprehensive test suite with 65+ tests covering all major functionality.
Run Tests
# Using build scripts ./build.sh test # Linux/macOS .\build.ps1 -Targets test # Windows # Using CMake directly cd build cmake --build . --target run_tests # Build and run ./ak_tests # Run tests directly (Linux/macOS) ak_tests.exe # Run tests directly (Windows)
Coverage Report (Linux/macOS)
./build.sh --coverage test coverage # Report generated in build/coverage_html/index.html
๐ Usage Examples
# Basic usage ak --version ak --help # Key management ak add mykey "sk-..." ak ls ak get mykey ak rm mykey # Service testing ak test openai ak test github ak test --all # Shell completions ak completion bash > /etc/bash_completion.d/ak # Bash ak completion zsh > /usr/share/zsh/site-functions/_ak # Zsh ak completion fish > ~/.config/fish/completions/ak.fish # Fish
๐๏ธ Development
Project Structure
ak/
โโโ include/ # Header files
โ โโโ cli/ # CLI interface
โ โโโ core/ # Core configuration
โ โโโ crypto/ # Cryptographic functions
โ โโโ services/ # Service definitions
โ โโโ ...
โโโ src/ # Source files
โ โโโ cli/
โ โโโ core/
โ โโโ crypto/
โ โโโ ...
โโโ tests/ # Test files
โโโ cmake/ # CMake helper scripts
โโโ CMakeLists.txt # Main CMake configuration
โโโ build.sh # Unix build script
โโโ build.ps1 # Windows build script
โโโ Makefile # Legacy Make support
Development Workflow
-
Setup Development Environment:
git clone <repository> cd ak ./build.sh --debug test # Build in debug mode with tests
-
Make Changes: Edit source files in
src/and headers ininclude/ -
Run Tests:
-
Check Coverage (Linux/macOS):
./build.sh --coverage test coverage -
Create Release:
cmake --build build --target publish # Patch release cmake --build build --target publish-minor # Minor release cmake --build build --target publish-major # Major release
Adding New Tests
Tests use Google Test framework. Add test files in the appropriate tests/ subdirectory:
#include <gtest/gtest.h> #include "your/module.hpp" TEST(ModuleTest, BasicFunctionality) { // Your test code EXPECT_EQ(expected, actual); }
๐ฏ Supported Platforms
| Platform | Architecture | Compiler | Status |
|---|---|---|---|
| Linux | x86_64 | GCC 7+ | โ Fully Supported |
| Linux | x86_64 | Clang 8+ | โ Fully Supported |
| macOS | x86_64 | Clang | โ Fully Supported |
| macOS | ARM64 | Clang | โ Fully Supported |
| Windows | x86_64 | MSVC 2019+ | โ Fully Supported |
| Windows | x86_64 | MinGW | โ ๏ธ Basic Support |
๐ Current Status
- Version: 4.10.6
- Test Coverage: ~60% line coverage, ~67% function coverage
- Tests: 65 tests across 21 test suites
- Build System: CMake 3.16+ with cross-platform support
- APT Repository: Available for Ubuntu/Debian systems
๐ค Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
./build.sh test - Submit a pull request
๐ License
This project is open source and licensed under the MIT License with Attribution Requirement.
Attribution Required: When integrating AK into other systems or creating derivative works, please mention ApertaCodex as the original creator.
See the LICENSE file for full details.
๐ง Troubleshooting
Common Issues
CMake Version Too Old
# Ubuntu/Debian - install newer CMake sudo apt remove cmake pip3 install cmake # macOS - update via Homebrew brew upgrade cmake
Missing C++17 Support
# Ubuntu/Debian - install GCC 7+ sudo apt install gcc-7 g++-7 # Update alternatives sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 60
Windows Build Issues
- Ensure Visual Studio 2019+ is installed with C++ tools
- Run build from "Developer Command Prompt for VS"
- Use PowerShell (not Command Prompt) for build scripts
Build Logs
- Linux/macOS: Check console output
- Windows: Check
build/CMakeFiles/CMakeError.logfor detailed errors
๐ Support
- Issues: GitHub Issues
- Documentation: This README and inline code comments
- Build Problems: Check troubleshooting section above`