Documentation ¶
Index ¶
- Constants
- func NormalizeAddress(input string) string
- func NormalizeUsername(input string) string
- func RemoveDots(input string) string
- type Account
- type Address
- type Application
- type Meta
- type PublicKey
- type PublicKeyIdentity
- type PublicKeySignature
- type ReferenceType
- type Resource
- type Tags
- type Token
- type TokenType
Constants ¶
const ( AuthToken TokenType = "auth" CodeToken = "code" UploadToken = "upload" )
AuthToken is for authorization, CodeToken is for 3rd party app OAuth flow.
Variables ¶
This section is empty.
Functions ¶
func NormalizeAddress ¶
NormalizeAddress splits the email into two parts and performs normalization on both parts
func NormalizeUsername ¶
NormalizeUsername removes all weird stuff from the username
func RemoveDots ¶
RemoveDots performs a Gmail-like operation on the email - removes all dots.
Types ¶
type Account ¶
type Account struct { ID uint64 `db:"id" json:"id" goqu:"skipinsert"` DateCreated time.Time `db:"date_created" json:"date_created"` DateModified time.Time `db:"date_modified" json:"date_modified"` Type string `db:"type" json:"type"` MainAddress string `db:"main_address" json:"main_address"` Identity string `db:"identity" json:"identity"` Password string `db:"password" json:"-"` Subscription string `db:"subscription" json:"subscription"` Blocked bool `db:"blocked" json:"blocked"` AltEmail string `db:"alt_email" json:"alt_email"` AltEmailVerified time.Time `db:"alt_email_verified" json:"alt_email_verified"` }
Account is pretty much an account.
type Address ¶
type Address struct { ID string `db:"id" json:"id"` StyledID string `db:"styled_id" json:"styled_id"` DateCreated time.Time `db:"date_created" json:"date_created"` DateModified time.Time `db:"date_modified" json:"date_modified"` Account uint64 `db:"account" json:"account"` PublicKey uint64 `db:"public_key" json:"public_key"` }
Address is the mapping between email addresses and accounts
type Application ¶
type Application struct { ID uint64 `db:"id" json:"id" goqu:"skipinsert"` DateCreated time.Time `db:"date_created" json:"date_created"` DateModified time.Time `db:"date_modified" json:"date_modified"` Owner uint64 `db:"owner" json:"owner"` Secret string `db:"secret" json:"secret"` Callback string `db:"callback" json:"callback"` Name string `db:"name" json:"name"` Email string `db:"email" json:"email"` HomePage string `db:"home_page" json:"home_page"` Description string `db:"description" json:"description"` }
Application is an entity used for OAuth token creation
type Meta ¶
type Meta map[string]interface{}
Meta is a custom JSON storage type for objects
type PublicKey ¶
type PublicKey struct { ID uint64 `db:"key_id" json:"key_id"` DateCreated time.Time `db:"date_created" json:"date_created"` DateModified time.Time `db:"date_modified" json:"date_modified"` Owner uint64 `db:"owner" json:"owner"` Algorithm uint8 `db:"algorithm" json:"algorithm"` Length uint16 `db:"length" json:"length"` Body []byte `db:"body" json:"body"` KeyIDString string `db:"key_id_string" json:"key_id_string"` KeyIDShortString string `db:"key_id_short_string" json:"key_id_short_string"` MasterKey uint64 `db:"master_key" json:"master_key"` }
PublicKey is the representation of a public key in the system
type PublicKeyIdentity ¶
type PublicKeyIdentity struct { ID uint64 `db:"identity" json:"identity" goqu:"skipinsert"` Key uint64 `db:"key" json:"key"` Name string `db:"name" json:"name"` SelfSignature uint64 `db:"self_signature" json:"self_signature"` Signatures []uint64 `db:"signatures" json:"signatures"` }
PublicKeyIdentity is part of the metadata of the key, a signed identity of the key
type PublicKeySignature ¶
type PublicKeySignature struct { ID uint64 `db:"id" json:"id" goqu:"skipinsert"` Type uint8 `db:"type" json:"type"` Algorithm uint8 `db:"algorithm" json:"algorithm"` Hash uint `db:"hash" json:"hash"` CreationTime time.Time `db:"creation_time" json:"creation_time"` SigLifetimeSecs uint32 `db:"sig_lifetime_secs" json:"sig_lifetime_secs"` KeyLifetimeSecs uint32 `db:"key_lifetime_secs" json:"key_lifetime_secs"` IssuerKeyID uint64 `db:"issuer_key_id" json:"issuer_key_id"` IsPrimaryID bool `db:"is_primary_id" json:"is_primary_id"` RevocationReason uint8 `db:"revocation_reason" json:"revocation_reason"` RevocationReasonText string `db:"revocation_reason_text" json:"revocation_reason_text"` }
PublicKeySignature is a signature of an identity. Creates Web of Trust.
type ReferenceType ¶
type ReferenceType string
ReferenceType is what the token refers to in case of upload and fetch tokens.
const ( ResourceRef ReferenceType = "resource" EmailRef = "email" )
ReferenceType is all the possible models that you can reference
func (*ReferenceType) Scan ¶
func (t *ReferenceType) Scan(value interface{}) error
Scan implements the database/sql Scanner interface
type Resource ¶
type Resource struct { ID uint64 `db:"id" json:"id" goqu:"skipinsert"` DateCreated time.Time `db:"date_created" json:"date_created"` DateModified time.Time `db:"date_modified" json:"date_modified"` Owner uint64 `db:"owner" json:"owner"` Meta Meta `db:"meta" json:"meta"` Tags Tags `db:"tags" json:"tags"` File string `db:"file" json:"file,omitempty"` UploadToken string `db:"upload_token" json:"upload_token,omitempty"` }
Resource is a basic storage in the system without any particular structure.
type Tags ¶
type Tags []string
Tags is a custom JSON storage type for arrays
type Token ¶
type Token struct { ID string `db:"id" json:"id" goqu:"skipinsert"` DateCreated time.Time `db:"date_created" json:"date_created"` DateModified time.Time `db:"date_modified" json:"date_modified"` Owner uint64 `db:"owner" json:"owner"` ExpiryDate time.Time `db:"expiry_date" json:"expiry_date"` Type TokenType `db:"type" json:"type"` Perms perms.Nodes `db:"perms" json:"perms,omitempty"` Application uint64 `db:"application" json:"application,omitempty"` ReferenceType ReferenceType `db:"reference_type" json:"reference_type,omitempty"` ReferenceID uint64 `db:"reference_id" json:"reference_id,omitempty"` }
Token is an implementation of both types of OAuth tokens implement some sorts of perms