ash-core
Developed by 3maem Co. | شركة عمائم
ASH (Application Security Hash) Core - Request integrity and anti-replay protection library for Rust.
Features
- Tamper Detection: Cryptographic proof ensures payload integrity
- Replay Prevention: One-time contexts prevent request replay
- Deterministic: Byte-identical output across all platforms
- WASM Compatible: Works in browsers and server environments
Installation
Quick Start
use ;
// Canonicalize a JSON payload
let canonical = canonicalize_json.unwrap;
assert_eq!;
// Build a proof
let proof = build_proof.unwrap;
// Verify a proof
let expected = proof.clone;
let input = new;
assert!;
API
Canonicalization
canonicalize_json(input: &str)- Canonicalize JSON to deterministic formcanonicalize_urlencoded(input: &str)- Canonicalize URL-encoded form data
Proof Generation
build_proof(mode, binding, context_id, nonce, payload)- Generate cryptographic proofverify_proof(input: &VerifyInput)- Verify proof matches expected value
Utilities
normalize_binding(method, path)- Normalize HTTP method and pathtiming_safe_equal(a, b)- Constant-time byte comparison
Types
AshMode- Security mode:Minimal,Balanced,StrictAshError- Error type with code and messageBuildProofInput- Structured input for proof buildingVerifyInput- Input for proof verification
Security Notes
ASH verifies what is being submitted, not who is submitting it. It should be used alongside authentication systems (JWT, OAuth, etc.).
License
ASH Source-Available License (ASAL-1.0)
See LICENSE for full terms.
© 3maem Co. | شركة عمائم