Sekuire Protocol 🥝
Core protocol definitions and data structures for the Sekuire Agent Identity Protocol. This package provides the fundamental types, schemas, and serialization formats used across the Sekuire ecosystem.
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Features
- Type Definitions: Complete protocol data structures
- Serialization: JSON/YAML support with Serde
- JSON Schema: Schemars integration for API documentation
- Database Support: Optional SQLx integration for backends
- Cross-Language: Compatible with Rust, Python, TypeScript, and more
Core Types
Agent Identity
use ;
let manifest = Manifest ;
Registry API
use ;
let request = PublishRequest ;
Handshake Protocol
use ;
// Client initiates handshake
let hello = HandshakeHello ;
// Agent responds
let welcome = HandshakeWelcome ;
// Client completes handshake
let auth = HandshakeAuth ;
Data Structures
Manifest Configuration
The Manifest type defines an agent's identity and metadata:
Verification Status
Registry Types
Handshake Messages
JSON Schema Support
All types implement JsonSchema for automatic documentation generation:
use Manifest;
use schema_for;
let schema = schema_for!;
println!;
Example JSON Schema output:
Database Integration
Enable the backend feature for SQLx support:
[]
= { = "0.1.0", = ["backend"] }
This adds database mappings for types like VerificationStatus:
// Automatic SQLx type mapping
Serialization Examples
JSON
use serde_json;
let manifest = create_manifest;
let json = to_string_pretty?;
let parsed: Manifest = from_str?;
YAML
use serde_yaml;
let manifest = create_manifest;
let yaml = to_string?;
let parsed: Manifest = from_str?;
Protocol Flow
The Sekuire protocol follows this sequence:
- Agent Registration: Agent publishes identity to registry
- Client Discovery: Client finds agent in registry
- Handshake Initiation: Client sends
HandshakeHello - Identity Proof: Agent responds with
HandshakeWelcome - Mutual Authentication: Client sends
HandshakeAuth - Verification Complete: Both parties are verified
Message Flow Diagram
Client Agent Registry
| | |
|---- HandshakeHello ---->| |
|<-- HandshakeWelcome ---| |
| | |
|---- HandshakeAuth ----->| |
| | |
|---- Verify Agent ------>| |
|<---- Agent Info --------|------------------------>|
Cryptographic Details
- Signature Algorithm: Ed25519
- Hash Algorithm: Blake3
- Nonce Generation: Cryptographically secure random
- Encoding: Hex for all binary data
Identity Hash Calculation
The sekuire_id is calculated as:
sekuire_id = Blake3(
manifest.identity.model ||
manifest.identity.system_prompt_content ||
manifest.identity.tools_content ||
manifest.project.name ||
manifest.project.version
)
Error Handling
The protocol uses standard Result types for error handling:
use ;
Version Compatibility
This package follows semantic versioning. Breaking changes will increment the major version.
- 0.1.x: Initial protocol specification
- 0.2.x: Added reputation system
- 1.0.x: Stable protocol with backward compatibility
Dependencies
serde: Serialization frameworkserde_json: JSON supportserde_yaml: YAML supportschemars: JSON schema generationsqlx: Optional database support
Examples
See the examples/ directory for complete working examples:
basic_manifest.rs: Creating agent manifestshandshake_simulation.rs: Simulating handshake protocolregistry_client.rs: Registry API clientjson_schema.rs: Generating API documentation
Language Support
This protocol definition is designed to be language-agnostic. Implementations exist for:
- Rust (this package)
- Python (
sekuire-sdk-python) - TypeScript (
@sekuire/protocol) - Go (community implementation)
Contributing
When contributing to the protocol:
- Maintain backward compatibility
- Update JSON schemas for new types
- Add comprehensive examples
- Document breaking changes
- Follow semantic versioning
License
Licensed under the MIT License. See LICENSE file for details.