Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
reinkrul committed Nov 21, 2023
1 parent 72a8fe8 commit 819874c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion vcr/pe/presentation_submission.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func resolveCredential(path []string, mapping InputDescriptorMappingObject, valu
func (s PresentationSubmission) Validate(presentations []vc.VerifiablePresentation, definition PresentationDefinition) (map[string]vc.VerifiableCredential, error) {
actualCredentials, err := s.Resolve(presentations)
if err != nil {
return nil, err
return nil, fmt.Errorf("resolve credentials from presentation submission: %w", err)
}

// Create a new presentation submission and resolve the credentials using our own copy of the Presentation Definition.
Expand Down
20 changes: 4 additions & 16 deletions vcr/pe/presentation_submission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,19 +385,6 @@ func TestPresentationSubmission_Resolve(t *testing.T) {
})
}

func credentialToJSONLD(credential vc.VerifiableCredential) vc.VerifiableCredential {
bytes, err := credential.MarshalJSON()
if err != nil {
panic(err)
}
var result vc.VerifiableCredential
err = json.Unmarshal(bytes, &result)
if err != nil {
panic(err)
}
return result
}

func TestPresentationSubmission_Validate(t *testing.T) {
vcID := ssi.MustParseURI("did:example:123#first-vc")
vp := vc.VerifiablePresentation{
Expand Down Expand Up @@ -496,7 +483,7 @@ func TestPresentationSubmission_Validate(t *testing.T) {
Path: "$[0]",
PathNested: &InputDescriptorMappingObject{
Id: "1",
Path: "$.verifiableCredential[0]",
Path: "$.verifiableCredential",
Format: "ldp_vc",
},
},
Expand All @@ -505,7 +492,7 @@ func TestPresentationSubmission_Validate(t *testing.T) {
Path: "$[0]",
PathNested: &InputDescriptorMappingObject{
Id: "2",
Path: "$.verifiableCredential[0]",
Path: "$.verifiableCredential",
Format: "ldp_vc",
},
},
Expand Down Expand Up @@ -552,6 +539,7 @@ func TestPresentationSubmission_Validate(t *testing.T) {
definition := PresentationDefinition{
SubmissionRequirements: []*SubmissionRequirement{
{
Name: "pick",
Count: &count,
From: "any",
Rule: "pick",
Expand Down Expand Up @@ -594,7 +582,7 @@ func TestPresentationSubmission_Validate(t *testing.T) {
DescriptorMap: []InputDescriptorMappingObject{
{
Id: "1", // actually maps to input descriptor 2, so should cause an error
Path: "$.verifiableCredential[0]",
Path: "$.verifiableCredential",
Format: "ldp_vc",
},
},
Expand Down

0 comments on commit 819874c

Please sign in to comment.