Documentation ¶
Index ¶
- func Decrypt(data []byte, sharedKey string) ([]byte, error)
- func Encrypt(message []byte, sharedKey string) []byte
- func GenerateSharedKey(recipientPublicKey string, privateKey string) string
- func ShutdownTorService(torService *TorService)
- type Primal
- func (p *Primal) ComputeSharedKey(publicKey string) string
- func (p *Primal) DisplayAllRoutes()
- func (p *Primal) GetCurrentConfiguration() data.Configuration
- func (p *Primal) GetDataDir() string
- func (p *Primal) GetDevices() []data.Device
- func (p *Primal) GetMiddleware(next http.Handler) func(w http.ResponseWriter, r *http.Request)
- func (p *Primal) GetOfflineQueue() data.OfflineSqliteDB
- func (p *Primal) GetPublicKey() string
- func (p *Primal) GetPublicURL() string
- func (p *Primal) InitPrimalEndpoints()
- func (p *Primal) IsURLOnline(url string) bool
- func (p *Primal) Notify(event data.BrokerEvent)
- func (p *Primal) NotifyPresenceOnline()
- func (p *Primal) ReloadIdentity()
- func (p *Primal) Send(request http.Request, encrypt bool) (*http.Response, error)
- func (p *Primal) SendPendingRequests(publicKey string)
- func (p *Primal) ServicesRunning() bool
- func (p *Primal) StartServices() bool
- func (p *Primal) StopServices() bool
- type TorConfig
- type TorHiddenService
- type TorService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateSharedKey ¶
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 (*Primal) ComputeSharedKey ¶
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 ¶
GetDataDir return identity's data dir
func (*Primal) GetDevices ¶
GetDevices return the list of currently stored devices
func (*Primal) GetMiddleware ¶
GetMiddleware return a middleware function to authorize and decrypt the payload
func (*Primal) GetOfflineQueue ¶
func (p *Primal) GetOfflineQueue() data.OfflineSqliteDB
func (*Primal) GetPublicKey ¶
GetPublicKey return personal public key
func (*Primal) GetPublicURL ¶
GetPublicURL return public hiddenservice URL
func (*Primal) InitPrimalEndpoints ¶
func (p *Primal) InitPrimalEndpoints()
InitPrimalEndpoints will initialize requests and devices endpoints + middleware
func (*Primal) IsURLOnline ¶
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 ¶
Send uses tor http client to forward an http request, encrypting the payload if required
func (*Primal) SendPendingRequests ¶
func (*Primal) ServicesRunning ¶
ServicesRunning check if services are currently running
func (*Primal) StartServices ¶
StartServices will start public/private tor hidden services
func (*Primal) StopServices ¶
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