server

package
v0.0.0-...-3d10487 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: BSD-2-Clause, BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// InvalidTokenErr is returned when passed a token for a user that does
	// not exist.
	InvalidTokenErr = errors.New("Invalid token, login required")

	// InvalidCredentialsErr is returned when a username does not match a
	// registered user or the password hashed with a salt does not match the
	// expected password hash.
	InvalidCredentialsErr = errors.New("invalid username or password")
)

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server contains the comms server and handler.

func NewServer

func NewServer(storageDir string, tokenTTL time.Duration, userRecords [][]string,
	id *id.ID, localServer string, certPem, keyPem []byte) (*Server, error)

NewServer generates a new server with a remote sync comms server. Returns an error if the key pair cannot be generated.

func (*Server) Start

func (s *Server) Start() error

Start starts the comms HTTPS server.

type Token

type Token nonce.Value

Token that identifies a user. It is unique and generated from a user's username and password.

func UnmarshalToken

func UnmarshalToken(b []byte) Token

UnmarshalToken unmarshalls the byte slice into a Token.

func (Token) Marshal

func (t Token) Marshal() []byte

Marshal marshals the Token into a byte slice.

Jump to

Keyboard shortcuts

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