Documentation ¶
Index ¶
- Constants
- Variables
- func DbModels() []interface{}
- func QueryDbModels() []interface{}
- type MessageSignature
- type OpLogPubKey
- type SignatureManager
- type SignatureManagerBase
- func (s *SignatureManagerBase) AttachToErrorManager(errManager generic_error.ErrorManager)
- func (s *SignatureManagerBase) CheckPubKey(ctx op_context.Context, key string) error
- func (s *SignatureManagerBase) Compress(src []byte) []byte
- func (s *SignatureManagerBase) Config() interface{}
- func (s *SignatureManagerBase) Decompress(src []byte) ([]byte, error)
- func (s *SignatureManagerBase) Find(ctx op_context.Context, contextId string) (*MessageSignature, error)
- func (s *SignatureManagerBase) Init(cfg config.Config, log logger.Logger, vld validator.Validator, ...) error
- func (s *SignatureManagerBase) MakeVerifier(ctx op_context.Context, key string) (crypt_utils.EVerifier, error)
- func (s *SignatureManagerBase) SetUserKeyFinder(userKeyFinder func(ctx auth.AuthContext) (UserWithPubkey, error))
- func (s *SignatureManagerBase) Verify(ctx auth.AuthContext, signature string, message []byte, extraData ...string) error
- type SignatureManagerBaseConfig
- type UserWithPubkey
- type WithSignatureManager
Constants ¶
View Source
const ( ErrorCodeInvalidKey string = "invalid_key" ErrorCodeInvalidSignature string = "invalid_signature" )
Variables ¶
View Source
var ErrorDescriptions = map[string]string{ ErrorCodeInvalidSignature: "Invalid signature", ErrorCodeInvalidKey: "Invalid key", }
View Source
var ErrorHttpCodes = map[string]int{ ErrorCodeInvalidSignature: http.StatusUnauthorized, }
Functions ¶
func QueryDbModels ¶
func QueryDbModels() []interface{}
Types ¶
type MessageSignature ¶
type MessageSignature struct { common.ObjectWithMonthBase auth.WithUserBase Context string `gorm:"index;index:,unique,composite:u_month"` Operation string `gorm:"index"` Algorithm string `gorm:"index"` Message string Signature string ExtraData string `gorm:"index"` PubKeyHash string `gorm:"index"` }
type OpLogPubKey ¶
type SignatureManager ¶
type SignatureManager interface { generic_error.ErrorDefinitions Verify(ctx auth.AuthContext, signature string, message []byte, extraData ...string) error CheckPubKey(ctx op_context.Context, key string) error SetUserKeyFinder(userKeyFinder func(ctx auth.AuthContext) (UserWithPubkey, error)) }
type SignatureManagerBase ¶
type SignatureManagerBase struct { SignatureManagerBaseConfig // contains filtered or unexported fields }
func NewSignatureManager ¶
func NewSignatureManager() *SignatureManagerBase
func (*SignatureManagerBase) AttachToErrorManager ¶
func (s *SignatureManagerBase) AttachToErrorManager(errManager generic_error.ErrorManager)
func (*SignatureManagerBase) CheckPubKey ¶
func (s *SignatureManagerBase) CheckPubKey(ctx op_context.Context, key string) error
func (*SignatureManagerBase) Compress ¶
func (s *SignatureManagerBase) Compress(src []byte) []byte
func (*SignatureManagerBase) Config ¶
func (s *SignatureManagerBase) Config() interface{}
func (*SignatureManagerBase) Decompress ¶
func (s *SignatureManagerBase) Decompress(src []byte) ([]byte, error)
func (*SignatureManagerBase) Find ¶
func (s *SignatureManagerBase) Find(ctx op_context.Context, contextId string) (*MessageSignature, error)
func (*SignatureManagerBase) MakeVerifier ¶
func (s *SignatureManagerBase) MakeVerifier(ctx op_context.Context, key string) (crypt_utils.EVerifier, error)
func (*SignatureManagerBase) SetUserKeyFinder ¶
func (s *SignatureManagerBase) SetUserKeyFinder(userKeyFinder func(ctx auth.AuthContext) (UserWithPubkey, error))
func (*SignatureManagerBase) Verify ¶
func (s *SignatureManagerBase) Verify(ctx auth.AuthContext, signature string, message []byte, extraData ...string) error
type UserWithPubkey ¶
type WithSignatureManager ¶
type WithSignatureManager interface {
SignatureManager() SignatureManager
}
Click to show internal directories.
Click to hide internal directories.