diff --git a/doc/sq_srvinv01.puml b/doc/sq_srvinv01.puml new file mode 100644 index 0000000..67c2e14 --- /dev/null +++ b/doc/sq_srvinv01.puml @@ -0,0 +1,12 @@ +@startuml Server Invitation Step 01 +User -> Bastet : fill invitation +User -> Bastet : select servers +Bastet -> NativeLib : get server cards for selected uids +NativeLib -> Bastet : server cards +Bastet -> NativeLib : invitationCreateMessage +NativeLib -> Bastet : invitationMessage +Bastet -> Server : send invitation +Server -> Redis : Store invitation +Server -> Bastet : invitation URL +Bastet -> User : invitation URL +@enduml \ No newline at end of file diff --git a/doc/sq_srvinv02.puml b/doc/sq_srvinv02.puml new file mode 100644 index 0000000..7e2ac17 --- /dev/null +++ b/doc/sq_srvinv02.puml @@ -0,0 +1,11 @@ +@startuml Server Invitation Step 02 +User -> Bastet : paste URL +Bastet -> NativeLib : build invitationGetMessage +NativeLib -> Bastet : invitationGetMessage +Bastet -> Server : send invitationGetMessage +Redis -> Server : retrieve invitation +Server -> Bastet : invitation message +Bastet -> NativeLib : please invitation message +NativeLib -> Bastet : invitation message +Bastet -> User : invitation data +@enduml \ No newline at end of file diff --git a/doc/sq_srvinv03.puml b/doc/sq_srvinv03.puml new file mode 100644 index 0000000..90b0594 --- /dev/null +++ b/doc/sq_srvinv03.puml @@ -0,0 +1,12 @@ + +@startuml Server Invitation Step 03 +User -> Bastet : select servers +User -> Bastet : accept invitation +Bastet -> NativeLib : accept invitation +Bastet -> NativeLib : build accept message +NativeLib -> Bastet : invitationGetMessage +Bastet -> Server : send accept message +Server -> Redis : store accept message +Server -> Bastet : accept message ok +Bastet -> User : msg sent +@enduml \ No newline at end of file diff --git a/doc/sq_srvinv04.puml b/doc/sq_srvinv04.puml new file mode 100644 index 0000000..2a85d36 --- /dev/null +++ b/doc/sq_srvinv04.puml @@ -0,0 +1,10 @@ + +@startuml Server Invitation Step 03 +Bastet -> NativeLib : periodic message check +Bastet -> NativeLib : build accept message +NativeLib -> Bastet : invitationGetMessage +Bastet -> Server : send accept message +Server -> Redis : store accept message +Server -> Bastet : accept message ok +Bastet -> User : msg sent +@enduml \ No newline at end of file diff --git a/server/router.go b/server/router.go index 28c4e6e..ad290f5 100644 --- a/server/router.go +++ b/server/router.go @@ -141,17 +141,22 @@ func (r *RedisRouter) Route(msg *meowlib.ToServerMessage) (*meowlib.FromServerMe from_server.Invitation.Payload = invitation // protobuf invitation } - /* should not happen - case 3: // answer invitation - expiry := r.AnswerInvitation(msg.Invitation.Id, int(msg.Invitation.Timeout), msg.Invitation.Payload, r.InvitationTimeout) - from_server.Invitation.Expiry = expiry.UTC().Unix() - case 4: // get answer - answer, err := r.GetInvitationAnswer(msg.Invitation.Id) - if err != nil { - from_server.Invitation.Payload = []byte("invitation expired") - } else { - from_server.Invitation.Payload = answer - } + case 3: // answer invitation + // just propagate the source publickey + from_server.Invitation.From = msg.Invitation.From + + //! store answer !! + from_server.Invitation.Payload = msg.Invitation.Payload + /* + expiry := r.AnswerInvitation(msg.Invitation.Id, int(msg.Invitation.Timeout), msg.Invitation.Payload, r.InvitationTimeout) + from_server.Invitation.Expiry = expiry.UTC().Unix() + case 4: // get answer + answer, err := r.GetInvitationAnswer(msg.Invitation.Id) + if err != nil { + from_server.Invitation.Payload = []byte("invitation expired") + } else { + from_server.Invitation.Payload = answer + } */ } }