Module ubiq::credentials
source · Expand description
Credentials for authenticating to the Ubiq platform
Credentials consist of several unique strings of data and can be found in the .ubiq/credentials file in the user’s home directory, in the environment or a combination of both. This module handles retrieval of the credentials from those locations or the creation of credentials from manually-specified strings.
The credentials file
The credentials file takes the form:
[profile]
ACCESS_KEY_ID = ...
SECRET_SIGNING_KEY = ...
SECRET_CRYPTO_ACCESS_KEY = ...
HOST = ...
The first three items are required. The last (HOST
) is not
required, and a suitable default will be supplied if it is not
present. The host name may or may not contain a leading http://
or https://
. By default, this file is located at .ubiq/credentials
in the user’s home directory.
profile
may be specified as default
, and this profile will
be loaded if one is not specified.
Credentials in the environment
The credentials may also be specified in the environment using the names
above, prefixed with UBIQ_
, e.g. ACCESS_KEY_ID
becomes
UBIQ_ACCESS_KEY_ID
in the environment. Rules governing the precedence
of these variables is described at Credentials::new()
.
Examples
Default credentials
use ubiq::credentials::Credentials;
let creds = Credentials::new(None, None).unwrap();
Manually-specified credentials
use ubiq::credentials::Credentials;
let creds = Credentials::create(
"ACCESS_KEY_ID".to_string(),
"SECRET_SIGNING_KEY".to_string(),
"SECRET_CRYPTO_ACCESS_KEY".to_string(),
None,
);
Structs
- The aggregation of the individual credential components