Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- type Flags
- type Manager
- func (m *Manager) ClientByID(ctx context.Context, clientID uuid.UUID) (c *Client, err error)
- func (m *Manager) CreateClient(ctx context.Context, name string, flags Flags) (c *Client, err error)
- func (m *Manager) CreatePassword(ctx context.Context, clientID uuid.UUID) (raw []byte, err error)
- func (m *Manager) DeleteClientByID(ctx context.Context, clientID uuid.UUID) (err error)
- func (m *Manager) Logger() *zap.Logger
- func (m *Manager) MatchSecret(ctx context.Context, clientID uuid.UUID, rawpass []byte) (ok bool, err error)
- func (m *Manager) SetLogger(logger *zap.Logger) error
- func (m *Manager) SetPasswordManager(pm password.Manager) error
- type SQLStore
- func (s *SQLStore) DeleteClientByID(ctx context.Context, clientID uuid.UUID) (err error)
- func (s *SQLStore) FetchAllClients(ctx context.Context) (gs []*Client, err error)
- func (s *SQLStore) FetchClientByID(ctx context.Context, clientID uuid.UUID) (*Client, error)
- func (s *SQLStore) UpsertClient(ctx context.Context, c *Client) (_ *Client, err error)
- type Store
Constants ¶
View Source
const PasswordLength = 32
Variables ¶
View Source
var ( ErrNilClient = errors.New("client is nil") ErrInvalidClientID = errors.New("client id is invalid") ErrInvalidDeviceID = errors.New("device id is invalid") ErrClientNotFound = errors.New("client is not found") ErrDeviceNotFound = errors.New("device is not found") ErrRelationNotFound = errors.New("relation is not found") ErrRelationAlreadyExists = errors.New("relation already exists") ErrNilDatabase = errors.New("data is nil") ErrNilStore = errors.New("store is nil") ErrNoName = errors.New("name cannot be empty") ErrEmptyEntropy = errors.New("entropy is empty") ErrNilPasswordManager = errors.New("password is nil") ErrDuplicateURL = errors.New("duplicate url") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Name string `db:"name" json:"name"` ID uuid.UUID `db:"id" json:"id"` RegisteredAt time.Time `db:"registered_at" json:"registered_at"` ExpireAt time.Time `db:"expire_at" json:"expire_at"` Flags Flags `db:"flags" json:"flags"` ReturnURLs []url.URL `db:"urls" json:"urls"` sync.RWMutex // contains filtered or unexported fields }
Client represents any external client that interfaces with this API
func (*Client) IsConfidential ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) ClientByID ¶
func (*Manager) CreateClient ¶
func (*Manager) CreatePassword ¶
func (*Manager) DeleteClientByID ¶
func (*Manager) MatchSecret ¶
type SQLStore ¶
type SQLStore struct {
// contains filtered or unexported fields
}
func (*SQLStore) DeleteClientByID ¶
func (*SQLStore) FetchAllClients ¶
func (*SQLStore) FetchClientByID ¶
type Store ¶
type Store interface { UpsertClient(ctx context.Context, c *Client) (*Client, error) FetchClientByID(ctx context.Context, clientID uuid.UUID) (c *Client, err error) FetchAllClients(ctx context.Context) (cs []*Client, err error) DeleteClientByID(ctx context.Context, clientID uuid.UUID) error }
func NewMemoryStore ¶
func NewMemoryStore() Store
Click to show internal directories.
Click to hide internal directories.