Skip to content

Commit

Permalink
chore: change proof purpose for data integrity
Browse files Browse the repository at this point in the history
Signed-off-by: Firas Qutishat <[email protected]>
  • Loading branch information
fqutishat committed Sep 13, 2023
1 parent 53bc2ef commit fe1a3e6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/doc/vc/crypto/crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down Expand Up @@ -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}},
Expand Down
2 changes: 1 addition & 1 deletion pkg/doc/vc/crypto/dataIntegrity.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (c *Crypto) signCredentialLDPDataIntegrity(signerData *vc.Signer,
}

if signOpts.Purpose == "" {
signOpts.Purpose = Authentication
signOpts.Purpose = AssertionMethod
}

signatureType := signerData.SignatureType
Expand Down
4 changes: 2 additions & 2 deletions pkg/doc/vc/crypto/dataIntegrity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down Expand Up @@ -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"])
Expand Down

0 comments on commit fe1a3e6

Please sign in to comment.