Documentation
¶
Overview ¶
Package holder is a generated GoMock package.
Package holder is a generated GoMock package.
Index ¶
- Constants
- Variables
- type BuildParams
- type MockOpenIDHandler
- type MockOpenIDHandlerMockRecorder
- type MockWallet
- func (m *MockWallet) BuildPresentation(ctx context.Context, credentials []vc.VerifiableCredential, ...) (*vc.VerifiablePresentation, error)
- func (m *MockWallet) BuildSubmission(ctx context.Context, walletDIDs []did.DID, ...) (*vc.VerifiablePresentation, *pe.PresentationSubmission, error)
- func (m *MockWallet) Diagnostics() []core.DiagnosticResult
- func (m *MockWallet) EXPECT() *MockWalletMockRecorder
- func (m *MockWallet) IsEmpty() (bool, error)
- func (m *MockWallet) List(ctx context.Context, holderDID did.DID) ([]vc.VerifiableCredential, error)
- func (m *MockWallet) Put(ctx context.Context, credentials ...vc.VerifiableCredential) error
- func (m *MockWallet) Remove(ctx context.Context, holderDID did.DID, credentialID ssi.URI) error
- func (m *MockWallet) SearchCredential(ctx context.Context, holderDID did.DID) ([]vc.VerifiableCredential, error)
- type MockWalletMockRecorder
- func (mr *MockWalletMockRecorder) BuildPresentation(ctx, credentials, options, signerDID, validateVC any) *gomock.Call
- func (mr *MockWalletMockRecorder) BuildSubmission(ctx, walletDIDs, additionalCredentials, presentationDefinition, params any) *gomock.Call
- func (mr *MockWalletMockRecorder) Diagnostics() *gomock.Call
- func (mr *MockWalletMockRecorder) IsEmpty() *gomock.Call
- func (mr *MockWalletMockRecorder) List(ctx, holderDID any) *gomock.Call
- func (mr *MockWalletMockRecorder) Put(ctx any, credentials ...any) *gomock.Call
- func (mr *MockWalletMockRecorder) Remove(ctx, holderDID, credentialID any) *gomock.Call
- func (mr *MockWalletMockRecorder) SearchCredential(ctx, holderDID any) *gomock.Call
- type OpenIDHandler
- type PresentationOptions
- type Wallet
Constants ¶
const ( JSONLDPresentationFormat = vc.JSONLDPresentationProofFormat JWTPresentationFormat = vc.JWTPresentationProofFormat )
Variables ¶
var VerifiableCredentialLDContextV1 = ssi.MustParseURI("https://www.w3.org/2018/credentials/v1")
VerifiableCredentialLDContextV1 holds the URI of the JSON-LD context for Verifiable Credentials.
var VerifiablePresentationLDType = ssi.MustParseURI("VerifiablePresentation")
VerifiablePresentationLDType holds the JSON-LD type for Verifiable Presentations.
Functions ¶
This section is empty.
Types ¶
type BuildParams ¶
type BuildParams struct {
// Audience is used to fill the audience field in the proof
Audience string
// DIDMethods is a list of DID methods that the verifier supports for presentation/credential validation
DIDMethods []string
// Expires is the expiration time of the presentation
Expires time.Time
// Format is a map of format designations that the verifier supports for the presentation
Format map[string]map[string][]string
// Nonce is used to fill the nonce/challenge field in the proof
Nonce string
}
BuildParams contains the parameters that will be used for building the verifiable presentation this includes both parameters for the proof and general requirements.
type MockOpenIDHandler ¶
type MockOpenIDHandler struct {
// contains filtered or unexported fields
}
MockOpenIDHandler is a mock of OpenIDHandler interface.
func NewMockOpenIDHandler ¶
func NewMockOpenIDHandler(ctrl *gomock.Controller) *MockOpenIDHandler
NewMockOpenIDHandler creates a new mock instance.
func (*MockOpenIDHandler) EXPECT ¶
func (m *MockOpenIDHandler) EXPECT() *MockOpenIDHandlerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockOpenIDHandler) HandleCredentialOffer ¶
func (m *MockOpenIDHandler) HandleCredentialOffer(ctx context.Context, offer openid4vci.CredentialOffer) error
HandleCredentialOffer mocks base method.
func (*MockOpenIDHandler) Metadata ¶
func (m *MockOpenIDHandler) Metadata() openid4vci.OAuth2ClientMetadata
Metadata mocks base method.
type MockOpenIDHandlerMockRecorder ¶
type MockOpenIDHandlerMockRecorder struct {
// contains filtered or unexported fields
}
MockOpenIDHandlerMockRecorder is the mock recorder for MockOpenIDHandler.
func (*MockOpenIDHandlerMockRecorder) HandleCredentialOffer ¶
func (mr *MockOpenIDHandlerMockRecorder) HandleCredentialOffer(ctx, offer any) *gomock.Call
HandleCredentialOffer indicates an expected call of HandleCredentialOffer.
func (*MockOpenIDHandlerMockRecorder) Metadata ¶
func (mr *MockOpenIDHandlerMockRecorder) Metadata() *gomock.Call
Metadata indicates an expected call of Metadata.
type MockWallet ¶
type MockWallet struct {
// contains filtered or unexported fields
}
MockWallet is a mock of Wallet interface.
func NewMockWallet ¶
func NewMockWallet(ctrl *gomock.Controller) *MockWallet
NewMockWallet creates a new mock instance.
func (*MockWallet) BuildPresentation ¶
func (m *MockWallet) BuildPresentation(ctx context.Context, credentials []vc.VerifiableCredential, options PresentationOptions, signerDID *did.DID, validateVC bool) (*vc.VerifiablePresentation, error)
BuildPresentation mocks base method.
func (*MockWallet) BuildSubmission ¶
func (m *MockWallet) BuildSubmission(ctx context.Context, walletDIDs []did.DID, additionalCredentials map[did.DID][]vc.VerifiableCredential, presentationDefinition pe.PresentationDefinition, params BuildParams) (*vc.VerifiablePresentation, *pe.PresentationSubmission, error)
BuildSubmission mocks base method.
func (*MockWallet) Diagnostics ¶
func (m *MockWallet) Diagnostics() []core.DiagnosticResult
Diagnostics mocks base method.
func (*MockWallet) EXPECT ¶
func (m *MockWallet) EXPECT() *MockWalletMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockWallet) IsEmpty ¶
func (m *MockWallet) IsEmpty() (bool, error)
IsEmpty mocks base method.
func (*MockWallet) List ¶
func (m *MockWallet) List(ctx context.Context, holderDID did.DID) ([]vc.VerifiableCredential, error)
List mocks base method.
func (*MockWallet) Put ¶
func (m *MockWallet) Put(ctx context.Context, credentials ...vc.VerifiableCredential) error
Put mocks base method.
func (*MockWallet) SearchCredential ¶
func (m *MockWallet) SearchCredential(ctx context.Context, holderDID did.DID) ([]vc.VerifiableCredential, error)
SearchCredential mocks base method.
type MockWalletMockRecorder ¶
type MockWalletMockRecorder struct {
// contains filtered or unexported fields
}
MockWalletMockRecorder is the mock recorder for MockWallet.
func (*MockWalletMockRecorder) BuildPresentation ¶
func (mr *MockWalletMockRecorder) BuildPresentation(ctx, credentials, options, signerDID, validateVC any) *gomock.Call
BuildPresentation indicates an expected call of BuildPresentation.
func (*MockWalletMockRecorder) BuildSubmission ¶
func (mr *MockWalletMockRecorder) BuildSubmission(ctx, walletDIDs, additionalCredentials, presentationDefinition, params any) *gomock.Call
BuildSubmission indicates an expected call of BuildSubmission.
func (*MockWalletMockRecorder) Diagnostics ¶
func (mr *MockWalletMockRecorder) Diagnostics() *gomock.Call
Diagnostics indicates an expected call of Diagnostics.
func (*MockWalletMockRecorder) IsEmpty ¶
func (mr *MockWalletMockRecorder) IsEmpty() *gomock.Call
IsEmpty indicates an expected call of IsEmpty.
func (*MockWalletMockRecorder) List ¶
func (mr *MockWalletMockRecorder) List(ctx, holderDID any) *gomock.Call
List indicates an expected call of List.
func (*MockWalletMockRecorder) Put ¶
func (mr *MockWalletMockRecorder) Put(ctx any, credentials ...any) *gomock.Call
Put indicates an expected call of Put.
func (*MockWalletMockRecorder) Remove ¶
func (mr *MockWalletMockRecorder) Remove(ctx, holderDID, credentialID any) *gomock.Call
Remove indicates an expected call of Remove.
func (*MockWalletMockRecorder) SearchCredential ¶
func (mr *MockWalletMockRecorder) SearchCredential(ctx, holderDID any) *gomock.Call
SearchCredential indicates an expected call of SearchCredential.
type OpenIDHandler ¶
type OpenIDHandler interface {
// Metadata returns the OAuth2 client metadata for the wallet.
Metadata() openid4vci.OAuth2ClientMetadata
// HandleCredentialOffer handles a credential offer from an issuer.
// It will try to retrieve the offered credential and store it.
HandleCredentialOffer(ctx context.Context, offer openid4vci.CredentialOffer) error
}
OpenIDHandler is the interface for handling issuer operations using OpenID4VCI.
func NewOpenIDHandler ¶
func NewOpenIDHandler(did did.DID, identifier string, httpClient core.HTTPRequestDoer, credentialStore vcrTypes.Writer, signer crypto.JWTSigner, resolver resolver.KeyResolver) OpenIDHandler
NewOpenIDHandler creates an OpenIDHandler that tries to retrieve offered credentials, to store it in the given credential store.
type PresentationOptions ¶
type PresentationOptions struct {
// AdditionalContexts contains the contexts to be added in addition to https://www.w3.org/2018/credentials/v1 and the context for JSONWebSignature2020
AdditionalContexts []ssi.URI
// AdditionalTypes contains the VerifiablePresentation types in addition to VerifiablePresentation
AdditionalTypes []ssi.URI
// Holder specifies the holder property.
Holder *ssi.URI
// ProofOptions contains the options for a specific proof.
ProofOptions proof.ProofOptions
// Format contains the requested format for the VerifiablePresentation. If not set, it defaults to JSON-LD.
// Valid options are: ldp_vp or jwt_vp
Format string
}
PresentationOptions contains parameters used to create the right VerifiablePresentation It's up to the caller to make sure the AdditionalTypes are covered by the AdditionalContexts
type Wallet ¶
type Wallet interface {
core.Diagnosable
// BuildPresentation builds and signs a Verifiable Presentation using the given Verifiable Credentials.
// The assertion key used for signing it is taken from signerDID's DID document.
// If signerDID is not provided, it will be derived from the credentials credentialSubject.id fields. But only if all provided credentials have the same (singular) credentialSubject.id field.
BuildPresentation(ctx context.Context, credentials []vc.VerifiableCredential, options PresentationOptions, signerDID *did.DID, validateVC bool) (*vc.VerifiablePresentation, error)
// BuildSubmission builds a Verifiable Presentation based on the given presentation definition.
// additionalCredentials can be given to have the submission consider extra credentials that are not in the wallet.
BuildSubmission(ctx context.Context, walletDIDs []did.DID, additionalCredentials map[did.DID][]vc.VerifiableCredential, presentationDefinition pe.PresentationDefinition, params BuildParams) (*vc.VerifiablePresentation, *pe.PresentationSubmission, error)
// List returns all credentials in the wallet for the given holder.
// If the wallet does not contain any credentials for the given holder, it returns an empty list.
List(ctx context.Context, holderDID did.DID) ([]vc.VerifiableCredential, error)
// SearchCredential returns all credentials in the wallet for the given holder.
// Unlike List, which filters out expired and revoked credentials, SearchCredential returns all credentials
// regardless of their validity status (signature, expired/revoked).
// This can be used to find credentials that can be removed, e.g. because they are expired or revoked.
SearchCredential(ctx context.Context, holderDID did.DID) ([]vc.VerifiableCredential, error)
// Remove removes the given credential from the wallet.
// If the credential is not in the wallet, it returns ErrNotFound.
Remove(ctx context.Context, holderDID did.DID, credentialID ssi.URI) error
// Put adds the given credentials to the wallet. It is an all-or-nothing operation:
// if one of them fails, none of the credentials are added.
Put(ctx context.Context, credentials ...vc.VerifiableCredential) error
// IsEmpty returns true if the wallet contains no credentials at all (for all holder DIDs).
IsEmpty() (bool, error)
}
Wallet holds Verifiable Credentials and can present them.
func NewMemoryWallet ¶
func NewMemoryWallet(documentLoader ld.DocumentLoader, keyResolver resolver.KeyResolver, signer crypto.JWTSigner, credentials map[did.DID][]vc.VerifiableCredential) Wallet