Skip to content

Instantly share code, notes, and snippets.

@adamstallard
Created August 30, 2025 10:01
Show Gist options
  • Select an option

  • Save adamstallard/2244f6b4c4aa80ddb59d0966bbc460d0 to your computer and use it in GitHub Desktop.

Select an option

Save adamstallard/2244f6b4c4aa80ddb59d0966bbc460d0 to your computer and use it in GitHub Desktop.
import { Parser as parser } from 'expr-eval';
import _ from 'lodash';
let verifications = [
{
"name": "Aura",
"user": "abc",
"block": 33340560,
"timestamp": 1756518949006,
"domains": [
{
"name": "BrightID",
"categories": [
{
"name": "subject",
"score": 82062875.08573386,
"level": 1,
"impacts": [
{
"evaluator": "def",
"level": 3,
"score": 82062875.08573386,
"confidence": 1,
"modified": 1665820000000,
"impact": 82062875.08573386
}
]
}
]
}
]
}
];
verifications = _.keyBy(verifications, (v) => v.name);
let verification =
'domainFilter(d) = d.name == "BrightID"; ' +
'categoryFilter(c) = c.name == "subject"; ' +
'domains = filter(domainFilter, Aura.domains); ' +
'categories = filter(categoryFilter, domains[0].categories); ' +
'verified = categories[0].level >= 1; ';
let verified;
let expr = parser.parse(verification);
for (let v of expr.variables()) {
if (!verifications[v]) {
verifications[v] = false;
}
}
verified = expr.evaluate(verifications);
console.log(verified)
@adamstallard
Copy link
Author

the verification string created here can be supplied to the query string of the /verifications endpoint to get a signed verification if the Aura subject level in the BrightID domain is greater than or equal to 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment