You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
other web5 sdks implementations end up being 6-7 nested loops for selectCredentials I think we can reduce this to worst case 2 nested loops (necessarily 2 because field.paths in an array):
{
"constraints": {
"fields": [{
"paths": [".*"],
"filter": /* the entire json schema for the VC */
}]
}
}
single field whose only path is equivalent to the entire object. then just use json schema 100% to validate whether the vcjwt satisfies the json schema provided 😄
other web5 sdks implementations end up being 6-7 nested loops for
selectCredentials
I think we can reduce this to worst case 2 nested loops (necessarily 2 becausefield.paths
in an array):two approaches come to mind:
Approach 1
[]FieldToken fieldTokens
constraints.fields
. For each field:field.paths
:FieldToken fieldToken
withtoken
andpath
fieldToken
tofieldTokens
filter
, add the filter as a property to the json schema. Usetoken
as the property nameWe’re now done constructing VC Selector. Time to build selection candidates:
map[string]any selectionCandidate
map[string]bool tokensFound
map[string]bool tokens
fieldTokens
:field.token
is intokens
. if it is not, add it.field.token
is intokensFound
. If it not:field.path
within decoded vcJwt. If the path is found:selectionCandidate
withfield.token
as the keyfield.token
totokensFound
len(tokens) == len(tokensFound)
. if it is not, the vcJwt does not fulfill the constraints. bailApproach 2
map[string]FieldToken fieldTokens
constraints.fields
. For eachfield
:token
,field.paths
) tofieldTokens
We’re now done constructing VC selector. Time to build selection candidates:
map[string]any selectionCandidate
fieldTokens
, for eachfieldToken
:value any
fieldToken.paths
, for eachpath
:path
within decoded vcJwt. if it is found,value
to the value at that pathselectionCandidate[fieldToken.Token]
tovalue
selectionCandidate
against the json schema. if it is not valid, the vcJwt does not fulfill the constraints.The text was updated successfully, but these errors were encountered: