Interactive fallback challenge-response for the Schnorr ZKP protocol.
When a non-interactive proof is expired or the client cannot generate one, the server can issue a challenge and verify an interactive response.
The caller is responsible for caching the challenge with a TTL (ETS, Redis, LiveView assigns, etc.) — this module is stateless.
Summary
Functions
Generates a random challenge scalar in [1, q-1].
Verifies an interactive Schnorr proof (r, c, s) against the public key y.
Functions
Generates a random challenge scalar in [1, q-1].
Uses Erlang's :crypto.strong_rand_bytes/1 for cryptographically secure
randomness.
Examples
iex> q = Snarkey.default_params().q
iex> challenge = Snarkey.Fallback.generate_challenge(q)
iex> is_integer(challenge)
true
iex> challenge > 0
true
iex> challenge < q
true
Verifies an interactive Schnorr proof (r, c, s) against the public key y.
Delegates to Snarkey.Proof.verify_interactive/7.
Returns :ok or {:error, :invalid_proof}.