common

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Page

type Page struct {
	// A storage dependent way of communicating the page to be retrieved. Empty string means the first page.
	Token string

	// A value of -1 means retrieval of all pages.
	Size int
}

func (*Page) ToStorageArgs

func (page *Page) ToStorageArgs() (string, int)

type Request

type Request struct {
	// ID for this request. It matches the "jti" claim in the JWT.
	// This is an output only field.
	ID string `json:"id,omitempty"`

	// Audience as defined in https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.3.
	Audience []string `json:"audience,omitempty"`

	// Expiration as defined in https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.4
	Expiration time.Time `json:"expiration" validate:"required"`

	// DID of the issuer of this presentation definition.
	IssuerDID string `json:"issuerId" validate:"required"`

	// The privateKey associated with the KID used to sign the JWT.
	IssuerKID string `json:"issuerKid" validate:"required"`
}

func ToServiceModel

func ToServiceModel(stored *StoredRequest) (*Request, error)

ToServiceModel converts a storage model to a service model.

type RequestStorage

type RequestStorage interface {
	StoreRequest(context.Context, StoredRequest) error
	GetRequest(context.Context, string) (*StoredRequest, error)
	ListRequests(context.Context) ([]StoredRequest, error)
	DeleteRequest(context.Context, string) error
}

func NewRequestStorage

func NewRequestStorage(db storage.ServiceStorage, namespace string) RequestStorage

type StoredRequest

type StoredRequest struct {
	ID          string   `json:"id"`
	Audience    []string `json:"audience"`
	Expiration  string   `json:"expiration"`
	IssuerDID   string   `json:"issuerId"`
	IssuerKID   string   `json:"issuerKid"`
	ReferenceID string   `json:"referenceId"`
	JWT         string   `json:"jwt"`
}

func CreateStoredRequest

func CreateStoredRequest(ctx context.Context, keyStore *keystore.Service, claimName string, claimValue any, request Request, id string) (*StoredRequest, error)

CreateStoredRequest creates a StoredRequest with the associated signed JWT populated. In addition to the fields present in request, the JWT will also include a claim with claimName and claimValue.

Jump to

Keyboard shortcuts

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