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 derive;
13pub mod didcomm;
14pub mod error;
15pub mod examples;
16pub mod message;
17pub mod utils;
18
19// Re-export public types for easier access
20pub use didcomm::{
21    Attachment, AttachmentData, Base64AttachmentData, JsonAttachmentData, LinksAttachmentData,
22    OutOfBand, PlainMessage,
23};
24pub use error::{Error, Result};
25pub use message::{
26    create_tap_message, AddAgents, Authorize, DocumentReference, ErrorBody, Invoice, LineItem,
27    OrderReference, Participant, Payment, Presentation, Reject, Settle, TapMessageBody,
28    TaxCategory, TaxSubtotal, TaxTotal, Transfer,
29};
30
31// Conditional compilation for WASM targets
32#[cfg(target_arch = "wasm32")]
33pub mod wasm {
34    //! WASM-specific functionality
35
36    use wasm_bindgen::prelude::*;
37
38    /// Initialize the WASM module.
39    #[wasm_bindgen(js_name = init_tap_msg)]
40    pub fn init() {
41        #[cfg(feature = "console_error_panic_hook")]
42        console_error_panic_hook::set_once();
43    }
44}
45
46// Test modules
47#[cfg(test)]
48mod tests {
49    // Tests are now in the tests directory
50}