From 96eeec4b959ebedfb9b467f08f10c99f623c0642 Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Tue, 22 Jul 2025 11:42:03 -0700 Subject: [PATCH 01/13] Refactor setup scripts --- .github/workflows/CI.yml | 3 +- .gitignore | 25 +- Cargo.toml | 28 + build_all.sh | 134 +++- circuit_setup/.gitignore | 7 +- circuit_setup/README.md | 17 +- circuit_setup/scripts/gen_mdl_device_key.sh | 12 +- circuit_setup/scripts/gen_x509_cert_chain.sh | 7 +- circuit_setup/scripts/jwk_gen.py | 13 +- circuit_setup/scripts/jwt_sign.py | 64 +- circuit_setup/scripts/prepare_mdl_setup.py | 3 +- circuit_setup/scripts/prepare_setup.py | 4 +- circuit_setup/scripts/run_setup.sh | 685 ++++++++++++------- clean_all.sh | 28 +- creds/.gitignore | 2 + creds/Cargo.toml | 10 +- creds/src/structs.rs | 2 + ecdsa-pop/neptune/Cargo.toml | 63 +- forks/circom-compat/Cargo.toml | 2 +- sample/.gitignore | 8 + sample/Cargo.toml | 16 + sample/clean-sample.sh | 39 +- sample/client/package-lock.json | 520 ++++++++------ sample/client/package.json | 7 +- sample/client/setup_client.sh | 21 +- sample/client_helper/Cargo.toml | 4 - sample/client_helper/setup_client_helper.sh | 49 +- sample/issuer/setup_issuer.sh | 22 +- sample/setup-sample.sh | 49 +- sample/verifier/Cargo.toml | 4 - sample/verifier/setup_verifier.sh | 20 +- 31 files changed, 1150 insertions(+), 718 deletions(-) create mode 100644 Cargo.toml create mode 100644 creds/.gitignore create mode 100644 sample/.gitignore create mode 100644 sample/Cargo.toml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 52c4274c..22e18d59 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -39,7 +39,7 @@ jobs: sudo apt install -y python3-pip nodejs curl --proto '=https' --tlsv1.3 -sSf https://sh.rustup.rs | sh -s -- -y source $HOME/.cargo/env - pip install python_jwt + pip install jwcrypto cbor2 git clone https://github.com/iden3/circom.git cd circom git checkout v2.1.6 @@ -48,7 +48,6 @@ jobs: export PATH=$PATH:~/.cargo/bin cd .. git submodule update --init --recursive - pip install git+https://github.com/peppelinux/pyMDOC-CBOR.git - name: Run circuit setup for rs256 run: | diff --git a/.gitignore b/.gitignore index 92672179..64bcc894 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,12 @@ .vscode/ target/ Cargo.lock +bin/ -# ignore test vectors, but not the README -creds/test-vectors -!creds/test-vectors/README +# sample output folder created by docker build +crescent-extension - -circuit_setup/circuits-mdl/circomlib -circuit_setup/inputs/*/** -!circuit_setup/inputs/*/*.json - -# sample files -sample/issuer/.well-known/ -sample/issuer/keys/ -sample/client/node_modules -sample/client/mdl.json -sample/client/dist -sample/client_helper/data -sample/verifier/data - -crescent-extension \ No newline at end of file +# There are additional sub-project .gitignore files: +# creds/.gitignore +# circuit_setup/.gitignore +# sample/.gitignore diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..97a89aea --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,28 @@ +[workspace] +resolver = "2" + +members = [ + "creds", + "sample/client_helper", + "sample/issuer", + "sample/verifier", + "sample/setup_service", + "circuit_setup/mdl-tools" +] + +# project profiles go here and not in child Cargo.toml files + +[profile.dev.package."crescent-sample-client-helper"] + +[profile.dev.package."crescent-sample-issuer"] + +[profile.dev.package."crescent-sample-verifier"] + +[profile.dev.package.crescent] + +[profile.dev.package.wasmer-vm] +opt-level = 3 +debug-assertions = false # We need this to work around a bug in Wasmer + +[profile.dev] +opt-level = 3 diff --git a/build_all.sh b/build_all.sh index 8bb1c5dc..85b5a6e2 100755 --- a/build_all.sh +++ b/build_all.sh @@ -1,50 +1,122 @@ -#!/bin/bash +#!/usr/bin/bash +# +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# + +set -e +shopt -s extglob + +cd "$(dirname "${BASH_SOURCE[0]}")" +readonly CRESCENT_ENV=${CRESCENT_ENV:-release} +[[ "$CRESCENT_ENV" =~ ^(release|debug)$ ]] || { echo "Invalid CRESCENT_ENV: $CRESCENT_ENV" >&2; exit 1; } +RELEASE_FLAG=$([[ "$CRESCENT_ENV" == "debug" ]] && echo "" || echo "--release") +BIN=$(pwd)/target/${CRESCENT_ENV} + + +# Check for required shell commands +check_prereqs() { + for cmd in "$@"; do + if ! command -v "$cmd" &> /dev/null; then + echo -e "\033[0;31m❌ Error: '$cmd' is required but not installed or not in PATH.\033[0m" >&2 + missing=true + fi + done +} + +# Check for required Python packages +check_pip_pkgs() { + for pkg in "$@"; do + if ! python -c "import $pkg" &>/dev/null; then + echo -e "\033[0;31m❌ Error: Python package '$pkg' is not installed.\033[0m" >&2 + missing=true + fi + done +} + +echo "🔍 Checking prerequisites..." +check_prereqs node npm python circom rustc cargo ssh +check_pip_pkgs jwcrypto cbor2 + + +# halt if any prerequisites are missing +if [ "${missing:-false}" = true ]; then + echo -e "\033[0;31m❌ Some prerequisites are missing. See circuit_setup\README.md for help with dependencies.\033[0m" >&2 + exit 1 +fi + +SECONDS=0 + +# Check for "trim" argument to have script clean extraneous artifacts +do_trim=false; for arg in "$@"; do [[ "$arg" == "trim" ]] && do_trim=true && break; done -RELEASE_FLAG="--release" git submodule update --init --recursive -# + +# Build everything from the sub-projects top level workspace at once +cargo build $RELEASE_FLAG --features print-trace + + # Circuit setup -# -cd circuit_setup/scripts -./run_setup.sh rs256 -./run_setup.sh rs256-sd -./run_setup.sh rs256-db -./run_setup.sh mdl1 +# Generates circom circuits and artifacts in circuit_setup/generated_files/ +# Final output is copied to creds/test-vectors/[mdl1, rs256, rs256-sd, rs256-db] +# The setup scripts are run in parallel for each circuit type to take advantage of multiple CPU cores +# as circuit generation is CPU intensive but single-threaded. +pushd circuit_setup/scripts > /dev/null +./run_setup.sh mdl1 & +./run_setup.sh rs256 & +./run_setup.sh rs256-sd & +./run_setup.sh rs256-db & +wait +popd > /dev/null -cd ../../creds +# Ensure the output directories exist +pushd creds > /dev/null for d in test-vectors/rs256 test-vectors/rs256-sd test-vectors/rs256-db test-vectors/mdl1; do if [ ! -d "$d" ]; then - echo "❌ Error: Missing directory creds/'$d'" >&2 + echo "❌ Error: Missing directory creds/$d" >&2 exit 1 fi done -cargo run --bin crescent $RELEASE_FLAG --features print-trace zksetup --name rs256 -cargo run --bin crescent $RELEASE_FLAG --features print-trace prove --name rs256 -cargo run --bin crescent $RELEASE_FLAG --features print-trace show --name rs256 -cargo run --bin crescent $RELEASE_FLAG --features print-trace verify --name rs256 +if [ "$do_trim" = true ]; then + echo "Cleaning up intermediate artifacts..." + rm -rf ../circuit_setup/generated_files/!(README.md) +fi + -cargo run --bin crescent $RELEASE_FLAG --features print-trace zksetup --name rs256-sd -cargo run --bin crescent $RELEASE_FLAG --features print-trace prove --name rs256-sd -cargo run --bin crescent $RELEASE_FLAG --features print-trace show --name rs256-sd -cargo run --bin crescent $RELEASE_FLAG --features print-trace verify --name rs256-sd +crescent="${BIN}/crescent-cli" -cargo run --bin crescent $RELEASE_FLAG --features print-trace zksetup --name rs256-db -cargo run --bin crescent $RELEASE_FLAG --features print-trace prove --name rs256-db -cargo run --bin crescent $RELEASE_FLAG --features print-trace show --name rs256-db -cargo run --bin crescent $RELEASE_FLAG --features print-trace verify --name rs256-db +if [ "$do_trim" = true ]; then + echo "Cleaning up build artifacts..." + cargo clean +fi -cargo run --bin crescent $RELEASE_FLAG --features print-trace zksetup --name mdl1 -cargo run --bin crescent $RELEASE_FLAG --features print-trace prove --name mdl1 -cargo run --bin crescent $RELEASE_FLAG --features print-trace show --name mdl1 -cargo run --bin crescent $RELEASE_FLAG --features print-trace verify --name mdl1 -cd .. +declare -A LABEL_COLORS=( + [rs256]=$'\033[0;35m' + [rs256-sd]=$'\033[0;36m' + [rs256-db]=$'\033[1;33m' + [mdl1]=$'\033[1;34m' +) + +RESET=$'\033[0m' + +for name in "${!LABEL_COLORS[@]}"; do + color="${LABEL_COLORS[$name]}" + { + $crescent zksetup --name "$name" + $crescent prove --name "$name" + $crescent show --name "$name" + $crescent verify --name "$name" + } 2>&1 | sed "s/^/\\${color}[${name}]\\${RESET} /" & +done + +wait # # Sample setup # -cd sample -# Node must be available for the .js scripts to be executed - ./setup-sample.sh +../sample/setup-sample.sh + +echo -e "\033[0;32mBuild-all completed in $SECONDS seconds\033[0m" diff --git a/circuit_setup/.gitignore b/circuit_setup/.gitignore index e92e2577..60b63692 100644 --- a/circuit_setup/.gitignore +++ b/circuit_setup/.gitignore @@ -1,4 +1,7 @@ -generated_files/* +generated_files/*/** !generated_files/README.md -logs + +inputs/*/** +!inputs/*/*.json + scripts/__pycache__/* diff --git a/circuit_setup/README.md b/circuit_setup/README.md index 2d7bd929..e8b12e89 100644 --- a/circuit_setup/README.md +++ b/circuit_setup/README.md @@ -30,7 +30,7 @@ curl --proto '=https' --tlsv1.3 -sSf https://sh.rustup.rs | sh 3. Install required Python modules ```bash -pip install python_jwt +pip install jwcrypto cbor2 ``` 4. Install [Circom](https://github.com/iden3/circom) @@ -53,21 +53,6 @@ Either clone this repo with the option `--recurse-submodules`, or for existing r git submodule update --init --recursive ``` -6. For mDL credentials, the [pyMDOC-CBOR](https://github.com/IdentityPython/pyMDOC-CBOR) Python module must be installed, with the command - -```bash -# Linux -pip install git+https://github.com/peppelinux/pyMDOC-CBOR.git -``` - -```bash -# Windows -# pyMDL-MDOC has a bug in the setup we need to fix for proper installation on Windows -git clone https://github.com/peppelinux/pyMDL-MDOC.git -cd pyMDL-MDOC -sed -i "s|i.replace(f'{_pkg_name}/', '')|i.replace(f'{_pkg_name}\\\\\\\\', '')|g" setup.py -pip install . -``` ## Sample JWT and mDL To work with Crescent, the prover and verifier both need the issuer's public key, and the prover needs a JWT. diff --git a/circuit_setup/scripts/gen_mdl_device_key.sh b/circuit_setup/scripts/gen_mdl_device_key.sh index 657483b6..d39964fb 100755 --- a/circuit_setup/scripts/gen_mdl_device_key.sh +++ b/circuit_setup/scripts/gen_mdl_device_key.sh @@ -1,7 +1,11 @@ +#!/usr/bin/bash +# # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. +# -#!/usr/bin/bash +# Change to the directory where the script is located +cd "$(dirname "${BASH_SOURCE[0]}")" || exit PRIVATE_KEY=../inputs/mdl1/device.prv PUBLIC_KEY=../inputs/mdl1/device.pub @@ -9,9 +13,9 @@ PUBLIC_KEY=../inputs/mdl1/device.pub echo "Generating mDL device key pair" # Generate the private key (PEM format) -openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:prime256v1 -pkeyopt ec_param_enc:named_curve -out ${PRIVATE_KEY} +openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:prime256v1 -pkeyopt ec_param_enc:named_curve -out "${PRIVATE_KEY}" echo "Generated private key: ${PRIVATE_KEY}" # Extract the public key (PEM format) -openssl ec -in ${PRIVATE_KEY} -pubout -out ${PUBLIC_KEY} -echo "Generated public key: ${PUBLIC_KEY}" \ No newline at end of file +openssl ec -in "${PRIVATE_KEY}" -pubout -out "${PUBLIC_KEY}" +echo "Generated public key: ${PUBLIC_KEY}" diff --git a/circuit_setup/scripts/gen_x509_cert_chain.sh b/circuit_setup/scripts/gen_x509_cert_chain.sh index bf010c2b..4af7934f 100755 --- a/circuit_setup/scripts/gen_x509_cert_chain.sh +++ b/circuit_setup/scripts/gen_x509_cert_chain.sh @@ -1,7 +1,9 @@ +#!/usr/bin/bash +# # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. +# -#!/bin/bash # This script generates 3-cert ECDSA chains (root -> CA -> issuer). # The leaf cert uses P-256 and is valid for 1 year, the CA and root CA use # the increasingly stronger P-384 and P-521, and are valid for @@ -10,6 +12,9 @@ # prevent gitbash from auto-converting paths to windows syntax export MSYS_NO_PATHCONV=1 +# Change to the directory where the script is located +cd "$(dirname "${BASH_SOURCE[0]}")" || exit + # directory where intermediate files are kept tmpdir=../generated_files/mdl1 # force relative paths that will work with openssl on both linux and windows. diff --git a/circuit_setup/scripts/jwk_gen.py b/circuit_setup/scripts/jwk_gen.py index ed109e36..ee77a626 100755 --- a/circuit_setup/scripts/jwk_gen.py +++ b/circuit_setup/scripts/jwk_gen.py @@ -1,11 +1,12 @@ +#!/usr/bin/python3 +# # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. +# -#!/usr/bin/python3 - -# Depends on python-jwt: -# pip install python_jwt -# https://pypi.org/project/python-jwt/ +# Depends on jwcrypto: +# pip install jwcrypto +# https://pypi.org/project/jwcrypto/ # The registry of supported algorithms in JWS is found here: # https://www.iana.org/assignments/jose/jose.xhtml @@ -22,7 +23,7 @@ # Inspect public RSA key with # openssl rsa -inform PEM -text -noout -in test.pub -pubin -import python_jwt as jwt, jwcrypto.jwk as jwk, datetime +import jwcrypto.jwk as jwk, datetime import sys, os def usage(): diff --git a/circuit_setup/scripts/jwt_sign.py b/circuit_setup/scripts/jwt_sign.py index afff29a0..b1f59d22 100755 --- a/circuit_setup/scripts/jwt_sign.py +++ b/circuit_setup/scripts/jwt_sign.py @@ -1,30 +1,25 @@ +#!/usr/bin/python3 +# # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. - -#!/usr/bin/python3 - -# pip install python_jwt -# https://pypi.org/project/python-jwt/ - +# # The registry of supported algorithms in JWS is found here: # https://www.iana.org/assignments/jose/jose.xhtml # JWT: https://www.rfc-editor.org/rfc/rfc7519 # JWS: https://www.rfc-editor.org/rfc/rfc7515 -# python JWT docs: https://jwcrypto.readthedocs.io -# python JWT Source: https://github.com/latchset/jwcrypto -import python_jwt as jwt, jwcrypto.jwk as jwk -from jwcrypto.common import base64url_decode, base64url_encode -from jwcrypto.jws import JWS -import sys, os, json, datetime +import sys, os, json, datetime, time +from jwcrypto import jwt, jwk +from jwcrypto.common import base64url_decode +import time def usage(): print("Python3 script to create a JWT") print("Usage:") - print("\t./" + os.path.basename(sys.argv[0]) + " ") + print(f"\t{os.path.basename(sys.argv[0])} ") print("Example:") - print("\tpython3 " + os.path.basename(sys.argv[0]) + "claims.json issuer.prv token.jwt") + print(f"\tpython3 {os.path.basename(sys.argv[0])} claims.json issuer.prv token.jwt") print("will sign the json in claims.json with the issuer private key in issuer.prv and output the JWT in token.jwt") print("If a device public key is provided, it will be added to the claims.") @@ -57,7 +52,7 @@ def usage(): else: raise ValueError("Unsupported key type") -print("Using signature algorithm {} for new token\n".format(new_alg)) +print(f"Using signature algorithm {new_alg} for new token\n") # load the claims from a file with open(sys.argv[1], 'r') as file: @@ -66,12 +61,12 @@ def usage(): # If a device public key was provided, add it to the claims, in the format expected by # Crescent. This is currently a custom format, but ideally would be a 'cnf' claim # https://datatracker.ietf.org/doc/html/rfc7800#section-3.2 -if sys.argv[4] is not None: +if len(sys.argv) > 4 and sys.argv[4] is not None: print("Adding device public key to claims") with open(sys.argv[4], "rb") as f: device_key_bytes = f.read() - device_key = jwk.JWK.from_pem(device_key_bytes, password=None) + device_key = jwk.JWK.from_pem(device_key_bytes, password=None) if device_key.get('kty') != "EC" or device_key.get('crv') != "P-256": print("device_key kty: {}".format(device_key.get('kty'))) print("device_key crv: {}".format(device_key.get('crv'))) @@ -86,27 +81,32 @@ def usage(): claims['device_key_0'] = device_key_0 claims['device_key_1'] = device_key_1 +# Add expiration (1 year from now) +now = datetime.datetime.now(datetime.UTC) +claims['iat'] = int(now.timestamp()) +claims['exp'] = int((now + datetime.timedelta(weeks=52)).timestamp()) +claims['nbf'] = int(now.timestamp()) + # Create the new token with the claims, and one year lifetime short_kid = issuer_key.get('kid') -new_jwt = jwt.generate_jwt(claims, issuer_key, new_alg, datetime.timedelta(weeks=52), other_headers={'kid': short_kid}) +jwt_token = jwt.JWT(header={"alg": new_alg, "kid": short_kid, "typ": "JWT"}, claims=claims) +jwt_token.make_signed_token(issuer_key) +new_jwt = jwt_token.serialize() -#print("New JWT: " + new_jwt) -new_token_header, new_token_claims = jwt.process_jwt(new_jwt) -#print("new header:") -#print(str(new_token_header)) print("Verifying... ", end="") try: - jwt.verify_jwt(new_jwt, issuer_key.public(), allowed_algs=['RS256', 'ES256', 'ES256K']) - print(" success") -except jwt._JWTError as e: - if str(e) == 'expired': + verified_token = jwt.JWT(jwt=new_jwt, key=issuer_key.public(), algs=['RS256', 'ES256', 'ES256K']) + verified_token.validate(issuer_key.public()) + claims = json.loads(verified_token.claims) + if int(time.time()) >= claims.get('exp'): print("Token signature is valid, but token is expired") - else: - print("WARNING: Token is invalid, caught JWTError: " + str(e)) - # We don't fail here since some reasons for verify_jwt to fail don't apply to W3C VCs, - # E.g., failing because the "nbf" claim is not present + + print(" success") +except Exception as e: + print("WARNING: Token is invalid, caught error: " + str(e)) with open(sys.argv[3], "w") as f: - token = f.write(new_jwt) -print("New token written to {}".format(sys.argv[3])) + f.write(new_jwt) + +print(f"New token written to {sys.argv[3]}") diff --git a/circuit_setup/scripts/prepare_mdl_setup.py b/circuit_setup/scripts/prepare_mdl_setup.py index c8d2fc9d..e51d2916 100644 --- a/circuit_setup/scripts/prepare_mdl_setup.py +++ b/circuit_setup/scripts/prepare_mdl_setup.py @@ -12,9 +12,10 @@ def usage(): print(f"Usage: ./{exe} ") def circom_header(cfg): + script_dir = os.path.dirname(os.path.abspath(__file__)) if cfg.get("alg") != "ES256": print("Unsupported alg:", cfg.get("alg")); sys.exit(-1) - with open("circuits-mdl/main_header_es256.circom.template") as f: + with open(os.path.join(script_dir, "../circuits-mdl/main_header_es256.circom.template")) as f: return f.read() def get_cbor_encoded_name_identifier(name: str): diff --git a/circuit_setup/scripts/prepare_setup.py b/circuit_setup/scripts/prepare_setup.py index aeb2659d..99bd5d83 100755 --- a/circuit_setup/scripts/prepare_setup.py +++ b/circuit_setup/scripts/prepare_setup.py @@ -16,10 +16,10 @@ def usage(): print("\t./" + os.path.basename(sys.argv[0]) + " ") def main_circom_header(config): - + script_dir = os.path.dirname(os.path.abspath(__file__)) template_filename = '' if config['alg'] == 'RS256': - template_filename = "circuits/main_header_rs256.circom.template" + template_filename = os.path.join(script_dir, "../circuits/main_header_rs256.circom.template") # TODO: add support for ES256K # elif config['alg'] == 'ES256K': # template_filename = "circuits/main_header_es256k.circom.template" diff --git a/circuit_setup/scripts/run_setup.sh b/circuit_setup/scripts/run_setup.sh index 425279ab..5bfe3d9e 100755 --- a/circuit_setup/scripts/run_setup.sh +++ b/circuit_setup/scripts/run_setup.sh @@ -1,248 +1,467 @@ +#!/usr/bin/bash +# # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. +# + +set -eEx -o pipefail -o errtrace +shopt -s extglob globstar nullglob + + +readonly CURVE=bn128 + +trap 'error "Unexpected error at line $LINENO in command: $BASH_COMMAND" "$?"' ERR + + +main() { + usage "$@" + setup + generate_keys + compile_circuit + generate_mdl + copy_artifacts + prune +} + +############################################################################### +# Process command line arguments +# Display usage information if arguments are missing or invalid +############################################################################### +usage() { + readonly SCRIPT_NAME="${0##*/}" + readonly NAME=$1 + readonly PRUNE=$([[ "$2" == "--prune" ]] && echo true || echo "") + + readonly CRESCENT_ENV=${CRESCENT_ENV:-release} + [[ "$CRESCENT_ENV" =~ ^(release|debug)$ ]] || { echo "Invalid CRESCENT_ENV: $CRESCENT_ENV" >&2; exit 1; } + RELEASE_FLAG=$([[ "$CRESCENT_ENV" == "debug" ]] && echo "" || echo "--release") + BIN=$(pwd)/target/${CRESCENT_ENV} + + if [[ -z "$NAME" || "$NAME" == "--prune" ]]; then + echo + echo -e "Usage: $SCRIPT_NAME [--prune]" + echo + echo " Required. Name of the subdirectory under 'inputs/'." + echo + echo " --prune Optional. Cleans up intermediate artifacts after building." + echo + echo " The subsequent run will take longer as it will recompile the circuit." + echo + echo "Example:" + echo " $0 rs256 --prune" + echo + echo "Available inputs:" + for dir in "../inputs"/*/; do + echo " - $(basename "$dir")" + done + exit 2 + fi +} + + +############################################################################### +# Set up the environment and paths +# Read the config.json file +# Create the output directory and log file +# Copy circom files to the instance's circom folder +############################################################################### +setup() { + # Ensure this script runs from its own directory. + # All paths are relative to this directory so this script can be run from anywhere. + cd "$(dirname "${BASH_SOURCE[0]}")" + + readonly SCRIPTS_DIR=$(pwd) + readonly CIRCUIT_SETUP=$(realpath "$SCRIPTS_DIR"/..) + readonly ROOT_DIR=$(realpath "$CIRCUIT_SETUP"/..) + readonly OUTPUTS_DIR=${CIRCUIT_SETUP}/generated_files/$NAME + readonly INPUTS_DIR=${CIRCUIT_SETUP}/inputs/$NAME + readonly COPY_DEST=$(realpath "${CIRCUIT_SETUP}/../creds/test-vectors/$NAME") + readonly CIRCOM_DIR=${OUTPUTS_DIR}/circom + readonly LOG_FILE=${OUTPUTS_DIR}/${NAME}.log + readonly CONFIG_FILE=${INPUTS_DIR}/config.json + readonly BIN=${ROOT_DIR}/target/${CRESCENT_ENV} + + assert_path "$CONFIG_FILE" "$INPUTS_DIR"/claims.json "$INPUTS_DIR"/proof_spec.json + + declare -g -A CONFIG + CONFIG[alg]=$(json_get "$CONFIG_FILE" alg) + CONFIG[credtype]=$(json_get "$CONFIG_FILE" credtype); : "${CONFIG[credtype]:=jwt}" + CONFIG[device_bound]=$([[ $(json_get "$CONFIG_FILE" device_bound) == "true" ]] && echo 1 || echo 0) + readonly -n CONFIG + + if [[ -z ${CONFIG[alg]} ]]; then + error "Algorithm (alg) not found in config.json." + fi -#!/usr/bin/bash + if [[ ${CONFIG[credtype]} == "mdl" ]]; then + fix_symlink "${CIRCUIT_SETUP}/circuits-mdl/circomlib" "${CIRCUIT_SETUP}/circuits/circomlib" + fi -set -e - -CURVE=bn128 - -# Argument NAME is the name of one of the subdirectories in inputs -NAME=$1 - -if [[ "$NAME" = "" ]] ; -then - echo "Usage: $0 " - echo "Must be run from scripts/" - echo "E.g.: $0 rs256" - exit -1 -fi - -# assume we're in scripts dir -cd .. -ROOT_DIR=`pwd` - -OUTPUTS_DIR=${ROOT_DIR}/generated_files/$NAME -CIRCOM_DIR=${OUTPUTS_DIR}/circom -INPUTS_DIR=${ROOT_DIR}/inputs/$NAME -COPY_DEST=${ROOT_DIR}/../creds/test-vectors/$NAME -LOG_FILE=${OUTPUTS_DIR}/${NAME}.log - -if [ ! -f ${INPUTS_DIR}/config.json ]; then - echo "${INPUTS_DIR}/config.json is not found, aborting" - exit -1 -fi - -# Determine the credential type, JWT or mDL -CREDTYPE_REGEX="\"credtype\": \"([a-z]+)\"" -if [[ `cat ${INPUTS_DIR}/config.json` =~ $CREDTYPE_REGEX ]]; then - CREDTYPE="${BASH_REMATCH[1]}" - echo "Credential type read from config.json: $CREDTYPE" -else - CREDTYPE="jwt" - echo "Credential type not found in config.json, assuming JWT" -fi - -if [ $CREDTYPE == 'mdl' ]; then - CIRCOM_SRC_DIR="${ROOT_DIR}/circuits-mdl" -else - CIRCOM_SRC_DIR="${ROOT_DIR}/circuits" -fi - -# Replace linux symlink with junction if on Windows -# There is a scenario where the symlink is broken on Windows, but then copied to the Ubuntu Docker container. -# In this case, we need to remove the broken symlink and create a new one. -if [ -f "${CIRCOM_SRC_DIR}/circomlib" ]; then - echo "Detected broken symlink at ${CIRCOM_SRC_DIR}/circomlib" - rm -f "${CIRCOM_SRC_DIR}/circomlib" - if [[ "$OS" == "Windows_NT" || "$(uname -o 2>/dev/null)" == "Msys" ]]; then - echo "Creating Windows junction..." - cmd //c "mklink /J $(cygpath -wa "$CIRCOM_SRC_DIR"/circomlib) $(cygpath -wa "${ROOT_DIR}/circuits/circomlib")" + blue "Name: $(printf "%-10s" "$NAME") | Credential type: ${CONFIG[credtype]} | Credential algorithm: ${CONFIG[alg]} | Device bound: ${CONFIG[device_bound]}" + + if [[ ${CONFIG[credtype]} == "mdl" ]]; then + readonly CIRCOM_SRC_DIR="${CIRCUIT_SETUP}/circuits-mdl" else - echo "Creating Linux symlink..." - ln -s "${ROOT_DIR}/circuits/circomlib" "${CIRCOM_SRC_DIR}/circomlib" -fi -fi + readonly CIRCOM_SRC_DIR="${CIRCUIT_SETUP}/circuits" + fi + if [ ! -f "${CIRCOM_SRC_DIR}/circomlib/package.json" ]; then + error "Circomlib not found. Run 'git submodule update --init --recursive' to get it." + fi + + mkdir -p "$OUTPUTS_DIR" "$CIRCOM_DIR" + : > "$LOG_FILE" + + cp -r -L "${CIRCOM_SRC_DIR}"/* "${CIRCOM_DIR}/" +} + +############################################################################### +# Create issuer keys, device keys, certs, and tokens +############################################################################### +generate_keys() { + pushd "$INPUTS_DIR" > /dev/null + + local jwt_files=(issuer.prv issuer.pub token.jwt claims.json ) + local jwt_db_files=("${jwt_files[@]}" device.prv device.pub) + local mdl_files=(issuer.prv issuer.pub device.prv device.pub issuer_certs.pem) + + if [[ ${CONFIG[credtype]} == "jwt" ]]; then + + local -r scripts_dir=$(relative_path "${SCRIPTS_DIR}") + + if [[ ${CONFIG[device_bound]} == 1 ]] && have_files_changed "${jwt_db_files[@]}"; then + echo "${NAME}: Creating issuer and device keys and JWT" + python3 "${scripts_dir}"/jwk_gen.py "${CONFIG[alg]}" issuer.prv issuer.pub + python3 "${scripts_dir}"/jwk_gen.py ES256 device.prv device.pub + python3 "${scripts_dir}"/jwt_sign.py claims.json issuer.prv token.jwt device.pub + checkpoint_files "${jwt_db_files[@]}" + + elif [[ ${CONFIG[device_bound]} == 0 ]] && have_files_changed "${jwt_files[@]}"; then + echo "${NAME}: Creating issuer keys and JWT" + python3 "${scripts_dir}"/jwk_gen.py "${CONFIG[alg]}" issuer.prv issuer.pub + python3 "${scripts_dir}"/jwt_sign.py claims.json issuer.prv token.jwt; + checkpoint_files "${jwt_files[@]}" + + else + green "${NAME}: Using existing keys and token" + fi + + elif [[ ${CONFIG[credtype]} == 'mdl' ]]; then + + if have_files_changed "${mdl_files[@]}"; then + echo "Creating sample issuer keys and mDL" + rm -f ./!(*.json) + echo "Creating sample device/issuer keys and mdl for algorithm ${CONFIG[alg]}" + "$SCRIPTS_DIR"/gen_mdl_device_key.sh + "$SCRIPTS_DIR"/gen_x509_cert_chain.sh + checkpoint_files "${mdl_files[@]}" + else + green "${NAME}: Using existing keys" + fi -# Determine if the credential should be device bound -DEVICE_BOUND_REGEX="\"device_bound\": ([a-z]+)" -if [[ `cat ${INPUTS_DIR}/config.json` =~ $DEVICE_BOUND_REGEX ]]; then - if [ "${BASH_REMATCH[1]}" = "true" ]; then - DEVICE_BOUND=1 - else - DEVICE_BOUND=0 - fi -else - DEVICE_BOUND=0 -fi -echo "Credential is device bound: $DEVICE_BOUND" - -# Create the output directory if not there. -mkdir $OUTPUTS_DIR 2>/dev/null || true -mkdir $CIRCOM_DIR 2>/dev/null || true - -# delete the LOG_FILE if it exists (otherwise we'll be parsing old data when setting up the files) -if [ -f ${LOG_FILE} ]; then - rm ${LOG_FILE} -fi -touch ${LOG_FILE} - -# For JWTs, we create sample issuer keys and a token -ALG_REGEX="\"alg\": \"([A-Z0-9]+)\"" -if [ ${CREDTYPE} == 'jwt' ] && ([ ! -f ${INPUTS_DIR}/issuer.pub ] || [ ! -f ${INPUTS_DIR}/issuer.prv ] || [ ! -f ${INPUTS_DIR}/token.jwt ]); then - rm ${INPUTS_DIR}/issuer.pub ${INPUTS_DIR}/issuer.prv ${INPUTS_DIR}/token.jwt 2>/dev/null && true - - if [[ `cat ${INPUTS_DIR}/config.json` =~ $ALG_REGEX ]]; then - ALG="${BASH_REMATCH[1]}" - echo "Creating sample keys and token for algorithm $ALG" - else - echo "Error: algorithm not found in config.json" - exit 1 - fi - python3 scripts/jwk_gen.py ${ALG} ${INPUTS_DIR}/issuer.prv ${INPUTS_DIR}/issuer.pub - if [ $DEVICE_BOUND ]; then - echo "Creating device public key" - python3 scripts/jwk_gen.py ES256 ${INPUTS_DIR}/device.prv ${INPUTS_DIR}/device.pub - python3 scripts/jwt_sign.py ${INPUTS_DIR}/claims.json ${INPUTS_DIR}/issuer.prv ${INPUTS_DIR}/token.jwt ${INPUTS_DIR}/device.pub - else - python3 scripts/jwt_sign.py ${INPUTS_DIR}/claims.json ${INPUTS_DIR}/issuer.prv ${INPUTS_DIR}/token.jwt fi -elif [ ${CREDTYPE} == 'mdl' ] && ([ ! -f ${INPUTS_DIR}/device.prv ] || [ ! -f ${INPUTS_DIR}/issuer.prv ] || [ ! -f ${INPUTS_DIR}/issuer.pub ] || [ ! -f ${INPUTS_DIR}/issuer_certs.pem ] || [ ! -f ${INPUTS_DIR}/mdl.cbor ]); then - echo "Creating sample issuer keys and mDL" - rm ${INPUTS_DIR}/device.prv ${INPUTS_DIR}/issuer.prv ${INPUTS_DIR}/issuer.pub ${INPUTS_DIR}/issuer_certs.pem ${INPUTS_DIR}/mdl.org ${OUTPUTS_DIR}/issuer.pub 2>/dev/null && true - if [[ `cat ${INPUTS_DIR}/config.json` =~ $ALG_REGEX ]]; then - ALG="${BASH_REMATCH[1]}" - echo "Creating sample device/issuer keys and mdl for algorithm $ALG" + popd > /dev/null +} + +############################################################################### +# Generate circom main r1cs file +# Extract the number of public inputs and outputs into io_locations.sym +############################################################################### +compile_circuit() { + local circuit_inputs=( + "${INPUTS_DIR}/config.json" + "${CIRCOM_SRC_DIR}/main_header_${CONFIG[alg],,}.circom.template" + ${CIRCOM_DIR}/{io_locations.sym,main.circom} + ) + # Collect all .circom files under ${CIRCOM_DIR} + while IFS= read -r -d '' file; do + circuit_inputs+=("$file") + done < <(find "${CIRCOM_DIR}" -type f -name '*.circom' -print0) + + if ! have_files_changed "${circuit_inputs[@]}"; then + green "${NAME}: Using existing circuits" + return 0 + fi + + green "${NAME}: Generating ${NAME}_main.circom... $(pwd)" + + local scripts=($(relative_path "${SCRIPTS_DIR}")) + if [ "${CONFIG[credtype]}" == 'mdl' ]; then + python3 "${scripts[0]}"/prepare_mdl_setup.py "${INPUTS_DIR}/config.json" "${CIRCOM_DIR}/main.circom" else - echo "Error: algorithm not found in config.json" - exit 1 - fi - cd ${ROOT_DIR}/scripts - ./gen_mdl_device_key.sh - ./gen_x509_cert_chain.sh - cd ${ROOT_DIR} -fi - -# Check that circomlib is present -if [ ! -f ${CIRCOM_SRC_DIR}/circomlib/README.md ]; then - echo "Circomlib not found. Run 'git submodule update --init --recursive' to get it." - exit -1 -fi - -echo "- Generating ${NAME}_main.circom..." - -# Generate the circom main file. -if [ ${CREDTYPE} == 'mdl' ]; then - python3 scripts/prepare_mdl_setup.py ${INPUTS_DIR}/config.json ${CIRCOM_DIR}/main.circom -else - python3 scripts/prepare_setup.py ${INPUTS_DIR}/config.json ${CIRCOM_DIR}/main.circom -fi - -echo "- Compiling main.circom..." -echo -e "\n=== circom output start ===" >> ${LOG_FILE} - - -# Copy the circom files we need to the instance's circom folder. -cp -r -L ${CIRCOM_SRC_DIR}/* ${CIRCOM_DIR}/ - -# Compile the circom circuit. First check if the hash of the circom files has changed, only re-compile if so. To force a re-build remove circom_files.sha256 -cd $CIRCOM_DIR -echo "Using Circom WASM witness generation" >> ${LOG_FILE} -circom main.circom --r1cs --wasm --O2 --sym --prime ${CURVE} | awk -v start=2 -v end=9 'NR>=start && NR<=end' >> ${LOG_FILE} -mv main.r1cs main_c.r1cs -mv main_c.r1cs ${OUTPUTS_DIR} - -cd ${ROOT_DIR} - -echo "=== circom output end ===" >> ${LOG_FILE} - -# Read the number of public inputs from $NAME.log -# there is a line of the form "public inputs: NUM_PUBLIC_INPUTS". parse out NUM_PUBLIC_INPUTS into a variable -NUM_PUBLIC_INPUTS=$(grep -m 1 "public inputs:" "$LOG_FILE" | awk '{print $3}') -NUM_PUBLIC_OUTPUTS=$(grep -m 1 "public outputs:" "$LOG_FILE" | awk '{print $3}') -# for mDL, we need to add the device public key to the number of public inputs -if [ "${CREDTYPE}" == "mdl" ] && [ "${DEVICE_BOUND}" == "1" ]; then - echo "Device bound mDL detected, adding device public key to public inputs" - NUM_PUBLIC_INPUTS=$((NUM_PUBLIC_INPUTS + 2)) -fi -NUM_PUBLIC_IOS=$(($NUM_PUBLIC_INPUTS + $NUM_PUBLIC_OUTPUTS)) -echo "Number of public inputs: $NUM_PUBLIC_INPUTS" -echo "Number of public outputs: $NUM_PUBLIC_OUTPUTS" -echo "Total number of public I/Os: $NUM_PUBLIC_IOS" - -# clean up the main.sym file as follows. Each entry is of the form #s, #w, #c, name as described in https://docs.circom.io/circom-language/formats/sym/ -awk -v max="$NUM_PUBLIC_IOS" -F ',' '$2 != -1 && $2 <= max {split($4, parts, "."); printf "%s,%s\n", parts[2], $2}' "${CIRCOM_DIR}/main.sym" > "${CIRCOM_DIR}/io_locations.sym" - -if [ ${CREDTYPE} == 'mdl' ]; then - echo "=== Generating mDL ===" - # Create the prover inputs (TODO: now that this has been ported to rust, do it in the library like for the JWT case) + python3 "${scripts[0]}"/prepare_setup.py "${INPUTS_DIR}/config.json" "${CIRCOM_DIR}/main.circom" + fi + + pushd "$CIRCOM_DIR" > /dev/null + log "=== ${NAME}: circom output start ===" + circom main.circom --r1cs --wasm --O2 --sym --prime ${CURVE} | awk -v start=2 -v end=9 'NR>=start && NR<=end' >> "${LOG_FILE}" + log "=== ${NAME}: circom output end ===" + mv main.r1cs "${OUTPUTS_DIR}"/main_c.r1cs + popd > /dev/null + + NUM_PUBLIC_INPUTS=$(grep -m 1 "public inputs:" "$LOG_FILE" | awk '{print $3}') + NUM_PUBLIC_OUTPUTS=$(grep -m 1 "public outputs:" "$LOG_FILE" | awk '{print $3}') + if [ "${CONFIG[credtype]}" == "mdl" ] && [ "${CONFIG[device_bound]}" == "1" ]; then + log "Device bound mDL detected, adding device public key to public inputs" + NUM_PUBLIC_INPUTS=$((NUM_PUBLIC_INPUTS + 2)) + fi + NUM_PUBLIC_IOS=$((NUM_PUBLIC_INPUTS + NUM_PUBLIC_OUTPUTS)) + log "${NAME}: Number of public inputs: $NUM_PUBLIC_INPUTS" + log "${NAME}: Number of public outputs: $NUM_PUBLIC_OUTPUTS" + log "${NAME}: Total number of public I/Os: $NUM_PUBLIC_IOS" + + awk -v max="$NUM_PUBLIC_IOS" -F ',' '$2 != -1 && $2 <= max {split($4, parts, "."); printf "%s,%s\n", parts[2], $2}' "${CIRCOM_DIR}/main.sym" > "${CIRCOM_DIR}/io_locations.sym" + + checkpoint_files "${circuit_inputs[@]}" + +} + +############################################################################### +# Generate mdl and prover inputs +# Does nothing if cred type is not mdl +############################################################################### +generate_mdl() { + if [ "${CONFIG[credtype]}" != 'mdl' ]; then + return 0 + fi + PROVER_INPUTS_FILE=${OUTPUTS_DIR}/prover_inputs.json PROVER_AUX_FILE=${OUTPUTS_DIR}/prover_aux.json - MDL_FILE=${INPUTS_DIR}/mdl.cbor - CONFIG_FILE=${INPUTS_DIR}/config.json - CLAIMS_FILE=${INPUTS_DIR}/claims.json - DEVICE_PRIV_KEY_FILE=${INPUTS_DIR}/device.prv - ISSUER_PRIV_KEY_FILE=${INPUTS_DIR}/issuer.prv - ISSUER_CERTS_FILE=${INPUTS_DIR}/issuer_certs.pem - ISSUER_KEY_FILE=${OUTPUTS_DIR}/issuer.pub - - cd ${ROOT_DIR}/mdl-tools - echo "Current dir: `pwd`" - # generate the mDL - cargo run --release --bin mdl-gen -- --claims ${CLAIMS_FILE} --device_priv_key ${DEVICE_PRIV_KEY_FILE} --issuer_private_key ${ISSUER_PRIV_KEY_FILE} --issuer_x5chain ${ISSUER_CERTS_FILE} --output ${MDL_FILE} 2>> ${LOG_FILE} - if [ $? -ne 0 ]; then - echo "Error running mdl-gen" - exit 1 + # list of files to check for changes and trigger a new mdl generation, otherwise use existing mdl output + local mdl_io=( + ${INPUTS_DIR}/{mdl.cbor,claims.json,device.prv,issuer.prv,issuer_certs.pem} + ${PROVER_INPUTS_FILE} ${PROVER_AUX_FILE} + ) + local mdl_tools_src=( ${CIRCUIT_SETUP}/mdl-tools/src/bin/*.rs ) + local mdl_tools_bin=(${BIN}/{mdl-gen,prepare-prover-input}) + + if ! have_files_changed "${mdl_io[@]}" "${mdl_tools_src[@]}"; then + green "${NAME}: Using existing mDL and prover inputs" + return 0 fi + + log "=== Generating mDL ===" + local mdl_file=${INPUTS_DIR}/mdl.cbor + local claims_file=${INPUTS_DIR}/claims.json + local device_priv_key_file=${INPUTS_DIR}/device.prv + local issuer_priv_key_file=${INPUTS_DIR}/issuer.prv + local issuer_certs_file=${INPUTS_DIR}/issuer_certs.pem + + if have_files_changed "${mdl_tools_bin[@]}" "${mdl_tools_src[@]}"; then + echo "Building mdl-gen and prepare-prover-input..." + cargo build -p mdl-tools $RELEASE_FLAG + checkpoint_files "${mdl_tools_bin[@]}" "${mdl_tools_src[@]}" + fi + + if ! "${BIN}"/mdl-gen --claims "${claims_file}" --device_priv_key "${device_priv_key_file}" --issuer_private_key "${issuer_priv_key_file}" --issuer_x5chain "${issuer_certs_file}" --output "${mdl_file}" 2>> "${LOG_FILE}"; then + error "Error running mdl-gen" + fi + + if ! "${BIN}"/prepare-prover-input --config "${CONFIG_FILE}" --mdl "${mdl_file}" --prover_inputs "${PROVER_INPUTS_FILE}" --prover_aux "${PROVER_AUX_FILE}" 2>> "${LOG_FILE}"; then + error "Error running prepare_prover_input" + fi + + node "${SCRIPTS_DIR}/precompEcdsa.mjs" "${OUTPUTS_DIR}/prover_inputs.json" > /dev/null 2>&1 + + checkpoint_files "${mdl_io[@]}" "${mdl_tools_src[@]}" +} + +############################################################################### +# Copy all the required files to the destination directory +############################################################################### +copy_artifacts() { + # Just do the copy every time, even if the files have not changed as its faster than checking if the files have changed + echo "${NAME}: Copying files to $(relative_path "${COPY_DEST}")..." + + rm -rf "${COPY_DEST}" + mkdir -p "${COPY_DEST}" + cd "${COPY_DEST}" + + if [ "${CONFIG[credtype]}" == 'jwt' ]; then + CRED_FILE="${INPUTS_DIR}/token.jwt" + elif [ "${CONFIG[credtype]}" == 'mdl' ]; then + CRED_FILE="${INPUTS_DIR}/mdl.cbor" + cp "${PROVER_INPUTS_FILE}" "${PROVER_AUX_FILE}" . + fi + + cp \ + "${CONFIG_FILE}" \ + "${OUTPUTS_DIR}/main_c.r1cs" \ + "${OUTPUTS_DIR}/circom/main_js/main.wasm" \ + "${OUTPUTS_DIR}/circom/io_locations.sym" \ + "${INPUTS_DIR}/issuer.pub" \ + "${INPUTS_DIR}/proof_spec.json" \ + "${CRED_FILE}" \ + . - # generate the prover inputs - cargo run --release --bin prepare-prover-input -- --config ${CONFIG_FILE} --mdl ${MDL_FILE} --prover_inputs ${PROVER_INPUTS_FILE} --prover_aux ${PROVER_AUX_FILE} 2>> ${LOG_FILE} - if [ $? -ne 0 ]; then - echo "Error running prepare_prover_input" - exit 1 - fi - - # extract key and signature from prover_inputs.json and add ecdsa precomputation and hash - node ${ROOT_DIR}/scripts/precompEcdsa.mjs ${OUTPUTS_DIR}/prover_inputs.json - - cd ${ROOT_DIR} -fi - -echo "Copying files to ${COPY_DEST}..." - -# Copy files needed for zksetup, prove, etc.. -R1CS_FILE=${OUTPUTS_DIR}/main_c.r1cs -WIT_GEN_FILE=${OUTPUTS_DIR}/circom/main_js/main.wasm -SYM_FILE=${OUTPUTS_DIR}/circom/io_locations.sym -CONFIG_FILE=${INPUTS_DIR}/config.json -ISSUER_KEY_FILE=${INPUTS_DIR}/issuer.pub -PROOF_SPEC_FILE=${INPUTS_DIR}/proof_spec.json -DEVICE_PUB_FILE=${INPUTS_DIR}/device.pub -DEVICE_PRV_FILE=${INPUTS_DIR}/device.prv -if [ ${CREDTYPE} == 'jwt' ]; then - CRED_FILE=${INPUTS_DIR}/token.jwt -elif [ ${CREDTYPE} == 'mdl' ]; then - CRED_FILE=${INPUTS_DIR}/mdl.cbor -fi - -rm -rf ${COPY_DEST} -mkdir -p ${COPY_DEST} -cp ${R1CS_FILE} ${COPY_DEST}/ -cp ${WIT_GEN_FILE} ${COPY_DEST}/ -cp ${SYM_FILE} ${COPY_DEST}/ -cp ${CONFIG_FILE} ${COPY_DEST}/ -cp ${ISSUER_KEY_FILE} ${COPY_DEST}/ -cp ${CRED_FILE} ${COPY_DEST}/ -cp ${DEVICE_PUB_FILE} ${COPY_DEST}/ || true # Optional file for JWTs -cp ${DEVICE_PRV_FILE} ${COPY_DEST}/ || true # Optional file for JWTs -cp ${PROOF_SPEC_FILE} ${COPY_DEST}/ -if [ ${CREDTYPE} == 'mdl' ]; then - cp ${PROVER_INPUTS_FILE} ${COPY_DEST}/ - cp ${PROVER_AUX_FILE} ${COPY_DEST}/ -fi - -cd scripts -echo "Done." + if [ "${CONFIG[device_bound]}" -eq 1 ]; then + cp "${INPUTS_DIR}/device.pub" "${INPUTS_DIR}/device.prv" . + fi + + cd "${CIRCUIT_SETUP}" +} + +############################################################################### +# Utility functions +############################################################################### + +green() { + echo -e "\033[0;32m$1\033[0m" +} + +blue () { + echo -e "\033[0;34m$1\033[0m" +} + +log() { + echo -e "\n$*" | tee -a "${LOG_FILE}" +} + +assert_path() { + for path in "$@"; do + [ -e "$path" ] || error "Required path not found: $path" + done +} + +error() { + local msg="$1" + local code="${2:-1}" + local script="$SCRIPT_NAME" + local line_trace="" + local n="${#BASH_LINENO[@]}" + for (( i = 0; i < n - 1; i++ )); do + [[ -n "$line_trace" ]] && line_trace+=":" + line_trace+="${BASH_LINENO[$i]}" + done + echo -e "\n\033[41;97m Error (${script}:${line_trace}): \033[0m $msg\n" >&2 + exit 1 +} + +fix_symlink() { + local link_path="$1" + local target_path="$2" + + if [ -f "$link_path" ]; then + echo "Detected broken symlink at $link_path" + rm -f "$link_path" + + if [[ "$OS" == "Windows_NT" || "$(uname -o 2>/dev/null)" == "Msys" ]]; then + echo "Creating Windows junction..." + cmd //c "mklink /J $(cygpath -wa "$link_path") $(cygpath -wa "$target_path")" + else + echo "Creating Linux symlink..." + ln -s "$target_path" "$link_path" + fi + + # Mark the symlink as unchanged so it doesn't appear as modified in git + # to undo: git update-index --no-assume-unchanged "$link_path" + git update-index --assume-unchanged "$link_path" + fi + + if [ ! -d "$link_path" ]; then + error "Expected directory symlink/junction at: $link_path" + fi +} + +relative_path() { + realpath --relative-to="$(pwd)" "$1" +} + +json_get() { + local -r json_file=$(relative_path "$1") + [ -f "$json_file" ] || error "JSON file not found: $json_file" + local key="$2" + # Python converts booleans to title case (True/False), so we have to convert booleans back to lowercase + python3 -c "import json;val = json.load(open('$json_file')).get('$key', '');print(str(val).lower() if isinstance(val, bool) else val)" 2>/dev/null +} + +prune() { + + [ -z "$PRUNE" ] && return 0 + + echo -e "\nPruning intermediate artifacts..." + + local before after saved + + before=$(du -s "${CIRCUIT_SETUP}" | awk '{print $1}') + + rm -rf "${OUTPUTS_DIR}" + rm -rf "${INPUTS_DIR:?}"/!(*.json) + + if [[ ${CONFIG[credtype]} == "mdl" ]]; then + cargo clean -p "mdl-tools" + cargo clean -p "mdl-tools" --release + fi + + after=$(du -s "${CIRCUIT_SETUP}" | awk '{print $1}') + saved=$((before - after)) + + echo "✂️ Reclaimed: $((saved / 1024)) MB" +} + +have_files_changed() { + local files=("$@") + + # If any of the files are missing, consider them changed + for f in "${files[@]}"; do + [[ -f "$f" ]] || return 0 + done + + # Generate current hash file + local -r current_hash_file=$(hash_files "${files[@]}") + local saved_hash_file="${current_hash_file%.current}" + + # Compare hash files + if [[ ! -f "$saved_hash_file" ]] || ! cmp -s "$current_hash_file" "$saved_hash_file"; then + return 0 # Files have changed + else + rm "$current_hash_file" + return 1 # Files have not changed + fi +} + +hash_files() { + local files=("$@") + local rel_files=() + for file in "${files[@]}"; do + if [[ ! -e "$file" ]]; then + error "File not found: $file" + fi + rel_files+=("$(realpath --relative-to=. "$file")") + done + # Generate hash ID from sorted file paths + local -r hash_id=$(printf "%s\n" "${rel_files[@]}" | sort -u | sha256sum | awk '{print substr($1,1,12)}') + local hash_file="${OUTPUTS_DIR}/${hash_id}.sha256.current" + sha256sum "${rel_files[@]}" | sort -u > "$hash_file" + echo "$hash_file" +} + +checkpoint_files() { + local files=("$@") + local current + current=$(hash_files "${files[@]}") + mv "$current" "${current%.current}" # Rename to remove .current suffix +} + +expand_files() { + shopt -s globstar nullglob + local inputs=("$@") + local files_set=() + for item in "${inputs[@]}"; do + for match in $item; do + if [[ -f "$match" ]]; then + rel_path=$(realpath --relative-to=. "$match") + files_set+=("$rel_path") + fi + done + done + printf "%s\n" "${files_set[@]}" | sort -u +} + + + +SECONDS=0 +main "$@" +green "\n✅ Done: $SCRIPT_NAME $NAME in ${SECONDS}s" diff --git a/clean_all.sh b/clean_all.sh index 0cb4bc57..5d83323c 100755 --- a/clean_all.sh +++ b/clean_all.sh @@ -1,19 +1,27 @@ -#!/bin/bash +#!/usr/bin/bash +# +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# + +# Enable glob pattern matching +shopt -s extglob + +# cd to this script's directory so we can run it from any location +cd "$(dirname "${BASH_SOURCE[0]}")" # clean Rust targets -for d in circuit_setup/mdl-tools creds ecdsa-pop sample/verifier sample/issuer sample/client_helper sample/setup_service; do - (cd $d && cargo clean && rm -f Cargo.lock) -done +cargo clean +rm -f ./Cargo.lock # remove generated files -find creds/test-vectors -mindepth 1 ! -name README.md -exec rm -rf {} + -find circuit_setup/inputs -type f ! -iname 'README.md' ! -name '*.json' -delete -find circuit_setup/generated_files -mindepth 1 ! -path 'circuit_setup/generated_files/README.md' -exec rm -rf {} + +rm -rf circuit_setup/inputs/*/!(*.json) +rm -rf circuit_setup/generated_files/!(README.md) +rm -rf creds/test-vectors/!(README.md) # clean wasm rm -rf creds/pkg # clean sample -cd sample && rm -rf client_helper/data verifier/data issuer/.well-known issuer/keys -cd client && npm run clean -cd ../.. +./sample/clean-sample.sh + diff --git a/creds/.gitignore b/creds/.gitignore new file mode 100644 index 00000000..2e275adf --- /dev/null +++ b/creds/.gitignore @@ -0,0 +1,2 @@ +test-vectors/*/** +!test-vectors/README diff --git a/creds/Cargo.toml b/creds/Cargo.toml index fa2324ec..bc60bb39 100644 --- a/creds/Cargo.toml +++ b/creds/Cargo.toml @@ -2,7 +2,7 @@ name = "crescent" version = "1.0.0" edition = "2021" -default-run = "crescent" +default-run = "crescent-cli" [dependencies] ark-crypto-primitives = { version = "=0.4.0" } @@ -73,8 +73,6 @@ criterion = { version = "0.5", features = ["html_reports"] } serial_test = "*" ark-bls12-381 = "0.4.0" - - [build-dependencies] cargo-patch = "0.3" @@ -98,6 +96,6 @@ harness = false [lib] crate-type = ["cdylib", "rlib"] -[profile.dev.package."*"] -#opt-level = 3 # optimize dependencies, even in dev builds -debug-assertions = false # We need this to work around a bug in Wasmer +[[bin]] +name = "crescent-cli" +path = "src/main.rs" diff --git a/creds/src/structs.rs b/creds/src/structs.rs index d678bb02..3074a017 100644 --- a/creds/src/structs.rs +++ b/creds/src/structs.rs @@ -179,8 +179,10 @@ impl GenericInputsJSON { } } +#[cfg(not(feature = "wasm"))] const BN254_PRIME: &str = "21888242871839275222246405745257275088548364400416034343698204186575808495617"; +#[cfg(not(feature = "wasm"))] fn normalize_i64_to_biguint(val: i64) -> BigUint { let prime = BigInt::from_str(BN254_PRIME).unwrap(); let bigint = BigInt::from(val); diff --git a/ecdsa-pop/neptune/Cargo.toml b/ecdsa-pop/neptune/Cargo.toml index db465a33..a2c1eba9 100644 --- a/ecdsa-pop/neptune/Cargo.toml +++ b/ecdsa-pop/neptune/Cargo.toml @@ -9,16 +9,16 @@ repository = "https://github.com/lurk-lab/neptune" rust-version = "1.71.0" [dependencies] -bellpepper = { workspace = true } -bellpepper-core = { workspace = true } -blake2s_simd = { workspace = true } -blstrs = { workspace = true, optional = true } -byteorder = { workspace = true } -ec-gpu = { workspace = true, optional = true } -ec-gpu-gen = { workspace = true, optional = true } -ff ={ workspace = true } -generic-array = { workspace = true } -pasta_curves = { workspace = true, features = ["serde"] } +bellpepper = { version = "0.2.0", default-features = false } +bellpepper-core = { version = "0.2.0", default-features = false } +blake2s_simd = "1.0.1" +blstrs = { version = "0.7.0", optional = true } +byteorder = "1" +ec-gpu = { version = "0.2.0", optional = true } +ec-gpu-gen = { version = "0.7.0", optional = true } +ff = "0.13.0" +generic-array = "1.0" +pasta_curves = { version = "0.5", features = ["serde"] } serde = { version = "1.0", features = ["derive"] } trait-set = "0.3.0" abomonation = { version = "0.7.3", optional = true } @@ -26,7 +26,7 @@ abomonation_derive = { version = "0.1.0", package = "abomonation_derive_ng", opt [dev-dependencies] bincode = "1.3.3" -blstrs = { workspace = true } +blstrs = { version = "0.7.0" } criterion = "0.5.1" rand = "0.8.5" rand_xorshift = "0.3.0" @@ -34,10 +34,11 @@ serde_json = "1.0.103" sha2 = "0.10" [build-dependencies] -blstrs = { workspace = true } -ec-gpu = { workspace = true, optional = true } -ec-gpu-gen = { workspace = true, optional = true } -pasta_curves = { workspace = true, features = ["serde"] } +blstrs = { version = "0.7.0" } +ec-gpu = { version = "0.2.0", optional = true } +ec-gpu-gen = { version = "0.7.0", optional = true } +pasta_curves = { version = "0.5", features = ["serde"] } + [package.metadata.cargo-udeps.ignore] normal = ["blstrs", "pasta_curves"] @@ -52,10 +53,6 @@ harness = false name = "synthesis" harness = false -[profile.bench] -incremental = false -codegen-units = 1 - [features] default = ["bls", "pasta"] cuda = ["ec-gpu-gen/cuda", "ec-gpu"] @@ -76,31 +73,3 @@ pasta = ["pasta_curves/gpu"] portable = ["blstrs/portable"] # Unsafe Abomonation-based serialization abomonation = ["dep:abomonation", "dep:abomonation_derive"] - -[workspace] -resolver = "2" -members = [ - "gbench", -] - -# Dependencies that should be kept in sync through the whole workspace -[workspace.dependencies] -bellpepper-core = { version = "0.2.0", default-features = false } -bellpepper = { version = "0.2.0", default-features = false } -blake2s_simd = "1.0.1" -blstrs = { version = "0.7.0" } -ff = "0.13.0" -generic-array = "1.0" -pasta_curves = { version = "0.5" } -ec-gpu = { version = "0.2.0" } -ec-gpu-gen = { version = "0.7.0" } -log = "0.4.19" -byteorder = "1" - -[profile.dev-ci] -inherits = "dev" -# By compiling dependencies with optimizations, performing tests gets much faster. -opt-level = 3 -lto = "thin" -incremental = false -codegen-units = 16 diff --git a/forks/circom-compat/Cargo.toml b/forks/circom-compat/Cargo.toml index 22435ef5..4477c816 100644 --- a/forks/circom-compat/Cargo.toml +++ b/forks/circom-compat/Cargo.toml @@ -44,7 +44,7 @@ cfg-if = "=1.0.0" [dev-dependencies] hex-literal = "=0.2.2" tokio = { version = "=1.29.1", features = ["macros"] } -serde_json = "=1.0.94" +serde_json = "1.0" ethers = "=2.0.7" [[bench]] diff --git a/sample/.gitignore b/sample/.gitignore new file mode 100644 index 00000000..f9e97c21 --- /dev/null +++ b/sample/.gitignore @@ -0,0 +1,8 @@ +issuer/.well-known/ +issuer/keys/ +client/node_modules +client/mdl.json +client/dist +client/.env +client_helper/data +verifier/data diff --git a/sample/Cargo.toml b/sample/Cargo.toml new file mode 100644 index 00000000..60ff0d07 --- /dev/null +++ b/sample/Cargo.toml @@ -0,0 +1,16 @@ +[workspace] +resolver = "2" + +members = [ + "client_helper", + "issuer", + "verifier", + "setup_service" +] + +[profile.dev.package.wasmer-vm] +opt-level = 3 +debug-assertions = false # We need this to work around a bug in Wasmer + +[profile.dev] +opt-level = 3 diff --git a/sample/clean-sample.sh b/sample/clean-sample.sh index 53329862..b781a188 100755 --- a/sample/clean-sample.sh +++ b/sample/clean-sample.sh @@ -1,29 +1,46 @@ -#!/bin/bash +#!/usr/bin/bash +# +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# # usage: clean-sample.sh [--data-and-build] +set -e + +cd "$(dirname "${BASH_SOURCE[0]}")" + DATA_AND_BUILD=false if [ "$1" == "--data-and-build" ]; then DATA_AND_BUILD=true fi -# clean client_helper project -rm -fr ./client_helper/data +rm -fr ./client/dist ./client/mdl.json +if ($DATA_AND_BUILD); then + ( cd ./client && npm run clean -p crescent-sample-client-helper ) +fi +echo "Cleaned client project" + +rm -fr ./client_helper/data ./client_helper/bin if ($DATA_AND_BUILD); then - cargo clean + ( cd ./client_helper && cargo clean ) fi echo "Cleaned client_helper project" -# clean issuer project -rm -fr ./issuer/data +rm -fr ./issuer/data ./issuer/keys ./issuer/.well-known ./issuer/bin if ($DATA_AND_BUILD); then - cargo clean + ( cd ./issuer && cargo clean ) fi echo "Cleaned issuer project" -# clean verifier project -rm -fr ./verifier/data +rm -fr ./verifier/data ./verifier/bin +if ($DATA_AND_BUILD); then + ( cd ./verifier && cargo clean ) +fi +echo "Cleaned verifier project" + +rm -fr ./setup_service/bin if ($DATA_AND_BUILD); then - cargo clean + ( cd ./setup_service && cargo clean ) fi -echo "Cleaned verifier project" \ No newline at end of file +echo "Cleaned setup_service project" diff --git a/sample/client/package-lock.json b/sample/client/package-lock.json index f43c125a..14876bb0 100644 --- a/sample/client/package-lock.json +++ b/sample/client/package-lock.json @@ -9,6 +9,9 @@ "version": "0.5.0", "hasInstallScript": true, "license": "MIT", + "dependencies": { + "cross-env": "^7.0.3" + }, "devDependencies": { "@rollup/plugin-commonjs": "28.0.0", "@rollup/plugin-eslint": "^9.0.5", @@ -19,7 +22,6 @@ "@stylistic/eslint-plugin": "^2.8.0", "@types/chrome": "0.0.272", "crescent": "file:../../creds/pkg", - "cross-env": "^7.0.3", "dotenv": "^16.4.5", "eslint": "8.57.1", "eslint-config-love": "71.0.0", @@ -33,13 +35,13 @@ }, "../../creds/pkg": { "name": "crescent", - "version": "0.5.0", + "version": "1.0.0", "dev": true }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.6.0.tgz", - "integrity": "sha512-WhCn7Z7TauhBtmzhvKpoQs0Wwb/kBcy4CwpuI0/eEIr2Lx2auxmulAzLr91wVZJaz47iUZdkXOK7WlAfxGKCnA==", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", + "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", "dev": true, "license": "MIT", "dependencies": { @@ -103,9 +105,9 @@ } }, "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, "license": "MIT", "dependencies": { @@ -184,9 +186,9 @@ } }, "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, "license": "MIT", "dependencies": { @@ -230,18 +232,14 @@ "license": "BSD-3-Clause" }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", - "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "version": "0.3.12", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz", + "integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==", "dev": true, "license": "MIT", "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" } }, "node_modules/@jridgewell/resolve-uri": { @@ -254,20 +252,10 @@ "node": ">=6.0.0" } }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@jridgewell/source-map": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", - "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "version": "0.3.10", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.10.tgz", + "integrity": "sha512-0pPkgz9dY+bijgistcTTJ5mR+ocqRXLuhXHYdzoMmmoJ2C9S46RCm2GMUbatPEUK9Yjy26IrAy8D/M00lLkv+Q==", "dev": true, "license": "MIT", "dependencies": { @@ -276,16 +264,16 @@ } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz", + "integrity": "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==", "dev": true, "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "version": "0.3.29", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz", + "integrity": "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==", "dev": true, "license": "MIT", "dependencies": { @@ -294,20 +282,20 @@ } }, "node_modules/@lit-labs/ssr-dom-shim": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.3.0.tgz", - "integrity": "sha512-nQIWonJ6eFAvUUrSlwyHDm/aE8PBDu5kRpL0vHMg6K8fK3Diq1xdPjTnsJSwxABhaZ+5eBi1btQB5ShUTKo4nQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.4.0.tgz", + "integrity": "sha512-ficsEARKnmmW5njugNYKipTm4SFnbik7CXtoencDZzmzo/dQ+2Q0bgkzJuoJP20Aj0F+izzJjOqsnkd6F/o1bw==", "dev": true, "license": "BSD-3-Clause" }, "node_modules/@lit/reactive-element": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.1.0.tgz", - "integrity": "sha512-L2qyoZSQClcBmq0qajBVbhYEcG6iK0XfLn66ifLe/RfC0/ihpc+pl0Wdn8bJ8o+hj38cG0fGXRgSS20MuXn7qA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.1.1.tgz", + "integrity": "sha512-N+dm5PAYdQ8e6UlywyyrgI2t++wFGXfHx+dSJ1oBrg6FAxUj40jId++EaRm80MKX5JnlH1sBsyZ5h0bcZKemCg==", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "@lit-labs/ssr-dom-shim": "^1.2.0" + "@lit-labs/ssr-dom-shim": "^1.4.0" } }, "node_modules/@nodelib/fs.scandir": { @@ -520,9 +508,9 @@ } }, "node_modules/@rollup/pluginutils": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.4.tgz", - "integrity": "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.2.0.tgz", + "integrity": "sha512-qWJ2ZTbmumwiLFomfzTyt5Kng4hwPi9rwCYN4SHb6eaRU1KNO4ccxINHr/VhH4GgPlt1XfSTLX2LBTme8ne4Zw==", "dev": true, "license": "MIT", "dependencies": { @@ -805,9 +793,9 @@ } }, "node_modules/@types/estree": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", - "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", "dev": true, "license": "MIT" }, @@ -871,13 +859,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.14.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.14.1.tgz", - "integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==", + "version": "24.0.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.13.tgz", + "integrity": "sha512-Qm9OYVOFHFYg3wJoTSrz80hoec5Lia/dPp84do3X7dZvLikQvM1YpmvTBEdIr/e+U8HTkFjLHLnl78K/qjf+jQ==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~6.21.0" + "undici-types": "~7.8.0" } }, "node_modules/@types/resolve": { @@ -895,21 +883,21 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.30.1.tgz", - "integrity": "sha512-v+VWphxMjn+1t48/jO4t950D6KR8JaJuNXzi33Ve6P8sEmPr5k6CEXjdGwT6+LodVnEa91EQCtwjWNUCPweo+Q==", + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.37.0.tgz", + "integrity": "sha512-jsuVWeIkb6ggzB+wPCsR4e6loj+rM72ohW6IBn2C+5NCvfUVY8s33iFPySSVXqtm5Hu29Ne/9bnA0JmyLmgenA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.30.1", - "@typescript-eslint/type-utils": "8.30.1", - "@typescript-eslint/utils": "8.30.1", - "@typescript-eslint/visitor-keys": "8.30.1", + "@typescript-eslint/scope-manager": "8.37.0", + "@typescript-eslint/type-utils": "8.37.0", + "@typescript-eslint/utils": "8.37.0", + "@typescript-eslint/visitor-keys": "8.37.0", "graphemer": "^1.4.0", - "ignore": "^5.3.1", + "ignore": "^7.0.0", "natural-compare": "^1.4.0", - "ts-api-utils": "^2.0.1" + "ts-api-utils": "^2.1.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -919,22 +907,32 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "@typescript-eslint/parser": "^8.37.0", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/@typescript-eslint/parser": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.30.1.tgz", - "integrity": "sha512-H+vqmWwT5xoNrXqWs/fesmssOW70gxFlgcMlYcBaWNPIEWDgLa4W9nkSPmhuOgLnXq9QYgkZ31fhDyLhleCsAg==", + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.37.0.tgz", + "integrity": "sha512-kVIaQE9vrN9RLCQMQ3iyRlVJpTiDUY6woHGb30JDkfJErqrQEmtdWH3gV0PBAfGZgQXoqzXOO0T3K6ioApbbAA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.30.1", - "@typescript-eslint/types": "8.30.1", - "@typescript-eslint/typescript-estree": "8.30.1", - "@typescript-eslint/visitor-keys": "8.30.1", + "@typescript-eslint/scope-manager": "8.37.0", + "@typescript-eslint/types": "8.37.0", + "@typescript-eslint/typescript-estree": "8.37.0", + "@typescript-eslint/visitor-keys": "8.37.0", "debug": "^4.3.4" }, "engines": { @@ -949,35 +947,75 @@ "typescript": ">=4.8.4 <5.9.0" } }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.37.0.tgz", + "integrity": "sha512-BIUXYsbkl5A1aJDdYJCBAo8rCEbAvdquQ8AnLb6z5Lp1u3x5PNgSSx9A/zqYc++Xnr/0DVpls8iQ2cJs/izTXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.37.0", + "@typescript-eslint/types": "^8.37.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.30.1.tgz", - "integrity": "sha512-+C0B6ChFXZkuaNDl73FJxRYT0G7ufVPOSQkqkpM/U198wUwUFOtgo1k/QzFh1KjpBitaK7R1tgjVz6o9HmsRPg==", + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.37.0.tgz", + "integrity": "sha512-0vGq0yiU1gbjKob2q691ybTg9JX6ShiVXAAfm2jGf3q0hdP6/BruaFjL/ManAR/lj05AvYCH+5bbVo0VtzmjOA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.30.1", - "@typescript-eslint/visitor-keys": "8.30.1" + "@typescript-eslint/types": "8.37.0", + "@typescript-eslint/visitor-keys": "8.37.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.37.0.tgz", + "integrity": "sha512-1/YHvAVTimMM9mmlPvTec9NP4bobA1RkDbMydxG8omqwJJLEW/Iy2C4adsAESIXU3WGLXFHSZUU+C9EoFWl4Zg==", + "dev": true, + "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.30.1.tgz", - "integrity": "sha512-64uBF76bfQiJyHgZISC7vcNz3adqQKIccVoKubyQcOnNcdJBvYOILV1v22Qhsw3tw3VQu5ll8ND6hycgAR5fEA==", + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.37.0.tgz", + "integrity": "sha512-SPkXWIkVZxhgwSwVq9rqj/4VFo7MnWwVaRNznfQDc/xPYHjXnPfLWn+4L6FF1cAz6e7dsqBeMawgl7QjUMj4Ow==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.30.1", - "@typescript-eslint/utils": "8.30.1", + "@typescript-eslint/types": "8.37.0", + "@typescript-eslint/typescript-estree": "8.37.0", + "@typescript-eslint/utils": "8.37.0", "debug": "^4.3.4", - "ts-api-utils": "^2.0.1" + "ts-api-utils": "^2.1.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -992,9 +1030,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.30.1.tgz", - "integrity": "sha512-81KawPfkuulyWo5QdyG/LOKbspyyiW+p4vpn4bYO7DM/hZImlVnFwrpCTnmNMOt8CvLRr5ojI9nU1Ekpw4RcEw==", + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.37.0.tgz", + "integrity": "sha512-ax0nv7PUF9NOVPs+lmQ7yIE7IQmAf8LGcXbMvHX5Gm+YJUYNAl340XkGnrimxZ0elXyoQJuN5sbg6C4evKA4SQ==", "dev": true, "license": "MIT", "engines": { @@ -1006,20 +1044,22 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.30.1.tgz", - "integrity": "sha512-kQQnxymiUy9tTb1F2uep9W6aBiYODgq5EMSk6Nxh4Z+BDUoYUSa029ISs5zTzKBFnexQEh71KqwjKnRz58lusQ==", + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.37.0.tgz", + "integrity": "sha512-zuWDMDuzMRbQOM+bHyU4/slw27bAUEcKSKKs3hcv2aNnc/tvE/h7w60dwVw8vnal2Pub6RT1T7BI8tFZ1fE+yg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.30.1", - "@typescript-eslint/visitor-keys": "8.30.1", + "@typescript-eslint/project-service": "8.37.0", + "@typescript-eslint/tsconfig-utils": "8.37.0", + "@typescript-eslint/types": "8.37.0", + "@typescript-eslint/visitor-keys": "8.37.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", - "ts-api-utils": "^2.0.1" + "ts-api-utils": "^2.1.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1033,16 +1073,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.30.1.tgz", - "integrity": "sha512-T/8q4R9En2tcEsWPQgB5BQ0XJVOtfARcUvOa8yJP3fh9M/mXraLxZrkCfGb6ChrO/V3W+Xbd04RacUEqk1CFEQ==", + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.37.0.tgz", + "integrity": "sha512-TSFvkIW6gGjN2p6zbXo20FzCABbyUAuq6tBvNRGsKdsSQ6a7rnV6ADfZ7f4iI3lIiXc4F4WWvtUfDw9CJ9pO5A==", "dev": true, "license": "MIT", "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.30.1", - "@typescript-eslint/types": "8.30.1", - "@typescript-eslint/typescript-estree": "8.30.1" + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.37.0", + "@typescript-eslint/types": "8.37.0", + "@typescript-eslint/typescript-estree": "8.37.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1057,14 +1097,14 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.30.1.tgz", - "integrity": "sha512-aEhgas7aJ6vZnNFC7K4/vMGDGyOiqWcYZPpIWrTKuTAlsvDNKy2GFDqh9smL+iq069ZvR0YzEeq0B8NJlLzjFA==", + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.37.0.tgz", + "integrity": "sha512-YzfhzcTnZVPiLfP/oeKtDp2evwvHLMe0LOy7oe+hb9KKIumLNohYS9Hgp1ifwpu42YWxhZE8yieggz6JpqO/1w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.30.1", - "eslint-visitor-keys": "^4.2.0" + "@typescript-eslint/types": "8.37.0", + "eslint-visitor-keys": "^4.2.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1082,9 +1122,9 @@ "license": "ISC" }, "node_modules/acorn": { - "version": "8.14.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", - "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", "bin": { @@ -1172,18 +1212,20 @@ } }, "node_modules/array-includes": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", - "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.9.tgz", + "integrity": "sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", - "es-object-atoms": "^1.0.0", - "get-intrinsic": "^1.2.4", - "is-string": "^1.0.7" + "es-abstract": "^1.24.0", + "es-object-atoms": "^1.1.1", + "get-intrinsic": "^1.3.0", + "is-string": "^1.1.1", + "math-intrinsics": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -1318,9 +1360,9 @@ "license": "MIT" }, "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1480,7 +1522,6 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", - "dev": true, "license": "MIT", "dependencies": { "cross-spawn": "^7.0.1" @@ -1499,7 +1540,6 @@ "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, "license": "MIT", "dependencies": { "path-key": "^3.1.0", @@ -1565,9 +1605,9 @@ } }, "node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1662,9 +1702,9 @@ } }, "node_modules/dotenv": { - "version": "16.5.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.5.0.tgz", - "integrity": "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==", + "version": "16.6.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", + "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", "dev": true, "license": "BSD-2-Clause", "engines": { @@ -1690,9 +1730,9 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.18.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.1.tgz", - "integrity": "sha512-ZSW3ma5GkcQBIpwZTSRAI8N71Uuwgs93IezB7mf7R60tC8ZbJideoDNKjHn2O9KIlx6rkGTTEk1xUCK2E1Y2Yg==", + "version": "5.18.2", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.2.tgz", + "integrity": "sha512-6Jw4sE1maoRJo3q8MsSIn2onJFbLTOjY9hlx4DZXmOKvLRd1Ok2kXmAGXaafL2+ijsJZ1ClYbl/pmqr9+k4iUQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1704,9 +1744,9 @@ } }, "node_modules/es-abstract": { - "version": "1.23.9", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.9.tgz", - "integrity": "sha512-py07lI0wjxAC/DcfK1S6G7iANonniZwTISvdPzk9hzeH0IZIshbuuFxLIU96OyF89Yb9hiqWn8M/bY83KY5vzA==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.0.tgz", + "integrity": "sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg==", "dev": true, "license": "MIT", "dependencies": { @@ -1714,18 +1754,18 @@ "arraybuffer.prototype.slice": "^1.0.4", "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.8", - "call-bound": "^1.0.3", + "call-bound": "^1.0.4", "data-view-buffer": "^1.0.2", "data-view-byte-length": "^1.0.2", "data-view-byte-offset": "^1.0.1", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", + "es-object-atoms": "^1.1.1", "es-set-tostringtag": "^2.1.0", "es-to-primitive": "^1.3.0", "function.prototype.name": "^1.1.8", - "get-intrinsic": "^1.2.7", - "get-proto": "^1.0.0", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", "get-symbol-description": "^1.1.0", "globalthis": "^1.0.4", "gopd": "^1.2.0", @@ -1737,21 +1777,24 @@ "is-array-buffer": "^3.0.5", "is-callable": "^1.2.7", "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", "is-regex": "^1.2.1", + "is-set": "^2.0.3", "is-shared-array-buffer": "^1.0.4", "is-string": "^1.1.1", "is-typed-array": "^1.1.15", - "is-weakref": "^1.1.0", + "is-weakref": "^1.1.1", "math-intrinsics": "^1.1.0", - "object-inspect": "^1.13.3", + "object-inspect": "^1.13.4", "object-keys": "^1.1.1", "object.assign": "^4.1.7", "own-keys": "^1.0.1", - "regexp.prototype.flags": "^1.5.3", + "regexp.prototype.flags": "^1.5.4", "safe-array-concat": "^1.1.3", "safe-push-apply": "^1.0.0", "safe-regex-test": "^1.1.0", "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", "string.prototype.trim": "^1.2.10", "string.prototype.trimend": "^1.0.9", "string.prototype.trimstart": "^1.0.8", @@ -1760,7 +1803,7 @@ "typed-array-byte-offset": "^1.0.4", "typed-array-length": "^1.0.7", "unbox-primitive": "^1.1.0", - "which-typed-array": "^1.1.18" + "which-typed-array": "^1.1.19" }, "engines": { "node": ">= 0.4" @@ -1982,9 +2025,9 @@ } }, "node_modules/eslint-module-utils": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.0.tgz", - "integrity": "sha512-wALZ0HFoytlyh/1+4wuZ9FJCD/leWHQzzrxJ8+rebyReSLk7LApMyd3WJaLVoN+D5+WIdJyDK1c6JnE65V4Zyg==", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz", + "integrity": "sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==", "dev": true, "license": "MIT", "dependencies": { @@ -2032,30 +2075,30 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz", - "integrity": "sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==", + "version": "2.32.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz", + "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", "dev": true, "license": "MIT", "dependencies": { "@rtsao/scc": "^1.1.0", - "array-includes": "^3.1.8", - "array.prototype.findlastindex": "^1.2.5", - "array.prototype.flat": "^1.3.2", - "array.prototype.flatmap": "^1.3.2", + "array-includes": "^3.1.9", + "array.prototype.findlastindex": "^1.2.6", + "array.prototype.flat": "^1.3.3", + "array.prototype.flatmap": "^1.3.3", "debug": "^3.2.7", "doctrine": "^2.1.0", "eslint-import-resolver-node": "^0.3.9", - "eslint-module-utils": "^2.12.0", + "eslint-module-utils": "^2.12.1", "hasown": "^2.0.2", - "is-core-module": "^2.15.1", + "is-core-module": "^2.16.1", "is-glob": "^4.0.3", "minimatch": "^3.1.2", "object.fromentries": "^2.0.8", "object.groupby": "^1.0.3", - "object.values": "^1.2.0", + "object.values": "^1.2.1", "semver": "^6.3.1", - "string.prototype.trimend": "^1.0.8", + "string.prototype.trimend": "^1.0.9", "tsconfig-paths": "^3.15.0" }, "engines": { @@ -2066,9 +2109,9 @@ } }, "node_modules/eslint-plugin-import/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, "license": "MIT", "dependencies": { @@ -2123,9 +2166,9 @@ } }, "node_modules/eslint-plugin-n": { - "version": "17.17.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-17.17.0.tgz", - "integrity": "sha512-2VvPK7Mo73z1rDFb6pTvkH6kFibAmnTubFq5l83vePxu0WiY1s0LOtj2WHb6Sa40R3w4mnh8GFYbHBQyMlotKw==", + "version": "17.21.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-17.21.0.tgz", + "integrity": "sha512-1+iZ8We4ZlwVMtb/DcHG3y5/bZOdazIpa/4TySo22MLKdwrLcfrX0hbadnCvykSQCCmkAnWmIP8jZVb2AAq29A==", "dev": true, "license": "MIT", "dependencies": { @@ -2136,7 +2179,8 @@ "globals": "^15.11.0", "ignore": "^5.3.2", "minimatch": "^9.0.5", - "semver": "^7.6.3" + "semver": "^7.6.3", + "ts-declaration-location": "^1.0.6" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2198,9 +2242,9 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", "dev": true, "license": "Apache-2.0", "engines": { @@ -2211,9 +2255,9 @@ } }, "node_modules/eslint/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, "license": "MIT", "dependencies": { @@ -2266,15 +2310,15 @@ } }, "node_modules/espree": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", - "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.14.0", + "acorn": "^8.15.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.0" + "eslint-visitor-keys": "^4.2.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2398,9 +2442,9 @@ } }, "node_modules/fdir": { - "version": "6.4.3", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", - "integrity": "sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==", + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", + "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", "dev": true, "license": "MIT", "peerDependencies": { @@ -2647,9 +2691,9 @@ } }, "node_modules/get-tsconfig": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.0.tgz", - "integrity": "sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A==", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.1.tgz", + "integrity": "sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2695,9 +2739,9 @@ } }, "node_modules/glob/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, "license": "MIT", "dependencies": { @@ -3176,6 +3220,19 @@ "dev": true, "license": "MIT" }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -3389,7 +3446,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, "license": "ISC" }, "node_modules/js-yaml": { @@ -3474,9 +3530,9 @@ } }, "node_modules/lit": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/lit/-/lit-3.3.0.tgz", - "integrity": "sha512-DGVsqsOIHBww2DqnuZzW7QsuCdahp50ojuDaBPC7jUDRpYoH0z7kHBBYZewRzer75FwtrkmkKk7iOAwSaWdBmw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/lit/-/lit-3.3.1.tgz", + "integrity": "sha512-Ksr/8L3PTapbdXJCk+EJVB78jDodUMaP54gD24W186zGRARvwrsPfS60wae/SSCTCNZVPd1chXqio1qHQmu4NA==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -3486,21 +3542,21 @@ } }, "node_modules/lit-element": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.2.0.tgz", - "integrity": "sha512-MGrXJVAI5x+Bfth/pU9Kst1iWID6GHDLEzFEnyULB/sFiRLgkd8NPK/PeeXxktA3T6EIIaq8U3KcbTU5XFcP2Q==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.2.1.tgz", + "integrity": "sha512-WGAWRGzirAgyphK2urmYOV72tlvnxw7YfyLDgQ+OZnM9vQQBQnumQ7jUJe6unEzwGU3ahFOjuz1iz1jjrpCPuw==", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "@lit-labs/ssr-dom-shim": "^1.2.0", + "@lit-labs/ssr-dom-shim": "^1.4.0", "@lit/reactive-element": "^2.1.0", "lit-html": "^3.3.0" } }, "node_modules/lit-html": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.3.0.tgz", - "integrity": "sha512-RHoswrFAxY2d8Cf2mm4OZ1DgzCoBKUKSPvA1fhtSELxUERq2aQQ2h05pO9j81gS1o7RIRJ+CePLogfyahwmynw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.3.1.tgz", + "integrity": "sha512-S9hbyDu/vs1qNrithiNyeyv64c9yqiW9l+DBgI18fL+MTvOtWoFR0FWiyq1TxaYef5wNlpEmzlXoBlZEO+WjoA==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -3875,7 +3931,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -4415,9 +4470,9 @@ } }, "node_modules/semver": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", - "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", "dev": true, "license": "ISC", "bin": { @@ -4490,7 +4545,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" @@ -4503,7 +4557,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -4623,6 +4676,20 @@ "source-map": "^0.6.0" } }, + "node_modules/stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/string.prototype.trim": { "version": "1.2.10", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", @@ -4745,9 +4812,9 @@ } }, "node_modules/tapable": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", - "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.2.tgz", + "integrity": "sha512-Re10+NauLTMCudc7T5WLFLAwDhQ0JWdrMK+9B2M8zR5hRExKmsRDCBA7/aV/pNJFltmBFO5BAMlQFi/vq3nKOg==", "dev": true, "license": "MIT", "engines": { @@ -4755,14 +4822,14 @@ } }, "node_modules/terser": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.39.0.tgz", - "integrity": "sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw==", + "version": "5.43.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz", + "integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.8.2", + "acorn": "^8.14.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, @@ -4806,6 +4873,29 @@ "typescript": ">=4.8.4" } }, + "node_modules/ts-declaration-location": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/ts-declaration-location/-/ts-declaration-location-1.0.7.tgz", + "integrity": "sha512-EDyGAwH1gO0Ausm9gV6T2nUvBgXT5kGoCMJPllOaooZ+4VvJiKBdZE7wK18N1deEowhcUptS+5GXZK8U/fvpwA==", + "dev": true, + "funding": [ + { + "type": "ko-fi", + "url": "https://ko-fi.com/rebeccastevens" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/ts-declaration-location" + } + ], + "license": "BSD-3-Clause", + "dependencies": { + "picomatch": "^4.0.2" + }, + "peerDependencies": { + "typescript": ">=4.0.0" + } + }, "node_modules/tsconfig-paths": { "version": "3.15.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", @@ -4945,15 +5035,16 @@ } }, "node_modules/typescript-eslint": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.30.1.tgz", - "integrity": "sha512-D7lC0kcehVH7Mb26MRQi64LMyRJsj3dToJxM1+JVTl53DQSV5/7oUGWQLcKl1C1KnoVHxMMU2FNQMffr7F3Row==", + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.37.0.tgz", + "integrity": "sha512-TnbEjzkE9EmcO0Q2zM+GE8NQLItNAJpMmED1BdgoBMYNdqMhzlbqfdSwiRlAzEK2pA9UzVW0gzaaIzXWg2BjfA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.30.1", - "@typescript-eslint/parser": "8.30.1", - "@typescript-eslint/utils": "8.30.1" + "@typescript-eslint/eslint-plugin": "8.37.0", + "@typescript-eslint/parser": "8.37.0", + "@typescript-eslint/typescript-estree": "8.37.0", + "@typescript-eslint/utils": "8.37.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4987,9 +5078,9 @@ } }, "node_modules/undici-types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", - "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", + "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==", "dev": true, "license": "MIT" }, @@ -5017,7 +5108,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" diff --git a/sample/client/package.json b/sample/client/package.json index a745d1af..65541c89 100644 --- a/sample/client/package.json +++ b/sample/client/package.json @@ -6,7 +6,8 @@ "type": "module", "scripts": { "clean": "rimraf ./dist/**/*", - "build": "cross-env NODE_ENV=production rollup -c", + "build": "npm run build:release", + "build:release": "cross-env NODE_ENV=production rollup -c", "build:debug": "cross-env NODE_ENV=development rollup -c", "build:watch": "npm run build:debug -- -w", "lint": "eslint .", @@ -16,6 +17,9 @@ }, "author": "", "license": "MIT", + "dependencies": { + "cross-env": "^7.0.3" + }, "devDependencies": { "@rollup/plugin-commonjs": "28.0.0", "@rollup/plugin-eslint": "^9.0.5", @@ -26,7 +30,6 @@ "@stylistic/eslint-plugin": "^2.8.0", "@types/chrome": "0.0.272", "crescent": "file:../../creds/pkg", - "cross-env": "^7.0.3", "dotenv": "^16.4.5", "eslint": "8.57.1", "eslint-config-love": "71.0.0", diff --git a/sample/client/setup_client.sh b/sample/client/setup_client.sh index 10c1bab7..f743a5ad 100755 --- a/sample/client/setup_client.sh +++ b/sample/client/setup_client.sh @@ -1,21 +1,24 @@ -#!/bin/bash +#!/usr/bin/bash +# +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# set -e +# Change to the script's directory (which should be client/) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$SCRIPT_DIR" + # Define the source and target directories as arrays CRESCENT_DIR="../../creds" -# Make sure we're in the right directory -CURRENT_DIR=${PWD##*/} -if [ "$CURRENT_DIR" != "client" ]; then - echo "Run this script from the client/ folder" - exit 1 -fi - echo "Building crescent wasm package" -pushd $CRESCENT_DIR > /dev/null +pushd "$CRESCENT_DIR" > /dev/null cargo install wasm-pack # Build crescent wasm package +# cargo check -p crescent --lib --release --target wasm32-unknown-unknown --no-default-features --features wasm + RUSTFLAGS="-A unused-imports -A unused-assignments -A unused-variables --cfg getrandom_backend=\"wasm_js\"" \ wasm-pack build --target web --no-default-features --features wasm || \ echo -e "\n\033[33m[WARNING] wasm-pack build failed. Proceeding without it.\033[0m\n" diff --git a/sample/client_helper/Cargo.toml b/sample/client_helper/Cargo.toml index 4711a57b..ca2f4264 100644 --- a/sample/client_helper/Cargo.toml +++ b/sample/client_helper/Cargo.toml @@ -17,7 +17,3 @@ sha2 = "0.10.8" hex = "0.4.3" base64-url = "3.0" crescent-sample-setup-service = {path="../setup_service"} - -[profile.dev.package."*"] -opt-level = 3 # optimize dependencies, even in dev builds -debug-assertions = false # We need this to work around a bug in Wasmer \ No newline at end of file diff --git a/sample/client_helper/setup_client_helper.sh b/sample/client_helper/setup_client_helper.sh index ede90172..41a45460 100755 --- a/sample/client_helper/setup_client_helper.sh +++ b/sample/client_helper/setup_client_helper.sh @@ -1,20 +1,18 @@ -#!/bin/bash -set -e +#!/usr/bin/bash +# +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# +set -e -o errexit +# Change to the script's directory (which should be client_helper/) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$SCRIPT_DIR" # Define the source and target directories as arrays -# Note: the rs256-db (device binding) set also supports selective disclosure, so we use that set for both features -SOURCE_DIRS=("../../creds/test-vectors/rs256" "../../creds/test-vectors/rs256-db" "../../creds/test-vectors/mdl1") -TARGET_DIRS=("./data/creds/jwt_corporate_1/shared" "./data/creds/jwt_sd/shared" "./data/creds/mdl_1/shared") -# Directory to clean up before copying new files +SOURCE_DIRS=(../../creds/test-vectors/{rs256,rs256-db,mdl1}) +TARGET_DIRS=(./data/creds/{jwt_corporate_1/shared,jwt_sd/shared,mdl_1/shared}) CLEANUP_DIR="./data/creds" -# Make sure we're in the right directory -CURRENT_DIR=${PWD##*/} -if [ "$CURRENT_DIR" != "client_helper" ]; then - echo "Run this script from the client_helper/ folder" - exit 1 -fi - # Remove and re-create the cleanup directory (could contain old creds) echo "Removing and re-creating $CLEANUP_DIR directory" rm -fr "$CLEANUP_DIR" @@ -25,22 +23,27 @@ for i in "${!SOURCE_DIRS[@]}"; do SOURCE_DIR="${SOURCE_DIRS[i]}" TARGET_DIR="${TARGET_DIRS[i]}" - # Remove and re-create the target directory + # Ensure the source directory exists + if [ ! -d "$SOURCE_DIR" ]; then + echo -e "\033[0;31mSource directory $SOURCE_DIR does not exist. Run run_setup.sh first.\033[0m" + exit 1 + fi + echo "Removing and re-creating $TARGET_DIR directory" mkdir -p "$TARGET_DIR" mkdir -p "${TARGET_DIR}/cache" echo "Copying files from $SOURCE_DIR to $TARGET_DIR" set -x - cp "${SOURCE_DIR}/config.json" "${TARGET_DIR}/" - cp "${SOURCE_DIR}/main.wasm" "${TARGET_DIR}/" - cp "${SOURCE_DIR}/main_c.r1cs" "${TARGET_DIR}/" - cp "${SOURCE_DIR}/io_locations.sym" "${TARGET_DIR}/" - [ -f "${SOURCE_DIR}/device.prv" ] && cp "${SOURCE_DIR}/device.prv" "${TARGET_DIR}/" - [ -f "${SOURCE_DIR}/device.pub" ] && cp "${SOURCE_DIR}/device.pub" "${TARGET_DIR}/" - cp "${SOURCE_DIR}/cache/prover_params.bin" "${TARGET_DIR}/cache/" - cp "${SOURCE_DIR}/cache/groth16_pvk.bin" "${TARGET_DIR}/cache/" - cp "${SOURCE_DIR}/cache/range_pk.bin" "${TARGET_DIR}/cache/" + ln "${SOURCE_DIR}/config.json" "${TARGET_DIR}/" + ln "${SOURCE_DIR}/main.wasm" "${TARGET_DIR}/" + ln "${SOURCE_DIR}/main_c.r1cs" "${TARGET_DIR}/" + ln "${SOURCE_DIR}/io_locations.sym" "${TARGET_DIR}/" + [ -f "${SOURCE_DIR}/device.prv" ] && ln "${SOURCE_DIR}/device.prv" "${TARGET_DIR}/" + [ -f "${SOURCE_DIR}/device.pub" ] && ln "${SOURCE_DIR}/device.pub" "${TARGET_DIR}/" + ln "${SOURCE_DIR}/cache/prover_params.bin" "${TARGET_DIR}/cache/" + ln "${SOURCE_DIR}/cache/groth16_pvk.bin" "${TARGET_DIR}/cache/" + ln "${SOURCE_DIR}/cache/range_pk.bin" "${TARGET_DIR}/cache/" set +x echo "Finished copying for $TARGET_DIR" diff --git a/sample/issuer/setup_issuer.sh b/sample/issuer/setup_issuer.sh index b2eb13cb..9c033ca8 100755 --- a/sample/issuer/setup_issuer.sh +++ b/sample/issuer/setup_issuer.sh @@ -1,15 +1,21 @@ -#!/bin/bash +#!/usr/bin/bash +# +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# + set -e -# call the issuer key generation script +# Change to the script's directory +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$SCRIPT_DIR" + +# Call the issuer key generation script ../common/generate-keys.sh -# call the JWKS generation script +# Call the JWKS generation script node scripts/generate-jwks.js -# copy the user device public key for device-bound JWTs -# note: the sample currently only uses one device key, shared by all users, simulating -# a device key registered with the issuer out-of-band. Fresh device keys could -# be generated for each user at issuance time; the sample flows would need to be updated +# Copy the user device public key for device-bound JWTs mkdir -p keys/ -cp -f ../../circuit_setup/inputs/rs256-db/device.pub keys/device.pub \ No newline at end of file +cp -f ../../circuit_setup/inputs/rs256-db/device.pub keys/device.pub diff --git a/sample/setup-sample.sh b/sample/setup-sample.sh index 6899f661..5c1bf627 100755 --- a/sample/setup-sample.sh +++ b/sample/setup-sample.sh @@ -1,30 +1,39 @@ -#!/bin/bash -set -e +#!/usr/bin/bash +# +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# # usage: setup-sample.sh -# setup client_helper project -cd client_helper -./setup_client_helper.sh -cargo build --release -cd .. +set -euo pipefail -# setup issuer project -cd issuer -./setup_issuer.sh -cargo build --release -cd .. +cd "$(dirname "${BASH_SOURCE[0]}")" +readonly CRESCENT_ENV=${CRESCENT_ENV:-release} +[[ "$CRESCENT_ENV" =~ ^(release|debug)$ ]] || { echo "Invalid CRESCENT_ENV: $CRESCENT_ENV" >&2; exit 1; } +RELEASE_FLAG=$([[ "$CRESCENT_ENV" == "debug" ]] && echo "" || echo "--release") -# setup verifier project -cd verifier -./setup_verifier.sh -cargo build --release -cd .. -# setup client project +readonly ROOT_DIR=$(realpath ..) +readonly BIN="${ROOT_DIR}/target/${CRESCENT_ENV}" + +./client_helper/setup_client_helper.sh & +./issuer/setup_issuer.sh & +./verifier/setup_verifier.sh & +wait + +# cargo build --features print-trace ${RELEASE_FLAG} +cargo build ${RELEASE_FLAG} +mkdir -p ./client_helper/bin ./issuer/bin ./verifier/bin ./setup_service/bin +cp "${BIN}"/crescent-sample-client-helper client_helper/bin/crescent-sample-client-helper +cp "${BIN}"/crescent-sample-issuer issuer/bin/crescent-sample-issuer +cp "${BIN}"/crescent-sample-verifier verifier/bin/crescent-sample-verifier +cp "${BIN}"/crescent-sample-setup-service setup_service/bin/crescent-sample-setup-service + +./client/setup_client.sh + cd client -./setup_client.sh -npm run build:debug +npm run build${CRESCENT_ENV:+:$CRESCENT_ENV} #npm build:release or build:debug # Create json file with base64 encoded mdoc and device private key # (until we have an issuer to issue mDLs, we use the ones generated in the Crescent lib) diff --git a/sample/verifier/Cargo.toml b/sample/verifier/Cargo.toml index 8d589747..413ac8ca 100644 --- a/sample/verifier/Cargo.toml +++ b/sample/verifier/Cargo.toml @@ -17,7 +17,3 @@ base64-url = "3.0" sha2 = "0.10.8" crescent = {path="../../creds"} crescent-sample-setup-service = {path="../setup_service"} - -[profile.dev.package."*"] -opt-level = 3 # optimize dependencies, even in dev builds -debug-assertions = false # We need this to work around a bug in Wasmer diff --git a/sample/verifier/setup_verifier.sh b/sample/verifier/setup_verifier.sh index 0a1a1edf..4662b256 100755 --- a/sample/verifier/setup_verifier.sh +++ b/sample/verifier/setup_verifier.sh @@ -1,20 +1,20 @@ -#!/bin/bash +#!/usr/bin/bash +# +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# + set -e +# Change to the script's directory (which should be verifier/) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$SCRIPT_DIR" + # Define the source and target directories as arrays -# Note: the rs256-db (device binding) set also supports selective disclosure, so we use that set for both features SOURCE_DIRS=("../../creds/test-vectors/rs256" "../../creds/test-vectors/rs256-db" "../../creds/test-vectors/mdl1") TARGET_DIRS=("./data/issuers/jwt_corporate_1/shared" "./data/issuers/jwt_sd/shared" "./data/issuers/mdl_1/shared") -# Directory to clean up before copying new files CLEANUP_DIR="./data/issuers" -# Make sure we're in the right directory -CURRENT_DIR=${PWD##*/} -if [ "$CURRENT_DIR" != "verifier" ]; then - echo "Run this script from the verifier/ folder" - exit 1 -fi - # Remove and re-create the cleanup directory (could contain old creds) echo "Removing and re-creating $CLEANUP_DIR directory" rm -fr "$CLEANUP_DIR" From 00688024340aa956265901d57b59745fa8ce3da1 Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Tue, 22 Jul 2025 11:54:30 -0700 Subject: [PATCH 02/13] turn off verbose output --- circuit_setup/scripts/run_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circuit_setup/scripts/run_setup.sh b/circuit_setup/scripts/run_setup.sh index 5bfe3d9e..ed1fb04f 100755 --- a/circuit_setup/scripts/run_setup.sh +++ b/circuit_setup/scripts/run_setup.sh @@ -4,7 +4,7 @@ # Licensed under the MIT license. # -set -eEx -o pipefail -o errtrace +set -eE -o pipefail -o errtrace shopt -s extglob globstar nullglob From 9411a0ffe1643a9002a2f9158c33a9f04dc0d1fd Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Fri, 15 Aug 2025 10:24:06 -0700 Subject: [PATCH 03/13] Merge branch 'main' of https://github.com/microsoft/crescent-credentials into refactor-setup-scripts --- clippy_command.sh | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/clippy_command.sh b/clippy_command.sh index 6470e2b7..49737220 100755 --- a/clippy_command.sh +++ b/clippy_command.sh @@ -1,10 +1,24 @@ #!/bin/sh +set -ex -# Invoke clippy with this command to allow some lints +ALLOW_FLAGS=" + -A clippy::needless_range_loop + -A clippy::same_item_push + -A clippy::should_implement_trait + -A clippy::result_large_err +" -RUSTFLAGS="--deny warnings" cargo clippy --release --tests -- \ - --no-deps \ - -A clippy::needless_range_loop \ - -A clippy::same_item_push \ - -A clippy::should_implement_trait \ - -A clippy::result_large_err +# Extra rustc lint relaxations (empty by default) +EXTRA_RUSTFLAGS="" + +case "$PWD" in + */ecdsa-pop|*/ecdsa-pop/*) + # dead_code is a rustc lint → must go into RUSTFLAGS + EXTRA_RUSTFLAGS="$EXTRA_RUSTFLAGS -Adead_code" + ;; +esac + +# Deny all warnings globally, but allow dead_code in ecdsa-pop +RUSTFLAGS="$EXTRA_RUSTFLAGS -Dwarnings" cargo clippy --release --tests -- \ + --no-deps \ + $ALLOW_FLAGS From 2624ee5f594e3b7b4050c5760150618a0840585c Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Thu, 28 Aug 2025 09:42:56 -0700 Subject: [PATCH 04/13] fix 1.89 clippy issues --- clippy_command.sh | 28 +++++-------------- creds/src/dlog.rs | 8 +++--- .../src/sonic_pc/data_structures.rs | 4 +-- forks/circom-compat/src/witness/memory.rs | 2 +- forks/halo2curves/src/lib.rs | 2 ++ 5 files changed, 16 insertions(+), 28 deletions(-) diff --git a/clippy_command.sh b/clippy_command.sh index 49737220..6470e2b7 100755 --- a/clippy_command.sh +++ b/clippy_command.sh @@ -1,24 +1,10 @@ #!/bin/sh -set -ex -ALLOW_FLAGS=" - -A clippy::needless_range_loop - -A clippy::same_item_push - -A clippy::should_implement_trait - -A clippy::result_large_err -" +# Invoke clippy with this command to allow some lints -# Extra rustc lint relaxations (empty by default) -EXTRA_RUSTFLAGS="" - -case "$PWD" in - */ecdsa-pop|*/ecdsa-pop/*) - # dead_code is a rustc lint → must go into RUSTFLAGS - EXTRA_RUSTFLAGS="$EXTRA_RUSTFLAGS -Adead_code" - ;; -esac - -# Deny all warnings globally, but allow dead_code in ecdsa-pop -RUSTFLAGS="$EXTRA_RUSTFLAGS -Dwarnings" cargo clippy --release --tests -- \ - --no-deps \ - $ALLOW_FLAGS +RUSTFLAGS="--deny warnings" cargo clippy --release --tests -- \ + --no-deps \ + -A clippy::needless_range_loop \ + -A clippy::same_item_push \ + -A clippy::should_implement_trait \ + -A clippy::result_large_err diff --git a/creds/src/dlog.rs b/creds/src/dlog.rs index eda75288..5845bc04 100644 --- a/creds/src/dlog.rs +++ b/creds/src/dlog.rs @@ -66,10 +66,10 @@ impl DLogPoK { r.push(ri); } - if eq_pos.is_some() { + if let Some(eq_pos_vec) = eq_pos.as_ref() { assert!(y.len() == 2); - for (i,j) in eq_pos.unwrap().iter() { + for (i, j) in eq_pos_vec.iter() { r[1][*j] = r[0][*i]; } } @@ -152,10 +152,10 @@ impl DLogPoK { add_to_transcript(&mut ts, b"y", &y[i]); } - if eq_pos.is_some() { + if let Some(eq_pos_vec) = eq_pos.as_ref() { assert!(y.len() == 2); - for (i,j) in eq_pos.unwrap().iter() { + for (i, j) in eq_pos_vec.iter() { if self.s[0][*i] != self.s[1][*j] { println!("DLogPoK verification failed: eq_pos mismatch"); return false; diff --git a/forks/ark-poly-commit/src/sonic_pc/data_structures.rs b/forks/ark-poly-commit/src/sonic_pc/data_structures.rs index 708b5589..49ee5db2 100644 --- a/forks/ark-poly-commit/src/sonic_pc/data_structures.rs +++ b/forks/ark-poly-commit/src/sonic_pc/data_structures.rs @@ -70,7 +70,7 @@ pub struct CommitterKey { impl CommitterKey { /// Obtain powers for the underlying KZG10 construction - pub fn powers(&self) -> kzg10::Powers { + pub fn powers(&self) -> kzg10::Powers<'_, E> { kzg10::Powers { powers_of_g: self.powers_of_g.as_slice().into(), powers_of_gamma_g: self.powers_of_gamma_g.as_slice().into(), @@ -81,7 +81,7 @@ impl CommitterKey { pub fn shifted_powers( &self, degree_bound: impl Into>, - ) -> Option> { + ) -> Option> { match (&self.shifted_powers_of_g, &self.shifted_powers_of_gamma_g) { (Some(shifted_powers_of_g), Some(shifted_powers_of_gamma_g)) => { let max_bound = self diff --git a/forks/circom-compat/src/witness/memory.rs b/forks/circom-compat/src/witness/memory.rs index 1298b411..191cef07 100644 --- a/forks/circom-compat/src/witness/memory.rs +++ b/forks/circom-compat/src/witness/memory.rs @@ -59,7 +59,7 @@ impl SafeMemory { } /// Gets an immutable view to the memory in 32 byte chunks - pub fn view(&self) -> MemoryView { + pub fn view(&self) -> MemoryView<'_, u32> { self.memory.view() } diff --git a/forks/halo2curves/src/lib.rs b/forks/halo2curves/src/lib.rs index 2e21ce02..e75d6d29 100644 --- a/forks/halo2curves/src/lib.rs +++ b/forks/halo2curves/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + mod arithmetic; mod curve; pub mod ff_ext; From 599d75f88541a3e02c337fd029efb7751e192531 Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Thu, 28 Aug 2025 10:57:43 -0700 Subject: [PATCH 05/13] disable __rust_probestack on linux --- creds/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/creds/Cargo.toml b/creds/Cargo.toml index bc60bb39..51a0b12b 100644 --- a/creds/Cargo.toml +++ b/creds/Cargo.toml @@ -68,6 +68,9 @@ p256 = { version = "0.13.2", features = ["ecdsa", "pem"]} getrandom_03 = { package = "getrandom", version = "0.3", features = ["wasm_js"] } getrandom_02 = { package = "getrandom", version = "0.2", features = ["js"] } +[target.x86_64-unknown-linux-gnu] +rustflags = ["-C", "no-probestack"] + [dev-dependencies] criterion = { version = "0.5", features = ["html_reports"] } serial_test = "*" From 3da486441c088dd59f89a9bbdc6168db9f4b5dfd Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Thu, 28 Aug 2025 11:29:48 -0700 Subject: [PATCH 06/13] move no-probestack to config; comment out dependency profiles to suppress workspace warnings --- creds/.cargo/.config.toml | 2 ++ creds/Cargo.toml | 3 --- forks/ark-poly-commit/Cargo.toml | 22 ++++++++--------- forks/groth16/Cargo.toml | 42 ++++++++++++++++---------------- forks/halo2curves/Cargo.toml | 16 ++++++------ 5 files changed, 42 insertions(+), 43 deletions(-) create mode 100644 creds/.cargo/.config.toml diff --git a/creds/.cargo/.config.toml b/creds/.cargo/.config.toml new file mode 100644 index 00000000..fac56909 --- /dev/null +++ b/creds/.cargo/.config.toml @@ -0,0 +1,2 @@ +[target.x86_64-unknown-linux-gnu] +rustflags = ["-C", "no-probestack"] diff --git a/creds/Cargo.toml b/creds/Cargo.toml index 51a0b12b..bc60bb39 100644 --- a/creds/Cargo.toml +++ b/creds/Cargo.toml @@ -68,9 +68,6 @@ p256 = { version = "0.13.2", features = ["ecdsa", "pem"]} getrandom_03 = { package = "getrandom", version = "0.3", features = ["wasm_js"] } getrandom_02 = { package = "getrandom", version = "0.2", features = ["js"] } -[target.x86_64-unknown-linux-gnu] -rustflags = ["-C", "no-probestack"] - [dev-dependencies] criterion = { version = "0.5", features = ["html_reports"] } serial_test = "*" diff --git a/forks/ark-poly-commit/Cargo.toml b/forks/ark-poly-commit/Cargo.toml index b4525016..90f6130e 100644 --- a/forks/ark-poly-commit/Cargo.toml +++ b/forks/ark-poly-commit/Cargo.toml @@ -33,17 +33,17 @@ categories = ["cryptography"] license = "MIT/Apache-2.0" repository = "https://github.com/arkworks-rs/poly-commit" -[profile.release] -opt-level = 3 -lto = "thin" -debug = true -incremental = true - -[profile.test] -opt-level = 3 -debug = true -debug-assertions = true -incremental = true +# [profile.release] +# opt-level = 3 +# lto = "thin" +# debug = true +# incremental = true + +# [profile.test] +# opt-level = 3 +# debug = true +# debug-assertions = true +# incremental = true [dependencies.ark-crypto-primitives] version = "^0.4.0" diff --git a/forks/groth16/Cargo.toml b/forks/groth16/Cargo.toml index 8db5d6b4..cdd9325f 100644 --- a/forks/groth16/Cargo.toml +++ b/forks/groth16/Cargo.toml @@ -53,27 +53,27 @@ path = "benches/bench.rs" harness = false required-features = ["std"] -[profile.release] -opt-level = 3 -lto = "thin" -incremental = true -panic = 'abort' +# [profile.release] +# opt-level = 3 +# lto = "thin" +# incremental = true +# panic = 'abort' -[profile.bench] -opt-level = 3 -debug = false -rpath = false -lto = "thin" -incremental = true -debug-assertions = false +# [profile.bench] +# opt-level = 3 +# debug = false +# rpath = false +# lto = "thin" +# incremental = true +# debug-assertions = false -[profile.dev] -opt-level = 0 -panic = 'abort' +# [profile.dev] +# opt-level = 0 +# panic = 'abort' -[profile.test] -opt-level = 3 -lto = "thin" -incremental = true -debug-assertions = true -debug = true +# [profile.test] +# opt-level = 3 +# lto = "thin" +# incremental = true +# debug-assertions = true +# debug = true diff --git a/forks/halo2curves/Cargo.toml b/forks/halo2curves/Cargo.toml index e7b8f46f..e50c3de3 100644 --- a/forks/halo2curves/Cargo.toml +++ b/forks/halo2curves/Cargo.toml @@ -55,14 +55,14 @@ bn256-table = [] derive_serde = ["serde/derive", "serde_arrays", "hex"] print-trace = ["ark-std/print-trace"] -[profile.bench] -opt-level = 3 -debug = false -debug-assertions = false -overflow-checks = false -lto = true -incremental = false -codegen-units = 1 +# [profile.bench] +# opt-level = 3 +# debug = false +# debug-assertions = false +# overflow-checks = false +# lto = true +# incremental = false +# codegen-units = 1 [[bench]] name = "field_arith" From ea44926488e56d3280a0a7ee84bfdd36ba856893 Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Thu, 28 Aug 2025 11:30:55 -0700 Subject: [PATCH 07/13] make python3 a prerequisite for build-all --- build_all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_all.sh b/build_all.sh index 85b5a6e2..4972086b 100755 --- a/build_all.sh +++ b/build_all.sh @@ -35,7 +35,7 @@ check_pip_pkgs() { } echo "🔍 Checking prerequisites..." -check_prereqs node npm python circom rustc cargo ssh +check_prereqs node npm python3 circom rustc cargo ssh check_pip_pkgs jwcrypto cbor2 From 4811ea071321f5f1913902d1cb9970bc8765586d Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Thu, 28 Aug 2025 14:18:13 -0700 Subject: [PATCH 08/13] move rust_probestack fix to right location --- creds/.cargo/.config.toml | 2 -- forks/circom-compat/.cargo/.config.toml | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) delete mode 100644 creds/.cargo/.config.toml create mode 100644 forks/circom-compat/.cargo/.config.toml diff --git a/creds/.cargo/.config.toml b/creds/.cargo/.config.toml deleted file mode 100644 index fac56909..00000000 --- a/creds/.cargo/.config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.x86_64-unknown-linux-gnu] -rustflags = ["-C", "no-probestack"] diff --git a/forks/circom-compat/.cargo/.config.toml b/forks/circom-compat/.cargo/.config.toml new file mode 100644 index 00000000..7ac2916e --- /dev/null +++ b/forks/circom-compat/.cargo/.config.toml @@ -0,0 +1,8 @@ +[target.x86_64-unknown-linux-gnu] +rustflags = ["-C", "no-probestack"] + +# This addresses the __rust_probestack issue introduced in Rust 1.89, +# where stack probing is required for large stack allocations to prevent stack overflows. +# wasmer-vn uses the __rust_probestack internal flag and needs to fix its usage. +# but we are stuck on wasmer 2.3.0 with this project. +# Upgrading to wasmer 6 causes massive errors \ No newline at end of file From 11236130173bcd2974906d128394478690bb2309 Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Thu, 28 Aug 2025 15:53:47 -0700 Subject: [PATCH 09/13] Revert to Rust 1.88 --- .github/workflows/CI.yml | 9 +++++++-- forks/circom-compat/.cargo/.config.toml | 8 -------- 2 files changed, 7 insertions(+), 10 deletions(-) delete mode 100644 forks/circom-compat/.cargo/.config.toml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 22e18d59..b912c0d7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -28,6 +28,13 @@ jobs: - name: Check out the project uses: actions/checkout@v3 + - name: Install Rust 1.88 + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.88.0 + override: true + profile: minimal + - name: Set up Python uses: actions/setup-python@v4 with: @@ -37,8 +44,6 @@ jobs: run: | sudo apt update sudo apt install -y python3-pip nodejs - curl --proto '=https' --tlsv1.3 -sSf https://sh.rustup.rs | sh -s -- -y - source $HOME/.cargo/env pip install jwcrypto cbor2 git clone https://github.com/iden3/circom.git cd circom diff --git a/forks/circom-compat/.cargo/.config.toml b/forks/circom-compat/.cargo/.config.toml deleted file mode 100644 index 7ac2916e..00000000 --- a/forks/circom-compat/.cargo/.config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[target.x86_64-unknown-linux-gnu] -rustflags = ["-C", "no-probestack"] - -# This addresses the __rust_probestack issue introduced in Rust 1.89, -# where stack probing is required for large stack allocations to prevent stack overflows. -# wasmer-vn uses the __rust_probestack internal flag and needs to fix its usage. -# but we are stuck on wasmer 2.3.0 with this project. -# Upgrading to wasmer 6 causes massive errors \ No newline at end of file From f9f3be53d0ce664c52482f779159947ac01f00ec Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Thu, 28 Aug 2025 16:35:04 -0700 Subject: [PATCH 10/13] remove rust-toolchain files --- creds/rust-toolchain | 1 - forks/halo2curves/rust-toolchain | 1 - 2 files changed, 2 deletions(-) delete mode 100644 creds/rust-toolchain delete mode 100644 forks/halo2curves/rust-toolchain diff --git a/creds/rust-toolchain b/creds/rust-toolchain deleted file mode 100644 index 2bf5ad04..00000000 --- a/creds/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -stable diff --git a/forks/halo2curves/rust-toolchain b/forks/halo2curves/rust-toolchain deleted file mode 100644 index dc87e8af..00000000 --- a/forks/halo2curves/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -1.74.0 From 1b358b8ef149548e2101472bce2699309c5c0f17 Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Thu, 28 Aug 2025 19:58:52 -0700 Subject: [PATCH 11/13] add clippy to rust install --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b912c0d7..bbb95bc8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -34,6 +34,7 @@ jobs: toolchain: 1.88.0 override: true profile: minimal + components: clippy - name: Set up Python uses: actions/setup-python@v4 From 3f8d99ee0da45ece49f6076a3770fdc23148a00a Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Fri, 29 Aug 2025 11:46:25 -0700 Subject: [PATCH 12/13] rename crescent exe in CI --- .github/workflows/CI.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index bbb95bc8..d8836f22 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -101,85 +101,85 @@ jobs: - name: Run ZKSetup for rs256 run: | cd creds - cargo run --bin crescent --release --features print-trace zksetup --name rs256 + cargo run --bin crescent-cli --release --features print-trace zksetup --name rs256 - name: Run Prove for rs256 run: | cd creds - cargo run --bin crescent --release --features print-trace prove --name rs256 + cargo run --bin crescent-cli --release --features print-trace prove --name rs256 - name: Run Show for rs256 run: | cd creds - cargo run --bin crescent --release --features print-trace show --name rs256 + cargo run --bin crescent-cli --release --features print-trace show --name rs256 - name: Run Verify for rs256 run: | cd creds - cargo run --bin crescent --release --features print-trace verify --name rs256 + cargo run --bin crescent-cli --release --features print-trace verify --name rs256 # RS256-sd Commands - name: Run ZKSetup for rs256-sd run: | cd creds - cargo run --bin crescent --release --features print-trace zksetup --name rs256-sd + cargo run --bin crescent-cli --release --features print-trace zksetup --name rs256-sd - name: Run Prove for rs256-sd run: | cd creds - cargo run --bin crescent --release --features print-trace prove --name rs256-sd + cargo run --bin crescent-cli --release --features print-trace prove --name rs256-sd - name: Run Show for rs256-sd run: | cd creds - cargo run --bin crescent --release --features print-trace show --name rs256-sd + cargo run --bin crescent-cli --release --features print-trace show --name rs256-sd - name: Run Verify for rs256-sd run: | cd creds - cargo run --bin crescent --release --features print-trace verify --name rs256-sd + cargo run --bin crescent-cli --release --features print-trace verify --name rs256-sd # RS256-db Commands - name: Run ZKSetup for rs256-db run: | cd creds - cargo run --bin crescent --release --features print-trace zksetup --name rs256-db + cargo run --bin crescent-cli --release --features print-trace zksetup --name rs256-db - name: Run Prove for rs256-db run: | cd creds - cargo run --bin crescent --release --features print-trace prove --name rs256-db + cargo run --bin crescent-cli --release --features print-trace prove --name rs256-db - name: Run Show for rs256-db run: | cd creds - cargo run --bin crescent --release --features print-trace show --name rs256-db + cargo run --bin crescent-cli --release --features print-trace show --name rs256-db - name: Run Verify for rs256-db run: | cd creds - cargo run --bin crescent --release --features print-trace verify --name rs256-db + cargo run --bin crescent-cli --release --features print-trace verify --name rs256-db # mDL Commands - name: Run ZKSetup for mDL run: | cd creds - cargo run --bin crescent --release --features print-trace zksetup --name mdl1 + cargo run --bin crescent-cli --release --features print-trace zksetup --name mdl1 - name: Run Prove for mDL run: | cd creds - cargo run --bin crescent --release --features print-trace prove --name mdl1 + cargo run --bin crescent-cli --release --features print-trace prove --name mdl1 - name: Run Show for mDL run: | cd creds - cargo run --bin crescent --release --features print-trace show --name mdl1 + cargo run --bin crescent-cli --release --features print-trace show --name mdl1 - name: Run Verify for mDL run: | cd creds - cargo run --bin crescent --release --features print-trace verify --name mdl1 + cargo run --bin crescent-cli --release --features print-trace verify --name mdl1 # Build sample - name: Run the sample setup script From 8de01a0084bbcd847feee7c42fce10aff4c12eea Mon Sep 17 00:00:00 2001 From: Larry Joy Date: Fri, 29 Aug 2025 14:07:38 -0700 Subject: [PATCH 13/13] debug output for sample setup --- sample/setup-sample.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/sample/setup-sample.sh b/sample/setup-sample.sh index 5c1bf627..a35f69b2 100755 --- a/sample/setup-sample.sh +++ b/sample/setup-sample.sh @@ -7,6 +7,7 @@ # usage: setup-sample.sh set -euo pipefail +set -x cd "$(dirname "${BASH_SOURCE[0]}")" readonly CRESCENT_ENV=${CRESCENT_ENV:-release}