Package com.tnsai.annotations
Annotation 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
| Method | Format | Use Case |
|---|---|---|
| wba | did:wba:domain:agentId | Web-Based Agents (recommended) |
| web | did:web:domain | Web domain based |
| key | did:key:publicKey | Cryptographic 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSupported key types for DID cryptography. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionAgent-specific identifier.Domain name for web-based DIDs.booleanWhether to auto-generate DID document.Key type for cryptographic operations.DID method.Public key for key-based DIDs.Service endpoint URL.
-
Element Details
-
method
String methodDID method.Supported methods:
wba- Web-Based Agents (recommended)web- Web domain basedkey- Cryptographic key based
- Returns:
- DID method name
- Default:
"wba"
-
domain
String domainDomain name for web-based DIDs.Used with
wbaandwebmethods.- Returns:
- domain name
- Default:
""
-
agentId
String agentIdAgent-specific identifier.If empty, a UUID is generated automatically.
- Returns:
- agent ID
- Default:
""
-
publicKey
String publicKeyPublic key for key-based DIDs.Used with
keymethod. Multibase encoded.- Returns:
- public key (multibase)
- Default:
""
-
keyType
DIDSpec.KeyType keyTypeKey type for cryptographic operations.- Returns:
- key type
- Default:
ED25519
-
generateDocument
boolean generateDocumentWhether to auto-generate DID document.If true, a DIDDocument is created with service endpoints.
- Returns:
- true to generate document
- Default:
true
-
serviceEndpoint
String serviceEndpointService endpoint URL.Where this agent can be reached.
- Returns:
- service endpoint URL
- Default:
""
-