Repository navigation
Validation parity with vcon 1.0.4 (content_hash, lawful basis body, created_at) - #9
Merged
Merged
Conversation
…body validator, keep created_at
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.
Brings
isValid()/getValidationWarnings()to parity with the Python reference, vcon 1.0.4, using the same messages.Rules ported
contentHashProblems(), exported): errors for a ContentHash that is not<algorithm>-<base64url digest>, an empty list, a non-string, or asha512/sha256digest of the wrong length. Checked on Dialogs (exceptincomplete), attachments, analysis,redacted_fromandamended_from.urlwithoutcontent_hashon a Dialog, analysis, or inline/redacted attachment (an error in 1.1), and a serialized JSON string body underencoding: "json".src/lawful-basis.ts, a port ofLawfulBasisValidator): required fields, lawful basis value, expiration, purpose grants,content_hashobject, proof mechanisms, and registry.isValid()runs it on everypurpose: "lawful_basis"attachment. Its errors and warnings are prefixedAttachment at index N (lawful_basis):and its own scope warnings are left out. Unknown proof types, hash algorithms, and canonicalization methods are warnings. Nested warnings are passed up. Timestamps are parsed the way Python'sdatetime.fromisoformatparses them.created_at/updated_aterror now gives the reason in dateutil's wording.lawful_basis attachment ... has no party/sessionwarnings. Python does not emit them, and the core rules already check scope.Parity
Compared against
vcon==1.0.4on 257 vCons (migrated real-world vCons plus the core-05 Appendix B examples), withmigrate_legacy=False:The two files that still differ are B6/B7, the known JWS-form difference. I also ran 147 generated edge cases. All match except 7, and each of those is a Python bug where JS deliberately behaves differently:
is_valid()raises on some inputs, and Python accepts a ContentHash with a trailing newline.Test fixtures that used
sha512-xnow use a real digest, as the Python tests do.