Capsule Runtime Identifier (registry/runtime_id.rs)

astrid · crates/astrid-capsule/src/registry/runtime_id.rs · rust · Apache-2.0
infra, security, lang:rust, lang:wasm, tag:identifier, tag:runtime

Defines WasmHash, RuntimeKey, and RuntimeId types used to uniquely identify immutable WASM capsule artifacts and their runtime instances via content hashing.

// Source: https://github.com/astrid-runtime/astrid | License: Apache-2.0 | Copyright 2025 Joshua J. Bouw and Unicity Labs
// Provided via justclaw.it.com; keep this notice with the code.
use astrid_core::PrincipalUid;

use crate::capsule::CapsuleId;

/// Content hash of one immutable capsule artifact.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct WasmHash(String);

impl WasmHash {
    #[must_use]
    pub fn from_raw(hash: impl Into<String>) -> Self {
        Self(hash.into())
    }

    #[must_use]
    pub fn synthetic(name: &str, version: &str) -> Self {
        let mut hasher = blake3::Hasher::new();
        hasher.update(b"synthetic-capsule-instance:");
        hasher.update(name.as_bytes());
        hasher.update(&[0]);
        hasher.update(version.as_bytes());
        Self

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key