fixes step 2
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
yc
2026-04-12 13:38:15 +02:00
parent 793213b3fb
commit 327bd390c4
7 changed files with 186 additions and 111 deletions

View File

@@ -62,29 +62,20 @@ func Step2ReadResponse(invitationData []byte, invitationServerUid string) (*meow
return meowlib.NewInvitationInitPayloadFromCompressed(serverMsg.Invitation.Payload)
}
// Step2PostAnswer builds and returns the packed server message that posts the
// invitee's ContactCard (encrypted with the initiator's temp key) to the invitation server.
func Step2PostAnswer(invitationId string, invitationServerUid string, timeout int) ([]byte, error) {
// Step2PostAnswer wraps the invitee's already-built PackedUserMessage into a server
// message and posts it to the invitation server. The packed message is produced by
// messages.Step2InviteeCreatesInitiatorAndEncryptedContactCard.
func Step2PostAnswer(invitationId string, packedMsg *meowlib.PackedUserMessage, invitationServerUid string, timeout int) ([]byte, error) {
peer := client.GetConfig().GetIdentity().Peers.GetFromInvitationId(invitationId)
if peer == nil {
return nil, errors.New("no peer with that invitation id")
}
answermsg, err := peer.BuildInvitationStep2Message(peer.GetMyContact())
if err != nil {
return nil, err
}
invitationServer, err := client.GetConfig().GetIdentity().MessageServers.LoadServer(invitationServerUid)
if err != nil {
return nil, err
}
packedMsg, err := peer.ProcessOutboundUserMessage(answermsg)
if err != nil {
return nil, err
}
toServerMessage, err := invitationServer.BuildToServerMessageInvitationAnswer(packedMsg, peer.MyIdentity.Public, invitationId, timeout)
if err != nil {
return nil, err