Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /SINTEF-9012_SINDIT20 /src /sindit /api /vault_endpoints.py
| from fastapi import HTTPException, Depends | |
| from sindit.initialize_vault import vault_service | |
| from sindit.util.log import logger | |
| from sindit.api.authentication_endpoints import User, get_current_active_user | |
| from sindit.api.api import app | |
| async def store_secret( | |
| secret_path: str, | |
| secret_value: str, | |
| current_user: User = Depends(get_current_active_user), | |
| ) -> dict: | |
| """ | |
| Store a secret in the vault. | |
| """ | |
| try: | |
| result = vault_service.get_vault(current_user.username).storeSecret( | |
| secret_path, secret_value | |
| ) | |
| return {"result": result} | |
| except Exception as e: | |
| logger.error(f"Error storing secret {secret_path}: {e}") | |
| raise HTTPException(status_code=400, detail=str(e)) | |
| async def list_secret_paths( | |
| current_user: User = Depends(get_current_active_user), | |
| ) -> dict: | |
| """ | |
| List all secret paths in the vault. | |
| """ | |
| try: | |
| return { | |
| "secret_paths": vault_service.get_vault( | |
| current_user.username | |
| ).listSecretPaths() | |
| } | |
| except Exception as e: | |
| logger.error(f"Error listing secret paths: {e}") | |
| raise HTTPException(status_code=400, detail=str(e)) | |
Xet Storage Details
- Size:
- 2.21 kB
- Xet hash:
- 00918625f75e42aac72e6e4e7fd82dbd4ab0e80d46dd668696e322b584325288
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.