Skip to main content

Crate clasp_registry

Crate clasp_registry 

Source
Expand description

CLASP Entity Registry

Persistent identity for devices, users, services, and routers in the CLASP network. Each entity has an Ed25519 keypair and a stable ID derived from its public key.

§Entity ID Format

clasp:<base58-ed25519-pubkey-prefix>

§Token Format

ent_<base64url(msgpack(entity_id + timestamp + ed25519_signature))>

§Storage Backends

  • MemoryEntityStore – default, no deps, for dev/testing
  • SqliteEntityStore – feature-gated behind sqlite, single file, WAL mode

§Integration

EntityValidator implements clasp_core::TokenValidator and plugs into the existing ValidatorChain. Existing cpsk_ tokens continue working unchanged.

use std::sync::Arc;
use clasp_core::ValidatorChain;
use clasp_registry::{EntityValidator, MemoryEntityStore};

let store = Arc::new(MemoryEntityStore::new());
let chain = ValidatorChain::new()
    .with(clasp_core::CpskValidator::new())
    .with(EntityValidator::new(store));

Re-exports§

pub use entity::Entity;
pub use entity::EntityId;
pub use entity::EntityKeypair;
pub use entity::EntityStatus;
pub use entity::EntityType;
pub use error::RegistryError;
pub use error::Result;
pub use store::EntityStore;
pub use store::MemoryEntityStore;
pub use token::generate_token;
pub use token::parse_token;
pub use token::ENTITY_TOKEN_PREFIX;
pub use validator::EntityValidator;

Modules§

entity
Entity types for the CLASP registry
error
Registry error types
store
Entity storage trait and in-memory implementation
token
Entity token generation and parsing
validator
Entity token validator implementing the clasp-core TokenValidator trait