An object containing input parameters for retrieving types.
The DID document from which types are retrieved.
An array of types. If no types were found, an empty array is returned.
const didDocument = {
verificationMethod: [
{
'id' : 'did:example:123#key-0',
'type' : 'Ed25519VerificationKey2018',
'controller' : 'did:example:123',
'publicKeyBase58' : '3M5RCDjPTWPkKSN3sxUmmMqHbmRPegYP1tjcKyrDbt9J'
},
{
'id' : 'did:example:123#key-1',
'type' : 'X25519KeyAgreementKey2019',
'controller' : 'did:example:123',
'publicKeyBase58' : 'FbQWLPRhTH95MCkQUeFYdiSoQt8zMwetqfWoxqPgaq7x'
},
{
'id' : 'did:example:123#key-3',
'type' : 'JsonWebKey2020',
'controller' : 'did:example:123',
'publicKeyJwk' : {
'kty' : 'EC',
'crv' : 'P-256',
'x' : 'Er6KSSnAjI70ObRWhlaMgqyIOQYrDJTE94ej5hybQ2M',
'y' : 'pPVzCOTJwgikPjuUE6UebfZySqEJ0ZtsWFpj7YSPGEk'
}
}
]
},
const vmTypes = getVerificationMethodTypes({ didDocument });
console.log(vmTypes);
// Output: ['Ed25519VerificationKey2018', 'X25519KeyAgreementKey2019', 'JsonWebKey2020']
Retrieves all DID verification method types from a given DID document.
The given DID Document must adhere to the W3C DID Core Specification.