partner

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: BSD-2-Clause, BSD-2-Clause Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadRelationship

func LoadRelationship(kv *versioned.KV, t session.RelationshipType, myID,
	partnerID *id.ID, cyHandler session.CypherHandler, grp *cyclic.Group,
	rng *fastRNG.StreamGenerator) (*relationship, error)

todo - doscstring

func NewRelationship

func NewRelationship(kv *versioned.KV, t session.RelationshipType,
	myID, partnerID *id.ID, myOriginPrivateKey,
	partnerOriginPublicKey *cyclic.Int, originMySIDHPrivKey *sidh.PrivateKey,
	originPartnerSIDHPubKey *sidh.PublicKey, initialParams session.Params,
	cyHandler session.CypherHandler, grp *cyclic.Group,
	rng *fastRNG.StreamGenerator) *relationship

fixme - this is weird becasue it creates the relationsip and the session. Should be refactored to create an empty relationship, with a second call adding the session todo - doscstring

Types

type ConnectionFp

type ConnectionFp struct {
	// contains filtered or unexported fields
}

ConnectionFp represents a Partner connection fingerprint

func (ConnectionFp) Bytes

func (c ConnectionFp) Bytes() []byte

func (ConnectionFp) String

func (c ConnectionFp) String() string

type Manager

type Manager interface {
	// PartnerId returns the ID of the E2E partner
	PartnerId() *id.ID
	// MyId returns my ID used for the E2E relationship
	MyId() *id.ID
	// MyRootPrivateKey returns first private key in the DAG
	MyRootPrivateKey() *cyclic.Int
	// PartnerRootPublicKey returns the partner's first public key in the DAG
	PartnerRootPublicKey() *cyclic.Int
	// SendRelationshipFingerprint returns the fingerprint of the send session
	SendRelationshipFingerprint() []byte
	// ReceiveRelationshipFingerprint returns the fingerprint of the receive session
	ReceiveRelationshipFingerprint() []byte
	// ConnectionFingerprint returns a unique fingerprint for an E2E relationship in string format
	ConnectionFingerprint() ConnectionFp
	// Contact returns the contact of the E2E partner
	Contact() contact.Contact

	// PopSendCypher returns the key which is most likely to be successful for sending
	PopSendCypher() (session.Cypher, error)
	// PopRekeyCypher returns a key which should be used for rekeying
	PopRekeyCypher() (session.Cypher, error)

	// NewReceiveSession creates a new Receive session using the latest private key
	// this user has sent and the new public key received from the partner. If the
	// session already exists, then it will not be overwritten and the extant
	// session will be returned with the bool set to true denoting a duplicate. This
	// allows for support of duplicate key exchange triggering.
	NewReceiveSession(partnerPubKey *cyclic.Int,
		partnerSIDHPubKey *sidh.PublicKey, e2eParams session.Params,
		source *session.Session) (*session.Session, bool)
	// NewSendSession creates a new Send session using the latest public key
	// received from the partner and a new private key for the user. Passing in a
	// private key is optional. A private key will be generated if none is passed.
	NewSendSession(myDHPrivKey *cyclic.Int, mySIDHPrivateKey *sidh.PrivateKey,
		e2eParams session.Params, source *session.Session) *session.Session
	// GetSendSession gets the Send session of the passed ID. Returns nil if no session is found.
	GetSendSession(sid session.SessionID) *session.Session
	//GetReceiveSession gets the Receive session of the passed ID. Returns nil if no session is found.
	GetReceiveSession(sid session.SessionID) *session.Session

	// Confirm sets the passed session ID as confirmed and cleans up old sessions
	Confirm(sid session.SessionID) error

	// TriggerNegotiations returns a list of session that need rekeys
	TriggerNegotiations() []*session.Session

	// MakeService Returns a service interface with the
	// appropriate identifier for who is being sent to. Will populate
	// the metadata with the partner
	MakeService(tag string) message.Service

	// Delete removes the relationship between the partner
	// and deletes the Send and Receive sessions. This includes the
	// sessions and the key vectors
	Delete() error
}

Manager create and manages both E2E send and receive sessions using the passed cryptographic data

func LoadManager

func LoadManager(kv *versioned.KV, myID, partnerID *id.ID,
	cyHandler session.CypherHandler, grp *cyclic.Group,
	rng *fastRNG.StreamGenerator) (Manager, error)

LoadManager loads a relationship and all buffers and sessions from disk

func NewManager

func NewManager(kv *versioned.KV, myID, partnerID *id.ID, myPrivKey,
	partnerPubKey *cyclic.Int, mySIDHPrivKey *sidh.PrivateKey,
	partnerSIDHPubKey *sidh.PublicKey, sendParams,
	receiveParams session.Params, cyHandler session.CypherHandler,
	grp *cyclic.Group, rng *fastRNG.StreamGenerator) Manager

NewManager creates the relationship and its first Send and Receive sessions.

func NewTestManager

func NewTestManager(partnerId *id.ID, partnerPubKey, myPrivKey *cyclic.Int, t *testing.T) Manager

NewTestManager allows creation of a Manager interface object for testing purposes Backwards compatibility must be maintained if you make changes here Currently used for: Group chat testing

type ServiceHandler

type ServiceHandler interface {
	AddService(identifier []byte, tag string, source []byte)
	DeleteKey(identifier []byte, tag string)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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