distribute/handshake/crypto

Types

Represents a registered crypto provider for handshake operations.

Used to identify and configure crypto providers that can be used during handshake key exchange and secure communication.

Fields

  • name: Unique identifier for the provider (e.g., “otp_crypto”, “libsodium”)

Status: STUB

Will be extended in v2.2.0+ to include provider capabilities, configuration, and priority settings.

pub type Provider {
  Provider(name: String)
}

Constructors

  • Provider(name: String)

Represents an established secure context with a remote node.

Contains the cryptographic state needed for secure communication, including session keys and cipher state derived from the handshake.

Fields

  • info: Debug information about the secure context

Status: STUB

Will be extended in v2.2.0+ to include:

  • Symmetric keys for encryption/decryption
  • Nonce counters for replay protection
  • Cipher suite information
  • Key derivation parameters
pub type SecureContext {
  SecureContext(info: String)
}

Constructors

  • SecureContext(info: String)

Values

pub fn get_secure_context(
  node: String,
) -> option.Option(SecureContext)

Retrieve the secure context for a remote node.

Returns the cached secure context if a successful handshake has been completed with the specified node, or None if no secure context exists.

Parameters

  • node: The node identifier (e.g., “node@host:9000”)

Returns

Some(context) if a secure context exists, None otherwise.

Status: STUB

Currently always returns None. Will implement context lookup and caching in v2.2.0+.

pub fn register_provider(p: Provider) -> Result(Nil, String)

Register a crypto provider for handshake sessions.

Providers are used during handshake key exchange to establish secure contexts with remote nodes. Multiple providers can be registered; the handshake will negotiate which to use based on both nodes’ capabilities.

Parameters

  • p: The provider to register

Returns

Ok(Nil) on success, Error(reason) if registration fails.

Status: STUB

Currently always returns Ok(Nil). Will implement actual registration in v2.2.0+.

Search Document