-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement PEX #52
Labels
Comments
also here's a cheeky way to use PD
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 😄 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: