Class DidDocument
-
- All Implemented Interfaces:
public final class DidDocumentDidDocument represents a set of data describing the DID subject including mechanisms such as:
cryptographic public keys - used to authenticate itself and prove association with the DID
services - means of communicating or interacting with the DID subject or associated entities via one or more service endpoints. Examples include discovery services, agent services, social networking services, file storage services, and verifiable credential repository services. A DID Document can be retrieved by resolving a DID URI. DID Core spec: https://www.w3.org/TR/did-core/#core-properties
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classDidDocument.BuilderBuilder object to build a DidDocument.
-
Field Summary
Fields Modifier and Type Field Description private final Stringidprivate final List<String>contextprivate final List<String>alsoKnownAsprivate final List<String>controllerprivate final List<VerificationMethod>verificationMethodprivate final List<Service>serviceprivate final List<String>assertionMethodprivate final List<String>authenticationprivate final List<String>keyAgreementprivate final List<String>capabilityDelegationprivate final List<String>capabilityInvocation
-
Constructor Summary
Constructors Constructor Description DidDocument(String id, List<String> context, List<String> alsoKnownAs, List<String> controller, List<VerificationMethod> verificationMethod, List<Service> service, List<String> assertionMethod, List<String> authentication, List<String> keyAgreement, List<String> capabilityDelegation, List<String> capabilityInvocation)
-
Method Summary
Modifier and Type Method Description final StringgetId()the DID URI for a particular DID subject, expressed using the id property in the DID document. final List<String>getContext()a list of URI that defines the schema version used in the document. final List<String>getAlsoKnownAs()AlsoKnownAs can contain multiple identifiers for different purposes, or at different times for the same DID subject. final List<String>getController()defines an entity that is authorized to make changes to a DID document. final List<VerificationMethod>getVerificationMethod()a list of cryptographic public keys, which can be used to authenticate or authorize interactions with the DID subject or associated parties. final List<Service>getService()expresses ways of communicating with the DID subject or associated entities. final List<String>getAssertionMethod()used to specify how the DID subject is expected to express claims, such as for the purposes of issuing a Verifiable Credential. final List<String>getAuthentication()specifies how the DID subject is expected to be authenticated, for purposes such as logging into a website or engaging in any sort of challenge-response protocol. final List<String>getKeyAgreement()specifies how an entity can generate encryption material to transmit confidential information intended for the DID subject, such as for establishing a secure communication channel. final List<String>getCapabilityDelegation()specifies a mechanism used by the DID subject to delegate a cryptographic capability to another party, such as delegating the authority to access a specific HTTP API. final List<String>getCapabilityInvocation()specifies a verification method used by the DID subject to invoke a cryptographic capability, such as the authorization to update the DID Document. final VerificationMethodselectVerificationMethod(VMSelector selector)Select verification method takes a selector that can be used to select a specific verification method from the DID Document. final StringgetAbsoluteResourceID(String id)GetAbsoluteResourceID returns a fully qualified ID for a document resource (e.g. final VerificationMethodfindAssertionMethodById(String assertionMethodId)Finds the first available assertion method from the DidDocument. final VerificationMethodfindAssertionMethodById()Finds the first available assertion method from the DidDocument. StringtoString()-
-
Constructor Detail
-
DidDocument
DidDocument(String id, List<String> context, List<String> alsoKnownAs, List<String> controller, List<VerificationMethod> verificationMethod, List<Service> service, List<String> assertionMethod, List<String> authentication, List<String> keyAgreement, List<String> capabilityDelegation, List<String> capabilityInvocation)
-
-
Method Detail
-
getId
final String getId()
the DID URI for a particular DID subject, expressed using the id property in the DID document.
-
getContext
final List<String> getContext()
a list of URI that defines the schema version used in the document.
-
getAlsoKnownAs
final List<String> getAlsoKnownAs()
AlsoKnownAs can contain multiple identifiers for different purposes, or at different times for the same DID subject. The assertion that two or more DIDs (or other types of URI) refer to the same DID subject can be made using the alsoKnownAs property.
-
getController
final List<String> getController()
defines an entity that is authorized to make changes to a DID document. The process of authorizing a DID controller is defined by the DID method. It can be a string or a list of strings.
-
getVerificationMethod
final List<VerificationMethod> getVerificationMethod()
a list of cryptographic public keys, which can be used to authenticate or authorize interactions with the DID subject or associated parties.
-
getService
final List<Service> getService()
expresses ways of communicating with the DID subject or associated entities. A service can be any type of service the DID subject wants to advertise.
-
getAssertionMethod
final List<String> getAssertionMethod()
used to specify how the DID subject is expected to express claims, such as for the purposes of issuing a Verifiable Credential.
-
getAuthentication
final List<String> getAuthentication()
specifies how the DID subject is expected to be authenticated, for purposes such as logging into a website or engaging in any sort of challenge-response protocol.
-
getKeyAgreement
final List<String> getKeyAgreement()
specifies how an entity can generate encryption material to transmit confidential information intended for the DID subject, such as for establishing a secure communication channel.
-
getCapabilityDelegation
final List<String> getCapabilityDelegation()
specifies a mechanism used by the DID subject to delegate a cryptographic capability to another party, such as delegating the authority to access a specific HTTP API.
-
getCapabilityInvocation
final List<String> getCapabilityInvocation()
specifies a verification method used by the DID subject to invoke a cryptographic capability, such as the authorization to update the DID Document.
-
selectVerificationMethod
final VerificationMethod selectVerificationMethod(VMSelector selector)
Select verification method takes a selector that can be used to select a specific verification method from the DID Document. If a selector is not provided, the first verification method is returned
The selector can either be an ID, Purpose, or null. If a Purpose is provided, the first verification method in the DID Document that has the provided purpose will be returned.
- Parameters:
selector- can either be an ID, Purpose, or null- Returns:
VerificationMethod matching the selector criteria
-
getAbsoluteResourceID
final String getAbsoluteResourceID(String id)
GetAbsoluteResourceID returns a fully qualified ID for a document resource (e.g. service, verification method) Document Resource IDs are allowed to be relative DID URLs as a means to reduce storage size of DID Documents. More info here: https://www.w3.org/TR/did-core/#relative-did-urls
- Parameters:
id- of the resource- Returns:
fully qualified ID for a document resource
-
findAssertionMethodById
@JvmOverloads() final VerificationMethod findAssertionMethodById(String assertionMethodId)
Finds the first available assertion method from the DidDocument. When assertionMethodId is null, the function will return the first available assertion method.
- Parameters:
assertionMethodId- The ID of the assertion method to be found- Returns:
VerificationMethod with purpose of Assertion
-
findAssertionMethodById
@JvmOverloads() final VerificationMethod findAssertionMethodById()
Finds the first available assertion method from the DidDocument. When assertionMethodId is null, the function will return the first available assertion method.
- Returns:
VerificationMethod with purpose of Assertion
-
-
-
-