#python #string #port #digital-signature #helpers #helper #signing #signature #sending

itsdangerous

Rust port of the popular itsdangerous python library for signing strings and sending them over untrusted channels

7 unstable releases

0.4.1 Mar 11, 2022
0.4.0 Apr 20, 2021
0.3.2 Mar 24, 2021
0.3.1 Jun 14, 2019
0.1.0 Jun 12, 2019

#496 in Cryptography

Download history 1856/week @ 2022-08-14 2979/week @ 2022-08-21 2508/week @ 2022-08-28 1408/week @ 2022-09-04 2307/week @ 2022-09-11 2313/week @ 2022-09-18 2363/week @ 2022-09-25 2586/week @ 2022-10-02 1023/week @ 2022-10-09 2803/week @ 2022-10-16 2564/week @ 2022-10-23 2162/week @ 2022-10-30 2951/week @ 2022-11-06 3035/week @ 2022-11-13 1534/week @ 2022-11-20 4089/week @ 2022-11-27

11,688 downloads per month

MIT license

78KB
1.5K SLoC

itsdangerous-rs

Build Status License Documentation Cargo

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.

Basic Usage

Add this to your Cargo.toml:

[dependencies]
itsdangerous = "0.3"

Next, get to signing some dangerous strings:

use itsdangerous::{default_builder, Signer};

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

    // Sign an arbitrary string, and send it somewhere dangerous.
    let signed = signer.sign("hello world!");

    // Unsign the string and validate that it hasn't been tampered with.
    let unsigned = signer.unsign(&signed).expect("Signature was not valid");
    assert_eq!(unsigned, "hello world!");
}

For more in-depth examples, check out the documentation!

License

Licensed under the MIT license.

Dependencies

~1MB
~19K SLoC