pub struct AutocryptSetupMessage { /* private fields */ }Expand description
Holds an Autocrypt Setup Message.
An Autocrypt Setup Message is used to transfer a private key from one device to another.
Implementations§
Source§impl AutocryptSetupMessage
impl AutocryptSetupMessage
Sourcepub fn new(cert: Cert) -> Self
pub fn new(cert: Cert) -> Self
Creates a new Autocrypt Setup Message for the specified Cert.
You can set the prefer_encrypt setting, which defaults to
“nopreference”, using set_prefer_encrypt.
Note: this generates a random passcode. To retrieve the
passcode, use the passcode method.
To decode an Autocrypt Setup Message, use the from_bytes or
from_reader methods.
Sourcepub fn set_prefer_encrypt(self, value: &str) -> Self
pub fn set_prefer_encrypt(self, value: &str) -> Self
Sets the prefer encrypt header.
Sourcepub fn prefer_encrypt(&self) -> Option<&str>
pub fn prefer_encrypt(&self) -> Option<&str>
Returns the prefer encrypt header.
Sourcepub fn set_passcode_format(self, value: &str) -> Self
pub fn set_passcode_format(self, value: &str) -> Self
Sets the “Passcode-Format” header.
Sourcepub fn passcode_format(&self) -> Option<&str>
pub fn passcode_format(&self) -> Option<&str>
Returns the “Passcode-Format” header.
Sourcepub fn set_passcode(self, passcode: Password) -> Self
pub fn set_passcode(self, passcode: Password) -> Self
Sets the passcode.
Sourcepub fn passcode(&self) -> Option<&Password>
pub fn passcode(&self) -> Option<&Password>
Returns the ASM’s passcode.
If the passcode has not yet been generated, this returns
None.
Sourcepub fn set_passcode_begin(self, value: &str) -> Self
pub fn set_passcode_begin(self, value: &str) -> Self
Sets the “Passcode-Begin” header.
Sourcepub fn passcode_begin(&self) -> Option<&str>
pub fn passcode_begin(&self) -> Option<&str>
Returns the “Passcode-Begin” header.
Sourcepub fn serialize<W>(&mut self, w: &mut W) -> Result<()>
pub fn serialize<W>(&mut self, w: &mut W) -> Result<()>
Generates the Autocrypt Setup Message.
The message is written to w.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<AutocryptSetupMessageParser<'_>>
pub fn from_bytes(bytes: &[u8]) -> Result<AutocryptSetupMessageParser<'_>>
Parses the autocrypt setup message in r.
passcode is the passcode used to protect the message.
Sourcepub fn from_reader<'a, R: Read + Send + Sync + 'a>(
r: R,
) -> Result<AutocryptSetupMessageParser<'a>>
pub fn from_reader<'a, R: Read + Send + Sync + 'a>( r: R, ) -> Result<AutocryptSetupMessageParser<'a>>
Parses the autocrypt setup message in r.
passcode is the passcode used to protect the message.