code: def validate_yubikey_otp_short(self, params):
      
      from_key = params["otp"][0]
      if not re.match(ykotp_valid_input, from_key):
          self.log_error("IN: %s, Invalid OTP" % (from_key))
          return "ERR Invalid OTP"
      try:
          res = pyhsm.yubikey.validate_otp(hsm, from_key)
          return "OK counter=%04x low=%04x high=%02x use=%02x" % \
              (res.use_ctr, res.ts_low, res.ts_high, res.session_ctr)
      except pyhsm.exception.YHSM_CommandFailed, e:
          return "ERR %s" % (pyhsm.defines.status2str(e.status))
docs: Validate YubiKey OTP using YubiHSM internal database.