rpc

package
v0.0.0-...-10245c6 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(methods interface{}, addr string, apiKey string) error

Types

type App

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

func New

func New(store Store, service Service) *App

func (*App) AddContact

func (a *App) AddContact(req *Contact, res *ContactResponse) error

func (*App) DecryptFile

func (a *App) DecryptFile(req *Decrypt, res *DecryptResponse) error

func (*App) DecryptText

func (a *App) DecryptText(req *Decrypt, res *DecryptResponse) error

func (*App) EncryptFile

func (a *App) EncryptFile(req *Encrypt, res *EncryptResponse) error

func (*App) EncryptText

func (a *App) EncryptText(req *Encrypt, res *EncryptResponse) error

func (*App) GenerateKey

func (a *App) GenerateKey(req *Key, res *KeyResponse) error

func (*App) GetContact

func (a *App) GetContact(req *Contact, res *ContactResponse) error

func (*App) GetContacts

func (a *App) GetContacts(req *string, res *ContactResponse) error

func (*App) GetKeys

func (a *App) GetKeys(req *string, res *KeyResponse) error

func (*App) GetSettings

func (a *App) GetSettings(req *string, res *string) error

func (*App) ImportContacts

func (a *App) ImportContacts(req *string, res *string) error

func (*App) ImportKeys

func (a *App) ImportKeys(req *string, res *string) error

func (*App) RemoveContact

func (a *App) RemoveContact(req *Contact, res *ContactResponse) error

func (*App) RemoveKey

func (a *App) RemoveKey(req *Key, res *KeyResponse) error

func (*App) ShowPrivateKey

func (a *App) ShowPrivateKey(req *Key, res *KeyResponse) error

func (*App) UpdateContact

func (a *App) UpdateContact(req *Contact, res *ContactResponse) error

func (*App) UpdateKey

func (a *App) UpdateKey(req *Key, res *KeyResponse) error

func (*App) UpdateSettings

func (a *App) UpdateSettings(req *string, res *string) error

type Conn

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

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Read

func (c *Conn) Read(p []byte) (n int, err error)

func (*Conn) Write

func (c *Conn) Write(d []byte) (n int, err error)

type Contact

type Contact struct {
	ID        string    `json:"id"`
	Label     string    `json:"label"`
	Key       string    `json:"key"`
	CreatedAt time.Time `json:"created_at"`
}

type ContactResponse

type ContactResponse struct {
	Contact  *Contact   `json:"contact,omitempty"`
	Contacts []*Contact `json:"contacts,omitempty"`
}

type Decrypt

type Decrypt struct {
	FilePath string   `json:"file_path,omitempty"`
	Text     string   `json:"text,omitempty"`
	Keys     []string `json:"keys"`
	Armor    bool     `json:"armor"`
}

type DecryptResponse

type DecryptResponse struct {
	Output     string `json:"output"`
	OutputPath string `json:"output_path"`
}

type Encrypt

type Encrypt struct {
	FilePath   string   `json:"file_path,omitempty"`
	Text       string   `json:"text,omitempty"`
	Recipients []string `json:"recipients"`
	Armor      bool     `json:"armor"`
}

type EncryptResponse

type EncryptResponse struct {
	OutputPath string `json:"output_path,omitempty"`
	Output     string `json:"output,omitempty"`
}

type Key

type Key struct {
	ID        string    `json:"id"`
	Key       string    `json:"key"`
	Private   string    `json:"private,omitempty"`
	Label     string    `json:"label"`
	CreatedAt time.Time `json:"created_at"`
}

type KeyResponse

type KeyResponse struct {
	Key  *Key   `json:"key,omitempty"`
	Keys []*Key `json:"keys,omitempty"`
}

type Service

type Service interface {
	Encrypt(in io.Reader, out io.Writer, useArmor bool, keys ...string) error
	Decrypt(in io.Reader, out io.Writer, keys ...string) error
	IsIdentity(key string) bool
	IsRecipient(key string) bool
	CreateKey() (private string, public string, err error)
}

type Store

type Store interface {
	Create(key, id string, value interface{}) error
	ReadAll(key string, value interface{}) error
	Read(key, id string, value interface{}) error
	Update(key, id string, value interface{}) error
	Delete(key, id string) error
}