backend

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GenerateKey = helper.GenerateKey

Functions

func FastGenerateKey added in v0.2.2

func FastGenerateKey(_, _ string, passphrase []byte, _ string, _ int) (string, error)

FastGenerateKey is a fast version of GenerateKey that uses a pre-computed key. This is useful for testing but is incredibly insecure.

Types

type Backend

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

func New

func New(authLife time.Duration, domain string) *Backend

func (*Backend) AddAddressCreatedUpdate added in v0.4.0

func (b *Backend) AddAddressCreatedUpdate(userID, addrID string) error

func (*Backend) AddLabelCreatedUpdate added in v0.4.0

func (b *Backend) AddLabelCreatedUpdate(userID, labelID string) error

func (*Backend) AddMessageCreatedUpdate added in v0.4.0

func (b *Backend) AddMessageCreatedUpdate(userID, messageID string) error

func (*Backend) CountMessages

func (b *Backend) CountMessages(userID string) (int, error)

func (*Backend) CreateAddress

func (b *Backend) CreateAddress(userID, email string, password []byte, withKey bool, status proton.AddressStatus) (string, error)

func (*Backend) CreateAddressKey

func (b *Backend) CreateAddressKey(userID, addrID string, password []byte) error

func (*Backend) CreateAttachment

func (b *Backend) CreateAttachment(
	userID string,
	messageID string,
	filename string,
	mimeType rfc822.MIMEType,
	disposition proton.Disposition,
	contentID string,
	keyPackets, dataPacket []byte,
	armSig string,
) (proton.Attachment, error)

func (*Backend) CreateDraft

func (b *Backend) CreateDraft(userID, addrID string, draft proton.DraftTemplate, parentID string) (proton.Message, error)

func (*Backend) CreateLabel

func (b *Backend) CreateLabel(userID, labelName, parentID string, labelType proton.LabelType) (proton.Label, error)

func (*Backend) CreateMessage

func (b *Backend) CreateMessage(
	userID, addrID string,
	subject string,
	sender *mail.Address,
	toList, ccList, bccList, replytos []*mail.Address,
	armBody string,
	mimeType rfc822.MIMEType,
	flags proton.MessageFlag,
	date time.Time,
	unread, starred bool,
) (string, error)

func (*Backend) CreateSubscription added in v0.2.2

func (b *Backend) CreateSubscription(userID, planID string) error

TODO: Implement this when we support subscriptions in the test server.

func (*Backend) CreateUser

func (b *Backend) CreateUser(username string, password []byte) (string, error)

func (*Backend) CreateUserKey

func (b *Backend) CreateUserKey(userID string, password []byte) error

func (*Backend) DeleteAddress added in v0.2.2

func (b *Backend) DeleteAddress(userID, addrID string) error

func (*Backend) DeleteLabel

func (b *Backend) DeleteLabel(userID, labelID string) error

func (*Backend) DeleteMessage

func (b *Backend) DeleteMessage(userID, messageID string) error

func (*Backend) DeleteSession

func (b *Backend) DeleteSession(userID, authUID string) error

func (*Backend) DisableAddress added in v0.2.2

func (b *Backend) DisableAddress(userID, addrID string) error

func (*Backend) EnableAddress added in v0.2.2

func (b *Backend) EnableAddress(userID, addrID string) error

func (*Backend) Encrypt

func (b *Backend) Encrypt(userID, addrID, decBody string) (string, error)

func (*Backend) GetAddress added in v0.2.2

func (b *Backend) GetAddress(userID, addrID string) (proton.Address, error)

func (*Backend) GetAddressID

func (b *Backend) GetAddressID(email string) (string, error)

func (*Backend) GetAddresses

func (b *Backend) GetAddresses(userID string) ([]proton.Address, error)

func (*Backend) GetAttachment

func (b *Backend) GetAttachment(attachID string) ([]byte, error)

func (*Backend) GetEvent

func (b *Backend) GetEvent(userID, rawEventID string) (proton.Event, error)

func (*Backend) GetKeySalts

func (b *Backend) GetKeySalts(userID string) ([]proton.Salt, error)

func (*Backend) GetLabel

func (b *Backend) GetLabel(userID, labelID string) (proton.Label, error)

func (*Backend) GetLabels

func (b *Backend) GetLabels(userID string, types ...proton.LabelType) ([]proton.Label, error)

func (*Backend) GetLatestEventID

func (b *Backend) GetLatestEventID(userID string) (string, error)

func (*Backend) GetMailSettings

func (b *Backend) GetMailSettings(userID string) (proton.MailSettings, error)

func (*Backend) GetMessage

func (b *Backend) GetMessage(userID, messageID string) (proton.Message, error)

func (*Backend) GetMessageIDs

func (b *Backend) GetMessageIDs(userID string, afterID string, limit int) ([]string, error)

func (*Backend) GetMessages

func (b *Backend) GetMessages(userID string, page, pageSize int, filter proton.MessageFilter) ([]proton.MessageMetadata, error)

func (*Backend) GetPublicKeys

func (b *Backend) GetPublicKeys(email string) ([]proton.PublicKey, error)

func (*Backend) GetSessions

func (b *Backend) GetSessions(userID string) ([]proton.AuthSession, error)

func (*Backend) GetUser

func (b *Backend) GetUser(userID string) (proton.User, error)

func (*Backend) HasLabel

func (b *Backend) HasLabel(userID, labelName string) (string, bool, error)

func (*Backend) LabelMessages

func (b *Backend) LabelMessages(userID, labelID string, messageIDs ...string) error

func (*Backend) LabelMessagesNoEvents added in v0.4.0

func (b *Backend) LabelMessagesNoEvents(userID, labelID string, messageIDs ...string) error

func (*Backend) NewAuth

func (b *Backend) NewAuth(username string, ephemeral, proof []byte, session string) (proton.Auth, error)

func (*Backend) NewAuthInfo

func (b *Backend) NewAuthInfo(username string) (proton.AuthInfo, error)

func (*Backend) NewAuthRef

func (b *Backend) NewAuthRef(authUID, authRef string) (proton.Auth, error)

func (*Backend) RefreshUser

func (b *Backend) RefreshUser(userID string, refresh proton.RefreshFlag) error

func (*Backend) RemoveAddress

func (b *Backend) RemoveAddress(userID, addrID string) error

func (*Backend) RemoveAddressKey

func (b *Backend) RemoveAddressKey(userID, addrID, keyID string) error

func (*Backend) RemoveUser

func (b *Backend) RemoveUser(userID string) error

func (*Backend) RemoveUserKey

func (b *Backend) RemoveUserKey(userID, keyID string) error

func (*Backend) RunQuarkCommand added in v0.2.2

func (s *Backend) RunQuarkCommand(command string, args ...string) (any, error)

func (*Backend) SendMessage

func (b *Backend) SendMessage(userID, messageID string, packages []*proton.MessagePackage) (proton.Message, error)

func (*Backend) SetAddressOrder

func (b *Backend) SetAddressOrder(userID string, addrIDs []string) error

func (*Backend) SetAuthLife

func (b *Backend) SetAuthLife(authLife time.Duration)

func (*Backend) SetMailSettingsAttachPublicKey added in v0.4.0

func (b *Backend) SetMailSettingsAttachPublicKey(userID string, attach bool) (proton.MailSettings, error)

func (*Backend) SetMessagesRead

func (b *Backend) SetMessagesRead(userID string, read bool, messageIDs ...string) error

func (*Backend) UnlabelMessages

func (b *Backend) UnlabelMessages(userID, labelID string, messageIDs ...string) error

func (*Backend) UpdateDraft

func (b *Backend) UpdateDraft(userID, draftID string, changes proton.DraftTemplate) (proton.Message, error)

func (*Backend) UpdateLabel

func (b *Backend) UpdateLabel(userID, labelID, name, parentID string) (proton.Label, error)

func (*Backend) VerifyAuth

func (b *Backend) VerifyAuth(authUID, authAcc string) (string, error)

type ID

type ID uint64

func (ID) Bytes

func (v ID) Bytes() []byte

func (*ID) FromString

func (v *ID) FromString(s string) error

func (ID) String

func (v ID) String() string

Jump to

Keyboard shortcuts

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