Skip to content

INJICERT #1181 [Feature] Issue a non-mDL mso_mdoc credential (ISO/IEC TS 23220 Photo ID) - #1210

Draft
bernard42 wants to merge 5 commits into
inji:developfrom
bernard42:issue-1181
Draft

bernard42 wants to merge 5 commits into
inji:developfrom
bernard42:issue-1181

Conversation

@bernard42

@bernard42 bernard42 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1181. Certify issues an ISO/IEC TS 23220 Photo ID (org.iso.23220.photoid.1) in DataProvider mode, per TS 23220-4 Annex C.

Changes

  • PhotoIdDataElements (beside MdlDataElements); MDocProcessor encodes and checks per namespace, mDL output unchanged
  • Photo ID: portrait → JPEG bytes; issue_date/expiry_date → full-date; portrait_capture_date → tdate; birth_date → full-date or map; age_over_NN → boolean
  • Add/Update: Photo ID mandatory elements (new photo_id_mandatory_fields_missing); missing element name/value named in the error
  • Sample: PhotoIDCredential seed, mock-photoid profile, photo_id_data.csv

Behaviour changes (every mso_mdoc, incl. mDL)

  • A null element is left out instead of written as CBOR null
  • Integers beyond a long are CBOR integers (were text); beyond ±2^64 are rejected

Docs: README, docker-compose README, Local_Development, Credential_Issuer_Configuration, Stoplight, Releases

Done when

  • Config via API, in issuer metadata; independent decoding passes
  • mDL tests pass; docs updated
  • Wallet downloads and shows it; verifier reports it verified

Summary by CodeRabbit

  • New Features
    • Added support for issuing ISO/IEC TS 23220 Photo ID credentials, including mandatory-field checks and encoding for dates, portraits, and age attestations.
    • Added a Photo ID profile and sample configuration for local setup, plus a Postman collection for the authorization-code issuance flow.
  • Bug Fixes
    • Improved mdoc template validation, including clearer errors for malformed entries and handling of null values and unsupported numeric values.
  • Documentation
    • Updated setup guides, API documentation, and release notes with Photo ID configuration and credential requirements.

…mso_mdoc

Signed-off-by: bernardlamptey42 <bernardlamptey42@yahoo.com>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI; Enforced overrides: Organization
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 17c54fc2-dc19-486b-b74d-a31a4e18fe76
Commits

Reviewing files that changed from the base of the PR and between 24c7401 and d3a2cb6.

Files selected for processing: 6

  • certify-service/src/main/java/io/mosip/certify/utils/MDocProcessor.java
  • certify-service/src/test/java/io/mosip/certify/credential/MDocCredentialPhotoIdTest.java
  • certify-service/src/test/java/io/mosip/certify/utils/MDocProcessorTest.java
  • docs/stoplight_docs/inji-certify-openapi.yaml
  • docs/technical_docs/Credential_Issuer_Configuration.md
  • docs/technical_docs/Releases.md

Walkthrough

The change adds ISO/IEC TS 23220 Photo ID support for mdoc credentials. It adds configuration checks for mandatory Photo ID elements and template structure, plus processing and CBOR encoding rules for Photo ID and mDL elements. It also adds a mock Photo ID profile, seeded credential configuration, and tests for validation and issuance. Documentation describes the profile and the added rules.

Merge Risk: Moderate · previous review 24c74 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Photo ID issuance can produce a credential without a mandatory element, such as the portrait, when the template sets it to null. This should be resolved or explicitly accepted before merge. The sample Postman flow can also leave a stale client key after a failed registration request. Unsigned age claims are not strictly validated.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive [#1181] Directly linked issue. Coding requirements: Photo ID mso_mdoc issuance in DataProvider mode, with validation, encoding, sample, tests, and docs.

Covered by the change summary:
- Mandatory ele…
Confirm that docker-compose/docker-compose-injistack/config/photo_id_data.csv (excluded by !**/*.csv) supplies a value for every org.iso.23220.1 mandatory element (family_name, given_name, birth_date, portrait, issue_date, `…
Passed Passed checks: 3 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: issuing a non-mDL mso_mdoc credential, the ISO/IEC TS 23220 Photo ID. The changeset adds Photo ID issuance in DataProvider mode, including the org.iso.23220.photoid.1 …
Out of Scope Changes check Passed Each change maps to a linked-issue task or supports one.
- PhotoIdDataElements, MDocProcessor, and the validators implement tasks 2 to 6 (portrait, dates, value types and nulls, template validatio…
Full details: Title check

Explanation

The title names the main change: issuing a non-mDL mso_mdoc credential, the ISO/IEC TS 23220 Photo ID. The changeset adds Photo ID issuance in DataProvider mode, including the org.iso.23220.photoid.1 docType, mandatory-element checks, encoding, docs, and tests. The title is specific and matches the linked issue #1181 and the PR objectives. It is 88 characters, slightly long, but still clear.

Full details: Out of Scope Changes check

Explanation

Each change maps to a linked-issue task or supports one.

  • PhotoIdDataElements, MDocProcessor, and the validators implement tasks 2 to 6 (portrait, dates, value types and nulls, template validation, birth_date map).
  • The null-omission and integer-range changes apply to all mso_mdoc credentials, including mDL. Task 4 requires null omission. The mDL output change for null elements is stated in the PR and is intended.
  • The PHOTO_ID_MANDATORY_FIELDS_MISSING constant and Photo ID tests implement task 9.
  • The sample seed, certify_init.sql entry, mock-photoid properties, CSV mount, and docker-compose changes implement task 1.
  • Documentation changes implement task 8.
  • The Postman collection under docs/postman_collections is a test tool for the Photo ID issuance flow. Its partner-auth and OIDC client setup steps are test scaffolding and do not change product behavior. This is a judgment call.

No change was shown to be unrelated to #1181.

Full details: Linked Issues check

Explanation

[#1181] Directly linked issue. Coding requirements: Photo ID mso_mdoc issuance in DataProvider mode, with validation, encoding, sample, tests, and docs.

Covered by the change summary:

  • Mandatory elements: PhotoIdDataElements.MANDATORY and missingMandatory report absent org.iso.23220.1 elements with photo_id_mandatory_fields_missing. Element names are listed. Checked on Add and Update through MsoMdocCredentialConfigValidator and CredentialConfigurationServiceImpl.
  • Portrait: portrait is encoded as JPEG byte string. Base64 and JPEG data-URI inputs are tested. Invalid images are rejected.
  • Dates: issue_date and expiry_date use full-date (tag 1004). portrait_capture_date uses tdate (tag 0). birth_date accepts full-date or map form.
  • Value types and nulls: null elements are omitted. Integers are CBOR integers in the range -2^64 to 2^64-1. Unsupported number types are rejected.
  • Template errors: missing element name or value fails with mdoc_template_processing_failed, and the message names the field.
  • Signing and binding: MDocCredentialPhotoIdTest checks ES256 signature, digests, docType, and deviceKey.
  • Tests: MDocProcessorTest, MsoMdocCredentialConfigValidatorTest, and CredentialConfigMetadataAttributesTest cover these cases. Existing mDL tests are reported as passing.
  • Docs: README, technical docs, Stoplight, and Releases are updated.

Not established:

  • The sample mock data requirement depends on docker-compose/docker-compose-injistack/config/photo_id_data.csv. This file is excluded by rule !**/*.csv and was not reviewed. Whether it supplies all mandatory elements cannot be confirmed.
  • Wallet download/display and verifier acceptance are manual end-to-end checks. They are non-coding and are not assessed.
  • Issuer key and certificate trust for the verifier relies on Certify's own signing key (CERTIFY_VC_SIGN_EC_R1). Verifier trust is not confirmed by code evidence.

Resolution

Confirm that docker-compose/docker-compose-injistack/config/photo_id_data.csv (excluded by !**/*.csv) supplies a value for every org.iso.23220.1 mandatory element (family_name, given_name, birth_date, portrait, issue_date, expiry_date, issuing_authority_unicode, issuing_country, age_over_18) and that its birth_date form matches the supported full-date or map formats. Verifier acceptance remains a manual check outside this assessment.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI; Enforced overrides: Organization
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: a53003c9-8df6-4153-b42e-e5c04dcc0a89
Commits

Reviewing files that changed from the base of the PR and between 5914868 and e876f14.

Files ignored due to path filters: 1

  • docker-compose/docker-compose-injistack/config/photo_id_data.csv is excluded by !**/*.csv
Files selected for processing: 19

  • README.md
  • certify-core/src/main/java/io/mosip/certify/core/constants/ErrorConstants.java
  • certify-service/src/main/java/io/mosip/certify/services/CredentialConfigurationServiceImpl.java
  • certify-service/src/main/java/io/mosip/certify/utils/MDocProcessor.java
  • certify-service/src/main/java/io/mosip/certify/utils/PhotoIdDataElements.java
  • certify-service/src/main/java/io/mosip/certify/validators/credentialconfigvalidators/MsoMdocCredentialConfigValidator.java
  • certify-service/src/main/resources/application-local.properties
  • certify-service/src/test/java/io/mosip/certify/credential/MDocCredentialPhotoIdTest.java
  • certify-service/src/test/java/io/mosip/certify/services/CredentialConfigMetadataAttributesTest.java
  • certify-service/src/test/java/io/mosip/certify/utils/MDocProcessorTest.java
  • certify-service/src/test/java/io/mosip/certify/validators/credentialconfigvalidators/MsoMdocCredentialConfigValidatorTest.java
  • docker-compose/docker-compose-injistack/README.md
  • docker-compose/docker-compose-injistack/certify_init.sql
  • docker-compose/docker-compose-injistack/config/certify-mock-photoid.properties
  • docker-compose/docker-compose-injistack/docker-compose.yaml
  • docs/stoplight_docs/inji-certify-openapi.yaml
  • docs/technical_docs/Credential_Issuer_Configuration.md
  • docs/technical_docs/Local_Development.md
  • docs/technical_docs/Releases.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment on lines +345 to +346
if (elementValue.isNull()) {
continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Data Integrity & Integration · Quick win

Reject unset mandatory elements after rendering.

If a Photo ID template declares portrait with elementValue: null, configuration validation accepts it. This branch then removes portrait. The remaining validation does not check mandatory-element presence, so the processed credential and its digest map lack a mandatory portrait.

Check mandatory elements after null omission. Keep null omission for optional elements. Apply the check to rendered templates, including Velocity-generated element lists.

Example check after namespace processing

if (PhotoIdDataElements.DOC_TYPE.equals(docType)) {
    List<?> elements = (List<?>) nameSpaces.getOrDefault(
            PhotoIdDataElements.NAMESPACE, List.of());
    Set<String> identifiers = new HashSet<>();
    for (Object element : elements) {
        identifiers.add((String) ((Map<?, ?>) element)
                .get(Constants.ELEMENT_IDENTIFIER));
    }
    List<String> missing = PhotoIdDataElements.missingMandatory(identifiers);
    if (!missing.isEmpty()) {
        throw new CertifyException(
                ErrorConstants.PHOTO_ID_MANDATORY_FIELDS_MISSING,
                "Missing Photo ID elements: " + String.join(", ", missing));
    }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayuradesh need your call on CodeRabbit's comment (mandatory element with a null value):

  • This PR leaves out an element whose value is null (every mdoc, mDL included). So a template with "portrait": null passes Add/Update (only identifiers are checked) and issues a document without its portrait. Before this PR the mDL rejected a null portrait at issuance.
  • CodeRabbit suggests checking mandatory elements at issuance, which is the check you asked me to remove in #1178 (point 1).

Options:

  1. Add/Update only (my preference): a mandatory element whose template value is literally null counts as missing (mdl_mandatory_fields_missing / photo_id_mandatory_fields_missing). A null that only appears after Velocity renders is still left out.
  2. Issuance check as CodeRabbit suggests, for both the mDL and the Photo ID.
  3. No change: a null mandatory element is left out, as now.

Which one should we go with?

Signed-off-by: bernardlamptey42 <bernardlamptey42@yahoo.com>
Signed-off-by: bernardlamptey42 <bernardlamptey42@yahoo.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI; Enforced overrides: Organization
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: b039f020-5117-416c-9f1a-83bf344d59e5
Commits

Reviewing files that changed from the base of the PR and between e876f14 and ff2d6a1.

Files selected for processing: 6

  • certify-service/src/main/java/io/mosip/certify/utils/MDocProcessor.java
  • certify-service/src/test/java/io/mosip/certify/utils/MDocProcessorTest.java
  • docs/README.md
  • docs/postman_collections/authorization_code_flow/data_provider_plugin/inji-certify-with-mock-photoid-vci.postman_collection.json
  • docs/technical_docs/Credential_Issuer_Configuration.md
  • docs/technical_docs/Releases.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment on lines +202 to +203
"pm.environment.set(\"privateKey_jwk\", JSON.stringify(privateKey_jwk));",
"pm.environment.set(\"publicKey_jwk\", JSON.stringify(publicKey_jwk));"

@coderabbitai coderabbitai Bot Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Stability & Availability · Heavy lift

Do not replace the active client key before registration succeeds.

If the request fails to connect, eSignet still has the old public key. Postman has no response to run the rollback script, so Get Tokens V2 signs with the new, unregistered private key. Stage the candidate pair separately and use its public key in the registration body. Promote the pair only after an ACTIVE response for the requested client. Keep the candidate available for recovery if the server outcome is unknown. (learning.postman.com)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai Valid gap, but not specific to this collection: the "Create OIDC client" script is shared with the mock-identity, DPoP and mDL collections. The rollback added in #1037 restores the previous key after an error response, but not when no response arrives (the test script never runs).

Fixing it in one collection would leave the others inconsistent, so I'll stage the new key and promote it only after an ACTIVE response in all four collections as part of #1174 (PR #1202), which already updates them.

@mayuradesh flagging this so the fix lands with #1174 rather than here. Let me know if you'd prefer it in this PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bernard42 Addressing this across all four collections in #1202 makes sense.

Please also check the case where the server registers the candidate key but the response is lost. The candidate key must remain available for recovery. I’m not marking the finding as addressed until the fix is verified.

You are interacting with an AI system.

Comment thread docs/technical_docs/Releases.md Resolved
Signed-off-by: bernardlamptey42 <bernardlamptey42@yahoo.com>
@bernard42

bernard42 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor
Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@bernard42

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI; Enforced overrides: Organization
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: cda22a91-ec1d-4800-b4e1-e51406759ab5
Commits

Reviewing files that changed from the base of the PR and between 5914868 and 24c7401.

Files ignored due to path filters: 1

  • docker-compose/docker-compose-injistack/config/photo_id_data.csv is excluded by !**/*.csv
Files selected for processing: 21

  • README.md
  • certify-core/src/main/java/io/mosip/certify/core/constants/ErrorConstants.java
  • certify-service/src/main/java/io/mosip/certify/services/CredentialConfigurationServiceImpl.java
  • certify-service/src/main/java/io/mosip/certify/utils/MDocProcessor.java
  • certify-service/src/main/java/io/mosip/certify/utils/PhotoIdDataElements.java
  • certify-service/src/main/java/io/mosip/certify/validators/credentialconfigvalidators/MsoMdocCredentialConfigValidator.java
  • certify-service/src/main/resources/application-local.properties
  • certify-service/src/test/java/io/mosip/certify/credential/MDocCredentialPhotoIdTest.java
  • certify-service/src/test/java/io/mosip/certify/services/CredentialConfigMetadataAttributesTest.java
  • certify-service/src/test/java/io/mosip/certify/utils/MDocProcessorTest.java
  • certify-service/src/test/java/io/mosip/certify/validators/credentialconfigvalidators/MsoMdocCredentialConfigValidatorTest.java
  • docker-compose/docker-compose-injistack/README.md
  • docker-compose/docker-compose-injistack/certify_init.sql
  • docker-compose/docker-compose-injistack/config/certify-mock-photoid.properties
  • docker-compose/docker-compose-injistack/docker-compose.yaml
  • docs/README.md
  • docs/postman_collections/authorization_code_flow/data_provider_plugin/inji-certify-with-mock-photoid-vci.postman_collection.json
  • docs/stoplight_docs/inji-certify-openapi.yaml
  • docs/technical_docs/Credential_Issuer_Configuration.md
  • docs/technical_docs/Local_Development.md
  • docs/technical_docs/Releases.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Signed-off-by: bernardlamptey42 <bernardlamptey42@yahoo.com>
@bernard42
bernard42 marked this pull request as draft November 25, 2026 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant