Struct sequoia_autocrypt::AutocryptSetupMessage
source · 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<()>where
W: Write + Send + Sync,
pub fn serialize<W>(&mut self, w: &mut W) -> Result<()>where W: Write + Send + Sync,
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.
Trait Implementations§
source§impl Debug for AutocryptSetupMessage
impl Debug for AutocryptSetupMessage
source§impl PartialEq<AutocryptSetupMessage> for AutocryptSetupMessage
impl PartialEq<AutocryptSetupMessage> for AutocryptSetupMessage
source§fn eq(&self, other: &AutocryptSetupMessage) -> bool
fn eq(&self, other: &AutocryptSetupMessage) -> bool
self
and other
values to be equal, and is used
by ==
.