Credential Exchange Protocols

Complete implementation of credential exchange protocols for TrustWeave, providing a unified interface for DIDComm V2, OIDC4VCI, and CHAPI.

Quick Start

Get started in 5 minutes! See the Complete Quick Start Guide for a full working example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import org.trustweave.credential.exchange.*
import org.trustweave.credential.exchange.registry.ExchangeProtocolRegistries
import org.trustweave.credential.exchange.request.ExchangeRequest
import org.trustweave.credential.exchange.result.ExchangeResult

// Create registry and exchange service
val registry = ExchangeProtocolRegistries.default()
val didCommService = DidCommFactory.createInMemoryService(kms, resolveDid)
registry.register(DidCommExchangeProtocol(didCommService))

val exchangeService = ExchangeServices.createExchangeService(
    protocolRegistry = registry,
    credentialService = credentialService,
    didResolver = didResolver
)

// Use any protocol with the same API
val offerResult = exchangeService.offer(
    ExchangeRequest.Offer(
        protocolName = "didcomm".requireExchangeProtocolName(),
        issuerDid = Did("did:key:issuer"),
        holderDid = Did("did:key:holder"),
        credentialPreview = credentialPreview,
        options = ExchangeOptions.Empty
    )
)
val offer = when (offerResult) {
    is ExchangeResult.Success -> offerResult.value
    else -> throw IllegalStateException("Offer failed: $offerResult")
}

For complete examples, see:

Protocols

✅ DIDComm V2

Status: Production Ready Documentation: DIDComm Protocol

  • Full protocol support (offer, request, issue, proof request, proof presentation)
  • Production crypto via didcomm-java library
  • End-to-end encryption (ECDH-1PU)
  • Message threading
  • JWS signing

✅ OIDC4VCI

Status: Production Ready Documentation: OIDC4VCI Protocol

  • Credential issuance flow
  • HTTP integration with credential issuer endpoints
  • Token exchange
  • Proof of possession (JWT)
  • Metadata discovery

✅ CHAPI

Status: Production Ready Documentation: CHAPI Protocol

  • Browser-compatible message generation
  • Credential offer/issue
  • Proof request/presentation
  • W3C Credential Handler API compliance

Documentation

Getting Started

Core Concepts

Advanced Topics

Protocol Comparison

Feature DIDComm OIDC4VCI CHAPI
Credential Offer
Credential Request
Credential Issue
Proof Request
Proof Presentation
Encryption Via HTTPS Browser
Production Ready

Production Status

All plugins are production-ready with:

  • ✅ Production-grade implementations
  • ✅ No placeholder/mock code in production paths
  • ✅ Integration with mature libraries
  • ✅ Proper error handling
  • ✅ Complete documentation

See Production Readiness and Final Evaluation for detailed assessments.

Getting Started

  1. Choose a Protocol: Based on your use case
  2. Read Protocol Documentation: See individual protocol docs
  3. Register Protocol: Add to the registry
  4. Use Protocol: Call registry methods

Examples

See Implementation Guide for detailed examples and Protocol Abstraction for core concepts.


This site uses Just the Docs, a documentation theme for Jekyll.