pub struct ConfigCredentials {
role: UserRole,
name: UserId,
passphrase: Option<String>,
}
Expand description
A set of credentials for a [NetHsm
][nethsm::NetHsm
]
Tracks the [UserRole
], [UserId
] and optionally the passphrase of the user.
Fields§
§role: UserRole
§name: UserId
§passphrase: Option<String>
Implementations§
Source§impl ConfigCredentials
impl ConfigCredentials
Sourcepub fn new(role: UserRole, name: UserId, passphrase: Option<String>) -> Self
pub fn new(role: UserRole, name: UserId, passphrase: Option<String>) -> Self
Creates a new ConfigCredentials
§Examples
use nethsm::UserRole;
use nethsm_config::{ConfigCredentials, ConfigInteractivity};
// credentials for an Operator user with passphrase
ConfigCredentials::new(
UserRole::Operator,
"user1".parse()?,
Some("my-passphrase".into()),
);
// credentials for an Administrator user without passphrase
ConfigCredentials::new(UserRole::Administrator, "admin1".parse()?, None);
Sourcepub fn get_passphrase(&self) -> Option<&str>
pub fn get_passphrase(&self) -> Option<&str>
Returns the passphrase of the ConfigCredentials
Sourcepub fn set_passphrase(&mut self, passphrase: String)
pub fn set_passphrase(&mut self, passphrase: String)
Sets the passphrase of the ConfigCredentials
Sourcepub fn has_passphrase(&self) -> bool
pub fn has_passphrase(&self) -> bool
Returns whether a passphrase is set for the ConfigCredentials
Trait Implementations§
Source§impl Clone for ConfigCredentials
impl Clone for ConfigCredentials
Source§fn clone(&self) -> ConfigCredentials
fn clone(&self) -> ConfigCredentials
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ConfigCredentials
impl Debug for ConfigCredentials
Source§impl<'de> Deserialize<'de> for ConfigCredentials
impl<'de> Deserialize<'de> for ConfigCredentials
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<ConfigCredentials> for Credentials
impl From<ConfigCredentials> for Credentials
Source§fn from(value: ConfigCredentials) -> Self
fn from(value: ConfigCredentials) -> Self
Converts to this type from the input type.
Source§impl Hash for ConfigCredentials
impl Hash for ConfigCredentials
Source§impl PartialEq for ConfigCredentials
impl PartialEq for ConfigCredentials
Source§impl Serialize for ConfigCredentials
impl Serialize for ConfigCredentials
Source§impl Zeroize for ConfigCredentials
impl Zeroize for ConfigCredentials
impl Eq for ConfigCredentials
impl StructuralPartialEq for ConfigCredentials
Auto Trait Implementations§
impl Freeze for ConfigCredentials
impl RefUnwindSafe for ConfigCredentials
impl Send for ConfigCredentials
impl Sync for ConfigCredentials
impl Unpin for ConfigCredentials
impl UnwindSafe for ConfigCredentials
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.