tir

package
v0.0.0-...-f2ba1b1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package tir2 provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.13.0 DO NOT EDIT.

Index

Constants

View Source
const DID_V4_Path = "v4/identifiers"
View Source
const ISSUERS_V3_PATH = "v3/issuers"
View Source
const ISSUERS_V4_PATH = "v4/issuers"
View Source
const SCOPE_TIR_READ = "tir_read"
View Source
const TirEndpointsCache = "tirEndpoints"
View Source
const WELL_KNOWN_ENDPOINT = "/.well-known/openid-configuration"

Variables

View Source
var ErrorBadPrivateKey = errors.New("bad_private_key_length")
View Source
var ErrorCachedOpenidMetadataNotFound = errors.New("cached_openid_metadata_not_found")
View Source
var ErrorGrantTypeNotSupported = errors.New("grant_type_not_supported")
View Source
var ErrorMetaDataNotOk = errors.New("no_metadata_available")
View Source
var ErrorScopeNotSupported = errors.New("scope_not_supported")
View Source
var ErrorTirEmptyResponse = errors.New("empty_response_from_tir")
View Source
var ErrorTirNoResponse = errors.New("no_response_from_tir")
View Source
var ErrorTokenEndpointNoResponse = errors.New("no_response_from_token_endpoint")

http client to be used

View Source
var ErrorTokenProviderNoDid = errors.New("no_did_configured")
View Source
var ErrorTokenProviderNoKey = errors.New("no_key_configured")
View Source
var ErrorTokenProviderNoVC = errors.New("no_vc_configured")
View Source
var ErrorTokenProviderNoVerificationMethod = errors.New("no_verification_method_configured")

Functions

func NewGetDIDDocumentRequest

func NewGetDIDDocumentRequest(server string, did Did, params *GetDIDDocumentParams) (*http.Request, error)

NewGetDIDDocumentRequest generates requests for GetDIDDocument

Types

type AuthorizingHttpClient

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

func (AuthorizingHttpClient) FillMetadataCache

func (ac AuthorizingHttpClient) FillMetadataCache(context.Context)

func (AuthorizingHttpClient) Get

func (ac AuthorizingHttpClient) Get(tirAddress string, tirPath string) (resp *http.Response, err error)

type Base64TokenEncoder

type Base64TokenEncoder struct{}

func (Base64TokenEncoder) GetEncodedToken

func (base64TokenEncoder Base64TokenEncoder) GetEncodedToken(vc *verifiable.Presentation, audience string) (encodedToken string, err error)

type Claim

type Claim struct {
	Name          string        `json:"name"`
	AllowedValues []interface{} `json:"allowedValues"`
}

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetDIDDocument

func (c *Client) GetDIDDocument(ctx context.Context, did Did, params *GetDIDDocumentParams, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetDIDDocument request
	GetDIDDocument(ctx context.Context, did Did, params *GetDIDDocumentParams, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) GetDIDDocumentWithResponse

func (c *ClientWithResponses) GetDIDDocumentWithResponse(ctx context.Context, did Did, params *GetDIDDocumentParams, reqEditors ...RequestEditorFn) (*GetDIDDocumentResponse, error)

GetDIDDocumentWithResponse request returning *GetDIDDocumentResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetDIDDocument request
	GetDIDDocumentWithResponse(ctx context.Context, did Did, params *GetDIDDocumentParams, reqEditors ...RequestEditorFn) (*GetDIDDocumentResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type Credential

type Credential struct {
	ValidFor        TimeRange `json:"validFor"`
	CredentialsType string    `json:"credentialsType"`
	Claims          []Claim   `json:"claims"`
}

* * Configuration of a credentialType, its validity time and the claims allowed to be issued

type DIDDocument

type DIDDocument struct {
	// Context Context used for describing the document
	Context            []string                               `json:"@context"`
	Id                 string                                 `json:"id"`
	VerificationMethod *[]DIDDocument_VerificationMethod_Item `json:"verificationMethod,omitempty"`
}

DIDDocument defines model for DIDDocument.

type DIDDocument_VerificationMethod_Item

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

DIDDocument_VerificationMethod_Item defines model for DIDDocument.verificationMethod.Item.

func (DIDDocument_VerificationMethod_Item) AsJsonWebKey2020VerificationMethod

func (t DIDDocument_VerificationMethod_Item) AsJsonWebKey2020VerificationMethod() (JsonWebKey2020VerificationMethod, error)

AsJsonWebKey2020VerificationMethod returns the union data inside the DIDDocument_VerificationMethod_Item as a JsonWebKey2020VerificationMethod

func (DIDDocument_VerificationMethod_Item) AsRsaVerificationKey2018VerificationMethod

func (t DIDDocument_VerificationMethod_Item) AsRsaVerificationKey2018VerificationMethod() (RsaVerificationKey2018VerificationMethod, error)

AsRsaVerificationKey2018VerificationMethod returns the union data inside the DIDDocument_VerificationMethod_Item as a RsaVerificationKey2018VerificationMethod

func (DIDDocument_VerificationMethod_Item) Discriminator

func (t DIDDocument_VerificationMethod_Item) Discriminator() (string, error)

func (*DIDDocument_VerificationMethod_Item) FromJsonWebKey2020VerificationMethod

func (t *DIDDocument_VerificationMethod_Item) FromJsonWebKey2020VerificationMethod(v JsonWebKey2020VerificationMethod) error

FromJsonWebKey2020VerificationMethod overwrites any union data inside the DIDDocument_VerificationMethod_Item as the provided JsonWebKey2020VerificationMethod

func (*DIDDocument_VerificationMethod_Item) FromRsaVerificationKey2018VerificationMethod

func (t *DIDDocument_VerificationMethod_Item) FromRsaVerificationKey2018VerificationMethod(v RsaVerificationKey2018VerificationMethod) error

FromRsaVerificationKey2018VerificationMethod overwrites any union data inside the DIDDocument_VerificationMethod_Item as the provided RsaVerificationKey2018VerificationMethod

func (DIDDocument_VerificationMethod_Item) MarshalJSON

func (t DIDDocument_VerificationMethod_Item) MarshalJSON() ([]byte, error)

func (*DIDDocument_VerificationMethod_Item) MergeJsonWebKey2020VerificationMethod

func (t *DIDDocument_VerificationMethod_Item) MergeJsonWebKey2020VerificationMethod(v JsonWebKey2020VerificationMethod) error

MergeJsonWebKey2020VerificationMethod performs a merge with any union data inside the DIDDocument_VerificationMethod_Item, using the provided JsonWebKey2020VerificationMethod

func (*DIDDocument_VerificationMethod_Item) MergeRsaVerificationKey2018VerificationMethod

func (t *DIDDocument_VerificationMethod_Item) MergeRsaVerificationKey2018VerificationMethod(v RsaVerificationKey2018VerificationMethod) error

MergeRsaVerificationKey2018VerificationMethod performs a merge with any union data inside the DIDDocument_VerificationMethod_Item, using the provided RsaVerificationKey2018VerificationMethod

func (*DIDDocument_VerificationMethod_Item) UnmarshalJSON

func (t *DIDDocument_VerificationMethod_Item) UnmarshalJSON(b []byte) error

func (DIDDocument_VerificationMethod_Item) ValueByDiscriminator

func (t DIDDocument_VerificationMethod_Item) ValueByDiscriminator() (interface{}, error)

type Did

type Did = string

Did defines model for Did.

type GetDIDDocumentParams

type GetDIDDocumentParams struct {
	// ValidAt This option is used to get a the version in the past of a DID document. It must be a date in ISO-8601 format
	ValidAt *ValidAt `form:"valid-at,omitempty" json:"valid-at,omitempty"`
}

GetDIDDocumentParams defines parameters for GetDIDDocument.

type GetDIDDocumentResponse

type GetDIDDocumentResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *DIDDocument
	JSON400      *ProblemDetails
	JSON404      *ProblemDetails
	JSON500      *ProblemDetails
}

func ParseGetDIDDocumentResponse

func ParseGetDIDDocumentResponse(rsp *http.Response) (*GetDIDDocumentResponse, error)

ParseGetDIDDocumentResponse parses an HTTP response from a GetDIDDocumentWithResponse call

func (GetDIDDocumentResponse) Status

func (r GetDIDDocumentResponse) Status() string

Status returns HTTPResponse.Status

func (GetDIDDocumentResponse) StatusCode

func (r GetDIDDocumentResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpClient

type HttpClient interface {
	Get(url string) (resp *http.Response, err error)
	Do(req *http.Request) (*http.Response, error)
}

type HttpGetClient

type HttpGetClient interface {
	Get(tirAddress string, tirPath string) (resp *http.Response, err error)
}

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type IssuerAttribute

type IssuerAttribute struct {
	Hash       string `json:"hash"`
	Body       string `json:"body"`
	IssuerType string `json:"issuerType"`
	Tao        string `json:"tao"`
	RootTao    string `json:"rootTao"`
}

* * Attribute of an issuer

type JWK

type JWK struct {
	Alg *string   `json:"alg,omitempty"`
	E   *string   `json:"e,omitempty"`
	Kid *string   `json:"kid,omitempty"`
	Kty *string   `json:"kty,omitempty"`
	N   *string   `json:"n,omitempty"`
	Use *string   `json:"use,omitempty"`
	X5c *[]string `json:"x5c,omitempty"`
	X5u *string   `json:"x5u,omitempty"`
}

JWK defines model for JWK.

type JsonWebKey2020VerificationMethod

type JsonWebKey2020VerificationMethod struct {
	Controller   *string `json:"controller,omitempty"`
	Id           *string `json:"id,omitempty"`
	PublicKeyJwk *JWK    `json:"publicKeyJwk,omitempty"`
	Type         *string `json:"type,omitempty"`
}

JsonWebKey2020VerificationMethod defines model for JsonWebKey2020VerificationMethod.

type M2MTokenProvider

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

func (M2MTokenProvider) GetAuthCredential

func (tokenProvider M2MTokenProvider) GetAuthCredential() (vc *verifiable.Credential, err error)

func (M2MTokenProvider) GetToken

func (tokenProvider M2MTokenProvider) GetToken(vc *verifiable.Credential, audience string) (token string, err error)

type NoAuthHttpClient

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

func (NoAuthHttpClient) Get

func (nac NoAuthHttpClient) Get(tirAddress string, tirPath string) (resp *http.Response, err error)

type ProblemDetails

type ProblemDetails struct {
	// Detail A human readable explanation specific to this occurrence of the problem.
	Detail *string `json:"detail,omitempty"`

	// Instance An absolute URI that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
	Instance *string `json:"instance,omitempty"`

	// Status The HTTP status code generated by the origin server for this occurrence of the problem.
	Status *float32 `json:"status,omitempty"`

	// Title A short summary of the problem type.
	Title *string `json:"title,omitempty"`

	// Type An absolute URI that identifies the problem type. When dereferenced, it SHOULD provide human-readable documentation for the problem type.
	Type *string `json:"type,omitempty"`
}

ProblemDetails defines model for ProblemDetails.

type RS256Signer

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

RS256Signer is a Jose complient signer.

func NewRS256Signer

func NewRS256Signer(privKey *rsa.PrivateKey) *RS256Signer

NewRS256Signer creates RS256Signer.

func (RS256Signer) Sign

func (s RS256Signer) Sign(data []byte) ([]byte, error)

Sign data.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type RsaVerificationKey2018VerificationMethod

type RsaVerificationKey2018VerificationMethod struct {
	Controller   *string `json:"controller,omitempty"`
	Id           *string `json:"id,omitempty"`
	PublicKeyJwk *JWK    `json:"publicKeyJwk,omitempty"`
	Type         *string `json:"type,omitempty"`
}

RsaVerificationKey2018VerificationMethod defines model for RsaVerificationKey2018VerificationMethod.

type TimeRange

type TimeRange struct {
	From string `json:"from"`
	To   string `json:"to"`
}

type TirClient

type TirClient interface {
	IsTrustedParticipant(tirEndpoints []string, did string) (trusted bool)
	GetTrustedIssuer(tirEndpoints []string, did string) (exists bool, trustedIssuer TrustedIssuer, err error)
}

func NewTirHttpClient

func NewTirHttpClient(tokenProvider TokenProvider, config config.M2M) (client TirClient, err error)

type TirHttpClient

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

* * A client to retrieve infromation from EBSI-compatible TrustedIssuerRegistry APIs.

func (TirHttpClient) GetTrustedIssuer

func (tc TirHttpClient) GetTrustedIssuer(tirEndpoints []string, did string) (exists bool, trustedIssuer TrustedIssuer, err error)

func (TirHttpClient) IsTrustedParticipant

func (tc TirHttpClient) IsTrustedParticipant(tirEndpoints []string, did string) (trusted bool)

type TokenEncoder

type TokenEncoder interface {
	GetEncodedToken(vp *verifiable.Presentation, audience string) (encodedToken string, err error)
}

type TokenProvider

type TokenProvider interface {
	GetToken(vc *verifiable.Credential, audience string) (string, error)
	GetAuthCredential() (vc *verifiable.Credential, err error)
}

func InitM2MTokenProvider

func InitM2MTokenProvider(config *configModel.Configuration, clock common.Clock) (tokenProvider TokenProvider, err error)

type TokenResponse

type TokenResponse struct {
	TokenType string `json:"token_type,omitempty"`

	// The lifetime in seconds of the access token
	ExpiresIn float32 `json:"expires_in,omitempty"`

	AccessToken string `json:"access_token,omitempty"`

	// The scope of the access token
	Scope string `json:"scope,omitempty"`
	// ID Token value associated with the authenticated session. Presents client's identity. ID Token is issued in a JWS format. See also the \"ID Token\" schema definition.
	IdToken string `json:"id_token,omitempty"`
}

type TrustedIssuer

type TrustedIssuer struct {
	Did        string            `json:"did"`
	Attributes []IssuerAttribute `json:"attributes"`
}

* * A trusted issuer as defined by EBSI

type ValidAt

type ValidAt = openapi_types.Date

ValidAt defines model for ValidAt.

type VerificationMethod

type VerificationMethod struct {
	Id   *string `json:"id,omitempty"`
	Type *string `json:"type,omitempty"`
}

VerificationMethod defines model for VerificationMethod.

Jump to

Keyboard shortcuts

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