- Explanation of Mock Data Derivation:
- The response object is provided directly from the WebAuthn Authentication API call and provides several fields.
- The authenticatorDataMock is the hex representation of bytes obtained by Base64URL decoding the authenticatorData from the above response.
- The clientDataMock is derived from the clientDataJSON in the response, after Base64URL decoding and converting to hex representation of the decoded bytes.
- The challengeMock represents bytes from Base64URL decoding the clientDataJSON.
- The rsMock contains the r and s values of the signature. It's important to note that the provided signature in the response object is the Base64URL encoding of the DER encoding of the signature.
- The QMock contains the x and y values of the public key, which is generated during the registration process.
- Functions in the Test:
- test_base64URL_format: Tests the new format and provides logs to illustrate the encoding.
- test_webauthn_Base64URL_checkSignature: Validates the signature with the new encoding.
- test_webauthn_format_details: Provides logs to understand the encoding process in detail.
## Request:
Kindly review the modifications and the accompanying tests to validate their efficacy.
A thorough security audit is recommended before integrating these changes into a production environment.
Summary
FCL_Webauthn.sol
to use a base64url encoding.'='
padding from encodings.tests/WebAuthn_forge/test/FCL_Webauthn_Base64Url.t.sol
.Detailed Changes
FCL_Webauthn.sol
:'='
signsTest File:
FCL_Webauthn_Base64Url.t.sol