SHSP Interfaces

pub package License

Abstract interfaces and contracts for Single HandShake Protocol (SHSP) implementations - defines the core API for peer-to-peer networking.

Features

  • 🏗️ Abstract interfaces defining the core SHSP API
  • 🔒 Type-safe contracts for all protocol components
  • 📚 Comprehensive documentation for implementers
  • 🎯 Dependency injection friendly design
  • Async/await support throughout

Installation

Add this to your package's pubspec.yaml:

dependencies:
  shsp_interfaces: ^1.0.0
  shsp_types: ^1.0.0  # Required dependency

Usage

import 'package:shsp_interfaces/shsp_interfaces.dart';
import 'package:shsp_types/shsp_types.dart';

// Implement a custom socket
class MyCustomSocket implements IShspSocket {
  @override
  Future<void> bind(InternetAddress address, int port) async {
    // Your implementation here
  }
  
  @override
  Future<void> send(List<int> data, RemoteInfo remoteInfo) async {
    // Your implementation here
  }
  
  // ... implement other required methods
}

Interfaces Included

  • IShspSocket: Socket implementation contract
  • IShspPeer: Peer management interface
  • IShspInstance: Protocol instance interface
  • IShsp: Core protocol interface
  • IShspHandshake: Handshake mechanism interface
  • IShspHandshakeHandler: Handshake processing interface

Architecture

This package provides the foundational contracts that any SHSP implementation must follow. It's designed to:

  • Enable multiple implementations of the protocol
  • Provide clear separation of concerns
  • Support dependency injection and testing
  • Maintain consistency across implementations

Documentation

For complete documentation, visit pub.dev/packages/shsp_interfaces.

License

This project is licensed under the MIT License.