lib

package
v0.0.6-beta Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password string, hashedPassword string) error

func GenerateClientToken

func GenerateClientToken(n int) (string, error)

func HashPassword

func HashPassword(password string) (string, error)

Types

type Auth

type Auth interface {
	Issue(context.Context, ClaimProps) (*string, error)
	Verify(context.Context, string) (*Claims, error)
}

func NewAuthSigningMetadata

func NewAuthSigningMetadata(c *Client) (Auth, error)

type ClaimProps

type ClaimProps struct {
	Subject         uuid.UUID
	Permission      string
	ValidForMinutes int64
}

type Claims

type Claims struct {
	Permission string    `json:"permission"`
	Subject    uuid.UUID `json:"sub"`
	IssuedAt   time.Time `json:"iss"`
	ExpiresAt  time.Time `json:"exp"`
	NotBefore  time.Time `json:"not_before"`
}

func (*Claims) Valid

func (c *Claims) Valid() error

type Client

type Client struct {
	KmsClient        KmsClientIface
	KeyId            string
	SigningAlgorithm string
}

func BuildSigningClient

func BuildSigningClient(config *config.Config) (*Client, error)
type Header struct {
	Algorithm string
	Type      string
	KeyId     string
}

type KmsClientIface

type KmsClientIface interface {
	Sign(ctx context.Context, params *kms.SignInput, optFns ...func(*kms.Options)) (*kms.SignOutput, error)
	Verify(ctx context.Context, params *kms.VerifyInput, optFns ...func(*kms.Options)) (*kms.VerifyOutput, error)
}

Jump to

Keyboard shortcuts

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