Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { Resource StyledName string `json:"styled_name" gorethink:"styled_name"` // Billing is a struct containing billing information. // TODO Work in progress Billing BillingData `json:"billing" gorethink:"billing"` // Password is the password used to login to the account. // It's hashed and salted using scrypt. Password string `json:"-" gorethink:"password"` // PublicKey is the fingerprint of account's default key PublicKey string `json:"public_key" gorethink:"public_key"` // Settings contains data needed to customize the user experience. Settings interface{} `json:"settings" gorethink:"settings"` // Type is the account type. // Examples (work in progress): // * beta: while in beta these are full accounts; after beta, these are normal accounts with special privileges // * std: standard, free account // * premium: premium account // * superuser: Lavaboom staff Type string `json:"type" gorethink:"type"` AltEmail string `json:"alt_email" gorethink:"alt_email"` FactorType string `json:"-" gorethink:"factor_type"` FactorValue []string `json:"-" gorethink:"factor_value"` Status string `json:"status" gorethink:"status"` Key *openpgp.Entity `json:"-" gorethink:"-"` }
Account stores essential data for a Lavaboom user, and is thus not encrypted.
func (*Account) SetPassword ¶
SetPassword changes the account's password
type Address ¶
type Address struct { // ID is an unique string <val>@lavaboom.com // Owner is the user whose address it is Resource }
type Email ¶
type Email struct { Resource MessageID string `json:"message_id" gorethink:"message_id"` // Kind is the type of encryption used in the email: // - raw - when sending raw emails before they get sent // - manifest - Manifest field is not empty, // - pgpmime - PGP/MIME format, aka everything is in body Kind string `json:"kind" gorethink:"kind"` // Unencrypted metadata information, available in both received in sent emails From string `json:"from" gorethink:"from"` To []string `json:"to" gorethink:"to"` CC []string `json:"cc" gorethink:"cc"` // BCC is only visible in sent emails BCC []string `json:"bcc" gorethink:"bcc"` // Fingerprints used for body and manifest PGPFingerprints []string `json:"pgp_fingerprints" gorethink:"pgp_fingerprints"` // Files contains IDs of other files Files []string `json:"files" gorethink:"files"` // Manifest is only available in emails that were encrypted using PGP manifests Manifest string `json:"manifest" gorethink:"manifest"` // Body contains all the data needed to send this email Body string `json:"body" gorethink:"body"` // ContentType of the body in unencrypted emails ContentType string `json:"content_type" gorethink:"content_type"` ReplyTo string `json:"reply_to" gorethink:"reply_to"` // Contains ID of the thread Thread string `json:"thread" gorethink:"thread"` // received or (queued|processed) Status string `json:"status" gorethink:"status"` }
Email is a message in a thread
type Encrypted ¶
type Encrypted struct { // Encoding tells the reader how to decode the data; can be "json", "protobuf", maybe more in the future Encoding string `json:"encoding" gorethink:"encoding"` // PGPFingerprints contains the fingerprints of the PGP public keys used to encrypt the data. PGPFingerprints []string `json:"pgp_fingerprints" gorethink:"pgp_fingerprints"` // Data is the raw, PGP-encrypted data Data string `json:"data" gorethink:"data"` // Schema is the name of the schema used to encode the data // Examples: string, contact, email Schema string `json:"schema" gorethink:"schema"` // VersionMajor is the major component of the schema version. // Schemas with the same major version should be compatible. VersionMajor int `json:"version_major" gorethink:"version_major"` // VersionMinor is the minor component of the schema version. // Schemas with different minor versions should be compatible. VersionMinor int `json:"version_minor" gorethink:"version_minor"` }
Encrypted is the base struct for PGP-encrypted resources.
type Expiring ¶
type Expiring struct { // ExpiryDate indicates when an object will expire ExpiryDate time.Time `json:"expiry_date" gorethink:"expiry_date"` }
Expiring is a base struct for resources that expires e.g. sessions.
func (*Expiring) ExpireAfterNHours ¶
ExpireAfterNHours sets the expiry date to time.Now().UTC() + n hours
func (*Expiring) ExpireSoon ¶
func (e *Expiring) ExpireSoon()
ExpireSoon sets the expiry date to something in the near future.
type Key ¶
type Key struct { Resource // ID is the fingerprint, Name is empty Expiring // ExpiryDate is either empty or expiring, user can set it Headers map[string]string `json:"headers" gorethink:"headers"` // Headers passed with the key Algorithm string `json:"algorithm" gorethink:"algorithm"` // Algorithm of the key Length uint16 `json:"length" gorethink:"length"` // Length of the key Key string `json:"key" gorethink:"key"` // Armor-encoded key KeyID string `json:"key_id" gorethink:"key_id"` // PGP key ID KeyIDShort string `json:"key_id_short" gorethink:"key_id_short"` // Shorter version of above Reliability int `json:"reliability" gorethink:"reliability"` // Reliability algorithm cached result MasterKey string `json:"master_key" gorethink:"mater_key"` // MasterKey's ID - no idea how it works }
type Label ¶
type Label struct { Resource // Builtin indicates whether a label is created/needed by the system. // Examples: inbox, trash, spam, drafts, starred, etc. Builtin bool `json:"builtin" gorethink:"builtin"` UnreadThreadsCount int `json:"unread_threads_count" gorethink:"unread_threads_count"` TotalThreadsCount int `json:"total_threads_count" gorethink:"total_threads_count"` }
Label is what IMAP calls folders, some providers call tags, and what we (and Gmail) call labels. It's both a simple way for users to organise their emails, but also a way to provide classic folder functionality (inbox, spam, drafts, etc). Examples:
- star an email: add the "starred" label
- archive an email: remove the "inbox" label
- delete an email: apply the "deleted" label (and cue for deletion)
type Resource ¶
type Resource struct { // ID is the resources ID, used as a primary key by the db. // For some resources (invites, auth tokens) this is also the data itself. ID string `json:"id" gorethink:"id"` // DateCreated is, shockingly, the time when the resource was created. DateCreated time.Time `json:"date_created" gorethink:"date_created"` // DateModified records the time of the last change of the resource. DateModified time.Time `json:"date_modified" gorethink:"date_modified"` // Name is the human-friendly name of the resource. It can either be essential (e.g. Account.Name) or optional. Name string `json:"name" gorethink:"name,omitempty"` // Owner is the ID of the account that owns this resource. Owner string `json:"owner" gorethink:"owner"` }
Resource is the base type for API resources.
func MakeResource ¶
MakeResource creates a new Resource object with sane defaults.
type Thread ¶
type Thread struct { Resource // Emails is a list of email IDs belonging to this thread Emails []string `json:"emails" gorethink:"emails"` // Labels is a list of label IDs assigned to this thread. // Note that emails lack this functionality. This way you can't only archive part of a thread. Labels []string `json:"labels" gorethink:"labels"` // Members is a slice containing userIDs or email addresses for all members of the thread Members []string `json:"members" gorethink:"members"` IsRead bool `json:"is_read" gorethink:"is_read"` LastRead string `json:"last_read" gorethink:"last_read"` Manifest string `json:"manifest,omitempty" gorethink:"manifest"` // SHA256 hash of the raw subject without prefixes SubjectHash string `json:"subject_hash" gorethink:"subject_hash"` // all, some, none Secure string `json:"secure" gorethink:"secure"` }
Thread is the data model for a list of emails, usually making up a conversation.
type Token ¶
type Token struct { Expiring Resource // Type describes the token's purpose: auth, invite, confirm, upgrade. Type string `json:"type" gorethink:"type"` }
Token is a volatile, unique object. It can be used for user authentication, confirmations, invites, etc.
func MakeAuthToken ¶
MakeAuthToken creates an authentication token, valid for a limited time.
func MakeInviteToken ¶
MakeInviteToken creates an invitation to create an account.
func (*Token) Invalidate ¶
func (t *Token) Invalidate()
Invalidate invalidates a token by adding a period (".") at the beginning of its type. It also shortens its expiration time.