apikey

package
v1.17.7-rc-3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSecret = errs.Class("no apikey error")

ErrNoSecret represents errors from the apikey database.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	// Secret is PK of the table and keeps unique value sno apikey token
	Secret Secret

	CreatedAt time.Time `json:"createdAt"`
}

APIKey describing apikey model in the database.

type DB

type DB interface {
	// Store stores apikey token into db.
	Store(ctx context.Context, secret APIKey) error

	// Check checks if unique apikey exists in db by token.
	Check(ctx context.Context, token Secret) error

	// Revoke removes token from db.
	Revoke(ctx context.Context, token Secret) error
}

DB is interface for working with apikey tokens.

architecture: Database

type Secret

type Secret [32]byte

Secret stores token of storagenode APIkey.

func NewSecretToken

func NewSecretToken() (Secret, error)

NewSecretToken creates new apikey token.

func TokenSecretFromBase64

func TokenSecretFromBase64(s string) (Secret, error)

TokenSecretFromBase64 creates new apikey token from base64 string.

func (Secret) IsZero

func (secret Secret) IsZero() bool

IsZero returns if the apikey token is not set.

func (Secret) String

func (secret Secret) String() string

String implements Stringer.

Jump to

Keyboard shortcuts

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