-
Notifications
You must be signed in to change notification settings - Fork 19
/
empty_store.go
41 lines (29 loc) · 1 KB
/
empty_store.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package v1
import (
"context"
"errors"
"code.vegaprotocol.io/vega/wallet/service/v2/connections"
)
var ErrSavingTokenIsDisabled = errors.New("saving tokens is disabled")
// EmptyStore can be used to disable the support for long-living API tokens.
type EmptyStore struct{}
func (e EmptyStore) TokenExists(_ connections.Token) (bool, error) {
return false, nil
}
func (e EmptyStore) ListTokens() ([]connections.TokenSummary, error) {
return []connections.TokenSummary{}, nil
}
func (e EmptyStore) DescribeToken(_ connections.Token) (connections.TokenDescription, error) {
return connections.TokenDescription{}, ErrTokenDoesNotExist
}
func (e EmptyStore) SaveToken(_ connections.TokenDescription) error {
return ErrSavingTokenIsDisabled
}
func (e EmptyStore) DeleteToken(_ connections.Token) error {
return ErrTokenDoesNotExist
}
func (e EmptyStore) OnUpdate(_ func(context.Context, ...connections.TokenDescription)) {}
func (e EmptyStore) Close() {}
func NewEmptyStore() *EmptyStore {
return &EmptyStore{}
}