Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QRCode code length overflow error on presentation #1

Open
millenc opened this issue May 4, 2023 · 1 comment
Open

QRCode code length overflow error on presentation #1

millenc opened this issue May 4, 2023 · 1 comment

Comments

@millenc
Copy link

millenc commented May 4, 2023

When I access the verifier app (through https://<mydomain>/verifier) and click on the Access to Telco Portal I get the following JS error:

 Uncaught (in promise) Error: code length overflow. (1556>1056)
    createData https://cdn.jsdelivr.net/gh/davidshimjs/qrcodejs@gh-pages/qrcode.min.js:1
    makeImpl https://cdn.jsdelivr.net/gh/davidshimjs/qrcodejs@gh-pages/qrcode.min.js:1
    getBestMaskPattern https://cdn.jsdelivr.net/gh/davidshimjs/qrcodejs@gh-pages/qrcode.min.js:1
    make https://cdn.jsdelivr.net/gh/davidshimjs/qrcodejs@gh-pages/qrcode.min.js:1
    makeCode https://cdn.jsdelivr.net/gh/davidshimjs/qrcodejs@gh-pages/qrcode.min.js:1
    requestPresentation https://<redacted>/verifier/js/index.js:36

The API request to get the QR code's contents works as expected and returns a URI such as:

{
  "requestId": "<request id redacted>",
  "url": "openid-vc://?request_uri=https://verifiedid.did.msidentity.com/v1.0/tenants/<tenant id redacted>/verifiableCredentials/presentationRequests/<request id redacted>",
  "expiry": 1683187032
}

This error has already been reported on the davidshimjs/qrcodejs project on the following open issue:

davidshimjs/qrcodejs#78

Apparently, the cause is passing strings between 192 and 220 characters, which makes sense since the request URI is exactly 192 characters long. The suggested workarounds are:

  1. Add the correctLevel: QRCode.CorrectLevel.L parameter to the QRCode() constructor call
  2. Swap the davidshimjs/qrcodejs library which is currently unmaintained with a maintained fork such as: KeeeX/qrcodejs

I've tested both and 1. didn't work for me. Using the KeeeX/qrcodejs fork did however and the QR code shows fine. I've made the change on my own fork:

millenc@0fad7b4

Is this error happening for somebody else? Should we update the library?

@embesozzi
Copy link
Contributor

I haven't encountered this error before. However, I will review the proposed workaround and include it in the demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants