models

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: LGPL-2.1 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AvailableOidcProviders = []*go_nuntio.OidcProvider{
		{
			Type: go_nuntio.OidcProviderType_NUNTIO_PROVIDER,
			Name: "Nuntio",
			Logo: "",
		},
		{
			Type: go_nuntio.OidcProviderType_GOOGLE_PROVIDER,
			Name: "Google",
			Logo: "",
		},
	}
)

Functions

func ConfigToProtoConfig

func ConfigToProtoConfig(config *Config) *go_nuntio.HeraConfig

func ContactToProto added in v0.1.20

func ContactToProto(contact *Contact) *go_nuntio.Contact

func EmailProviderToProto

func EmailProviderToProto(emailProvider *EmailProvider) *go_nuntio.EmailProvider

func HashToProto

func HashToProto(hash *Hash) *go_nuntio.Hash

func HeraConfigToProtoConfig

func HeraConfigToProtoConfig(h *HeraConfig) (*go_nuntio.HeraConfig, error)

func HeraConfigToProtoUsers

func HeraConfigToProtoUsers(h *HeraConfig) []*go_nuntio.User

func ImageToProto added in v0.1.27

func ImageToProto(image *Image) *go_nuntio.Image

func OidcProviderToProto

func OidcProviderToProto(provider *OidcProvider) *go_nuntio.OidcProvider

func TemplateToProto

func TemplateToProto(template *Template) *go_nuntio.Template

func TextProviderToProto

func TextProviderToProto(textProvider *TextProvider) *go_nuntio.TextProvider

func TokenToProtoToken

func TokenToProtoToken(token *Token) *go_nuntio.Token

func TokensToProto

func TokensToProto(tokens []*Token) []*go_nuntio.Token

func UserToProto added in v0.1.20

func UserToProto(user *User) *go_nuntio.User

func UsersToProto

func UsersToProto(users []*User) []*go_nuntio.User

func VerificationCodeToProto

func VerificationCodeToProto(verificationCode *VerificationCode) *go_nuntio.VerificationCode

Types

type Bcrypt

type Bcrypt struct {
	Cost int `bson:"cost" json:"cost"`
}

type Config

type Config struct {
	Id                       string                      `bson:"_id" json:"_id"`
	Name                     *cryptox.Stringx            `bson:"name" json:"name"`
	EnableSignup             bool                        `bson:"enable_signup" json:"enable_signup"`
	EnableLogin              bool                        `bson:"enable_login" json:"enable_login"`
	CreatedAt                time.Time                   `bson:"created_at" json:"created_at"`
	UpdatedAt                time.Time                   `bson:"updated_at" json:"updated_at"`
	ValidatePassword         bool                        `bson:"validate_password" json:"validate_password"`
	PublicKey                *cryptox.Stringx            `bson:"public_key" json:"public_key"`
	HashingAlgorithm         go_nuntio.HashingAlgorithm  `bson:"hashing_algorithm" json:"hashing_algorithm"`
	Bcrypt                   *Bcrypt                     `bson:"bcrypt" json:"bcrypt"`
	Scrypt                   *Scrypt                     `bson:"scrypt" json:"scrypt"`
	OidcProviders            map[string]*OidcProvider    `bson:"oidc_providers" json:"oidc_providers"`
	EmailProviders           map[string]*EmailProvider   `bson:"email_providers" json:"email_providers"`
	SelectedEmailProvider    go_nuntio.EmailProviderType `bson:"selected_email_provider" json:"selected_email_provider"`
	TextProviders            map[string]*TextProvider    `bson:"text_providers" json:"text_providers"`
	SelectedTextProvider     go_nuntio.TextProviderType  `bson:"selected_text_provider" json:"selected_text_provider"`
	SupportedLoginMechanisms []go_nuntio.LoginType       `bson:"supported_login_mechanisms" json:"supported_login_mechanisms"`
	Templates                map[string]*Template        `bson:"templates" json:"templates"`
	AccessTokenExpiry        int32                       `bson:"access_token_expiry" json:"access_token_expiry"`
	RefreshTokenExpiry       int32                       `bson:"refresh_token_expiry" json:"refresh_token_expiry"`
	VerificationCodeExpiry   int32                       `bson:"verification_code_expiry" json:"verification_code_expiry"`
	PasswordUpdatedAt        time.Time                   `bson:"password_updated_at" json:"password_updated_at"`
	Callbacks                []string                    `bson:"callbacks" json:"callbacks"`
}

func ProtoConfigToConfig

func ProtoConfigToConfig(config *go_nuntio.HeraConfig) *Config

type Contact added in v0.1.20

type Contact struct {
	Id         string    `bson:"_id" json:"_id"`
	FromUserId string    `bson:"from_user_id" json:"from_user_id"`
	ToUserId   string    `bson:"to_user_id" json:"to_user_id"`
	From       *User     `bson:"from" json:"from"`
	To         *User     `bson:"to" json:"to"`
	Accepted   bool      `bson:"accepted" json:"accepted"`
	AcceptedAt time.Time `bson:"accepted_at" json:"accepted_at"`
	SentAt     time.Time `bson:"sent_at" json:"sent_at"`
}

func ProtoToContact added in v0.1.20

func ProtoToContact(contact *go_nuntio.Contact) *Contact

type EmailProvider

type EmailProvider struct {
	Id           string                      `bson:"_id,omitempty" json:"_id,omitempty"`
	Type         go_nuntio.EmailProviderType `bson:"type,omitempty" json:"type,omitempty"`
	ConfirmEmail bool                        `bson:"confirm_email,omitempty" json:"confirm_email,omitempty"`
	Enabled      bool                        `bson:"enabled,omitempty" json:"enabled,omitempty"`
	PublicKey    *cryptox.Stringx            `bson:"public_key,omitempty" json:"public_key,omitempty"`
	PrivateKey   *cryptox.Stringx            `bson:"private_key,omitempty" json:"private_key,omitempty"`
	From         *cryptox.Stringx            `bson:"from,omitempty" json:"from,omitempty"`
}

func ProtoToEmailProvider

func ProtoToEmailProvider(emailProvider *go_nuntio.EmailProvider) *EmailProvider

type Hash

type Hash struct {
	Variant go_nuntio.HashingAlgorithm  `json:"variant,omitempty"`
	Body    string                      `json:"body,omitempty"`
	Params  map[string]*cryptox.Stringx `json:"params,omitempty"`
}

func ProtoToHash

func ProtoToHash(hash *go_nuntio.Hash) *Hash

type HeraApp

type HeraApp struct {
	Name                   string              `bson:"name" json:"name"`
	EnableSignup           *bool               `bson:"enable_signup" json:"enable_signup"`
	EnableLogin            *bool               `bson:"enable_login" json:"enable_login"`
	ValidatePassword       *bool               `bson:"validate_password" json:"validate_password"`
	VerifyEmail            *bool               `bson:"verify_email" json:"verify_email"`
	VerifyPhone            *bool               `bson:"verify_phone" json:"verify_phone"`
	LoginMechanisms        []string            `bson:"login_mechanisms" json:"login_mechanisms"`
	PublicKey              string              `bson:"public_key" json:"public_key"`
	HashingAlgorithm       string              `bson:"hashing_algorithm" json:"hashing_algorithm"`
	Scrypt                 *ScryptHera         `bson:"scrypt" json:"scrypt"`
	Bcrypt                 *Bcrypt             `bson:"bcrypt" json:"bcrypt"`
	OidcProviders          []*HeraOidcProvider `bson:"oidc_providers" json:"oidc_providers"`
	EmailProvider          *HeraEmailProvider  `bson:"email_provider" json:"email_provider"`
	TextProvider           *HeraTextProvider   `bson:"text_provider" json:"text_provider"`
	AccessTokenExpiry      *int32              `bson:"access_token_expiry,omitempty" json:"access_token_expiry,omitempty"`
	RefreshTokenExpiry     *int32              `bson:"refresh_token_expiry,omitempty" json:"refresh_token_expiry,omitempty"`
	VerificationCodeExpiry *int32              `bson:"verification_code_expiry,omitempty" json:"verification_code_expiry,omitempty"`
	Callbacks              []string            `bson:"callbacks,omitempty" json:"callbacks,omitempty"`
}

type HeraConfig

type HeraConfig struct {
	App   HeraApp    `bson:"default_config" json:"default_config"`
	Users []HeraUser `bson:"users" json:"users"`
}

type HeraEmailProvider

type HeraEmailProvider struct {
	Type         string `bson:"type" json:"type"`
	ConfirmEmail bool   `bson:"confirm_email" json:"confirm_email"`
	PublicKey    string `bson:"public_key" json:"public_key"`
	PrivateKey   string `bson:"private_key" json:"private_key"`
	From         string `bson:"from" json:"from"`
}

type HeraOidcProvider

type HeraOidcProvider struct {
	Enabled  bool     `bson:"enabled" json:"enabled"`
	Id       string   `bson:"id" json:"id"`
	Type     string   `bson:"type" json:"type"`
	Secret   string   `bson:"secret" json:"secret"`
	Name     string   `bson:"name" json:"name"`
	Url      string   `bson:"url" json:"url"`
	Scopes   []string `bson:"scopes" json:"scopes"`
	GiveRole string   `bson:"give_role" json:"give_role"`
}

type HeraTextProvider

type HeraTextProvider struct {
	Type          string `bson:"type" json:"type"`
	ConfirmNumber bool   `bson:"confirm_number" json:"confirm_number"`
	AccountId     string `bson:"account_id" json:"account_id"`
	AuthToken     string `bson:"auth_token" json:"auth_token"`
	From          string `bson:"from" json:"from"`
}

type HeraUser

type HeraUser struct {
	FirstName    string `bson:"first_name" json:"first_name"`
	LastName     string `bson:"last_name" json:"last_name"`
	Email        string `bson:"email" json:"email"`
	Password     string `bson:"password" json:"password"`
	Phone        string `bson:"phone" json:"phone"`
	Username     string `bson:"username" json:"username"`
	ProfileImage *Image `bson:"profile_image" json:"profile_image"`
	Id           string `bson:"id" json:"id"`
	Birthdate    string `bson:"birthdate" json:"birthdate"`
}

type Image added in v0.1.27

type Image struct {
	Url       *cryptox.Stringx `json:"url,omitempty"`
	ExpiresAt time.Time        `json:"updated_at,omitempty"`
	Expires   bool             `json:"expires,omitempty"`
	Key       string           `json:"key,omitempty"`
}

func ProtoToImage added in v0.1.27

func ProtoToImage(image *go_nuntio.Image) *Image

func (*Image) GetExpiresAt added in v0.1.27

func (i *Image) GetExpiresAt() time.Time

func (*Image) GetUrl added in v0.1.27

func (i *Image) GetUrl() *cryptox.Stringx

type OidcProvider

type OidcProvider struct {
	Id       *cryptox.Stringx           `bson:"id,omitempty" json:"id,omitempty"`
	Secret   *cryptox.Stringx           `bson:"secret,omitempty" json:"secret,omitempty"`
	Name     *cryptox.Stringx           `bson:"name,omitempty" json:"name,omitempty"`
	Enabled  bool                       `bson:"enabled,omitempty" json:"enabled,omitempty"`
	Url      *cryptox.Stringx           `bson:"url,omitempty" json:"url,omitempty"`
	Type     go_nuntio.OidcProviderType `bson:"type,omitempty" json:"type,omitempty"`
	Scopes   []*cryptox.Stringx         `bson:"scopes,omitempty" json:"scopes,omitempty"`
	GiveRole *cryptox.Stringx           `bson:"give_role,omitempty" json:"give_role,omitempty"`
}

func ProtoToOidcProvider

func ProtoToOidcProvider(provider *go_nuntio.OidcProvider) *OidcProvider

type Scrypt

type Scrypt struct {
	SignerKey     *cryptox.Stringx `bson:"signer_key,omitempty" json:"signer_key,omitempty"`
	SaltSeparator *cryptox.Stringx `bson:"salt_separator,omitempty" json:"salt_separator,omitempty"`
	Rounds        int              `bson:"rounds,omitempty" json:"rounds,omitempty"`
	MemCost       int              `bson:"mem_cost,omitempty" json:"mem_cost,omitempty"`
	P             int              `bson:"p,omitempty" json:"p,omitempty"`
	KeyLen        int              `bson:"key_len,omitempty" json:"key_len,omitempty"`
}

type ScryptHera

type ScryptHera struct {
	SignerKey     string `bson:"signer_key" json:"signer_key"`
	SaltSeparator string `bson:"salt_separator" json:"salt_separator"`
	Rounds        int    `bson:"rounds" json:"rounds"`
	MemCost       int    `bson:"mem_cost" json:"mem_cost"`
	P             int    `bson:"p" json:"p"`
	KeyLen        int    `bson:"key_len" json:"key_len"`
}

type Template

type Template struct {
	Id      string                 `bson:"_id" json:"_id"`
	Body    *cryptox.Stringx       `bson:"body" json:"body"`
	Subject *cryptox.Stringx       `bson:"subject" json:"subject"`
	Type    go_nuntio.TemplateType `bson:"type" json:"type"`
	Enabled bool                   `bson:"enabled" json:"enabled"`
}

func ProtoToTemplate

func ProtoToTemplate(template *go_nuntio.Template) *Template

type TextProvider

type TextProvider struct {
	Id            string                     `bson:"_id" json:"_id"`
	Type          go_nuntio.TextProviderType `bson:"type,omitempty" json:"type,omitempty"`
	ConfirmNumber bool                       `bson:"confirm_number,omitempty" json:"confirm_number,omitempty"`
	AccountId     *cryptox.Stringx           `bson:"account_id,omitempty" json:"account_id,omitempty"`
	AuthToken     *cryptox.Stringx           `bson:"auth_token,omitempty" json:"auth_token,omitempty"`
	From          *cryptox.Stringx           `bson:"from,omitempty" json:"from,omitempty"`
}

func ProtoToTextProvider

func ProtoToTextProvider(textProvider *go_nuntio.TextProvider) *TextProvider

type Token

type Token struct {
	Id               string                     `bson:"_id" json:"_id"`
	UserId           string                     `bson:"user_id,omitempty" json:"user_id,omitempty"`
	Blocked          bool                       `bson:"blocked,omitempty" json:"blocked,omitempty"`
	DeviceInfo       *cryptox.Stringx           `bson:"device_info,omitempty" json:"device_info,omitempty"`
	LoggedInFrom     *cryptox.Stringx           `bson:"logged_in_from,omitempty" json:"logged_in_from,omitempty"`
	TokenType        go_nuntio.TokenType        `bson:"token_type,omitempty" json:"token_type,omitempty"`
	LoginType        go_nuntio.LoginType        `bson:"login_type,omitempty" json:"login_type,omitempty"`
	PlatformType     go_nuntio.PlatformType     `bson:"platform_type,omitempty" json:"platform_type,omitempty"`
	OidcProviderType go_nuntio.OidcProviderType `bson:"oidc_provider_type,omitempty" json:"oidc_provider_type,omitempty"`
	BlockedAt        time.Time                  `bson:"blocked_at,omitempty" json:"blocked_at,omitempty"`
	CreatedAt        time.Time                  `bson:"created_at,omitempty" json:"created_at,omitempty"`
	UsedAt           time.Time                  `bson:"used_at,omitempty" json:"used_at,omitempty"`
	ExpiresAt        time.Time                  `bson:"expires_at,omitempty" json:"expires_at,omitempty"` // unix time
}

func ProtoTokenToToken

func ProtoTokenToToken(token *go_nuntio.Token) *Token

type User

type User struct {
	Id                   string                `bson:"_id" json:"_id"`
	Username             *cryptox.Stringx      `bson:"username,omitempty" json:"username,omitempty"`
	Email                *cryptox.Stringx      `bson:"email,omitempty" json:"email,omitempty"`
	Password             *Hash                 `bson:"password,omitempty" json:"password,omitempty"`
	ProfileImage         *Image                `bson:"profile_image,omitempty" json:"profile_image,omitempty"`
	CoverImage           *Image                `bson:"cover_image,omitempty" json:"cover_image,omitempty"`
	CreatedAt            time.Time             `bson:"created_at,omitempty" json:"created_at,omitempty"`
	UpdatedAt            time.Time             `bson:"updated_at,omitempty" json:"updated_at,omitempty"`
	FirstName            *cryptox.Stringx      `bson:"first_name,omitempty" json:"first_name,omitempty"`
	LastName             *cryptox.Stringx      `bson:"last_name,omitempty" json:"last_name,omitempty"`
	Birthdate            *cryptox.Stringx      `bson:"birthdate,omitempty" json:"birthdate,omitempty"`
	VerifiedEmails       []string              `bson:"verified_emails,omitempty" json:"verified_emails,omitempty"`
	EmailHash            string                `bson:"email_hash,omitempty" json:"email_hash,omitempty"`
	Phone                *cryptox.Stringx      `bson:"phone,omitempty" json:"phone,omitempty"`
	PhoneHash            string                `bson:"phone_hash,omitempty" json:"phone_hash,omitempty"`
	VerifiedPhoneNumbers []string              `bson:"verified_phone_numbers,omitempty" json:"verified_phone_numbers,omitempty"`
	PreferredLanguage    go_nuntio.CountryCode `bson:"preferred_language,omitempty" json:"preferred_language,omitempty"`
	UsernameHash         string                `bson:"username_hash,omitempty" json:"username_hash,omitempty"`
	Gender               *cryptox.Stringx      `bson:"gender,omitempty" json:"gender,omitempty"`
	Country              *cryptox.Stringx      `bson:"country,omitempty" json:"country,omitempty"`
	Address              *cryptox.Stringx      `bson:"address,omitempty" json:"address,omitempty"`
	City                 *cryptox.Stringx      `bson:"city,omitempty" json:"city,omitempty"`
	PostalCode           *cryptox.Stringx      `bson:"postal_code,omitempty" json:"postal_code,omitempty"`
	Role                 string                `bson:"role,omitempty" json:"role,omitempty"`
	Ssn                  *cryptox.Stringx      `bson:"ssn,omitempty" json:"ssn,omitempty"`
	RegistrationType     go_nuntio.LoginType   `bson:"registration_type,omitempty" json:"registration_type,omitempty"`
	ContactAccepted      bool                  `bson:"contact_accepted,omitempty" json:"contact_accepted,omitempty"`
}

func ProtoToUser

func ProtoToUser(user *go_nuntio.User) *User

func ProtoToUsers added in v0.1.14

func ProtoToUsers(users []*go_nuntio.User) []*User

type VerificationCode

type VerificationCode struct {
	Id          string                     `bson:"_id" json:"_id"`
	Code        *Hash                      `bson:"code" json:"code"`
	SentAt      time.Time                  `bson:"sent_at" json:"sent_at"`
	ExpiresAt   time.Time                  `bson:"expires_at" json:"expires_at"`    // unix time
	LastAttempt time.Time                  `bson:"last_attempt" json:"LastAttempt"` // unix time
	Attempts    int32                      `bson:"attempts" json:"attempts"`
	UserId      string                     `bson:"user_id" json:"user_id"`
	Type        go_nuntio.VerificationType `bson:"verification_type" json:"verification_type"`
}

func ProtoToVerificationCode

func ProtoToVerificationCode(verificationCode *go_nuntio.VerificationCode) *VerificationCode

Jump to

Keyboard shortcuts

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