From e9f70e71158b124cf4f4b6e9f29bc9394a9581a0 Mon Sep 17 00:00:00 2001 From: netkas Date: Mon, 27 Jan 2025 12:38:36 -0500 Subject: [PATCH] Added method SettingsDeleteSignature --- .../SettingsDeleteSignature.php | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/Socialbox/Classes/StandardMethods/SettingsDeleteSignature.php diff --git a/src/Socialbox/Classes/StandardMethods/SettingsDeleteSignature.php b/src/Socialbox/Classes/StandardMethods/SettingsDeleteSignature.php new file mode 100644 index 0000000..4c250cd --- /dev/null +++ b/src/Socialbox/Classes/StandardMethods/SettingsDeleteSignature.php @@ -0,0 +1,49 @@ +containsParameter('uuid')) + { + return $rpcRequest->produceError(StandardError::RPC_INVALID_ARGUMENTS, "Missing 'uuid' parameter"); + } + + try + { + $uuid = Uuid::fromString($rpcRequest->getParameter('uuid')); + } + catch(InvalidArgumentException $e) + { + return $rpcRequest->produceError(StandardError::RPC_INVALID_ARGUMENTS, 'Invalid UUID'); + } + + try + { + SigningKeysManager::deleteSigningKey($request->getPeer()->getUuid(), $uuid); + } + catch(Exception $e) + { + throw new StandardException('Failed to delete the signing key', StandardError::INTERNAL_SERVER_ERROR, $e); + } + + return $rpcRequest->produceResponse(true); + } + } \ No newline at end of file