Commit graph

83 commits

Author SHA1 Message Date
Scott Shawcroft
05745b1952
More TLV encoding fixes 2024-09-20 15:24:53 -07:00
Scott Shawcroft
2fe5fac82b
Add command support and split TLV parsing
TLV parsing can now happen without a concrete TLV structure to
follow. Structures are parsed into dictionaries and list/arrays are
into Python lists. They can't be reencoded this way! It is assumed
they will be used to create a more concrete object via `.from_value`

This handles the variable argument structures by allowing calling
code to make them concrete once they determine the type.

tlv.List is now a container superclass like tlv.Structure. It
allows for Structure like attribute access but preserves order
and duplicate keys (which may be unused).

Commands are now supported by subclassing the data model cluster
and overriding the class level Command() object. It stores input
and output type info.
2024-09-19 16:14:05 -07:00
Scott Shawcroft
39c27d0b55
Encrypts and sends but isn't decryptable 2024-09-17 16:04:19 -07:00
Scott Shawcroft
ba30cd9524
Refactor a bit to make things easier to find 2024-09-13 15:50:39 -07:00
Scott Shawcroft
1236513d67
WIP default values 2024-07-31 13:29:03 -07:00
Scott Shawcroft
49d090df42
WIP interaction model parsing and plumbing 2024-07-30 16:35:56 -07:00
Scott Shawcroft
7e235cd49a
WIP: Decrypt first message
Gotta figure out how to decode lists and arrays.
2024-07-29 16:29:26 -07:00
Scott Shawcroft
70d2e652d8
PASE succeeds 2024-07-29 14:31:20 -07:00
Scott Shawcroft
997a65c05d
Debugging crypto mismatch 2024-07-26 16:03:22 -07:00
Scott Shawcroft
5f14782999
Start working on SPAKE2+ 2024-07-24 15:43:52 -07:00
Scott Shawcroft
aa1b3fb4b0
Merge pull request #3 from CharString/adding_stricter_type_annotations
Adding stricter type annotations
2024-07-24 09:59:34 -07:00
Scott Shawcroft
05388f185a
Fix tag encoding, wrap in struct and parse StatusReport 2024-07-23 14:48:38 -07:00
Scott Shawcroft
4778dea5c5
More message encoding and attempted send 2024-07-22 16:24:47 -07:00
Chris Wesseling
b74a17dc1c Change NumberMembers to IntMembers
This makes those struct fields show up as `int` when you hover them in
your editor. And will give red squiglies when assiging values with the
wrong type.
2024-07-22 23:12:29 +02:00
Chris Wesseling
4bd35adc5a Add tlv.FloatMember
Adds a FloatMember that encodes LE floats/doubles as specified in A.11.5
2024-07-22 22:50:24 +02:00
Scott Shawcroft
89c6a97d63
Merge pull request #2 from CharString/adding_stricter_type_annotations
Stricter types
2024-07-22 13:11:32 -07:00
Chris Wesseling
6d7ee584e6 Handle optional and StructMember 2024-07-22 21:41:24 +02:00
Chris Wesseling
d6917a939a Stricter types
Makes things like this give a type error:

```
class NullTest(tlv.TLVStructure):
    n = tlv.BoolMember(None, nullable=True)
    notn = tlv.BoolMember(None, nullable=False)

s = NullTest()
s.n = None  # checks ok
s.notn = None  # doesn't type check
```
2024-07-20 19:38:20 +02:00
Scott Shawcroft
fecabb36b6
Work on sending a message 2024-07-19 15:56:02 -07:00
Scott Shawcroft
6078dbe887
Connect back up to real networking, record packets and enable replay 2024-07-18 14:43:15 -07:00
Scott Shawcroft
e59044735f
Merge pull request #1 from CharString/add-hypothesis-tests
Add hypothesis tests and bounds checks on Integers
2024-07-18 10:41:42 -07:00
Chris Wesseling
2c365ac768 Install all test dependencies in GH action 2024-07-18 19:11:51 +02:00
Chris Wesseling
ae892580ec Add hypothesis tests and bounds checks on Integers 2024-07-18 19:05:53 +02:00
Scott Shawcroft
9d2687b784
Add message reception state for counter verification 2024-07-17 11:23:03 -07:00
Scott Shawcroft
6f28636869
Add encoding and test it 2024-07-15 15:55:59 -07:00
Scott Shawcroft
5278ea1108
Test struct decode 2024-07-15 14:34:22 -07:00
Scott Shawcroft
c2eefe2d0b
Tests pass (more to come) 2024-07-15 13:11:09 -07:00
Scott Shawcroft
c65dfaa44e
add pre-commit 2024-07-15 11:09:15 -07:00
Scott Shawcroft
36e070361f
Create python-package.yml
Add CI
2024-07-15 10:52:07 -07:00
Scott Shawcroft
3fe32427c9
Fix float and add tests 2024-07-12 16:51:36 -07:00
Scott Shawcroft
83090d411c
More tests and UTF8 string 2024-07-12 15:45:49 -07:00
Scott Shawcroft
6c60bef9c6
Ignore dist 2024-07-12 13:51:07 -07:00
Scott Shawcroft
b3bdd11acb
Initial version 2024-07-12 13:50:07 -07:00