def update(self, param, reset_failcount=True): """ update - process initialization parameters :param param: dict of initialization parameters :type param: dict :return: nothing """ if self.hKeyRequired is True: genkey = is_true(getParam(param, "genkey", optional)) if not param.get('keysize'): param['keysize'] = 16 if genkey: otpKey = generate_otpkey(param['keysize']) del param['genkey'] else: # genkey not set: check otpkey is given # this will raise an exception if otpkey is not present otpKey = getParam(param, "otpkey", required) param['otpkey'] = otpKey # motp token specific mOTPPin = getParam(param, "motppin", required) self.token.set_user_pin(mOTPPin) TokenClass.update(self, param, reset_failcount) return
def get_init_detail(self, params=None, user=None): """ At the end of the initialization we return the URL for the TiQR App. """ response_detail = TokenClass.get_init_detail(self, params, user) params = params or {} enroll_url = get_from_config("tiqr.regServer") log.info("using tiqr.regServer for enrollment: {0!s}".format(enroll_url)) serial = self.token.serial session = generate_otpkey() # save the session in the token self.add_tokeninfo("session", session) tiqrenroll = "tiqrenroll://{0!s}?action={1!s}&session={2!s}&serial={3!s}".format( enroll_url, API_ACTIONS.METADATA, session, serial) response_detail["tiqrenroll"] = {"description": _("URL for TiQR " "enrollment"), "value": tiqrenroll, "img": create_img(tiqrenroll, width=250)} return response_detail