Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move cipher to decryption function #82

Closed
wants to merge 1 commit into from

Conversation

Ernst79
Copy link
Collaborator

@Ernst79 Ernst79 commented Jul 15, 2023

HA was failing in the config flow tests with 2.13.0 on this part of the code when using encryption

assert self.cipher is not None  # nosec

I move the cipher part down to the decryption function. Not sure is this is the best way to solve it, but the HA tests do work with this change.

@codecov
Copy link

codecov bot commented Jul 15, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.10 ⚠️

Comparison is base (e6c192c) 77.66% compared to head (93c8baa) 77.56%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #82      +/-   ##
==========================================
- Coverage   77.66%   77.56%   -0.10%     
==========================================
  Files           6        6              
  Lines         479      477       -2     
  Branches       72       71       -1     
==========================================
- Hits          372      370       -2     
  Misses         83       83              
  Partials       24       24              
Impacted Files Coverage Δ
src/bthome_ble/__init__.py 100.00% <100.00%> (ø)
src/bthome_ble/parser.py 83.49% <100.00%> (-0.11%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Ernst79 Ernst79 requested a review from bdraco July 15, 2023 21:28
@bdraco
Copy link
Member

bdraco commented Jul 15, 2023

Is the bindkey getting set outside of init ?

@bdraco
Copy link
Member

bdraco commented Jul 15, 2023

Ideally we don't want to recreate the object every time we decrypt a packet as it will likely be MUCH slower

@bdraco
Copy link
Member

bdraco commented Jul 15, 2023

I fixed it in #83

@Ernst79 Ernst79 closed this Jul 16, 2023
@Ernst79
Copy link
Collaborator Author

Ernst79 commented Jul 16, 2023

Ideally we don't want to recreate the object every time we decrypt a packet as it will likely be MUCH slower

Yes, that what I also thought, but couldn't think of a better solution. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants