Expand description
Moloch Core - Fundamental types for the Moloch audit chain.
This crate provides the core data structures and cryptographic primitives used throughout the Moloch system:
crypto- Hashing (BLAKE3) and signatures (Ed25519)event- Audit events (the atomic unit of the chain)block- Blocks that batch events togetherproof- Merkle proofs for inclusion verification
§Example
use moloch_core::{
crypto::SecretKey,
event::{ActorId, ActorKind, AuditEvent, EventType, ResourceId, ResourceKind},
block::BlockBuilder,
};
// Generate a key for signing
let key = SecretKey::generate();
// Create an audit event
let actor = ActorId::new(key.public_key(), ActorKind::User);
let resource = ResourceId::new(ResourceKind::Repository, "myrepo");
let event = AuditEvent::builder()
.now()
.event_type(EventType::Push { force: false, commits: 1 })
.actor(actor)
.resource(resource)
.sign(&key)
.unwrap();
// Create a block containing the event
let sealer = moloch_core::block::SealerId::new(key.public_key());
let block = BlockBuilder::new(sealer)
.events(vec![event])
.seal(&key);
assert!(block.validate(None).is_ok());Re-exports§
pub use aligned::AlignedHash;pub use aligned::AlignedHashArray;pub use aligned::CacheLinePadded;pub use aligned::CACHE_LINE_SIZE;pub use arena::BatchArena;pub use arena::CanonicalBytesArena;pub use arena::DEFAULT_ARENA_CAPACITY;pub use block::compute_events_root;pub use block::compute_events_root_parallel;pub use block::Block;pub use block::BlockBuilder;pub use block::BlockHash;pub use block::BlockHeader;pub use block::SealerId;pub use crypto::batch_verify;pub use crypto::batch_verify_with_fallback;pub use crypto::hash;pub use crypto::hash_pair;pub use crypto::BatchVerifyResult;pub use crypto::Hash;pub use crypto::PublicKey;pub use crypto::SecretKey;pub use crypto::Sig;pub use error::Error;pub use error::Result;pub use event::ActorId;pub use event::ActorKind;pub use event::AuditEvent;pub use event::EventId;pub use event::EventType;pub use event::Outcome;pub use event::ResourceId;pub use event::ResourceKind;pub use merkle::compute_proof;pub use merkle::compute_root_optimized;pub use merkle::compute_roots_batch;pub use merkle::verify_proof;pub use proof::BlockInclusionProof;pub use proof::ConsistencyProof;pub use proof::InclusionProof;pub use proof::MmrProof;pub use proof::Position;pub use proof::ProofNode;pub use agent::ActionModifications;pub use agent::ActionOutcome;pub use agent::AgentAttestation;pub use agent::AgentAttestationBuilder;pub use agent::Alternative;pub use agent::ApprovalContext;pub use agent::ApprovalDecision;pub use agent::ApprovalPolicy;pub use agent::ApprovalRequest;pub use agent::ApprovalRequestId;pub use agent::ApprovalResponse;pub use agent::ApprovalStatus;pub use agent::AttestationError;pub use agent::AttestationRegistry;pub use agent::Attestor;pub use agent::CancellationActor;pub use agent::Capability;pub use agent::CapabilityBuilder;pub use agent::CapabilityCheck;pub use agent::CapabilityConstraints;pub use agent::CapabilityId;pub use agent::CapabilityKind;pub use agent::CapabilitySet;pub use agent::CapabilitySetId;pub use agent::CausalContext;pub use agent::CausalContextBuilder;pub use agent::Confidence;pub use agent::CoordinatedAction;pub use agent::CoordinatedActionBuilder;pub use agent::CoordinatedActionSpec;pub use agent::CoordinationEvent;pub use agent::CoordinationId;pub use agent::CoordinationMetrics;pub use agent::CoordinationProtocol;pub use agent::CoordinationResult;pub use agent::CoordinationStatus;pub use agent::CoordinationType;pub use agent::Cost;pub use agent::CrossSessionReference;pub use agent::DayOfWeek;pub use agent::Decision;pub use agent::DenialReason;pub use agent::DisputeStatus;pub use agent::DurationMs;pub use agent::EmergencyAction;pub use agent::EmergencyEvent;pub use agent::EmergencyEventBuilder;pub use agent::EmergencyPriority;pub use agent::EmergencyResolution;pub use agent::EmergencyTrigger;pub use agent::EscalationPolicy;pub use agent::Evidence;pub use agent::Factor;pub use agent::FailureHandling;pub use agent::Goal;pub use agent::GoalSource;pub use agent::IdempotencyKey;pub use agent::IdempotencyRecord;pub use agent::ImpactAssessment;pub use agent::OutcomeAttestation;pub use agent::OutcomeAttestationBuilder;pub use agent::OutcomeDispute;pub use agent::Participant;pub use agent::ParticipantRole;pub use agent::PostMortem;pub use agent::PrincipalId;pub use agent::PrincipalKind;pub use agent::Priority;pub use agent::ProposedAction;pub use agent::ProposedActionBuilder;pub use agent::RateLimit;pub use agent::ReasoningStep;pub use agent::ReasoningTrace;pub use agent::ReasoningTraceBuilder;pub use agent::RequiredCapability;pub use agent::Resolution;pub use agent::ResourceScope;pub use agent::Responsibility;pub use agent::RuntimeAttestation;pub use agent::Session;pub use agent::SessionBuilder;pub use agent::SessionEndReason;pub use agent::SessionId;pub use agent::SessionSummary;pub use agent::Severity;pub use agent::StepAction;pub use agent::SuspensionScope;pub use agent::Task;pub use agent::TaskDependency;pub use agent::TaskId;pub use agent::TeeQuote;pub use agent::TeeType;pub use agent::TimeOfDay;pub use agent::TimeWindow;pub use agent::ToolAttestation;pub use agent::TraceId;
Modules§
- agent
- Agent accountability types for Moloch.
- aligned
- Cache-line aligned types for high-performance operations.
- arena
- Arena allocator for efficient batch operations.
- block
- Block types for Moloch.
- crypto
- Cryptographic primitives for Moloch, powered by Arcanum.
- error
- Error types for Moloch.
- event
- Audit event types.
- merkle
- Optimized Merkle tree construction for Moloch.
- proof
- Proof types for Moloch.
- rkyv_
types - Zero-copy serialization with rkyv.
Macros§
Functions§
- batch_
verify_ events - Batch-verify the signatures of multiple events.
- batch_
verify_ events_ parallel - Batch-verify event signatures with parallel canonical bytes computation.