[][src]Struct simple_secrets::Packet

pub struct Packet { /* fields omitted */ }

Data types

Converts serializable data to and from websafe strings.

Methods

impl Packet
[src]

Public functions

pub fn new(master: String) -> Result<Packet, SimpleError>
[src]

Construct a Packet with the given master key. Must be 64 hex characters.

pub fn pack<T: ?Sized>(&self, value: &T) -> Result<String, SimpleError> where
    T: Serialize
[src]

Turn a Rust type into an encrypted packet. This object will possibly be deserialized in a different programming environment—it should be JSON-like in structure.

pub fn unpack<'a, T>(&self, websafe: String) -> Result<T, SimpleError> where
    T: Deserialize<'a>, 
[src]

Turn an encrypted packet into a Rust structure. This object possibly originated in a different programming environment—it should be JSON-like in structure.

pub fn pack_raw(&self, data: &mut Vec<u8>) -> Result<String, SimpleError>
[src]

Encrypt a packet into raw bytes. This allows the caller to issue app-specific typesafe serialization calls beforehand.

pub fn unpack_raw(&self, websafe: String) -> Result<Vec<u8>, SimpleError>
[src]

Decrypt a packet into raw bytes. This allows the caller to issue app-specific typesafe deserialization calls later.

Trait Implementations

impl From<[u8; 32]> for Packet
[src]

fn from(key: [u8; 32]) -> Self
[src]

Construct a Packet with the given 256-bit master key.

impl Drop for Packet
[src]

fn drop(&mut self)
[src]

Ensure that sensitive data is removed from memory

Auto Trait Implementations

impl Send for Packet

impl Sync for Packet

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]