DidMethodUtils
Common utilities for DID method implementations.
Provides helper functions for:
DID parsing and validation
Verification method type mapping (algorithm → verification method type)
DID document builder helpers
Resolution metadata helpers
Functions
Maps a cryptographic algorithm to its verification method type.
Maps a KeyAlgorithm enum to its verification method type.
Builds a DID document with standard structure.
Builds a did:web identifier from a domain.
Compresses an EC public key point to SEC1 compressed form (0x02/0x03 || x), as required by the multicodec table for secp256k1-pub, p256-pub, p384-pub and p521-pub.
Creates an error DID resolution result.
Creates a DID resolution result for a document found on the method's backing store.
Creates a verification method reference from a key handle.
Creates a verification method reference from a key handle using KeyAlgorithm enum.
Decompresses an EC public key point to SEC1 uncompressed form (0x04 || x || y).
Returns the field-element (coordinate) size in bytes for algorithm, or null if it is not a supported short-Weierstrass EC algorithm.
Returns the 2-byte multicodec prefix for algorithm.
Normalizes a domain name for did:web.
Parses a multicodec-prefixed byte array and returns a (algorithm, publicKeyBytes) pair.
Percent-decodes a single did:web method-specific-id segment (RFC 3986 §2.1).
Validates that a DID matches a specific method.