tap_msg/
lib.rs

1//! Implementation of the Transaction Authorization Protocol (TAP)
2//!
3//! This crate provides the core functionality for the Transaction Authorization
4//! Protocol (TAP), including message definitions, serialization, validation,
5//! and DIDComm integration.
6//!
7//! The Transaction Authorization Protocol (TAP) is a multi-party protocol for
8//! authorizing, documenting, and recording financial transactions for
9//! cryptocurrency asset transfers.
10
11// Internal modules
12pub mod didcomm;
13pub mod error;
14// pub mod examples; // Temporarily disabled during refactor
15pub mod message;
16pub mod utils;
17
18// Re-export the derive macros from tap-msg-derive
19pub use tap_msg_derive::{TapMessage, TapMessageBody};
20
21// Re-export public types for easier access
22pub use didcomm::{
23    Attachment, AttachmentData, Base64AttachmentData, JsonAttachmentData, LinksAttachmentData,
24    OutOfBand, PlainMessage, PlainMessageExt, UntypedPlainMessage,
25};
26pub use error::{Error, Result};
27pub use message::{
28    create_tap_message, AddAgents, Agent, Authorize, DocumentReference, ErrorBody, Invoice,
29    LineItem, MessageContext, OrderReference, Party, Payment, Presentation, Reject, Settle,
30    TapMessageBody, TaxCategory, TaxSubtotal, TaxTotal, TransactionContext, Transfer,
31};
32
33// Conditional compilation for WASM targets
34#[cfg(target_arch = "wasm32")]
35pub mod wasm {
36    //! WASM-specific functionality
37
38    use wasm_bindgen::prelude::*;
39
40    /// Initialize the WASM module.
41    #[wasm_bindgen(js_name = init_tap_msg)]
42    pub fn init() {
43        #[cfg(feature = "console_error_panic_hook")]
44        console_error_panic_hook::set_once();
45    }
46}
47
48// Test modules
49#[cfg(test)]
50mod tests {
51    // Tests are now in the tests directory
52}