Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

84 update base64url encoding #106

Merged
merged 2 commits into from
Oct 2, 2023
Merged

Conversation

JohnGuilding
Copy link
Contributor

@JohnGuilding JohnGuilding commented Sep 29, 2023

This PR:

  1. Updates the base64url library used in the primitives project based on recent changes to the FCL lib
  2. Updates some misleading and incorrect forge tests. They were misleading as they indicated the function under test could validate an incremented nonce. This sort of check is managed by the entry point so we do not need to test such scenarios. Additionally, the nonce increment syntax was wrong as it incremented the nonce after the assertion, not before which was the intended behaviour (pointed out by @jzaki).

What are the changes to the base64url library?

If interested in the details, see the following closed PR into the FCL lib. The TLDR is that the base64url library got updated to be more in-line with the webauthn spec. You can verify the changes made in this PR by comparing Base64Url.sol to the FCL Base64Url.sol file

The webauthn standard specifies that base64url encoding should be used for encoding the client challenge. All trailing '=' characters should also be removed - from the spec:

challenge, of type DOMString
This member contains the base64url encoding of the challenge provided by the Relying Party. See the § 13.4.3 Cryptographic Challenges security consideration.

Base64url encoding
The term Base64url Encoding refers to the base64 encoding using the URL- and filename-safe character set defined in Section 5 of [RFC4648], with all trailing '=' characters omitted (as permitted by Section 3.2) and without the inclusion of any line breaks, whitespace, or other additional characters.

@JohnGuilding JohnGuilding linked an issue Sep 29, 2023 that may be closed by this pull request
@JohnGuilding JohnGuilding marked this pull request as ready for review September 29, 2023 17:48
Base automatically changed from 55-move-low-level-webauthn-logic-to-primitives-directory to main September 29, 2023 17:49
@JohnGuilding JohnGuilding linked an issue Oct 2, 2023 that may be closed by this pull request
@JohnGuilding JohnGuilding force-pushed the 84-update-base64url-encoding branch from fa12553 to f19ebfb Compare October 2, 2023 12:13
@JohnGuilding JohnGuilding merged commit f0caa4e into main Oct 2, 2023
@JohnGuilding JohnGuilding deleted the 84-update-base64url-encoding branch October 2, 2023 12:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate whether we need to use base64url encoding in FCL lib
2 participants