apikey

package
v0.0.0-...-3dc0db1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager provides an API to manage api keys.

func NewManager

func NewManager(db hub.DB) *Manager

NewManager creates a new Manager instance.

func (*Manager) Add

func (m *Manager) Add(ctx context.Context, ak *hub.APIKey) (*hub.APIKey, error)

Add adds the provided api key to the database.

func (*Manager) Check

func (m *Manager) Check(ctx context.Context, apiKeyID, apiKeySecret string) (*hub.CheckAPIKeyOutput, error)

Check checks if the api key provided is valid.

func (*Manager) Delete

func (m *Manager) Delete(ctx context.Context, apiKeyID string) error

Delete deletes the provided api key from the database.

func (*Manager) GetJSON

func (m *Manager) GetJSON(ctx context.Context, apiKeyID string) ([]byte, error)

GetJSON returns the requested api key as a json object.

func (*Manager) GetOwnedByUserJSON

func (m *Manager) GetOwnedByUserJSON(ctx context.Context, p *hub.Pagination) (*hub.JSONQueryResult, error)

GetOwnedByUserJSON returns the api keys belonging to the requesting user as a json array.

func (*Manager) Update

func (m *Manager) Update(ctx context.Context, ak *hub.APIKey) error

Update updates the provided api key in the database.

type ManagerMock

type ManagerMock struct {
	mock.Mock
}

ManagerMock is a mock implementation of the APIKeyManager interface.

func (*ManagerMock) Add

func (m *ManagerMock) Add(ctx context.Context, ak *hub.APIKey) (*hub.APIKey, error)

Add implements the APIKeyManager interface.

func (*ManagerMock) Check

func (m *ManagerMock) Check(ctx context.Context, apiKeyID, apiKeySecret string) (*hub.CheckAPIKeyOutput, error)

Check implements the UserManager interface.

func (*ManagerMock) Delete

func (m *ManagerMock) Delete(ctx context.Context, apiKeyID string) error

Delete implements the APIKeyManager interface.

func (*ManagerMock) GetJSON

func (m *ManagerMock) GetJSON(ctx context.Context, apiKeyID string) ([]byte, error)

GetJSON implements the APIKeyManager interface.

func (*ManagerMock) GetOwnedByUserJSON

func (m *ManagerMock) GetOwnedByUserJSON(ctx context.Context, p *hub.Pagination) (*hub.JSONQueryResult, error)

GetOwnedByUserJSON implements the APIKeyManager interface.

func (*ManagerMock) Update

func (m *ManagerMock) Update(ctx context.Context, ak *hub.APIKey) error

Update implements the APIKeyManager interface.

Jump to

Keyboard shortcuts

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