Getting Started Guide

Prerequisites

  • Node.js 20 or higher

  • npm or yarn package manager

  • Basic understanding of TypeScript/JavaScript

  • Familiarity with cryptographic concepts

Installation

Core Package

npm install @the-hashgraph-group-ag/cryptosuites-core

EdDSA Cryptosuite

npm install @the-hashgraph-group-ag/cryptosuites-eddsa-v1

Ed25519 Signer

npm install @the-hashgraph-group-ag/signer-internal-ed25519

Basic Usage

Importing the SDK

import {
  ProofCreator,
  ProofVerifier,
  Signer,
  canonicalizer,
  hashing
} from '@the-hashgraph-group-ag/cryptosuites-core';

import { EdDSAProofCreator, EdDSAProofVerifier } from '@the-hashgraph-group-ag/cryptosuites-eddsa-v1';
import { InternalEd25519Signer, InternalEd25519Verifier } from '@the-hashgraph-group-ag/signer-internal-ed25519';

Creating a Simple Proof

// Initialize components
const proofCreator = new EdDSAProofCreator();
const signer = new InternalEd25519Signer(privateKey);

// Create proof options
const proofOptions = {
  proofPurpose: 'assertionMethod',
  verificationMethod: 'did:example:123#key-1',
};

// Create and sign document
const securedDocument = await signer.sign(
  inputDocument,
  proofOptions,
  proofCreator
);

Verifying a Proof

// Initialize verifier
const proofVerifier = new EdDSAProofVerifier();
const verifier = new InternalEd25519Verifier();

// Verify document
const isValid = await verifier.verify(
  securedDocument,
  { verificationMethodResolver: resolveKey },
  [proofVerifier]
);

Next Steps

  • Explore the API Reference for detailed documentation

  • Check out the Architecture Guide to understand the system design

  • Review the other packages for specific cryptosuite implementations