shh

package module
v0.0.0-...-230a2ce Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: MIT Imports: 21 Imported by: 0

README

SHH

A simple "shh" for your browser-server trades.

It's only a very simple service to generate temporal RSA Keypairs and use it for encode your browser -> server trades. In the graphic below you can see how SHH works.

basic implementation

See sshjs here: https://github.com/bregydoc/shh-js

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

type BasicCredentials

type BasicCredentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type Config

type Config struct {
	APIPort      string      `yaml:"api_port" env:"API_PORT"`
	RPCPort      string      `yaml:"rpc_port" env:"RPC_PORT"`
	StoreBackend StoreConfig `yaml:"store_backend" env:"STORE_BACKEND"`
}

func LoadConfig

func LoadConfig(filename ...string) (*Config, error)

type Option

type Option func(wizard *Wizard) error

func WithConfigAPI

func WithConfigAPI(prefixURL string, port string, e ...*gin.Engine) Option

func WithConfigRPC

func WithConfigRPC(port string) Option

func WithDefaultAPI

func WithDefaultAPI() Option

func WithFullAvailableAPI

func WithFullAvailableAPI() Option

func WithRandomSource

func WithRandomSource(reader io.Reader) Option

func WithStore

func WithStore(s Store) Option

type Pair

type Pair struct {
	PrivateKeyPem string
	PublicKeyPem  string
}

type PairEvent

type PairEvent string
const EventPairExpired PairEvent = "expired"

type Store

type Store interface {
	RegisterNewPair(token string, pair *Pair) error
	ObservePublic(token, publicKey string, callback func(e *PairEvent)) error
	GetPair(token, publicKey string) (*Pair, error)
}

type StoreConfig

type StoreConfig struct {
	Type     string `yaml:"type" env:"STORE_TYPE"`
	Address  string `yaml:"address" env:"STORE_ADDRESS"`
	Username string `yaml:"username" env:"STORE_USERNAME"`
	Password string `yaml:"password" env:"STORE_PASSWORD"`
}

type ToFold

type ToFold struct {
	Credentials BasicCredentials `json:"credentials"`
	Message     string           `json:"message"`
	PublicKey   string           `json:"public_key"`
}

type ToUnfold

type ToUnfold struct {
	Credentials   BasicCredentials `json:"credentials"`
	FoldedMessage string           `json:"message"`
	PublicKey     string           `json:"public_key"`
}

type Wizard

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

func NewWizard

func NewWizard(options ...Option) (*Wizard, error)

func (*Wizard) FoldMessage

func (w *Wizard) FoldMessage(c context.Context, req *proto.MessageToFold) (*proto.EncodedMessage, error)

func (*Wizard) GeneratePublicKey

func (w *Wizard) GeneratePublicKey(c context.Context, req *proto.Claims) (*proto.PublicKey, error)

func (*Wizard) Run

func (w *Wizard) Run() chan error

func (*Wizard) UnfoldMessage

func (w *Wizard) UnfoldMessage(c context.Context, req *proto.MessageToUnfold) (*proto.Message, error)

Directories

Path Synopsis
stores

Jump to

Keyboard shortcuts

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