models

package
v0.0.0-...-7438d6a Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2015 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Scopes = map[string]struct{}{
	"password_grant":      {},
	"admin":               {},
	"account":             {},
	"account:read":        {},
	"account:address":     {},
	"account:modify":      {},
	"account:delete":      {},
	"addresses":           {},
	"addresses:read":      {},
	"addresses:modify":    {},
	"addresses:delete":    {},
	"applications":        {},
	"applications:read":   {},
	"applications:modify": {},
	"applications:delete": {},
	"emails":              {},
	"emails:send":         {},
	"emails:read":         {},
	"emails:modify":       {},
	"emails:delete":       {},
	"keys":                {},
	"keys:read":           {},
	"labels":              {},
	"labels:read":         {},
	"labels:modify":       {},
	"labels:delete":       {},
	"resources":           {},
	"resources:read":      {},
	"resources:modify":    {},
	"resources:delete":    {},
	"threads":             {},
	"threads:read":        {},
	"threads:modify":      {},
	"threads:delete":      {},
	"tokens":              {},
	"tokens:read":         {},
	"tokens:oauth":        {},
	"tokens:logout":       {},
	"tokens:modify":       {},
	"tokens:delete":       {},
}

Functions

func InScope

func InScope(scope []string, what []string) bool

Types

type Account

type Account struct {
	ID           string    `json:"id" gorethink:"id"`                                           // 20-char long id
	DateCreated  time.Time `json:"date_created,omitempty" gorethink:"date_created,omitempty"`   // when the account was created
	DateModified time.Time `json:"date_modified,omitempty" gorethink:"date_modified,omitempty"` // last modification
	MainAddress  string    `json:"main_address" gorethink:"main_address"`                       // main address id
	Password     []byte    `json:"-" gorethink:"password,omitempty"`                            // scrypt'd sha256 password
	Subscription string    `json:"subscription" gorethink:"subscription"`                       // chosen subscription
	AltEmail     string    `json:"alt_email" gorethink:"alt_email"`                             // alternative email
	Status       string    `json:"status" gorethink:"status"`                                   // account's status
}

func (*Account) SetPassword

func (a *Account) SetPassword(password []byte) error

func (*Account) VerifyPassword

func (a *Account) VerifyPassword(password []byte) (bool, bool, error)

type Address

type Address struct {
	ID           string    `json:"id" gorethink:"id"`                                 // the actual address
	StyledID     string    `json:"styled_id" gorethink:"styled_id"`                   // what the address looks like
	DateCreated  time.Time `json:"date_created" gorethink:"date_created,omitempty"`   // when it was created
	DateModified time.Time `json:"date_modified" gorethink:"date_modified,omitempty"` // last update
	Owner        string    `json:"owner" gorethink:"owner"`                           // who owns it
	PublicKey    string    `json:"public_key" gorethink:"public_key"`                 // default public key
}

type Application

type Application struct {
	ID           string    `json:"id" gorethink:"id"`
	DateCreated  time.Time `json:"date_created,omitempty" gorethink:"date_created,omitempty"`
	DateModified time.Time `json:"date_modified,omitempty" gorethink:"date_modified,omitempty"`
	Owner        string    `json:"owner" gorethink:"owner"`

	Secret   string `json:"secret" gorethink:"secret"`
	Callback string `json:"callback" gorethink:"callback"`

	Homepage    string `json:"homepage" gorethink:"homepage"`
	Name        string `json:"name" gorethink:"name"`
	Description string `json:"description" gorethink:"description"`
}

type Email

type Email struct {
	ID           string    `json:"id" gorethink:"id"`                                           // 20-char id
	DateCreated  time.Time `json:"date_created,omitempty" gorethink:"date_created,omitempty"`   // time of creation
	DateModified time.Time `json:"date_modified,omitempty" gorethink:"date_modified,omitempty"` // time of last mod
	Owner        string    `json:"owner" gorethink:"owner"`                                     // Owner of the email

	MessageID string `json:"message_id" gorethink:"message_id"`

	Thread string `json:"thread" gorethink:"thread"` // thread id
	Status string `json:"status" gorethink:"status"` // status - received, sent or sending

	Manifest []byte `json:"manifest" gorethink:"manifest"` // Description of the body including keys
	Body     []byte `json:"body" gorethink:"body"`         // Email's body encrypted using AES256-CTR
}

type EmailNode

type EmailNode struct {
	Headers        mail.Header  `json:"headers"`
	BasePosition   int          `json:"base_position"`
	HeaderPosition [2]int       `json:"header_position"`
	BodyPosition   [2]int       `json:"body_position"`
	Children       []*EmailNode `json:"children,omitempty"`
}

type Identity

type Identity struct {
	Name          string       `json:"name" gorethink:"name"`
	SelfSignature *Signature   `json:"self_signature" gorethink:"self_signature"`
	Signatures    []*Signature `json:"signatures" gorethink:"signatures"`
}

type Key

type Key struct {
	ID           string    `json:"id" gorethink:"id"`                                           // key's fingerprint
	DateCreated  time.Time `json:"date_created,omitempty" gorethink:"date_created,omitempty"`   // when it was created
	DateModified time.Time `json:"date_modified,omitempty" gorethink:"date_modified,omitempty"` // last update
	Owner        string    `json:"owner,omitempty" gorethink:"owner,omitempty"`                 // owner of the key

	Algorithm        uint8  `json:"algorithm,omitempty" gorethink:"algorithm,omitempty"` // algorithm of the key
	Length           uint16 `json:"length,omitempty" gorethink:"length,omitempty"`       // key's length
	Body             []byte `json:"body,omitempty" gorethink:"body,omitempty"`           // the actual key
	KeyID            uint64 `json:"key_id,omitempty" gorethink:"key_id,omitempty"`
	KeyIDString      string `json:"key_id_string,omitempty" gorethink:"key_id_string,omitempty"`             // key_id
	KeyIDShortString string `json:"key_id_short_string,omitempty" gorethink:"key_id_short_string,omitempty"` // shorter version of key_id
	MasterKey        string `json:"master_key,omitempty" gorethink:"master_key,omitempty"`                   // master key

	Identities []*Identity `json:"identities,omitempty" gorethink:"identities,omitempty"`
}

type Label

type Label struct {
	ID           string    `json:"id" gorethink:"id"`                                           // 20-char id
	DateCreated  time.Time `json:"date_created,omitempty" gorethink:"date_created,omitempty"`   // time of creation
	DateModified time.Time `json:"date_modified,omitempty" gorethink:"date_modified,omitempty"` // time of last mod
	Owner        string    `json:"owner" gorethink:"owner"`                                     // Owner of the email

	Name   string `json:"name" gorethink:"name"`
	System bool   `json:"system" gorethink:"system"`
}

type Manifest

type Manifest struct {
	Key         []byte     `json:"key"`
	Nonce       []byte     `json:"nonce"`
	Description *EmailNode `json:"description"`
}

type Resource

type Resource struct {
	ID           string    `json:"id" gorethink:"id"`                                           // 20-char id
	DateCreated  time.Time `json:"date_created,omitempty" gorethink:"date_created,omitempty"`   // time of creation
	DateModified time.Time `json:"date_modified,omitempty" gorethink:"date_modified,omitempty"` // time of last mod
	Owner        string    `json:"owner" gorethink:"owner"`                                     // Owner of the email

	Meta map[string]interface{} `json:"meta,omitempty" gorethink:"meta,omitempty"`
	Body []byte                 `json:"body" gorethink:"body"`
	Tags []string               `json:"tags,omitempty" gorethink:"tags,omitempty"`
}

type Signature

type Signature struct {
	Type         uint8     `json:"type" gorethink:"type"`
	Algorithm    uint8     `json:"algorithm" gorethink:"algorithm"`
	Hash         uint      `json:"hash" gorethink:"hash"`
	CreationTime time.Time `json:"creation_time" gorethink:"creation_time"`

	SigLifetimeSecs *uint32 `json:"sig_lifetime_secs,omitempty" gorethink:"sig_lifetime_secs,omitempty"`
	KeyLifetimeSecs *uint32 `json:"key_lifetime_secs,omitempty" gorethink:"key_lifetime_secs,omitempty"`
	IssuerKeyID     *uint64 `json:"issuer_key_id,omitempty" gorethink:"issuer_key_id,omitempty"`
	IsPrimaryID     *bool   `json:"is_primary_id,omitempty" gorethink:"is_primary_id,omitempty"`

	RevocationReason     *uint8 `json:"revocation_reason,omitempty" gorethink:"revocation_reason,omitempty"`
	RevocationReasonText string `json:"revocation_reason_text,omitempty" gorethink:"revocation_reason_text,omitempty"`
}

type Thread

type Thread struct {
	ID           string    `json:"id" gorethink:"id"`                                           // 20-char id
	DateCreated  time.Time `json:"date_created,omitempty" gorethink:"date_created,omitempty"`   // time of creation
	DateModified time.Time `json:"date_modified,omitempty" gorethink:"date_modified,omitempty"` // time of last mod
	Owner        string    `json:"owner" gorethink:"owner"`                                     // Owner of the email

	Labels  []string `json:"labels" gorethink:"labels"`
	Members []string `json:"members" gorethink:"members"`

	IsRead   bool   `json:"is_read" gorethink:"is_read"`
	LastRead string `json:"last_read" gorethink:"last_read"`

	Secure string `json:"secure" gorethink:"secure"`

	Manifest []byte `json:"manifest,omitempty" gorethink:"manifest,omitempty"`
}

type Token

type Token struct {
	ID           string    `json:"id" gorethink:"id"`                                           // 20-char id
	DateCreated  time.Time `json:"date_created,omitempty" gorethink:"date_created,omitempty"`   // time of creation
	DateModified time.Time `json:"date_modified,omitempty" gorethink:"date_modified,omitempty"` // time of last mod
	Owner        string    `json:"owner" gorethink:"owner"`                                     // Owner of the email
	ExpiryDate   time.Time `json:"expiry_date,omitempty" gorethink:"expiry_date,omitempty"`

	Type     string   `json:"type" gorethink:"type"` // auth/activate/code
	Scope    []string `json:"scope,omitempty" gorethink:"scope,omitempty"`
	ClientID string   `json:"client_id,omitempty" gorethink:"client_id,omitempty"`
}

func (*Token) IsExpired

func (t *Token) IsExpired() bool

Jump to

Keyboard shortcuts

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