Skip to content

Commit 165fc8e

Browse files
committed
Improve platform-indepdendent credential docs.
Add material around attributes.
1 parent ed75bcf commit 165fc8e

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

src/credential.rs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
3-
# Platorm-independent secure storage model
3+
# Platform-independent secure storage model
44
55
This module defines a plug and play model for platform-specific credential stores.
66
The model comprises two traits: [CredentialBuilderApi] for the underlying store
@@ -44,17 +44,25 @@ pub trait CredentialApi {
4444
/// This will persist the secret in the underlying store.
4545
fn set_secret(&self, password: &[u8]) -> Result<()>;
4646

47-
/// Retrieve a password (a string) from the credential, if one has been set.
47+
/// Retrieve the password (a string) from the underlying credential.
4848
///
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.
5051
fn get_password(&self) -> Result<String>;
5152

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.
5354
///
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.
5557
fn get_secret(&self) -> Result<Vec<u8>>;
5658

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.
5866
///
5967
/// We provide a default (no-op) implementation of this method
6068
/// for backward compatibility with stores that don't implement it.
@@ -65,7 +73,14 @@ pub trait CredentialApi {
6573
Ok(HashMap::new())
6674
}
6775

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.
6984
///
7085
/// We provide a default no-op implementation of this method
7186
/// for backward compatibility with stores that don't implement it.

0 commit comments

Comments
 (0)