def generate_verifier_code(self): mapped = map(lambda x: self.rnd.getrandbits(8), range(32)) encoded = b64encode(bytes(mapped)) verifier = encoded.decode().replace("=", "") hash = SHA256Hash.new(self) hash.update(verifier.encode("utf-8")) digest = b64encode(hash.digest()) challenge = digest.decode().replace("=", "") return {"verifier": verifier, "challenge": challenge}
def signable_hash(self) -> SHA256Hash: return SHA256Hash.new( b64encode( self.__delimiter.join(self.signable_data).encode('latin1')))