Class RecoveryCodes
java.lang.Object
com.irurueta.authserver.authorization.application.totp.RecoveryCodes
Creates recovery codes (Crockford base-32 alphabet, so no
I, L, O or U) and
normalizes what a user types back into that form.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringCrockford's base-32 alphabet.static final intNumber of characters of a code.private final SecureRandomSource of randomness. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
CODE_LENGTH
public static final int CODE_LENGTHNumber of characters of a code.- See Also:
-
ALPHABET
Crockford's base-32 alphabet.- See Also:
-
random
Source of randomness.
-
-
Constructor Details
-
RecoveryCodes
public RecoveryCodes()
-
-
Method Details
-
newCode
Creates a new random code.- Returns:
- the code,
CODE_LENGTHcharacters long.
-
normalize
Normalizes a typed code: upper case, without separators, and with the look-alike letters Crockford maps (Oto0,IandLto1).- Parameters:
typed- the code as typed.- Returns:
- the canonical form.
-