# silence-laboratories/silent-shard-dkls23-ll architecture

> Architecture diagram of the GitHub repository silence-laboratories/silent-shard-dkls23-ll, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/silence-laboratories/silent-shard-dkls23-ll
- Repository: https://github.com/silence-laboratories/silent-shard-dkls23-ll

## Overview

##### Main Components

a) Core Library Layer (dkls23-ll):
- DKG (Distributed Key Generation) Module
- DSG (Distributed Signature Generation) Module
- Pairs Module
- Utils Module
- Error Handling Module

b) WASM Wrapper Layer:
- This as an intermediate layer above the core library
- Following components:
- Key Generation Interface
- Key Share Management
- Signing Interface
- Error Handling
- Message Processing

c) Protocol Implementation Layer:
- Cryptographic protocols:
- DKLs23 Protocol Implementation
- Endemic OT Protocol
- SoftSpokenOT Protocol
- Proactive Security Mechanism

##### Component Relationships

- Protocol implementation interactions with both core and wrapper layers

##### Specific Elements

a) Process Flows:
- Key Generation Flow (2-out-of-2 and 2-out-of-3 variants)
- Signature Generation Flow
- Presignature Computation Flow
- Key Rotation/Refresh Flow

b) Security Boundaries:
- Trust boundaries between parties
- Secure communication channels
- Threshold boundaries

##### Technical Details to Emphasize

- Rust native components (Core Library)
- WebAssembly components (Wrapper)
- External interfaces
- Cryptographic operations
- Message passing mechanisms

##### Implementation Notes

Annotations for:
- State management
- Message validation requirements
- Single-use presignature warning
- Network security considerations (marked as external responsibility)

##### Additional Elements

Callouts for:
- Supported party configurations (2-out-of-2, 2-out-of-3)
- Security properties (UC secure, threshold properties)
- Critical dependencies
- State management requirements

**[Application Layer (WASM Interface)]**
- ↕
**[Protocol Implementation Layer]**
- ↕
**[Core Cryptographic Layer]**

- Rectangles: Core components
- Hexagons: Protocol implementations
- Circles: Communication points
- Diamonds: Decision points

- Blue: Core cryptographic operations
- Green: Secure channels
- Yellow: Warning points (like single-use presignatures)
- Red: Security boundaries

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#dae8fc,stroke:#6c8ebf
    classDef wasm fill:#d5e8d4,stroke:#82b366
    classDef protocol fill:#ffe6cc,stroke:#d79b00
    classDef security fill:#f8cecc,stroke:#b85450
    classDef flow fill:#fff2cc,stroke:#d6b656

    %% Core Library Layer
    subgraph CoreLib["Core Library Layer"]
        DKG["DKG Module"]
        DSG["DSG Module"]
        Pairs["Pairs Module"]
        Utils["Utils Module"]
        ErrorCore["Error Handling"]
        Constants["Constants"]
    end

    %% WASM Wrapper Layer
    subgraph WASMWrapper["WASM Wrapper Layer"]
        KeyGen["Key Generation Interface"]
        KeyShare["Key Share Management"]
        SignInterface["Signing Interface"]
        ErrorWasm["Error Handling"]
        MsgProc["Message Processing"]
        WasmUtils["WASM Utils"]
    end

    %% Protocol Implementation Layer
    subgraph ProtocolLayer["Protocol Implementation Layer"]
        DKLs23{{"DKLs23 Protocol"}}
        EndemicOT{{"Endemic OT Protocol"}}
        SoftSpokenOT{{"SoftSpoken OT Protocol"}}
        ProactiveSec{{"Proactive Security"}}
    end

    %% Relationships
    DKG <--> DSG
    Pairs --> DKG
    Pairs --> DSG
    Utils --> DKG
    Utils --> DSG
    ErrorCore --> DKG
    ErrorCore --> DSG
    Constants --> DKG
    Constants --> DSG

    DKLs23 --> DKG
    DKLs23 --> DSG
    EndemicOT --> DKLs23
    SoftSpokenOT --> DKLs23
    ProactiveSec --> DKG

    KeyGen --> DKLs23
    SignInterface --> DKLs23
    KeyShare --> KeyGen
    KeyShare --> SignInterface
    MsgProc --> KeyGen
    MsgProc --> SignInterface
    ErrorWasm --> KeyGen
    ErrorWasm --> SignInterface
    WasmUtils --> KeyGen
    WasmUtils --> SignInterface

    %% Click Events
    click DKG "https://github.com/silence-laboratories/silent-shard-dkls23-ll/blob/main/src/dkg.rs"
    click DSG "https://github.com/silence-laboratories/silent-shard-dkls23-ll/blob/main/src/dsg.rs"
    click Pairs "https://github.com/silence-laboratories/silent-shard-dkls23-ll/blob/main/src/pairs.rs"
    click Utils "https://github.com/silence-laboratories/silent-shard-dkls23-ll/blob/main/src/utils.rs"
    click ErrorCore "https://github.com/silence-laboratories/silent-shard-dkls23-ll/blob/main/src/error.rs"
    click Constants "https://github.com/silence-laboratories/silent-shard-dkls23-ll/blob/main/src/constants.rs"
    click KeyGen "https://github.com/silence-laboratories/silent-shard-dkls23-ll/blob/main/wrapper/wasm-ll/src/keygen.rs"
    click KeyShare "https://github.com/silence-laboratories/silent-shard-dkls23-ll/blob/main/wrapper/wasm-ll/src/keyshare.rs"
    click SignInterface "https://github.com/silence-laboratories/silent-shard-dkls23-ll/blob/main/wrapper/wasm-ll/src/sign.rs"
    click ErrorWasm "https://github.com/silence-laboratories/silent-shard-dkls23-ll/blob/main/wrapper/wasm-ll/src/errors.rs"
    click MsgProc "https://github.com/silence-laboratories/silent-shard-dkls23-ll/blob/main/wrapper/wasm-ll/src/message.rs"
    click WasmUtils "https://github.com/silence-laboratories/silent-shard-dkls23-ll/blob/main/wrapper/wasm-ll/src/utils.rs"

    %% Style Applications
    class DKG,DSG,Pairs,Utils,ErrorCore,Constants core
    class KeyGen,KeyShare,SignInterface,ErrorWasm,MsgProc,WasmUtils wasm
    class DKLs23,EndemicOT,SoftSpokenOT,ProactiveSec protocol
```
