openid4vp

package
v0.0.0-...-6ffe938 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package openid4vp contains functionality for doing OpenID4VP operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Acknowledgment

type Acknowledgment struct {
	// contains filtered or unexported fields
}

Acknowledgment represents an object that allows to acknowledge the verifier on presentation request status.

func NewAcknowledgment

func NewAcknowledgment(serialized string) (*Acknowledgment, error)

NewAcknowledgment recreates acknowledgment object from serialized state.

func (*Acknowledgment) NoConsent

func (a *Acknowledgment) NoConsent() error

NoConsent acknowledge verifier that user does not consent to the presentation request.

func (*Acknowledgment) NoMatchingCredential

func (a *Acknowledgment) NoMatchingCredential() error

NoMatchingCredential acknowledge verifier that no matching credential was found.

func (*Acknowledgment) Serialize

func (a *Acknowledgment) Serialize() (string, error)

Serialize the acknowledgment object so it can be restored later.

func (*Acknowledgment) SetInteractionDetails

func (a *Acknowledgment) SetInteractionDetails(serializedInteractionDetails string) error

SetInteractionDetails extends acknowledgment request with serializedInteractionDetails.

func (*Acknowledgment) WithCode

func (a *Acknowledgment) WithCode(code, desc string) error

WithCode sends acknowledgment message to verifier with the custom error code and description.

type Args

type Args struct {
	// contains filtered or unexported fields
}

Args contains the required parameters for an Interaction.

func NewArgs

func NewArgs(authorizationRequest string, crypto api.Crypto, didResolver api.DIDResolver) *Args

NewArgs creates a new Args object. All parameters are mandatory.

type CredentialClaimKeys

type CredentialClaimKeys struct {
	ContentJSON interface{}
}

CredentialClaimKeys represent credential claim keys.

type Interaction

type Interaction struct {
	// contains filtered or unexported fields
}

Interaction represents a single OpenID4VP interaction between a wallet and a verifier. The methods defined on this object are used to help guide the calling code through the OpenID4VP flow.

func NewInteraction

func NewInteraction(args *Args, opts *Opts) (*Interaction, error)

NewInteraction creates a new OpenID4VP Interaction. The methods defined on this object are used to help guide the calling code through the OpenID4VP flow.

func (*Interaction) Acknowledgment

func (o *Interaction) Acknowledgment() *Acknowledgment

Acknowledgment returns acknowledgment object.

func (*Interaction) CustomScope

func (o *Interaction) CustomScope() *Scope

CustomScope returns vp integration scope.

func (*Interaction) GetQuery

func (o *Interaction) GetQuery() ([]byte, error)

GetQuery creates query based on authorization request data.

func (*Interaction) OTelTraceID

func (o *Interaction) OTelTraceID() string

OTelTraceID returns open telemetry trace id.

func (*Interaction) PresentCredential

func (o *Interaction) PresentCredential(credentials *verifiable.CredentialsArray) error

PresentCredential presents credentials to redirect uri from request object.

func (*Interaction) PresentCredentialOpts

func (o *Interaction) PresentCredentialOpts(
	credentials *verifiable.CredentialsArray,
	opts *PresentCredentialOpts,
) error

PresentCredentialOpts presents credentials to redirect uri from request object.

func (*Interaction) PresentCredentialUnsafe

func (o *Interaction) PresentCredentialUnsafe(credential *verifiable.Credential) error

PresentCredentialUnsafe presents a single credential to redirect uri from request object.

Note: this variant of PresentCredential will skip client-side presentation definition constraint validation. All input descriptors will accept the provided credential, at least in terms of issuer fields, and subject data fields.

func (*Interaction) PresentedClaims

func (o *Interaction) PresentedClaims(credential *verifiable.Credential) (*CredentialClaimKeys, error)

PresentedClaims returns vc presented claims.

func (*Interaction) TrustInfo

func (o *Interaction) TrustInfo() (*VerifierTrustInfo, error)

TrustInfo return verifier trust info.

func (*Interaction) VerifierDisplayData

func (o *Interaction) VerifierDisplayData() *VerifierDisplayData

VerifierDisplayData returns display information about verifier.

type Opts

type Opts struct {
	// contains filtered or unexported fields
}

Opts contains all optional arguments that can be passed into the NewInteraction function.

func NewOpts

func NewOpts() *Opts

NewOpts returns a new Opts object.

func (*Opts) AddHeader

func (o *Opts) AddHeader(header *api.Header) *Opts

AddHeader adds the given HTTP header to all REST calls made to the issuer during the OpenID4CI flow.

func (*Opts) AddHeaders

func (o *Opts) AddHeaders(headers *api.Headers) *Opts

AddHeaders adds the given HTTP headers to all REST calls made to the verifier during the OpenID4VP flow.

func (*Opts) DisableHTTPClientTLSVerify

func (o *Opts) DisableHTTPClientTLSVerify() *Opts

DisableHTTPClientTLSVerify disables tls verification, should be used only for test purposes.

func (*Opts) DisableOpenTelemetry

func (o *Opts) DisableOpenTelemetry() *Opts

DisableOpenTelemetry disables sending of open telemetry header.

func (*Opts) EnableAddingDIProofs

func (o *Opts) EnableAddingDIProofs(kms *localkms.KMS) *Opts

EnableAddingDIProofs enables the adding of data integrity proofs to presentations sent to the verifier. It requires a KMS to be passed in. Deprecated: DI proofs are now enabled by default. Their usage depends on the proof types supported by the verifier.

func (*Opts) SetActivityLogger

func (o *Opts) SetActivityLogger(activityLogger api.ActivityLogger) *Opts

SetActivityLogger sets an activity logger to use.

func (*Opts) SetDocumentLoader

func (o *Opts) SetDocumentLoader(documentLoader api.LDDocumentLoader) *Opts

SetDocumentLoader sets a document loader to use.

func (*Opts) SetHTTPTimeoutNanoseconds

func (o *Opts) SetHTTPTimeoutNanoseconds(timeout int64) *Opts

SetHTTPTimeoutNanoseconds sets the timeout (in nanoseconds) for HTTP calls. Passing in 0 will disable timeouts.

func (*Opts) SetMetricsLogger

func (o *Opts) SetMetricsLogger(metricsLogger api.MetricsLogger) *Opts

SetMetricsLogger sets a metrics logger to use.

type PresentCredentialOpts

type PresentCredentialOpts struct {
	// contains filtered or unexported fields
}

PresentCredentialOpts contains options for present credential operation.

func NewPresentCredentialOpts

func NewPresentCredentialOpts() *PresentCredentialOpts

NewPresentCredentialOpts returns a new PresentCredentialOpts object.

func (*PresentCredentialOpts) AddScopeClaim

func (o *PresentCredentialOpts) AddScopeClaim(claimName, claimJSON string) *PresentCredentialOpts

AddScopeClaim adds scope claim with given name.

func (*PresentCredentialOpts) SetAttestationVC

func (o *PresentCredentialOpts) SetAttestationVC(
	vm *api.VerificationMethod, vc string,
) *PresentCredentialOpts

SetAttestationVC is an option for the RequestCredentialWithPreAuth method that allows you to specify attestation VC, which may be required by the verifier.

func (*PresentCredentialOpts) SetInteractionDetails

func (o *PresentCredentialOpts) SetInteractionDetails(
	serializedInteractionDetails string,
) *PresentCredentialOpts

SetInteractionDetails extends authorization response with interaction details.

type Scope

type Scope struct {
	// contains filtered or unexported fields
}

Scope represents an array of scope strings. Since arrays and slices are not compatible with gomobile, this type acts as a wrapper around a Go array of strings.

func NewScope

func NewScope(scope []string) *Scope

NewScope creates Scope object from array of scopes.

func (*Scope) AtIndex

func (s *Scope) AtIndex(index int) string

AtIndex returns scope by index.

func (*Scope) Length

func (s *Scope) Length() int

Length returns the number scopes.

type VerifierDisplayData

type VerifierDisplayData struct {
	// contains filtered or unexported fields
}

VerifierDisplayData represents display information for a verifier.

func (*VerifierDisplayData) DID

func (v *VerifierDisplayData) DID() string

DID returns the verifier's DID.

func (*VerifierDisplayData) LogoURI

func (v *VerifierDisplayData) LogoURI() string

LogoURI returns the verifier's logo URI.

func (*VerifierDisplayData) Name

func (v *VerifierDisplayData) Name() string

Name returns the verifier's name.

func (*VerifierDisplayData) Purpose

func (v *VerifierDisplayData) Purpose() string

Purpose returns the verifier's purpose.

type VerifierTrustInfo

type VerifierTrustInfo struct {
	DID         string
	Domain      string
	DomainValid bool
}

VerifierTrustInfo represent verifier trust information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL