request->getPathParam('token'); $secret = $this->secretService->retrieveAndDelete($token); if ($secret === null) { $this->httpStatusCode = Http::NOT_FOUND; return $this->showErrorMessage('Not found'); } $this->notifyStatusChanged($token, SecretService::STATUS_RETRIEVED); $response = [ 'ciphertext' => Base64Url::encode($secret->getCiphertext()), 'nonce' => Base64Url::encode($secret->getNonce()), ]; $attachmentCiphertext = $secret->getAttachmentCiphertext(); $attachmentNonce = $secret->getAttachmentNonce(); $attachmentMeta = $secret->getAttachmentMeta(); if ($attachmentCiphertext !== null && $attachmentNonce !== null && $attachmentMeta !== null) { $response['attachment_ciphertext'] = Base64Url::encode($attachmentCiphertext); $response['attachment_nonce'] = Base64Url::encode($attachmentNonce); $response['attachment_meta'] = Base64Url::encode($attachmentMeta); } return $response; } catch (Throwable $e) { $this->secretLogger->logException($e); return $this->showErrorMessage('Unable to retrieve secret'); } } }