3.1.0 • Published 5 months ago

@empe/common v3.1.0

Weekly downloads
-
License
-
Repository
github
Last release
5 months ago

Common Package

Overview

The common package provides foundational utilities, interfaces, and helper classes that are shared across the SSI (Self-Sovereign Identity) SDK. This package serves as the core building block for implementing W3C standards for Decentralized Identifiers (DIDs) and Verifiable Credentials (VCs).

Key Components

Cryptography

The cryptography module provides essential cryptographic operations and utilities needed for digital signatures, key management, and secure messaging in decentralized identity systems.

  • Cryptographic primitives
  • Key generation and management
  • Signing and verification utilities
  • Support for various cryptographic algorithms (as specified by W3C standards)

Storage

The storage module provides adapters and interfaces for securely storing cryptographic keys and other sensitive data.

  • KeyStorageAdapter: Interface for key storage operations
  • MemKeyStorageAdapter: In-memory implementation for development and testing

Error Handling

Standardized error classes to ensure consistent error handling across the SDK:

  • BaseError: Foundation error class with support for error codes
  • Various specialized error types for different components

Usage Examples

Using the Key Storage Adapter

import { MemKeyStorageAdapter, JwkCrv } from '@empe/common';

// Create an in-memory key storage (for development/testing only)
const keyStorage = new MemKeyStorageAdapter();

// Store a key
await keyStorage.add('key-id-1', {
  pub: new Uint8Array([/* public key bytes */]),
  prv: new Uint8Array([/* private key bytes */]),
  type: JwkCrv.Ed25519 // JWK curve type
});

// Retrieve a key
const keyEntry = await keyStorage.get('key-id-1');

// Check if a key exists
const hasKey = await keyStorage.has('key-id-1');

// Remove a key
await keyStorage.remove('key-id-1');

Important Notes

  • The MemKeyStorageAdapter is intended for testing and development only, NOT for production use.
  • For production deployments, use a secure, persistent key storage implementation.
3.1.0

5 months ago

3.0.0

8 months ago

2.2.0

8 months ago

2.1.0

9 months ago

1.0.0

11 months ago

0.0.3

11 months ago

0.0.2

1 year ago