Update VERSION for UsNat encoded strings, add tests for decoding version 1 strings #93
+99
−50
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.
Possibly related issues
Problem
GPP strings encoded with the UsNat section are being encoded not in accordance to the spec.
Version 1 UsNat section should have 12 values for SensitiveDataProcessing and 2 values for KnownChildSensitiveDataConsents. https://github.com/InteractiveAdvertisingBureau/Global-Privacy-Platform/blob/us-va_1.0/Sections/US-National/IAB%20Privacy%E2%80%99s%20National%20Privacy%20Technical%20Specification.md
Version 2 UsNat section has 16 values for SensitiveDataProcessing and 3 values for KnownChildSensitiveDataConsents
The support for the extra values was added in #67 UsNatCoreSegment.ts, but the VERSION constant was not updated. This means that the UsNat consent strings are being encoded as Version 1 but having 16 and 3 values for SensitiveDataProcessing and KnownChildSensitiveDataConsents
Adjustments
Open Question
When parsing a Version 1 string, should the Version be updated to Version 2 in the internal storage? If a Version 1 string is decoded and then encoded, the result will be a Version 2 string. I think this would mainly help with confusion, to avoid the object indicating it is Version 1 while having expanded field values; even if they were padded with 0s for the additional options.
The
package-lock.jsonupdated when runningnpm install, so I included it.