Initialize the ZK verifier with admin and verification key
admin - Admin address for emergency controlsverification_key - Groth16 verification key (public parameters)min_score - Minimum acceptable credit score (0-1000)fn init(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
verification_key: VerificationKey,
min_score: u32,
)
Get credit score for a user (if not expired)
Option<CreditScore> - Score if exists and not expired, None otherwisefn get_score(env: soroban_sdk::Env, user: soroban_sdk::Address) -> Option
Admin: Emergency pause
fn set_pause(env: soroban_sdk::Env, caller: soroban_sdk::Address, paused: bool)
Admin: Set minimum score threshold
fn set_min_score(env: soroban_sdk::Env, caller: soroban_sdk::Address, min_score: u32)
Check if user has valid credit score above minimum
fn is_creditworthy(env: soroban_sdk::Env, user: soroban_sdk::Address) -> bool
Admin: Update verification key (e.g., if compromised)
fn update_verification_key(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
new_key: VerificationKey,
)
Verify a ZK proof and store the credit score
user - User address claiming the credit scoreproof - Groth16 proof (alpha, beta, gamma, delta)public_inputs - Public inputs [score, timestamp, user_hash, ...]nonce - Unique nonce to prevent replay attacksbool - True if proof is valid and score storedfn verify_score_with_proof(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
score: u32,
merkle_root: MerkleRoot,
merkle_proof: soroban_sdk::Vec>,
nonce: ProofNonce,
) -> bool