@hsuite/dkg-types

A comprehensive type system and model definitions for Distributed Key Generation (DKG) operations in the HSuite ecosystem.

Overview

The @dkg-types library provides a robust set of TypeScript interfaces and model implementations for managing distributed key generation processes. It serves as the foundational type system for DKG operations, ensuring type safety and consistency across the HSuite platform.

Core Components

Interfaces (IDKG Namespace)

  • NetworkClusterStatus: Enum defining possible cluster states

    • BUILDING: Initial setup phase

    • ROTATING: Member addition/removal phase

    • BANNING: Problematic member removal

    • CONTRIBUTIONS_READY: Ready for member contributions

    • READY: Fully operational state

  • IShamirSecretShare: Interface for Shamir's Secret Sharing implementation

  • IMemberShare: Interface for managing member share distribution

  • INode: Interface for DKG network participants

  • IMember: Interface for DKG protocol members

  • ICluster: Interface for DKG cluster management

  • IPayload: Interface namespace for DKG protocol messages

Models (DKG Namespace)

  • ShamirSecretShare: Implementation of Shamir's Secret Sharing scheme

    • Secure secret splitting

    • Threshold-based reconstruction

    • Share integrity validation

  • MemberShare: Implementation for member share management

    • Share distribution tracking

    • Ownership management

    • Integrity validation

  • Node: Implementation for network participants

    • Node identification

    • Network addressing

    • Verification vector management

  • Member: Implementation for protocol participants

    • Share management

    • Key generation

    • Protocol state management

  • Cluster: Implementation for DKG cluster coordination

    • Member coordination

    • Threshold management

    • State synchronization

  • Payload: Implementation namespace for protocol messages

Features

  • Type-safe DKG operations

  • Comprehensive protocol state management

  • Threshold cryptography support

  • Secure share distribution

  • Member coordination

  • Protocol message handling

  • Verification vector management

Usage

import { IDKG, DKG } from '@dkg-types';

// Create a new node
const node: IDKG.INode = {
  operator: '0x123abc...',
  id: 'node-123',
  sn_id: 'smartnode-456',
  vvec: ['vvec1', 'vvec2']
};

// Initialize a cluster
const cluster: IDKG.ICluster = {
  networkId: "network-123",
  members: [],
  memberships: [],
  groupsVvec: ["vvec1", "vvec2"],
  threshold: 3
};

// Create a member instance
const member: IDKG.IMember = {
  dkgId: 'dkg-789',
  membersShares: [],
  verificationVector: ['vv1', 'vv2'],
  receivedShares: [],
  secretKeyShare: 'sk-123',
  secretKeyShamir: ['ss1', 'ss2'],
  shamirSecretShares: []
};

Integration

The library is designed to work seamlessly with the HSuite ecosystem and provides:

  • NestJS Swagger integration via @ApiSchema decorators

  • TypeScript type definitions

  • Modular component architecture

  • Extensible interface system

Technical Details

  • Written in TypeScript

  • Follows object-oriented design principles

  • Implements threshold cryptography standards

  • Provides comprehensive type safety

  • Supports secure key generation and distribution

Dependencies

This library is part of the HSuite ecosystem and requires:

{
  "@hsuite/nestjs-swagger": "latest"
}

Documentation

All components are thoroughly documented using TypeScript JSDoc comments and include:

  • Detailed descriptions

  • Usage examples

  • Technical remarks

  • Integration guidelines

For detailed API documentation, refer to the CompoDocs generated documentation.

License

This package is part of the HbarSuite ecosystem and is covered by its license terms.


Built with ❤️ by the HbarSuite Team Copyright © 2024 HbarSuite. All rights reserved.

Last updated