Crates.io | fernet |
lib.rs | fernet |
version | 0.2.2 |
source | src |
created_at | 2018-05-04 19:30:42.529657 |
updated_at | 2024-05-16 16:38:41.80418 |
description | An implementation of fernet in Rust. |
homepage | https://github.com/mozilla-services/fernet-rs/ |
repository | https://github.com/mozilla-services/fernet-rs/ |
max_upload_size | |
id | 63773 |
size | 48,053 |
An implementation of fernet in Rust.
Fernet is a small library to help you encrypt parcels of data with optional expiry times. It's great for tokens or exchanging small strings or blobs of data. Fernet is designed to be easy to use, combining cryptographic primitives in a way that is hard to get wrong, prevents tampering and gives you confidence that the token is legitimate. You should consider this if you need:
Add fernet to your Cargo.toml:
[dependencies]
fernet = "0.1"
And then have a look at our [API documentation] online, or run "cargo doc --open" in your project.
By default fernet wraps operations in an attempt to be safe - you should never be able to "hold it incorrectly". But we understand that sometimes you need to be able to do some more complicated operations.
The major example of this is having your application test how it handles tokens that have expired past their ttl.
To support this, we allow you to pass in timestamps to the encrypt_at_time
and
decrypt_at_time
functions, but these are behind a feature gate. To activate these
api's you need to add the following to Cargo.toml
[dependencies]
fernet = { version = "0.1", features = ["fernet_danger_timestamps"] }