Documentation ¶
Index ¶
- func GenerateCertFromKey(pk *ecdsa.PrivateKey, from time.Time, hostname string) (tls.Certificate, []byte, error)
- func GenerateX509Cert(sn *big.Int, from, to time.Time, hostname string) *x509.Certificate
- func GenerateX509PEMs(cert *x509.Certificate, key *ecdsa.PrivateKey) (certPem, keyPem []byte, err error)
- func GetOutboundIP() (net.IP, error)
- func PublicTLSCert() (string, error)
- func StartUpPairingClient(db *multiaccounts.Database, cs, configJSON string) error
- func StartUpPairingServer(db *multiaccounts.Database, mode Mode, configJSON string) (string, error)
- func ToECDSA(d []byte) *ecdsa.PrivateKey
- type Config
- type ConnectionParamVersion
- type ConnectionParams
- type EncryptionPayload
- type Event
- type EventType
- type HandlerPatternMap
- type MediaServer
- func (s *MediaServer) MakeAudioURL(id string) string
- func (s *MediaServer) MakeDiscordAttachmentURL(messageID string, id string) string
- func (s *MediaServer) MakeDiscordAuthorAvatarURL(authorID string) string
- func (s *MediaServer) MakeIdenticonURL(from string) string
- func (s *MediaServer) MakeImageServerURL() string
- func (s *MediaServer) MakeImageURL(id string) string
- func (s *MediaServer) MakeStickerURL(stickerHash string) string
- type Mode
- type PairingClient
- type PairingPayload
- type PairingPayloadManager
- type PairingPayloadManagerConfig
- type PairingPayloadMarshaller
- type PairingPayloadRepository
- type PairingPayloadSourceConfig
- type PairingServer
- type PayloadEncryptionManager
- func (pem *PayloadEncryptionManager) Decrypt(data []byte) error
- func (pem *PayloadEncryptionManager) Encrypt(data []byte) error
- func (pem *PayloadEncryptionManager) EncryptPlain(plaintext []byte) ([]byte, error)
- func (pem *PayloadEncryptionManager) Received() []byte
- func (pem *PayloadEncryptionManager) ResetPayload()
- func (pem *PayloadEncryptionManager) ToSend() []byte
- type PayloadManager
- type PayloadRepository
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCertFromKey ¶ added in v0.102.2
func GenerateCertFromKey(pk *ecdsa.PrivateKey, from time.Time, hostname string) (tls.Certificate, []byte, error)
func GenerateX509Cert ¶ added in v0.97.4
func GenerateX509PEMs ¶ added in v0.97.4
func GenerateX509PEMs(cert *x509.Certificate, key *ecdsa.PrivateKey) (certPem, keyPem []byte, err error)
func GetOutboundIP ¶ added in v0.102.2
func PublicTLSCert ¶
func StartUpPairingClient ¶ added in v0.109.1
func StartUpPairingClient(db *multiaccounts.Database, cs, configJSON string) error
func StartUpPairingServer ¶ added in v0.109.1
StartUpPairingServer generates a PairingServer, starts the pairing server in the correct mode and returns the ConnectionParams string to allow a PairingClient to make a successful connection.
func ToECDSA ¶ added in v0.102.2
func ToECDSA(d []byte) *ecdsa.PrivateKey
ToECDSA takes a []byte of D and uses it to create an ecdsa.PublicKey on the elliptic.P256 curve this function is basically a P256 curve version of eth-node/crypto.ToECDSA without all the nice validation
Types ¶
type Config ¶ added in v0.102.2
type Config struct { // Connection fields PK *ecdsa.PublicKey EK []byte Cert *tls.Certificate Hostname string Mode Mode // Payload management fields *PairingPayloadManagerConfig }
type ConnectionParamVersion ¶ added in v0.102.2
type ConnectionParamVersion int
const (
Version1 ConnectionParamVersion = iota + 1
)
type ConnectionParams ¶ added in v0.102.2
type ConnectionParams struct {
// contains filtered or unexported fields
}
func NewConnectionParams ¶ added in v0.102.2
func (*ConnectionParams) FromString ¶ added in v0.102.2
func (cp *ConnectionParams) FromString(s string) error
FromString parses a connection params string required for to securely connect to another Status device. This function parses a connection string generated by ToString
func (*ConnectionParams) ToString ¶ added in v0.102.2
func (cp *ConnectionParams) ToString() string
ToString generates a string required for generating a secure connection to another Status device.
The returned string will look like below:
- "cs2:4FHRnp:H6G:uqnnMwVUfJc2Fkcaojet8F1ufKC3hZdGEt47joyBx9yd:BbnZ7Gc66t54a9kEFCf7FW8SGQuYypwHVeNkRYeNoqV6:2"
Format bytes encoded into a base58 string, delimited by ":"
- string type identifier
- version
- net.IP
- port
- ecdsa CompressedPublicKey
- AES encryption key
- server mode
type EncryptionPayload ¶ added in v0.106.1
type EncryptionPayload struct {
// contains filtered or unexported fields
}
EncryptionPayload represents the plain text and encrypted text of payload data
type EventType ¶ added in v0.109.1
type EventType string
EventType type for event types.
const ( EventConnectionError EventType = "connection-error" EventConnectionSuccess EventType = "connection-success" EventTransferError EventType = "transfer-error" EventTransferSuccess EventType = "transfer-success" EventProcessSuccess EventType = "process-success" EventProcessError EventType = "process-error" )
type HandlerPatternMap ¶ added in v0.102.2
type HandlerPatternMap map[string]http.HandlerFunc
type MediaServer ¶ added in v0.102.2
type MediaServer struct { Server // contains filtered or unexported fields }
func NewMediaServer ¶ added in v0.102.2
func NewMediaServer(db *sql.DB, downloader *ipfs.Downloader, multiaccountsDB *multiaccounts.Database) (*MediaServer, error)
NewMediaServer returns a *MediaServer
func (*MediaServer) MakeAudioURL ¶ added in v0.102.2
func (s *MediaServer) MakeAudioURL(id string) string
func (*MediaServer) MakeDiscordAttachmentURL ¶ added in v0.111.5
func (s *MediaServer) MakeDiscordAttachmentURL(messageID string, id string) string
func (*MediaServer) MakeDiscordAuthorAvatarURL ¶ added in v0.111.5
func (s *MediaServer) MakeDiscordAuthorAvatarURL(authorID string) string
func (*MediaServer) MakeIdenticonURL ¶ added in v0.102.2
func (s *MediaServer) MakeIdenticonURL(from string) string
func (*MediaServer) MakeImageServerURL ¶ added in v0.102.2
func (s *MediaServer) MakeImageServerURL() string
func (*MediaServer) MakeImageURL ¶ added in v0.102.2
func (s *MediaServer) MakeImageURL(id string) string
func (*MediaServer) MakeStickerURL ¶ added in v0.102.2
func (s *MediaServer) MakeStickerURL(stickerHash string) string
type PairingClient ¶ added in v0.102.5
type PairingClient struct { *http.Client PayloadManager // contains filtered or unexported fields }
func NewPairingClient ¶ added in v0.102.5
func NewPairingClient(c *ConnectionParams, config *PairingPayloadManagerConfig) (*PairingClient, error)
func (*PairingClient) PairAccount ¶ added in v0.102.5
func (c *PairingClient) PairAccount() error
type PairingPayload ¶ added in v0.106.1
type PairingPayload struct {
// contains filtered or unexported fields
}
PairingPayload represents the payload structure a PairingServer handles
func (*PairingPayload) ResetPayload ¶ added in v0.106.1
func (pp *PairingPayload) ResetPayload()
type PairingPayloadManager ¶ added in v0.106.1
type PairingPayloadManager struct { *PayloadEncryptionManager // contains filtered or unexported fields }
PairingPayloadManager is responsible for the whole lifecycle of a PairingPayload
func NewPairingPayloadManager ¶ added in v0.106.1
func NewPairingPayloadManager(aesKey []byte, config *PairingPayloadManagerConfig) (*PairingPayloadManager, error)
NewPairingPayloadManager generates a new and initialised PairingPayloadManager
func (*PairingPayloadManager) Mount ¶ added in v0.106.1
func (ppm *PairingPayloadManager) Mount() error
Mount loads and prepares the payload to be stored in the PairingPayloadManager's state ready for later access
func (*PairingPayloadManager) Receive ¶ added in v0.106.1
func (ppm *PairingPayloadManager) Receive(data []byte) error
Receive takes a []byte representing raw data, parses and stores the data
func (*PairingPayloadManager) ResetPayload ¶ added in v0.106.1
func (ppm *PairingPayloadManager) ResetPayload()
ResetPayload resets all payload state managed by the PairingPayloadManager
type PairingPayloadManagerConfig ¶ added in v0.106.1
type PairingPayloadManagerConfig struct { DB *multiaccounts.Database PairingPayloadSourceConfig }
PairingPayloadManagerConfig represents the initialisation parameters required for a PairingPayloadManager
type PairingPayloadMarshaller ¶ added in v0.106.1
type PairingPayloadMarshaller struct {
*PairingPayload
}
PairingPayloadMarshaller is responsible for marshalling and unmarshalling PairingServer payload data
func NewPairingPayloadMarshaller ¶ added in v0.106.1
func NewPairingPayloadMarshaller(p *PairingPayload) *PairingPayloadMarshaller
func (*PairingPayloadMarshaller) MarshalToProtobuf ¶ added in v0.106.1
func (ppm *PairingPayloadMarshaller) MarshalToProtobuf() ([]byte, error)
func (*PairingPayloadMarshaller) UnmarshalProtobuf ¶ added in v0.106.1
func (ppm *PairingPayloadMarshaller) UnmarshalProtobuf(data []byte) error
type PairingPayloadRepository ¶ added in v0.106.1
type PairingPayloadRepository struct { *PairingPayload // contains filtered or unexported fields }
PairingPayloadRepository is responsible for loading, parsing, validating and storing PairingServer payload data
func NewPairingPayloadRepository ¶ added in v0.106.1
func NewPairingPayloadRepository(p *PairingPayload, config *PairingPayloadManagerConfig) *PairingPayloadRepository
func (*PairingPayloadRepository) LoadFromSource ¶ added in v0.106.1
func (ppr *PairingPayloadRepository) LoadFromSource() error
func (*PairingPayloadRepository) StoreToSource ¶ added in v0.106.1
func (ppr *PairingPayloadRepository) StoreToSource() error
type PairingPayloadSourceConfig ¶ added in v0.109.1
type PairingPayloadSourceConfig struct { KeystorePath string `json:"keystorePath"` KeyUID string `json:"keyUID"` Password string `json:"password"` }
PairingPayloadSourceConfig represents location and access data of the pairing payload ONLY available from the application client
type PairingServer ¶ added in v0.102.2
type PairingServer struct { Server PayloadManager // contains filtered or unexported fields }
func MakeFullPairingServer ¶ added in v0.109.1
func MakeFullPairingServer(db *multiaccounts.Database, mode Mode, storeConfig PairingPayloadSourceConfig) (*PairingServer, error)
MakeFullPairingServer generates a fully configured and randomly seeded PairingServer
func NewPairingServer ¶ added in v0.102.2
func NewPairingServer(config *Config) (*PairingServer, error)
NewPairingServer returns a *PairingServer init from the given *Config
func (*PairingServer) MakeConnectionParams ¶ added in v0.102.2
func (s *PairingServer) MakeConnectionParams() (*ConnectionParams, error)
MakeConnectionParams generates a *ConnectionParams based on the Server's current state
func (*PairingServer) StartPairing ¶ added in v0.102.5
func (s *PairingServer) StartPairing() error
type PayloadEncryptionManager ¶ added in v0.106.1
type PayloadEncryptionManager struct {
// contains filtered or unexported fields
}
PayloadEncryptionManager is responsible for encrypting and decrypting payload data
func NewPayloadEncryptionManager ¶ added in v0.106.1
func NewPayloadEncryptionManager(aesKey []byte) (*PayloadEncryptionManager, error)
func (*PayloadEncryptionManager) Decrypt ¶ added in v0.106.1
func (pem *PayloadEncryptionManager) Decrypt(data []byte) error
func (*PayloadEncryptionManager) Encrypt ¶ added in v0.106.1
func (pem *PayloadEncryptionManager) Encrypt(data []byte) error
func (*PayloadEncryptionManager) EncryptPlain ¶ added in v0.106.3
func (pem *PayloadEncryptionManager) EncryptPlain(plaintext []byte) ([]byte, error)
func (*PayloadEncryptionManager) Received ¶ added in v0.106.1
func (pem *PayloadEncryptionManager) Received() []byte
func (*PayloadEncryptionManager) ResetPayload ¶ added in v0.106.1
func (pem *PayloadEncryptionManager) ResetPayload()
func (*PayloadEncryptionManager) ToSend ¶ added in v0.106.1
func (pem *PayloadEncryptionManager) ToSend() []byte
type PayloadManager ¶ added in v0.102.5
type PayloadManager interface { Mount() error Receive(data []byte) error ToSend() []byte Received() []byte ResetPayload() EncryptPlain(plaintext []byte) ([]byte, error) }
PayloadManager is the interface for PayloadManagers and wraps the basic functions for fulfilling payload management
type PayloadRepository ¶ added in v0.106.1
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(cert *tls.Certificate, hostname string, afterPortChanged func(int)) Server
func (*Server) AddHandlers ¶ added in v0.106.3
func (s *Server) AddHandlers(handlers HandlerPatternMap)
func (*Server) MakeBaseURL ¶ added in v0.102.2
func (*Server) SetHandlers ¶ added in v0.102.2
func (s *Server) SetHandlers(handlers HandlerPatternMap)
func (*Server) ToBackground ¶
func (s *Server) ToBackground()
func (*Server) ToForeground ¶
func (s *Server) ToForeground()