Skip to content

Conversation

@modelrailroader
Copy link
Contributor

Hey,
your documentation to create a new object of the TwoFactorAuth class is wrong.
A single string like "sha1" is not enough; expected is an argument of Algorithm.

Copy link
Collaborator

@willpower232 willpower232 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an excellent observation however technically one doesn't need to specify the other arguments now the minimum supported version of PHP is greater than 8 so this example could be $tfa = new TwoFactorAuth(qrcodeprovider: $qrCodeProvider);

That said, the documentation about algorithm at docs/optional-configuration.md is definitely out of date.

@modelrailroader
Copy link
Contributor Author

Sorry, I really forget this.
Do you think like this? I'm not so familiar with PHP 8 and all the changes yet...

@willpower232
Copy link
Collaborator

In this case it makes sense as I can imagine a significant number of users would just want to specify the name of the application and a QR code provider, unless one is developing for a specific hardware token or custom application then the default SHA1 should suffice which thanks to PHP 8 means you don't need to specify most of the constructor arguments.

Are you going to edit docs/optional-configuration.md as well?

@modelrailroader
Copy link
Contributor Author

modelrailroader commented Jun 11, 2023

Done.

In this case it makes sense as I can imagine a significant number of users would just want to specify the name of the application and a QR code provider

But wouldn't it then not making more sense to change the position of the CodeProvider, so that the time when a code gets unvalid and the number of digits don't have to specified when defining the class?

Like this:
$tfa = new TwoFactorAuth(null, YourChosenProvider: $qrCodeProvider, 6, 30, Algorithm::Sha1);

@willpower232

Copy link
Collaborator

@willpower232 willpower232 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately hindsight is 20:20 as they say, the construct method signature could have been made in a slightly more efficient way but that doesn't really matter any more thanks to newer PHP versions.

Also changing it would constitute a major breaking change for unsuspecting users so its better left as is for now.

Github won't let me suggest what the final wording should be but I think it should be this

image

@modelrailroader
Copy link
Contributor Author

I have done this now, like you proposed.

Additionally, I fixed the hyperlinks for the documentation about the different online and offline providers. All hyperlinks had the file extension ".html", but it is ".md". ;-)

@modelrailroader
Copy link
Contributor Author

You're right! Changed it.

@willpower232 willpower232 merged commit 9476751 into RobThree:master Jul 29, 2023
@willpower232
Copy link
Collaborator

apologies for the delay! I wanted to do this at a time I could watch the build to make sure the docs website still works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants