Versions in this module Expand all Collapse all v1 v1.5.0 Jun 29, 2024 v1.4.0 Aug 9, 2022 Changes in this version type Identity + func (i *Identity) IsDeactivated() bool + func (i *Identity) Status() string v1.3.1 Dec 20, 2021 v1.3.0 Nov 22, 2021 Changes in this version + const CMSPluginID + const CMSPluginVersion + const CmdCMSCodeStatsByUserMonthYear + const CmdCMSUserByID + const CmdCMSUserSubContractors + const CmdCMSUsersByContractorType + const CmdCMSUsersByDomain + const CmdCMSUsersByProposalToken + const CmdNewCMSUser + const CmdNewCMSUserCodeStats + const CmdUpdateCMSUser + const CmdUpdateCMSUserCodeStats + const ErrorCodeInvalid + const ErrorCodeUserBalanceInsufficient + const ErrorCodeUserRegistrationNotPaid + const PiUserPluginID + const VersionEmailHistory + const VersionSession + const VersionUser + var ErrCodeStatsNotFound = errors.New("code stats not found") + var ErrInvalidPlugin = errors.New("invalid plugin") + var ErrInvalidPluginCmd = errors.New("invalid plugin command") + var ErrSessionNotFound = errors.New("no user session found") + var ErrShutdown = errors.New("database is shutting down") + var ErrUserExists = errors.New("user already exists") + var ErrUserNotFound = errors.New("user not found") + var ErrorCodes = map[int]string + func EncodeCMSCodeStatsByUserMonthYear(u CMSCodeStatsByUserMonthYear) ([]byte, error) + func EncodeCMSCodeStatsByUserMonthYearReply(u CMSCodeStatsByUserMonthYearReply) ([]byte, error) + func EncodeCMSUser(u CMSUser) ([]byte, error) + func EncodeCMSUserByID(u CMSUserByID) ([]byte, error) + func EncodeCMSUserByIDReply(u CMSUserByIDReply) ([]byte, error) + func EncodeCMSUserSubContractors(u CMSUserSubContractors) ([]byte, error) + func EncodeCMSUserSubContractorsReply(u CMSUserSubContractorsReply) ([]byte, error) + func EncodeCMSUsersByContractorType(u CMSUsersByContractorType) ([]byte, error) + func EncodeCMSUsersByContractorTypeReply(u CMSUsersByContractorTypeReply) ([]byte, error) + func EncodeCMSUsersByDomain(u CMSUsersByDomain) ([]byte, error) + func EncodeCMSUsersByDomainReply(u CMSUsersByDomainReply) ([]byte, error) + func EncodeCMSUsersByProposalToken(u CMSUsersByProposalToken) ([]byte, error) + func EncodeCMSUsersByProposalTokenReply(u CMSUsersByProposalTokenReply) ([]byte, error) + func EncodeCodeStats(cs CodeStats) ([]byte, error) + func EncodeNewCMSCodeStats(u NewCMSCodeStats) ([]byte, error) + func EncodeNewCMSCodeStatsReply(u NewCMSCodeStatsReply) ([]byte, error) + func EncodeNewCMSUser(u NewCMSUser) ([]byte, error) + func EncodeNewCMSUserReply(u NewCMSUserReply) ([]byte, error) + func EncodeSession(s Session) ([]byte, error) + func EncodeUpdateCMSCodeStats(u UpdateCMSCodeStats) ([]byte, error) + func EncodeUpdateCMSCodeStatsReply(u UpdateCMSCodeStatsReply) ([]byte, error) + func EncodeUpdateCMSUser(u UpdateCMSUser) ([]byte, error) + func EncodeUpdateCMSUserReply(u UpdateCMSUserReply) ([]byte, error) + func EncodeUser(u User) ([]byte, error) + func NewTestMailerDB(histories map[uuid.UUID]EmailHistory) *testMailerDB + type CMSCodeStatsByUserMonthYear struct + GithubName string + Month int + Year int + func DecodeCMSCodeStatsByUserMonthYear(b []byte) (*CMSCodeStatsByUserMonthYear, error) + type CMSCodeStatsByUserMonthYearReply struct + UserCodeStats []CodeStats + func DecodeCMSCodeStatsByUserMonthYearReply(b []byte) (*CMSCodeStatsByUserMonthYearReply, error) + type CMSUser struct + ContractorContact string + ContractorLocation string + ContractorName string + ContractorType int + Domain int + GitHubName string + MatrixName string + ProposalsOwned []string + SupervisorUserIDs []uuid.UUID + func DecodeCMSUser(payload []byte) (*CMSUser, error) + type CMSUserByID struct + ID string + func DecodeCMSUserByID(b []byte) (*CMSUserByID, error) + type CMSUserByIDReply struct + User *CMSUser + func DecodeCMSUserByIDReply(b []byte) (*CMSUserByIDReply, error) + type CMSUserSubContractors struct + ID string + func DecodeCMSUserSubContractors(b []byte) (*CMSUserSubContractors, error) + type CMSUserSubContractorsReply struct + Users []CMSUser + func DecodeCMSUserSubContractorsReply(b []byte) (*CMSUserSubContractorsReply, error) + type CMSUsersByContractorType struct + ContractorType int + func DecodeCMSUsersByContractorType(b []byte) (*CMSUsersByContractorType, error) + type CMSUsersByContractorTypeReply struct + Users []CMSUser + func DecodeCMSUsersByContractorTypeReply(b []byte) (*CMSUsersByContractorTypeReply, error) + type CMSUsersByDomain struct + Domain int + func DecodeCMSUsersByDomain(b []byte) (*CMSUsersByDomain, error) + type CMSUsersByDomainReply struct + Users []CMSUser + func DecodeCMSUsersByDomainReply(b []byte) (*CMSUsersByDomainReply, error) + type CMSUsersByProposalToken struct + Token string + func DecodeCMSUsersByProposalToken(b []byte) (*CMSUsersByProposalToken, error) + type CMSUsersByProposalTokenReply struct + Users []CMSUser + func DecodeCMSUsersByProposalTokenReply(b []byte) (*CMSUsersByProposalTokenReply, error) + type CodeStats struct + CommitAdditions int64 + CommitDeletions int64 + Commits []string + GitHubName string + ID string + MergedAdditions int64 + MergedDeletions int64 + Month int + PRs []string + Repository string + ReviewAdditions int64 + ReviewDeletions int64 + Reviews []string + UpdatedAdditions int64 + UpdatedDeletions int64 + Year int + func DecodeCodeStats(b []byte) (*CodeStats, error) + type Database interface + AllUsers func(callbackFn func(u *User)) error + Close func() error + InsertUser func(User) error + PluginExec func(PluginCommand) (*PluginCommandReply, error) + RegisterPlugin func(Plugin) error + RotateKeys func(newKeyPath string) error + SessionDeleteByID func(sessionID string) error + SessionGetByID func(sessionID string) (*Session, error) + SessionSave func(Session) error + SessionsDeleteByUserID func(id uuid.UUID, exemptSessionIDs []string) error + SetPaywallAddressIndex func(index uint64) error + UserGetById func(uuid.UUID) (*User, error) + UserGetByPubKey func(string) (*User, error) + UserGetByUsername func(string) (*User, error) + UserNew func(User) error + UserUpdate func(User) error + UsersGetByPubKey func(pubKeys []string) (map[string]User, error) + type EmailHistory struct + LimitWarningSent bool + Timestamps []int64 + type Identity struct + Activated int64 + Deactivated int64 + Key [identity.PublicKeySize]byte + func NewIdentity(publicKey string) (*Identity, error) + func (i *Identity) Activate() + func (i *Identity) Deactivate() + func (i *Identity) IsActive() bool + func (i *Identity) IsInactive() bool + func (i *Identity) String() string + type MailerDB interface + EmailHistoriesGet func(users []uuid.UUID) (map[uuid.UUID]EmailHistory, error) + EmailHistoriesSave func(histories map[uuid.UUID]EmailHistory) error + type NewCMSCodeStats struct + UserCodeStats []CodeStats + func DecodeNewCMSCodeStats(b []byte) (*NewCMSCodeStats, error) + type NewCMSCodeStatsReply struct + func DecodeNewCMSCodeStatsReply(b []byte) (*NewCMSCodeStatsReply, error) + type NewCMSUser struct + ContractorType int + Email string + NewUserVerificationExpiry int64 + NewUserVerificationToken []byte + Username string + func DecodeNewCMSUser(b []byte) (*NewCMSUser, error) + type NewCMSUserReply struct + func DecodeNewCMSUserReply(b []byte) (*NewCMSUserReply, error) + type Plugin struct + ID string + Settings []PluginSetting + Version string + type PluginCommand struct + Command string + ID string + Payload string + type PluginCommandReply struct + Command string + ID string + Payload string + type PluginSetting struct + Key string + Value string + type ProposalCredit struct + CensorshipToken string + DatePurchased int64 + PaywallID uint64 + Price uint64 + TxID string + type ProposalPaywall struct + Address string + CreditPrice uint64 + ID uint64 + NumCredits uint64 + PollExpiry int64 + TxAmount uint64 + TxID string + TxNotBefore int64 + type Session struct + CreatedAt int64 + ID string + UserID uuid.UUID + Values string + func DecodeSession(payload []byte) (*Session, error) + type UpdateCMSCodeStats struct + UserCodeStats []CodeStats + func DecodeUpdateCMSCodeStats(b []byte) (*UpdateCMSCodeStats, error) + type UpdateCMSCodeStatsReply struct + func DecodeUpdateCMSCodeStatsReply(b []byte) (*UpdateCMSCodeStatsReply, error) + type UpdateCMSUser struct + ContractorContact string + ContractorLocation string + ContractorName string + ContractorType int + Domain int + GitHubName string + ID uuid.UUID + MatrixName string + ProposalsOwned []string + SupervisorUserIDs []uuid.UUID + func DecodeUpdateCMSUser(b []byte) (*UpdateCMSUser, error) + type UpdateCMSUserReply struct + func DecodeUpdateCMSUserReply(b []byte) (*UpdateCMSUserReply, error) + type User struct + Admin bool + Deactivated bool + Email string + EmailNotifications uint64 + FailedLoginAttempts uint64 + HashedPassword []byte + ID uuid.UUID + Identities []Identity + LastLoginTime int64 + NewUserPaywallAddress string + NewUserPaywallAmount uint64 + NewUserPaywallPollExpiry int64 + NewUserPaywallTx string + NewUserPaywallTxNotBefore int64 + NewUserVerificationExpiry int64 + NewUserVerificationToken []byte + PaywallAddressIndex uint64 + ProposalCommentsAccessTimes map[string]int64 + ProposalPaywalls []ProposalPaywall + ResendNewUserVerificationExpiry int64 + ResetPasswordVerificationExpiry int64 + ResetPasswordVerificationToken []byte + SpentProposalCredits []ProposalCredit + TOTPLastFailedCodeTime []int64 + TOTPLastUpdated []int64 + TOTPSecret string + TOTPType int + TOTPVerified bool + UnspentProposalCredits []ProposalCredit + UpdateKeyVerificationExpiry int64 + UpdateKeyVerificationToken []byte + Username string + func DecodeUser(payload []byte) (*User, error) + func (u *User) ActivateIdentity(key []byte) error + func (u *User) ActiveIdentity() *Identity + func (u *User) AddIdentity(id Identity) error + func (u *User) InactiveIdentity() *Identity + func (u *User) NotificationIsEnabled(ntfnBit uint64) bool + func (u *User) PublicKey() string