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

source

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.

source

pub fn set_prefer_encrypt(self, value: &str) -> Self

Sets the prefer encrypt header.

source

pub fn prefer_encrypt(&self) -> Option<&str>

Returns the prefer encrypt header.

source

pub fn set_passcode_format(self, value: &str) -> Self

Sets the “Passcode-Format” header.

source

pub fn passcode_format(&self) -> Option<&str>

Returns the “Passcode-Format” header.

source

pub fn set_passcode(self, passcode: Password) -> Self

Sets the passcode.

source

pub fn passcode(&self) -> Option<&Password>

Returns the ASM’s passcode.

If the passcode has not yet been generated, this returns None.

source

pub fn set_passcode_begin(self, value: &str) -> Self

Sets the “Passcode-Begin” header.

source

pub fn passcode_begin(&self) -> Option<&str>

Returns the “Passcode-Begin” header.

source

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.

source

pub fn from_bytes(bytes: &[u8]) -> Result<AutocryptSetupMessageParser<'_>>

Parses the autocrypt setup message in r.

passcode is the passcode used to protect the message.

source

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.

source

pub fn into_cert(self) -> Cert

Returns the Cert consuming the AutocryptSetupMessage in the process.

Trait Implementations§

source§

impl Debug for AutocryptSetupMessage

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<AutocryptSetupMessage> for AutocryptSetupMessage

source§

fn eq(&self, other: &AutocryptSetupMessage) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for AutocryptSetupMessage

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.