mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-28 12:19:54 +00:00
add type-verified command actor (from)
This commit is contained in:
parent
222051fc5d
commit
b64a2e615d
2 changed files with 26 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue