From 82217f0f999e6a6260bf37ceaf6c6f26840452e5 Mon Sep 17 00:00:00 2001 From: Maksym Hrynenko Date: Wed, 15 May 2024 20:45:26 +0300 Subject: [PATCH 1/2] add: aditional info to err msg --- internal/service/api/handlers/create_identity.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/service/api/handlers/create_identity.go b/internal/service/api/handlers/create_identity.go index 1837caa..524f5b3 100644 --- a/internal/service/api/handlers/create_identity.go +++ b/internal/service/api/handlers/create_identity.go @@ -28,6 +28,7 @@ import ( "github.com/rarimo/passport-identity-provider/resources" "gitlab.com/distributed_lab/ape" "gitlab.com/distributed_lab/ape/problems" + "gitlab.com/distributed_lab/logan/v3" "gitlab.com/distributed_lab/logan/v3/errors" ) @@ -357,7 +358,10 @@ func validateSignedAttributes(signedAttributes, encapsulatedContent []byte, algo } if !bytes.Equal(digestAttr.Digest[0].Bytes, d) { - return errors.New("digest signed attribute is not equal to encapsulated content hash") + return errors.From(errors.New("digest signed attribute is not equal to encapsulated content hash"), logan.F{ + "signed_attributes": hex.EncodeToString(digestAttr.Digest[0].Bytes), + "content_hash": hex.EncodeToString(d), + }) } return nil } From 16043b7bbb252f1cce2cb935bf987282e5d0d212 Mon Sep 17 00:00:00 2001 From: Maksym Hrynenko Date: Wed, 15 May 2024 21:08:46 +0300 Subject: [PATCH 2/2] add: encapsulated_content to the err log --- internal/service/api/handlers/create_identity.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/api/handlers/create_identity.go b/internal/service/api/handlers/create_identity.go index 524f5b3..2455e17 100644 --- a/internal/service/api/handlers/create_identity.go +++ b/internal/service/api/handlers/create_identity.go @@ -359,8 +359,9 @@ func validateSignedAttributes(signedAttributes, encapsulatedContent []byte, algo if !bytes.Equal(digestAttr.Digest[0].Bytes, d) { return errors.From(errors.New("digest signed attribute is not equal to encapsulated content hash"), logan.F{ - "signed_attributes": hex.EncodeToString(digestAttr.Digest[0].Bytes), - "content_hash": hex.EncodeToString(d), + "signed_attributes": hex.EncodeToString(digestAttr.Digest[0].Bytes), + "content_hash": hex.EncodeToString(d), + "encapsulated_content": hex.EncodeToString(encapsulatedContent), }) } return nil