Skip to content

Commit

Permalink
feat: pass all
Browse files Browse the repository at this point in the history
  • Loading branch information
skynet2 committed Oct 31, 2024
1 parent 7467272 commit d100358
Show file tree
Hide file tree
Showing 31 changed files with 680 additions and 238 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ALPINE_IMAGE ?=alpine
OPENSSL_IMAGE ?=frapsoft/openssl
GOPROXY ?= https://proxy.golang.org

VC_FRAMEWORK_VERSION = 882ca910f0916f8da048532c0c9d0b9bc51f61eb
VC_FRAMEWORK_VERSION = 6b058672fb8436bb910b2d3857edad0800ab48f3
KMS_FRAMEWORK_VERSION = 8d9510c6bb88df0666fa45c55c0ace699a675b12
DID_GO_VERSION = 014935534038f28666c4b61b16c2059be9423c33
SIDE_TREE_VERSION = f4260aff710479ba5fa3f0c61b51d451d9041225
Expand Down
219 changes: 110 additions & 109 deletions api/spec/openapi.gen.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/vc-rest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/trustbloc/did-go v1.3.1-0.20241028131019-014935534038
github.com/trustbloc/logutil-go v1.0.0
github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84
github.com/trustbloc/vcs v0.0.0
github.com/trustbloc/vcs/component/credentialstatus v0.0.0-00010101000000-000000000000
github.com/trustbloc/vcs/component/echo v0.0.0-00010101000000-000000000000
Expand Down
4 changes: 2 additions & 2 deletions cmd/vc-rest/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,8 @@ github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYtt
github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc=
github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 h1:0IW4muaGvhjJ4OkG6/PQG3DGf5POWxlA1wwEYsxWQ+4=
github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104/go.mod h1:3yChjB5KOT7B9eZe0W1XaIx3MNUuC1Oe9nR/GCtI1W0=
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091 h1:xM6WbckFTPjeb2gGzCm2pJAOnVHRkrgz+wOXxukgQg4=
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091/go.mod h1:P8hpnwkdxWAlbqL8QiKiGjQImuLUPGscCoyGqz9RS/Q=
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84 h1:JXk/NNoknrSkai40NSGWUj5r/AreVVveRa43S1ZlblI=
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84/go.mod h1:3/GbrzF7phN+SxBTZaUBS6VxnoxpXGBUjjk3Eg4ImUk=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
Expand Down
2 changes: 1 addition & 1 deletion component/credentialstatus/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88
github.com/trustbloc/logutil-go v1.0.0
github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84
github.com/trustbloc/vcs v0.0.0-00010101000000-000000000000
)

Expand Down
4 changes: 2 additions & 2 deletions component/credentialstatus/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,8 @@ github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYtt
github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc=
github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 h1:0IW4muaGvhjJ4OkG6/PQG3DGf5POWxlA1wwEYsxWQ+4=
github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104/go.mod h1:3yChjB5KOT7B9eZe0W1XaIx3MNUuC1Oe9nR/GCtI1W0=
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091 h1:xM6WbckFTPjeb2gGzCm2pJAOnVHRkrgz+wOXxukgQg4=
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091/go.mod h1:P8hpnwkdxWAlbqL8QiKiGjQImuLUPGscCoyGqz9RS/Q=
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84 h1:JXk/NNoknrSkai40NSGWUj5r/AreVVveRa43S1ZlblI=
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84/go.mod h1:3/GbrzF7phN+SxBTZaUBS6VxnoxpXGBUjjk3Eg4ImUk=
github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc=
github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
Expand Down
2 changes: 1 addition & 1 deletion component/event/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/stretchr/testify v1.9.0
github.com/trustbloc/cmdutil-go v1.0.0
github.com/trustbloc/logutil-go v1.0.0
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84
github.com/trustbloc/vcs v0.0.0-00010101000000-000000000000
go.opentelemetry.io/otel/trace v1.29.0
)
Expand Down
4 changes: 2 additions & 2 deletions component/event/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88 h1:k3KNf9tE4TBV
github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0=
github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYttMypcE=
github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc=
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091 h1:xM6WbckFTPjeb2gGzCm2pJAOnVHRkrgz+wOXxukgQg4=
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091/go.mod h1:P8hpnwkdxWAlbqL8QiKiGjQImuLUPGscCoyGqz9RS/Q=
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84 h1:JXk/NNoknrSkai40NSGWUj5r/AreVVveRa43S1ZlblI=
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84/go.mod h1:3/GbrzF7phN+SxBTZaUBS6VxnoxpXGBUjjk3Eg4ImUk=
github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc=
github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
Expand Down
2 changes: 1 addition & 1 deletion component/profile/reader/file/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ require (
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
github.com/trustbloc/bbs-signature-go v1.0.2 // indirect
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091 // indirect
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/veraison/go-cose v1.3.0-rc.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions component/profile/reader/file/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYtt
github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc=
github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 h1:0IW4muaGvhjJ4OkG6/PQG3DGf5POWxlA1wwEYsxWQ+4=
github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104/go.mod h1:3yChjB5KOT7B9eZe0W1XaIx3MNUuC1Oe9nR/GCtI1W0=
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091 h1:xM6WbckFTPjeb2gGzCm2pJAOnVHRkrgz+wOXxukgQg4=
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091/go.mod h1:P8hpnwkdxWAlbqL8QiKiGjQImuLUPGscCoyGqz9RS/Q=
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84 h1:JXk/NNoknrSkai40NSGWUj5r/AreVVveRa43S1ZlblI=
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84/go.mod h1:3/GbrzF7phN+SxBTZaUBS6VxnoxpXGBUjjk3Eg4ImUk=
github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc=
github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
Expand Down
2 changes: 1 addition & 1 deletion component/wallet-cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88
github.com/trustbloc/logutil-go v1.0.0
github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84
github.com/trustbloc/vcs v0.0.0-00010101000000-000000000000
github.com/valyala/fastjson v1.6.4
github.com/veraison/go-cose v1.3.0-rc.1
Expand Down
4 changes: 2 additions & 2 deletions component/wallet-cli/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,8 @@ github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYtt
github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc=
github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 h1:0IW4muaGvhjJ4OkG6/PQG3DGf5POWxlA1wwEYsxWQ+4=
github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104/go.mod h1:3yChjB5KOT7B9eZe0W1XaIx3MNUuC1Oe9nR/GCtI1W0=
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091 h1:xM6WbckFTPjeb2gGzCm2pJAOnVHRkrgz+wOXxukgQg4=
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091/go.mod h1:P8hpnwkdxWAlbqL8QiKiGjQImuLUPGscCoyGqz9RS/Q=
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84 h1:JXk/NNoknrSkai40NSGWUj5r/AreVVveRa43S1ZlblI=
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84/go.mod h1:3/GbrzF7phN+SxBTZaUBS6VxnoxpXGBUjjk3Eg4ImUk=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
Expand Down
50 changes: 43 additions & 7 deletions docs/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ paths:
responses:
'302':
description: Found
headers: {}
headers: { }
content:
application/x-www-form-urlencoded:
schema:
Expand Down Expand Up @@ -835,7 +835,7 @@ paths:
description: 'String indicating that client is using an identifier not assigned by the authorization server. The only supported value "urn:ietf:params:oauth:client-id-scheme:oauth-discoverable-client" specifies "client_id" parameter in the request as an HTTPS based URL corresponding to the "client_uri". If the authorization server does not already have the metadata for the identified client, it can retrieve the metadata from client’s well-known location.'
tags:
- oidc4ci
parameters: []
parameters: [ ]
/oidc/token:
post:
summary: OIDC Token Request
Expand Down Expand Up @@ -969,7 +969,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/CredentialRequest'
parameters: []
parameters: [ ]
/oidc/batch_credential:
post:
summary: OIDC Batch Credential
Expand All @@ -992,7 +992,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/BatchCredentialRequest'
parameters: []
parameters: [ ]
/oidc/notification:
post:
summary: OIDC Notification
Expand All @@ -1014,7 +1014,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/AckRequest'
parameters: []
parameters: [ ]
components:
schemas:
HealthCheckResponse:
Expand Down Expand Up @@ -1289,7 +1289,43 @@ components:
checks:
type: array
items:
$ref: '#/components/schemas/VerifyPresentationCheckResult'
type: string
warnings:
type: array
items:
type: string
errors:
type: array
items:
type: string
verified:
type: boolean
presentation:
type: object
description: Presentation object.
presentationResult:
$ref: '#/components/schemas/PresentationResult'
credentialResults:
type: array
items:
$ref: '#/components/schemas/PresentationResult'
required:
- presentationResult
- credentialResults
- checks
- verified
PresentationResult:
title: PresentationResult
x-tags:
- verifier
type: object
description: Presentation result.
properties:
verified:
type: boolean
description: Presentation verification result.
required:
- verified
VerifyPresentationCheckResult:
title: VerifyPresentationCheckResult
x-tags:
Expand Down Expand Up @@ -2578,4 +2614,4 @@ components:
- alg_values_supported
- enc_values_supported
- encryption_required
securitySchemes: {}
securitySchemes: { }
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ require (
github.com/trustbloc/did-go v1.3.1-0.20241028131019-014935534038
github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88
github.com/trustbloc/logutil-go v1.0.0-rc1
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84
github.com/valyala/fastjson v1.6.4
github.com/veraison/go-cose v1.3.0-rc.1
github.com/xeipuuv/gojsonschema v1.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,8 @@ github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88 h1:k3KNf9tE4TBV
github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0=
github.com/trustbloc/logutil-go v1.0.0-rc1 h1:rRJbvgQfrlUfyej+mY0nuQJymGqjRW4oZEwKi544F4c=
github.com/trustbloc/logutil-go v1.0.0-rc1/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc=
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091 h1:xM6WbckFTPjeb2gGzCm2pJAOnVHRkrgz+wOXxukgQg4=
github.com/trustbloc/vc-go v1.2.1-0.20241021195658-882ca910f091/go.mod h1:P8hpnwkdxWAlbqL8QiKiGjQImuLUPGscCoyGqz9RS/Q=
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84 h1:JXk/NNoknrSkai40NSGWUj5r/AreVVveRa43S1ZlblI=
github.com/trustbloc/vc-go v1.2.1-0.20241031134218-6b058672fb84/go.mod h1:3/GbrzF7phN+SxBTZaUBS6VxnoxpXGBUjjk3Eg4ImUk=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (w *Wrapper) VerifyPresentation(
presentation *verifiable.Presentation,
opts *verifypresentation.Options,
profile *profileapi.Verifier,
) ([]verifypresentation.PresentationVerificationCheckResult, map[string][]string, error) {
) (verifypresentation.PresentationVerificationResult, map[string][]string, error) {
ctx, span := w.tracer.Start(ctx, "verifypresentation.VerifyPresentation")
defer span.End()

Expand All @@ -53,7 +53,7 @@ func (w *Wrapper) VerifyPresentation(
w.setClaimKeys(span, claimKeys)

if err != nil {
return nil, claimKeys, err
return verifypresentation.PresentationVerificationResult{}, claimKeys, err
}

return res, claimKeys, nil
Expand Down
19 changes: 17 additions & 2 deletions pkg/restapi/v1/issuer/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,22 @@ func (c *Controller) issueCredential(

// for some reason should be allowed https://w3c.github.io/vc-data-model/#status test suite
if v, ok := finalCredentials.(map[string]interface{}); ok {
contexts := v["@context"].([]interface{})
contextObj, contextObjOk := v["@context"]
if !contextObjOk {
return nil, resterr.NewValidationError(resterr.InvalidValue, "credential.@context",
errors.New("@context must be specified"))
}

contexts, contextsOk := contextObj.([]interface{})
if !contextsOk {
return nil, resterr.NewValidationError(resterr.InvalidValue, "credential.@context",
errors.New("@context must be an array"))
}

if len(contexts) == 0 {
return nil, resterr.NewValidationError(resterr.InvalidValue, "credential.@context",
errors.New("@context must be specified"))
}

// required by interop ed25519 signature suite
if len(contexts) > 0 && contexts[0].(string) == verifiable.V1ContextURI {
Expand Down Expand Up @@ -257,7 +272,7 @@ func (c *Controller) issueCredential(
}
}

if _, credSubOk := v["credential_subject"].(map[string]interface{}); !credSubOk {
if _, credSubOk := v["credentialSubject"].(map[string]interface{}); !credSubOk {
return nil, resterr.NewValidationError(resterr.InvalidValue, "credential_subject",
errors.New("credential_subject must be an object"))
}
Expand Down
48 changes: 34 additions & 14 deletions pkg/restapi/v1/verifier/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (c *Controller) PostVerifyPresentation(e echo.Context, profileID, profileVe
return err
}

if len(lo.FromPtr(resp.Checks)) > 0 {
if len(lo.FromPtr(resp.Errors)) > 0 {
return util.WriteOutputWithCode(http.StatusBadRequest, e)(resp, nil)
}

Expand Down Expand Up @@ -340,9 +340,9 @@ func (c *Controller) verifyPresentation(
return nil, resterr.NewSystemError(resterr.VerifierVerifyCredentialSvcComponent, "VerifyCredential", err)
}

logger.Debugc(ctx, "PostVerifyPresentation success")
logger.Debugc(ctx, "PostVerifyPresentation completed")

return mapVerifyPresentationChecks(verRes), nil
return mapVerifyPresentationChecks(verRes, presentation), nil
}

func (c *Controller) getDataIntegrityVerifier() (*dataintegrity.Verifier, error) {
Expand Down Expand Up @@ -1147,22 +1147,42 @@ func mapVerifyCredentialChecks(checks []verifycredential.CredentialsVerification
}

func mapVerifyPresentationChecks(
checks []verifypresentation.PresentationVerificationCheckResult) *VerifyPresentationResponse {
if len(checks) == 0 {
return &VerifyPresentationResponse{}
result verifypresentation.PresentationVerificationResult,
pres *verifiable.Presentation,
) *VerifyPresentationResponse {
final := &VerifyPresentationResponse{
Checks: nil,
Errors: nil,
PresentationResult: PresentationResult{}, // vcplayground
Warnings: nil,
}

var checkList []VerifyPresentationCheckResult
for _, check := range checks {
checkList = append(checkList, VerifyPresentationCheckResult{
Check: check.Check,
Error: check.Error,
})
var errArr []string

for _, check := range result.Checks {
final.Checks = append(final.Checks, check.Check)

if check.Error != nil {
errArr = append(errArr, check.Error.Error())
}
}

return &VerifyPresentationResponse{
Checks: &checkList,
if len(errArr) > 0 {
final.Errors = &errArr
}

final.PresentationResult.Verified = len(errArr) == 0 // vcplayeground
final.Verified = final.PresentationResult.Verified // vcplayeground

if final.PresentationResult.Verified && pres != nil {
for range pres.Credentials() {
final.CredentialResults = append(final.CredentialResults, PresentationResult{ // vcplayeground
Verified: true,
})
}
}

return final
}

func getVerifyCredentialOptions(options *VerifyCredentialOptions) *verifycredential.Options {
Expand Down
27 changes: 17 additions & 10 deletions pkg/restapi/v1/verifier/openapi.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d100358

Please sign in to comment.