Skip to content
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

Presentation Exchange: support for json schema filtering and relational constraints #351

Merged
merged 5 commits into from
Apr 13, 2023

Conversation

decentralgabe
Copy link
Member

@decentralgabe decentralgabe commented Apr 13, 2023

fixes #350, #165, and partially #64

@decentralgabe decentralgabe self-assigned this Apr 13, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 13, 2023

Codecov Report

Merging #351 (0e698b4) into main (82a731c) will increase coverage by 0.07%.
The diff coverage is 51.32%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #351      +/-   ##
==========================================
+ Coverage   57.31%   57.38%   +0.07%     
==========================================
  Files          51       51              
  Lines        6339     6410      +71     
==========================================
+ Hits         3633     3678      +45     
- Misses       2017     2032      +15     
- Partials      689      700      +11     
Impacted Files Coverage Δ
credential/util/util.go 37.50% <37.29%> (+7.95%) ⬆️
credential/exchange/model.go 38.12% <50.00%> (+0.46%) ⬆️
credential/manifest/validation.go 65.75% <50.00%> (+1.94%) ⬆️
credential/signing/jwt.go 35.58% <57.14%> (+5.23%) ⬆️
credential/exchange/request.go 42.31% <60.00%> (ø)
credential/exchange/verification.go 52.99% <61.36%> (+0.61%) ⬆️
credential/exchange/submission.go 73.04% <72.73%> (-1.33%) ⬇️

@decentralgabe decentralgabe marked this pull request as ready for review April 13, 2023 01:41
@decentralgabe decentralgabe added this to the BTC Miami milestone Apr 13, 2023
// CredentialsFromInterface turn a generic cred into a known shape without maintaining the proof/signature wrapper
func CredentialsFromInterface(genericCred any) (*credential.VerifiableCredential, error) {
// ToCredential turn a generic cred into its known object model
func ToCredential(genericCred any) (*credential.VerifiableCredential, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nitro-neal refactored this method and the one below to handle jwt/json properly to fix #165

// CredentialsFromInterface turn a generic cred into a known shape without maintaining the proof/signature wrapper
func CredentialsFromInterface(genericCred any) (*credential.VerifiableCredential, error) {
// ToCredential turn a generic cred into its known object model
func ToCredential(genericCred any) (*credential.VerifiableCredential, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, almost need this as a standard for every object.

Copy link
Contributor

@nitro-neal nitro-neal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome stuff

func ClaimAsJSON(claim any) (map[string]any, error) {
switch c := claim.(type) {
// ToCredentialJSONMap turn a generic cred into a JSON object
func ToCredentialJSONMap(genericCred any) (map[string]any, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternativly we could make this private and then the master ToCredential funciton will have the signature:

func ToCredential(genericCred any) (*credential.VerifiableCredential, map[string]any, jwt.Token, error) {

One func to rule them all

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it like this at first but figured it was cleaner to have each func do a single thing

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

Successfully merging this pull request may close these issues.

Presentation Exchange: constraints
3 participants