Forge documentation
Library referenceRust

forge-wasm

WASM/WASI component exports for the Forge SDK — cross-language consumption

WASM/WASI component exports for the Forge SDK — cross-language consumption

Package contract

FieldValue
Languagerust
Source version0.2.0
Manifestforge-rs/crates/forge-wasm/Cargo.toml
Source files4
EvidenceSource reference; registry publication and runtime conformance are separate checks

Import boundary

use forge_wasm;

Use a source checkout or your verified private registry. Manifest coordinates identify the package; they do not establish that a public registry release exists.

Crate boundary

The following entries are taken from src/lib.rs. Feature conditions in the exact source still apply.

pub mod error;

pub mod exports;

pub mod types;

Source reference

Download package reference JSON. Each original source file and generated declaration artifact has its own SHA-256 digest. Function bodies and constant values are omitted from downloads. These are source declaration inventories, not compiler-resolved rustdoc, TypeDoc, DocC, or Dokka output. Private modules can contain public declarations that are not reachable through the package boundary; consult the entry point before importing.

error.rs

Read declaration text · 2 declaration entries

#[derive(Debug, Error)]
pub enum ForgeWasmError {
    /// JSON serialization failed when converting a Rust type to JSON output.
    ///
    /// This indicates a bug in the WASM export layer if it occurs, since
    /// all output types derive `Serialize`.
    #[error("JSON serialization error: {0}")]
    Serialization(String),

    /// JSON deserialization failed when parsing input from the calling language.
    ///
    /// The calling SDK sent malformed JSON. The error message includes the
    /// serde parse error for debugging.
    #[error("JSON deserialization error: {0}")]
    Deserialization(String),

    /// An identity operation failed in the underlying `forge-identity` or `oas-sdk` layer.
    ///
    /// This wraps errors from HMR creation, agent derivation, and related
    /// identity workflows.
    #[error("identity operation failed: {0}")]
    Identity(String),

    /// An authorization operation failed in the underlying `forge-auth` layer.
    ///
    /// This wraps errors from Arsenal ACT verification and capability checks.
    #[error("auth operation failed: {0}")]
    Auth(String),

    /// The input provided to a WASM export function is structurally invalid.
    ///
    /// Examples: empty namespace, invalid hex string, wrong key length.
    #[error("invalid input: {0}")]
    InvalidInput(String),
}

pub type ForgeWasmResult<T> = Result<T, ForgeWasmError>;

exports.rs

Read declaration text · 4 declaration entries

pub fn create_hmr_identity(request_json: &str) -> ForgeWasmResult<String>;

pub fn derive_agent_identity(request_json: &str) -> ForgeWasmResult<String>;

pub fn sign_message(request_json: &str) -> ForgeWasmResult<String>;

pub fn verify_signature(request_json: &str) -> ForgeWasmResult<String>;

lib.rs

Read declaration text · 3 declaration entries

pub mod error;

pub mod exports;

pub mod types;

types.rs

Read declaration text · 9 declaration entries

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Zeroize)]
pub struct WasmIdentityInfo {
/// The `did:oas` identifier string (e.g., `"did:oas:test:hmr:alice"`).

pub did: String,
/// The entity kind (e.g., `"hmr"`, `"mhr"`, `"agent"`, `"tool"`).

pub kind: String,
/// The number of derivation steps from the human root (0 for root entities).

pub lineage_depth: u32,
/// Hex-encoded 32-byte Ed25519 public (verifying) key.

pub public_key_hex: String
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct WasmCreateHmrRequest {
/// The OAS namespace (e.g., `"l1fe"`, `"test"`).

pub namespace: String,
/// The unique identifier within the namespace (e.g., `"alice"`).

pub identifier: String
}

#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Zeroize, ZeroizeOnDrop)]
pub struct WasmCreateHmrResult {
/// Public identity info (DID, kind, depth, public key).

pub identity: WasmIdentityInfo,
/// Hex-encoded 32-byte Ed25519 signing (private) key. SENSITIVE.

pub signing_key_hex: String,
/// The signed OAS Identity Document serialized as JSON.

pub document_json: String
}

#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Zeroize, ZeroizeOnDrop)]
pub struct WasmDeriveAgentRequest {
/// Hex-encoded 32-byte Ed25519 signing key of the parent. SENSITIVE.

pub parent_signing_key_hex: String,
/// The parent's signed OAS Identity Document as a JSON string.

pub parent_document_json: String,
/// The child agent's identifier (e.g., `"analyzer"`, `"scraper"`).

pub child_name: String,
/// The child agent's OAS namespace (e.g., `"l1fe"`, `"test"`).

pub child_namespace: String
}

#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Zeroize, ZeroizeOnDrop)]
pub struct WasmDeriveAgentResult {
/// Public identity info for the derived child agent.

pub identity: WasmIdentityInfo,
/// Hex-encoded 32-byte Ed25519 signing (private) key of the child. SENSITIVE.

pub signing_key_hex: String,
/// The signed child OAS Identity Document (with lineage section) as JSON.

pub document_json: String
}

#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Zeroize, ZeroizeOnDrop)]
pub struct WasmSignRequest {
/// Hex-encoded 32-byte Ed25519 signing key. SENSITIVE.

pub signing_key_hex: String,
/// Hex-encoded message bytes to sign.

pub message_hex: String
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct WasmSignResult {
/// Hex-encoded 64-byte Ed25519 signature.

pub signature_hex: String
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct WasmVerifyRequest {
/// Hex-encoded 32-byte Ed25519 public (verifying) key.

pub public_key_hex: String,
/// Hex-encoded message bytes that were signed.

pub message_hex: String,
/// Hex-encoded 64-byte Ed25519 signature to verify.

pub signature_hex: String
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct WasmVerifyResult {
/// Whether the signature is valid for the given message and public key.

pub valid: bool
}

Continue

On this page