diff --git a/src/Socialbox/Classes/StandardMethods/SettingsGetSigningKey.php b/src/Socialbox/Classes/StandardMethods/SettingsGetSigningKey.php new file mode 100644 index 0000000..e004dea --- /dev/null +++ b/src/Socialbox/Classes/StandardMethods/SettingsGetSigningKey.php @@ -0,0 +1,43 @@ +containsParameter('uuid') && $rpcRequest->getParameter('uuid') !== null) + { + return $rpcRequest->produceError(StandardError::RPC_INVALID_ARGUMENTS, "Missing 'uuid' parameter"); + } + + try + { + $key = SigningKeysManager::getSigningKey($request->getPeer()->getUuid(), $rpcRequest->getParameter('uuid')); + } + catch (DatabaseOperationException $e) + { + throw new StandardException('Failed to get the signing keys', StandardError::INTERNAL_SERVER_ERROR, $e); + } + + if($key === null) + { + return $rpcRequest->produceError(StandardError::NOT_FOUND, 'The signing key does not exist'); + } + + // Return the signing key + return $rpcRequest->produceResponse($key->toStandard()); + } + } \ No newline at end of file