contextutil

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 6 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")

	// ErrNonceNotFound must be used when nonce value is not found in context
	ErrNonceNotFound = errors.Error("nonce 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 Copy added in v1.0.0

func Copy(ctx context.Context) context.Context

Copy creates a copy of the given context with relevant values

func DIDFromContext added in v1.0.0

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

DIDFromContext returns did from the context.

func Job

func Job(ctx context.Context) jobs.JobID

Job returns current jobID

func New

New creates new instance of the request headers.

func Nonce added in v1.0.0

func Nonce(ctx context.Context) (uint32, error)

Nonce extracts the nonce value from the given context

func WithJob

func WithJob(ctx context.Context, jobID jobs.JobID) context.Context

WithJob returns a context with Job ID

func WithNonce added in v1.0.0

func WithNonce(ctx context.Context, n uint32) context.Context

WithNonce returns a context with Nonce value

Types

This section is empty.

Jump to

Keyboard shortcuts

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