public boolean verify ( String otp ) { long code = Long . parseLong ( otp ) ; long currentInterval = clock . getCurrentInterval ( ) ; int pastResponse = Math . max ( DELAY_WINDOW , 0 ) ; for ( int i = pastResponse ; i >= 0 ; -- i ) { int candidate = generate ( this . secret , currentInterval - i ) ; if ( candidate == code ) { return true ; } } return false ; }
Verifier - To be used only on the server side