Trait deltachat::key::DcKey

source ·
pub(crate) trait DcKey: Serialize + Deserializable + KeyTrait + Clone {
    // Required method
    fn to_asc(&self, header: Option<(&str, &str)>) -> String;

    // Provided methods
    fn from_slice(bytes: &[u8]) -> Result<Self> { ... }
    fn from_base64(data: &str) -> Result<Self> { ... }
    fn from_asc(data: &str) -> Result<(Self, BTreeMap<String, String>)> { ... }
    fn to_bytes(&self) -> Vec<u8>  { ... }
    fn to_base64(&self) -> String { ... }
    fn fingerprint(&self) -> Fingerprint { ... }
}
Expand description

Convenience trait for working with keys.

This trait is implemented for rPGP’s SignedPublicKey and SignedSecretKey types and makes working with them a little easier in the deltachat world.

Required Methods§

source

fn to_asc(&self, header: Option<(&str, &str)>) -> String

Serialise the key to ASCII-armored representation.

Each header line must be terminated by \r\n. Only allows setting one header as a simplification since that’s the only way it’s used so far.

Provided Methods§

source

fn from_slice(bytes: &[u8]) -> Result<Self>

Create a key from some bytes.

source

fn from_base64(data: &str) -> Result<Self>

Create a key from a base64 string.

source

fn from_asc(data: &str) -> Result<(Self, BTreeMap<String, String>)>

Create a key from an ASCII-armored string.

Returns the key and a map of any headers which might have been set in the ASCII-armored representation.

source

fn to_bytes(&self) -> Vec<u8>

Serialise the key as bytes.

source

fn to_base64(&self) -> String

Serialise the key to a base64 string.

source

fn fingerprint(&self) -> Fingerprint

The fingerprint for the key.

Object Safety§

This trait is not object safe.

Implementors§