pub(crate) trait DcKey:
Serialize
+ Deserializable
+ Clone {
// Required methods
fn to_asc(&self, header: Option<(&str, &str)>) -> String;
fn dc_fingerprint(&self) -> Fingerprint;
fn is_private() -> bool;
fn key_id(&self) -> KeyId;
// 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 { ... }
}
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§
Sourcefn to_asc(&self, header: Option<(&str, &str)>) -> String
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.
Sourcefn dc_fingerprint(&self) -> Fingerprint
fn dc_fingerprint(&self) -> Fingerprint
The fingerprint for the key.
fn is_private() -> bool
fn key_id(&self) -> KeyId
Provided Methods§
Sourcefn from_slice(bytes: &[u8]) -> Result<Self>
fn from_slice(bytes: &[u8]) -> Result<Self>
Create a key from some bytes.
Sourcefn from_base64(data: &str) -> Result<Self>
fn from_base64(data: &str) -> Result<Self>
Create a key from a base64 string.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.