CredentialTransformer
Credential transformer for format conversion.
Provides format conversion between different credential representations:
JSON-LD (default W3C VC format)
JWT (compact, widely supported)
CBOR (binary, efficient - RFC 8949 compliant)
Recommended Usage (Elegant DSL API):
// Use extension functions directly on VerifiableCredential (recommended)
val jwt = credential.toJwt()
val jsonLd = credential.toJsonLd()
val cbor = credential.toCbor()
// Convert from formats
val credential = jwtString.fromJwt()
val credential = jsonLdObject.toCredential()
val credential = cborBytes.fromCbor()
// Round-trip transformations
val recovered = credential.roundTripJwt()Content copied to clipboard
Alternative Usage (Direct API):
val transformer = CredentialTransformer()
val jwt = transformer.toJwt(credential)
val credential = transformer.fromJwt(jwt)Content copied to clipboard
With TrustWeave Integration:
val jwt = trustWeave.toJwt(credential)
val jsonLd = trustWeave.toJsonLd(credential)Content copied to clipboard
With DSL Builder:
val jwt = (credential.transform { toJwt() } as TransformResult.Jwt).valueContent copied to clipboard
See also
org.trustweave.credential.internal.transform.CredentialTransformerExtensions
For extension functions
For DSL builder
Functions
Link copied to clipboard
Convert CBOR to credential.
Link copied to clipboard
Convert JSON-LD to credential.
Link copied to clipboard
Convert JWT to credential.
Link copied to clipboard
Convert credential to CBOR format.
Link copied to clipboard
Convert credential to JSON-LD format.
Link copied to clipboard
Convert credential to JWT format.