use crate::*;
use holochain_zome_types::signature::Signature;
#[derive(Debug, thiserror::Error)]
pub enum KeystoreError {
#[error("GhostError: {0}")]
GhostError(#[from] ghost_actor::GhostError),
#[error(transparent)]
LairError(#[from] lair_keystore_api_0_0::LairError),
#[error("SerializedBytesError: {0}")]
SerializedBytesError(#[from] SerializedBytesError),
#[error("Invalid signature {0:?}, for {1}")]
InvalidSignature(Signature, String),
#[error("Secure primitive error: {0}")]
SecurePrimitiveError(#[from] holochain_zome_types::SecurePrimitiveError),
#[error("Other: {0}")]
Other(String),
}
impl From<KeystoreError> for lair_keystore_api_0_0::LairError {
fn from(e: KeystoreError) -> lair_keystore_api_0_0::LairError {
match e {
KeystoreError::LairError(e) => e,
_ => lair_keystore_api_0_0::LairError::other(e),
}
}
}
impl std::cmp::PartialEq for KeystoreError {
fn eq(&self, o: &Self) -> bool {
format!("{:?}", self) == format!("{:?}", o)
}
}
impl From<String> for KeystoreError {
fn from(e: String) -> Self {
KeystoreError::Other(e)
}
}
impl From<&String> for KeystoreError {
fn from(e: &String) -> Self {
e.to_string().into()
}
}
impl From<&str> for KeystoreError {
fn from(e: &str) -> Self {
e.to_string().into()
}
}