bddutil

package
v0.0.0-...-7d48e80 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 27 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreEqualJSON

func AreEqualJSON(b1, b2 []byte) (bool, error)

AreEqualJSON compares if 2 JSON bytes are equal

func CloseResponseBody

func CloseResponseBody(respBody io.Closer)

CloseResponseBody closes the response body.

func CreateCustomPresentation

func CreateCustomPresentation(vcBytes []byte, vdr vdrapi.Registry,
	ldpContext *verifiable.LinkedDataProofContext) ([]byte, error)

CreateCustomPresentation creates verifiable presentation from custom linked data proof context

func DocumentLoader

func DocumentLoader() (*lddocloader.DocumentLoader, error)

DocumentLoader returns a JSON-LD document loader with preloaded test contexts.

func ExpectedStatusCodeError

func ExpectedStatusCodeError(expected, actual int, respBytes []byte) error

ExpectedStatusCodeError formats the status code error message.

func ExpectedStringError

func ExpectedStringError(expected, actual string) error

ExpectedStringError formats the response error message.

func GetCredentialKey

func GetCredentialKey(user string) string

GetCredentialKey key for storing credential.

func GetDIDDocKey

func GetDIDDocKey(user string) string

GetDIDDocKey key for storing did DOC.

func GetIssuerHolderCommKey

func GetIssuerHolderCommKey(issuer, holder string) string

GetIssuerHolderCommKey key for storing data moving between issuer and holder.

func GetOptionsKey

func GetOptionsKey(user string) string

GetOptionsKey key for storing options.

func GetPresentationKey

func GetPresentationKey(user string) string

GetPresentationKey key for storing presentation.

func GetProfileNameKey

func GetProfileNameKey(user string) string

GetProfileNameKey key for storing profile name.

func GetProofChallengeKey

func GetProofChallengeKey(user string) string

GetProofChallengeKey key for storing proof challenge.

func GetProofDomainKey

func GetProofDomainKey(user string) string

GetProofDomainKey key for storing proof domain.

func GetSignatureRepresentation

func GetSignatureRepresentation(holder string) verifiable.SignatureRepresentation

GetSignatureRepresentation parse signature representation

func HTTPDo

func HTTPDo(method, url, contentType, token string, body io.Reader) (*http.Response, error)

HTTPDo send http request

func HTTPSDo

func HTTPSDo(method, url, contentType, token string, body io.Reader, tlsConfig *tls.Config) (*http.Response, error)

HTTPSDo send https request

func IssueAccessToken

func IssueAccessToken(ctx context.Context, oidcProviderURL, clientID, secret string, scopes []string) (string, error)

func ResolveDID

func ResolveDID(vdrRegistry vdrapi.Registry, did string, maxRetry int) (*docdid.Doc, error)

ResolveDID waits for the DID to become available for resolution.

Types

type ProofDataOpts

type ProofDataOpts struct {
	Challenge string
	Domain    string
}

ProofDataOpts for storing proof options.

type Request

type Request interface {
	Invoke() (string, interface{}, error)
}

Request is a request that's submitted to the worker pool for processing.

type Response

type Response struct {
	Request
	Resp         interface{}
	Err          error
	CredentialID string
}

Response is the response for an individual request.

type WorkerPool

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

WorkerPool manages a pool of workers that processes requests concurrently and, at the end, gathers the responses.

func NewWorkerPool

func NewWorkerPool(num int, logger *log.Log) *WorkerPool

NewWorkerPool returns a new worker pool with the given number of workers.

func (*WorkerPool) Responses

func (p *WorkerPool) Responses() []*Response

Responses contains the responses after the pool is stopped.

func (*WorkerPool) Start

func (p *WorkerPool) Start()

Start starts all the workers and listens for responses.

func (*WorkerPool) Stop

func (p *WorkerPool) Stop()

Stop stops the workers in the pool and stops listening for responses.

func (*WorkerPool) Submit

func (p *WorkerPool) Submit(req Request)

Submit submits a request for processing.

Jump to

Keyboard shortcuts

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