You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix handling of short discriminator in QRCodeSetupPayloadGenerator (project-chip#33250)
* Fix handling of short discriminator in QRCodeSetupPayloadGenerator
If a SetupPayload contains a short discriminator then
- isValidQRCodePayload() should return false
- trying to generate a QR Code should return INVALID_ARGUMENT
- generating with SetAllowInvalidPayload(true) should work (not die)
* SetupPayload tweaks
Make IsCommonTag, IsVendorTag, and getOptionalVendorData(tag, &info) public.
The first two are just encoding spec rules that are useful for clients, and the
latter allows clients to read vendor data by tag instead of having to read the
whole list.
Also use default values instead of explicit constructors for OptionalQRCodeInfo
and fix up some doc comments to correctly reference the vendor tag range.
* Address review comments
Elaborate on the use case for AllowInvalidPayload in the comments, and encode a
missing long discriminator as 0, to avoid a client encoding invalid payloads
from relying on round-tripping a short discriminator through a QR code.
* Handle rendezvousInformation and discriminator the same way
* Address review comment: use ValueOr
0 commit comments