[][src]Crate itsdangerous

A rust re-implementation of the Python library itsdangerous.

Essentially, this crate provides various helpers to pass data to untrusted environments and get it back safe and sound. Data is cryptographically signed to ensure that it has not been tampered with.

Signers

  • Signer, a signer that signs/unsigns arbitrary values.
  • TimestampSigner, a signer that signs/unsigns arbitrary values attaching a signed timestamp so you know when the value was signed.

Basic Example

use std::time::Duration;
use itsdangerous::default_builder;

// Create a signer using the default builder, and an arbitrary secret key.
let signer = default_builder("secret key").build();

// Sign an arbitrary string.
let signed = signer.sign("hello world!");

// Unsign the string and validate whether or not its expired.
let unsigned = signer.unsign(&signed).expect("Signature was not valid");
assert_eq!(unsigned, "hello world!");

Re-exports

pub use error::BadSignature;
pub use error::BadTimedSignature;
pub use error::InvalidSeperator;
pub use error::PayloadError;
pub use error::TimestampExpired;
pub use seperator::Seperator;
pub use signer::default_builder;
pub use signer::Signer;
pub use signer::SignerBuilder;
pub use timed::TimestampSigner;

Modules

algorithm
base64
error
key_derivation
seperator
serde_serializer
signer
timed