tap_agent/
lib.rs

1//! TAP Agent implementation
2//!
3//! This crate provides an agent implementation for the Transaction Authorization Protocol (TAP).
4//! The TAP Agent is responsible for sending and receiving TAP messages, managing keys, and
5//! applying policies.
6
7/// Agent implementation
8pub mod agent;
9
10/// Agent configuration
11pub mod config;
12
13/// Cryptographic utilities
14pub mod crypto;
15
16/// DID utilities
17pub mod did;
18
19/// Error types
20pub mod error;
21
22/// Message types and utilities
23pub mod message;
24
25/// A trait for types that can be serialized to JSON in an type-erased way
26pub trait ErasedSerialize {
27    /// Serialize to JSON string
28    fn to_json(&self) -> std::result::Result<String, serde_json::Error>;
29}
30
31impl<T: serde::Serialize> ErasedSerialize for T {
32    fn to_json(&self) -> std::result::Result<String, serde_json::Error> {
33        serde_json::to_string(self)
34    }
35}
36
37// Re-export key types for convenience
38pub use agent::{Agent, DefaultAgent};
39pub use config::AgentConfig;
40pub use crypto::{BasicSecretResolver, DefaultMessagePacker, MessagePacker};
41pub use did::{DIDMethodResolver, KeyResolver, MultiResolver, SyncDIDResolver};
42pub use didcomm::did::{DIDDoc, DIDResolver};
43pub use error::{Error, Result};
44pub use message::{SecurityMode, PRESENTATION_MESSAGE_TYPE};
45
46/// Version of the TAP Agent
47pub const VERSION: &str = env!("CARGO_PKG_VERSION");