Package dev.vink.jtotp
Class OtpUtils
java.lang.Object
dev.vink.jtotp.OtpUtils
Utility class for generating OTP (One-Time Password) URLs.
This class provides methods to create OTP URLs following the Key URI Format.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic String
Key for the algorithm parameter in the OTP URL.static String
Key for the digits parameter in the OTP URL.static String
Key for the issuer parameter in the OTP URL.static String
Key for the period parameter in the OTP URL.static String
Key for the shared secret parameter in the OTP URL. -
Method Summary
-
Field Details
-
SECRET
Key for the shared secret parameter in the OTP URL. -
ISSUER
Key for the issuer parameter in the OTP URL. -
ALGORITHM
Key for the algorithm parameter in the OTP URL. -
PERIOD
Key for the period parameter in the OTP URL. -
DIGITS
Key for the digits parameter in the OTP URL.
-
-
Method Details
-
createOtpUrl
Creates an OTP URL based on the specified type, label, and parameters.- Parameters:
type
- The type of OTP (e.g., currently "totp" is supported).label
- The label for the OTP, typically in the format "Issuer:AccountName".params
- A map of key-value pairs representing additional parameters for the OTP URL.- Returns:
- A string representing the complete OTP URL.
- Throws:
RuntimeException
- If UTF-8 encoding is not supported.NullPointerException
- If params provided is null.
-