phomeCore

package
v0.0.0-...-5fd5544 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

README

PhomeCore

PhomeCore is a peer-to-peer and host-client capable network protocol that can be positioned on the presentation layer of the OSI model. It is built upon proven existing technologies, including HTTP/3 and ed25519, and is structured to be block-based. It enforces message validation and encryption with TLS, and simplifies the chain-of-trust problem by exchanging certificates out-of-band. While the reference client utilizes PhomeCore to transmit the locations of devices, PhomeCore can be integrated into various software solutions, such as chat applications.

Documentation

Overview

This file handles encryption and decryption of TLS

This file is for handling Peers, including pairing and storage of existing paired devices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeginClientPeer

func BeginClientPeer(certFile string, keyFile string, addr string, knownUuids func(peerUuid string) string) error

func BeginHTTP

func BeginHTTP(certFile string, keyFile string, addr string, knownUuids func(peerUuid string) string) error

func DecodeB64

func DecodeB64(in string) (string, error)

func EncodeB64

func EncodeB64(in string) string

func GenerateUUID

func GenerateUUID() string

Note: GenCerts in Encryption.go also generates the localhost UUID.

func PCVerifyConnection

func PCVerifyConnection(rawCerts [][]byte, knownCerts func(peerUuid string) (peerCert string)) error

Compare the certificate received from the server with the saved certificate of this UUID. An MITM should not be possible since the server must be hosted with the same cert that signed the JSON.

Types

type JSONBundle

type JSONBundle struct {
	PubKey string // required only for initial pair, otherwise it is ignored.
	Test   string
}

func (*JSONBundle) DecodeJSON

func (newPairingJSON *JSONBundle) DecodeJSON(pairingJSONstr string) error

This function unmarshals a pairing JSON string into a JSONBundle

func (*JSONBundle) GenerateJSON

func (newPairingJSON *JSONBundle) GenerateJSON() (string, error)

This function generates the initial pairing JSON from a JSONBundle. It is recommended to convert the string output to base64 for pairing.

type SelfIDs

type SelfIDs struct {
	CertPath string
	KeyPath  string
}

Remember to check that these paths are valid in your implementation!

func (*SelfIDs) GenCerts

func (ids *SelfIDs) GenCerts() error

GenCerts generates certificates for server TLS and client verification.

Jump to

Keyboard shortcuts

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