services

package
v1.5.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SecKeyPair    = "keyPair"
	TokenExpHours = 24 * 7 // 1 week
)
View Source
const PunqAdminIdKey = "admin_id"

Variables

This section is empty.

Functions

func AddContext

func AddContext(ctx dtos.PunqContext) (*dtos.PunqContext, error)

func AddUser

func AddUser(userCreateInput dtos.PunqUserCreateInput) (*dtos.PunqUser, error)

func CreateAdminUser added in v1.2.0

func CreateAdminUser()

func CreateUserSecret added in v1.2.0

func CreateUserSecret()

func DeleteContext

func DeleteContext(id string) (interface{}, error)

func DeleteUser

func DeleteUser(id string) error

func GenerateToken added in v1.2.0

func GenerateToken(user *dtos.PunqUser) (*dtos.PunqToken, error)

func GetAdmin

func GetAdmin() (*dtos.PunqUser, error)

func GetContext

func GetContext(id string) (*dtos.PunqContext, error)

func GetGinContextId added in v1.2.1

func GetGinContextId(c *gin.Context) *string

func GetGinContextUser added in v1.2.1

func GetGinContextUser(c *gin.Context) *dtos.PunqUser

func GetOwnContext

func GetOwnContext() (*dtos.PunqContext, error)

func GetUser

func GetUser(id string) (*dtos.PunqUser, error)

func GetUserByEmail added in v1.2.0

func GetUserByEmail(email string) (*dtos.PunqUser, error)

func InitAuthService added in v1.2.0

func InitAuthService()

func InitUserService added in v1.2.0

func InitUserService()

func ListContexts

func ListContexts() []dtos.PunqContext

func ListUsers

func ListUsers() []dtos.PunqUser

func RemoveKeyPair added in v1.2.0

func RemoveKeyPair()

func UpdateContext

func UpdateContext(ctx dtos.PunqContext) (interface{}, error)

func UpdateUser

func UpdateUser(userUpdateInput dtos.PunqUser) (*dtos.PunqUser, error)

Types

type KeyPair added in v1.2.0

type KeyPair struct {
	PrivateKeyString string `json:"privateKey" validate:"required"`
	PublicKeyString  string `json:"publicKey" validate:"required"`

	PrivateKey *ecdsa.PrivateKey `json:"-"`
	PublicKey  any               `json:"-"`
}
var KeyPairInstance *KeyPair

func CreateKeyPair added in v1.2.0

func CreateKeyPair() (*KeyPair, error)

func GetKeyPair added in v1.2.0

func GetKeyPair() (*KeyPair, error)

func (*KeyPair) UnmarshalJSON added in v1.2.0

func (keyPair *KeyPair) UnmarshalJSON(data []byte) error

type PunqClaims added in v1.2.0

type PunqClaims struct {
	UserID string `json:"userId"`
	jwt.RegisteredClaims
}

func ValidationToken added in v1.2.0

func ValidationToken(tokenString string) (*PunqClaims, error)

Jump to

Keyboard shortcuts

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