This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Method for adding Credential Application data to a VP (#3109)
- Added a method that adds Credential Application data to a VP based on a Credential Manifest. - Added "https://identity.foundation/credential-manifest/application/v1" context to the embedded contexts. Signed-off-by: Derek Trider <Derek.Trider@securekey.com>
- Loading branch information
Derek Trider
committed
Dec 16, 2021
1 parent
a0879ff
commit 642a9f0
Showing
22 changed files
with
1,206 additions
and
228 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
Copyright SecureKey Technologies Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package cm_test | ||
|
||
import ( | ||
"encoding/json" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/hyperledger/aries-framework-go/pkg/doc/verifiable" | ||
"github.com/hyperledger/aries-framework-go/pkg/internal/ldtestutil" | ||
) | ||
|
||
const errorMessageTestNameFormat = "Test name: %s" | ||
|
||
// Marshals the presentation and then unmarshals it again so that the type of the custom fields matches the type of | ||
// the expected presentation - this allows us to use reflect.DeepEqual to compare them. | ||
func marshalThenUnmarshalAgain(t *testing.T, presentation *verifiable.Presentation, | ||
testName string) *verifiable.Presentation { | ||
presentationBytes, err := json.Marshal(presentation) | ||
require.NoError(t, err, errorMessageTestNameFormat, testName) | ||
|
||
return makePresentationFromBytes(t, presentationBytes, testName) | ||
} | ||
|
||
func makePresentationFromBytes(t *testing.T, presentationBytes []byte, testName string) *verifiable.Presentation { | ||
loader, err := ldtestutil.DocumentLoader() | ||
require.NoError(t, err) | ||
|
||
presentation, err := verifiable.ParsePresentation(presentationBytes, | ||
verifiable.WithPresDisabledProofCheck(), | ||
verifiable.WithPresJSONLDDocumentLoader(loader)) | ||
require.NoError(t, err, errorMessageTestNameFormat, testName) | ||
|
||
return presentation | ||
} |
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.