hyperlane-plugin-tenant 23.3.1

A zero-allocation multi-tenant resolution and isolation plugin for the Hyperlane framework supporting X-Tenant-Id header, Host subdomain, and path-prefix extraction, XxHash3_64 tenant registry, pluggable TenantResolver, and prebuilt 400/403/404 wire responses.
Documentation
/// Context attribute key storing resolved [`TenantContext`].
pub const ATTR_TENANT_CONTEXT: &str = "hyperlane_plugin_tenant.context";

/// Default header inspected for tenant identification (`x-tenant-id`).
pub const DEFAULT_TENANT_HEADER: &str = "x-tenant-id";

/// Maximum accepted byte length of a tenant identifier (`64`).
pub const MAX_TENANT_ID_LEN: usize = 64;

/// Default `Content-Type` for tenant error responses.
pub const DEFAULT_TENANT_ERROR_CONTENT_TYPE: &str = "application/json; charset=utf-8";

/// Default JSON body emitted when no tenant identifier is supplied (`400`).
pub const DEFAULT_MISSING_TENANT_BODY: &[u8] =
    br#"{"error":"missing_tenant","message":"tenant identifier is required"}"#;

/// Default JSON body emitted when a tenant identifier is unknown (`404`).
pub const DEFAULT_UNKNOWN_TENANT_BODY: &[u8] =
    br#"{"error":"unknown_tenant","message":"tenant does not exist"}"#;

/// Default JSON body emitted when a tenant is suspended (`403`).
pub const DEFAULT_SUSPENDED_TENANT_BODY: &[u8] =
    br#"{"error":"tenant_suspended","message":"tenant account is suspended"}"#;

/// Root slash constant.
pub(crate) const ROOT_SLASH: &str = "/";