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