Skip to content

Commit

Permalink
upgrading ssi-sdk dep (#707)
Browse files Browse the repository at this point in the history
* upgrading ssi-sdk dep

* Fix problems with backwards compat.

* spec
  • Loading branch information
andresuribe87 authored Dec 4, 2023
1 parent bd260c2 commit 9e01fcc
Show file tree
Hide file tree
Showing 18 changed files with 117 additions and 80 deletions.
32 changes: 17 additions & 15 deletions doc/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
definitions:
credential.CredentialSchema:
properties:
digestSRI:
type: string
id:
type: string
type:
Expand Down Expand Up @@ -214,6 +216,20 @@ definitions:
- WebMethod
- IONMethod
- JWKMethod
did.PublicKeyPurpose:
enum:
- authentication
- assertionMethod
- capabilityInvocation
- capabilityDelegation
- keyAgreement
type: string
x-enum-varnames:
- Authentication
- AssertionMethod
- CapabilityInvocation
- CapabilityDelegation
- KeyAgreement
did.VerificationMethod:
properties:
blockchainAccountId:
Expand Down Expand Up @@ -896,25 +912,11 @@ definitions:
$ref: '#/definitions/jwx.PublicKeyJWK'
purposes:
items:
$ref: '#/definitions/ion.PublicKeyPurpose'
$ref: '#/definitions/did.PublicKeyPurpose'
type: array
type:
type: string
type: object
ion.PublicKeyPurpose:
enum:
- authentication
- assertionMethod
- capabilityInvocation
- capabilityDelegation
- keyAgreement
type: string
x-enum-varnames:
- Authentication
- AssertionMethod
- CapabilityInvocation
- CapabilityDelegation
- KeyAgreement
jwx.PublicKeyJWK:
properties:
alg:
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21

require (
github.com/BurntSushi/toml v1.3.2
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20230818212001-6e1043316e75
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20231030185053-d2001a482ff8
github.com/alicebob/miniredis/v2 v2.31.0
github.com/ardanlabs/conf v1.5.0
github.com/benbjohnson/clock v1.3.5
Expand All @@ -22,7 +22,7 @@ require (
github.com/google/uuid v1.3.1
github.com/joho/godotenv v1.5.1
github.com/lestrrat-go/jwx v1.2.26
github.com/lestrrat-go/jwx/v2 v2.0.13
github.com/lestrrat-go/jwx/v2 v2.0.15
github.com/lib/pq v1.10.9
github.com/magefile/mage v1.15.0
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
Expand Down Expand Up @@ -61,12 +61,12 @@ require (
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aws/aws-sdk-go v1.44.277 // indirect
github.com/bits-and-blooms/bitset v1.8.0 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/cloudflare/circl v1.3.6 // indirect
github.com/creasty/defaults v1.7.0 // indirect
github.com/cristalhq/jwt/v4 v4.0.2 // indirect
github.com/dave/jennifer v1.6.1 // indirect
Expand All @@ -87,7 +87,7 @@ require (
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/spec v0.20.9 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-playground/validator/v10 v10.15.0 // indirect
github.com/go-playground/validator/v10 v10.15.1 // indirect
github.com/golang/glog v1.1.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
Expand All @@ -96,7 +96,7 @@ require (
github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gowebpki/jcs v1.0.0 // indirect
github.com/gowebpki/jcs v1.0.1 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
Expand Down
31 changes: 14 additions & 17 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/DmitriyVTitov/size v1.5.0/go.mod h1:le6rNI4CoLQV1b9gzp1+3d7hMAD/uu2QcJ+aYbNgiU0=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20230818212001-6e1043316e75 h1:nUuLKpzXuJBCEzInbsypquopNW8IleHmId+Gh6l6Yu8=
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20230818212001-6e1043316e75/go.mod h1:6HfhtzYPqY/5on4tCFN54iv10td+zKiUJUptAEGHv7U=
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20231030185053-d2001a482ff8 h1:5u8nJAbahMVHtuFpyjXPAa3obai69KRTxEpsdQpeHYA=
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20231030185053-d2001a482ff8/go.mod h1:SSC6mIgP6XqXjeZ5YUZS21S7lbsetkEC0gVh9EPL2vM=
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 h1:uvdUDbHQHO85qeSydJtItA4T55Pw6BtAejd0APRJOCE=
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
Expand All @@ -64,8 +64,8 @@ github.com/aws/aws-sdk-go v1.44.277 h1:YHmyzBPARTJ7LLYV1fxbfEbQOaUh3kh52hb7nBvX3
github.com/aws/aws-sdk-go v1.44.277/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o=
github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c=
github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88=
github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/bsm/ginkgo/v2 v2.7.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w=
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
Expand Down Expand Up @@ -94,8 +94,8 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs=
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
github.com/cloudflare/circl v1.3.6 h1:/xbKIqSHbZXHwkhbrhrt2YOHIwYJlXH94E3tI/gDlUg=
github.com/cloudflare/circl v1.3.6/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand Down Expand Up @@ -183,8 +183,8 @@ github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
github.com/go-playground/validator/v10 v10.15.0 h1:nDU5XeOKtB3GEa+uB7GNYwhVKsgjAR7VgKoNB6ryXfw=
github.com/go-playground/validator/v10 v10.15.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-playground/validator/v10 v10.15.1 h1:BSe8uhN+xQ4r5guV/ywQI4gO59C2raYcGffYWZEjZzM=
github.com/go-playground/validator/v10 v10.15.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
Expand Down Expand Up @@ -271,8 +271,8 @@ github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qK
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gowebpki/jcs v1.0.0 h1:0pZtOgGetfH/L7yXb4KWcJqIyZNA43WXFyMd7ftZACw=
github.com/gowebpki/jcs v1.0.0/go.mod h1:CID1cNZ+sHp1CCpAR8mPf6QRtagFBgPJE0FCUQ6+BrI=
github.com/gowebpki/jcs v1.0.1 h1:Qjzg8EOkrOTuWP7DqQ1FbYtcpEbeTzUoTN9bptp8FOU=
github.com/gowebpki/jcs v1.0.1/go.mod h1:CID1cNZ+sHp1CCpAR8mPf6QRtagFBgPJE0FCUQ6+BrI=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
Expand Down Expand Up @@ -302,8 +302,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jarcoal/httpmock v1.3.0 h1:2RJ8GP0IIaWwcC9Fp2BmVi8Kog3v2Hn7VXM3fTd+nuc=
github.com/jarcoal/httpmock v1.3.0/go.mod h1:3yb8rc4BI7TCBhFY8ng0gjuLKJNquuDNiPaZjnENuYg=
github.com/jarcoal/httpmock v1.3.1 h1:iUx3whfZWVf3jT01hQTO/Eo5sAYtB2/rqaUuOtpInww=
github.com/jarcoal/httpmock v1.3.1/go.mod h1:3yb8rc4BI7TCBhFY8ng0gjuLKJNquuDNiPaZjnENuYg=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
Expand Down Expand Up @@ -350,8 +350,8 @@ github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzlt
github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4=
github.com/lestrrat-go/jwx v1.2.26 h1:4iFo8FPRZGDYe1t19mQP0zTRqA7n8HnJ5lkIiDvJcB0=
github.com/lestrrat-go/jwx v1.2.26/go.mod h1:MaiCdGbn3/cckbOFSCluJlJMmp9dmZm5hDuIkx8ftpQ=
github.com/lestrrat-go/jwx/v2 v2.0.13 h1:XdxzJbudGaHEoNmyJACAT8aFCB+DmviiaiMoZwuJoUo=
github.com/lestrrat-go/jwx/v2 v2.0.13/go.mod h1:UzXMzcV99p9/xe1JsIb336NJDGXLsleR+Qj3ucEDtfI=
github.com/lestrrat-go/jwx/v2 v2.0.15 h1:XvR2lQdX+mZechmqWxqQb2foU3hgAn5+Rj0ICa0I6sU=
github.com/lestrrat-go/jwx/v2 v2.0.15/go.mod h1:jBHyESp4e7QxfERM0UKkQ80/94paqNIEcdEfiUYz5zE=
github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU=
github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
Expand Down Expand Up @@ -551,7 +551,6 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -713,7 +712,6 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand All @@ -722,7 +720,6 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
2 changes: 1 addition & 1 deletion internal/schema/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import (

// Resolution is an interface that defines a generic method of resolving a schema
type Resolution interface {
Resolve(ctx context.Context, id string) (*schema.JSONSchema, schema.VCJSONSchemaType, error)
Resolve(ctx context.Context, id string) (*schema.JSONSchema, *schema.VCJSONSchema, schema.VCJSONSchemaType, error)
}
24 changes: 18 additions & 6 deletions internal/verification/verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package verification
import (
"context"
"fmt"
"strings"

credsdk "github.com/TBD54566975/ssi-sdk/credential"
"github.com/TBD54566975/ssi-sdk/credential/integrity"
schemalib "github.com/TBD54566975/ssi-sdk/credential/schema"
"github.com/TBD54566975/ssi-sdk/credential/validation"
"github.com/TBD54566975/ssi-sdk/crypto"
"github.com/TBD54566975/ssi-sdk/crypto/jwx"
Expand All @@ -14,6 +16,8 @@ import (
sdkutil "github.com/TBD54566975/ssi-sdk/util"
"github.com/goccy/go-json"
"github.com/pkg/errors"
"github.com/tbd54566975/ssi-service/config"
"github.com/tbd54566975/ssi-service/pkg/service/framework"

"github.com/tbd54566975/ssi-service/internal/credential"
didint "github.com/tbd54566975/ssi-service/internal/did"
Expand Down Expand Up @@ -165,16 +169,24 @@ func (v Verifier) staticValidationChecks(ctx context.Context, credential credsdk
// if the credential has a schema, resolve it before it is to be used in verification
var validationOpts []validation.Option
if credential.CredentialSchema != nil {
schemaID := credential.CredentialSchema.ID
resolvedSchema, _, err := v.schemaResolver.Resolve(ctx, schemaID)
schemaID := strings.Replace(credential.CredentialSchema.ID, config.GetServicePath(framework.Schema)+"/", "", 1)
resolvedSchema, resolvedSchemaCred, schemaType, err := v.schemaResolver.Resolve(ctx, schemaID)
if err != nil {
return errors.Wrapf(err, "for credential<%s> failed to resolve schemas: %s", credential.ID, schemaID)
}
schemaBytes, err := json.Marshal(resolvedSchema)
if err != nil {
return errors.Wrapf(err, "for credential<%s> failed to marshal schema: %s", credential.ID, schemaID)
if schemaType == schemalib.JSONSchemaType {
schemaBytes, err := json.Marshal(resolvedSchema)
if err != nil {
return errors.Wrapf(err, "for credential<%s> failed to marshal schema: %s", credential.ID, schemaID)
}
validationOpts = append(validationOpts, validation.WithSchema(string(schemaBytes)))
} else {
schemaCredBytes, err := json.Marshal(resolvedSchemaCred)
if err != nil {
return errors.Wrap(err, "marshalling json schema credential")
}
validationOpts = append(validationOpts, validation.WithSchema(string(schemaCredBytes)))
}
validationOpts = append(validationOpts, validation.WithSchema(string(schemaBytes)))
}

// run the configured static checks on the credential
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/router/credential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ func createCredServicePrereqs(tt *testing.T, s storage.ServiceStorage) (issuer,

func getEmailSchema() map[string]any {
return map[string]any{
"$schema": "https://json-schema.org/draft-07/schema",
"$schema": "https://json-schema.org/draft-07/schema#",
"type": "object",
"properties": map[string]any{
"credentialSubject": map[string]any{
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/router/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func TestManifestRouter(t *testing.T) {

// create a schema for the creds to be issued against
licenseSchema := map[string]any{
"$schema": "https://json-schema.org/draft-07/schema",
"$schema": "https://json-schema.org/draft-07/schema#",
"type": "object",
"properties": map[string]any{
"credentialSubject": map[string]any{
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/router/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func TestSchemaSigning(t *testing.T) {

func getSimpleSchema() map[string]any {
simpleSchema := map[string]any{
"$schema": "https://json-schema.org/draft-07/schema",
"$schema": "https://json-schema.org/draft-07/schema#",
"type": "object",
"properties": map[string]any{
"credentialSubject": map[string]any{
Expand Down
4 changes: 2 additions & 2 deletions pkg/server/server_credential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ func TestCredentialAPI(t *testing.T) {

// create a schema
simpleSchema := map[string]any{
"$schema": "https://json-schema.org/draft-07/schema",
"$schema": "https://json-schema.org/draft-07/schema#",
"type": "object",
"properties": map[string]any{
"credentialSubject": map[string]any{
Expand Down Expand Up @@ -613,7 +613,7 @@ func TestCredentialAPI(t *testing.T) {

// create a schema
simpleSchema := map[string]any{
"$schema": "https://json-schema.org/draft-07/schema",
"$schema": "https://json-schema.org/draft-07/schema#",
"type": "object",
"properties": map[string]any{
"credentialSubject": map[string]any{
Expand Down
4 changes: 2 additions & 2 deletions pkg/server/server_did_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ func TestDIDAPI(t *testing.T) {
X: "tXSKB_rubXS7sCjXqupVJEzTcW3MsjmEvq1YpXn96Zg",
Y: "dOicXqbjFxoGJ-K0-GJ1kHYJqic_D_OMuUwkQ7Ol6nk",
},
Purposes: []ion.PublicKeyPurpose{
ion.Authentication, ion.KeyAgreement,
Purposes: []didsdk.PublicKeyPurpose{
didsdk.Authentication, didsdk.KeyAgreement,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/server_issuance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func setupAllThings(t *testing.T, s storage.ServiceStorage) (*did.CreateDIDRespo
require.NoError(t, err)

licenseSchema := map[string]any{
"$schema": "https://json-schema.org/draft-07/schema",
"$schema": "https://json-schema.org/draft-07/schema#",
"type": "object",
"properties": map[string]any{
"credentialSubject": map[string]any{
Expand Down
Loading

0 comments on commit 9e01fcc

Please sign in to comment.