Documentation ¶
Index ¶
- Constants
- Variables
- func NewDecryptIncomingGroupMessagesTask(interval time.Duration, hushProto *hushProtocol) *decryptIncomingGroupMessagesTask
- func NewDecryptIncomingIndividualMessagesTask(interval time.Duration, hushProto *hushProtocol) *decryptIncomingIndividualMessagesTask
- func NewExchangeDHPubkeysTask(interval time.Duration, hushProto *hushProtocol) *exchangeDHPubkeysTask
- func NewHushProtocol(transports []swarm.Transport, store Store, keyStore identity.KeyStore, ...) *hushProtocol
- func NewStore(db *state.DBTree) *store
- type BaseHushTransport
- func (t *BaseHushTransport) HandleIncomingDHPubkeyAttestations(ctx context.Context, attestations []DHPubkeyAttestation, peerConn HushPeerConn)
- func (t *BaseHushTransport) HandleIncomingGroupMessage(ctx context.Context, msg GroupMessage, peerConn HushPeerConn)
- func (t *BaseHushTransport) HandleIncomingIndividualMessage(ctx context.Context, msg IndividualMessage, peerConn HushPeerConn)
- func (t *BaseHushTransport) HandleIncomingIndividualSessionProposal(ctx context.Context, encryptedProposal []byte, alice HushPeerConn)
- func (t *BaseHushTransport) HandleIncomingIndividualSessionResponse(ctx context.Context, approval IndividualSessionResponse, bob HushPeerConn)
- func (t *BaseHushTransport) OnIncomingDHPubkeyAttestations(handler IncomingDHPubkeyAttestationsCallback)
- func (t *BaseHushTransport) OnIncomingGroupMessage(handler IncomingGroupMessageCallback)
- func (t *BaseHushTransport) OnIncomingIndividualMessage(handler IncomingIndividualMessageCallback)
- func (t *BaseHushTransport) OnIncomingIndividualSessionProposal(handler IncomingIndividualSessionProposalCallback)
- func (t *BaseHushTransport) OnIncomingIndividualSessionResponse(handler IncomingIndividualSessionResponseCallback)
- type DHPair
- type DHPubkeyAttestation
- type EncryptedIndividualSessionProposal
- type GroupMessage
- type GroupMessageDecryptedCallback
- type GroupMessageEncryptedCallback
- type GroupMessageIntent
- type GroupMessage_EncryptionKey
- type HushPeerConn
- type HushProtocol
- type HushTransport
- type IncomingDHPubkeyAttestationsCallback
- type IncomingGroupMessageCallback
- type IncomingIndividualMessageCallback
- type IncomingIndividualSessionProposalCallback
- type IncomingIndividualSessionResponseCallback
- type IndividualMessage
- type IndividualMessageDecryptedCallback
- type IndividualMessageHeader
- type IndividualMessageIntent
- type IndividualSessionID
- type IndividualSessionProposal
- type IndividualSessionResponse
- type RatchetKeyStore
- type RatchetSessionStore
- type SharedKey
- type Store
Constants ¶
View Source
const ProtocolName = "protohush"
Variables ¶
View Source
var ( ErrInvalidSignature = errors.New("invalid signature") ErrInvalidDHPubkey = errors.New("invalid DH pubkey") ErrEpochTooLow = errors.New("epoch too low") )
View Source
var (
ErrRecipientIsSelf = errors.New("recipient is self")
)
View Source
var IndividualMessageFromDoubleRatchetMessage = pb.IndividualMessageFromDoubleRatchetMessage
Functions ¶
func NewHushProtocol ¶
Types ¶
type BaseHushTransport ¶
type BaseHushTransport struct {
// contains filtered or unexported fields
}
func (*BaseHushTransport) HandleIncomingDHPubkeyAttestations ¶
func (t *BaseHushTransport) HandleIncomingDHPubkeyAttestations(ctx context.Context, attestations []DHPubkeyAttestation, peerConn HushPeerConn)
func (*BaseHushTransport) HandleIncomingGroupMessage ¶
func (t *BaseHushTransport) HandleIncomingGroupMessage(ctx context.Context, msg GroupMessage, peerConn HushPeerConn)
func (*BaseHushTransport) HandleIncomingIndividualMessage ¶
func (t *BaseHushTransport) HandleIncomingIndividualMessage(ctx context.Context, msg IndividualMessage, peerConn HushPeerConn)
func (*BaseHushTransport) HandleIncomingIndividualSessionProposal ¶
func (t *BaseHushTransport) HandleIncomingIndividualSessionProposal(ctx context.Context, encryptedProposal []byte, alice HushPeerConn)
func (*BaseHushTransport) HandleIncomingIndividualSessionResponse ¶
func (t *BaseHushTransport) HandleIncomingIndividualSessionResponse(ctx context.Context, approval IndividualSessionResponse, bob HushPeerConn)
func (*BaseHushTransport) OnIncomingDHPubkeyAttestations ¶
func (t *BaseHushTransport) OnIncomingDHPubkeyAttestations(handler IncomingDHPubkeyAttestationsCallback)
func (*BaseHushTransport) OnIncomingGroupMessage ¶
func (t *BaseHushTransport) OnIncomingGroupMessage(handler IncomingGroupMessageCallback)
func (*BaseHushTransport) OnIncomingIndividualMessage ¶
func (t *BaseHushTransport) OnIncomingIndividualMessage(handler IncomingIndividualMessageCallback)
func (*BaseHushTransport) OnIncomingIndividualSessionProposal ¶
func (t *BaseHushTransport) OnIncomingIndividualSessionProposal(handler IncomingIndividualSessionProposalCallback)
func (*BaseHushTransport) OnIncomingIndividualSessionResponse ¶
func (t *BaseHushTransport) OnIncomingIndividualSessionResponse(handler IncomingIndividualSessionResponseCallback)
type DHPubkeyAttestation ¶
type DHPubkeyAttestation = pb.DHPubkeyAttestation
type EncryptedIndividualSessionProposal ¶
type EncryptedIndividualSessionProposal struct { AliceAddr types.Address `tree:"aliceAddr"` EncryptedProposal []byte `tree:"encryptedProposal"` }
func (EncryptedIndividualSessionProposal) Hash ¶
func (p EncryptedIndividualSessionProposal) Hash() types.Hash
type GroupMessage ¶
type GroupMessage = pb.GroupMessage
type GroupSessionID = pb.GroupSessionID type GroupSessionProposal = pb.GroupSessionProposal
type GroupMessageDecryptedCallback ¶
type GroupMessageDecryptedCallback func(sender types.Address, plaintext []byte, msg GroupMessage)
type GroupMessageEncryptedCallback ¶
type GroupMessageEncryptedCallback func(msg GroupMessage)
type GroupMessageIntent ¶
type GroupMessage_EncryptionKey ¶
type GroupMessage_EncryptionKey = pb.GroupMessage_EncryptionKey
type HushPeerConn ¶
type HushPeerConn interface { swarm.PeerConn SendDHPubkeyAttestations(ctx context.Context, attestations []DHPubkeyAttestation) error ProposeIndividualSession(ctx context.Context, encryptedProposal []byte) error RespondToIndividualSession(ctx context.Context, approval IndividualSessionResponse) error SendHushIndividualMessage(ctx context.Context, msg IndividualMessage) error SendHushGroupMessage(ctx context.Context, msg GroupMessage) error }
type HushProtocol ¶
type HushProtocol interface { process.Interface EnsureIndividualSession(ctx context.Context, sessionType string, recipient types.Address) (IndividualSessionProposal, bool, error) ProposeIndividualSession(ctx context.Context, sessionType string, recipient types.Address, epoch uint64) (IndividualSessionProposal, error) ProposeNextIndividualSession(ctx context.Context, sessionType string, recipient types.Address) (IndividualSessionProposal, error) EncryptIndividualMessage(sessionType string, recipient types.Address, plaintext []byte) error OnIndividualMessageDecrypted(sessionType string, handler IndividualMessageDecryptedCallback) EncryptGroupMessage(sessionType, messageID string, recipients []types.Address, plaintext []byte) error DecryptGroupMessage(msg GroupMessage) error OnGroupMessageEncrypted(sessionType string, handler GroupMessageEncryptedCallback) OnGroupMessageDecrypted(sessionType string, handler GroupMessageDecryptedCallback) }
type HushTransport ¶
type HushTransport interface { swarm.Transport OnIncomingDHPubkeyAttestations(handler IncomingDHPubkeyAttestationsCallback) OnIncomingIndividualSessionProposal(handler IncomingIndividualSessionProposalCallback) OnIncomingIndividualSessionResponse(handler IncomingIndividualSessionResponseCallback) OnIncomingIndividualMessage(handler IncomingIndividualMessageCallback) OnIncomingGroupMessage(handler IncomingGroupMessageCallback) }
type IncomingDHPubkeyAttestationsCallback ¶
type IncomingDHPubkeyAttestationsCallback func(ctx context.Context, attestations []DHPubkeyAttestation, peer HushPeerConn)
type IncomingGroupMessageCallback ¶
type IncomingGroupMessageCallback func(ctx context.Context, msg GroupMessage, peer HushPeerConn)
type IncomingIndividualMessageCallback ¶
type IncomingIndividualMessageCallback func(ctx context.Context, msg IndividualMessage, peer HushPeerConn)
type IncomingIndividualSessionProposalCallback ¶
type IncomingIndividualSessionProposalCallback func(ctx context.Context, encryptedProposal []byte, alice HushPeerConn)
type IncomingIndividualSessionResponseCallback ¶
type IncomingIndividualSessionResponseCallback func(ctx context.Context, approval IndividualSessionResponse, bob HushPeerConn)
type IndividualMessage ¶
type IndividualMessage = pb.IndividualMessage
type IndividualMessageDecryptedCallback ¶
type IndividualMessageDecryptedCallback func(sender types.Address, plaintext []byte, msg IndividualMessage)
type IndividualMessageHeader ¶
type IndividualMessageHeader = pb.IndividualMessage_Header
type IndividualMessageIntent ¶
type IndividualSessionID ¶
type IndividualSessionID = pb.IndividualSessionID
type IndividualSessionProposal ¶
type IndividualSessionProposal = pb.IndividualSessionProposal
type IndividualSessionResponse ¶
type IndividualSessionResponse = pb.IndividualSessionResponse
type RatchetKeyStore ¶
type RatchetKeyStore interface { doubleratchet.KeysStorage }
type RatchetSessionStore ¶
type RatchetSessionStore interface { doubleratchet.SessionStorage }
type Store ¶
type Store interface { // Diffie-Hellman keys EnsureDHPair() (DHPair, error) DHPubkeyAttestations() ([]DHPubkeyAttestation, error) LatestDHPubkeyFor(addr types.Address) (DHPubkeyAttestation, error) SaveDHPubkeyAttestations(attestations []DHPubkeyAttestation) error // Individual session handshake protocol OutgoingIndividualSessionProposalHashes() (types.Set[types.Hash], error) OutgoingIndividualSessionProposalByHash(proposalHash types.Hash) (IndividualSessionProposal, error) OutgoingIndividualSessionProposalsForUsers(aliceAddr, bobAddr types.Address) ([]IndividualSessionProposal, error) OutgoingIndividualSessionProposalByUsersAndType(sessionType string, aliceAddr, bobAddr types.Address) (IndividualSessionProposal, error) SaveOutgoingIndividualSessionProposal(proposal IndividualSessionProposal) error DeleteOutgoingIndividualSessionProposal(sessionHash types.Hash) error IncomingIndividualSessionProposals() (map[types.Hash]EncryptedIndividualSessionProposal, error) IncomingIndividualSessionProposal(hash types.Hash) (EncryptedIndividualSessionProposal, error) SaveIncomingIndividualSessionProposal(proposal EncryptedIndividualSessionProposal) error DeleteIncomingIndividualSessionProposal(proposal EncryptedIndividualSessionProposal) error OutgoingIndividualSessionResponses() (map[types.Address]map[types.Hash]IndividualSessionResponse, error) OutgoingIndividualSessionResponsesForUser(aliceAddr types.Address) ([]IndividualSessionResponse, error) OutgoingIndividualSessionResponse(aliceAddr types.Address, proposalHash types.Hash) (IndividualSessionResponse, error) SaveOutgoingIndividualSessionResponse(sender types.Address, approval IndividualSessionResponse) error DeleteOutgoingIndividualSessionResponse(aliceAddr types.Address, proposalHash types.Hash) error // Established individual sessions LatestIndividualSessionWithUsers(sessionType string, aliceAddr, bobAddr types.Address) (IndividualSessionProposal, error) IndividualSessionByID(id IndividualSessionID) (IndividualSessionProposal, error) IndividualSessionIDBySessionHash(hash types.Hash) (IndividualSessionID, error) SaveApprovedIndividualSession(session IndividualSessionProposal) error // Individual messages OutgoingIndividualMessageIntents() ([]IndividualMessageIntent, error) OutgoingIndividualMessageIntentIDsForTypeAndRecipient(sessionType string, recipient types.Address) (types.Set[types.ID], error) OutgoingIndividualMessageIntent(sessionType string, recipient types.Address, id types.ID) (IndividualMessageIntent, error) SaveOutgoingIndividualMessageIntent(intent IndividualMessageIntent) error DeleteOutgoingIndividualMessageIntent(intent IndividualMessageIntent) error IncomingIndividualMessages() ([]IndividualMessage, error) SaveIncomingIndividualMessage(sender types.Address, msg IndividualMessage) error DeleteIncomingIndividualMessage(msg IndividualMessage) error // Group messages OutgoingGroupMessageSessionTypes() (types.Set[string], error) OutgoingGroupMessageIntentIDsForSessionType(sessionType string) (types.Set[string], error) OutgoingGroupMessageIntent(sessionType, id string) (GroupMessageIntent, error) SaveOutgoingGroupMessageIntent(intent GroupMessageIntent) error DeleteOutgoingGroupMessageIntent(sessionType, id string) error IncomingGroupMessages() ([]GroupMessage, error) SaveIncomingGroupMessage(sender types.Address, msg GroupMessage) error DeleteIncomingGroupMessage(msg GroupMessage) error // Double ratchet message keys + sessions RatchetSessionStore() RatchetSessionStore RatchetKeyStore() RatchetKeyStore DebugPrint() }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.