QrCodeParser
object QrCodeParser
QR code parser for credential and presentation URLs.
Supports parsing:
OIDC4VCI credential offer URLs:
openid-credential-offer://...Offer-by-value, OID4VCI v1.0 §4.1: a single
credential_offerquery parameter carrying URL-encoded JSON (credential_issuer,credential_configuration_ids,grants)Offer-by-reference: a
credential_offer_uriquery parameter pointing at the offer JSONLegacy flat parameters:
credential_issuer=...&credential_configuration_ids=a,bOIDC4VP authorization URLs:
openid4vp://authorize?...Generic HTTP/HTTPS URLs
Example Usage:
val qrCode = "openid-credential-offer://?credential_offer=%7B%22credential_issuer%22...%7D"
val parsed = QrCodeParser.parse(qrCode)
when (parsed) {
is QrCodeContent.CredentialOffer -> {
println("Credential offer from: ${parsed.credentialIssuer}")
}
is QrCodeContent.PresentationRequest -> {
println("Presentation request: ${parsed.authorizationUrl}")
}
}Content copied to clipboard