Skip to content

Commit cb2d606

Browse files
authored
Update demo.py
1 parent 4c6fbfa commit cb2d606

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

demo.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
from cyphersyntax.handshake import (
2+
HandshakeConfirmation,
3+
HandshakeOffer,
4+
HandshakeResponse,
5+
)
16
from cyphersyntax.identity import Identity
27
from cyphersyntax.session import AeadSuite, SessionFactory
38

@@ -13,14 +18,19 @@ def main() -> None:
1318
suite=AeadSuite.AES_GCM_SIV,
1419
supplemental_secret=b"future-pq-kem-secret",
1520
)
21+
received_offer = HandshakeOffer.from_bytes(pending_alice.offer.to_bytes())
1622
response, pending_bob = SessionFactory.responder(
1723
local_identity=bob,
1824
remote_signing_public_key=alice.ed25519_public_bytes(),
19-
offer=pending_alice.offer,
25+
offer=received_offer,
2026
supplemental_secret=b"future-pq-kem-secret",
2127
)
22-
confirmation, alice_session = pending_alice.complete(response)
23-
bob_session = pending_bob.complete(confirmation)
28+
received_response = HandshakeResponse.from_bytes(response.to_bytes())
29+
confirmation, alice_session = pending_alice.complete(received_response)
30+
received_confirmation = HandshakeConfirmation.from_bytes(
31+
confirmation.to_bytes()
32+
)
33+
bob_session = pending_bob.complete(received_confirmation)
2434

2535
packet = alice_session.encrypt(b"CypherSyntax demo message")
2636
plaintext = bob_session.decrypt(packet)

0 commit comments

Comments
 (0)