From dbfa10263bd4f8202ccae4e8313cfc45c733fc8b Mon Sep 17 00:00:00 2001 From: Koen Vervloesem Date: Sun, 16 Jul 2023 16:14:31 +0200 Subject: [PATCH 1/2] Publish encrypted properties when PUBLISH_ADVDATA is 1 --- TheengsGateway/ble_gateway.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/TheengsGateway/ble_gateway.py b/TheengsGateway/ble_gateway.py index e886a10f..fc894b41 100644 --- a/TheengsGateway/ble_gateway.py +++ b/TheengsGateway/ble_gateway.py @@ -379,6 +379,11 @@ def detection_callback( decrypted_data, data_json, decoded_json ) + # Keep encrypted properties + cipher = decoded_json["cipher"] + mic = decoded_json["mic"] + ctr = decoded_json["ctr"] + # Re-decode advertisement, this time unencrypted decoded_json = decodeBLE(json.dumps(data_json)) if decoded_json: @@ -389,6 +394,11 @@ def detection_callback( data_json["servicedata"], ) + # Re-add encrypted properties + decoded_json["cipher"] = cipher + decoded_json["mic"] = mic + decoded_json["ctr"] = ctr + except KeyError: logger.exception( "Can't find bindkey for %s.", device.address @@ -413,6 +423,9 @@ def detection_callback( "cont", "track", "encr", + "cipher", + "mic", + "ctr", ): decoded_json.pop(key, None) From 58f394faeee5cdfc5fe23535586d2dd1044b391f Mon Sep 17 00:00:00 2001 From: Koen Vervloesem Date: Sun, 16 Jul 2023 18:22:06 +0200 Subject: [PATCH 2/2] Update GitHub Actions versions --- .github/workflows/check.yml | 4 ++-- .github/workflows/manual_test-pypi.yml | 10 +++++----- .github/workflows/publish_docs.yml | 12 ++++++------ .github/workflows/release.yml | 8 +++++--- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 02da5b04..98b3f524 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,9 +11,9 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout repository - uses: actions/checkout@v3.1.0 + uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v4.3.0 + uses: actions/setup-python@v4 with: python-version: "3.11" - name: Run pre-commit diff --git a/.github/workflows/manual_test-pypi.yml b/.github/workflows/manual_test-pypi.yml index 9e351e7f..48bff861 100644 --- a/.github/workflows/manual_test-pypi.yml +++ b/.github/workflows/manual_test-pypi.yml @@ -4,13 +4,13 @@ on: jobs: build-n-publish: name: Build and publish distribution to TestPyPI - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 with: {fetch-depth: 0} # deep clone for setuptools-scm - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: - python-version: '3.x' + python-version: '3.11' - name: Install pypa/build run: | python3 -m pip install --upgrade pip @@ -19,7 +19,7 @@ jobs: run: | python3 setup.py sdist - name: Publish distribution 📦 to Test PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml index 0bdf8f54..7668285c 100644 --- a/.github/workflows/publish_docs.yml +++ b/.github/workflows/publish_docs.yml @@ -5,18 +5,18 @@ on: types: [published] jobs: documentation: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 name: Create the documentation and deploy it to GitHub Pages steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: "14.x" - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: "3.7" + python-version: "3.11" - name: Install build dependencies run: | python -m pip install --upgrade pip @@ -30,4 +30,4 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs/.vuepress/dist - cname: gateway.theengs.io \ No newline at end of file + cname: gateway.theengs.io diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a7621414..682eea59 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,11 +6,13 @@ on: jobs: build-n-publish: name: Build and publish distributions to PyPI - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 with: {fetch-depth: 0} # deep clone for setuptools-scm - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 + with: + python-version: '3.11' - name: Install pypa/build run: | python3 -m pip install --upgrade pip @@ -19,6 +21,6 @@ jobs: run: | python3 setup.py sdist - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }}