-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VCR: Copy VC search query type from Nuts node (#356)
* VCR: Copy VC search query type from Nuts node * feedback
- Loading branch information
Showing
3 changed files
with
34 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,31 @@ | ||
package vcr | ||
|
||
import ( | ||
ssi "github.com/nuts-foundation/go-did" | ||
"github.com/nuts-foundation/go-did/did" | ||
"github.com/nuts-foundation/go-did/vc" | ||
v2 "github.com/nuts-foundation/nuts-node/vcr/api/v2" | ||
) | ||
|
||
// SearchVCRequest is the request body for searching VCs | ||
type SearchVCRequest v2.SearchVCRequest | ||
|
||
type VerifiableCredential = vc.VerifiableCredential | ||
type VerifiablePresentation = vc.VerifiablePresentation | ||
type DID = did.DID | ||
type CredentialSubject = interface{} | ||
|
||
// SearchVCRequest is the request body for searching VCs | ||
type SearchVCRequest struct { | ||
// A partial VerifiableCredential in JSON-LD format. Each field will be used to match credentials against. All fields MUST be present. | ||
Query SearchVCQuery `json:"query"` | ||
SearchOptions *SearchOptions `json:"searchOptions,omitempty"` | ||
} | ||
|
||
// SearchVCQuery defines a helper struct to search for VerifiableCredentials. | ||
type SearchVCQuery struct { | ||
// Context defines the json-ld context to dereference the URIs | ||
Context []ssi.URI `json:"@context"` | ||
// Type holds multiple types for a credential. A credential must always have the 'VerifiableCredential' type. | ||
Type []ssi.URI `json:"type,omitempty"` | ||
// Issuer refers to the party that issued the credential | ||
Issuer *ssi.URI `json:"issuer,omitempty"` | ||
// CredentialSubject holds the actual data for the credential. It must be extracted using the UnmarshalCredentialSubject method and a custom type. | ||
CredentialSubject interface{} `json:"credentialSubject,omitempty"` | ||
} |
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