zk-threshold-proof
Version:
A lightweight SDK to generate and verify ZK proofs that assert a private value is greater than or equal to a threshold.
15 lines (11 loc) • 319 B
JavaScript
function dateToTimestamp(dateStr) {
return Math.floor(new Date(dateStr).getTime() / 1000);
}
async function buildWitness({ birthdate, minAge, currentDate }) {
return {
birthdate: dateToTimestamp(birthdate),
minAge,
currentDate: dateToTimestamp(currentDate),
};
}
module.exports = { buildWitness };