//! # tibet-iddrop — Identity Drop and Acceptance Protocol
//!
//! Rust implementation of `draft-vandemeent-iddrop-00`.
//!
//! ## Two initiation modes, one protocol-engine
//!
//! - **offer-first** (§6) — humaan / proximity / NFC / QR / local
//!   discovery. Sender opens a temporary offer; receiver chooses
//!   accept / challenge / reject. Sealed delivery follows acceptance.
//!
//! - **request-first** (§7) — autonomous / cap-bus / machine-to-machine.
//!   Receiver issues a request carrying `request_id` and
//!   `challenge_nonce`; sender produces a receiver-bound response.
//!
//! Both modes converge on the same six validation rules (§8):
//!
//! 1. Carrier truth — TBZ v2 sealed authentication
//! 2. Semantic class — `PayloadClass::Identity` MUST be explicit
//! 3. Receiver binding — response addressed to local identity
//! 4. Claim provenance — AINS/JIS lookup confirms sender_pubkey
//! 5. Causal binding — request_id + challenge_nonce, OR offer session
//! 6. Commitment discipline — never auto-materialise without user/policy ack
//!
//! ## Use case #1 — trust-kernel handoff
//!
//! The Android KIT app carries a trust-kernel (AES-256-GCM + TIBET +
//! eSIM trust). `tibet-iddrop` is the protocol that lets one
//! trust-kernel instance hand a sub-identity to another instance —
//! parent → child device, friend → friend introduction, employer →
//! contractor capability.
//!
//! ## Layers
//!
//! ```text
//! L3: iddrop protocol            (= this crate)
//! L2: SSM / semantic typing      (= PayloadClass::Identity in TBZ v2.2+)
//! L1: TBZ v2 sealed bytes        (= tibet-zip-core 2.2.0)
//! ```

#![deny(missing_docs)]
#![warn(rust_2018_idioms)]

pub mod ains;
pub mod claim;
pub mod errors;
pub mod nonce;
pub mod offer;
pub mod request;
pub mod transport;
pub mod validator;

pub use ains::{AinsResolver, StubAinsResolver};
#[cfg(feature = "wire")]
pub use ains::HttpAinsResolver;
pub use claim::{ClaimType, IdClaim, SemanticType};
pub use errors::{IddropError, Result};
pub use nonce::ChallengeNonce;
pub use offer::Offer;
pub use request::Request;
pub use validator::{validate, ValidationOutcome, ValidatorRule};

/// Protocol version identifier carried in every iddrop object.
pub const PROTOCOL_VERSION: &str = "iddrop.v0";

/// JSON content-type tag for iddrop sealed payloads.
pub const PAYLOAD_CONTENT_TYPE: &str = "application/vnd.tibet.iddrop+json";

/// Spec reference: `draft-vandemeent-iddrop-00`.
pub const SPEC_REFERENCE: &str = "draft-vandemeent-iddrop-00";
