Expand description
Rust HAIAI.
This crate is intentionally a thin HAI-platform wrapper around JACS.
Runtime signing/canonicalization should be delegated via JacsProvider.
§Feature flags
jacs-crate(default) – Use the published jacs crate from crates.io.
§Agent API
The recommended entry point is agent::Agent, which provides an
ergonomic agent.email.* namespace. All email operations sign with
the agent’s JACS key – there is no unsigned send path.
use haiai::agent::Agent;
use haiai::types::SendEmailOptions;
let agent = Agent::from_config(None).await?;
agent.email.send(SendEmailOptions {
to: "other@hai.ai".into(),
subject: "Hello".into(),
body: "World".into(),
cc: vec![],
bcc: vec![],
in_reply_to: None,
attachments: vec![],
labels: vec![],
append_footer: None,
}).await?;Re-exports§
pub use a2a::A2AAgentCapabilities;pub use a2a::A2AAgentCard;pub use a2a::A2AAgentExtension;pub use a2a::A2AAgentInterface;pub use a2a::A2AAgentSkill;pub use a2a::A2AArtifactSignature;pub use a2a::A2AArtifactVerificationResult;pub use a2a::A2AChainEntry;pub use a2a::A2AChainOfCustody;pub use a2a::A2AIntegration;pub use a2a::A2AMediatedJobOptions;pub use a2a::A2ATrustAssessment;pub use a2a::A2ATrustPolicy;pub use a2a::A2AWrappedArtifact;pub use a2a::A2A_JACS_EXTENSION_URI;pub use a2a::A2A_PROTOCOL_VERSION_04;pub use a2a::A2A_PROTOCOL_VERSION_10;pub use agent::Agent;pub use agent::EmailNamespace;pub use client::HaiClient;pub use client::HaiClientOptions;pub use client::SseConnection;pub use client::WsConnection;pub use client::DEFAULT_BASE_URL;pub use client::DEFAULT_DNS_RESOLVER;pub use client::DEFAULT_MAX_RETRIES;pub use client::DEFAULT_TIMEOUT_SECS;pub use config::load_config;pub use config::redacted_display;pub use config::resolve_private_key_candidates;pub use config::resolve_storage_backend;pub use config::resolve_storage_backend_label;pub use config::AgentConfig;pub use config::StorageConfigSummary;pub use email::verify_email;pub use error::HaiError;pub use error::Result;pub use jacs::JacsAgentLifecycle;pub use jacs::JacsBatchProvider;pub use jacs::JacsDocumentProvider;pub use jacs::JacsEmailProvider;pub use jacs::JacsProvider;pub use jacs::JacsVerificationProvider;pub use jacs::NoopJacsProvider;pub use jacs::StaticJacsProvider;pub use jacs::media_verify_result_to_json;pub use jacs::media_verify_status_to_str;pub use jacs::text_signature_status_to_str;pub use jacs::verify_text_result_to_json;pub use jacs::JacsMediaProvider;pub use jacs_local::LocalJacsProvider;pub use jacs_remote::RemoteJacsProvider;pub use jacs_remote::RemoteJacsProviderOptions;pub use verify::generate_verify_link;pub use verify::generate_verify_link_hosted;pub use verify::MAX_VERIFY_DOCUMENT_BYTES;pub use verify::MAX_VERIFY_URL_LEN;pub use types::*;
Modules§
- a2a
- agent
- High-level
AgentAPI for HAI email operations. - client
- config
- HAI email verification wrapper.
- error
- jacs
- jacs_
local - jacs_
remote RemoteJacsProvider— JacsDocumentProvider impl backed by/api/v1/recordsonhai-api.- key_
format - mime
- RFC 5322 MIME email construction.
- self_
knowledge - Embedded documentation search powered by BM25.
- types
- validation
- Input validation for email operations.
- verify
Structs§
- Attachment
Entry - An attachment entry with content hash, MIME header hash, and filename.
- Body
Part Entry - A body part entry with content and MIME header hashes.
- Content
Verification Result - Result of content verification comparing trusted JACS hashes against email.
- Email
Signature Headers - The set of signed email headers in the JACS signature payload.
- Email
Signature Payload - The payload section of the JACS email signature document.
- Jacs
Email Metadata - Metadata for the JACS email signature document.
- Jacs
Email Signature - Cryptographic signature of the JACS email signature document.
- Jacs
Email Signature Document - The complete JACS email signature document.
- Media
Verification Result - Result of
super::advanced::verify_image. - Parsed
Attachment - A parsed attachment with content and metadata.
- Parsed
Body Part - A parsed body part with content and MIME metadata.
- Parsed
Email Parts - Parsed email parts extracted from raw RFC 5322 bytes. Used as intermediate representation for signing and verification.
- Sign
Image Options - Options for
super::advanced::sign_image. - Sign
Text Options - Options for
super::advanced::sign_text_file. - Sign
Text Outcome - Outcome of
super::advanced::sign_text_file. - Signed
Header Entry - A signed header entry containing the raw value and its SHA-256 hash.
- Signed
Media - Outcome of
super::advanced::sign_image. - Text
Signature Entry - One result entry per signature block.
- Verify
Image Options - Options for
super::advanced::verify_image. - Verify
Text Options - Options for
verify_inline. C1 resolution: callers pick strict vs permissive. PRD §4.1.5 addskey_dirfor library callers that want programmatic equivalent of the CLI--key-dirflag.
Enums§
- Media
Verify Status - Per-image verification status. Maps roughly to
crate::inline::SignatureStatusbut with image-specific additions (UnsupportedFormat). - Text
Signature Status - Per-block verification status.
Malformedhere is per-block (well-terminated block with a bad body); file-level malformation goes onVerifyTextResult. - Verify
Text Result - Overall verify result.
MissingSignatureandMalformedare file-level discriminators.
Functions§
- sign_
email - Sign a raw RFC 5322 email and attach a JACS signature document.