services

package
v0.0.0-...-f750f1c Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionDefaultMaxAge = time.Hour * 24 * 365 * 10
)

Variables

This section is empty.

Functions

func NewAuth

func NewAuth(base *BaseService, sessionUserKey, sessionUserPasswordHashKey string, passwordHash PasswordHash,
	testMode bool, adminList []string, adminFriendship string) rpc.AuthService

func NewBlob

func NewBlob(base *BaseService) rpc.BlobService

func NewGroup

func NewGroup(base *BaseService) rpc.GroupService

func NewInfo

func NewInfo(base *BaseService, pubKeyPem string) rpc.InfoService

func NewInvite

func NewInvite(base *BaseService) rpc.InviteService

func NewMessageHub

func NewMessageHub(base *BaseService, admins []string) rpc.MessageHubService

func NewMessageHubInternal

func NewMessageHubInternal(base *BaseService) rpc.MessageHubInternalService

func NewNotification

func NewNotification(base *BaseService) rpc.NotificationService

func NewToken

func NewToken(base *BaseService, tokenGenerator token.Generator, tokenDuration time.Duration) rpc.TokenService

func NewUser

func NewUser(base *BaseService, passwordHash PasswordHash) rpc.UserService

Types

type BaseService

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

func NewBase

func NewBase(repos repo.Repos, options BaseServiceOptions) *BaseService

func (*BaseService) GetUserAttachments

func (s *BaseService) GetUserAttachments(ctx context.Context, userID string) common.MailAttachmentList

type BaseServiceOptions

type BaseServiceOptions struct {
	UserCache          caches.Users
	S3Storage          *common.S3Storage
	TokenGenerator     token.Generator
	TokenParsers       *TokenParsers
	MailSender         *common.MailSender
	Cfg                config.Config
	NotificationSender NotificationSender
	RootEmailTemplate  *template.Template
}

type ContextKey

type ContextKey string
const (
	ContextUserKey    ContextKey = "user"
	ContextIsAdminKey ContextKey = "isAdmin"
	ContextSession    ContextKey = "session"
	ContextHubKey     ContextKey = "hub"
)

type Notification

type Notification struct {
	UserIDs     []string               `json:"users"`
	Text        string                 `json:"text"`
	MessageType string                 `json:"message_type"`
	Data        map[string]interface{} `json:"data"`
	IsExternal  bool                   `json:"is_external"`
}

type NotificationSender

type NotificationSender interface {
	Start()
	SendNotification(userIDs []string, text, messageType string, data map[string]interface{})
	SendExternalNotifications(notifications []Notification)
	SetGetUserAttachments(getUserAttachments func(ctx context.Context, userID string) common.MailAttachmentList)
}

func NewNotificationSender

func NewNotificationSender(repos repo.Repos, userCache caches.Users, firebaseClient *fcm.Client, mailSender *common.MailSender, rootEmailTemplate *template.Template) NotificationSender

type PasswordHash

type PasswordHash interface {
	GenerateHash(password string) (string, error)
	CompareHashAndPassword(hash, password string) bool
}

type Session

type Session interface {
	SetValue(key, value interface{})
	Clear()
	Save(options SessionSaveOptions) error
}

type SessionSaveOptions

type SessionSaveOptions struct {
	MaxAge time.Duration
}

type TokenParsers

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

func NewTokenParsers

func NewTokenParsers(primary token.Parser) *TokenParsers

func (*TokenParsers) Hub

func (tp *TokenParsers) Hub(ctx context.Context, hubAddress string) token.Parser

func (*TokenParsers) Primary

func (tp *TokenParsers) Primary() token.Parser

Jump to

Keyboard shortcuts

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