Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
run: |
chmod +x circuits/scripts/build/build_cpp.sh && \
./circuits/scripts/build/build_cpp.sh register &&
./circuits/scripts/build/build_cpp.sh register_id &&
./circuits/scripts/build/build_cpp.sh disclose &&
./circuits/scripts/build/build_cpp.sh dsc

Expand Down
5 changes: 5 additions & 0 deletions app/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export function extractMRZInfo(mrzString: string) {

// Function to format date from 'YYYY-MM-DD 00:00:00 +0000' to 'YYMMDD'
export function formatDateToYYMMDD(inputDate: string) {
// Validate input string length to prevent substring errors
if (!inputDate || inputDate.length < 10) {
Copy link
Contributor

Choose a reason for hiding this comment

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

couldnt it be equal to 10 too?

throw new Error('Invalid date format: input string must be at least 10 characters long');
}

// Extract the date components directly from the input string
const year = inputDate.substring(2, 4); // Get YY part
const month = inputDate.substring(5, 7); // Get MM part
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register.circom";

component main { public [ merkle_root ] } = REGISTER(256, 224, 44, 32, 7, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(160, 160, 27, 32, 7, 384, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(160, 160, 7, 64, 4, 384, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(160, 160, 3, 120, 35, 384, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(160, 256, 1, 120, 35, 384, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(224, 224, 30, 32, 7, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(256, 224, 44, 32, 7, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register.circom";

component main { public [ merkle_root ] } = REGISTER(256, 224, 44, 32, 7, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 21, 64, 4, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 37, 64, 6, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 8, 64, 4, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 23, 64, 6, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 13, 120, 35, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 43, 120, 35, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 4, 120, 35, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 19, 120, 35, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 46, 120, 35, 512, 128);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(384, 384, 22, 64, 6, 768, 256);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(384, 384, 38, 64, 8, 768, 256);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(384, 384, 9, 64, 6, 768, 256);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(384, 384, 45, 120, 35, 768, 256);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(512, 512, 10, 120, 35, 896, 256);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(512, 512, 29, 64, 8, 896, 256);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(512, 512, 41, 66, 8, 896, 256);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(512, 512, 15, 120, 35, 896, 256);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../register_id.circom";

component main { public [ merkle_root ] } = REGISTER_ID(512, 512, 42, 120, 35, 896, 256);
56 changes: 47 additions & 9 deletions circuits/scripts/build/build_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

# run from root
# first argument should register | dsc | disclose
if [[ $1 != "register" && $1 != "dsc" && $1 != "disclose" ]]; then
echo "first argument should be register | dsc | disclose"
if [[ $1 != "register" && $1 != "dsc" && $1 != "disclose" && $1 != "register_id" ]]; then
echo "first argument should be register | dsc | disclose | register_id"
exit 1
fi

REGISTER_CIRCUITS=(
# passport
"register_sha1_sha1_sha1_ecdsa_brainpoolP224r1:true"
"register_sha1_sha1_sha1_ecdsa_secp256r1:true"
"register_sha1_sha1_sha1_rsa_65537_4096:true"
"register_sha1_sha256_sha256_rsa_65537_4096:true"
"register_sha224_sha224_sha224_ecdsa_brainpoolP224r1:true"
"register_sha256_sha224_sha224_ecdsa_secp224r1:true"
"register_sha256_sha256_sha224_ecdsa_secp224r1:true"
"register_sha256_sha256_sha256_ecdsa_brainpoolP256r1:true"
"register_sha256_sha256_sha256_ecdsa_brainpoolP384r1:true"
"register_sha256_sha256_sha256_ecdsa_secp256r1:true"
Expand All @@ -35,8 +37,39 @@ REGISTER_CIRCUITS=(
"register_sha512_sha512_sha512_rsapss_65537_64_2048:true"
)

REGISTER_ID_CIRCUITS=(
# eu id
"register_id_sha1_sha1_sha1_ecdsa_brainpoolP224r1:true"
"register_id_sha1_sha1_sha1_ecdsa_secp256r1:true"
"register_id_sha1_sha1_sha1_rsa_65537_4096:true"
"register_id_sha1_sha256_sha256_rsa_65537_4096:true"
"register_id_sha224_sha224_sha224_ecdsa_brainpoolP224r1:true"
"register_id_sha256_sha224_sha224_ecdsa_secp224r1:true"
"register_id_sha256_sha256_sha224_ecdsa_secp224r1:true"
"register_id_sha256_sha256_sha256_ecdsa_brainpoolP256r1:true"
"register_id_sha256_sha256_sha256_ecdsa_brainpoolP384r1:true"
"register_id_sha256_sha256_sha256_ecdsa_secp256r1:true"
"register_id_sha256_sha256_sha256_ecdsa_secp384r1:true"
"register_id_sha256_sha256_sha256_rsa_3_4096:true"
"register_id_sha256_sha256_sha256_rsa_65537_4096:true"
"register_id_sha256_sha256_sha256_rsapss_3_32_2048:true"
"register_id_sha256_sha256_sha256_rsapss_65537_32_2048:true"
"register_id_sha256_sha256_sha256_rsapss_65537_32_3072:true"
"register_id_sha256_sha256_sha256_rsapss_65537_64_2048:true"
"register_id_sha384_sha384_sha384_ecdsa_brainpoolP384r1:true"
"register_id_sha384_sha384_sha384_ecdsa_brainpoolP512r1:true"
"register_id_sha384_sha384_sha384_ecdsa_secp384r1:true"
"register_id_sha384_sha384_sha384_rsapss_65537_48_2048:true"
"register_id_sha512_sha512_sha256_rsa_65537_4096:true"
"register_id_sha512_sha512_sha512_ecdsa_brainpoolP512r1:true"
"register_id_sha512_sha512_sha512_ecdsa_secp521r1:true"
"register_id_sha512_sha512_sha512_rsa_65537_4096:true"
"register_id_sha512_sha512_sha512_rsapss_65537_64_2048:true"
)

DISCLOSE_CIRCUITS=(
"vc_and_disclose:true"
"vc_and_disclose_id:true"
)

DSC_CIRCUITS=(
Expand Down Expand Up @@ -66,6 +99,11 @@ if [[ $1 == "register" ]]; then
output="output/register"
mkdir -p $output
basepath="./circuits/circuits/register/instances"
elif [[ $1 == "register_id" ]]; then
allowed_circuits=("${REGISTER_ID_CIRCUITS[@]}")
output="output/register"
mkdir -p $output
basepath="./circuits/circuits/register_id/instances"
elif [[ $1 == "dsc" ]]; then
allowed_circuits=("${DSC_CIRCUITS[@]}")
output="output/dsc"
Expand All @@ -78,7 +116,7 @@ elif [[ $1 == "disclose" ]]; then
basepath="./circuits/circuits/disclose"
fi

pids=()
pids=()
for item in "${allowed_circuits[@]}"; do
filename=$(echo "$item" | cut -d':' -f1)
allowed=$(echo "$item" | cut -d':' -f2)
Expand All @@ -89,7 +127,7 @@ for item in "${allowed_circuits[@]}"; do
fi

while [[ ${#pids[@]} -ge 5 ]]; do
new_pids=()
new_pids=()
for pid in "${pids[@]}"; do
if kill -0 "$pid" 2>/dev/null; then
new_pids+=("$pid")
Expand All @@ -107,13 +145,13 @@ for item in "${allowed_circuits[@]}"; do
circuit_name="${filename%.*}"
(
circom $filepath \
-l "circuits/node_modules" \
-l "circuits/node_modules/@zk-kit/binary-merkle-root.circom/src" \
-l "circuits/node_modules/circomlib/circuits" \
-l "node_modules" \
-l "node_modules/@zk-kit/binary-merkle-root.circom/src" \
-l "node_modules/circomlib/circuits" \
--O1 -c --output $output && \
cd $output/${circuit_name}_cpp && \
make
) &
make
) &
pids+=($!)
done

Expand Down
Loading