{"id":42374388,"url":"https://github.com/emorilebo/mobile_secrets_vault","last_synced_at":"2026-01-27T20:05:19.965Z","repository":{"id":325543095,"uuid":"1101583406","full_name":"emorilebo/mobile_secrets_vault","owner":"emorilebo","description":"Secure secrets management for mobile backend applications with encryption, versioning, and audit logging","archived":false,"fork":false,"pushed_at":"2025-11-21T22:57:58.000Z","size":155,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-22T00:20:32.453Z","etag":null,"topics":["aes-gcm","cryptography","django","emori","encryption","fastapi","godfreylebo","mobile-backend","python","secrets-management","security"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emorilebo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-21T22:18:32.000Z","updated_at":"2025-11-21T22:54:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/emorilebo/mobile_secrets_vault","commit_stats":null,"previous_names":["emorilebo/mobile_secrets_vault"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/emorilebo/mobile_secrets_vault","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emorilebo%2Fmobile_secrets_vault","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emorilebo%2Fmobile_secrets_vault/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emorilebo%2Fmobile_secrets_vault/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emorilebo%2Fmobile_secrets_vault/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emorilebo","download_url":"https://codeload.github.com/emorilebo/mobile_secrets_vault/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emorilebo%2Fmobile_secrets_vault/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28820352,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aes-gcm","cryptography","django","emori","encryption","fastapi","godfreylebo","mobile-backend","python","secrets-management","security"],"created_at":"2026-01-27T20:04:32.948Z","updated_at":"2026-01-27T20:05:19.957Z","avatar_url":"https://github.com/emorilebo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mobile Secrets Vault 🔐\n\n[![PyPI version](https://badge.fury.io/py/mobile-secrets-vault.svg)](https://badge.fury.io/py/mobile-secrets-vault)\n[![Python Versions](https://img.shields.io/pypi/pyversions/mobile-secrets-vault.svg)](https://pypi.org/project/mobile-secrets-vault/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![codecov](https://codecov.io/gh/godfreylebo/mobile_secrets_vault/branch/main/graph/badge.svg)](https://codecov.io/gh/godfreylebo/mobile_secrets_vault)\n\nA robust, secure Python package for managing secrets in mobile backend applications (FastAPI, Django, Flask) with AES-GCM-256 encryption, versioning, rotation, and audit logging.\n\n## ✨ Features\n\n- **🔒 Military-Grade Encryption**: AES-GCM-256 authenticated encryption\n- **📚 Version Control**: Track secret history with automatic versioning\n- **🔄 Key Rotation**: Seamlessly rotate encryption keys without downtime\n- **📝 Audit Logging**: Complete audit trail of all operations\n- **🖥️ CLI \u0026 Python API**: Use via command line or integrate programmatically\n- **🚀 Backend Integration**: Ready-to-use examples for FastAPI and Django\n- **🧪 Battle-Tested**: Comprehensive test suite with 95%+ coverage\n- **🐍 Modern Python**: Supports Python 3.8+\n\n## 🚀 Quick Start\n\n### Installation\n\n```bash\npip install mobile-secrets-vault\n```\n\n### CLI Usage\n\n```bash\n# Initialize a new vault\nvault init\n\n# Set secrets\nvault set DATABASE_URL \"postgresql://localhost/mydb\"\nvault set API_KEY \"secret-key-12345\"\n\n# Get secrets\nvault get DATABASE_URL\n\n# List all secrets\nvault list\n\n# View version history\nvault list-versions DATABASE_URL\n\n# Rotate encryption key\nvault rotate\n```\n\n### Python API Usage\n\n```python\nfrom mobile_secrets_vault import MobileSecretsVault\n\n# Initialize vault\nvault = MobileSecretsVault(\n    master_key_file=\".vault/master.key\",\n    secrets_filepath=\".vault/secrets.yaml\"\n)\n\n# Set a secret\nversion = vault.set(\"API_KEY\", \"my-secret-value\")\nprint(f\"Secret saved as version {version}\")\n\n# Get a secret\napi_key = vault.get(\"API_KEY\")\nprint(f\"API Key: {api_key}\")\n\n# List all secrets\nsecrets = vault.list_keys()\nprint(f\"Stored secrets: {secrets}\")\n\n# View version history\nversions = vault.list_versions(\"API_KEY\")\nfor v in versions:\n    print(f\"Version {v['version']}: {v['timestamp']}\")\n\n# Rotate encryption key\nnew_key = vault.rotate()\nprint(\"All secrets re-encrypted with new key!\")\n```\n\n## 📖 Documentation\n\n### CLI Commands\n\n| Command | Description | Example |\n|---------|-------------|---------|\n| `vault init` | Initialize vault and generate master key | `vault init --output-dir .vault` |\n| `vault set \u003ckey\u003e \u003cvalue\u003e` | Set or update a secret | `vault set DB_PASS mypassword` |\n| `vault get \u003ckey\u003e` | Retrieve a secret | `vault get DB_PASS` |\n| `vault delete \u003ckey\u003e` | Delete a secret | `vault delete OLD_KEY --yes` |\n| `vault list` | List all secret keys | `vault list` |\n| `vault list-versions \u003ckey\u003e` | Show version history | `vault list-versions API_KEY` |\n| `vault rotate` | Rotate master encryption key | `vault rotate --new-key-file new.key` |\n| `vault audit` | View audit logs | `vault audit --key API_KEY` |\n\n### Python API Methods\n\n```python\nclass MobileSecretsVault:\n    def __init__(\n        self,\n        master_key: bytes = None,\n        master_key_file: str = None,\n        secrets_filepath: str = None,\n        audit_log_file: str = None,\n        auto_save: bool = True\n    )\n    \n    def set(self, key: str, value: str, metadata: dict = None) -\u003e int\n    def get(self, key: str, version: int = None) -\u003e str\n    def delete(self, key: str) -\u003e bool\n    def list_keys(self) -\u003e list[str]\n    def list_versions(self, key: str) -\u003e list[dict]\n    def rotate(self, new_key: bytes = None) -\u003e bytes\n    def get_audit_log(self, key: str = None, limit: int = 100) -\u003e list[dict]\n    def save(self) -\u003e None\n```\n\n## 🏗️ Integration Examples\n\n### FastAPI Integration\n\n```python\nfrom fastapi import FastAPI, Depends\nfrom mobile_secrets_vault import MobileSecretsVault\n\napp = FastAPI()\nvault = None\n\n@app.on_event(\"startup\")\nasync def startup():\n    global vault\n    vault = MobileSecretsVault(\n        master_key_file=\".vault/master.key\",\n        secrets_filepath=\".vault/secrets.yaml\"\n    )\n\n@app.get(\"/config\")\ndef get_config():\n    return {\n        \"database_url\": vault.get(\"DATABASE_URL\"),\n        \"api_key\": vault.get(\"API_KEY\")\n    }\n```\n\nSee [examples/fastapi_example.py](examples/fastapi_example.py) for a complete implementation.\n\n### Django Integration\n\n```python\n# settings.py\nfrom mobile_secrets_vault import MobileSecretsVault\n\nVAULT = MobileSecretsVault(\n    master_key_file=BASE_DIR / '.vault' / 'master.key',\n    secrets_filepath=BASE_DIR / '.vault' / 'secrets.yaml'\n)\n\nSECRET_KEY = VAULT.get('DJANGO_SECRET_KEY')\nDATABASES = {\n    'default': {\n        'PASSWORD': VAULT.get('DB_PASSWORD'),\n        'USER': VAULT.get('DB_USER'),\n    }\n}\n```\n\nSee [examples/django_example.py](examples/django_example.py) for a complete implementation.\n\n## 🔐 Security Best Practices\n\n### Master Key Management\n\n\u003e [!CAUTION]\n\u003e **NEVER commit your master key to version control!**\n\n1. **Add to .gitignore**:\n   ```bash\n   echo \".vault/\" \u003e\u003e .gitignore\n   ```\n\n2. **Store securely in production**:\n   - Use environment variables\n   - Use cloud secret managers (AWS Secrets Manager, Google Secret Manager)\n   - Use hardware security modules (HSM) for enterprise deployments\n\n3. **Backup your master key**:\n   - Store encrypted backups in multiple secure locations\n   - Use password managers for team access\n   - Document key recovery procedures\n\n### Encryption Details\n\n- **Algorithm**: AES-GCM-256 (Authenticated Encryption with Associated Data)\n- **Key Size**: 256 bits (32 bytes)\n- **Nonce**: Random 96-bit nonce per encryption\n- **Authentication**: Built-in authentication tag prevents tampering\n\n### Production Deployment\n\n```bash\n# Option 1: Environment variable\nexport VAULT_MASTER_KEY=\"\u003cbase64-encoded-key\u003e\"\n\n# Option 2: Mounted key file (Kubernetes, Docker)\nvault --master-key-file /run/secrets/vault_key get API_KEY\n\n# Option 3: Cloud secret manager\n# Retrieve master key from AWS Secrets Manager, then initialize vault\n```\n\n## 🧪 Development\n\n### Setup Development Environment\n\n```bash\n# Clone repository\ngit clone https://github.com/godfreylebo/mobile_secrets_vault.git\ncd mobile_secrets_vault\n\n# Install in development mode\npip install -e \".[dev]\"\n\n# Run tests\npytest\n\n# Run tests with coverage\npytest --cov=mobile_secrets_vault --cov-report=html\n\n# Format code\nblack src/ tests/\n\n# Lint code\nflake8 src/ tests/\n\n# Type check\nmypy src/\n```\n\n### Running Tests\n\n```bash\n# All tests\npytest\n\n# Specific test file\npytest tests/test_vault.py\n\n# With coverage report\npytest --cov=mobile_secrets_vault --cov-report=term-missing\n\n# Verbose output\npytest -v\n```\n\n## 📦 Publishing to PyPI\n\n### Prerequisites\n\n1. **Create PyPI Account**: Sign up at [pypi.org](https://pypi.org)\n2. **Create API Token**: Settings → API tokens → Add API token\n3. **Install build tools**:\n   ```bash\n   pip install build twine\n   ```\n\n### Build and Publish\n\n```bash\n# 1. Update version in pyproject.toml\n# version = \"0.1.0\" -\u003e \"0.1.1\"\n\n# 2. Build package\npython -m build\n\n# 3. Check package\ntwine check dist/*\n\n# 4. Upload to TestPyPI (optional)\ntwine upload --repository testpypi dist/*\n\n# 5. Test installation\npip install --index-url https://test.pypi.org/simple/ mobile-secrets-vault\n\n# 6. Upload to PyPI (production)\ntwine upload dist/*\n```\n\n### Automated Publishing with GitHub Actions\n\nThe package includes a CI/CD workflow that automatically:\n- Runs tests on Python 3.8-3.12\n- Checks code formatting and linting\n- Publishes to PyPI on tagged releases\n\nTo trigger automated publishing:\n\n```bash\ngit tag v0.1.0\ngit push origin v0.1.0\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature/amazing-feature`\n3. Make your changes and add tests\n4. Run tests: `pytest`\n5. Format code: `black src/ tests/`\n6. Commit: `git commit -m 'Add amazing feature'`\n7. Push: `git push origin feature/amazing-feature`\n8. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 👤 Author\n\n**Godfrey Lebo**\n\n- GitHub: [@godfreylebo](https://github.com/godfreylebo)\n- PyPI: [mobile-secrets-vault](https://pypi.org/project/mobile-secrets-vault/)\n\n## 🙏 Acknowledgments\n\n- Built with [cryptography](https://cryptography.io/) for encryption\n- CLI powered by [click](https://click.palletsprojects.com/)\n- Storage using [PyYAML](https://pyyaml.org/)\n\n## 📊 Project Stats\n\n- **Lines of Code**: ~2,000\n- **Test Coverage**: 95%+\n- **Dependencies**: 4 (cryptography, click, PyYAML, python-dotenv)\n- **Python Versions**: 3.8, 3.9, 3.10, 3.11, 3.12\n\n---\n\n**⭐ If you find this project useful, please consider giving it a star on GitHub!**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femorilebo%2Fmobile_secrets_vault","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femorilebo%2Fmobile_secrets_vault","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femorilebo%2Fmobile_secrets_vault/lists"}