-
Notifications
You must be signed in to change notification settings - Fork 7
matcher
Thomas Fossati edited this page Jan 18, 2024
·
1 revision
The Verifier's main function is to find patterns in Evidence that match known-good-values or known-bad-values, or some specific "state" that can be associated with metadata related to the Attester (i.e., CoRIM's endorsed values).
To "pattern match" Evidence, the Verifier needs:
- A way to identify which Evidence claim needs to be matched
- The comparison logic to be used in matching
- The value(s) to compare against
It makes sense to encapsulate all that into a basic matcher object that can become a building block of higher-level constructs.
Given the variability of Evidence, such matcher needs to be assisted by an "attestation scheme"-specific function that identifies the claim in the Evidence Claims-Set that this matcher is describing.
matcher = [
cmp: cmp
values: values
]
claim-id = text / int
cmp = "in-set" ; any
/ "in-range" ; sortable types
/ "masked" ; bytes
/ "regexp" ; text
values = [ + any ]
ref-value = [
+ matcher
]
end-value = [
+ matcher ; condition
values ; endorsed-values
]
def match(ClaimsSet, RV, CTX)
for rv in RV:
tbcClaim = CTX.profile.claim_lookup(ClaimsSet, rv.cid)
if not rv.cmp(tbcClaim, rv.vals):
return false
return true
Single matcher, infinite combinations:
{
"rim": {
"cmp": "in-set",
"values": [
"3q0=",
"vq8="
]
},
"rem": {
"cmp": "in-set",
"values": [
[ "3q0=", "vq8=", "AAA=", "AAA=" ],
[ "AAA=", "AAA=", "AAA=", "AAA=" ]
]
},
"perso": {
"cmp": "regexp",
"values": [
"^coco-*$"
]
}
}
{
"svn": {
"cmp": "in-range",
"values": [
{ "min": 0, "max": 10 }
]
}
}
{
"raw-value": {
"cmp": "masked",
"values": [
{
"bytes": "AAE=",
"mask": "AQE="
}
]
}
}
{
"rim": "3q0=",
"rem": [ "AAA=", "AAA=", "AAA=", "AAA=" ]
}
rv = { + claim-id => matcher }