Skip to main content

AshAdapter

Trait AshAdapter 

Source
pub trait AshAdapter {
    // Provided methods
    fn canonicalize_json(&self, input: &str) -> AdapterResult { ... }
    fn canonicalize_query(&self, input: &str) -> AdapterResult { ... }
    fn canonicalize_urlencoded(&self, input: &str) -> AdapterResult { ... }
    fn normalize_binding(
        &self,
        method: &str,
        path: &str,
        query: &str,
    ) -> AdapterResult { ... }
    fn hash_body(&self, body: &str) -> AdapterResult { ... }
    fn derive_client_secret(
        &self,
        nonce: &str,
        context_id: &str,
        binding: &str,
    ) -> AdapterResult { ... }
    fn build_proof(
        &self,
        secret: &str,
        ts: &str,
        binding: &str,
        body_hash: &str,
    ) -> AdapterResult { ... }
    fn timing_safe_equal(&self, a: &str, b: &str) -> AdapterResult { ... }
    fn validate_timestamp(&self, ts: &str) -> AdapterResult { ... }
    fn trigger_error(&self, input: &Value) -> AdapterResult { ... }
    fn extract_scoped_fields(
        &self,
        payload: &str,
        fields: &[String],
        strict: bool,
    ) -> AdapterResult { ... }
    fn build_unified_proof(&self, input: &Value) -> AdapterResult { ... }
}
Expand description

Trait that SDK implementations must implement for conformance testing.

Each method corresponds to a vector category. Return AdapterResult::skip() for categories your SDK doesn’t implement yet.

Provided Methods§

Source

fn canonicalize_json(&self, input: &str) -> AdapterResult

JSON canonicalization: input JSON text → canonical JSON text

Source

fn canonicalize_query(&self, input: &str) -> AdapterResult

Query canonicalization: raw query → canonical query

Source

fn canonicalize_urlencoded(&self, input: &str) -> AdapterResult

URL-encoded canonicalization: raw → canonical

Source

fn normalize_binding( &self, method: &str, path: &str, query: &str, ) -> AdapterResult

Binding normalization: (method, path, query) → binding string

Source

fn hash_body(&self, body: &str) -> AdapterResult

Body hashing: canonical body → hex hash

Source

fn derive_client_secret( &self, nonce: &str, context_id: &str, binding: &str, ) -> AdapterResult

Client secret derivation: (nonce, context_id, binding) → hex secret

Source

fn build_proof( &self, secret: &str, ts: &str, binding: &str, body_hash: &str, ) -> AdapterResult

Proof generation: full inputs → hex proof

Source

fn timing_safe_equal(&self, a: &str, b: &str) -> AdapterResult

Timing-safe comparison: (a, b) → bool

Source

fn validate_timestamp(&self, ts: &str) -> AdapterResult

Timestamp validation: ts → ok or error

Source

fn trigger_error(&self, input: &Value) -> AdapterResult

Error behavior: trigger → error code + status

Source

fn extract_scoped_fields( &self, payload: &str, fields: &[String], strict: bool, ) -> AdapterResult

Scoped field extraction: (payload, fields, mode) → extracted/hash

Source

fn build_unified_proof(&self, input: &Value) -> AdapterResult

Unified proof: full inputs → proof + scope_hash + chain_hash

Implementors§