user_pubkey

package
v0.0.0-...-8122643 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

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",
}

Functions

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 PubkeyI

type PubkeyI interface {
	PubKey() string
	PubKeyHash() string
	SetPubKey(key string)
	SetPubKeyHash(hash string)
}

type UserPubkey

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

type UserPubkeyI interface {
	common.Object
	common.WithActive
	PubkeyI
	PubKeyOwner() string
	SetPubKeyOwner(hash string)
}

Jump to

Keyboard shortcuts

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