fromJwt

open suspend override fun fromJwt(jwt: String): VerifiableCredential

Convert JWT to credential.

Parses a JWT and extracts the credential from the 'vc' claim. Note: This does not verify the signature. Use CredentialService.verify() for verification.

Recommended: Use the extension function jwtString.fromJwt() instead for a more elegant API.

Return

Verifiable credential

Parameters

jwt

JWT string

See also

Extension function


suspend fun fromJwt(jwt: String, allowUnsecured: Boolean): VerifiableCredential

Convert JWT to credential.

Parses a JWS-secured JWT and extracts the credential from the vc claim. The signature is not verified here — use CredentialService.verify() for that.

Unsecured JWTs (alg: none, such as the output of toJwt) are rejected unless allowUnsecured is true. Input that is not a JWT at all is rejected; there is no fallback to parsing raw JSON.

Throws

if the input is not a JWT, is unsecured without opt-in, or carries no valid vc claim.