Skip to main content

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