github / webauthn-json

🔏 A small WebAuthn API wrapper that translates to/from pure JSON using base64url.
https://github.github.com/webauthn-json/demo/
MIT License
760 stars 61 forks source link

Compilation error while using get #84

Open bharath154 opened 8 months ago

bharath154 commented 8 months ago

Hello,

I am running into this compilation error, while trying to use navigate.credentials.get. Is this an issue or I am missing something?

 tsc --noEmit
node_modules/@github/webauthn-json/src/webauthn-json/base64url.ts:28:26 - error TS2569: Type 'Uint8Array' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.

28   for (const charCode of byteView) {
                            ~~~~~~~~

Found 1 error.

tsc --version
Version 4.5.5

I am using it as below in my ts project:

      const options = parseRequestOptionsFromJSON({
        publicKey: {
          challenge: securityKeyChallengeResponse.challenge,
          timeout: 60000,
          rpId: securityKeyChallengeResponse.rp.id,
          allowCredentials: securityKeyChallengeResponse.allowedCredentials,
        },
      });

      const securityKeyCredential = await get(options);
      const securityKeyCredentialJson = securityKeyCredential.toJSON();
lgarron commented 8 months ago

I'd suggest making sure that:

(I can't offer useful advice for targeting anything other than ESM.)

bharath154 commented 8 months ago

Cool. Thanks. For now will live with a patch to this file. Once we do upgrade we may not need this patch. Thanks for your help! 🙇