Documentation ¶
Index ¶
- Constants
- Variables
- func FindUserPubKey[T UserPubkeyI](ctrl PubkeyController[T], ctx auth.AuthContext) (signature.UserWithPubkey, error)
- func ListPubkeys[T UserPubkeyI](crud crud.CRUD, ctx op_context.Context, filter *db.Filter, ...) ([]T, int64, error)
- func NewOplog() *signature.OpLogPubKey
- type PubkeyController
- type PubkeyControllerBase
- func (p *PubkeyControllerBase[T, U]) AddPubKey(ctx op_context.Context, userId string, key string, idIsLogin ...bool) (string, error)
- func (p *PubkeyControllerBase[T, U]) AttachToErrorManager(errManager generic_error.ErrorManager)
- func (p *PubkeyControllerBase[T, U]) CRUD() crud.CRUD
- func (p *PubkeyControllerBase[T, U]) DeactivatePubKey(ctx op_context.Context, userId string, keyId string, idIsLogin ...bool) error
- func (p *PubkeyControllerBase[T, U]) FindActivePubKey(ctx op_context.Context, userId string, idIsLogin ...bool) (T, error)
- func (p *PubkeyControllerBase[T, U]) ListPubKeys(ctx op_context.Context, filter *db.Filter) ([]T, int64, error)
- func (p *PubkeyControllerBase[T, U]) OpLog(ctx op_context.Context, op string, userId string, login string, keyId string, ...)
- func (p *PubkeyControllerBase[T, U]) SetUserFinder(userFinder user.UserFinder[U])
- type PubkeyData
- type PubkeyEssentials
- type PubkeyI
- type UserPubkey
- type UserPubkeyI
Constants ¶
View Source
const ( ErrorCodeDuplicateKey string = "duplicate_pubkey" ErrorCodeActiveKeyNotFound string = "active_pubkey_not_found" )
Variables ¶
View Source
var ErrorDescriptions = map[string]string{ ErrorCodeDuplicateKey: "Duplicate key already loaded", ErrorCodeActiveKeyNotFound: "Active public key not found", }
View Source
var ErrorHttpCodes = map[string]int{ ErrorCodeActiveKeyNotFound: http.StatusUnauthorized, }
Functions ¶
func FindUserPubKey ¶
func FindUserPubKey[T UserPubkeyI](ctrl PubkeyController[T], ctx auth.AuthContext) (signature.UserWithPubkey, error)
func ListPubkeys ¶
func ListPubkeys[T UserPubkeyI](crud crud.CRUD, ctx op_context.Context, filter *db.Filter, keyModel UserPubkeyI, userModel user.User, destModel T, queryName string) ([]T, int64, error)
func NewOplog ¶
func NewOplog() *signature.OpLogPubKey
Types ¶
type PubkeyController ¶
type PubkeyController[T UserPubkeyI] interface { AddPubKey(ctx op_context.Context, userId string, key string, idIsLogin ...bool) (string, error) DeactivatePubKey(ctx op_context.Context, userId string, keyId string, idIsLogin ...bool) error FindActivePubKey(ctx op_context.Context, userId string, idIsLogin ...bool) (T, error) }
type PubkeyControllerBase ¶
type PubkeyControllerBase[T UserPubkeyI, U user.User] struct { // contains filtered or unexported fields }
func NewPubkeyController ¶
func NewPubkeyController[T UserPubkeyI, U user.User](objectBuilder func() T, signatureManager signature.SignatureManager, userFinder user.UserFinder[U], cruds ...crud.CRUD) *PubkeyControllerBase[T, U]
func (*PubkeyControllerBase[T, U]) AddPubKey ¶
func (p *PubkeyControllerBase[T, U]) AddPubKey(ctx op_context.Context, userId string, key string, idIsLogin ...bool) (string, error)
func (*PubkeyControllerBase[T, U]) AttachToErrorManager ¶
func (p *PubkeyControllerBase[T, U]) AttachToErrorManager(errManager generic_error.ErrorManager)
func (*PubkeyControllerBase[T, U]) CRUD ¶
func (p *PubkeyControllerBase[T, U]) CRUD() crud.CRUD
func (*PubkeyControllerBase[T, U]) DeactivatePubKey ¶
func (p *PubkeyControllerBase[T, U]) DeactivatePubKey(ctx op_context.Context, userId string, keyId string, idIsLogin ...bool) error
func (*PubkeyControllerBase[T, U]) FindActivePubKey ¶
func (p *PubkeyControllerBase[T, U]) FindActivePubKey(ctx op_context.Context, userId string, idIsLogin ...bool) (T, error)
func (*PubkeyControllerBase[T, U]) ListPubKeys ¶
func (p *PubkeyControllerBase[T, U]) ListPubKeys(ctx op_context.Context, filter *db.Filter) ([]T, int64, error)
func (*PubkeyControllerBase[T, U]) OpLog ¶
func (p *PubkeyControllerBase[T, U]) OpLog(ctx op_context.Context, op string, userId string, login string, keyId string, keyHash string)
func (*PubkeyControllerBase[T, U]) SetUserFinder ¶
func (p *PubkeyControllerBase[T, U]) SetUserFinder(userFinder user.UserFinder[U])
type PubkeyData ¶
type PubkeyData struct {
PublicKey string `json:"public_key" validate:"required" vmessage:"Public key must be set in request." display:"Key"`
}
type PubkeyEssentials ¶
type PubkeyEssentials struct { PubkeyData PublicKeyHash string `json:"public_key_hash" gorm:"index;index:,unique,composite:u" display:"Hash"` PublicKeyOwner string `json:"public_key_owner" gorm:"index;index:,unique,composite:u" display:"Owner ID"` }
type UserPubkey ¶
type UserPubkey struct { common.ObjectBase common.WithActiveBase PubkeyEssentials }
func (*UserPubkey) PubKey ¶
func (u *UserPubkey) PubKey() string
func (*UserPubkey) PubKeyHash ¶
func (u *UserPubkey) PubKeyHash() string
func (*UserPubkey) PubKeyOwner ¶
func (u *UserPubkey) PubKeyOwner() string
func (*UserPubkey) SetPubKey ¶
func (u *UserPubkey) SetPubKey(key string)
func (*UserPubkey) SetPubKeyHash ¶
func (u *UserPubkey) SetPubKeyHash(hash string)
func (*UserPubkey) SetPubKeyOwner ¶
func (u *UserPubkey) SetPubKeyOwner(owner string)
type UserPubkeyI ¶
Click to show internal directories.
Click to hide internal directories.