[Webkit-unassigned] [Bug 240134] New: Error occurs on second call of button click callback when crypto.subtle.digest() is called before navigator.credentials.get()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 5 12:35:22 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=240134

            Bug ID: 240134
           Summary: Error occurs on second call of button click callback
                    when crypto.subtle.digest() is called before
                    navigator.credentials.get()
           Product: WebKit
           Version: Safari 15
          Hardware: iPhone / iPad
                OS: iOS 15
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKit Misc.
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: tommy at theliftedinitiative.org

When window.crypto.subtle.digest() is called before window.navigator.credentials.get(), the first time will not error but calling it a second time will.

The code below shows how to reproduce.


const getBtn = document.getElementById("get");
getBtn.addEventListener("click", async () => {
  try {
    /*
      remove the call to crypto.suble.digest and it will work without error
    */
    const digest = await window.crypto.subtle.digest(
      "SHA-512",
      CHALLENGE_BUFFER,
    )
    let credential = (await window.navigator.credentials.get({
      publicKey: {
        challenge: CHALLENGE_BUFFER,
        timeout: 30000,
        userVerification: "discouraged",
        allowCredentials: [
          {
            transports: ["nfc", "usb"],
            id: credentialId,
            type: "public-key",
          },
        ],
      },
    }))
    console.log({credential})
  } catch (e) {
    alert(`error ${e.message}`)
  }
})

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220505/9e4e54db/attachment-0001.htm>


More information about the webkit-unassigned mailing list