Created
August 30, 2025 10:01
-
-
Save adamstallard/2244f6b4c4aa80ddb59d0966bbc460d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the
verificationstring created here can be supplied to the query string of the/verificationsendpoint to get a signed verification if the Aura subject level in the BrightID domain is greater than or equal to1.