pub struct Complete {
pub name: String,
pub config: Config,
pub last_modified: DateTime<Utc>,
pub public_key: PublicKey,
pub credentials: Option<Credentials>,
}
Expand description
A complete user identity, representing the secret key, public key, and user info
Fields§
§name: String
§config: Config
§last_modified: DateTime<Utc>
§public_key: PublicKey
§credentials: Option<Credentials>
Implementations§
Source§impl Complete
impl Complete
Sourcepub async fn prompt_changes(
&self,
to_replace: Option<String>,
link_remote: bool,
) -> Result<Self, Error>
pub async fn prompt_changes( &self, to_replace: Option<String>, link_remote: bool, ) -> Result<Self, Error>
Prompt the user to make changes to an identity, returning the new identity
§Arguments
replace_current
- The identity to replace
Sourcepub async fn create(&self, link_remote: bool) -> Result<(), Error>
pub async fn create(&self, link_remote: bool) -> Result<(), Error>
Create a complete identity, including writing to disk & exchanging key with origin.
§Arguments
link_remote
- Override if the identity should be exchanged with the remote.
Sourcepub fn replace_with(self, new_identity: Self) -> Result<Self, Error>
pub fn replace_with(self, new_identity: Self) -> Result<Self, Error>
Replace an existing identity with a new one.
§Arguments
new_identity
- The new identity that will be created
Source§impl Complete
impl Complete
Source§impl Complete
impl Complete
Sourcepub fn new(
name: String,
config: Config,
public_key: PublicKey,
credentials: Option<Credentials>,
) -> Self
pub fn new( name: String, config: Config, public_key: PublicKey, credentials: Option<Credentials>, ) -> Self
Creates a new identity
§Arguments
name
- The name of the identity. This is encoded on-disk as identities/<NAME>
config
- User configuration including author details & SSH keypublic_key
- The user’s public keycredentials
- The user’s secret data including secret key & password
Sourcepub fn default() -> Result<Self, Error>
pub fn default() -> Result<Self, Error>
Creates the default identity, inferring details from the user’s profile
Sourcepub fn secret_key(&self) -> Option<SecretKey>
pub fn secret_key(&self) -> Option<SecretKey>
Returns the secret key, if one exists
Sourcepub fn as_portable(&self) -> Self
pub fn as_portable(&self) -> Self
Strips the identity of any device-specific information, such as key path & identity name Returns the stripped identity
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Complete
impl<'de> Deserialize<'de> for Complete
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
Auto Trait Implementations§
impl !Freeze for Complete
impl RefUnwindSafe for Complete
impl Send for Complete
impl Sync for Complete
impl Unpin for Complete
impl UnwindSafe for Complete
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