Annotation Interface DIDSpec


@Documented @Retention(RUNTIME) @Target({}) public @interface DIDSpec
Configures W3C Decentralized Identifier (DID) for agent identity.

DIDs provide cryptographic identity for agent authentication, message signing, and inter-agent trust relationships.

DID Format

 did:method:method-specific-id

 Examples:
 did:wba:example.com:agent-123
 did:web:example.com
 did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
 

Supported Methods

MethodFormatUse Case
wbadid:wba:domain:agentIdWeb-Based Agents (recommended)
webdid:web:domainWeb domain based
keydid:key:publicKeyCryptographic key based

Usage


 @AgentSpec(
     description = "Research agent",
     did = @DIDSpec(
         method = "wba",
         domain = "university.edu",
         agentId = "research-001"
     )
 )
 public class ResearchAgent extends Agent { ... }
 // Generated DID: did:wba:university.edu:research-001
 

Auto-Generated Agent ID

If agentId is empty, a UUID is generated automatically:


 @DIDSpec(method = "wba", domain = "example.com")
 // Generated DID: did:wba:example.com:a1b2c3d4-...
 
Author:
TnsAI Team
See Also:
  • Element Details

    • method

      String method
      DID method.

      Supported methods:

      • wba - Web-Based Agents (recommended)
      • web - Web domain based
      • key - Cryptographic key based
      Returns:
      DID method name
      Default:
      "wba"
    • domain

      String domain
      Domain name for web-based DIDs.

      Used with wba and web methods.

      Returns:
      domain name
      Default:
      ""
    • agentId

      String agentId
      Agent-specific identifier.

      If empty, a UUID is generated automatically.

      Returns:
      agent ID
      Default:
      ""
    • publicKey

      String publicKey
      Public key for key-based DIDs.

      Used with key method. Multibase encoded.

      Returns:
      public key (multibase)
      Default:
      ""
    • keyType

      Key type for cryptographic operations.
      Returns:
      key type
      Default:
      ED25519
    • generateDocument

      boolean generateDocument
      Whether to auto-generate DID document.

      If true, a DIDDocument is created with service endpoints.

      Returns:
      true to generate document
      Default:
      true
    • serviceEndpoint

      String serviceEndpoint
      Service endpoint URL.

      Where this agent can be reached.

      Returns:
      service endpoint URL
      Default:
      ""