The object to be checked.
true
if obj
is a DidService
; otherwise, false
.
const service = {
id: "did:example:123#service-1",
type: "OidcService",
serviceEndpoint: "https://example.com/oidc"
};
if (isDidService(service)) {
console.log('The object is a DidService');
} else {
console.log('The object is not a DidService');
}
Checks if a given object is a DidService.
A DidService in the context of DID resources must include the properties
id
,type
, andserviceEndpoint
. TheserviceEndpoint
can be aDidServiceEndpoint
or an array ofDidServiceEndpoint
objects.