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

Incorrect passkey key length #91

Open
cpb8010 opened this issue Oct 11, 2024 · 3 comments
Open

Incorrect passkey key length #91

cpb8010 opened this issue Oct 11, 2024 · 3 comments
Assignees
Labels
bug Something isn't working project: contracts

Comments

@cpb8010
Copy link
Contributor

cpb8010 commented Oct 11, 2024

The most likely cause of this is based on the difference between the js webauthn crypto functions and the implementation in solidity. The solidity interface is fixed length and can likely handle left padded zeros on randomly generated keys. The JavaScript version is not set up for zero padding. The function we have to extract keys will remove the padding.

This is likely causing problems with solidity functioning.

@cpb8010 cpb8010 self-assigned this Oct 11, 2024
@cpb8010 cpb8010 added the bug Something isn't working label Oct 11, 2024
@cpb8010
Copy link
Contributor Author

cpb8010 commented Oct 11, 2024

I tried removing the isLeadingZero key length check and it instantly fails the existing tests, so I no longer think that's the culprit here. I'm going to try running the tests many times in a row to see if I can capture the exact bad signature. I was able to replicate this once with my local embedded-wallet-test setup, but at the time I thought it was an human introduced error since I was copying challenge and signature data back and forth via copy & paste.

@cpb8010
Copy link
Contributor Author

cpb8010 commented Oct 24, 2024

credentialPublicKey
: 
"[165,1,2,3,38,32,1,33,88,32,152,25,160,102,196,254,56,9,223,43,70,154,156,55,45,227,23,201,255,149,64,210,201,226,206,216,78,20,157,93,195,6,34,88,32,80,53,188,94,51,107,25,146,10,162,183,211,227,218,251,159,60,47,248,214,1,149,215,252,85,42,88,161,151,157,250,148]"

@MexicanAce
Copy link
Contributor

Here's another example key with this error from the e2e tests:

{
  credentials: [
    {
      credentialId: 'N2MR0gtVcKsvcgI5EEOthwFgf7RNcvuMxoVY7+j/R9k=',
      isResidentCredential: true,
      rpId: 'localhost',
      privateKey: 'MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgs3dWcC7QZPwdY7j6HbsLG9VlFuqc8YP2UfFBp8fsjI6hRANCAAReIN82Gk4EkVDLdFnTjXH86Gu91zOTwGNur3iEqOZ/xz8Yv7O58OTUvdS9hDRQeIgnyy9lZnNLjBVVikTagI94',
      userHandle: 'Mcs77cTuzSBMbm1QX54jORfSi2RHm0HW4ZhVaJX2CHU=',
      signCount: 1,
      backupEligibility: false,
      backupState: false
    }
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working project: contracts
Projects
None yet
Development

No branches or pull requests

2 participants