Server invitation process functions
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
ycc
2023-11-14 16:32:50 +01:00
parent 65f9ee2e07
commit 432f449558
8 changed files with 134 additions and 85 deletions

View File

@ -100,6 +100,23 @@ func (p *Peer) BuildSingleFileMessage(filename string, message []byte) ([]meowli
return msgs, nil
}
// Builds an invitation answer user message.
// it takes as input a contactcard generated by Identity.AnswerInvitation
func (p *Peer) BuildInvitationAnswserMessage(myContactCard *meowlib.ContactCard) (*meowlib.UserMessage, error) {
var msg meowlib.UserMessage
var invitation meowlib.Invitation
invitation.Step = 3
out, err := proto.Marshal(myContactCard)
if err != nil {
return nil, err
}
invitation.Payload = out
msg.Destination = p.Contact.LookupPublicKey
msg.From = p.MyIdentity.Public
msg.Type = "1"
return &msg, nil
}
//
// Messages encryption and packaging
//