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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
use sos_core::{SecretId, VaultId};
use thiserror::Error;
use urn::Urn;
/// Errors generated by the library.
#[derive(Debug, Error)]
pub enum Error {
/// Error generated when an account does not exist.
#[error("account not found '{0}'")]
NoAccount(String),
/// Error generated when a folder password could not be located.
#[error("folder password not found for '{0}'")]
NoFolderPassword(VaultId),
/// Error generated when a login vault does not contain
/// the identity bit flag.
#[error("vault is not an identity vault")]
NotIdentityFolder,
/// Error generated parsing an AGE identity from a string.
#[error("failed to parse AGE identity: '{0}'")]
AgeIdentityParse(String),
/// Error generated when an identity key could not be
/// found in an identity vault.
#[error("identity vault does not contain a valid account identity key")]
NoIdentityKey,
/// Error generated when a vault entry in an identity vault is of
/// the wrong secret kind.
#[error("vault entry for {0} is of an unexpected type")]
VaultEntryKind(String),
/// Error generated when attempting to parse an AGE identity.
#[error(r#"invalid x25519 identity '{0}'"#)]
InvalidX25519Identity(String),
/// Error generated when a vault does not contain a secret by URN.
#[error("vault {0} does not contain {1}")]
NoSecretUrn(VaultId, Urn),
/// Error generated when a vault does not contain a secret by identifier.
#[error("vault {0} does not contain {1}")]
NoSecretId(VaultId, SecretId),
/// Error generated when a file encryption password could not be found.
#[error("could not find file encryption password in identity folder")]
NoFileEncryptionPassword,
/// Error generated converting to fixed length slice.
#[error(transparent)]
TryFromSlice(#[from] std::array::TryFromSliceError),
/// Error generated by the IO module.
#[error(transparent)]
Io(#[from] std::io::Error),
/// Error generated by the core library.
#[error(transparent)]
Core(#[from] sos_core::Error),
/// Authentication errors.
#[error(transparent)]
Authentication(#[from] sos_core::AuthenticationError),
/// Error generated by the backend library.
#[error(transparent)]
Backend(#[from] sos_backend::Error),
/// Error generated by the database library.
#[error(transparent)]
Database(#[from] sos_backend::database::Error),
/// Error generated by the async sqlite library.
#[error(transparent)]
AsyncSqlite(#[from] sos_backend::database::async_sqlite::Error),
/// Error generated by the sqlite library.
#[error(transparent)]
Sqlite(#[from] sos_backend::database::async_sqlite::rusqlite::Error),
/// Error generated by the password library.
#[error(transparent)]
Password(#[from] sos_password::Error),
/// Error generated by the signer library.
#[error(transparent)]
Signer(#[from] sos_signer::Error),
/// Error generated by the vault library.
#[error(transparent)]
Vault(#[from] sos_vault::Error),
/// Error generated by the Ed25519 library.
#[error(transparent)]
Ed25519(#[from] ed25519_dalek::ed25519::Error),
/// Error generated by the URN library.
#[error(transparent)]
Urn(#[from] urn::Error),
}