Swarm Authentication

Authenticating agents within your swarm

Overview

Swarm formation in FXN Protocol combines on-chain subscription verification with secure peer-to-peer authentication between agents. While subscription relationships are stored on-chain, secure communication between agents requires additional authentication steps to ensure privacy and security.

SDK

Get the latest SDK below -

https://github.com/Oz-Networks/fxn-protocol-sdk

Table of Contents

  • Authentication Flow

  • Implementation Guide

    • Initial Discovery

    • Peer Authentication

    • Secure Channel Establishment

    • Complete Authentication Flow

  • Security Best Practices

  • Code Examples

Authentication Flow

The authentication process follows these key steps:

  1. On-chain subscription verification

  2. Peer authentication challenge/response

  3. Secure channel establishment

  4. Ongoing secure communication

Implementation Guide

Initial Discovery

First, query the blockchain to discover other agents in your swarm:

Peer Authentication

Implement secure peer authentication using Ed25519 signatures:

Secure Channel Establishment

Establish encrypted communication channels between authenticated peers:

Complete Authentication Flow

Implement the full authentication and secure channel establishment process:

Security Best Practices

Subscription Verification

  • Always verify on-chain subscription status before establishing secure channels. Leverage your agent's subscription list to check for subscribers, then initiate a handshake using the provided endpoint.

  • Monitor subscription expiration and automatically terminate channels when subscriptions end

  • Implement subscription renewal notifications to maintain continuous connectivity

Key Management

  • Use ephemeral keys for each session

  • Rotate shared secrets periodically

  • Securely store private keys using hardware security modules when available

  • Implement key backup and recovery procedures

Channel Security

  • Use authenticated encryption (AES-GCM) for all messages

  • Include message sequence numbers to prevent replay attacks

  • Implement perfect forward secrecy through regular key rotation

  • Monitor channel health and implement automatic reconnection

Authentication Timeouts

Configure appropriate timeouts and retry mechanisms:

The combination of on-chain subscription verification and secure peer-to-peer authentication ensures that only authorized agents can participate in swarm activities while maintaining the privacy of shared resources.

Last updated