Verifying a disclosure
A verifier needs one import. Not the SDK, not a Midnight client, not us.
import { verifyDisclosure } from '@nokto-protocol/sdk/verify';
const result = await verifyDisclosure(
proof,
{
verifierId: MY_ID,
challenge, // issued by you, for this request
threshold: 100_000n,
minTier: 1,
periodStart: 0n,
periodEnd: 9_999_999_999n,
},
checkPlonkProof,
);
if (result.ok) {
// The predicate holds. You know nothing else, by construction.
}
The claim is checked against what you asked for before the proof is checked at all — a cryptographically valid proof of a different statement is the dangerous case, because it looks like success.
What you are checking, and why each field is there
verifierId— the claim must name you as the intended recipient. A proof addressed to a different verifier is refused before the proof itself is checked.challenge— nothing is written on chain when a disclosure is made, so freshness has to come from somewhere. You issue the challenge; a proof that answers an old challenge, or someone else's, is refused.thresholdandminTier— the exact predicate you asked about. AminTiermismatch is rejected in either direction: a proof at a weaker tier than you asked for is obviously unacceptable, and one at a stronger tier is also refused, because silently accepting it would mean your records say you checked something you did not.periodStart/periodEnd— the window the aggregate must sit inside, so income from outside the period you asked about cannot be counted.
See Assurance tiers for what a minTier
value means, and Predicates for what
discloseIncomeAtLeast actually proves.
Building any of this yourself, rather than pasting the snippet above, requires building from source — the packages are not published.