(byte[] secret, String code, int tolerance)
| 123 | /// side of `now` (so a tolerance of 1 will accept the previous, current |
| 124 | /// and next code). |
| 125 | public static boolean verifyTotp(byte[] secret, String code, int tolerance) { |
| 126 | return verifyTotp(secret, code, tolerance, |
| 127 | System.currentTimeMillis(), 30, 6, Hash.SHA1); |
| 128 | } |
| 129 | |
| 130 | /// Builds the canonical `otpauth://totp/...` URI that authenticator apps |
| 131 | /// (Google Authenticator, Microsoft Authenticator, 1Password, Authy, ...) |