Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

feat: CL Anoncreds Crypto API #3275

Merged

Conversation

kgoncharov
Copy link
Contributor

Title:
CL Anoncreds Crypto API

Description:

  • This is the second PR to support CL in af-go #180
  • This PR adds support for CL Anoncreds on Crypto API level (currently, for tinkcrypto)
  • This PR contains implementation of CL for tinkcrypto
  • remotecrypto changes will be introduced in the one of the latest PRs

Summary:

  • Extended Crypto API with CL methods
  • Adopted libursa CL primitives for tinkcrypto implementation
  • Added ursa CL verifier functionality
  • Added stubs for remotecrypto and tinkcrypto for the case where no ursa installed
  • Added unit tests
  • Minor refactoring

@kgoncharov kgoncharov marked this pull request as draft July 13, 2022 15:03
@troyronda troyronda requested review from baha-ai and Moopli July 13, 2022 16:39
@codecov
Copy link

codecov bot commented Jul 13, 2022

Codecov Report

Merging #3275 (5267cef) into main (9957132) will increase coverage by 0.01%.
The diff coverage is 0.00%.

❗ Current head 5267cef differs from pull request most recent head ab829fe. Consider uploading reports for the commit ab829fe to get more accurate results

@@            Coverage Diff             @@
##             main    #3275      +/-   ##
==========================================
+ Coverage   88.00%   88.02%   +0.01%     
==========================================
  Files         322      323       +1     
  Lines       44389    44393       +4     
==========================================
+ Hits        39066    39077      +11     
+ Misses       3927     3920       -7     
  Partials     1396     1396              
Impacted Files Coverage Δ
pkg/crypto/tinkcrypto/cl_crypto_stub.go 0.00% <0.00%> (ø)
pkg/crypto/webkms/remotecrypto.go 89.81% <0.00%> (-1.12%) ⬇️
pkg/wallet/kmsclient.go 96.44% <0.00%> (-0.07%) ⬇️
pkg/controller/command/verifiable/command.go 89.54% <0.00%> (-0.05%) ⬇️
pkg/doc/verifiable/jws.go 79.54% <0.00%> (ø)
pkg/doc/signature/signer/signer.go 96.25% <0.00%> (ø)
pkg/client/issuecredential/rfc0593/dependencies.go 100.00% <0.00%> (ø)
pkg/doc/verifiable/credential.go 91.04% <0.00%> (+0.08%) ⬆️
pkg/client/issuecredential/rfc0593/event.go 68.70% <0.00%> (+0.36%) ⬆️
...mm/protocol/middleware/presentproof/middlewares.go 87.69% <0.00%> (+0.54%) ⬆️
... and 7 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

pkg/crypto/api.go Outdated Show resolved Hide resolved
@@ -0,0 +1,316 @@
//go:build ursa
// +build ursa
Copy link
Contributor

@baha-ai baha-ai Jul 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like ursa tagged files are not included in our linter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems it'll take ursa and cgo to be provided in golangci-lint Docker container.
should we create a new image for lint with these dependencies inside and use it in check_lint.sh?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it seems the default golangci-lint won't have these tools, might as well create a new dedicated image. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Baha-sk Where should I keep related Dockerfile and push the corresponding image?
Also, we could try to make a separate github job as Alex did for ursa tests - it'll use docker with pre-installed ursa

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can create a ursa subfolder under images and have a new dockerfile there.

as for the job, i would recommend simply updating scripts/check_lint.sh with new entries for ursa linting using your new image.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Baha-sk can we postpone this chage to the next PR?
Currently, I'm not a contributor to af-go, since I haven't made any commit to the repo. Therefore, pipelines would be not started automatically. And it'll be painful to ask you to start pipeline on each of me changes during debug.
Although, I ran golangci-lint locally with ursa tag and made the fixes according to all lint warnings.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no issues @kgoncharov, this is not mandatory, but a suggestion if you need to have a separate dockerfile for ursa builds.

pkg/crypto/api.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
Comment on lines +1 to +2
//go:build ursa
// +build ursa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the crypto api was updated to add the new CL functions, the framework won't compile without this build tag.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed in today's planning, since there are empty stubs in the non-ursa build, the framework should be ok. Further changes will be needed on the server side of KMS.

pkg/crypto/api.go Outdated Show resolved Hide resolved
@kgoncharov kgoncharov force-pushed the cl-crypto-api-tink branch 2 times, most recently from 5267cef to a27d8e9 Compare August 10, 2022 10:42
@kgoncharov kgoncharov marked this pull request as ready for review August 10, 2022 10:58
@kgoncharov kgoncharov closed this Aug 10, 2022
@kgoncharov kgoncharov reopened this Aug 10, 2022
* extended Crypto API with SignWithSecrets and Blind methods
* refactored CL primitives
* implemented new methods for tinkcrypto
* formatted all ursa code
* added ursautil for common ursa methods
* added stubs for CL for remotecrypto and non-ursa tinkcrypto build
* added unit tests

Signed-off-by: konstantin.goncharov <konstantin.goncharov@avast.com>
@sudeshrshetty sudeshrshetty merged commit 45c3566 into hyperledger-archives:main Aug 11, 2022
@kgoncharov kgoncharov deleted the cl-crypto-api-tink branch August 11, 2022 14:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants