#string #channel #untrusted #port #python #sending #popular

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

#480 in Cryptography

Download history 8757/week @ 2024-07-21 7179/week @ 2024-07-28 7948/week @ 2024-08-04 15094/week @ 2024-08-11 17485/week @ 2024-08-18 27163/week @ 2024-08-25 14319/week @ 2024-09-01 19099/week @ 2024-09-08 14632/week @ 2024-09-15 17745/week @ 2024-09-22 33515/week @ 2024-09-29 6571/week @ 2024-10-06 28084/week @ 2024-10-13 15218/week @ 2024-10-20 23160/week @ 2024-10-27 3490/week @ 2024-11-03

69,963 downloads per month

MIT license

79KB
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

~0.8–1.2MB
~23K SLoC