Skip to main content

agent_id_handshake/
lib.rs

1//! Handshake protocol for mutual agent authentication.
2//!
3//! This crate implements the challenge-response handshake defined in the AIP spec.
4//!
5//! # Example
6//!
7//! ```no_run
8//! use agent_id_core::RootKey;
9//! use agent_id_handshake::{messages::Hello, protocol::{Verifier, sign_proof}};
10//!
11//! // Agent A initiates
12//! let key_a = RootKey::generate();
13//! let hello = Hello::new(key_a.did().to_string());
14//!
15//! // Agent B responds with challenge
16//! let key_b = RootKey::generate();
17//! let verifier = Verifier::new(key_b.did());
18//! let challenge = verifier.handle_hello(&hello).unwrap();
19//!
20//! // Agent A signs proof
21//! let proof = sign_proof(&challenge, &key_a.did(), &key_a, Some(key_b.did().to_string())).unwrap();
22//!
23//! // Agent B verifies and accepts
24//! verifier.verify_proof(&proof, &challenge).unwrap();
25//! ```
26
27pub mod error;
28pub mod messages;
29pub mod protocol;
30
31pub use error::{HandshakeError, Result};
32pub use messages::{Challenge, Hello, Proof, ProofAccepted};
33pub use protocol::{sign_proof, verify_counter_proof, Verifier};