deal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHighThreshold = errors.New("threshold cannot be higher than the number of players")

ErrHighThreshold is returned when the number of players is lower than the threshold

View Source
var ErrInvalidTOTPSecret = errors.New("the provided value is not a valid TOTP secret key")

ErrInvalidTOTPSecret is returned when testing the given secret against the TOTP algorithm unsuccessfully

View Source
var ErrLowThreshold = errors.New("threshold cannot be lower than 2")

ErrLowThreshold is returned when the provided threshold makes no sense: if less than 2, there's no reason to use farMFA

Functions

func CreateTocs

func CreateTocs(note, secret string, players []*Player, threshold int) (map[string]string, error)

CreateTocs generates encrypted len(players) encrypted Tocs from secret; note is a message to remind the purpose of these Tocs

Types

type EncryptFunc

type EncryptFunc func(toc *api.Toc) (string, error)

EncryptFunc turns a Toc into an encrypted string

func EncryptWithAge

func EncryptWithAge(playerKeys ...age.Recipient) EncryptFunc

EncryptWithAge is used to encrypt a JSON-marshalled Toc with Age for a certain player

type Player

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

Player represents an individual who receives an encrypted Toc

func NewPlayer

func NewPlayer(address string, encryptionFunc EncryptFunc) (*Player, error)

func (*Player) EncryptToc

func (p *Player) EncryptToc(toc *api.Toc) (string, error)

EncryptToc simply encrypts a Toc for the intended player

Jump to

Keyboard shortcuts

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