oidc4vci

package
v0.0.0-...-3c62d32 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0 Imports: 62 Imported by: 2

Documentation

Index

Constants

View Source
const (
	FlowTypeAuthorizationCode FlowType = "authorization_code"
	FlowTypeWalletInitiated            = "wallet_initiated"
	FlowTypePreAuthorizedCode          = "pre-authorized_code"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AttestationService

type AttestationService interface {
	GetAttestation(ctx context.Context, request attestation.GetAttestationRequest) (string, error)
}

type BatchCredentialRequest

type BatchCredentialRequest struct {
	CredentialRequests []CredentialRequest `json:"credential_requests"`
}

type BatchCredentialResponse

type BatchCredentialResponse struct {
	// JSON string containing a nonce to be used to create a proof of possession of key material when requesting a Credential.
	CNonce *string `json:"c_nonce,omitempty"`

	// JSON integer denoting the lifetime in seconds of the c_nonce.
	CNonceExpiresIn     *int                                `json:"c_nonce_expires_in,omitempty"`
	CredentialResponses []CredentialResponseBatchCredential `json:"credential_responses"`
}

BatchCredentialResponse for OIDC Batch Credential response.

type CWTProofBuilder

type CWTProofBuilder struct {
}

func NewCWTProofBuilder

func NewCWTProofBuilder() *CWTProofBuilder

func (*CWTProofBuilder) Build

func (b *CWTProofBuilder) Build(
	ctx context.Context,
	req *CreateProofRequest,
) (*Proof, error)

type CreateProofRequest

type CreateProofRequest struct {
	Signer           jose.Signer
	CustomHeaders    map[string]interface{}
	WalletKeyID      string
	WalletDID        string
	WalletKeyType    kms.KeyType
	Claims           *ProofClaims
	VDR              vdrapi.Registry
	CredentialIssuer string
}

type CredentialDefinition

type CredentialDefinition struct {
	// For ldp_vc only. Array as defined in https://www.w3.org/TR/vc-data-model/#contexts.
	Context *[]string `json:"@context,omitempty"`
	// An object containing a list of name/value pairs, where each name identifies a claim offered in the Credential. The value can be another such object (nested data structures), or an array of such objects.
	CredentialSubject *map[string]interface{} `json:"credentialSubject,omitempty"`
	// Array designating the types a certain credential type supports
	Type []string `json:"type"`
}

CredentialDefinition contains the detailed description of the credential type.

type CredentialRequest

type CredentialRequest struct {
	Format                       verifiable.OIDCFormat         `json:"format,omitempty"`
	CredentialDefinition         *CredentialDefinition         `json:"credential_definition,omitempty"`
	CredentialIdentifier         *string                       `json:"credential_identifier,omitempty"`
	Proof                        Proof                         `json:"proof,omitempty"`
	CredentialResponseEncryption *CredentialResponseEncryption `json:"credential_response_encryption,omitempty"`
}

type CredentialResponse

type CredentialResponse struct {
	AcceptanceToken string                `json:"acceptance_token,omitempty"`
	CNonce          string                `json:"c_nonce,omitempty"`
	CNonceExpiresIn int                   `json:"c_nonce_expires_in,omitempty"`
	Credential      interface{}           `json:"credential"`
	Format          verifiable.OIDCFormat `json:"format"`
	NotificationId  *string               `json:"notification_id"`
}

type CredentialResponseBatchCredential

type CredentialResponseBatchCredential struct {
	// Contains issued Credential.
	Credential interface{} `json:"credential"`

	// String identifying an issued Credential that the Wallet includes in the acknowledgement request.
	NotificationId *string `json:"notification_id,omitempty"`

	// OPTIONAL. String identifying a Deferred Issuance transaction. This claim is contained in the response if the Credential Issuer was unable to immediately issue the Credential. The value is subsequently used to obtain the respective Credential with the Deferred Credential Endpoint.
	TransactionId *string `json:"transaction_id,omitempty"`
}

type CredentialResponseEncryption

type CredentialResponseEncryption struct {
	// JWE alg algorithm for encrypting the Credential Response.
	Alg string `json:"alg"`

	// JWE enc algorithm for encrypting the Credential Response.
	Enc string `json:"enc"`

	// Object containing a single public key as a JWK used for encrypting the Credential Response.
	Jwk string `json:"jwk"`
}

CredentialResponseEncryption containing information for encrypting the Credential Response.

type Flow

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

func NewFlow

func NewFlow(p provider, opts ...Opt) (*Flow, error)

func (*Flow) PerfInfo

func (f *Flow) PerfInfo() *PerfInfo

func (*Flow) Run

func (f *Flow) Run(ctx context.Context) ([]*verifiable.Credential, error)

func (*Flow) Signer

func (f *Flow) Signer() jose.Signer

type FlowType

type FlowType string

type JWTProofBuilder

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

func NewJWTProofBuilder

func NewJWTProofBuilder() *JWTProofBuilder

func (*JWTProofBuilder) Build

func (b *JWTProofBuilder) Build(
	ctx context.Context,
	req *CreateProofRequest,
) (*Proof, error)

func (*JWTProofBuilder) WithCustomProofFn

func (b *JWTProofBuilder) WithCustomProofFn(
	proofFn JWTProofFn,
) *JWTProofBuilder

type JWTProofFn

type JWTProofFn func(
	ctx context.Context,
	req *CreateProofRequest,
) (string, error)

type LDPProofBuilder

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

func NewLDPProofBuilder

func NewLDPProofBuilder() *LDPProofBuilder

func (*LDPProofBuilder) Build

func (b *LDPProofBuilder) Build(
	_ context.Context,
	req *CreateProofRequest,
) (*Proof, error)

type Opt

type Opt func(opts *options)

func WithBatchCredentialIssuance

func WithBatchCredentialIssuance() Opt

func WithClientID

func WithClientID(clientID string) Opt

func WithCredentialConfigurationIDs

func WithCredentialConfigurationIDs(credentialConfigurationIDs []string) Opt

func WithCredentialFilter

func WithCredentialFilter(credentialType string, oidcCredentialFormat vcsverifiable.OIDCFormat) Opt

func WithCredentialOffer

func WithCredentialOffer(credentialOffer string) Opt

func WithEnableDiscoverableClientID

func WithEnableDiscoverableClientID() Opt

func WithFlowType

func WithFlowType(flowType FlowType) Opt

func WithIssuerState

func WithIssuerState(issuerState string) Opt

func WithPin

func WithPin(pin string) Opt

func WithProofBuilder

func WithProofBuilder(proofBuilder ProofBuilder) Opt

func WithRedirectURI

func WithRedirectURI(redirectURI string) Opt

func WithScopes

func WithScopes(scopes []string) Opt

func WithUserLogin

func WithUserLogin(userLogin string) Opt

func WithUserPassword

func WithUserPassword(userPassword string) Opt

func WithWalletDIDIndex

func WithWalletDIDIndex(idx int) Opt

type PerfInfo

type PerfInfo struct {
	GetIssuerCredentialsOIDCConfig time.Duration `json:"vci_get_issuer_credentials_oidc_config"`
	GetAccessToken                 time.Duration `json:"vci_get_access_token"`
	GetCredential                  time.Duration `json:"vci_get_credential"`
	CredentialsAck                 time.Duration `json:"vci_credentials_ack"`
	VcsCIFlowDuration              time.Duration `json:"_vcs_ci_flow_duration"`
}

type Proof

type Proof struct {
	JWT       string `json:"jwt"`
	CWT       string `json:"cwt"`
	ProofType string `json:"proof_type"`
	LdpVp     any    `json:"ldp_vp,omitempty"`
}

type ProofBuilder

type ProofBuilder interface {
	Build(
		ctx context.Context,
		req *CreateProofRequest,
	) (*Proof, error)
}

type ProofClaims

type ProofClaims struct {
	Issuer   string `json:"iss,omitempty" cbor:"1,keyasint"`
	Audience string `json:"aud,omitempty" cbor:"3,keyasint"`
	IssuedAt *int64 `json:"iat,omitempty" cbor:"6,keyasint"`
	Nonce    string `json:"nonce,omitempty" cbor:"10,keyasint"`
}

type TrustRegistry

type TrustRegistry interface {
	ValidateIssuer(
		ctx context.Context,
		issuerDID string,
		issuerDomain string,
		credentialOffers []trustregistry.CredentialOffer,
	) (bool, error)
}

Jump to

Keyboard shortcuts

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