psql

package
v0.0.0-...-88f351d Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: MIT, CC-BY-4.0, MIT, + 1 more Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const OTPKeyType = security.AES128

Variables

View Source
var ErrPsqlConnectionLost = errors.New("postgres connection lost")

Functions

This section is empty.

Types

type Account

type Account struct {
	ID                  string
	Name                string
	Email               string
	Nonce               []byte
	MAC                 []byte
	EncryptedSystemKey  []byte         `db:"encrypted_system_key"`
	EncryptedUserKey    []byte         `db:"encrypted_user_key"`
	EncryptedPrivateKey []byte         `db:"encrypted_private_key"`
	PublicKey           []byte         `db:"public_key"`
	StaffCapabilityID   sql.NullString `db:"staff_capability_id"`
}

func (*Account) Bind

func (a *Account) Bind(b *Backend) *AccountBinding

type AccountBinding

type AccountBinding struct {
	*Backend
	*Account
	StaffCapability *Capability
	// contains filtered or unexported fields
}

func (*AccountBinding) Email

func (ab *AccountBinding) Email() (string, bool)

func (*AccountBinding) ID

func (*AccountBinding) IsStaff

func (ab *AccountBinding) IsStaff() bool

func (*AccountBinding) KeyFromPassword

func (ab *AccountBinding) KeyFromPassword(password string) *security.ManagedKey

func (*AccountBinding) KeyPair

func (ab *AccountBinding) KeyPair() security.ManagedKeyPair

func (*AccountBinding) Name

func (ab *AccountBinding) Name() string

func (*AccountBinding) PersonalIdentities

func (ab *AccountBinding) PersonalIdentities() []proto.PersonalIdentity

func (*AccountBinding) SystemKey

func (ab *AccountBinding) SystemKey() security.ManagedKey

func (*AccountBinding) Unlock

func (ab *AccountBinding) Unlock(clientKey *security.ManagedKey) (*security.ManagedKeyPair, error)

func (*AccountBinding) UnlockStaffKMS

func (ab *AccountBinding) UnlockStaffKMS(clientKey *security.ManagedKey) (security.KMS, error)

func (*AccountBinding) UserKey

func (ab *AccountBinding) UserKey() security.ManagedKey

func (*AccountBinding) View

func (ab *AccountBinding) View(roomName string) *proto.AccountView

type AccountManagerBinding

type AccountManagerBinding struct {
	*Backend
}

func (*AccountManagerBinding) ChangeClientKey

func (b *AccountManagerBinding) ChangeClientKey(
	ctx scope.Context, accountID snowflake.Snowflake, oldKey, newKey *security.ManagedKey) error

func (*AccountManagerBinding) ChangeEmail

func (b *AccountManagerBinding) ChangeEmail(ctx scope.Context, accountID snowflake.Snowflake, email string) (bool, error)

func (*AccountManagerBinding) ChangeName

func (b *AccountManagerBinding) ChangeName(ctx scope.Context, accountID snowflake.Snowflake, name string) error

func (*AccountManagerBinding) ConfirmPasswordReset

func (b *AccountManagerBinding) ConfirmPasswordReset(
	ctx scope.Context, kms security.KMS, confirmation, password string) error

func (*AccountManagerBinding) GenerateOTP

func (b *AccountManagerBinding) GenerateOTP(ctx scope.Context, heim *proto.Heim, kms security.KMS, account proto.Account) (*proto.OTP, error)

func (*AccountManagerBinding) Get

func (*AccountManagerBinding) GetPasswordResetAccount

func (b *AccountManagerBinding) GetPasswordResetAccount(ctx scope.Context, confirmation string) (proto.Account, error)

func (*AccountManagerBinding) GrantStaff

func (b *AccountManagerBinding) GrantStaff(
	ctx scope.Context, accountID snowflake.Snowflake, kmsCred security.KMSCredential) error

func (*AccountManagerBinding) OTP

func (b *AccountManagerBinding) OTP(ctx scope.Context, kms security.KMS, accountID snowflake.Snowflake) (*proto.OTP, error)

func (*AccountManagerBinding) Register

func (b *AccountManagerBinding) Register(
	ctx scope.Context, kms security.KMS, namespace, id, password string,
	agentID string, agentKey *security.ManagedKey) (
	proto.Account, *security.ManagedKey, error)

func (*AccountManagerBinding) RequestPasswordReset

func (b *AccountManagerBinding) RequestPasswordReset(
	ctx scope.Context, kms security.KMS, namespace, id string) (
	proto.Account, *proto.PasswordResetRequest, error)

func (*AccountManagerBinding) Resolve

func (b *AccountManagerBinding) Resolve(ctx scope.Context, namespace, id string) (proto.Account, error)

func (*AccountManagerBinding) RevokeStaff

func (b *AccountManagerBinding) RevokeStaff(ctx scope.Context, accountID snowflake.Snowflake) error

func (*AccountManagerBinding) SetUserKey

func (b *AccountManagerBinding) SetUserKey(
	ctx scope.Context, accountID snowflake.Snowflake, key *security.ManagedKey) error

func (*AccountManagerBinding) ValidateOTP

func (b *AccountManagerBinding) ValidateOTP(ctx scope.Context, kms security.KMS, accountID snowflake.Snowflake, password string) error

func (*AccountManagerBinding) VerifyPersonalIdentity

func (b *AccountManagerBinding) VerifyPersonalIdentity(ctx scope.Context, namespace, id string) error

type AccountWithStaffCapability

type AccountWithStaffCapability struct {
	AccountID            string         `db:"id"`
	CapabilityAccountID  sql.NullString `db:"account_id"`
	AccountNonce         []byte         `db:"nonce"`
	StaffCapabilityID    sql.NullString `db:"staff_capability_id"`
	StaffCapabilityNonce []byte         `db:"staff_capability_nonce"`
	Account
	Capability
}

func (*AccountWithStaffCapability) Bind

type Agent

type Agent struct {
	ID                 string
	IV                 []byte
	MAC                []byte
	EncryptedClientKey []byte         `db:"encrypted_client_key"`
	AccountID          sql.NullString `db:"account_id"`
	Created            time.Time
	Blessed            bool
	Bot                bool
}

type AgentTrackerBinding

type AgentTrackerBinding struct {
	*Backend
}

func (*AgentTrackerBinding) ClearClientKey

func (atb *AgentTrackerBinding) ClearClientKey(ctx scope.Context, agentID string) error

func (*AgentTrackerBinding) Get

func (atb *AgentTrackerBinding) Get(ctx scope.Context, agentID string) (*proto.Agent, error)

func (*AgentTrackerBinding) Register

func (atb *AgentTrackerBinding) Register(ctx scope.Context, agent *proto.Agent) error

func (*AgentTrackerBinding) SetClientKey

func (atb *AgentTrackerBinding) SetClientKey(
	ctx scope.Context, agentID string, accessKey *security.ManagedKey,
	accountID snowflake.Snowflake, clientKey *security.ManagedKey) error

type Backend

type Backend struct {
	sync.Mutex
	*sql.DB
	*gorp.DbMap
	// contains filtered or unexported fields
}

func NewBackend

func NewBackend(heim *proto.Heim, config *backend.DatabaseConfig) (*Backend, error)

func (*Backend) AccountManager

func (b *Backend) AccountManager() proto.AccountManager

func (*Backend) AgentTracker

func (b *Backend) AgentTracker() proto.AgentTracker

func (*Backend) Ban

func (b *Backend) Ban(ctx scope.Context, ban proto.Ban, until time.Time) error

func (*Backend) Close

func (b *Backend) Close()

func (*Backend) CreateRoom

func (b *Backend) CreateRoom(
	ctx scope.Context, kms security.KMS, private bool, name string, managers ...proto.Account) (
	proto.ManagedRoom, error)

func (*Backend) EmailTracker

func (b *Backend) EmailTracker() proto.EmailTracker

func (*Backend) GetRoom

func (b *Backend) GetRoom(ctx scope.Context, name string) (proto.ManagedRoom, error)

func (*Backend) Jobs

func (b *Backend) Jobs() jobs.JobService

func (*Backend) NotifyUser

func (b *Backend) NotifyUser(ctx scope.Context, userID proto.UserID, packetType proto.PacketType, payload interface{}, excluding ...proto.Session) error

func (*Backend) PMTracker

func (b *Backend) PMTracker() proto.PMTracker

func (*Backend) Peers

func (b *Backend) Peers() []cluster.PeerDesc

func (*Backend) Unban

func (b *Backend) Unban(ctx scope.Context, ban proto.Ban) error

func (*Backend) Version

func (b *Backend) Version() string

type BannedAgent

type BannedAgent struct {
	AgentID       string `db:"agent_id"`
	Room          sql.NullString
	Created       time.Time
	Expires       gorp.NullTime
	RoomReason    string `db:"room_reason"`
	AgentReason   string `db:"agent_reason"`
	PrivateReason string `db:"private_reason"`
}

type BannedIP

type BannedIP struct {
	IP      string `db:"ip"`
	Room    sql.NullString
	Created time.Time
	Expires gorp.NullTime
	Reason  string
}

type BroadcastMessage

type BroadcastMessage struct {
	Room    string
	Exclude []string
	Event   *proto.Packet
	UserID  proto.UserID
}

type Capability

type Capability struct {
	ID                   string
	AccountID            string `db:"account_id"`
	NonceBytes           []byte `db:"nonce"`
	EncryptedPrivateData []byte `db:"encrypted_private_data"`
	PublicData           []byte `db:"public_data"`
}

func (*Capability) CapabilityID

func (c *Capability) CapabilityID() string

func (*Capability) EncryptedPayload

func (c *Capability) EncryptedPayload() []byte

func (*Capability) Nonce

func (c *Capability) Nonce() []byte

func (*Capability) PublicPayload

func (c *Capability) PublicPayload() []byte

type Email

type Email struct {
	ID        string
	AccountID string `db:"account_id"`
	JobID     int64  `db:"job_id"`
	EmailType string `db:"email_type"`
	SendTo    string `db:"send_to"`
	SendFrom  string `db:"send_from"`
	Message   []byte
	Created   time.Time
	Delivered gorp.NullTime
	Failed    gorp.NullTime
}

func (*Email) FromBackend

func (e *Email) FromBackend(ref *emails.EmailRef)

func (*Email) ToBackend

func (e *Email) ToBackend() (*emails.EmailRef, error)

type EmailTracker

type EmailTracker struct {
	Backend *Backend
}

func (*EmailTracker) Get

func (et *EmailTracker) Get(ctx scope.Context, accountID snowflake.Snowflake, id string) (*emails.EmailRef, error)

func (*EmailTracker) List

func (et *EmailTracker) List(ctx scope.Context, accountID snowflake.Snowflake, n int, before time.Time) ([]*emails.EmailRef, error)

func (*EmailTracker) MarkDelivered

func (et *EmailTracker) MarkDelivered(ctx scope.Context, accountID snowflake.Snowflake, id string) error

func (*EmailTracker) Send

func (et *EmailTracker) Send(
	ctx scope.Context, js jobs.JobService, templater *templates.Templater, deliverer emails.Deliverer,
	account proto.Account, to, templateName string, data interface{}) (
	*emails.EmailRef, error)

type JobItem

type JobItem struct {
	ID                     int64
	Queue                  string
	JobType                string `db:"job_type"`
	Data                   []byte
	Created                time.Time
	Due                    time.Time
	Claimed                gorp.NullTime
	Completed              gorp.NullTime
	MaxWorkDurationSeconds int32 `db:"max_work_duration_seconds"`
	AttemptsMade           int32 `db:"attempts_made"`
	AttemptsRemaining      int32 `db:"attempts_remaining"`
}

type JobLog

type JobLog struct {
	JobID     int64 `db:"job_id"`
	Attempt   int32
	HandlerID string `db:"handler_id"`
	Started   time.Time
	Finished  gorp.NullTime
	Stolen    gorp.NullTime
	StolenBy  sql.NullString `db:"stolen_by"`
	Outcome   sql.NullString
	Log       []byte
}

type JobQueue

type JobQueue struct {
	Name string
}

func (*JobQueue) Bind

func (jq *JobQueue) Bind(b *Backend) *JobQueueBinding

type JobQueueBinding

type JobQueueBinding struct {
	*JobQueue
	*Backend
	// contains filtered or unexported fields
}

func (*JobQueueBinding) Add

func (jq *JobQueueBinding) Add(
	ctx scope.Context, jobType jobs.JobType, payload interface{}, options ...jobs.JobOption) (
	snowflake.Snowflake, error)

func (*JobQueueBinding) AddAndClaim

func (jq *JobQueueBinding) AddAndClaim(
	ctx scope.Context, jobType jobs.JobType, payload interface{}, handlerID string, options ...jobs.JobOption) (
	*jobs.Job, error)

func (*JobQueueBinding) Cancel

func (jq *JobQueueBinding) Cancel(ctx scope.Context, jobID snowflake.Snowflake) error

func (*JobQueueBinding) Complete

func (jq *JobQueueBinding) Complete(
	ctx scope.Context, jobID snowflake.Snowflake, handlerID string, attemptNumber int32, log []byte) error

func (*JobQueueBinding) Fail

func (jq *JobQueueBinding) Fail(
	ctx scope.Context, jobID snowflake.Snowflake, handlerID string, attemptNumber int32, reason string, log []byte) error

func (*JobQueueBinding) Log

func (jq *JobQueueBinding) Log(ctx scope.Context, jobID snowflake.Snowflake, attemptNumber int32) (*jobs.JobLog, error)

func (*JobQueueBinding) Name

func (jq *JobQueueBinding) Name() string

func (*JobQueueBinding) Stats

func (*JobQueueBinding) TryClaim

func (jq *JobQueueBinding) TryClaim(ctx scope.Context, handlerID string) (*jobs.Job, error)

func (*JobQueueBinding) TrySteal

func (jq *JobQueueBinding) TrySteal(ctx scope.Context, handlerID string) (*jobs.Job, error)

func (*JobQueueBinding) WaitForJob

func (jq *JobQueueBinding) WaitForJob(ctx scope.Context) error

type JobService

type JobService struct {
	*Backend
}

func (*JobService) GetQueue

func (js *JobService) GetQueue(ctx scope.Context, name string) (jobs.JobQueue, error)

type Listener

type Listener struct {
	proto.Session
	*proto.Client
	// contains filtered or unexported fields
}

type ListenerMap

type ListenerMap map[string]Listener

func (ListenerMap) Broadcast

func (lm ListenerMap) Broadcast(ctx scope.Context, event *proto.Packet, exclude ...string) error

func (ListenerMap) NotifyUser

func (lm ListenerMap) NotifyUser(ctx scope.Context, userID proto.UserID, event *proto.Packet, exclude ...string) error

type ManagedRoomBinding

type ManagedRoomBinding struct {
	RoomBinding
	*Room
}

func (*ManagedRoomBinding) AddManager

func (rb *ManagedRoomBinding) AddManager(
	ctx scope.Context, kms security.KMS, actor proto.Account, actorKey *security.ManagedKey,
	newManager proto.Account) error

func (*ManagedRoomBinding) Ban

func (rb *ManagedRoomBinding) Ban(ctx scope.Context, ban proto.Ban, until time.Time) error

func (*ManagedRoomBinding) GenerateMessageKey

func (rb *ManagedRoomBinding) GenerateMessageKey(ctx scope.Context, kms security.KMS) (
	proto.RoomMessageKey, error)

func (*ManagedRoomBinding) IsValidParent

func (rb *ManagedRoomBinding) IsValidParent(id snowflake.Snowflake) (bool, error)

func (*ManagedRoomBinding) ManagerCapability

func (rb *ManagedRoomBinding) ManagerCapability(ctx scope.Context, manager proto.Account) (
	security.Capability, error)

func (*ManagedRoomBinding) ManagerKey

func (rb *ManagedRoomBinding) ManagerKey(ctx scope.Context) (proto.RoomManagerKey, error)

func (*ManagedRoomBinding) Managers

func (rb *ManagedRoomBinding) Managers(ctx scope.Context) ([]proto.Account, error)

func (*ManagedRoomBinding) MessageKey

func (rb *ManagedRoomBinding) MessageKey(ctx scope.Context) (proto.RoomMessageKey, error)

func (*ManagedRoomBinding) MessageKeyID

func (rb *ManagedRoomBinding) MessageKeyID(ctx scope.Context) (string, bool, error)

func (*ManagedRoomBinding) MinAgentAge

func (rb *ManagedRoomBinding) MinAgentAge() time.Duration

func (*ManagedRoomBinding) RemoveManager

func (rb *ManagedRoomBinding) RemoveManager(
	ctx scope.Context, actor proto.Account, actorKey *security.ManagedKey,
	formerManager proto.Account) error

func (*ManagedRoomBinding) Unban

func (rb *ManagedRoomBinding) Unban(ctx scope.Context, ban proto.Ban) error

type Message

type Message struct {
	Room           string
	ID             string
	PreviousEditID sql.NullString `db:"previous_edit_id"`
	Parent         string
	Posted         time.Time
	Edited         gorp.NullTime
	Deleted        gorp.NullTime
	SessionID      string `db:"session_id"`

	SenderID            string `db:"sender_id"`
	SenderName          string `db:"sender_name"`
	SenderClientAddress string `db:"sender_client_address"`
	SenderIsManager     bool   `db:"sender_is_manager"`
	SenderIsStaff       bool   `db:"sender_is_staff"`

	ServerID        string `db:"server_id"`
	ServerEra       string `db:"server_era"`
	Content         string
	EncryptionKeyID sql.NullString `db:"encryption_key_id"`
}

func NewMessage

func NewMessage(
	roomName string, sessionView proto.SessionView, id, parent snowflake.Snowflake, keyID, content string) (
	*Message, error)

func (*Message) ToBackend

func (m *Message) ToBackend() proto.Message

func (*Message) ToTransmission

func (m *Message) ToTransmission() proto.Message

type MessageEditLog

type MessageEditLog struct {
	EditID          string `db:"edit_id"`
	Room            string
	MessageID       string         `db:"message_id"`
	EditorID        sql.NullString `db:"editor_id"`
	PreviousEditID  sql.NullString `db:"previous_edit_id"`
	PreviousContent string         `db:"previous_content"`
	PreviousParent  sql.NullString `db:"previous_parent"`
}

type MessageKey

type MessageKey struct {
	ID           string
	EncryptedKey []byte `db:"encrypted_key"`
	IV           []byte
	Nonce        []byte
}

type Nick

type Nick struct {
	Room   string
	UserID string `db:"user_id"`
	Nick   string
}

type OTP

type OTP struct {
	AccountID    string `db:"account_id"`
	IV           []byte
	EncryptedKey []byte `db:"encrypted_key"`
	Digest       []byte
	EncryptedURI []byte `db:"encrypted_uri"`
	Validated    bool
}

type PM

type PM struct {
	ID                    string
	Initiator             string
	InitiatorNick         string `db:"initiator_nick"`
	Receiver              string
	ReceiverNick          string `db:"receiver_nick"`
	ReceiverMAC           []byte `db:"receiver_mac"`
	IV                    []byte
	EncryptedSystemKey    []byte `db:"encrypted_system_key"`
	EncryptedInitiatorKey []byte `db:"encrypted_initiator_key"`
	EncryptedReceiverKey  []byte `db:"encrypted_receiver_key"`
}

func (*PM) ToBackend

func (pm *PM) ToBackend() *proto.PM

type PMRoomBinding

type PMRoomBinding struct {
	RoomBinding
	// contains filtered or unexported fields
}

func (*PMRoomBinding) MessageKeyID

func (pmrb *PMRoomBinding) MessageKeyID(ctx scope.Context) (string, bool, error)

func (*PMRoomBinding) ResolveNick

func (pmrb *PMRoomBinding) ResolveNick(ctx scope.Context, userID proto.UserID) (string, bool, error)

func (*PMRoomBinding) Snapshot

func (pmrb *PMRoomBinding) Snapshot(
	ctx scope.Context, session proto.Session, level proto.PrivilegeLevel, numMessages int) (*proto.SnapshotEvent, error)

type PMTracker

type PMTracker struct {
	*Backend
}

func (*PMTracker) Initiate

func (t *PMTracker) Initiate(
	ctx scope.Context, kms security.KMS, room proto.Room, client *proto.Client, recipient proto.UserID) (
	snowflake.Snowflake, error)

func (*PMTracker) Room

type PasswordResetRequest

type PasswordResetRequest struct {
	ID          string
	AccountID   string `db:"account_id"`
	Key         []byte
	Requested   time.Time
	Expires     time.Time
	Consumed    gorp.NullTime
	Invalidated gorp.NullTime
}

type PersonalIdentity

type PersonalIdentity struct {
	Namespace string
	ID        string
	AccountID string `db:"account_id"`
	Verified  bool
}

type PersonalIdentityBinding

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

func (*PersonalIdentityBinding) ID

func (pib *PersonalIdentityBinding) ID() string

func (*PersonalIdentityBinding) Namespace

func (pib *PersonalIdentityBinding) Namespace() string

func (*PersonalIdentityBinding) Verified

func (pib *PersonalIdentityBinding) Verified() bool

type Presence

type Presence struct {
	Room      string
	Topic     string
	ServerID  string `db:"server_id"`
	ServerEra string `db:"server_era"`
	SessionID string `db:"session_id"`
	Updated   time.Time
	KeyID     string `db:"key_id"`
	Fact      []byte
}

func (*Presence) SessionView

func (p *Presence) SessionView(level proto.PrivilegeLevel) (proto.SessionView, error)

func (*Presence) SetFact

func (p *Presence) SetFact(fact *proto.Presence) error

type Room

type Room struct {
	Name                   string
	FoundedBy              string `db:"founded_by"`
	RetentionDays          int    `db:"retention_days"`
	Nonce                  []byte `db:"pk_nonce"`
	MAC                    []byte `db:"pk_mac"`
	IV                     []byte `db:"pk_iv"`
	EncryptedManagementKey []byte `db:"encrypted_management_key"`
	EncryptedPrivateKey    []byte `db:"encrypted_private_key"`
	PublicKey              []byte `db:"public_key"`
	MinAgentAge            int64  `db:"min_agent_age"`
}

func (*Room) Bind

func (r *Room) Bind(b *Backend) *ManagedRoomBinding

type RoomBinding

type RoomBinding struct {
	*Backend
	RoomName  string
	RoomTitle string
	// contains filtered or unexported fields
}

func (*RoomBinding) EditMessage

func (rb *RoomBinding) EditMessage(
	ctx scope.Context, session proto.Session, edit proto.EditMessageCommand) (
	proto.EditMessageReply, error)

func (*RoomBinding) GetMessage

func (rb *RoomBinding) GetMessage(ctx scope.Context, id snowflake.Snowflake) (*proto.Message, error)

func (*RoomBinding) ID

func (rb *RoomBinding) ID() string

func (*RoomBinding) IsValidParent

func (rb *RoomBinding) IsValidParent(id snowflake.Snowflake) (bool, error)

func (*RoomBinding) Join

func (rb *RoomBinding) Join(ctx scope.Context, session proto.Session) (string, error)

func (*RoomBinding) Latest

func (rb *RoomBinding) Latest(ctx scope.Context, n int, before snowflake.Snowflake) (
	[]proto.Message, error)

func (*RoomBinding) Listing

func (rb *RoomBinding) Listing(ctx scope.Context, level proto.PrivilegeLevel, exclude ...proto.Session) (proto.Listing, error)

func (*RoomBinding) MessageKeyID

func (rb *RoomBinding) MessageKeyID(ctx scope.Context) (string, bool, error)

func (*RoomBinding) Part

func (rb *RoomBinding) Part(ctx scope.Context, session proto.Session) error

func (*RoomBinding) RenameUser

func (rb *RoomBinding) RenameUser(ctx scope.Context, session proto.Session, formerName string) (
	*proto.NickEvent, error)

func (*RoomBinding) ResolveClientAddress

func (rb *RoomBinding) ResolveClientAddress(ctx scope.Context, addr string) (net.IP, error)

func (*RoomBinding) ResolveNick

func (rb *RoomBinding) ResolveNick(ctx scope.Context, userID proto.UserID) (string, bool, error)

func (*RoomBinding) Send

func (rb *RoomBinding) Send(ctx scope.Context, session proto.Session, msg proto.Message) (
	proto.Message, error)

func (*RoomBinding) Snapshot

func (rb *RoomBinding) Snapshot(
	ctx scope.Context, session proto.Session, level proto.PrivilegeLevel, numMessages int) (*proto.SnapshotEvent, error)

func (*RoomBinding) Title

func (rb *RoomBinding) Title() string

func (*RoomBinding) WaitForPart

func (rb *RoomBinding) WaitForPart(sessionID string) error

type RoomCapability

type RoomCapability struct {
	Room         string
	CapabilityID string `db:"capability_id"`
	AccountID    string `db:"account_id"`
	Granted      time.Time
	Revoked      time.Time
}

type RoomCapabilityBinding

type RoomCapabilityBinding struct {
	AccountID string `db:"account_id"`
	Capability
	RoomCapability
}

func (*RoomCapabilityBinding) CapabilityID

func (rcb *RoomCapabilityBinding) CapabilityID() string

type RoomManagerCapabilities

type RoomManagerCapabilities struct {
	Room     *Room
	Executor gorp.SqlExecutor
}

func (*RoomManagerCapabilities) Get

func (*RoomManagerCapabilities) Remove

func (rmc *RoomManagerCapabilities) Remove(ctx scope.Context, capabilityID string) error

func (*RoomManagerCapabilities) Save

type RoomManagerCapability

type RoomManagerCapability RoomCapability

type RoomManagerCapabilityBinding

type RoomManagerCapabilityBinding struct {
	AccountID string `db:"account_id"`
	Capability
	RoomManagerCapability
}

func (*RoomManagerCapabilityBinding) CapabilityID

func (rmcb *RoomManagerCapabilityBinding) CapabilityID() string

type RoomManagerKeyBinding

type RoomManagerKeyBinding struct {
	*Room
	*RoomManagerCapabilities
	*proto.GrantManager
}

func NewRoomManagerKeyBinding

func NewRoomManagerKeyBinding(rb *ManagedRoomBinding) *RoomManagerKeyBinding

func (*RoomManagerKeyBinding) KeyPair

func (*RoomManagerKeyBinding) Nonce

func (rmkb *RoomManagerKeyBinding) Nonce() []byte

func (*RoomManagerKeyBinding) SetExecutor

func (rmkb *RoomManagerKeyBinding) SetExecutor(executor gorp.SqlExecutor)

func (*RoomManagerKeyBinding) StaffUnlock

func (rmkb *RoomManagerKeyBinding) StaffUnlock(kms security.KMS) (*security.ManagedKeyPair, error)

func (*RoomManagerKeyBinding) Unlock

func (rmkb *RoomManagerKeyBinding) Unlock(
	managerKey *security.ManagedKey) (*security.ManagedKeyPair, error)

type RoomMessageCapabilities

type RoomMessageCapabilities struct {
	Room     *Room
	Executor gorp.SqlExecutor
}

func (*RoomMessageCapabilities) Get

func (*RoomMessageCapabilities) Remove

func (rmc *RoomMessageCapabilities) Remove(ctx scope.Context, capabilityID string) error

func (*RoomMessageCapabilities) Save

type RoomMessageKey

type RoomMessageKey struct {
	Room      string
	KeyID     string `db:"key_id"`
	Activated time.Time
	Expired   time.Time
	Comment   string
}

type RoomMessageKeyBinding

type RoomMessageKeyBinding struct {
	*proto.GrantManager
	MessageKey
	RoomMessageKey
}

func NewRoomMessageKeyBinding

func NewRoomMessageKeyBinding(
	rb *ManagedRoomBinding, keyID snowflake.Snowflake, msgKey *security.ManagedKey,
	nonce []byte) *RoomMessageKeyBinding

func (*RoomMessageKeyBinding) KeyID

func (rmkb *RoomMessageKeyBinding) KeyID() string

func (*RoomMessageKeyBinding) ManagedKey

func (rmkb *RoomMessageKeyBinding) ManagedKey() security.ManagedKey

func (*RoomMessageKeyBinding) Nonce

func (rmkb *RoomMessageKeyBinding) Nonce() []byte

func (*RoomMessageKeyBinding) Timestamp

func (rmkb *RoomMessageKeyBinding) Timestamp() time.Time

type SessionLog

type SessionLog struct {
	SessionID string `db:"session_id"`
	IP        string
	Room      string
	UserAgent string `db:"user_agent"`
	Connected time.Time
}

type VirtualAddress

type VirtualAddress struct {
	Room    string
	Virtual string
	Real    string
	Created time.Time
}

Jump to

Keyboard shortcuts

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