1
1
/*!
2
2
3
- # Platorm -independent secure storage model
3
+ # Platform -independent secure storage model
4
4
5
5
This module defines a plug and play model for platform-specific credential stores.
6
6
The model comprises two traits: [CredentialBuilderApi] for the underlying store
@@ -44,17 +44,25 @@ pub trait CredentialApi {
44
44
/// This will persist the secret in the underlying store.
45
45
fn set_secret ( & self , password : & [ u8 ] ) -> Result < ( ) > ;
46
46
47
- /// Retrieve a password (a string) from the credential, if one has been set .
47
+ /// Retrieve the password (a string) from the underlying credential .
48
48
///
49
- /// This has no effect on the underlying store.
49
+ /// This has no effect on the underlying store. If there is no credential
50
+ /// for this entry, a [NoEntry](crate::Error::NoEntry) error is returned.
50
51
fn get_password ( & self ) -> Result < String > ;
51
52
52
- /// Retrieve a secret (a byte array) from the credential, if one has been set .
53
+ /// Retrieve a secret (a byte array) from the credential.
53
54
///
54
- /// This has no effect on the underlying store.
55
+ /// This has no effect on the underlying store. If there is no credential
56
+ /// for this entry, a [NoEntry](crate::Error::NoEntry) error is returned.
55
57
fn get_secret ( & self ) -> Result < Vec < u8 > > ;
56
58
57
- /// Get the attributes on this credential from the underlying store.
59
+ /// Get the secure store attributes on this entry's credential.
60
+ ///
61
+ /// Each credential store may support reading and updating different
62
+ /// named attributes; see the documentation on each of the stores
63
+ /// for details. Note that the keyring itself uses some of these
64
+ /// attributes to map entries to their underlying credential; these
65
+ /// _controlled_ attributes are not available for reading or updating.
58
66
///
59
67
/// We provide a default (no-op) implementation of this method
60
68
/// for backward compatibility with stores that don't implement it.
@@ -65,7 +73,14 @@ pub trait CredentialApi {
65
73
Ok ( HashMap :: new ( ) )
66
74
}
67
75
68
- /// Update attributes on the underlying credential store.
76
+ /// Update the secure store attributes on this entry's credential.
77
+ ///
78
+ /// Each credential store may support reading and updating different
79
+ /// named attributes; see the documentation on each of the stores
80
+ /// for details. The implementation will ignore any attribute names
81
+ /// that you supply that are not available for update. Because the
82
+ /// names used by the different stores tend to be distinct, you can
83
+ /// write cross-platform code that will work correctly on each platform.
69
84
///
70
85
/// We provide a default no-op implementation of this method
71
86
/// for backward compatibility with stores that don't implement it.
0 commit comments