rdubois-crypto / FreshCryptoLib

Cryptographic Primitives for Blockchain Systems (solidity, cairo, C and rust)
MIT License
124 stars 22 forks source link

Incorrect encoding of clientChallenge in FCL_Webauthn.sol #11

Closed evmBrahmin closed 11 months ago

evmBrahmin commented 11 months ago

Description:

Issue:

In the FCL_Webauthn.sol contract, the WebAuthn_format function currently encodes the provided clientChallenge using Base64. However, according to the updated WebAuthn specification, the challenge within the clientData should be base64url encoded. This discrepancy can lead to a mismatch when comparing the hash of the two, especially if the challenge contains URL-safe characters.

Reference:

In the WebAuthn Level 1 specification:

Potential Solution:

The encoding method used for clientChallenge in the WebAuthn_format function should be updated to use base64url without trailing = characters instead of plain base64. This would ensure that the resulting hashes are equivalent given the clientChallenge contains URL-safe characters and follows the specification precisely.

rdubois-crypto commented 11 months ago

related PR merged.