apikey

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: GPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyAPIKey                           = errors.New("empty API key")
	ErrFailedToSetMetadataAuthorizationToken = errors.New("failed to set metadata authorization token")
)

Functions

This section is empty.

Types

type Interceptor

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

Interceptor is the interceptor for the authentication

func NewInterceptor

func NewInterceptor(
	methodsToIntercept []string,
	apiKey string,
	logger *slog.Logger,
) (*Interceptor, error)

NewInterceptor creates a new authentication interceptor

Parameters:

  • methodsToIntercept: a slice of method names to intercept
  • apiKey: the API key to use for authentication
  • logger: the logger to use for logging

Returns:

  • *Interceptor: the interceptor
  • error: an error if the interceptions map is nil

func (Interceptor) Authenticate

func (i Interceptor) Authenticate() grpc.UnaryClientInterceptor

Authenticate creates a gRPC unary client interceptor for authentication

Returns:

  • grpc.UnaryClientInterceptor: the interceptor

Jump to

Keyboard shortcuts

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