Skip to main content

Crate slim_bindings

Crate slim_bindings 

Source
Expand description

§SLIM Bindings - UniFFI Language Bindings

This crate provides language-agnostic FFI bindings for SLIM using UniFFI. It enables integration with Go, Python, Kotlin, Swift, and other languages.

§Architecture

The module is organized into distinct components:

  • App: App-level operations (creation, configuration, session management)
  • Session: Session-specific operations (publish, invite, remove, message reception)
  • MessageContext: Message metadata and routing information
  • ServiceRef: Service reference management (global vs local)

§Usage

§From Rust

use slim_bindings::{App, Name, SessionConfig, SessionType, IdentityProviderConfig, IdentityVerifierConfig};

// Create an app
let app_name = Arc::new(Name { components: vec!["org".into(), "app".into(), "v1".into()], id: None });
let provider_config = IdentityProviderConfig::SharedSecret { data: "my-secret".to_string() };
let verifier_config = IdentityVerifierConfig::SharedSecret { data: "my-secret".to_string() };
let app = App::new(app_name, provider_config, verifier_config, false)?;

// Create a session
let config = SessionConfig { session_type: SessionType::PointToPoint, ... };
let session = app.create_session(config, destination)?;

§From Go (via generated bindings)

providerConfig := slim.IdentityProviderConfigSharedSecret{Data: sharedSecret}
verifierConfig := slim.IdentityVerifierConfigSharedSecret{Data: sharedSecret}
app, err := slim.NewApp(appName, providerConfig, verifierConfig, false)
session, err := app.CreateSession(config, destination)
session.Publish(data, payloadType, metadata)

Re-exports§

pub use slimrpc::BidiStreamHandler;
pub use slimrpc::Channel;
pub use slimrpc::Codec;
pub use slimrpc::Context;
pub use slimrpc::DEADLINE_KEY;
pub use slimrpc::DecodedStream;
pub use slimrpc::Decoder;
pub use slimrpc::Encoder;
pub use slimrpc::HandlerType;
pub use slimrpc::InvalidRpcCode;
pub use slimrpc::MAX_TIMEOUT;
pub use slimrpc::MulticastBidiStreamHandler;
pub use slimrpc::MulticastResponseReader;
pub use slimrpc::MulticastStreamMessage;
pub use slimrpc::RawStream;
pub use slimrpc::RequestStreamWriter;
pub use slimrpc::ResponseSink;
pub use slimrpc::ResponseStreamReader;
pub use slimrpc::RpcCode;
pub use slimrpc::RpcError;
pub use slimrpc::RpcMessageContext;
pub use slimrpc::RpcMulticastItem;
pub use slimrpc::STATUS_CODE_KEY;
pub use slimrpc::Server;
pub use slimrpc::SessionContext as RpcSessionContext;
pub use slimrpc::StreamMessage;
pub use slimrpc::StreamStreamHandler;
pub use slimrpc::StreamUnaryHandler;
pub use slimrpc::UnaryStreamHandler;
pub use slimrpc::UnaryUnaryHandler;
pub use slimrpc::UniffiRequestStream as RequestStream;
pub use slimrpc::build_method_subscription_name;

Modules§

slimrpc
SlimRPC - gRPC-like RPC framework over SLIM

Structs§

App
Adapter that bridges the App API with language-bindings interface
BasicAuth
Basic authentication configuration
BuildInfo
Build information for the SLIM bindings
ClientConfig
Client configuration for connecting to a SLIM server
ClientJwtAuth
JWT authentication configuration for client-side signing
CompletionHandle
FFI-compatible completion handle for async operations
DataplaneConfig
DataPlane configuration wrapper for uniffi bindings
ExponentialBackoff
Exponential backoff configuration
JwtAuth
JWT authentication configuration for server-side verification
JwtKeyConfig
JWT key configuration
KeepaliveConfig
Keepalive configuration for the client
KeepaliveServerParameters
Keepalive configuration for the server
MessageContext
Generic message context for language bindings (UniFFI-compatible)
Name
Name type for SLIM (Secure Low-Latency Interactive Messaging)
ProxyConfig
HTTP Proxy configuration
ReceivedMessage
Received message containing context and payload
RuntimeConfig
Runtime configuration for the SLIM bindings
ServerConfig
Server configuration for running a SLIM server
Service
Service wrapper for uniffi bindings
ServiceConfig
Service configuration wrapper for uniffi bindings
Session
Session context for language bindings (UniFFI-compatible)
SessionConfig
Session configuration
SessionWithCompletion
Result of creating a session, containing the session context and a completion handle
SpireConfig
SPIRE configuration for SPIFFE Workload API integration
StaticJwtAuth
Static JWT (Bearer token) authentication configuration The token is loaded from a file and automatically reloaded when changed
TlsClientConfig
TLS configuration for client connections
TlsServerConfig
TLS configuration for server connections
TracingConfig
Tracing/logging configuration for the SLIM bindings

Enums§

BackoffConfig
Backoff retry configuration
CaSource
CA certificate source configuration
ClientAuthenticationConfig
Authentication configuration enum for client
ClientTransportProtocol
Transport protocol for dataplane communication.
Direction
Direction enum Indicates whether the App can send, receive, both, or neither.
IdentityProviderConfig
Identity provider configuration - used to prove identity to others
IdentityVerifierConfig
Identity verifier configuration - used to verify identity of others
JwtAlgorithm
JWT signing/verification algorithm
JwtKeyData
JWT key data source
JwtKeyFormat
JWT key format
JwtKeyType
JWT key type (encoding, decoding, or autoresolve)
ServerAuthenticationConfig
Authentication configuration enum for server
ServerTransportProtocol
Transport protocol for dataplane communication.
SessionType
Session type enum
SlimError
Error types for SLIM operations
TlsSource
TLS certificate and key source configuration
TransportProtocol
Transport protocol for dataplane communication.

Functions§

create_service
Create a new Service with builder pattern
create_service_with_config
Create a new Service with configuration
get_build_info
Get detailed build information
get_global_service
Get the global service instance (creates it if it doesn’t exist)
get_runtime
Get the global runtime
get_runtime_config
Get the runtime configuration
get_service_config
Get the service configuration
get_tracing_config
Get the tracing configuration
get_version
Get the version of the SLIM bindings (simple string)
initialize_from_config
Initialize SLIM bindings from a configuration file
initialize_with_configs
Initialize SLIM bindings with custom configuration structs
initialize_with_defaults
Initialize SLIM bindings with default configuration
is_initialized
Check if SLIM bindings have been initialized
new_config_from_json
Parse and validate a SLIM gRPC client configuration from JSON.
new_dataplane_config
Create a new DataplaneConfig
new_insecure_client_config
Create a new insecure client config (no TLS)
new_insecure_server_config
Create a new insecure server config (no TLS)
new_runtime_config
Create a new BindingsRuntimeConfig with default values
new_runtime_config_with
Create a new BindingsRuntimeConfig with custom values
new_server_config
Create a new server config with the given endpoint and default values
new_service_config
Create a new BindingsServiceConfig with default values
new_service_config_with
Create a new BindingsServiceConfig with custom values
new_service_configuration
Create a new ServiceConfiguration
new_tracing_config
Create a new BindingsTracingConfig with default values
new_tracing_config_with
Create a new BindingsTracingConfig with custom values
shutdown
Perform graceful shutdown operations
shutdown_blocking
Perform graceful shutdown operations (blocking version)