Package com.tnsai.identity
Record Class DIDConfig
java.lang.Object
java.lang.Record
com.tnsai.identity.DIDConfig
public record DIDConfig(String method, String domain, String agentId, String publicKey, String keyType, boolean generateDocument, String serviceEndpoint)
extends Record
Programmatic counterpart of
DIDSpec — the configuration an agent
declares to derive its DID (and, where supported, a
DIDDocument).
Where DID is the representation (the did: string
plus its parsed components), DIDConfig is the configuration:
the inputs an agent supplies — via @AgentSpec(did = ...) or
AgentBuilder.did(DIDConfig) — that those components
are derived from. The annotation and builder paths share this value type so
both produce identical DIDs (see toDid(String)).
- Since:
- 0.11.0
- Author:
- TnsAI Team
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionagentId()Returns the value of theagentIdrecord component.domain()Returns the value of thedomainrecord component.final booleanIndicates whether some other object is "equal to" this one.static DIDConfigBuilds a config from aDIDSpecannotation (1:1 field mapping).booleanReturns the value of thegenerateDocumentrecord component.final inthashCode()Returns a hash code value for this object.keyType()Returns the value of thekeyTyperecord component.method()Returns the value of themethodrecord component.static DIDConfigConvenience factory for the common case — method, domain and agent id, with the remaining fields left at their defaults.Returns the value of thepublicKeyrecord component.Returns the value of theserviceEndpointrecord component.Resolves this config to a DID string, applying the same default substitution as the annotation path: empty method →wba, empty domain →local, empty agent id →fallbackAgentId.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
from
Builds a config from aDIDSpecannotation (1:1 field mapping).- Parameters:
annotation- the@DIDSpecto read- Returns:
- the equivalent programmatic config
-
of
Convenience factory for the common case — method, domain and agent id, with the remaining fields left at their defaults.- Parameters:
method- DID method (e.g.wba)domain- domain (e.g.example.com)agentId- method-specific agent id- Returns:
- a config with default
keyType,generateDocument = true
-
toDid
Resolves this config to a DID string, applying the same default substitution as the annotation path: empty method →wba, empty domain →local, empty agent id →fallbackAgentId.- Parameters:
fallbackAgentId- agent id used whenagentId()is blank- Returns:
- a
did:method:domain:idstring
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
method
Returns the value of themethodrecord component.- Returns:
- the value of the
methodrecord component
-
domain
Returns the value of thedomainrecord component.- Returns:
- the value of the
domainrecord component
-
agentId
Returns the value of theagentIdrecord component.- Returns:
- the value of the
agentIdrecord component
-
publicKey
Returns the value of thepublicKeyrecord component.- Returns:
- the value of the
publicKeyrecord component
-
keyType
Returns the value of thekeyTyperecord component.- Returns:
- the value of the
keyTyperecord component
-
generateDocument
public boolean generateDocument()Returns the value of thegenerateDocumentrecord component.- Returns:
- the value of the
generateDocumentrecord component
-
serviceEndpoint
Returns the value of theserviceEndpointrecord component.- Returns:
- the value of the
serviceEndpointrecord component
-