forked from hyperledger-archives/aries-framework-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add "no proof check" option for VC decoding
closes hyperledger-archives#1002 Signed-off-by: Dima <dkinoshenko@gmail.com>
- Loading branch information
Showing
13 changed files
with
128 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// +build testsuite | ||
|
||
/* | ||
Copyright SecureKey Technologies Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
This is not actually a test but rather a stand-alone generator application | ||
that is used by VC Test Suite (https://github.com/w3c/vc-test-suite). | ||
To run VC Test Suite, execute `make vc-test-suite`. | ||
*/ | ||
|
||
package verifiable | ||
|
||
// WithNoProofCheck disables checking of Verifiable Credential's proofs. | ||
func WithNoProofCheck() CredentialOpt { | ||
return func(opts *credentialOpts) { | ||
opts.disabledProofCheck = true | ||
} | ||
} | ||
|
||
// WithPresNoProofCheck tells to skip checking of Verifiable Presentation's proofs. | ||
func WithPresNoProofCheck() PresentationOpt { | ||
return func(opts *presentationOpts) { | ||
opts.disabledProofCheck = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// +build testsuite | ||
|
||
/* | ||
Copyright SecureKey Technologies Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
This is not actually a test but rather a stand-alone generator application | ||
that is used by VC Test Suite (https://github.com/w3c/vc-test-suite). | ||
To run VC Test Suite, execute `make vc-test-suite`. | ||
*/ | ||
|
||
package verifiable | ||
|
||
import ( | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
func TestWithNoProofCheck(t *testing.T) { | ||
credentialOpt := WithNoProofCheck() | ||
require.NotNil(t, credentialOpt) | ||
|
||
opts := &credentialOpts{} | ||
credentialOpt(opts) | ||
require.True(t, opts.disabledProofCheck) | ||
} | ||
|
||
func TestWithPresSkippedEmbeddedProofCheck(t *testing.T) { | ||
vpOpt := WithPresNoProofCheck() | ||
require.NotNil(t, vpOpt) | ||
|
||
opts := &presentationOpts{} | ||
vpOpt(opts) | ||
require.True(t, opts.disabledProofCheck) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.