Documentation
¶
Index ¶
- Constants
- func ServerCredStoreMigrate(pgconn *pgx.Conn, dbschema string) error
- type PGDB
- type ServerCredStore
- func (self *ServerCredStore) AuthorizationCount(ctx context.Context) (int, error)
- func (self *ServerCredStore) CardCount(ctx context.Context) (int, error)
- func (self *ServerCredStore) ListRealm(ctx context.Context) ([]credentials.Realm, error)
- func (self *ServerCredStore) LoadCard(ctx context.Context, cardId []byte, dst *credentials.ServerCard) error
- func (self *ServerCredStore) LoadRealm(ctx context.Context, realmId []byte, dst *credentials.Realm) error
- func (self *ServerCredStore) PopEnrollAuthorization(ctx context.Context, authorizationId []byte, ...) error
- func (self *ServerCredStore) RemoveCard(ctx context.Context, cardId []byte) bool
- func (self *ServerCredStore) RemoveRealm(ctx context.Context, realmId []byte) error
- func (self *ServerCredStore) SaveCard(ctx context.Context, card credentials.ServerCard) error
- func (self *ServerCredStore) SaveEnrollAuthorization(ctx context.Context, ea credentials.EnrollAuthorization) error
- func (self *ServerCredStore) SaveRealm(ctx context.Context, realm credentials.Realm) error
Constants ¶
const (
// All package errors are wrapping Error
Error = errorFlag("pgdb: error")
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PGDB ¶
type PGDB interface {
Exec(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error)
Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
}
PGDB is implemented by pgx.Tx, pgx.Conn & pgxpool.Pool accessing a postgres database through this common interface simplifies testing
type ServerCredStore ¶
type ServerCredStore struct {
DB PGDB
// contains filtered or unexported fields
}
func NewServerCredStore ¶
func NewServerCredStore(ctx context.Context, dsn string) (*ServerCredStore, error)
func (*ServerCredStore) AuthorizationCount ¶
func (self *ServerCredStore) AuthorizationCount(ctx context.Context) (int, error)
AuthorizationCount returns the number of EnrollAuthorization in the ServerCredStore.
func (*ServerCredStore) CardCount ¶
func (self *ServerCredStore) CardCount(ctx context.Context) (int, error)
CountCard returns the number of ServerCard in the ServerCredStore.
func (*ServerCredStore) ListRealm ¶
func (self *ServerCredStore) ListRealm(ctx context.Context) ([]credentials.Realm, error)
ListRealm lists the Realm in the ServerCredStore. It errors if the ServerCredStore is not reachable.
func (*ServerCredStore) LoadCard ¶
func (self *ServerCredStore) LoadCard(ctx context.Context, cardId []byte, dst *credentials.ServerCard) error
LoadCard loads stored card data in dst. It returns true if card data were successfully loaded.
func (*ServerCredStore) LoadRealm ¶
func (self *ServerCredStore) LoadRealm(ctx context.Context, realmId []byte, dst *credentials.Realm) error
LoadRealm loads realm data for realmId into dst. It errors if realm data were not successfully loaded.
func (*ServerCredStore) PopEnrollAuthorization ¶
func (self *ServerCredStore) PopEnrollAuthorization(ctx context.Context, authorizationId []byte, ea *credentials.EnrollAuthorization) error
PopEnrollAuthorization loads authorization data in ea and remove it from the ServerCredStore. It returns an error if the authorization could not be loaded and removed.
func (*ServerCredStore) RemoveCard ¶
func (self *ServerCredStore) RemoveCard(ctx context.Context, cardId []byte) bool
RemoveCard removes the ServerCard with cardId identifier from the ServerCredStore. It returns true if the ServerCard was effectively removed.
func (*ServerCredStore) RemoveRealm ¶
func (self *ServerCredStore) RemoveRealm(ctx context.Context, realmId []byte) error
RemoveRealm removes the Realm with realmId identifier from the ServerCredStore. It errors if the ServerCredStore is not reachable or if realmId does not exists.
func (*ServerCredStore) SaveCard ¶
func (self *ServerCredStore) SaveCard(ctx context.Context, card credentials.ServerCard) error
SaveCard saves card in the ServerCredStore. It errors if the card could not be saved.
func (*ServerCredStore) SaveEnrollAuthorization ¶
func (self *ServerCredStore) SaveEnrollAuthorization(ctx context.Context, ea credentials.EnrollAuthorization) error
SaveEnrollAuthorization saves ea in the ServerCredStore. It errors if the authorization could not be saved.
func (*ServerCredStore) SaveRealm ¶
func (self *ServerCredStore) SaveRealm(ctx context.Context, realm credentials.Realm) error
SaveRealm saves realm into the ServerCredStore. It errors if realm could not be saved.