HbarSuite Docs
  • Welcome to HbarSuite
  • HbarSuite Developer Documentation
    • HbarSuite Smart Engine Applications
      • @hsuite/cross-chain-exchange
      • @hsuite/dao
      • @hsuite/exchange
      • @hsuite/launchpad
      • @hsuite/multisig
      • @hsuite/nft-exchange
    • HSuite Libraries
      • @hsuite/api-key
      • @hsuite/auth-types
      • @hsuite/auth
      • @hsuite/client-types
      • @hsuite/client
      • @hsuite/dkg-types
      • @hsuite/hashgraph-types
      • @hsuite/health
      • @hsuite/helpers
      • @hsuite/ipfs
      • @hsuite/smart-config
      • @hsuite/smart-network-types
      • @hsuite/smart-transaction-types
      • @hsuite/smartnode-sdk
      • @hsuite/snapshots
      • @hsuite/subscriptions-types
      • @hsuite/subscriptions
      • @hsuite/throttler-types
      • @hsuite/throttler
      • @hsuite/users-types
      • @hsuite/users
      • @hsuite/validators-types
  • General Documentation
    • Tokenomics
      • Tokenomics v1
      • Tokenomics V2
    • Smart Apps and Interaction
      • Subscription-Based Model
      • Token-Gate Model
    • The Smart Node Network
      • security-layer
        • Security Layer Integration
        • Setting Up Secure Clusters
        • Generating and Sharing Keys Collaboratively
        • Protecting Secrets with Shamir's Method
        • Managing Cluster Membership
        • Handling Node Expulsion and Replacement
        • Automating Responses to Network Changes & Key Rotation
        • Ensuring Continuous Operation and Recovery
      • Understanding Validators in Our System
        • Type of Validators Explained
    • What is a Smart Node?
  • Restful APIs Documentation
Powered by GitBook
On this page
  • Overview
  • Core Components
  • Interfaces (IDKG Namespace)
  • Models (DKG Namespace)
  • Features
  • Usage
  • Integration
  • Technical Details
  • Dependencies
  • Documentation
  • License
  1. HbarSuite Developer Documentation
  2. HSuite Libraries

@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.

Previous@hsuite/clientNext@hsuite/hashgraph-types

Last updated 3 months ago