toJwt

open suspend override fun toJwt(credential: VerifiableCredential): String

Convert credential to JWT format.

Creates a JWT with the credential in the 'vc' claim. Note: This creates an unsigned JWT. For signed JWTs, use CredentialService.issue().

The result is an unsecured JWT (alg: none); reading it back requires fromJwt with allowUnsecured = true.

Return

JWT string (unsigned)

Parameters

credential

Credential to convert

Throws

if the credential cannot be encoded as JWT claims. The method never falls back to another representation.