An object containing input parameters for retrieving verification relationships.
The DID document to search for verification relationships.
The method ID to search for within the verification relationships.
An array of DidVerificationRelationship
enums representing the types of verification
relationships that reference the specified method ID.
const didDocument: DidDocument = {
// ...contents of a DID document...
};
const relationships = getVerificationRelationshipsById({
didDocument,
methodId: 'key-1'
});
console.log(relationships);
// Output might include ['authentication', 'assertionMethod'] if those relationships
// reference or contain the specified method ID.
Retrieves a list of DID verification relationships by a specific method ID from a DID document.
This function examines the specified DID document to identify any verification relationships (e.g.,
authentication
,assertionMethod
) that reference a verification method by its method ID or contain an embedded verification method matching the method ID. The method ID is typically a fragment of a DID (e.g.,did:example:123#key-1
) that uniquely identifies a verification method within the DID document.The search considers both direct references to verification methods by their IDs and verification methods embedded within the verification relationship arrays. It returns an array of
DidVerificationRelationship
enums corresponding to the verification relationships that contain the specified method ID.