From afbab7c1623bcf66f2bc544a427985910d2cdee3 Mon Sep 17 00:00:00 2001 From: chrysn Date: Tue, 14 May 2024 12:28:44 +0200 Subject: [PATCH] packages: Add lakers-python --- packages/lakers-python/meta.yaml | 19 +++++++++++++++++++ packages/lakers-python/test_cbor_diag.py | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 packages/lakers-python/meta.yaml create mode 100644 packages/lakers-python/test_cbor_diag.py diff --git a/packages/lakers-python/meta.yaml b/packages/lakers-python/meta.yaml new file mode 100644 index 000000000000..ebaf3b581197 --- /dev/null +++ b/packages/lakers-python/meta.yaml @@ -0,0 +1,19 @@ +package: + name: lakers-python + version: 0.3.0 + top-level: + - lakers +source: + url: https://files.pythonhosted.org/packages/29/93/5d70b035f987a48dd854c1afc21025fb8446aae4d43c685b68691175623c/lakers_python-0.3.0.tar.gz + sha256: 009fc5e31b5a9a276216ff43ffd097004396a2a9131359a1da35d464e599cd1c +build: + script: | + cargo update -p proc-macro2 --precise 1.0.60 +requirements: + executable: + - rustup +about: + home: https://github.com/openwsn-berkeley/lakers/ + PyPI: https://pypi.org/project/lakers-python/ + summary: An implementation of EDHOC (RFC 9528) + license: BSD-3-Clause diff --git a/packages/lakers-python/test_cbor_diag.py b/packages/lakers-python/test_cbor_diag.py new file mode 100644 index 000000000000..962831863283 --- /dev/null +++ b/packages/lakers-python/test_cbor_diag.py @@ -0,0 +1,18 @@ +from pytest_pyodide import run_in_pyodide + +@run_in_pyodide(packages=["lakers-python"]) +def test_lakers_python(selenium_standalone): + import lakers + + # Running an exchange needs some keys and credentials; those are from the EDHOC test vectors. + R = bytes.fromhex("72cc4761dbd4c78f758931aa589d348d1ef874a7e303ede2f140dcf3e6aa4aac") + CRED_R = bytes.fromhex("A2026008A101A5010202410A2001215820BBC34960526EA4D32E940CAD2A234148DDC21791A12AFBCBAC93622046DD44F02258204519E257236B2A0CE2023F0931F1F386CA7AFDA64FCDE0108C224C51EABF6072") + + initiator = lakers.EdhocInitiator() + responder = lakers.EdhocResponder(R, CRED_R) + + message_1 = initiator.prepare_message_1() + responder.process_message_1(message_1) + _message_2 = responder.prepare_message_2(lakers.CredentialTransfer.ByReference, None, None) + + # There's a lot more that can be tested, but if this runs through, we've covered the most critical kinds of operations.