Architecture Guide

Overview

The Hashgraph Cryptosuites SDK follows a modular architecture designed to provide flexibility, extensibility, and compliance with W3C Data Integrity specifications.

Core Components

Core Package (@the-hashgraph-group-ag/cryptosuites-core)

The core package provides the foundational interfaces and utilities:

  • Interfaces - Abstract definitions for all cryptographic operations

  • Canonicalization - JSON canonicalization following RFC 8785

  • Hashing - Cryptographic hashing algorithms (SHA-256)

  • Utilities - Common utilities for multibase encoding and array operations

Cryptosuites

Cryptosuites implement specific cryptographic proof methods:

  • EdDSA Cryptosuite (@the-hashgraph-group-ag/cryptosuites-eddsa-v1)

    • Implements EdDSA signature scheme

    • Supports Ed25519 and Ed448 curves

    • W3C Data Integrity compliant

Signers and Verifiers

Concrete implementations for signing and verification:

  • Internal Ed25519 (@the-hashgraph-group-ag/signer-internal-ed25519)

    • Pure JavaScript Ed25519 implementation

    • No external dependencies

    • Suitable for browser and Node.js environments

Design Principles

Modularity

Each package has a single responsibility: - Core provides interfaces and utilities - Cryptosuites implement proof methods - Signers/Verifiers handle cryptographic operations

Extensibility

The architecture allows for easy extension: - New cryptosuites can be added by implementing the core interfaces - Custom signers can be created for different key types - Additional hashing algorithms can be integrated

Standards Compliance

Full compliance with: - W3C Data Integrity specification - RFC 8785 JSON Canonicalization - JWK (JSON Web Key) standards

Data Flow

Proof Creation

  1. Document Preparation - Input document is canonicalized

  2. Proof Generation - Cryptosuite creates proof structure

  3. Signing - Signer creates cryptographic signature

  4. Document Assembly - Proof is attached to create secured document

Proof Verification

  1. Document Parsing - Secured document is parsed

  2. Proof Extraction - Proof data is extracted

  3. Verification - Verifier validates the signature

  4. Result - Boolean result indicating validity

Package Dependencies

core (no dependencies)
├── cryptosuites-eddsa-v1
│   └── core
└── signer-internal-ed25519
    └── core

Future Extensions

The architecture supports future additions: - Additional cryptosuites (RSA, ECDSA, etc.) - Hardware security module (HSM) integration - Cloud-based signing services - Additional canonicalization methods