RSA public key to define a group in which we will work. The key is an integer n = p*q with p, q primes number. The group we work in is the set of inversible mod n.
Tuple of the RSA group comprising the locked and unlocked values as well as (Wesolowski) proof that the unlocked value indeed correspond to the locked one.
Function taking as input an rsa_public, a time and three strings representing a locked and unlocked value as well as a wesolowski proof and returning Some vdf_tuple if the elements are in the RSA group with rsa_public as modulus and the Wesolowski proof verifies, None otherwise.
Generates almost uniformly an integer mod n. It is in the RSA group with overwhelming probability. We use this since we want to lock symmetric keys, not pre-determined messages.
Precomputes a vdf_tuple given a time:int and optionally locked_value. If precompute_path is given, it will instead read vdf_tuple locally and if not found, will write the newly computed vdf_tuple there.
Receives a claim opening with a proof and potentially secret. If the proof is valid hashes the opening using unlocked_value_to_symmetric_key, returns None otherwise.
Result of the opening of a chest. The opening can fail in two ways which we distinguish to blame the right party. One can provide a false unlocked_value or unlocked_proof, in which case we return Bogus_opening and the provider of the chest key is at fault. Otherwise we return Correct payload where payload is the content that had originally been put in the chest.
High level function which given a payload, time and optionally a precomputed_path, generates a chest and chest_key. The payload corresponds to the message to timelock while the time corresponds to the difficulty in opening the chest. Beware, it does not correspond to a duration per se but to the number of iteration needed. The optional precomputed_path is a local path where to read or write some auxiliary information to generate the chest quickly.