diff --git a/specification/Simplex/Messaging/Protocol.idr b/specification/Simplex/Messaging/Protocol.idr index f8d4af923b..cdf82d11b8 100644 --- a/specification/Simplex/Messaging/Protocol.idr +++ b/specification/Simplex/Messaging/Protocol.idr @@ -274,10 +274,24 @@ data Command : (ty : Type) PushMsg : {auto prf : HasState Sender s} -> Command () Broker Recipient + (Secured <==> (Secured, n) <==| s) + (>>> Secured <==> (Secured, n) <==| s) + + DeleteMsg : {auto prf : HasState Sender s} + -> Command () Recipient Broker (Secured <==> (Secured, 1 + n) <==| s) (>>> Secured <==> (Secured, n) <==| s) + Pure : (res : Result a) -> Command a from to state state_fn (>>=) : Command a from1 to1 state1 state2_fn -> ((res : Result a) -> Command b from2 to2 (state2_fn state1 res) state3_fn) -> Command b from1 to2 state1 state3_fn + + +infix 5 &> +(&>) : (p : Participant) + -> Command a from1 to1 state1 state2_fn + -> {auto prf : p = from1} + -> Command a from1 to1 state1 state2_fn +(&>) _ c = c diff --git a/specification/Simplex/Messaging/Scenarios.idr b/specification/Simplex/Messaging/Scenarios.idr index a8da8644bf..83e45482d9 100644 --- a/specification/Simplex/Messaging/Scenarios.idr +++ b/specification/Simplex/Messaging/Scenarios.idr @@ -2,17 +2,18 @@ module Simplex.Messaging.Scenarios import Protocol -establishConnection : Command () Recipient Recipient +establishConnection : Command () Recipient Broker (Null <==> (Null, 0) <==| Null) (>>> Secured <==> (Secured, 0) <==| Secured) establishConnection = do - ids <- CreateConn "recipient's public key for broker" - Subscribe - SendInvite newInvitation - ConfirmConn "sender's public key for broker" - PushConfirm - SecureConn "sender's public key for broker" - SendWelcome - PushWelcome - SendMsg "Hello" - PushMsg + Recipient &> CreateConn "recipient's public key for broker" + Recipient &> Subscribe + Recipient &> SendInvite newInvitation + Sender &> ConfirmConn "sender's public key for broker" + Broker &> PushConfirm + Recipient &> SecureConn "sender's public key for broker" + Sender &> SendWelcome + Broker &> PushWelcome + Sender &> SendMsg "Hello" + Broker &> PushMsg + Recipient &> DeleteMsg