UNPKG

@synet/did

Version:

Secure, minimal, standards-compliant DID library for production environments. Supports did:key and did:web methods with strict validation and cryptographic security.

102 lines (71 loc) 3.7 kB
# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [1.0.6] - 2025-07-24 ### Breaking - createFromKey is depricated, use DID.create({publicKeyHex,KeyType: 'Ed25519', metadata}) ## [1.0.5] - 2025-07-22 ### Changed - **BREAKING**: `DID.create()` now accepts `DIDConfig` object instead of raw `meta` parameter - **API Consistency**: Updated to match @synet/keys v1.0.6 patterns with config objects - **Props-based Architecture**: Enhanced Unit Architecture Doctrine v1.0.5 compliance - **Updated Documentation**: Complete README refresh with new API signatures and examples ### Added - **DIDConfig interface**: Structured configuration object with `metadata` property - **Enhanced API Examples**: Updated all code examples to use new config-based patterns - **Type Safety**: Improved TypeScript definitions for better developer experience ## [1.0.3] - 2025-07-04 ### Added - DID Unit ## [1.0.2] - 2025-07-04 ### Fixed - Imports ## [1.0.1] - 2025-07-03 ### Code Quality Improvements - Updated all test error message expectations to match actual implementation - Fixed parameter naming consistency (`publicKey``verificationMethod`, `services``service`) - Added comprehensive test coverage for edge cases - Fixed empty test file with proper smoke tests ### Security - **Enhanced multicodec encoding**: Now uses proper varint (unsigned LEB128) encoding per standards - **Improved input validation**: Stricter validation of hex strings and key lengths - **Standards compliance**: All outputs now cross-validated against W3C test vectors and reference implementations ### Technical Details - Implemented `encodeVarint` function for proper unsigned LEB128 encoding - Updated `encodeMultibase` to use varint-encoded multicodec prefixes - Enhanced service ID processing in `createDIDDocument` function - 78 tests added, all pass with 100% success rate - Added external validation tests and online tests. ## [1.0.0] - 2025-05-01 ### Added - Initial release of @synet/did package - Support for creating DIDs with two methods: - `did:key` - Cryptographic key-based DIDs with multicodec encoding - `did:web` - Web-based DIDs with domain validation - DID parsing and validation functionality with detailed error messages - DID document creation with verification methods and services - Comprehensive utility functions: - `isDID()` - Check if string is valid DID - `extractMethod()` - Extract method from DID - `extractIdentifier()` - Extract identifier from DID - `normalizeDID()` - Normalize DID format - `createDIDURL()` - Create DID URL from components - Full TypeScript support with detailed type definitions - Zero runtime dependencies for minimal attack surface - Comprehensive test suite with 100% code coverage - Security-focused documentation and examples ### Security Features - **No cryptographic fallbacks** - Uses only secure, validated cryptographic primitives - **Minimal attack surface** - Zero runtime dependencies, focused scope - **Standards-compliant** - Follows W3C DID Core specification exactly - **Strict validation** - Comprehensive input sanitization and format validation - **Production-ready** - Built for high-stakes environments ### Technical Details - Built with TypeScript 5.8+ - Uses ES modules (ESM) format - Supports Node.js 18+ - Follows W3C DID Core specification - Implements proper error handling with DIDError class - Uses Bitcoin/IPFS Base58 alphabet for encoding - Implements varint encoding for multicodec prefixes