import prelude;
public sending : Word;
public to : Word;
pattern Msg (a:Host)
= ( b:Host, text:Public ) [ !begun(a sending text to b) ];
tag msg (Msg(a)) : Auth<a:Host>;
fun lkupAuthKey (p:Any) : AuthKey(p);
client Initiator (a:Host, b:Host, sA:SignKey(a)) at a is
{
establish Receiver at b is (socket : Socket);
new (text : Public);
begin! (a sending text to b);
output socket is (a, text, {| hash( msg(b,text) ) |}sA);
}
server Receiver (b:Host) at b is (socket : Socket)
{
input socket is (a:Un, text:Un, ctext:Un);
let sA:AuthKey(a) = lkupAuthKey (a);
match ctext is {| hash( msg(b,text) ) |}sA^-1
[ !begun (a sending text to b) ];
end (a sending text to b);
}
|