primal

package
v0.0.0-...-64ed5c8 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(data []byte, sharedKey string) ([]byte, error)

Decrypt decrypt a payload using the precomputed key

func Encrypt

func Encrypt(message []byte, sharedKey string) []byte

Encrypt encrypt a payload using the precomputed key

func GenerateSharedKey

func GenerateSharedKey(recipientPublicKey string, privateKey string) string

GenerateSharedKey return a precomputet key for the recipient

func ShutdownTorService

func ShutdownTorService(torService *TorService)

ShutdownTorService close hidden services, do not disconnect from tor

Types

type Primal

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

func InitPrimal

func InitPrimal(publicRouter *mux.Router, privateRouter *mux.Router) *Primal

func (*Primal) ComputeSharedKey

func (p *Primal) ComputeSharedKey(publicKey string) string

ComputeSharedKey for the specific public key

func (*Primal) DisplayAllRoutes

func (p *Primal) DisplayAllRoutes()

func (*Primal) GetCurrentConfiguration

func (p *Primal) GetCurrentConfiguration() data.Configuration

GetCurrentConfiguration return configuration status

func (*Primal) GetDataDir

func (p *Primal) GetDataDir() string

GetDataDir return identity's data dir

func (*Primal) GetDevices

func (p *Primal) GetDevices() []data.Device

GetDevices return the list of currently stored devices

func (*Primal) GetMiddleware

func (p *Primal) GetMiddleware(next http.Handler) func(w http.ResponseWriter, r *http.Request)

GetMiddleware return a middleware function to authorize and decrypt the payload

func (*Primal) GetOfflineQueue

func (p *Primal) GetOfflineQueue() data.OfflineSqliteDB

func (*Primal) GetPublicKey

func (p *Primal) GetPublicKey() string

GetPublicKey return personal public key

func (*Primal) GetPublicURL

func (p *Primal) GetPublicURL() string

GetPublicURL return public hiddenservice URL

func (*Primal) InitPrimalEndpoints

func (p *Primal) InitPrimalEndpoints()

InitPrimalEndpoints will initialize requests and devices endpoints + middleware

func (*Primal) IsURLOnline

func (p *Primal) IsURLOnline(url string) bool

func (*Primal) Notify

func (p *Primal) Notify(event data.BrokerEvent)

Notify send the broker a new event

func (*Primal) NotifyPresenceOnline

func (p *Primal) NotifyPresenceOnline()

func (*Primal) ReloadIdentity

func (p *Primal) ReloadIdentity()

ReloadIdentity reload default identity

func (*Primal) Send

func (p *Primal) Send(request http.Request, encrypt bool) (*http.Response, error)

Send uses tor http client to forward an http request, encrypting the payload if required

func (*Primal) SendPendingRequests

func (p *Primal) SendPendingRequests(publicKey string)

func (*Primal) ServicesRunning

func (p *Primal) ServicesRunning() bool

ServicesRunning check if services are currently running

func (*Primal) StartServices

func (p *Primal) StartServices() bool

StartServices will start public/private tor hidden services

func (*Primal) StopServices

func (p *Primal) StopServices() bool

StopServices stop both local and hidden services

type TorConfig

type TorConfig struct {
	DataDir        string
	PublicService  TorHiddenService
	PrivateService TorHiddenService
}

type TorHiddenService

type TorHiddenService struct {
	Port int
	Key  ed25519.PrivateKey
}

type TorService

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

func (*TorService) GetTorClient

func (torService *TorService) GetTorClient() (*http.Client, error)

GetTorClient return a client to interact with tor network

func (*TorService) InitTorService

func (torService *TorService) InitTorService(config TorConfig)

InitTorService initialize tor connection and both hidden services using the config

Jump to

Keyboard shortcuts

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