contextutil

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrSelfNotFound must be used when self value is not found in the context
	ErrSelfNotFound = errors.Error("self value not found in the context")

	// ErrDIDMissingFromContext sentinel error when did is missing from the context.
	ErrDIDMissingFromContext = errors.Error("failed to extract did from context")
)

Variables

This section is empty.

Functions

func Account

func Account(ctx context.Context) (config.Account, error)

Account extracts the TenantConfig from the given context value

func AccountDID

func AccountDID(ctx context.Context) (identity.DID, error)

AccountDID extracts the AccountConfig DID from the given context value

func Context

func Context(ctx context.Context, cs config.Service) (context.Context, error)

Context updates a context with account info using the configstore, must only be used for api handlers

func DIDFromContext added in v1.0.0

func DIDFromContext(ctx context.Context) (did identity.DID, err error)

DIDFromContext returns did from the context.

func New

New creates new instance of the request headers. TODO(ved): this doesn't deserve to be here. Causes too many implicit requirements

func WithAccount added in v1.3.0

func WithAccount(ctx context.Context, cfg config.Account) context.Context

WithAccount sets config to the context and returns it

Types

This section is empty.

Jump to

Keyboard shortcuts

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