api_v1

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

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Maximum time, in seconds, that a request timestamp can differ from the current time.
	MaxTimeSkew = 30.0

	// Length, in bytes, of generated API keys
	KeySize = 32

	SignatureHeader         = "X-NAIS-Signature"
	FailedAuthenticationMsg = "failed authentication"
	DirectDeployGithubTask  = "NAIS_DIRECT_DEPLOY"
)

Variables

This section is empty.

Functions

func GenMAC

func GenMAC(message, key []byte) []byte

GenMAC generates the HMAC signature for a message provided the secret key using SHA256

func ValidateAnyMAC

func ValidateAnyMAC(message, messageMAC []byte, apiKeys []Key) error

func ValidateMAC

func ValidateMAC(message, messageMAC, key []byte) bool

ValidateMAC reports whether messageMAC is a valid HMAC tag for message.

Types

type ClusterList

type ClusterList []string

func (ClusterList) Contains

func (c ClusterList) Contains(cluster string) error

type Key

type Key []byte

func Keygen

func Keygen(length int) (Key, error)

Generate a cryptographically secure random key of N length.

func (Key) MarshalJSON

func (k Key) MarshalJSON() ([]byte, error)

func (Key) String

func (k Key) String() string

func (*Key) UnmarshalJSON

func (k *Key) UnmarshalJSON(b []byte) error

type Timestamp

type Timestamp int64

func (Timestamp) Validate

func (t Timestamp) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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