1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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::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::LairError {
fn from(e: KeystoreError) -> lair_keystore_api::LairError {
match e {
KeystoreError::LairError(e) => e,
_ => lair_keystore_api::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()
}
}