@@ -11,8 +11,8 @@ use crate::{
11
11
use secrecy:: SecretString ;
12
12
use sos_backend:: { database:: async_sqlite:: Client , BackendTarget } ;
13
13
use sos_core:: {
14
- crypto:: AccessKey , decode, events:: Event , AccountId , Paths , SecretId ,
15
- VaultId ,
14
+ crypto:: AccessKey , decode, events:: Event , AccountId , AuthenticationError ,
15
+ Paths , SecretId , VaultId ,
16
16
} ;
17
17
use sos_vault:: { list_local_folders, read_public_identity, Summary , Vault } ;
18
18
use sos_vfs as vfs;
@@ -81,29 +81,42 @@ impl Identity {
81
81
82
82
/// Device manager.
83
83
pub fn devices ( & self ) -> Result < & DeviceManager > {
84
- self . identity
84
+ Ok ( self
85
+ . identity
85
86
. as_ref ( )
86
- . ok_or ( Error :: NotAuthenticated ) ?
87
- . devices ( )
87
+ . ok_or ( AuthenticationError :: NotAuthenticated ) ?
88
+ . devices ( ) ? )
88
89
}
89
90
90
91
/// Account information.
91
92
pub fn account ( & self ) -> Result < & PublicIdentity > {
92
- self . account . as_ref ( ) . ok_or ( Error :: NotAuthenticated )
93
+ Ok ( self
94
+ . account
95
+ . as_ref ( )
96
+ . ok_or ( AuthenticationError :: NotAuthenticated ) ?)
93
97
}
94
98
95
99
fn account_mut ( & mut self ) -> Result < & mut PublicIdentity > {
96
- self . account . as_mut ( ) . ok_or ( Error :: NotAuthenticated )
100
+ Ok ( self
101
+ . account
102
+ . as_mut ( )
103
+ . ok_or ( AuthenticationError :: NotAuthenticated ) ?)
97
104
}
98
105
99
106
/// Private identity.
100
107
pub fn identity ( & self ) -> Result < & IdentityFolder > {
101
- self . identity . as_ref ( ) . ok_or ( Error :: NotAuthenticated )
108
+ Ok ( self
109
+ . identity
110
+ . as_ref ( )
111
+ . ok_or ( AuthenticationError :: NotAuthenticated ) ?)
102
112
}
103
113
104
114
#[ doc( hidden) ]
105
115
pub fn identity_mut ( & mut self ) -> Result < & mut IdentityFolder > {
106
- self . identity . as_mut ( ) . ok_or ( Error :: NotAuthenticated )
116
+ Ok ( self
117
+ . identity
118
+ . as_mut ( )
119
+ . ok_or ( AuthenticationError :: NotAuthenticated ) ?)
107
120
}
108
121
109
122
/// Verify the access key for this account.
0 commit comments