Invitation process store my server card+ server invitation fields
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is failing
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	continuous-integration/drone/push Build is failing
				
			This commit is contained in:
		@@ -43,34 +43,33 @@ func CreateIdentity(nickname string) *Identity {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Creates an invitation for a peer, returns the peer containing
 | 
					// Creates an invitation for a peer, returns the peer containing
 | 
				
			||||||
func (id *Identity) InvitePeer(MyName string, ContactName string, MessageServerIdxs []int) (*Peer, *meowlib.ContactCard, error) {
 | 
					func (id *Identity) InvitePeer(MyName string, ContactName string, MessageServerIdxs []int) (*Peer, error) {
 | 
				
			||||||
	var peer Peer
 | 
						var peer Peer
 | 
				
			||||||
	var myContactCard meowlib.ContactCard
 | 
					 | 
				
			||||||
	peer.MyIdentity = meowlib.NewKeyPair()
 | 
						peer.MyIdentity = meowlib.NewKeyPair()
 | 
				
			||||||
	peer.MyEncryptionKp = meowlib.NewKeyPair()
 | 
						peer.MyEncryptionKp = meowlib.NewKeyPair()
 | 
				
			||||||
	peer.MyLookupKp = meowlib.NewKeyPair()
 | 
						peer.MyLookupKp = meowlib.NewKeyPair()
 | 
				
			||||||
	peer.Name = ContactName
 | 
						peer.Name = ContactName
 | 
				
			||||||
	peer.InvitationId = uuid.New().String()
 | 
						peer.InvitationId = uuid.New().String() // todo as param to identify then update url
 | 
				
			||||||
	if id.MessageServers.Servers == nil {
 | 
						if id.MessageServers.Servers == nil {
 | 
				
			||||||
		return nil, nil, errors.New("no message servers defined in your identity")
 | 
							return nil, errors.New("no message servers defined in your identity")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for _, i := range MessageServerIdxs {
 | 
						for _, i := range MessageServerIdxs {
 | 
				
			||||||
		if i > len(id.MessageServers.Servers)-1 {
 | 
							if i > len(id.MessageServers.Servers)-1 {
 | 
				
			||||||
			return nil, nil, errors.New("requested server out of range of defined message servers")
 | 
								return nil, errors.New("requested server out of range of defined message servers")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for _, i := range MessageServerIdxs {
 | 
						for _, i := range MessageServerIdxs {
 | 
				
			||||||
		srv := &id.MessageServers.Servers[i].ServerData
 | 
							srv := &id.MessageServers.Servers[i].ServerData
 | 
				
			||||||
		myContactCard.PullServers = append(myContactCard.PullServers, srv)
 | 
							peer.MyContact.PullServers = append(peer.MyContact.PullServers, srv)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	myContactCard.Name = MyName
 | 
						peer.MyContact.Name = MyName
 | 
				
			||||||
	myContactCard.ContactPublicKey = peer.MyIdentity.Public
 | 
						peer.MyContact.ContactPublicKey = peer.MyIdentity.Public
 | 
				
			||||||
	myContactCard.EncryptionPublicKey = peer.MyEncryptionKp.Public
 | 
						peer.MyContact.EncryptionPublicKey = peer.MyEncryptionKp.Public
 | 
				
			||||||
	myContactCard.LookupPublicKey = peer.MyLookupKp.Public
 | 
						peer.MyContact.LookupPublicKey = peer.MyLookupKp.Public
 | 
				
			||||||
	myContactCard.InvitationId = peer.InvitationId
 | 
						peer.MyContact.InvitationId = peer.InvitationId
 | 
				
			||||||
	id.Peers = append(id.Peers, peer)
 | 
						id.Peers = append(id.Peers, peer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return &peer, &myContactCard, nil
 | 
						return &peer, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (id *Identity) CheckInvitation(ReceivedContact *meowlib.ContactCard) (isAnswer bool, proposedNick string, receivedNick string) {
 | 
					func (id *Identity) CheckInvitation(ReceivedContact *meowlib.ContactCard) (isAnswer bool, proposedNick string, receivedNick string) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,9 +25,12 @@ type Peer struct {
 | 
				
			|||||||
	MyEncryptionKp meowlib.KeyPair      `json:"my_encryption_kp,omitempty"`
 | 
						MyEncryptionKp meowlib.KeyPair      `json:"my_encryption_kp,omitempty"`
 | 
				
			||||||
	MyLookupKp     meowlib.KeyPair      `json:"my_lookup_kp,omitempty"`
 | 
						MyLookupKp     meowlib.KeyPair      `json:"my_lookup_kp,omitempty"`
 | 
				
			||||||
	MyPullServers  []meowlib.ServerCard `json:"my_pull_servers,omitempty"`
 | 
						MyPullServers  []meowlib.ServerCard `json:"my_pull_servers,omitempty"`
 | 
				
			||||||
 | 
						MyContact      meowlib.ContactCard  `json:"my_contact,omitempty"`
 | 
				
			||||||
	// Peer keys and infos
 | 
						// Peer keys and infos
 | 
				
			||||||
	Contact      meowlib.ContactCard `json:"contact,omitempty"`
 | 
						Contact          meowlib.ContactCard `json:"contact,omitempty"`
 | 
				
			||||||
	InvitationId string              `json:"invitation_id,omitempty"`
 | 
						InvitationId     string              `json:"invitation_id,omitempty"`
 | 
				
			||||||
 | 
						InvitationUrl    string              `json:"invitation_url,omitempty"`
 | 
				
			||||||
 | 
						InvitationExpiry time.Time           `json:"invitation_expiry,omitempty"`
 | 
				
			||||||
	// Internal management attributes
 | 
						// Internal management attributes
 | 
				
			||||||
	Visible             bool      `json:"visible,omitempty"`
 | 
						Visible             bool      `json:"visible,omitempty"`
 | 
				
			||||||
	VisiblePassword     string    `json:"visible_password,omitempty"`
 | 
						VisiblePassword     string    `json:"visible_password,omitempty"`
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user