register

package
v0.0.0-...-08046e1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 6 Imported by: 0

README

Register

The register service can be used in conjonction with a mint to allow public registration on it. This is what powers registration of the settle.network mint.

Registration is made available from the settle command line and consists in:

  • capturing the email of the user in the command line
  • submitting a registration request to the register service
  • sending a credentials link to the user over email

Once the user follows the credentials link, we verify that he is human and display his credentials to them.

It can be used by other mints, but is not mandatory to run a mint (registration of users is left out of the specification of a mint).

Documentation

Index

Constants

View Source
const (
	// EnvCfgHost is the env config key for the register host.
	EnvCfgHost env.ConfigKey = "host"
	// EnvCfgPort is the port on which to run the register.
	EnvCfgPort env.ConfigKey = "port"
	// EnvCfgCredsURL is the URL that is sent to the user over email to
	// retrieve their credentials.
	EnvCfgCredsURL env.ConfigKey = "credentials_url"
	// EnvCfgMint is the env config key for the mint this register service is
	// bound to.
	EnvCfgMint env.ConfigKey = "mint"
	// EnvCfgSMTPLogin is the env config key for the SMTP login to use to send
	// verification emails.
	EnvCfgSMTPLogin env.ConfigKey = "smtp_login"
	// EnvCfgSMTPPassword is the env config key for the SMTP password to use to
	// send verification emails.
	EnvCfgSMTPPassword env.ConfigKey = "smtp_password"
	// EnvCfgSMTPHost is the env config key for the SMTP host to use to send
	// verification emails.
	EnvCfgSMTPHost env.ConfigKey = "smtp_host"
	// EnvCfgFrom is the email address to send registration emails from.
	EnvCfgFrom env.ConfigKey = "from"
)
View Source
const (
	// Version is the current protocol version.
	Version string = "0"
	// TimeResolutionNs is the resolution of our time variables in nanoseconds
	// (aka resolution in milliseconds).
	TimeResolutionNs int64 = 1000 * 1000
)

Variables

This section is empty.

Functions

func GetCredsURL

func GetCredsURL(
	ctx context.Context,
) string

GetCredsURL retrieves the credentials URL for users to retrieve their credentials.

func GetFrom

func GetFrom(
	ctx context.Context,
) string

GetFrom retrieves the current address to send registration emails from

func GetHost

func GetHost(
	ctx context.Context,
) string

GetHost retrieves the current register host from the given contest.

func GetMint

func GetMint(
	ctx context.Context,
) string

GetMint retrieves the current mint host from the given contest.

func GetPort

func GetPort(
	ctx context.Context,
) string

GetPort retrieves the current register port from the given contest.

func GetSMTP

func GetSMTP(
	ctx context.Context,
) (*smtp.Auth, string)

GetSMTP retrieves the SMTP credentials.

Types

type CredentialsResource

type CredentialsResource struct {
	Address  string `json:"address"`
	Password string `json:"password"`
}

CredentialsResource is the representation of user credentials.

type UserResource

type UserResource struct {
	ID      string    `json:"id"`
	Created int64     `json:"created"`
	Status  UsrStatus `json:"status"`

	Username string `json:"username"`
	Email    string `json:"email"`

	Credentials *CredentialsResource `json:"credentials"`
}

UserResource is the representation of a user in the register API.

type UsrStatus

type UsrStatus string

UsrStatus is the status of a user.

const (
	// UsrStUnverified is an unverified user.
	UsrStUnverified UsrStatus = "unverified"
	// UsrStVerified is a verified user
	UsrStVerified UsrStatus = "verified"
)

func (*UsrStatus) Scan

func (s *UsrStatus) Scan(src interface{}) error

Scan implements sql.Scanner.

func (UsrStatus) Value

func (s UsrStatus) Value() (value driver.Value, err error)

Value implements driver.Valuer.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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