1#![forbid(unsafe_code)]
56#![allow(
57 clippy::cast_possible_truncation,
58 clippy::cast_precision_loss,
59 clippy::if_not_else,
60 clippy::items_after_statements,
61 clippy::manual_let_else,
62 clippy::map_unwrap_or,
63 clippy::missing_errors_doc,
64 clippy::must_use_candidate,
65 clippy::uninlined_format_args
66)]
67
68#[cfg(feature = "acl")]
69pub mod acl;
70#[cfg(feature = "config")]
71pub mod config;
72pub mod constants;
73pub mod did;
74pub mod doc;
75pub mod endpoint;
76pub mod error;
77pub mod identity;
78pub mod inbox;
79pub mod interfaces;
80pub mod ipfs;
81#[cfg(feature = "iroh")]
82#[allow(dead_code)]
83mod iroh;
84pub mod key;
85#[cfg(all(feature = "kubo", not(target_arch = "wasm32")))]
86mod kubo;
87#[cfg(all(feature = "kubo", feature = "config", not(target_arch = "wasm32")))]
88pub use kubo::remote_pin_replace;
89#[cfg(all(feature = "kubo", not(target_arch = "wasm32")))]
90pub use kubo::PinReplaceOutcome;
91#[cfg(all(feature = "kubo", not(target_arch = "wasm32")))]
92pub use kubo::{cat_bytes, ipfs_add};
93pub mod msg;
94mod multiformat;
95#[cfg(feature = "iroh")]
96#[allow(dead_code)]
97mod outbox;
98pub mod service;
99pub mod transport;
100pub(crate) mod ttl_queue;
101
102pub use did::{Did, DID_PREFIX};
105pub use doc::{
106 now_iso_utc, Document, MaExtension, Proof, VerificationMethod, DEFAULT_DID_CONTEXT,
107 DEFAULT_PROOF_PURPOSE, DEFAULT_PROOF_TYPE,
108};
109pub use error::{Error, MaError, Result};
110pub use identity::{
111 generate_identity, generate_identity_from_secret, ipns_from_secret, GeneratedIdentity,
112};
113pub use ipld_core::ipld::Ipld;
114pub use key::{
115 EncryptionKey, SigningKey, ASSERTION_METHOD_KEY_TYPE, CODEC_ED25519_PUB, CODEC_EDDSA_SIG,
116 CODEC_X25519_PUB, KEY_AGREEMENT_KEY_TYPE,
117};
118pub use msg::{
119 decode_content, encode_content, Envelope, Headers, Message, ReplayGuard,
120 DEFAULT_MAX_CLOCK_SKEW_SECS, DEFAULT_MESSAGE_TTL_SECS, DEFAULT_REPLAY_WINDOW_SECS,
121 MESSAGE_PREFIX,
122};
123pub use multiformat::{
124 CODEC_CBOR, CODEC_DAG_CBOR, CODEC_DAG_JSON, CODEC_IDENTITY, CODEC_JSON, CODEC_RAW,
125};
126
127#[cfg(feature = "acl")]
128pub use acl::{
129 check_cap, is_principal_key, is_valid_acl_key, normalize_principal, validate_acl_map, AclMap,
130 CapabilityEntry, CAP_ACL, CAP_CREATE, CAP_CRUD, CAP_DELETE, CAP_IDENTITY_PUBLISH, CAP_INBOX,
131 CAP_IPFS, CAP_READ, CAP_RPC, CAP_UPDATE, GROUP_PREFIX, LOCAL_ENTITY_WILDCARD,
132};
133
134pub use service::{
137 Service, CONTENT_TYPE_CBOR, CONTENT_TYPE_TERM, CONTENT_TYPE_TERM_CBOR, CONTENT_TYPE_TERM_YAML,
138 CRUD_PROTOCOL_ID, INBOX_PROTOCOL_ID, IPFS_PROTOCOL_ID, MESSAGE_TYPE_BROADCAST,
139 MESSAGE_TYPE_CHAT, MESSAGE_TYPE_CRUD, MESSAGE_TYPE_CRUD_REPLY, MESSAGE_TYPE_DOC,
140 MESSAGE_TYPE_EMOTE, MESSAGE_TYPE_IDENTITY_PUBLISH_REQUEST, MESSAGE_TYPE_IPFS_REQUEST,
141 MESSAGE_TYPE_MESSAGE, MESSAGE_TYPE_RPC, MESSAGE_TYPE_RPC_REPLY, RPC_PROTOCOL_ID,
142};
143
144pub use inbox::Inbox;
147
148pub use endpoint::{MaEndpoint, DEFAULT_DELIVERY_PROTOCOL_ID};
151#[cfg(feature = "iroh")]
152pub use outbox::Outbox;
153
154#[cfg(feature = "iroh")]
159pub async fn new_ma_endpoint(secret_bytes: [u8; 32], ipv6: bool) -> Result<Box<dyn MaEndpoint>> {
160 let endpoint = iroh::new_endpoint(secret_bytes, ipv6).await?;
161 Ok(Box::new(endpoint))
162}
163
164pub use transport::{
167 endpoint_id_from_transport, endpoint_id_from_transport_value, normalize_endpoint_id,
168 protocol_from_transport, resolve_endpoint_for_protocol, resolve_inbox_endpoint_id,
169 transport_string,
170};
171
172pub use identity::{generate_secret_key_file, load_secret_key_bytes, socket_addr_to_multiaddr};
175
176#[cfg(all(feature = "config", not(target_arch = "wasm32")))]
179pub use config::MaArgs;
180#[cfg(feature = "config")]
181pub use config::{BrowserIdentityExport, Config, SecretBundle};
182
183pub use ipfs::gateway_resolver::{DidDocumentResolver, IpfsGatewayResolver};
186
187pub use interfaces::{DidPublisher, IpfsPublisher};
190pub use ipfs::*;