openbadgeslib 4.6.4__tar.gz → 4.6.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/Changelog.txt +118 -0
  2. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/PKG-INFO +1 -1
  3. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/_context_validation.py +284 -27
  4. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/credential.py +121 -34
  5. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/ldp.py +33 -4
  6. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/util.py +1 -1
  7. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib.egg-info/PKG-INFO +1 -1
  8. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_credential.py +260 -0
  9. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_ldp_context_validation.py +991 -0
  10. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_ldp_ecdsa_sd.py +83 -0
  11. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_verifier.py +34 -0
  12. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/CONTRIBUTING.md +0 -0
  13. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/GOVERNANCE.md +0 -0
  14. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/LICENSE.txt +0 -0
  15. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/MANIFEST.in +0 -0
  16. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/README.md +0 -0
  17. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/SECURITY.md +0 -0
  18. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/docs/README.md +0 -0
  19. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/__init__.py +0 -0
  20. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/_jsonmodel.py +0 -0
  21. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/_jws/__init__.py +0 -0
  22. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/_jws/exceptions.py +0 -0
  23. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/_jws/utils.py +0 -0
  24. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/_ob1_api.py +0 -0
  25. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/_python_support.py +0 -0
  26. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/_safejson.py +0 -0
  27. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/badge_model.py +0 -0
  28. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/baking.py +0 -0
  29. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/cli_common.py +0 -0
  30. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/config.ini.example +0 -0
  31. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/confparser.py +0 -0
  32. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/errors.py +0 -0
  33. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/issue.py +0 -0
  34. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/keys.py +0 -0
  35. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/logs.py +0 -0
  36. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/mail.py +0 -0
  37. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob1/__init__.py +0 -0
  38. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob1/badge.py +0 -0
  39. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob1/signer.py +0 -0
  40. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob1/verifier.py +0 -0
  41. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob2/__init__.py +0 -0
  42. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob2/models.py +0 -0
  43. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob2/signer.py +0 -0
  44. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob2/verifier.py +0 -0
  45. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/__init__.py +0 -0
  46. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/_canon_guard.py +0 -0
  47. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/_structure_screen.py +0 -0
  48. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/clr.py +0 -0
  49. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/contexts/__init__.py +0 -0
  50. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/contexts/clr_context_2.0.1.json +0 -0
  51. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/contexts/credentials-v2.json +0 -0
  52. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/contexts/ob-v3p0-context-3.0.1.json +0 -0
  53. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/contexts/ob-v3p0-context-3.0.2.json +0 -0
  54. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/contexts/ob-v3p0-context-3.0.3.json +0 -0
  55. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/contexts/ob-v3p0-extensions.json +0 -0
  56. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/contexts/security-data-integrity-v2.json +0 -0
  57. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/contexts/security-multikey-v1.json +0 -0
  58. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/did.py +0 -0
  59. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/eudi.py +0 -0
  60. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/publish.py +0 -0
  61. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/signer.py +0 -0
  62. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/status.py +0 -0
  63. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/status_list.py +0 -0
  64. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/status_registry.py +0 -0
  65. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/ob3/verifier.py +0 -0
  66. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/oid4vci/__init__.py +0 -0
  67. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/oid4vci/codes.py +0 -0
  68. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/oid4vci/errors.py +0 -0
  69. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/oid4vci/formats.py +0 -0
  70. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/oid4vci/handler.py +0 -0
  71. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/oid4vci/memory_store.py +0 -0
  72. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/oid4vci/metadata.py +0 -0
  73. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/oid4vci/nonce.py +0 -0
  74. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/oid4vci/offer.py +0 -0
  75. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/oid4vci/reconcile.py +0 -0
  76. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/oid4vci/sqlite_store.py +0 -0
  77. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/oid4vci/store.py +0 -0
  78. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/openbadges_cli.py +0 -0
  79. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/openbadges_init.py +0 -0
  80. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/openbadges_keygenerator.py +0 -0
  81. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/openbadges_publish.py +0 -0
  82. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/openbadges_signer.py +0 -0
  83. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/openbadges_status.py +0 -0
  84. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/openbadges_verifier.py +0 -0
  85. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/py.typed +0 -0
  86. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib/verify.py +0 -0
  87. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib.egg-info/SOURCES.txt +0 -0
  88. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib.egg-info/dependency_links.txt +0 -0
  89. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib.egg-info/entry_points.txt +0 -0
  90. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib.egg-info/requires.txt +0 -0
  91. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/openbadgeslib.egg-info/top_level.txt +0 -0
  92. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/pyproject.toml +0 -0
  93. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/setup.cfg +0 -0
  94. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/config1.ini +0 -0
  95. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/conformance/Dockerfile.ob3 +0 -0
  96. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/conformance/README.md +0 -0
  97. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/conformance/conftest.py +0 -0
  98. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/conformance/docker-compose.yml +0 -0
  99. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/conformance/relax-danubetech-checksums.awk +0 -0
  100. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/conformance/test_official_validators.py +0 -0
  101. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/conftest.py +0 -0
  102. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/fixtures/ob_schemas/README.md +0 -0
  103. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/fixtures/ob_schemas/ob_v3p0_achievementcredential_schema.json +0 -0
  104. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/fixtures/ob_schemas/ob_v3p0_profile_schema.json +0 -0
  105. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/fixtures/ob_schemas/refresh.sh +0 -0
  106. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/fixtures/vc_di_eddsa/README.md +0 -0
  107. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/fixtures/vc_di_eddsa/credentials-examples-v2.json +0 -0
  108. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/fixtures/vc_di_eddsa/doc-hash.txt +0 -0
  109. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/fixtures/vc_di_eddsa/key-pair.json +0 -0
  110. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/fixtures/vc_di_eddsa/proof-config-hash.txt +0 -0
  111. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/fixtures/vc_di_eddsa/signed-credential.json +0 -0
  112. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/images/sample1.png +0 -0
  113. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/images/sample1.svg +0 -0
  114. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/images/userimage01.svg +0 -0
  115. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/ldp_helpers.py +0 -0
  116. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/logo Python Espan/314/203a.svg" +0 -0
  117. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/logo Python Espa/303/261a.svg" +0 -0
  118. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_b64url.py +0 -0
  119. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_baking.py +0 -0
  120. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_cli_json.py +0 -0
  121. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_cli_smoke.py +0 -0
  122. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_confparser.py +0 -0
  123. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_docs.py +0 -0
  124. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_eddsa.py +0 -0
  125. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_errors.py +0 -0
  126. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_examples.py +0 -0
  127. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_issue.py +0 -0
  128. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_issue_credential.py +0 -0
  129. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_jsonmodel.py +0 -0
  130. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_jws.py +0 -0
  131. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_key_operation.py +0 -0
  132. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_keys.py +0 -0
  133. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_mail.py +0 -0
  134. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob1_badge_io.py +0 -0
  135. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob1_deprecation.py +0 -0
  136. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob1_signer.py +0 -0
  137. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob1_verifier.py +0 -0
  138. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob2_cli.py +0 -0
  139. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob2_error_branches.py +0 -0
  140. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob2_models.py +0 -0
  141. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob2_signer.py +0 -0
  142. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob2_verifier.py +0 -0
  143. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_canon_guard_dataset.py +0 -0
  144. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_clr.py +0 -0
  145. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_conformance_schema.py +0 -0
  146. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_contexts.py +0 -0
  147. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_did.py +0 -0
  148. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_did_doc.py +0 -0
  149. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_endorsement.py +0 -0
  150. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_eudi_oid4vci.py +0 -0
  151. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_eudi_sd_jwt.py +0 -0
  152. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_eudi_type_metadata.py +0 -0
  153. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_eudi_x5c.py +0 -0
  154. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_ldp.py +0 -0
  155. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_ldp_canon_guard.py +0 -0
  156. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_ldp_cli.py +0 -0
  157. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_ldp_ecdsa_sd_dos.py +0 -0
  158. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_ldp_errors.py +0 -0
  159. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_ldp_sign.py +0 -0
  160. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_ldp_structure_screen.py +0 -0
  161. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_publish_cli.py +0 -0
  162. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_signer.py +0 -0
  163. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_signer_cli_ldp.py +0 -0
  164. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_status.py +0 -0
  165. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_status_list.py +0 -0
  166. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_ob3_status_registry.py +0 -0
  167. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_oid4vci_config.py +0 -0
  168. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_oid4vci_protocol.py +0 -0
  169. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_oid4vci_reservations.py +0 -0
  170. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_oid4vci_store.py +0 -0
  171. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_openbadges_cli.py +0 -0
  172. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_public_api.py +0 -0
  173. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_python_support.py +0 -0
  174. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_safejson.py +0 -0
  175. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_sign_ecc.pem +0 -0
  176. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_sign_rsa.pem +0 -0
  177. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_signer_batch.py +0 -0
  178. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_untrusted_input.py +0 -0
  179. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_util.py +0 -0
  180. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_verifier_cli_coverage.py +0 -0
  181. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_verify.py +0 -0
  182. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_verify_ecc.pem +0 -0
  183. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/test_verify_rsa.pem +0 -0
  184. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/withoutxmlheader.svg +0 -0
  185. {openbadgeslib-4.6.4 → openbadgeslib-4.6.5}/tests/withxmlheader.svg +0 -0
@@ -4,6 +4,124 @@ OpenBadgesLib - Changelog
4
4
  Newest first. Dates are ISO 8601 (YYYY-MM-DD).
5
5
 
6
6
 
7
+ * v4.6.5 - 2026-11-18
8
+
9
+ - security(ldp): every description of a node the returned credential is
10
+ read from must agree with the one it is read from. RDF has one node per
11
+ id however many JSON objects describe it, and a Data Integrity signature
12
+ covers the node, so a signed member can sit in any of them, while
13
+ `OB3LdpVerifier.verify` reads each member from one fixed object. The
14
+ 1EdTech Complete example describes two nodes twice in the credential
15
+ itself (the issuer again as `achievement.creator`, a `criteria` with the
16
+ achievement's id), and a holder can write any node that has an id as two
17
+ entries of the array that holds it. Without touching the signature, the
18
+ holder of such a badge could move the achievement's `description` into
19
+ `criteria` (or the `narrative` of `criteria` onto the achievement), leave
20
+ the issuer's `name`, `url`, `email` and `image` only in `creator`, split
21
+ `credentialSubject` so that `result`, `identifier` and `creditsEarned`
22
+ sat in the entry the model does not read, or exchange two values of one
23
+ member: the returned credential lacked them (an empty description, an
24
+ issuer without name, no results) or showed the other value. Validity,
25
+ status, recipient and issuer verdicts were not affected. Now, for the
26
+ issuer, each `credentialSubject`, its achievement, and the `criteria`,
27
+ `alignment`, `resultDescription`, `result`, `identifier` and `evidence`
28
+ nodes the model reads, every other object with the same id anywhere in
29
+ the document, embedded endorsements included, must carry for each member
30
+ the model reads there either nothing or exactly the same value(s); a
31
+ value that is itself one of those nodes is the same when its id and what
32
+ the model reads of it are. A member the model does not read is free, so
33
+ the Complete example, endorsements of the achievement or of the issuer,
34
+ and the shape this library issues (no `creator`, a `criteria` without
35
+ id) verify as before.
36
+ Compatibility: a credential whose issuer gives such a node two different
37
+ values for a member the model reads, or gives the member only outside
38
+ the object the model reads it from, is refused. That is an `issuer`
39
+ written as a bare IRI, or with fewer of `name`, `url`, `email`, `image`
40
+ and `endorsementJwt` than an `achievement.creator` (or any other
41
+ description) of the same id in the same credential, which is the very
42
+ document a holder gets by cutting a twice-described issuer down; a
43
+ self-issued badge whose subject and issuer objects carry different
44
+ `image` values; and an ecdsa-sd-2023 presentation that reveals a member
45
+ of a twice-described node only at the other pointer
46
+ (`/credentialSubject/achievement/creator/name` without `/issuer/name`).
47
+ The remedy for an issuer is to describe the node where the model reads
48
+ it, and for a holder to reveal the member there; the refusal names the
49
+ node, the member and both places. `OB3LdpSigner` holds what it emits to
50
+ the same rule and raises `ErrorSigningFile` for what 4.6.4 issued and
51
+ verified when the caller gives two of the nodes one id and different
52
+ members: two `Evidence` or two `ResultDescription` entries with the same
53
+ id that differ (or one of which lacks a member the other has), an
54
+ `Evidence` with the id of the achievement or of the issuer, an
55
+ achievement with the issuer's id and another `name`. A self-issued badge
56
+ (the recipient id equal to the issuer id) is issued as before. The
57
+ low-level functions, which check the proof alone, and the JWT-VC path,
58
+ where every byte is signed, are unchanged (#348)
59
+
60
+ - fix(ob3): an `image` given as a string is read as the image's id.
61
+ `"image": "https://..."` is the same JSON-LD statement as
62
+ `"image": {"id": "https://..."}`, but the model read an image only from
63
+ the object, so `Issuer.image_url` and `Achievement.image_url` were None
64
+ for an issuer that wrote the bare IRI, on the JWT-VC and the Data
65
+ Integrity path alike. On the Data Integrity path a holder could cause
66
+ it: context validation takes the two spellings for one, so an image
67
+ signed with its `id` alone (no `type`, no `caption`) could be re-spelled
68
+ as a string under the same proof, and the verified credential lost it;
69
+ so could a typed image whose node is described somewhere else in the
70
+ credential. Nothing is refused that verified before and `to_vc` still
71
+ writes the object. With the string read, the rule of #348 above compares
72
+ an `image` between two descriptions of the issuer or of the achievement
73
+ by the id it names, which is all the model reads of it: an image named
74
+ in one and described (`type`, `caption`) in the other verifies, two
75
+ different images of one node or an image only in the description the
76
+ model does not read are refused (#350)
77
+
78
+ - fix(ob3): a value, the one-entry array of it and the value written twice
79
+ are read as one by the model. In JSON-LD the values of a property are a
80
+ set, so `"criteria": {...}`, `"criteria": [{...}]` and
81
+ `"criteria": [{...}, {...}]` with the same object twice are the same
82
+ statements, but `OpenBadgeCredential.from_vc_document` read most members
83
+ in one shape only. On the Data Integrity path a holder could use it:
84
+ context validation takes a value and its one-entry array for one
85
+ spelling (conforming credentials write `"type": ["Profile"]`), and a
86
+ repeated value changes nothing signed, so with the proof still valid a
87
+ `criteria` or an `image` in an array read as none (`criteria_narrative`
88
+ `''`, `image_url` None), `creditsEarned` / `creditsAvailable` in an
89
+ array as None, a one-entry `resultDescription`, `identifier` or `result`
90
+ written as the bare object as an empty list, a one-entry `tag` written
91
+ as a string as that string, and a string in an array (the credential
92
+ `name`, the issuer's `name`, `url` and `email`, the achievement's
93
+ `description` and `achievementType`, the `narrative` of `criteria`, the
94
+ optional members of an evidence, a result, a result description, an
95
+ alignment or an identifier) as a list where the model declares a `str`.
96
+ On the JWT-VC path, where every byte is signed, an issuer that wrote the
97
+ other spelling got the same. Now a member the model reads as one value
98
+ is read from the value, from its one-entry array, and from an array
99
+ whose entries are all that same value (numbers compared by value, a
100
+ boolean never equal to a number; for an `image`, entries that name one
101
+ id, as objects or bare IRIs); a member it reads as a list is read from
102
+ a single value too. Nothing that verified is refused and no verdict
103
+ changes: `alignment`, `evidence`, `credentialStatus`, `endorsementJwt`
104
+ and `credentialSubject` already read both shapes, and the members that
105
+ refuse an array (`issuer`, `achievement`, `validFrom` / `validUntil`,
106
+ and the required strings: the achievement's `name`, an alignment's
107
+ `targetName` and `targetUrl`, an identifier's `identityHash`,
108
+ `identityType` and `hashed`, a result description's `name` and
109
+ `resultType`) refuse it as before. Not changed: an array of values that
110
+ really differ, which only an issuer can sign, is read as before (no
111
+ criteria, no image, no credits; a list for a string), and where the
112
+ model reads a list (`tag`, `evidence`, `alignment`, `identifier`, ...)
113
+ a holder can still write an entry twice, which then shows twice: a
114
+ scalar or a node with an id as it is, a node without id under a blank
115
+ node label on eddsa-rdfc-2022 (#351)
116
+
117
+ - security(ldp): a blank node label (`_:x`) is refused as the `id` of
118
+ `credentialSubject.achievement` on both Data Integrity suites (OB 3.0
119
+ requires it, and a label added after signing was reported as the
120
+ achievement id). On ecdsa-sd-2023 the returned credential is built
121
+ without the label a subject or a status entry carries, so the holder
122
+ cannot choose the status entry id or a `recipient_id` the model
123
+ reports (#349)
124
+
7
125
  * v4.6.4 - 2026-11-18
8
126
 
9
127
  - security(ldp): on CPython 3.11 and 3.12 the JSON-LD to RDF conversion may
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openbadgeslib
3
- Version: 4.6.4
3
+ Version: 4.6.5
4
4
  Summary: Production-ready Python library & CLI for Open Badges 3.0 (W3C Verifiable Credentials): issue, verify, and revoke JWT-VC credentials with Bitstring Status Lists and did:web — plus strict OB 2.0 and legacy OB 1.0.
5
5
  Author-email: Luis González Fernández <luisgf@luisgf.es>, Jesús Cea Avión <jcea@jcea.es>
6
6
  License: LGPLv3
@@ -132,12 +132,46 @@
132
132
  # subject's EndorsementSubject type: a type is a statement about the node
133
133
  # too, and moves out with endorsementComment as the description moves in.
134
134
  # The cost: an endorsement whose subject carries an extension member is
135
- # refused. A node the issuer describes twice in the credential itself (the
136
- # issuer again as achievement.creator, a criteria with the achievement's id,
137
- # both in the credential the tests model on the 1EdTech example) is NOT
138
- # covered: the two descriptions differ there by design, so neither a
139
- # "described once" nor an "exact copy" rule holds, and a member the model
140
- # reads can still be left only in the other.
135
+ # refused.
136
+ #
137
+ # The same holds with no endorsement (_check_read_in_place). A node is
138
+ # described twice in the credential itself when the issuer writes it twice
139
+ # (the issuer again as achievement.creator and a criteria with the
140
+ # achievement's id, both in the credential the tests model on the 1EdTech
141
+ # example; the subject of a self-issued badge, which is its issuer), and any
142
+ # node with an id -- or with a blank node label, as good as one inside a
143
+ # document -- can be split by the holder over two entries of the array that
144
+ # holds it (credentialSubject: [{id: S, achievement}, {id: S, result}], of
145
+ # which the model reads the first). Such descriptions differ by design, so
146
+ # neither a "described once" nor an "exact copy" rule holds; the rule is by
147
+ # member. For every node the model reads members from at a fixed position
148
+ # (_MODEL_READS: the issuer, each credentialSubject, its achievement, the
149
+ # criteria, alignments, resultDescriptions, results and identifiers under
150
+ # them, each evidence), every other node object with the same @id anywhere in
151
+ # the document, inside an embedded credential too, carries for each of those
152
+ # members either nothing or the value(s) the position carries: compared as
153
+ # canonical JSON of the expanded form -- of a value that is itself a node the
154
+ # model reads members of, its id and those members; of any other, the whole
155
+ # value -- and the values of one member as a set (their order is not
156
+ # signed). So a member cannot be left
157
+ # only where the model does not read it -- moved there, or deleted from the
158
+ # object it is read from -- and a node cannot have two values for it to
159
+ # exchange. A member the model does not read is free: the creator may carry
160
+ # other endorsements than the issuer, and a criteria with the achievement's
161
+ # id adds only its narrative, which is read from the criteria and so may not
162
+ # sit on the achievement object either. The check runs once, on the document
163
+ # the model is built from, after every other rule. The cost: a credential
164
+ # whose issuer gives such a node two different values for a member the model
165
+ # reads, or the member only outside the object it is read from, is refused.
166
+ # That is ``issuer`` as a bare IRI (or with fewer of those members) beside a
167
+ # ``creator`` with the same id that has them -- the very document a holder
168
+ # gets by cutting a twice-described issuer down to its id --, a self-issued
169
+ # badge whose subject and issuer objects each carry an ``image``, and an
170
+ # ecdsa-sd-2023 presentation that reveals such a member only at the other
171
+ # pointer. A node of which the model reads the id alone (an ``image``) has
172
+ # no member to hold in place and no rule of its own; as a member of the
173
+ # issuer or of the achievement it is compared by that id, which the model
174
+ # reads from the object and from the bare IRI alike.
141
175
  #
142
176
  # Fifth (_reject_blank_node_ids), a blank node label is no identifier. It is
143
177
  # not part of the dataset -- canonicalization relabels blank nodes -- so
@@ -145,16 +179,19 @@
145
179
  # under the same signature, the compacted form keeps the label, and the model
146
180
  # reads it as the id of the credential, of the issuer, of the subject
147
181
  # (recipient_id) or of a status entry. A label is refused in those four
148
- # positions, of the credential and of every embedded one, in whatever JSON
149
- # spelling ("id", "@id", a bare reference, an entry of an array). Only
150
- # there: openvc-core's ecdsa-sd-2023 derive writes a label on every node of a
151
- # presentation that has no id (the criteria of every badge this library
152
- # issues), so a rule for all nodes would refuse those presentations. For the
153
- # same reason, when the proof is an ecdsa-sd-2023 one (*derived*) only the
154
- # credential's and the issuer's ids are held to it -- OB 3.0 requires those,
155
- # so a label there never comes from a conforming credential -- and a subject
156
- # or status entry, whose id is optional, keeps the label the delegate gave
157
- # it: that presentation verifies, and its model still shows the label.
182
+ # positions (and the achievement's), of the credential and of every embedded
183
+ # one, in whatever JSON spelling ("id", "@id", a bare reference, an entry of an
184
+ # array). Only there: openvc-core's ecdsa-sd-2023 derive writes a label on
185
+ # every node of a presentation that has no id (the criteria of every badge this
186
+ # library issues), so a rule for all nodes would refuse those presentations.
187
+ # For the same reason, when the proof is an ecdsa-sd-2023 one (*derived*) only
188
+ # the credential's and the issuer's ids are held to it -- OB 3.0 requires
189
+ # those, so a label there never comes from a conforming credential -- and a
190
+ # subject or status entry, whose id is optional, keeps the label the delegate
191
+ # gave it: that presentation verifies, and OB3LdpVerifier.verify builds the
192
+ # model from a copy without it, so no label is reported as a recipient or a
193
+ # status id. The id of credentialSubject.achievement, which OB 3.0 requires, is
194
+ # held to the rule on both suites, as is a bare reference there.
158
195
  #
159
196
  # OB 3.0 adaptations (the 1EdTech "Complete OpenBadgeCredential" example must
160
197
  # validate):
@@ -353,7 +390,13 @@ def _check_form(document: dict[str, Any], loader: _Loader, jsonld: Any, *,
353
390
  if "@graph" in node:
354
391
  raise OB3VerificationError(
355
392
  "the %s uses a top-level @graph, which is not accepted" % what)
356
- _check_expanded(node, node.get("@id"), what, top=True, embedded=depth > 0)
393
+ # Only the document the model is built from has the positions it reads
394
+ # (a proof configuration has none of them, an embedded credential is not
395
+ # modelled); its walk reaches into the credentials it embeds.
396
+ described: Optional[_Described] = {} if depth == 0 else None
397
+ _check_expanded(node, node.get("@id"), what, top=True, embedded=depth > 0,
398
+ reads=_model_reads() if depth == 0 else None,
399
+ described=described)
357
400
  _check_status_in_place(node, what)
358
401
 
359
402
  compacted = _jsonld_call(jsonld.compact, what, expanded,
@@ -390,6 +433,11 @@ def _check_form(document: dict[str, Any], loader: _Loader, jsonld: Any, *,
390
433
  _check_embedded(credential, path, loader, jsonld, what=what,
391
434
  depth=depth + 1, derived=derived)
392
435
 
436
+ # Last, so every rule above keeps its own refusal: by now the document,
437
+ # and each credential it embeds, is known to be in compacted form.
438
+ if described:
439
+ _check_read_in_place(described, node, document, what)
440
+
393
441
 
394
442
  def _check_embedded(credential: dict[str, Any], path: _Path, loader: _Loader,
395
443
  jsonld: Any, *, what: str, depth: int,
@@ -420,19 +468,29 @@ def _reject_blank_node_ids(credential: dict[str, Any], what: str,
420
468
  derived: bool) -> None:
421
469
  """Refuse a blank node label as the id of *credential* (compact JSON, as
422
470
  the model reads it), of its issuer, of a credentialSubject or of a
423
- credentialStatus entry: the proof does not cover it (see the module
424
- comment). With *derived*, an ecdsa-sd-2023 presentation, only where
425
- OB 3.0 requires an id: the delegate labels every node that has none.
471
+ credentialStatus entry, or of the achievement of a credentialSubject: the
472
+ proof does not cover it (see the module comment). With *derived*, an
473
+ ecdsa-sd-2023 presentation, the subject's and the status entry's own ids
474
+ are exempt, since the delegate labels every node that has none; the
475
+ credential's, the issuer's and the achievement's, which OB 3.0 requires,
476
+ are not.
426
477
 
427
478
  A few dictionary reads on a credential already at hand, before any
428
479
  JSON-LD processing; nothing is walked."""
429
480
  _reject_blank_node_id(credential, what, "its id")
430
481
  for key, whose, required in _IDENTIFIED:
431
- if derived and not required:
432
- continue
433
482
  value = credential.get(key)
434
483
  for node in (value if isinstance(value, list) else [value]):
435
- _reject_blank_node_id(node, what, whose)
484
+ if required or not derived:
485
+ _reject_blank_node_id(node, what, whose)
486
+ # OB 3.0 requires Achievement.id, so a label there is refused on
487
+ # both suites: a presentation of a conforming credential has none.
488
+ if key == "credentialSubject" and isinstance(node, dict):
489
+ achievement = node.get("achievement")
490
+ for ach in (achievement if isinstance(achievement, list)
491
+ else [achievement]):
492
+ _reject_blank_node_id(
493
+ ach, what, "the id of its achievement")
436
494
 
437
495
 
438
496
  def _reject_blank_node_id(node: Any, what: str, whose: str) -> None:
@@ -589,17 +647,23 @@ def _is_node_iri(value: Any) -> bool:
589
647
 
590
648
 
591
649
  def _check_expanded(value: Any, top_id: Any, what: str, *, top: bool = False,
592
- via: Optional[str] = None, embedded: bool = False) -> None:
650
+ via: Optional[str] = None, embedded: bool = False,
651
+ reads: Optional["_Reads"] = None,
652
+ described: Optional["_Described"] = None) -> None:
593
653
  """Walk the expanded form: refuse the keywords that detach statements from
594
654
  their node, a nested re-description of the document's own node, and
595
655
  anything the RDF conversion would silently drop -- so the dataset holds
596
656
  exactly what the JSON says. *via* is the predicate that led here.
597
657
  *embedded* marks the walk of an embedded credential, whose subject may
598
658
  carry only the members of an EndorsementSubject (see the module
599
- comment)."""
659
+ comment). With *described*, every node object below the top one that has
660
+ an ``@id`` is noted in it, together with *reads*: the members the model
661
+ reads from a node in this position, if it reads any
662
+ (_check_read_in_place)."""
600
663
  if isinstance(value, list):
601
664
  for item in value:
602
- _check_expanded(item, top_id, what, via=via, embedded=embedded)
665
+ _check_expanded(item, top_id, what, via=via, embedded=embedded,
666
+ reads=reads, described=described)
603
667
  return
604
668
  if not isinstance(value, dict):
605
669
  return
@@ -626,6 +690,8 @@ def _check_expanded(value: Any, top_id: Any, what: str, *, top: bool = False,
626
690
  raise OB3VerificationError(
627
691
  "the %s's own node %s is described again inside it"
628
692
  % (what, _brief(top_id)))
693
+ if described is not None and not top and "@id" in value:
694
+ described.setdefault(value["@id"], []).append((value, reads))
629
695
  subject = embedded and via == _CREDENTIAL_SUBJECT
630
696
  for key, item in value.items():
631
697
  if not key.startswith("@") and not _is_predicate(key):
@@ -639,8 +705,199 @@ def _check_expanded(value: Any, top_id: Any, what: str, *, top: bool = False,
639
705
  "endorses, signed all the same there, would be out of the "
640
706
  "object the model reads it from" % (what, _brief(key)))
641
707
  if key not in ("@id", "@type"):
708
+ below = reads.get(key) if reads else None
642
709
  _check_expanded(item, top_id, what, embedded=embedded,
643
- via=None if key.startswith("@") else key)
710
+ via=None if key.startswith("@") else key,
711
+ reads=below[1] if below else None,
712
+ described=described)
713
+
714
+
715
+ # ── a node the model reads, described in more than one place ────────────────
716
+
717
+ # What OpenBadgeCredential.from_vc_document reads below the credential's own
718
+ # node (ob3/credential.py; a test compares this table with what it really
719
+ # reads, in both directions): the compact key of a member -> the keys read
720
+ # from the node(s) under it, in turn. An empty mapping is a value read as it
721
+ # is; None is a node read for its id alone (an ``image``, whether it is
722
+ # written as an object or as a bare IRI): it has no members, so no rule of
723
+ # its own, and as a member it is compared by the id it names. The
724
+ # credential's own node and its credentialStatus entries have rules of
725
+ # their own and are not listed.
726
+ _ALIGNMENT_READS: Mapping[str, Any] = MappingProxyType({
727
+ "targetName": {}, "targetUrl": {}, "targetFramework": {},
728
+ "targetCode": {}, "targetDescription": {}})
729
+ _MODEL_READS: Mapping[str, Any] = MappingProxyType({
730
+ "issuer": {"name": {}, "url": {}, "email": {}, "image": None,
731
+ "endorsementJwt": {}},
732
+ "credentialSubject": {
733
+ "identifier": {"identityHash": {}, "identityType": {}, "hashed": {},
734
+ "salt": {}},
735
+ "result": {"value": {}, "status": {}, "achievedLevel": {},
736
+ "resultDescription": {}, "alignment": _ALIGNMENT_READS},
737
+ "creditsEarned": {},
738
+ "achievement": {
739
+ "name": {}, "description": {}, "criteria": {"narrative": {}},
740
+ "image": None, "tag": {}, "endorsementJwt": {},
741
+ "achievementType": {}, "creditsAvailable": {},
742
+ "alignment": _ALIGNMENT_READS,
743
+ "resultDescription": {
744
+ "name": {}, "resultType": {}, "allowedValue": {},
745
+ "requiredValue": {}, "requiredLevel": {}, "valueMin": {},
746
+ "valueMax": {}, "alignment": _ALIGNMENT_READS},
747
+ },
748
+ },
749
+ "evidence": {"narrative": {}, "name": {}, "description": {}, "genre": {},
750
+ "audience": {}},
751
+ })
752
+
753
+ # _MODEL_READS by predicate: IRI -> (the model's key, the same for the
754
+ # node(s) under it).
755
+ _Reads = Mapping[str, Tuple[str, Any]]
756
+ # @id -> every node object of the expanded form that carries it, each with
757
+ # what the model reads from it there (None or empty: nothing).
758
+ _Described = Dict[str, List[Tuple[Dict[str, Any], Optional[_Reads]]]]
759
+
760
+
761
+ @functools.lru_cache(maxsize=1)
762
+ def _model_reads() -> _Reads:
763
+ """_MODEL_READS for the expanded form. A key stands for every IRI some
764
+ pinned context defines it as, in any scope (``image`` is also the Image
765
+ type's alias): a superset, like _key_iris, so the rule fails closed
766
+ whatever scoped context the node's types bring."""
767
+ return _reads_by_iri(_MODEL_READS)
768
+
769
+
770
+ def _reads_by_iri(reads: Mapping[str, Any]) -> _Reads:
771
+ names = _type_synonyms()
772
+ return {iri: (key, None if below is None else _reads_by_iri(below))
773
+ for key, below in reads.items() for iri in names[key]}
774
+
775
+
776
+ def _check_read_in_place(described: _Described, root: Dict[str, Any],
777
+ document: Dict[str, Any], what: str) -> None:
778
+ """Refuse a node the model reads members from that is described in more
779
+ than one place, unless every description that carries one of those
780
+ members carries the same value(s) for it, the one the model reads
781
+ included (see the module comment). *described* is what _check_expanded
782
+ collected over *root*, the expanded form of *document*.
783
+
784
+ Nothing is walked again: only the node objects that share an ``@id`` with
785
+ one the model reads are looked at, and of those only the members it
786
+ reads."""
787
+ for node_id, places in described.items():
788
+ if len(places) < 2:
789
+ continue
790
+ for member in sorted({iri for _, reads in places if reads
791
+ for iri in reads}):
792
+ carriers = [node for node, _ in places if node.get(member)]
793
+ if not carriers:
794
+ continue
795
+ readers = [(node, reads[member]) for node, reads in places
796
+ if reads and member in reads]
797
+ for reader, (key, below) in readers:
798
+ if not reader.get(member):
799
+ raise OB3VerificationError(
800
+ "the %s describes the node %s in more than one place, "
801
+ "and its %s is not at %s, where the model reads it, "
802
+ "but at %s: the signature covers the node, not which "
803
+ "JSON object carries each of its members, so what "
804
+ "was signed would not be shown; describe the node "
805
+ "where the model reads it"
806
+ % (what, _brief(node_id), key,
807
+ _where(document, root, reader),
808
+ _where(document, root, carriers[0])))
809
+ reader, (key, below) = readers[0]
810
+ shown = _values(reader[member], below)
811
+ for carrier in carriers:
812
+ if _values(carrier[member], below) != shown:
813
+ raise OB3VerificationError(
814
+ "the %s describes the node %s in more than one place, "
815
+ "and its %s at %s, where the model reads it, is not "
816
+ "the same as at %s: the signature covers the node, "
817
+ "not which JSON object carries each value, so either "
818
+ "could be shown as the signed one; give the node the "
819
+ "same %s wherever it is described"
820
+ % (what, _brief(node_id), key,
821
+ _where(document, root, reader),
822
+ _where(document, root, carrier), key))
823
+
824
+
825
+ def _values(items: Any, below: Optional[_Reads]) -> FrozenSet[Any]:
826
+ """What the model reads of the values of a member of an expanded node
827
+ object, as a set: the order of the values of a property is not signed.
828
+ *below* is what it reads from a node under that member (_Reads): empty
829
+ for a value read as it is, None for a node read for its id alone."""
830
+ return frozenset(_read_of(item, below) for item in
831
+ (items if isinstance(items, list) else [items]))
832
+
833
+
834
+ def _read_of(item: Any, below: Optional[_Reads]) -> Any:
835
+ """What the model reads of one value: the value whole, in canonical JSON
836
+ (so true/1 and 1/1.0 stay distinct), unless it is a node the model reads
837
+ members of -- then its id and those members, the same way -- or a node
838
+ it reads for its id alone (*below* is None) -- then that id. What the
839
+ model does not read of such a node (the ``targetType`` of an alignment,
840
+ the ``caption`` of an image) is no reason to tell two descriptions
841
+ apart; a member moved between two objects of that node is refused on the
842
+ node's own account, since the one under the position the model reads is
843
+ itself a node it reads."""
844
+ if below == {} or not isinstance(item, dict) or any(
845
+ key.startswith("@") and key not in ("@id", "@type") for key in item):
846
+ return _canonical(item)
847
+ if below is None:
848
+ return (item.get("@id"),)
849
+ return (item.get("@id"), tuple(
850
+ (member, _values(item[member], inner))
851
+ for member, (_, inner) in sorted(below.items()) if item.get(member)))
852
+
853
+
854
+ def _where(document: Any, root: Any, node: Dict[str, Any]) -> str:
855
+ """A JSON pointer into *document* to the object that expanded to *node*,
856
+ an object of its expanded form *root*. Only run to word a refusal, on a
857
+ document already known to be in compacted form, so a step of the
858
+ expanded path is a key the pinned contexts spell that IRI with and an
859
+ array holds its entries in the same order; where the document has
860
+ another shape the pointer goes on by the terms, as an approximation."""
861
+ value: Any = document
862
+ path: _Path = ()
863
+ for step in _path_to(root, node, ()) or ():
864
+ if isinstance(step, int):
865
+ # Expansion wraps every value in an array; compaction unwraps
866
+ # the ones with a single entry.
867
+ if isinstance(value, list) and step < len(value):
868
+ value, path = value[step], path + (step,)
869
+ elif step:
870
+ value, path = None, path + (step,)
871
+ continue
872
+ terms = _term_spellings().get(step, frozenset())
873
+ key = next((key for key in value if key == step or key in terms),
874
+ None) if isinstance(value, dict) else None
875
+ if key is None:
876
+ # A property is spelled lowerCamelCase, and sorts after the type
877
+ # alias that shares its IRI (Criteria / criteria).
878
+ value, path = None, path + (max(terms) if terms else step,)
879
+ else:
880
+ value, path = value[key], path + (key,)
881
+ return _brief(_pointer(path))
882
+
883
+
884
+ def _path_to(value: Any, node: Dict[str, Any], path: _Path) -> Optional[_Path]:
885
+ """The keys and indexes that lead from *value* (expanded form) to the
886
+ object *node* itself, or None."""
887
+ if value is node:
888
+ return path
889
+ if isinstance(value, list):
890
+ for index, item in enumerate(value):
891
+ found = _path_to(item, node, path + (index,))
892
+ if found is not None:
893
+ return found
894
+ elif isinstance(value, dict) and "@value" not in value:
895
+ for key, item in value.items():
896
+ if key not in ("@id", "@type"):
897
+ found = _path_to(item, node, path + (key,))
898
+ if found is not None:
899
+ return found
900
+ return None
644
901
 
645
902
 
646
903
  def _check_status_in_place(node: dict[str, Any], what: str) -> None: