didwebvh-ts v1.0.3
didwebvh-ts
didwebvh-ts provides developers with a comprehensive library and resolver for working with Decentralized Identifiers (DIDs) following the did:webvh method specification. This Typescript-based toolkit is designed to facilitate the integration and management of DIDs within web applications, enabling secure identity verification and authentication processes. It includes functions for creating, resolving, updating and deactivating DIDs by managing DID documents. The package is built to ensure compatibility with the latest web development standards, offering a straightforward API that makes it easy to implement DID-based features in a variety of projects.
Summary
The didwebvh-ts implementation of the did:webvh specification aims to be compatible with the did:webvh v0.5 specification.
Prerequisites
Install bun.sh
curl -fsSL https://bun.sh/install | bashInstall dependencies
bun installAvailable Commands
The following commands are defined in the package.json file:
dev: Run the resolver in development mode with debugging enabled.bun run devThis command runs:
bun --watch --inspect-wait ./src/resolver.tsserver: Run the resolver in watch mode for development.bun run serverThis command runs:
bun --watch ./src/resolver.tstest: Run all tests.bun run testThis command runs:
bun testtest:watch: Run tests in watch mode.bun run test:watchThis command runs:
bun test --watchtest:bail: Run tests in watch mode, stopping on the first failure with verbose output.bun run test:bailThis command runs:
bun test --watch --bail --verbosetest:log: Run tests and save the output to a log file.bun run test:logThis command runs:
mkdir -p ./test/logs && LOG_RESOLVES=true bun test &> ./test/logs/test-run.txtcli: Run the CLI tool.bun run cli [command] [options]This command runs:
bun run src/cli.ts --
CLI Usage Guide
⚠️ Warning: The CLI is experimental beta software - use at your own risk!
Basic Syntax
bun run cli [command] [options]Available Commands
1. Create a DID
Create a new DID with various configuration options:
bun run cli create \
--domain example.com \
--output ./did.jsonl \Key Options:
--domain: (Required) Host domain for the DID--output: Save location for DID log--portable: Enable domain portability--witness: Add witness DIDs (repeatable)--witness-threshold: Set minimum witness count--next-key-hash: Add pre-rotation key hashes
2. Resolve a DID
View the current state of a DID:
# From DID identifier
bun run cli resolve --did did:webvh:123456:example.com
# From local log file
bun run cli resolve --log ./did.jsonl3. Update a DID
Modify an existing DID's properties:
bun run cli update \
--log ./did.jsonl \
--output ./updated.jsonl \
--add-vm keyAgreement \
--service LinkedDomains,https://example.com \
--also-known-as did:web:example.comUpdate Options:
--log: (Required) Current DID log path--output: Updated log save location--add-vm: Add verification methods:- authentication
- assertionMethod
- keyAgreement
- capabilityInvocation
- capabilityDelegation
--service: Add services (format: type,endpoint)--also-known-as: Add alternative identifiers--witness: Update witness list--witness-threshold: Update witness requirements
4. Deactivate a DID
Permanently deactivate a DID:
bun run cli deactivate \
--log ./did.jsonl \
--output ./deactivated.jsonlContributing
Commit Message Format
This project uses Semantic Release for automated version management and package publishing. Commit messages must follow the Conventional Commits specification.
Format: <type>(<scope>): <description> where scope is optional.
Types:
feat: A new feature (triggers a minor version bump)fix: A bug fix (triggers a patch version bump)docs: Documentation changesstyle: Code style changes (formatting, missing semi-colons, etc)refactor: Code changes that neither fix a bug nor add a featureperf: Performance improvementstest: Adding or updating testschore: Changes to build process or auxiliary tools
Examples:
feat(resolver): add support for new DID method
fix: handle null response from endpoint
docs: update installation instructions
chore: update dependenciesBreaking changes must include BREAKING CHANGE: in the commit message body or footer, or append a ! after the type/scope.
Example:
feat(api)!: remove deprecated endpointsor
feat(api): remove deprecated endpoints
BREAKING CHANGE: The following endpoints have been removed...