interceptor

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MPL-2.0 Imports: 15 Imported by: 5

Documentation

Overview

Package interceptor provides a GRPC client interceptor that signs requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthEnabledFunc

type AuthEnabledFunc func(ctx context.Context, cc *grpc.ClientConn) (bool, error)

AuthEnabledFunc is called once to determine if auth is enabled.

type Interceptor added in v0.3.0

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

Interceptor is a GRPC interceptor that provides Unary and Stream client interceptors.

func New added in v0.3.0

func New(options Options) *Interceptor

New creates a new client interceptor.

func (*Interceptor) Stream added in v0.3.0

Stream returns a new streaming client interceptor which signs requests.

func (*Interceptor) Unary added in v0.3.0

Unary returns a new unary client interceptor which signs requests.

type Options added in v0.3.0

type Options struct {
	InfoWriter       io.Writer
	AuthEnabledFunc  AuthEnabledFunc
	GetUserKeyFunc   UserKeyFunc
	RenewUserKeyFunc UserKeyFunc

	UserKeyProvider *client.KeyProvider

	ContextName string
	Identity    string
	ClientName  string

	// ServiceAccountBase64 is a static service account key in base64 format.
	// When specified, ContextName and Identity are ignored and retries are never attempted.
	ServiceAccountBase64 string
}

Options are the options for the interceptor.

type SkipInterceptorContextKey

type SkipInterceptorContextKey struct{}

SkipInterceptorContextKey is a context key used to skip interceptor to avoid infinite recursion.

type UserKeyFunc added in v0.3.0

type UserKeyFunc func(ctx context.Context, cc *grpc.ClientConn, options *Options) (message.Signer, error)

UserKeyFunc is a function that is called to read the initial user (non-service-account) key.

Jump to

Keyboard shortcuts

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