Documentation
¶
Index ¶
- Variables
- func DecryptData(params UnifiedParams) (string, error)
- func DecryptPin(params UnifiedParams) (string, error)
- func EncryptData(params UnifiedParams) (string, error)
- func EncryptPin(params UnifiedParams) (string, error)
- func GenerateMac(params UnifiedParams) (string, error)
- func InitialKey(params UnifiedParams) (string, error)
- func MakeHTTPHandler(s Service) http.Handler
- func TransactionKey(params UnifiedParams) (string, error)
- type BaseKey
- type Machine
- type Repository
- type Service
- type UnifiedParams
- type WrapperCall
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBadRouting is returned when an expected path variable is missing, which is always programmer error. ErrBadRouting = fmt.Errorf("inconsistent mapping between route and handler, %s", bugReportHelp) ErrFoundABug = fmt.Errorf("snuck into machine with err == nil, %s", bugReportHelp) )
View Source
var ( ErrNotFound = errors.New("not found") ErrAlreadyExists = errors.New("already exists") )
Functions ¶
func DecryptData ¶
func DecryptData(params UnifiedParams) (string, error)
func DecryptPin ¶
func DecryptPin(params UnifiedParams) (string, error)
func EncryptData ¶
func EncryptData(params UnifiedParams) (string, error)
func EncryptPin ¶
func EncryptPin(params UnifiedParams) (string, error)
func GenerateMac ¶
func GenerateMac(params UnifiedParams) (string, error)
func InitialKey ¶
func InitialKey(params UnifiedParams) (string, error)
func MakeHTTPHandler ¶
func TransactionKey ¶
func TransactionKey(params UnifiedParams) (string, error)
Types ¶
type Machine ¶
type Machine struct {
BaseKey
InitialKey string
CurrentKSN string
TransactionKey string
CreatedAt time.Time
}
func NewMachine ¶
type Repository ¶
type Repository interface {
StoreMachine(m *Machine) error
FindMachine(ik string) (*Machine, error)
FindAllMachines() []*Machine
DeleteMachine(ik string) error
}
Repository is the Service storage mechanism abstraction
func NewRepositoryInMemory ¶
func NewRepositoryInMemory(logger log.Logger) Repository
NewRepositoryInMemory is an in memory ach storage repository for machines
type Service ¶
type Service interface {
CreateMachine(m *Machine) error
GetMachine(ik string) (*Machine, error)
GetMachines() []*Machine
MakeNextKSN(ik string) (*Machine, error)
DeleteMachine(ik string) error
EncryptPin(ik, pin, pan, format string) (string, error)
DecryptPin(ik, ciphertext, pan, format string) (string, error)
GenerateMac(ik, data, action, macType string) (string, error)
EncryptData(ik, data, action, iv string) (string, error)
DecryptData(ik, ciphertext, action, iv string) (string, error)
}
Service is a REST interface for interacting with machine structures
type UnifiedParams ¶
type UnifiedParams struct {
Algorithm string
AlgorithmKey string
BKD string
KSN string
IK string
TK string
PIN string
PAN string
Format string
MacType string
Plaintext string
Ciphertext string
Action string
IV string
}
func (UnifiedParams) ValidateAlgorithm ¶
func (p UnifiedParams) ValidateAlgorithm() error
type WrapperCall ¶
type WrapperCall func(params UnifiedParams) (string, error)
Click to show internal directories.
Click to hide internal directories.