Refactor command handling

This now supports usage/help texts
This commit is contained in:
2025-05-18 17:56:53 +02:00
parent 26ef9b45d4
commit dcf0b4274c
15 changed files with 337 additions and 431 deletions

View File

@ -12,9 +12,15 @@ LOG = logging.getLogger(__name__)
@final
class GetSecret(CommandDispatcher):
"""Get Secret."""
"""Retrieve an encrypted secret.
Returns the value of the secret provided as a mandatory argument.
The secret will be encrypted using the stored RSA public key, and returned
as a base64 encoded string.
"""
name = "get_secret"
mandatory_argument = "SECRET"
@override
async def exec(self) -> None:
@ -22,6 +28,7 @@ class GetSecret(CommandDispatcher):
if len(self.arguments) != 1:
raise exceptions.UnknownClientOrSecretError()
secret_name = self.arguments[0]
LOG.debug("get_secret called: Argument: %r", secret_name)
if secret_name not in self.client.secrets:
await self.audit(
Operation.DENY,