Repository navigation
feat(r9cam): accept EdDSA device tokens - #521
Merged
Merged
Conversation
Device assertions were ES256 only (ASSERTION_ALGORITHMS = ("ES256",)), so a camera could not move to an Ed25519 key. The backend now accepts ES256 and EdDSA, and each camera may sign only with the algorithm its registered key implies: EC P-256 for ES256, OKP Ed25519 for EdDSA. The stored JWK already records the key type, so no migration is needed.
Pairing an Ed25519 camera also needs r9cam-models 0.7.0, whose DevicePublicKeyJWK accepts OKP keys; the relock follows once it is on PyPI.
Not tested: the database integration tests (pairing and relay flows) did not run locally.
Fixes #501
Signed-off-by: Simon van Lierde <90462640+simonvanlierde@users.noreply.github.com>
r9cam-models 0.7.0 lets DevicePublicKeyJWK carry an Ed25519 (OKP) key, which r9cam 0.8 pairs with by default. Under 0.6 pairing such a Pi failed with a ValidationError on PairingRegisterRequest. - The OpenAPI exports and the generated frontend API types pick up the wider JWK schema; `y` is optional now, and no frontend code reads the JWK. - A pairing test registers an Ed25519 key. Signed-off-by: Simon van Lierde <90462640+simonvanlierde@users.noreply.github.com>
Merging this PR will not alter performance1 warning
Comparing |
r9cam-models 0.7.0 types RelayPublicKeyJWK.alg as Literal["ES256", "EdDSA"], so unpacking a dict[str, str] into it fails ty with invalid-argument-type in backend/check. Signed-off-by: Simon van Lierde <90462640+simonvanlierde@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This lets r9cam cameras sign their device tokens with EdDSA as well as ES256. Fixes #501.
DevicePublicKeyJWKaccepts Ed25519 keys. r9cam 0.8.0 pairs with Ed25519 by default, so this needs to be deployed before that release.Tested:
just backend/checkpasses, and the backend unit and integration tests pass, 2242 tests. The three new assertion tests failed against the old code, and the Ed25519 pairing test failed on the 0.6 pin.Not checked: nothing beyond CI.