https://github.com/edgio/rust-ectoken
Rust implementation of ectoken
https://github.com/edgio/rust-ectoken
Last synced: 12 months ago
JSON representation
Rust implementation of ectoken
- Host: GitHub
- URL: https://github.com/edgio/rust-ectoken
- Owner: Edgio
- License: apache-2.0
- Created: 2021-03-18T17:50:18.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-01-09T04:22:18.000Z (about 2 years ago)
- Last Synced: 2025-04-06T07:05:57.299Z (12 months ago)
- Language: Rust
- Size: 112 KB
- Stars: 4
- Watchers: 7
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README

[](https://crates.io/crates/ectoken)
[](https://docs.rs/ectoken)

# rust-ectoken
> _Token Generator for EdgeCast Token-Based Authentication implemented in Rust_
Token-Based Authentication safeguards against hotlinking by adding a token requirement to requests for content secured by it. This token, which must be defined in the request URL's query string, defines the criteria that must be met before the requested content may be served via the CDN. This repository contains source code for a Rust implementation.
Written against Rust 2021. (Minimum rustc version 1.60.0).
## Table of Contents
- [Build](#Build)
- [Test](#Test)
- [Usage](#usage)
- [Contribute](#contribute)
- [License](#license)
## Build
```
cargo build --release
```
## Test
```
cargo test
```
## Usage
### Library
Add the following to your Cargo.toml.
```toml
[dependencies]
ectoken = "0.5"
```
### CLI
```
To Encrypt:
ec_encrypt
or:
ec_encrypt encrypt
To Decrypt:
ec_encrypt decrypt
```
#### Example
```rust
use ectoken;
fn example() {
let encrypted = ectoken::encrypt_v3("mykey", "mymessage");
let decrypted = ectoken::decrypt_v3("mykey", &encrypted).unwrap();
assert_eq!("mymessage", decrypted);
}
```
## Contribute
- We welcome issues, questions and pull requests.
## License
This project is licensed under the terms of the Apache 2.0 open source license. Please refer to the `LICENSE-APACHE` file for the full terms.