trojan-auth 0.1.4

Authentication backends for trojan-rs
Documentation

Authentication backends for trojan.

This crate provides authentication backends for the Trojan protocol.

Example

use trojan_auth::{AuthBackend, MemoryAuth, sha224_hex};

# async fn example() -> Result<(), trojan_auth::AuthError> {
// Create an auth backend from passwords
let auth = MemoryAuth::from_passwords(["my_password"]);

// Verify a hash
let hash = sha224_hex("my_password");
let result = auth.verify(&hash).await?;
# Ok(())
# }

SQL Backend

Enable the sql-postgres, sql-mysql, or sql-sqlite feature to use SQL database authentication:

[dependencies]
trojan-auth = { version = "0.1", features = ["sql-postgres"] }

See the [sql] module for more details.