Skip to content

Commit

Permalink
feat: changes
Browse files Browse the repository at this point in the history
  • Loading branch information
skynet2 committed Sep 23, 2024
1 parent 5f239c5 commit 32a1807
Show file tree
Hide file tree
Showing 25 changed files with 811 additions and 120 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 = 3d0b87b8eed653c16f8cc144e5f3a473366a4ac7
VC_FRAMEWORK_VERSION = 444d6c8795171bf09c5838f54019ecf3f0b0d23a
KMS_FRAMEWORK_VERSION = 59c2830d27fd44f9a3a663242a4aa61544ce622e
DID_GO_VERSION = aa500e57d8bdf51c90c20d3a6c815fdc76f716c3
SIDE_TREE_VERSION = f4260aff710479ba5fa3f0c61b51d451d9041225
Expand Down
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.20240910130808-bf0188fdfe70
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.20240920094609-3d0b87b8eed6
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517
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.20240920094609-3d0b87b8eed6 h1:XZK/3OOP6d5QDuJemIPLDdUKoQk/8XzeYh3WigZ4fb8=
github.com/trustbloc/vc-go v1.2.1-0.20240920094609-3d0b87b8eed6/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo=
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517 h1:vSErEdByzxtFERDCuj+apO17aBM/qloaNWfnkdkzn6w=
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo=
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.2
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.20240920094609-3d0b87b8eed6
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517
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.20240920094609-3d0b87b8eed6 h1:XZK/3OOP6d5QDuJemIPLDdUKoQk/8XzeYh3WigZ4fb8=
github.com/trustbloc/vc-go v1.2.1-0.20240920094609-3d0b87b8eed6/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo=
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517 h1:vSErEdByzxtFERDCuj+apO17aBM/qloaNWfnkdkzn6w=
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo=
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.20240920094609-3d0b87b8eed6
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517
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.2 h1:nAlhDoHkSyX1eQFRz/sJsdgmJuNadyX7FJEy/9ROwy
github.com/trustbloc/kms-go v1.1.2/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.20240920094609-3d0b87b8eed6 h1:XZK/3OOP6d5QDuJemIPLDdUKoQk/8XzeYh3WigZ4fb8=
github.com/trustbloc/vc-go v1.2.1-0.20240920094609-3d0b87b8eed6/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo=
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517 h1:vSErEdByzxtFERDCuj+apO17aBM/qloaNWfnkdkzn6w=
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo=
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.20240920094609-3d0b87b8eed6 // indirect
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517 // 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.20240920094609-3d0b87b8eed6 h1:XZK/3OOP6d5QDuJemIPLDdUKoQk/8XzeYh3WigZ4fb8=
github.com/trustbloc/vc-go v1.2.1-0.20240920094609-3d0b87b8eed6/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo=
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517 h1:vSErEdByzxtFERDCuj+apO17aBM/qloaNWfnkdkzn6w=
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo=
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 @@ -28,7 +28,7 @@ require (
github.com/trustbloc/kms-go v1.1.2
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.20240920094609-3d0b87b8eed6
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517
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.20240920094609-3d0b87b8eed6 h1:XZK/3OOP6d5QDuJemIPLDdUKoQk/8XzeYh3WigZ4fb8=
github.com/trustbloc/vc-go v1.2.1-0.20240920094609-3d0b87b8eed6/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo=
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517 h1:vSErEdByzxtFERDCuj+apO17aBM/qloaNWfnkdkzn6w=
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo=
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 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.20240910130808-bf0188fdfe70
github.com/trustbloc/kms-go v1.1.2
github.com/trustbloc/logutil-go v1.0.0-rc1
github.com/trustbloc/vc-go v1.2.1-0.20240920094609-3d0b87b8eed6
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517
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.2 h1:nAlhDoHkSyX1eQFRz/sJsdgmJuNadyX7FJEy/9ROwy
github.com/trustbloc/kms-go v1.1.2/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.20240920094609-3d0b87b8eed6 h1:XZK/3OOP6d5QDuJemIPLDdUKoQk/8XzeYh3WigZ4fb8=
github.com/trustbloc/vc-go v1.2.1-0.20240920094609-3d0b87b8eed6/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo=
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517 h1:vSErEdByzxtFERDCuj+apO17aBM/qloaNWfnkdkzn6w=
github.com/trustbloc/vc-go v1.2.1-0.20240923151258-444d6c879517/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo=
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
30 changes: 23 additions & 7 deletions pkg/doc/vc/crypto/crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,11 @@ func TestSignCredential(t *testing.T) {
"info": "Info",
})

signedVC, err := c.SignCredential(getTestLDPDataIntegritySigner(), unsignedVC)
signedVC, err := c.SignCredential(getTestLDPDataIntegritySigner(
ecdsa2019.SuiteType,
vcsverifiable.Ed25519Signature2018,
kms.ED25519,
), unsignedVC)
require.NoError(t, err)
require.Equal(t, 1, len(signedVC.Proofs()))
require.False(t, signedVC.IsJWT())
Expand Down Expand Up @@ -862,12 +866,19 @@ func TestSignCredential(t *testing.T) {
}

func getTestLDPSigner() *vc.Signer {
return getTestLDPSignerInternal("Ed25519Signature2018", kms.ED25519Type)
}

func getTestLDPSignerInternal(
signatureType vcsverifiable.SignatureType,
keyType kms.KeyType,
) *vc.Signer {
return &vc.Signer{
DID: "did:trustbloc:abc",
SignatureType: "Ed25519Signature2018",
SignatureType: signatureType,
Creator: "did:trustbloc:abc#key1",
KMSKeyID: "key1",
KeyType: kms.ED25519,
KeyType: keyType,
KMS: &vcskms.MockKMS{
FixedSigner: &mockwrapper.MockFixedKeyCrypto{},
},
Expand All @@ -878,19 +889,24 @@ func getTestLDPSigner() *vc.Signer {
}
}

func getTestLDPDataIntegritySigner() *vc.Signer {
s := getTestLDPSigner()
func getTestLDPDataIntegritySigner(
suite string,
signatureType vcsverifiable.SignatureType,
keyType kms.KeyType,

Check failure on line 895 in pkg/doc/vc/crypto/crypto_test.go

View workflow job for this annotation

GitHub Actions / Checks

`getTestLDPDataIntegritySigner` - `keyType` always receives `"ED25519"` (unparam)
) *vc.Signer {
s := getTestLDPSignerInternal(signatureType, keyType)
s.DataIntegrityProof = vc.DataIntegrityProofConfig{
Enable: true,
SuiteType: ecdsa2019.SuiteType,
SuiteType: suite,
}

return s
}

func getJWTSigner(
customSigner api.KMSCryptoMultiSigner,
kid string) *vc.Signer {
kid string,
) *vc.Signer {
return &vc.Signer{
DID: didID,
SignatureType: "Ed25519Signature2018",
Expand Down
63 changes: 60 additions & 3 deletions pkg/doc/vc/crypto/dataIntegrity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ import (
vdrmock "github.com/trustbloc/did-go/vdr/mock"
mockwrapper "github.com/trustbloc/kms-go/mock/wrapper"
kmsapi "github.com/trustbloc/kms-go/spi/kms"
"github.com/trustbloc/vc-go/dataintegrity/suite/ecdsa2019"
"github.com/trustbloc/vc-go/dataintegrity/suite/eddsa2022"
"github.com/trustbloc/vc-go/verifiable"

"github.com/trustbloc/vcs/internal/mock/vcskms"
vcsverifiable "github.com/trustbloc/vcs/pkg/doc/verifiable"

"github.com/trustbloc/vcs/pkg/internal/testutil"
)
Expand Down Expand Up @@ -49,7 +53,11 @@ func TestCrypto_SignCredentialLDPDataIntegrity(t *testing.T) { //nolint:gocognit
testutil.DocumentLoader(t),
)

testSigner := getTestLDPDataIntegritySigner()
testSigner := getTestLDPDataIntegritySigner(
ecdsa2019.SuiteType,
vcsverifiable.Ed25519Signature2018,
kmsapi.ED25519,
)

unsignedVc, err := verifiable.CreateCredential(verifiable.CredentialContents{
ID: "http://example.edu/credentials/1872",
Expand Down Expand Up @@ -93,6 +101,46 @@ func TestCrypto_SignCredentialLDPDataIntegrity(t *testing.T) { //nolint:gocognit
require.NotEmpty(t, signedVC.Proofs()[0]["proofValue"])
})

t.Run("Success ecdsa-rdfc-2019", func(t *testing.T) {
legacySigner := getTestLDPDataIntegritySigner(
ecdsa2019.SuiteTypeNew,
vcsverifiable.Ed25519Signature2020,
kmsapi.ED25519,
)

signedVC, err := c.signCredentialLDPDataIntegrity(legacySigner, unsignedVc)
require.NoError(t, err)
require.Equal(t, 1, len(signedVC.Proofs()))

require.Equal(t, "DataIntegrityProof", signedVC.Proofs()[0]["type"])
require.Equal(t, "ecdsa-rdfc-2019", signedVC.Proofs()[0]["cryptosuite"])
require.Equal(t, "#key1", signedVC.Proofs()[0]["verificationMethod"])
require.Equal(t, "assertionMethod", signedVC.Proofs()[0]["proofPurpose"])
require.Empty(t, signedVC.Proofs()[0]["challenge"])
require.Empty(t, signedVC.Proofs()[0]["domain"])
require.NotEmpty(t, signedVC.Proofs()[0]["proofValue"])
})

t.Run("Success eddsa-rdfc-2022", func(t *testing.T) {
eddsa2022Signer := getTestLDPDataIntegritySigner(
eddsa2022.SuiteType,
vcsverifiable.Ed25519Signature2020,
kmsapi.ED25519,
)

signedVC, err := c.signCredentialLDPDataIntegrity(eddsa2022Signer, unsignedVc)
require.NoError(t, err)
require.Equal(t, 1, len(signedVC.Proofs()))

require.Equal(t, "DataIntegrityProof", signedVC.Proofs()[0]["type"])
require.Equal(t, "eddsa-rdfc-2022", signedVC.Proofs()[0]["cryptosuite"])
require.Equal(t, "#key1", signedVC.Proofs()[0]["verificationMethod"])
require.Equal(t, "assertionMethod", signedVC.Proofs()[0]["proofPurpose"])
require.Empty(t, signedVC.Proofs()[0]["challenge"])
require.Empty(t, signedVC.Proofs()[0]["domain"])
require.NotEmpty(t, signedVC.Proofs()[0]["proofValue"])
})

t.Run("Success with options", func(t *testing.T) {
testCrypto := New(
&vdrmock.VDRegistry{
Expand Down Expand Up @@ -127,7 +175,12 @@ func TestCrypto_SignCredentialLDPDataIntegrity(t *testing.T) { //nolint:gocognit
verifiable.CredentialContents{ID: "http://example.edu/credentials/1872"}, nil)
require.NoError(t, err)

ariesSigner := getTestLDPDataIntegritySigner()
ariesSigner := getTestLDPDataIntegritySigner(
ecdsa2019.SuiteType,
vcsverifiable.Ed25519Signature2018,
kmsapi.ED25519,
)

ariesSigner.DataIntegrityProof.SuiteType = "undefined"

signedVC, err := c.signCredentialLDPDataIntegrity(ariesSigner, testCredentials)
Expand All @@ -136,7 +189,11 @@ func TestCrypto_SignCredentialLDPDataIntegrity(t *testing.T) { //nolint:gocognit
})

t.Run("Error get signer", func(t *testing.T) {
ariesSigner := getTestLDPDataIntegritySigner()
ariesSigner := getTestLDPDataIntegritySigner(
ecdsa2019.SuiteType,
vcsverifiable.Ed25519Signature2018,
kmsapi.ED25519,
)

ariesSigner.KMS = &vcskms.MockKMS{
Signer: &mockwrapper.MockKMSCrypto{FixedKeyCryptoErr: errors.New("some error")},
Expand Down
Loading

0 comments on commit 32a1807

Please sign in to comment.