src/eric7/WebBrowser/WebAuth/Fido2Management.py

branch
eric7
changeset 10859
399d19fc7eb5
parent 10858
8a03d5f6146c
child 10863
88c6e062aa76
equal deleted inserted replaced
10858:8a03d5f6146c 10859:399d19fc7eb5
167 } 167 }
168 168
169 # PIN related data 169 # PIN related data
170 if self.__ctap2.info.options["clientPin"]: 170 if self.__ctap2.info.options["clientPin"]:
171 msg1 = ( 171 msg1 = (
172 self.tr( 172 self.tr("PIN is disabled and must be changed before it can be used!")
173 "PIN is disabled and must be changed before it can be used!"
174 )
175 if self.__ctap2.info.force_pin_change 173 if self.__ctap2.info.force_pin_change
176 else "" 174 else ""
177 ) 175 )
178 pinRetries, powerCycle = self.getPinRetries() 176 pinRetries, powerCycle = self.getPinRetries()
179 if pinRetries: 177 if pinRetries:
867 865
868 def forcePinChangeSupported(self): 866 def forcePinChangeSupported(self):
869 """ 867 """
870 Public method to check, if the 'forcePinChange' function is supported by the 868 Public method to check, if the 'forcePinChange' function is supported by the
871 selected security key. 869 selected security key.
872 870
873 @return flag indicating support 871 @return flag indicating support
874 @rtype bool 872 @rtype bool
875 """ 873 """
876 if ( 874 return not (
877 self.__ctap2 is None 875 self.__ctap2 is None
878 or self.__ctap2.info is None 876 or self.__ctap2.info is None
879 or not self.__ctap2.info.options.get("setMinPINLength") 877 or not self.__ctap2.info.options.get("setMinPINLength")
880 ): 878 )
881 return False
882 else:
883 return True
884 879
885 def forcePinChange(self, pin): 880 def forcePinChange(self, pin):
886 """ 881 """
887 Public method to force the PIN to be changed to a new value before use. 882 Public method to force the PIN to be changed to a new value before use.
888 883
898 Public method to check, if the 'setMinPINLength' function is available. 893 Public method to check, if the 'setMinPINLength' function is available.
899 894
900 @return flag indicating availability 895 @return flag indicating availability
901 @rtype bool 896 @rtype bool
902 """ 897 """
903 if ( 898 return not (
904 self.__ctap2 is None 899 self.__ctap2 is None
905 or self.__ctap2.info is None 900 or self.__ctap2.info is None
906 or not self.__ctap2.info.options.get("setMinPINLength") 901 or not self.__ctap2.info.options.get("setMinPINLength")
907 or ( 902 or (
908 self.__ctap2.info.options.get("alwaysUv") 903 self.__ctap2.info.options.get("alwaysUv")
909 and not self.__ctap2.info.options.get("clientPin") 904 and not self.__ctap2.info.options.get("clientPin")
910 ) 905 )
911 ): 906 )
912 return False
913 else:
914 return True
915 907
916 def setMinimumPinLength(self, pin, minLength): 908 def setMinimumPinLength(self, pin, minLength):
917 """ 909 """
918 Public method to set the minimum PIN length. 910 Public method to set the minimum PIN length.
919 911
920 @param pin PIN to unlock the connected security key 912 @param pin PIN to unlock the connected security key
921 @type str 913 @type str
922 @param minLength minimum PIN length 914 @param minLength minimum PIN length
923 @type int 915 @type int
916 @exception Fido2PinError raised to indicate an issue with the PIN length
924 """ 917 """
925 if minLength < 4 or minLength > 63: 918 if minLength < 4 or minLength > 63:
926 raise Fido2PinError( 919 raise Fido2PinError(
927 self.tr("The minimum PIN length must be between 4 and 63.") 920 self.tr("The minimum PIN length must be between 4 and 63.")
928 ) 921 )
942 Public method to check, if the 'toggleAlwaysUv' function is available. 935 Public method to check, if the 'toggleAlwaysUv' function is available.
943 936
944 @return flag indicating availability 937 @return flag indicating availability
945 @rtype bool 938 @rtype bool
946 """ 939 """
947 if ( 940 return not (
948 self.__ctap2 is None 941 self.__ctap2 is None
949 or self.__ctap2.info is None 942 or self.__ctap2.info is None
950 or "alwaysUv" not in self.__ctap2.info.options 943 or "alwaysUv" not in self.__ctap2.info.options
951 ): 944 )
952 return False
953 else:
954 return True
955 945
956 def getAlwaysUv(self): 946 def getAlwaysUv(self):
957 """ 947 """
958 Public method to get the value of the 'alwaysUv' flag of the current security 948 Public method to get the value of the 'alwaysUv' flag of the current security
959 key. 949 key.
950
951 @return return value of the 'alwaysUv' flag
952 @rtype bool
960 """ 953 """
961 if self.__ctap2 is None: 954 if self.__ctap2 is None:
962 return False 955 return False
963 956
964 info = self.__ctap2.get_info() 957 info = self.__ctap2.get_info()

eric ide

mercurial