common

package
v0.0.0-...-ef7a112 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateVerificationMethodID

func ValidateVerificationMethodID(fullyQualifiedVerificationMethodID, issuerID string) error

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,omitempty"`

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

	// The id of the verificationMethod (see https://www.w3.org/TR/did-core/#verification-methods) who's privateKey is
	// stored in onchain-access-control. The verificationMethod must be part of the did document associated with `issuer`.
	// The private key associated with the verificationMethod's publicKey will be used to sign the JWT.
	VerificationMethodID string `` /* 163-byte string literal not displayed */

	// The URL that the presenter should be submitting the presentation submission to.
	// Optional.
	CallbackURL string `json:"callbackUrl,omitempty" example:"https://example.com"`
}

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"`
	VerificationMethodID string   `json:"verificationMethodId"`
	ReferenceID          string   `json:"referenceId"`
	JWT                  string   `json:"jwt"`
	CallbackURL          string   `json:"callbackUrl"`
}

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