status-go/server/pairing/interfaces.go
Samuel Hawksby-Robinson 465afd0131 Refactored BasePayloadReceiver to handle Receive()
Additionally to allow this process flow I refactored RawMessagePayloadReceiver and InstallationPayloadHandler to use a dedicated Marshaller type. Also added a fix to struct extention functionality, we want to ignore the process if there is no public key because that will key encoding. Seems an unnecessary bug to have to handle when you know there is no key.
2023-04-04 11:56:40 +01:00

43 lines
1.3 KiB
Go

package pairing
import (
"go.uber.org/zap"
)
// PayloadMounterReceiver represents a struct that can:
// - mount payload data from a PayloadRepository or a PayloadLoader into memory (PayloadMounter.Mount)
// - prepare data to be sent encrypted (PayloadMounter.ToSend) via some transport
// - receive and prepare encrypted transport data (PayloadReceiver.Receive) to be stored
// - prepare the received (PayloadReceiver.Received) data to be stored to a PayloadRepository or a PayloadStorer
type PayloadMounterReceiver interface {
PayloadMounter
PayloadReceiver
}
// PayloadRepository represents a struct that can both load and store data to an internally managed data store
type PayloadRepository interface {
PayloadLoader
PayloadStorer
}
type PayloadLocker interface {
// LockPayload prevents future excess to outbound safe and received data
LockPayload()
}
// TODO if this interface only gets a logger, then maybe remove the interface and change consuming function params
// to accept a *zap.logger
// https://github.com/status-im/status-go/issues/3370
type HandlerServer interface {
GetLogger() *zap.Logger
}
type ProtobufMarshaller interface {
MarshalProtobuf() ([]byte, error)
}
type ProtobufUnmarshaller interface {
UnmarshalProtobuf([]byte) error
}