From fe1a3e6e3f732483a5cc853cc1daa5a640969bbe Mon Sep 17 00:00:00 2001 From: Firas Qutishat Date: Wed, 13 Sep 2023 15:41:37 -0400 Subject: [PATCH] chore: change proof purpose for data integrity Signed-off-by: Firas Qutishat --- pkg/doc/vc/crypto/crypto_test.go | 4 ++-- pkg/doc/vc/crypto/dataIntegrity.go | 2 +- pkg/doc/vc/crypto/dataIntegrity_test.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/doc/vc/crypto/crypto_test.go b/pkg/doc/vc/crypto/crypto_test.go index 1bdea00a6..68857a314 100644 --- a/pkg/doc/vc/crypto/crypto_test.go +++ b/pkg/doc/vc/crypto/crypto_test.go @@ -671,7 +671,7 @@ func TestSignCredential(t *testing.T) { c := New( &vdrmock.VDRegistry{ ResolveFunc: func(didID string, opts ...vdrapi.DIDMethodOption) (*did.DocResolution, error) { - return makeMockDIDResolution(signingDID, verificationMethod, did.Authentication), nil + return makeMockDIDResolution(signingDID, verificationMethod, did.AssertionMethod), nil }}, testutil.DocumentLoader(t), ) @@ -939,7 +939,7 @@ func createDIDDoc(didID string, opts ...opt) *did.Doc { VerificationMethod: []did.VerificationMethod{signingKey}, Service: []did.Service{service}, Created: &createdTime, - AssertionMethod: []did.Verification{{VerificationMethod: signingKey}}, + AssertionMethod: []did.Verification{{VerificationMethod: signingKey, Relationship: did.AssertionMethod}}, Authentication: []did.Verification{{VerificationMethod: signingKey, Relationship: did.Authentication}}, CapabilityInvocation: []did.Verification{{VerificationMethod: signingKey}}, CapabilityDelegation: []did.Verification{{VerificationMethod: signingKey}}, diff --git a/pkg/doc/vc/crypto/dataIntegrity.go b/pkg/doc/vc/crypto/dataIntegrity.go index 6bd70710a..ca1a81c5b 100644 --- a/pkg/doc/vc/crypto/dataIntegrity.go +++ b/pkg/doc/vc/crypto/dataIntegrity.go @@ -32,7 +32,7 @@ func (c *Crypto) signCredentialLDPDataIntegrity(signerData *vc.Signer, } if signOpts.Purpose == "" { - signOpts.Purpose = Authentication + signOpts.Purpose = AssertionMethod } signatureType := signerData.SignatureType diff --git a/pkg/doc/vc/crypto/dataIntegrity_test.go b/pkg/doc/vc/crypto/dataIntegrity_test.go index 705ca8daf..3c600defd 100644 --- a/pkg/doc/vc/crypto/dataIntegrity_test.go +++ b/pkg/doc/vc/crypto/dataIntegrity_test.go @@ -39,7 +39,7 @@ func TestCrypto_SignCredentialLDPDataIntegrity(t *testing.T) { //nolint:gocognit c := New( &vdrmock.VDRegistry{ ResolveFunc: func(didID string, opts ...vdrapi.DIDMethodOption) (*did.DocResolution, error) { - return makeMockDIDResolution(signingDID, verificationMethod, did.Authentication), nil + return makeMockDIDResolution(signingDID, verificationMethod, did.AssertionMethod), nil }}, testutil.DocumentLoader(t), ) @@ -82,7 +82,7 @@ func TestCrypto_SignCredentialLDPDataIntegrity(t *testing.T) { //nolint:gocognit require.Equal(t, "DataIntegrityProof", signedVC.Proofs[0]["type"]) require.Equal(t, "ecdsa-2019", signedVC.Proofs[0]["cryptosuite"]) require.Equal(t, "#key1", signedVC.Proofs[0]["verificationMethod"]) - require.Equal(t, "authentication", signedVC.Proofs[0]["proofPurpose"]) + 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"])