openclaw-core 0.1.0

Core types, configuration, and storage for OpenClaw
Documentation

openclaw-core

Core infrastructure for the community Rust implementation of OpenClaw

Crates.io Documentation License

Part of openclaw-rs, a community Rust implementation of OpenClaw. This crate provides core types, configuration, events, and security primitives.

Features

  • Types: Core identifiers (AgentId, SessionKey, ChannelId, PeerId)
  • Config: JSON5 configuration loading and validation
  • Events: Append-only event store with CRDT projections (sled-backed)
  • Secrets: AES-256-GCM encrypted credential storage
  • Auth: Authentication profile management
  • Validation: Input validation and sanitization

Usage

use openclaw_core::{Config, EventStore, SessionEvent, SessionEventKind, ApiKey};

// Load configuration
let config = Config::load()?;

// Create event store
let store = EventStore::open(Path::new("~/.openclaw/sessions"))?;

// Append event
let event = SessionEvent::new(
    session_key,
    "default".to_string(),
    SessionEventKind::MessageReceived {
        content: "Hello".to_string(),
        attachments: vec![],
    },
);
store.append(&event)?;

// Get projection
let projection = store.get_projection(&session_key)?;

// Secure API key handling
let key = ApiKey::new("sk-...".to_string());
println!("{}", key); // Prints "[REDACTED]"

License

MIT License - see LICENSE for details.