support td1 - #37
Open
ilya-korotya wants to merge 12 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for TD1 (ID card) format to the existing passport verification system, which previously only supported TD3 (passport) format. The implementation includes utilities for building TD1 MRZ data, circuit inputs generation, and comprehensive test coverage.
- Introduces TD1 document format support alongside existing TD3 passport format
- Refactors existing code to share common functionality between TD1 and TD3
- Implements new circuits and test suites for ID card verification
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
utils/passports/utils.ts |
New utility file with shared functions for TD1/TD3 MRZ building, signature generation, and document payload creation |
utils/passports/genMockIdCardData.ts |
New function to generate mock ID card data for testing TD1 format |
utils/passports/genMockPassportData.ts |
Refactored to use shared utilities from utils.ts, reducing code duplication |
utils/passports/format.ts |
Added formatMrzTD1 function for TD1 format (90 chars) alongside existing formatMrzTD3 (88 chars) |
utils/passports/passport_parsing/parsePassportData.ts |
Updated to handle both TD1 and TD3 formats with automatic detection based on MRZ length |
utils/circuits/generateInputs.ts |
Added generateCircuitInputsIdCard function for TD1 circuit input generation |
utils/hash.ts |
Improved error handling by throwing errors instead of falling back to defaults |
circuits/idcard/idcard.circom |
New main ID card circuit implementing DG1FieldParser template for TD1 format |
circuits/idcard/constants.circom |
New constants file defining TD1 field positions and sizes |
circuits/idcard/instances/*.circom |
Circuit instances for different hash algorithms (sha1, sha224, sha256, sha384, sha512) |
tests/idcard/idcard.test.ts |
Comprehensive test suite covering valid ID cards, expiration, and constraint validation |
tests/idcard/test_cases.ts |
Test configuration for hash algorithms |
package.json & yarn.lock |
Added @types/elliptic dependency for TypeScript type definitions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
daveroga
requested changes
Dec 16, 2025
daveroga
left a comment
Contributor
There was a problem hiding this comment.
yarn installdoesn't work and produce errors. UpdateREADMEreplacingyarn installwithpnpm install- Remove then
yarn.lockand includepnpm-lock.yaml. - Maybe you need also to include build scripts for
idcardcircuits in this PR? - Maybe you need also to include integration scripts for
idcardin this PR?
daveroga
approved these changes
Dec 16, 2025
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.
No description provided.