TryToggleAlwaysUv Method
TryToggleAlwaysUv()
Try to toggle the YubiKey's "alwaysUv" option (set to false
if
currently true
or set to true
if currently
false
. If the YubiKey selected does not support the "alwaysUv"
option, this method will return false
.
public bool TryToggleAlwaysUv()
Returns
A boolean, true
if the YubiKey was able to toggle the
"alwaysUv" and "makeCredUvNotReqd" options, false
if the
YubiKey does not support this feature.
Exceptions
Type | Condition |
---|---|
Ctap2DataException | The YubiKey could not perform the operation, even though the always UV toggle feature is supported. |
Remarks
See the FIDO2 standard, section 7.2, for a discussion of the always UV feature.
It is possible to toggle the feature only if the "alwaysUv" option is
present on the YubiKey. If the "alwaysUv" option is not present, this
method will return false
.
This method will also toggle the "makeCredUvNotReqd" option as well. This option will almost certainly be the opposite of "alwaysUv".
Before calling this method, you should check the "alwaysUv" option in
the AuthenticatorInfo. If it is already true
and
you want it true
, don't call this method.
OptionValue optionValue = fido2Session.AuthenticatorInfo.GetOptionValue(
AuthenticatorOptions.alwaysUv);
if (optionValue == OptionValue.False)
{
_ = fido2Session.TryToggleAlwaysUv();
}
The enable toggle always UV operation requires a PinUvAuthToken with permission "acfg" (Authenticator Configuration). If the "alwaysUv" option is present, this method will need the AuthToken. If the method needs an AuthToken, it will get one using the KeyCollector. If you do not want to use a KeyCollector, make sure you verify the PIN or UV with thee AuthenticatorConfiguration permission before calling this method.