code

package
v0.0.0-...-0119d12 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Max permitted lifetime of a shared session.
	MaxSessionShareExpiry = time.Hour * 24 * 30
)

Variables

View Source
var (
	ErrNS          = errorx.NewNamespace("error.api.user.code")
	ErrShareFailed = ErrNS.NewType("share_failed")
)
View Source
var Module = fx.Options(
	fx.Provide(NewService),
	fx.Invoke(registerRouter),
)

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService() *Service

func (*Service) NewSessionFromSharingCode

func (s *Service) NewSessionFromSharingCode(codeInHex string) *utils.SessionUser

func (*Service) ShareHandler

func (s *Service) ShareHandler(c *gin.Context)

@ID userShareSession @Summary Share current session and generate a sharing code @Param request body ShareRequest true "Request body" @Security JwtAuth @Success 200 {object} ShareResponse @Router /user/share/code [post]

func (*Service) SharingCodeFromSession

func (s *Service) SharingCodeFromSession(session *utils.SessionUser, expireIn time.Duration, revokeWritePriv bool) *string

type ShareRequest

type ShareRequest struct {
	ExpireInSeconds int64 `json:"expire_in_sec"`
	RevokeWritePriv bool  `json:"revoke_write_priv"`
}

type ShareResponse

type ShareResponse struct {
	Code string `json:"code"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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