Trait Encode

Source
pub trait Encode {
    // Required methods
    fn to_bytes(&self) -> (Vec<u8>, Vec<u8>);
    fn from_bytes(cipher: &[u8], keybase: &[u8]) -> Result<Self, FbError>
       where Self: Sized;
    fn to_base64(&self) -> (String, String);
    fn from_base64(cipher: &str, keybase: &str) -> Result<Self, FbError>
       where Self: Sized;
}
Expand description

Provides methods to encode and decode data to and from several formats.

Required Methods§

Source

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

Returns the byte representation of the ciphertext and keybase.

Source

fn from_bytes(cipher: &[u8], keybase: &[u8]) -> Result<Self, FbError>
where Self: Sized,

Constructs the FbObj from the provided byte representations of ciphertext and keybase.

§Errors
Source

fn to_base64(&self) -> (String, String)

Available on crate feature base64 only.

Returns the base64 encoded representation of the ciphertext and keybase.
Requires base64 feature to be enabled.

Source

fn from_base64(cipher: &str, keybase: &str) -> Result<Self, FbError>
where Self: Sized,

Available on crate feature base64 only.

Constructs the FbObj from the provided base64 encoded forms of ciphertext and keybase.
Requires base64 feature to be enabled.

§Errors

Implementors§

Source§

impl<const LIMBS: usize> Encode for FbObj<Uint<LIMBS>>
where Uint<LIMBS>: ArrayEncoding,