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

Use TOTP token with display #609

Closed
AFUman opened this issue May 7, 2024 · 2 comments
Closed

Use TOTP token with display #609

AFUman opened this issue May 7, 2024 · 2 comments
Labels
Enhancement TOTP Time-based One-time Passwords

Comments

@AFUman
Copy link

AFUman commented May 7, 2024

Is your enhancement related to a problem? Please describe.

Hello,
I would like to use 2FA with a hardware TOTP token. Is there a way to enter a predefined seed instead of having one generated?

Greetings
Chris

Proposed Solution

No response

Designs

No response

Describe alternatives you've considered

No response

Please confirm that you have searched existing issues in this repository.

Yes

@dd32 dd32 added Enhancement TOTP Time-based One-time Passwords labels May 7, 2024
@dd32
Copy link
Member

dd32 commented May 7, 2024

Is there a way to enter a predefined seed instead of having one generated?

No, That is not currently supported by the plugin.

Hardware tokens would normally use WebAuthN instead of TOTP however, such as via #427 or https://wordpress.org/plugins/two-factor-provider-webauthn/

(Edit: Just noting, Hardware keys which provide a TOTP seed do exist, and supporting it would technically be feasible, I'm unsure if the plugin would wish to support that however.)

@kasparsd
Copy link
Collaborator

It seems that no other service provider currently allows you to specify the secret.

Technically, this would require some JS work to allow a user override for the generated secret that gets sent during the setup:

var key = $('#two-factor-totp-key').val(),

and we should also ensure that it doesn't contain invalid characters per:

/**
* Check if the TOTP secret key has a proper format.
*
* @param string $key TOTP secret key.
*
* @return boolean
*/
public function is_valid_key( $key ) {
$check = sprintf( '/^[%s]+$/', self::$base_32_chars );
if ( 1 === preg_match( $check, $key ) ) {
return true;
}
return false;
}

Practically, you can currently use the browser inspector to replace the value of the hidden two-factor-totp-key field and it will store that secret instead.

I recommend we don't implement this as the built-in functionality for this plugin.

@kasparsd kasparsd closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement TOTP Time-based One-time Passwords
Projects
None yet
Development

No branches or pull requests

3 participants