Data Types Reference
Complete reference for all TrustWeave data types.
Core Types
Did
Type-safe Decentralized Identifier (value class).
1
2
@JvmInline
value class Did(val value: String)
Properties:
value: The underlying string value of the DID (e.g., “did:key:z6Mk…”)
Usage:
1
2
3
4
5
6
7
8
// Create Did from string
val did = Did("did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK")
// Access underlying string value
val didString = did.value
// Use in DID operations
val resolution = didResolver.resolve(did)
Note: Did is a value class that provides compile-time type safety and validation. The constructor validates that the DID follows the did:method:identifier format.
DidDocument
W3C-compliant DID document.
1
2
3
4
5
6
7
data class DidDocument(
val id: String, // DID string (e.g., "did:key:z6Mk...")
val verificationMethod: List<VerificationMethod>, // Public keys
val authentication: List<String>, // Authentication key references
val assertionMethod: List<String>, // Assertion key references
val service: List<Service>? = null // Optional service endpoints
)
Properties:
id: The DID identifierverificationMethod: Array of verification methods with public keysauthentication: Authentication key referencesassertionMethod: Assertion key references (for signing)service: Optional service endpoints
VerifiableCredential
W3C-compliant verifiable credential.
1
2
3
4
5
6
7
8
9
10
data class VerifiableCredential(
val id: String, // Credential ID
val type: List<String>, // Credential types
val issuer: String, // Issuer DID
val issuanceDate: String, // ISO 8601 timestamp
val credentialSubject: JsonObject, // Subject claims
val proof: Proof, // Cryptographic proof
val expirationDate: String? = null, // Optional expiration
val credentialStatus: CredentialStatus? = null // Optional revocation status
)
Properties:
id: Unique credential identifiertype: Credential types (must include “VerifiableCredential”)issuer: Issuer DIDissuanceDate: When credential was issued (ISO 8601)credentialSubject: The claims being made (JsonObject)proof: Cryptographic proof (signature)expirationDate: Optional expiration datecredentialStatus: Optional revocation status
VerifiablePresentation
W3C-compliant verifiable presentation.
1
2
3
4
5
6
7
8
data class VerifiablePresentation(
val id: String, // Presentation ID
val type: List<String>, // Presentation types
val holder: String, // Holder DID
val verifiableCredential: List<VerifiableCredential>, // Credentials
val proof: Proof, // Cryptographic proof
val expirationDate: String? = null // Optional expiration
)
Properties:
id: Unique presentation identifiertype: Presentation typesholder: Holder DIDverifiableCredential: List of credentials in presentationproof: Cryptographic proofexpirationDate: Optional expiration date
DID Types
DidResolutionResult
Result of DID resolution.
1
2
3
4
data class DidResolutionResult(
val document: DidDocument?, // Resolved DID document
val metadata: DidResolutionMetadata // Resolution metadata
)
Properties:
document: Resolved DID document (null if not found)metadata: Resolution metadata (method, error, etc.)
DidResolutionMetadata
Metadata about DID resolution.
1
2
3
4
data class DidResolutionMetadata(
val method: String, // DID method used
val error: String? = null // Error message if resolution failed
)
DidCreationOptions
Options for creating DIDs.
1
2
3
4
5
data class DidCreationOptions(
val algorithm: KeyAlgorithm = KeyAlgorithm.ED25519,
val purposes: List<KeyPurpose> = listOf(KeyPurpose.AUTHENTICATION, KeyPurpose.ASSERTION_METHOD),
val additionalProperties: Map<String, Any> = emptyMap()
)
Properties:
algorithm: Key algorithm (ED25519, SECP256K1, RSA)purposes: List of key purposesadditionalProperties: Method-specific options
Credential Types
CredentialVerificationResult
Result of credential verification.
1
2
3
4
5
6
7
8
9
data class CredentialVerificationResult(
val valid: Boolean, // Overall validity
val proofValid: Boolean, // Proof signature is valid
val issuerValid: Boolean, // Issuer DID resolved successfully
val notExpired: Boolean, // Credential has not expired
val notRevoked: Boolean, // Credential is not revoked
val errors: List<String>, // List of error messages
val warnings: List<String> // List of warnings
)
Properties:
valid: Overall validity (all checks passed)proofValid: Proof signature is validissuerValid: Issuer DID resolved successfullynotExpired: Credential has not expirednotRevoked: Credential is not revokederrors: List of error messages if verification failedwarnings: List of warnings (e.g., expiring soon)
CredentialStatus
Revocation status information.
1
2
3
4
5
6
data class CredentialStatus(
val id: String, // Status list ID
val type: String, // Status list type
val statusPurpose: String, // Purpose (revocation, suspension)
val statusListIndex: Int // Index in status list
)
Wallet Types
CredentialFilter
Filter for querying credentials.
1
2
3
4
5
data class CredentialFilter(
val issuer: String? = null, // Filter by issuer DID
val type: String? = null, // Filter by credential type
val expired: Boolean? = null // Filter by expiration status
)
CredentialCollection
Collection of credentials.
1
2
3
4
5
6
data class CredentialCollection(
val id: String, // Collection ID
val name: String, // Collection name
val description: String? = null, // Optional description
val createdAt: Long? = null // Creation timestamp
)
CredentialMetadata
Metadata for a credential.
1
2
3
4
5
6
data class CredentialMetadata(
val credentialId: String, // Credential ID
val tags: Set<String> = emptySet(), // Tags
val notes: String? = null, // Optional notes
val customMetadata: Map<String, Any> = emptyMap() // Custom metadata
)
WalletCapabilities
Capabilities supported by a wallet.
1
2
3
4
5
6
7
data class WalletCapabilities(
val organization: Boolean = false, // Supports organization (collections, tags)
val presentation: Boolean = false, // Supports presentation creation
val lifecycle: Boolean = false, // Supports lifecycle management
val didManagement: Boolean = false, // Supports DID management
val keyManagement: Boolean = false // Supports key management
)
WalletStatistics
Statistics about a wallet.
1
2
3
4
5
6
data class WalletStatistics(
val totalCredentials: Int, // Total number of credentials
val collectionsCount: Int, // Number of collections
val tagsCount: Int, // Number of unique tags
val archivedCount: Int = 0 // Number of archived credentials
)
Blockchain Types
AnchorResult
Result of anchoring data to blockchain.
1
2
3
4
data class AnchorResult(
val ref: AnchorRef, // Anchor reference
val timestamp: String // ISO 8601 timestamp
)
Properties:
ref: Anchor reference (chain ID, transaction hash, block number)timestamp: When data was anchored (ISO 8601)
AnchorRef
Reference to anchored data on blockchain.
1
2
3
4
5
data class AnchorRef(
val chainId: String, // Chain ID (CAIP-2 format)
val txHash: String, // Transaction hash
val blockNumber: Long? = null // Block number (if available)
)
Properties:
chainId: Chain identifier (e.g., “algorand:testnet”)txHash: Transaction hashblockNumber: Block number where anchored (if available)
Key Types
KeyId
Type-safe key identifier (value class).
1
2
@JvmInline
value class KeyId(val value: String)
Properties:
value: The underlying string value of the key identifier
Usage:
1
2
3
4
5
6
7
8
9
// Create KeyId from string
val keyId = KeyId("did:key:z6Mk...#key-1")
// Access underlying string value
val keyIdString = keyId.value
// Use in KMS operations
val signature = kms.sign(keyId, data)
val publicKey = kms.getPublicKey(keyId)
Note: KeyId is a value class that provides compile-time type safety. When you have a KeyHandle, the id property is already a KeyId, so you can use it directly. When constructing from a string, use KeyId("your-key-string").
KeyInfo
Information about a cryptographic key.
1
2
3
4
5
6
data class KeyInfo(
val keyId: KeyId, // Key identifier (type-safe)
val algorithm: String, // Key algorithm
val publicKey: ByteArray, // Public key bytes
val purposes: List<KeyPurpose> // Key purposes
)
Properties:
keyId: Key identifier (type-safeKeyIdvalue class)algorithm: Key algorithm (Ed25519, Secp256k1, etc.)publicKey: Public key bytespurposes: Key purposes (AUTHENTICATION, ASSERTION_METHOD, etc.)
KeyPurpose
Purpose of a cryptographic key.
1
2
3
4
5
6
7
enum class KeyPurpose {
AUTHENTICATION, // Authentication
ASSERTION_METHOD, // Assertion (signing)
KEY_AGREEMENT, // Key agreement
CAPABILITY_INVOCATION, // Capability invocation
CAPABILITY_DELEGATION // Capability delegation
}
Proof Types
Proof
Cryptographic proof (signature).
1
2
3
4
5
6
7
data class Proof(
val type: String, // Proof type (Ed25519Signature2020, etc.)
val created: String, // Creation timestamp (ISO 8601)
val verificationMethod: String, // Verification method reference
val proofPurpose: String, // Proof purpose (assertionMethod, etc.)
val proofValue: String // Proof value (signature)
)
Properties:
type: Proof type (Ed25519Signature2020, JsonWebSignature2020, etc.)created: When proof was created (ISO 8601)verificationMethod: Verification method reference (key ID)proofPurpose: Proof purpose (assertionMethod, authentication, etc.)proofValue: Proof value (signature)
Service Types
Service
Service endpoint in DID document.
1
2
3
4
5
data class Service(
val id: String, // Service ID
val type: String, // Service type
val serviceEndpoint: String // Service endpoint URL
)
Properties:
id: Service identifiertype: Service type (LinkedDomains, DIDCommMessaging, etc.)serviceEndpoint: Service endpoint URL
Related Documentation
- Core API - API methods that use these types
- Wallet API - Wallet-specific types
- Quick Reference - Quick API lookup