Documentation ¶
Index ¶
- Constants
- type FingerprintType
- type ReceivedRequest
- type RequestType
- type SentRequest
- func (sr *SentRequest) GetFingerprint() format.Fingerprint
- func (sr *SentRequest) GetMyPrivKey() *cyclic.Int
- func (sr *SentRequest) GetMyPubKey() *cyclic.Int
- func (sr *SentRequest) GetMySIDHPrivKey() *sidh.PrivateKey
- func (sr *SentRequest) GetMySIDHPubKey() *sidh.PublicKey
- func (sr *SentRequest) GetPartner() *id.ID
- func (sr *SentRequest) GetPartnerHistoricalPubKey() *cyclic.Int
- func (sr *SentRequest) IsReset() bool
- func (sr *SentRequest) OverwriteSIDHKeys(priv *sidh.PrivateKey, pub *sidh.PublicKey)
- type SentRequestHandler
- type Store
- func (s *Store) AddReceived(c contact.Contact, key *sidh.PublicKey, round rounds.Round) error
- func (s *Store) AddSent(partner *id.ID, partnerHistoricalPubKey, myPrivKey, myPubKey *cyclic.Int, ...) (*SentRequest, error)
- func (s *Store) CheckIfNegotiationIsNew(partner *id.ID, negotiationFingerprint []byte) (newFingerprint bool, position uint)
- func (s *Store) DeleteAllRequests() error
- func (s *Store) DeleteConfirmation(partner *id.ID) error
- func (s *Store) DeleteReceiveRequests() error
- func (s *Store) DeleteReceivedRequest(partner *id.ID) error
- func (s *Store) DeleteRequest(partner *id.ID) error
- func (s *Store) DeleteSentRequest(partner *id.ID) error
- func (s *Store) DeleteSentRequests() error
- func (s *Store) GetAllReceivedRequests() []*ReceivedRequest
- func (s *Store) GetReceivedRequest(partner *id.ID) (contact.Contact, error)
- func (s *Store) HandleReceivedRequest(partner *id.ID, handler func(*ReceivedRequest) error) error
- func (s *Store) HandleSentRequest(partner *id.ID, handler func(request *SentRequest) error) error
- func (s *Store) LoadConfirmation(partner *id.ID) ([]byte, []byte, format.Fingerprint, error)
- func (s *Store) StoreConfirmation(partner *id.ID, confirmationPayload, mac []byte, fp format.Fingerprint) error
Constants ¶
const NoRequestFound = "no request found"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FingerprintType ¶
type FingerprintType uint
const ( General FingerprintType = 1 Specific FingerprintType = 2 )
type ReceivedRequest ¶
type ReceivedRequest struct {
// contains filtered or unexported fields
}
func (*ReceivedRequest) GetContact ¶
func (rr *ReceivedRequest) GetContact() contact.Contact
func (*ReceivedRequest) GetRound ¶
func (rr *ReceivedRequest) GetRound() rounds.Round
func (*ReceivedRequest) GetTheirSidHPubKeyA ¶
func (rr *ReceivedRequest) GetTheirSidHPubKeyA() *sidh.PublicKey
type SentRequest ¶
type SentRequest struct {
// contains filtered or unexported fields
}
func (*SentRequest) GetFingerprint ¶
func (sr *SentRequest) GetFingerprint() format.Fingerprint
func (*SentRequest) GetMyPrivKey ¶
func (sr *SentRequest) GetMyPrivKey() *cyclic.Int
func (*SentRequest) GetMyPubKey ¶
func (sr *SentRequest) GetMyPubKey() *cyclic.Int
func (*SentRequest) GetMySIDHPrivKey ¶
func (sr *SentRequest) GetMySIDHPrivKey() *sidh.PrivateKey
func (*SentRequest) GetMySIDHPubKey ¶
func (sr *SentRequest) GetMySIDHPubKey() *sidh.PublicKey
func (*SentRequest) GetPartner ¶
func (sr *SentRequest) GetPartner() *id.ID
func (*SentRequest) GetPartnerHistoricalPubKey ¶
func (sr *SentRequest) GetPartnerHistoricalPubKey() *cyclic.Int
func (*SentRequest) IsReset ¶
func (sr *SentRequest) IsReset() bool
func (*SentRequest) OverwriteSIDHKeys ¶
func (sr *SentRequest) OverwriteSIDHKeys(priv *sidh.PrivateKey, pub *sidh.PublicKey)
OverwriteSIDHKeys is used to temporarily overwrite sidh keys to handle e.g., confirmation receivedByID. FIXME: this is a code smell but was the cleanest solution at the time. Business logic should probably handle this better?
type SentRequestHandler ¶
type SentRequestHandler interface { Add(sr *SentRequest) Delete(sr *SentRequest) }
SentRequestHandler allows the lower level to assign and remove services
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func NewOrLoadStore ¶
NewOrLoadStore loads an extant new store. All passed in private keys are added as sentByFingerprints so they can be used to trigger receivedByID. If no store can be found, it creates a new one
func (*Store) AddReceived ¶
func (*Store) AddSent ¶
func (s *Store) AddSent(partner *id.ID, partnerHistoricalPubKey, myPrivKey, myPubKey *cyclic.Int, sidHPrivA *sidh.PrivateKey, sidHPubA *sidh.PublicKey, fp format.Fingerprint, reset bool) (*SentRequest, error)
func (*Store) CheckIfNegotiationIsNew ¶
func (s *Store) CheckIfNegotiationIsNew(partner *id.ID, negotiationFingerprint []byte) ( newFingerprint bool, position uint)
CheckIfNegotiationIsNew adds a new negotiation fingerprint if it is new. If the partner does not exist, it will add it and the new fingerprint and return newFingerprint = true. If the partner exists and the fingerprint does not exist, add it adds it as the latest fingerprint and returns newFingerprint = true, If the partner exists and the fingerprint exists, return newFingerprint = false in all cases it will return the position of the fingerprint, with the newest always at position 0
func (*Store) DeleteAllRequests ¶
DeleteAllRequests clears the request map and all associated storage objects containing request data.
func (*Store) DeleteConfirmation ¶
DeleteConfirmation deletes the confirmation for the given partner and fingerprint from storage.
func (*Store) DeleteReceiveRequests ¶
DeleteReceiveRequests deletes all Receive receivedByID from Store.
func (*Store) DeleteReceivedRequest ¶
DeleteReceivedRequest deletes the received request for the given partnerID pair.
func (*Store) DeleteRequest ¶
DeleteRequest deletes a request from Store given a partner ID. If the partner ID exists as a request, then the request will be deleted and the state stored. If the partner does not exist, then an error will be returned.
func (*Store) DeleteSentRequest ¶
DeleteSentRequest deletes the sent request for the given partnerID pair.
func (*Store) DeleteSentRequests ¶
DeleteSentRequests deletes all Sent receivedByID from Store.
func (*Store) GetAllReceivedRequests ¶
func (s *Store) GetAllReceivedRequests() []*ReceivedRequest
GetAllReceivedRequests returns a slice of all recieved requests.
func (*Store) GetReceivedRequest ¶
GetReceivedRequest returns the contact representing the partner request if it exists. It does not take the lock. It is only meant to return the contact to an external API user.
func (*Store) HandleReceivedRequest ¶
HandleReceivedRequest handles the request singly, only a single operator operates on the same request at a time. It will delete the request if no error is returned from the handler
func (*Store) HandleSentRequest ¶
HandleSentRequest handles the request singly, only a single operator operates on the same request at a time. It will delete the request if no error is returned from the handler
func (*Store) LoadConfirmation ¶
LoadConfirmation loads the confirmation for the given partner and fingerprint from storage.
func (*Store) StoreConfirmation ¶
func (s *Store) StoreConfirmation(partner *id.ID, confirmationPayload, mac []byte, fp format.Fingerprint) error
StoreConfirmation saves the confirmation to storage for the given partner and fingerprint.