Server side invitation step 3/4 preserve From public key / Client finalize in progress
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:
@ -11,8 +11,6 @@ import (
|
||||
)
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// InvitationAnswer
|
||||
@ -90,7 +88,7 @@ func InvitationAnswerFile(invitationFile string, nickname string, myNickname str
|
||||
}
|
||||
|
||||
// InvitationAnswerMessage
|
||||
func InvitationAnswerMessage(invitationId string, invitationServerUid string) ([]byte, string, error) {
|
||||
func InvitationAnswerMessage(invitationId string, invitationServerUid string, timeout int) ([]byte, string, error) {
|
||||
|
||||
// find the peer with that invitation id
|
||||
var peer *client.Peer
|
||||
@ -121,19 +119,35 @@ func InvitationAnswerMessage(invitationId string, invitationServerUid string) ([
|
||||
return nil, "InvitationAnswerMessage: ProcessOutboundUserMessage", err
|
||||
}
|
||||
// Creating Server message for transporting the user message
|
||||
toServerMessage := invitationServer.BuildToServerMessageFromUserMessage(packedMsg)
|
||||
// move the payload to invitation
|
||||
toServerMessage.Messages = nil
|
||||
invitationPayload, err := proto.Marshal(packedMsg)
|
||||
toServerMessage, err := invitationServer.BuildToServerMessageInvitationAnswer(packedMsg, peer.MyIdentity.Public, timeout)
|
||||
if err != nil {
|
||||
return nil, "InvitationAnswerMessage: proto.Marshal", err
|
||||
return nil, "InvitationAnswerMessage: BuildToServerMessageInvitationAnswer", err
|
||||
}
|
||||
toServerMessage.Invitation.Payload = invitationPayload
|
||||
toServerMessage.Invitation = &meowlib.Invitation{Step: 3}
|
||||
toServerMessage.Invitation.From = peer.MyIdentity.Public
|
||||
|
||||
// Server outbound processing
|
||||
bytemsg, err := invitationServer.ProcessOutboundMessage(toServerMessage)
|
||||
if err != nil {
|
||||
return nil, "InvitationAnswerMessage: ProcessOutboundMessage", err
|
||||
}
|
||||
return bytemsg, "", nil
|
||||
}
|
||||
|
||||
// InvitationAnswerMessageReadResponse
|
||||
// Called by the invitation receiver
|
||||
// invitationData: the data received from the server
|
||||
// invitationServerUid: the uid of the server holding the invitation
|
||||
func InvitationAnswerMessageReadResponse(invitationData []byte, invitationServerUid string) (*meowlib.Invitation, string, error) {
|
||||
|
||||
server, err := client.GetConfig().GetIdentity().MessageServers.LoadServer(invitationServerUid)
|
||||
if err != nil {
|
||||
return nil, "InvitationGetMessageReadResponse: LoadServer", err
|
||||
}
|
||||
// Server inbound processing : get the invitation server
|
||||
serverMsg, err := server.ProcessInboundServerResponse(invitationData)
|
||||
if err != nil {
|
||||
return nil, "InvitationGetMessageReadResponse: ProcessInboundServerResponse", err
|
||||
}
|
||||
|
||||
return serverMsg.Invitation, "", nil
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user