Concepts

The threshold OPRF

How a credential becomes the person secret s without any node seeing who asked.

An oblivious pseudorandom function (OPRF, standardized for prime-order groups in RFC 9497) lets a device get the output of a keyed function on its input without the key holder seeing the input, and without the device learning the key. Once uses one to turn a person's HashID into the person secret s: the same HashID always gives the same s, nobody can compute s from HashID without the key, and no node sees HashID.

The key is shared among 3 nodes so that no one node holds it. 2 of 3 nodes answer each request.

The key and its shares

The OPRF key is a scalar sk on BabyJubJub. It is split with a degree-one polynomial whose constant term is sk, evaluated at 1, 2 and 3: node i holds the share skᵢ. Any two shares rebuild sk by Lagrange interpolation, and one share alone says nothing about it.

The program's OPRF registry, the account at ["oprf"], holds the public points of the three shares K₁, K₂, K₃ (each skᵢ·G), the combined public key K = sk·G, a Poseidon digest of those eight coordinates in that order, and a version number. The admin writes it with set_oprf. After the first enrollment the combined key is fixed: a new key would change every person's s, and with it every person nullifier and every scope nullifier, so set_oprf refuses it with StaleOprfKey. The shares can be refreshed under the same combined key, which raises the version, and enroll accepts only the current version.

Hashing to the curve

The device first maps HashID to a point P on BabyJubJub. It derives two field elements uⱼ = Poseidon(0x483243, HashID, j) for j = 0, 1, maps each to the curve with Elligator 2, adds the two points and multiplies by the cofactor 8.

The mapping has to hide the discrete logarithm of P. If P were h·G for a value h anyone can compute, such as Poseidon(HashID), then sk·P would equal h·K, which anyone could compute from the public key, and the OPRF would protect nothing.

Asking the nodes

  1. Blind

    The device draws a random nonzero scalar r and computes the blinded query B = r·P. B is a uniformly random point to anyone who doesn't know r.

  2. Prove the query

    With the authorize circuit the device proves that B was made from the HashID of a credential, that the credential's signature verifies under the issuer key, and that it was issued to the holder key. The public signals are B, the issuer key, the holder key and the credential's valid-until time.

  3. Sign the request

    For each node the device signs Poseidon(0x4f505246524551, nodeIndex, Bx, By, timestamp) with the holder key. A copied credential file is not enough to ask the nodes: the request also needs the holder's private key, which never leaves the device.

  4. Evaluate

    Each node checks the proof, that the issuer key is trusted, that the credential has not expired, that the timestamp is fresh and that the holder signature verifies. It then answers with Zᵢ = skᵢ·B and a DLEQ proof, in Chaum–Pedersen form, that the same skᵢ links G to Kᵢ and B to Zᵢ: with a fresh nonce w, T₁ = w·G, T₂ = w·B, a challenge c from the low 248 bits of Poseidon(0x444c4551, i, Kᵢ, B, Zᵢ, T₁, T₂), and the response v = w + c·skᵢ.

  5. Combine and unblind

    The device verifies both proofs against the registry, interpolates the two answers into Z = sk·B, and removes the blinding: Q = r⁻¹·Z = sk·P. The person secret is s = Poseidon(Qx, Qy).

What the enrollment proof checks again

The device could lie about the answers it got, so the enroll circuit repeats the whole check over the transcript: that both answers carry valid proofs under two distinct registered shares, that the four registry points lie on one degree-one polynomial, that every point is in the prime-order subgroup, and that r·Q interpolates correctly from the two answers. The proof also commits to the registry digest, and enroll compares it with the digest in the registry account.

Domain tags

Each Poseidon hash that could otherwise collide with another carries a tag in its first input:

TagASCIIUsed in
0x483243H2CHashing HashID to the curve
0x4f505246524551OPRFREQThe holder's signed request to a node
0x444c4551DLEQEach node's Chaum–Pedersen challenge
2^128 + 0x504552534f4ePERSONThe person nullifier N

Each node answers on its own POST /v1/evaluate, and the API forwards POST /v1/oprf/{nodeId}/evaluate to node nodeId. Run an OPRF node covers operating one.