feat: create key in encryption service for merchant and user (#4910)

Co-authored-by: Arjun Karthik <m.arjunkarthik@gmail.com>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Kartikeya Hegde
2024-07-11 20:39:40 +05:30
committed by GitHub
parent f63a678d71
commit 43741df4a7
35 changed files with 668 additions and 7 deletions

View File

@ -145,6 +145,42 @@ where
}
}
#[allow(missing_docs)]
#[derive(Debug, thiserror::Error)]
pub enum KeyManagerClientError {
#[error("Failed to construct header from the given value")]
FailedtoConstructHeader,
#[error("Failed to send request to Keymanager")]
RequestNotSent(String),
#[error("URL encoding of request failed")]
UrlEncodingFailed,
#[error("Failed to build the reqwest client ")]
ClientConstructionFailed,
#[error("Failed to send the request to Keymanager")]
RequestSendFailed,
#[error("Internal Server Error Received {0:?}")]
InternalServerError(bytes::Bytes),
#[error("Bad request received {0:?}")]
BadRequest(bytes::Bytes),
#[error("Unexpected Error occurred while calling the KeyManager")]
Unexpected(bytes::Bytes),
#[error("Response Decoding failed")]
ResponseDecodingFailed,
}
#[allow(missing_docs)]
#[derive(Debug, thiserror::Error)]
pub enum KeyManagerError {
#[error("Failed to add key to the KeyManager")]
KeyAddFailed,
#[error("Failed to transfer the key to the KeyManager")]
KeyTransferFailed,
#[error("Failed to Encrypt the data in the KeyManager")]
EncryptionFailed,
#[error("Failed to Decrypt the data in the KeyManager")]
DecryptionFailed,
}
/// Allow [error_stack::Report] to convert between error types
/// This auto-implements [ReportSwitchExt] for the corresponding errors
pub trait ErrorSwitch<T> {