typtop

package
v0.0.0-...-0c294a2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RSADecrypt

func RSADecrypt(privateKey *rsa.PrivateKey, ciphertext []byte) []byte

func RSAEncrypt

func RSAEncrypt(publicKey *rsa.PublicKey, message []byte) []byte

Types

type CacheState

type CacheState struct {
	// w
	RegisteredPassword string
	// F
	TypoCacheFrequency []int
	// M
	WaitListFrequency map[string]int
	// U
	TypoIndexPairs []TypoIndexPair
}

CacheState represents the state of the cache

type Checker

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

Checker represents a typtop checker service...

func NewChecker

func NewChecker(typtopConfig *config.TypTopChecker, typoFrequency map[string]int) (checker *Checker)

NewChecker initialises the Checker

func (*Checker) Login

func (checker *Checker) Login(state *State, submittedPassword string, privateKey *rsa.PrivateKey) (bool, *State)

Login checks if the typtop user's password

func (*Checker) Register

func (checker *Checker) Register(password string) (state *State, privateKey *rsa.PrivateKey)

Register initialises the user's state

type State

type State struct {
	Publickey          *rsa.PublicKey `json:"publicKey"`
	CipheredCacheState []byte         `json:"cipheredCacheState"`
	TypoCache          [][]byte       `json:"typoCache"`
	WaitList           [][]byte       `json:"waitList"`
	Gamma              int            `json:"gamma"`
}

State represents the server state in Chatterjee et al. typo correction paper

type TypoIndexPair

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

TypoIndexPair represents a typo and the index of that typo in the typo cache

type User

type User struct {
	ID            int             `json:"id"`
	Email         string          `json:"email"`
	LoginAttempts int             `json:"loginAttempts"`
	PrivateKey    *rsa.PrivateKey `json:"privateKey"`
	State         *State          `json:"typtopState"`
}

User represents a TypTop user

Jump to

Keyboard shortcuts

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