@@ -375,7 +375,8 @@ function prepare_backend_for_packaging() {
375375 chmod +x " $DIST_DIR /$PRODUCT_FOLDER /bootstrap/" * .sh 2> /dev/null || true
376376
377377 echo " === Ensuring server certificates exist in the distribution ==="
378- ensure_certificates " $DIST_DIR /$PRODUCT_FOLDER /$SECURITY_DIR "
378+ ensure_certificates " $DIST_DIR /$PRODUCT_FOLDER /$SECURITY_DIR " " server"
379+ ensure_certificates " $DIST_DIR /$PRODUCT_FOLDER /$SECURITY_DIR " " signing"
379380 echo " ================================================================"
380381
381382 echo " === Ensuring crypto file exists in the distribution ==="
@@ -449,7 +450,7 @@ function build_sample_app() {
449450 # Build React Vanilla sample
450451 echo " === Building React Vanilla sample app ==="
451452 echo " === Ensuring React Vanilla sample app certificates exist ==="
452- ensure_certificates " $VANILLA_SAMPLE_APP_DIR "
453+ ensure_certificates " $VANILLA_SAMPLE_APP_DIR " " server "
453454
454455 cd " $VANILLA_SAMPLE_APP_DIR " || exit 1
455456 echo " Installing React Vanilla sample dependencies..."
@@ -466,7 +467,7 @@ function build_sample_app() {
466467
467468 # Ensure certificates exist for React SDK sample
468469 echo " === Ensuring React SDK sample app certificates exist ==="
469- ensure_certificates " $REACT_SDK_SAMPLE_APP_DIR "
470+ ensure_certificates " $REACT_SDK_SAMPLE_APP_DIR " " server "
470471
471472 cd " $REACT_SDK_SAMPLE_APP_DIR " || exit 1
472473 echo " Installing React SDK sample dependencies..."
@@ -483,7 +484,7 @@ function build_sample_app() {
483484
484485 # Ensure certificates exist for React API-based sample
485486 echo " === Ensuring React API-based sample app certificates exist ==="
486- ensure_certificates " $REACT_API_SAMPLE_APP_DIR "
487+ ensure_certificates " $REACT_API_SAMPLE_APP_DIR " " server "
487488
488489 cd " $REACT_API_SAMPLE_APP_DIR " || exit 1
489490 echo " Installing React API-based sample dependencies..."
@@ -553,7 +554,7 @@ function package_vanilla_sample() {
553554
554555 # Ensure the certificates exist in the sample app directory
555556 echo " === Ensuring certificates exist in the React Vanilla sample distribution ==="
556- ensure_certificates " $DIST_DIR /$VANILLA_SAMPLE_APP_FOLDER "
557+ ensure_certificates " $DIST_DIR /$VANILLA_SAMPLE_APP_FOLDER " " server "
557558
558559 # Copy the appropriate startup script based on the target OS
559560 if [ " $SAMPLE_DIST_OS " = " win" ]; then
@@ -627,7 +628,7 @@ function package_react_api_based_sample() {
627628
628629 # Ensure the certificates exist in the sample app dist directory
629630 echo " === Ensuring certificates exist in the React API-based sample distribution ==="
630- ensure_certificates " $DIST_DIR /$REACT_API_SAMPLE_APP_FOLDER /dist"
631+ ensure_certificates " $DIST_DIR /$REACT_API_SAMPLE_APP_FOLDER /dist" " server "
631632
632633 # Copy the appropriate startup script based on the target OS
633634 if [ " $SAMPLE_DIST_OS " = " win" ]; then
@@ -826,16 +827,16 @@ function merge_coverage() {
826827
827828function ensure_certificates() {
828829 local cert_dir=$1
829- local cert_name_prefix=" server"
830+ local cert_name_prefix=${2 :- " server" } # Default to "server" if not specified
830831 local cert_file_name=" ${cert_name_prefix} .cert"
831832 local key_file_name=" ${cert_name_prefix} .key"
832833
833- # Generate certificate and key file if don't exists in the cert directory
834+ # Generate certificate and key file if they don't exist in the cert directory
834835 local local_cert_file=" ${LOCAL_CERT_DIR} /${cert_file_name} "
835836 local local_key_file=" ${LOCAL_CERT_DIR} /${key_file_name} "
836837 if [[ ! -f " $local_cert_file " || ! -f " $local_key_file " ]]; then
837838 mkdir -p " $LOCAL_CERT_DIR "
838- echo " Generating SSL certificates in $LOCAL_CERT_DIR ..."
839+ echo " Generating certificates ( ${cert_name_prefix} ) in $LOCAL_CERT_DIR ..."
839840 OPENSSL_ERR=$(
840841 openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
841842 -keyout " $local_key_file " \
@@ -844,12 +845,12 @@ function ensure_certificates() {
844845 > /dev/null 2>&1
845846 )
846847 if [[ $? -ne 0 ]]; then
847- echo " Error generating SSL certificates: $OPENSSL_ERR "
848+ echo " Error generating certificates: $OPENSSL_ERR "
848849 exit 1
849850 fi
850851 echo " Certificates generated successfully in $LOCAL_CERT_DIR ."
851852 else
852- echo " Certificates already exist in $LOCAL_CERT_DIR ."
853+ echo " Certificates ( ${cert_name_prefix} ) already exist in $LOCAL_CERT_DIR ."
853854 fi
854855
855856 # Copy the generated certificates to the specified directory
@@ -858,12 +859,12 @@ function ensure_certificates() {
858859
859860 if [[ ! -f " $cert_file " || ! -f " $key_file " ]]; then
860861 mkdir -p " $cert_dir "
861- echo " Copying certificates to $cert_dir ..."
862+ echo " Copying certificates ( ${cert_name_prefix} ) to $cert_dir ..."
862863 cp " $local_cert_file " " $cert_file "
863864 cp " $local_key_file " " $key_file "
864865 echo " Certificates copied successfully to $cert_dir ."
865866 else
866- echo " Certificates already exist in $cert_dir ."
867+ echo " Certificates ( ${cert_name_prefix} ) already exist in $cert_dir ."
867868 fi
868869}
869870
@@ -1005,11 +1006,12 @@ function run_backend() {
10051006 local show_final_output=${1:- true}
10061007
10071008 echo " === Ensuring server certificates exist ==="
1008- ensure_certificates " $BACKEND_DIR /$SECURITY_DIR "
1009+ ensure_certificates " $BACKEND_DIR /$SECURITY_DIR " " server"
1010+ ensure_certificates " $BACKEND_DIR /$SECURITY_DIR " " signing"
10091011
10101012 echo " === Ensuring sample app certificates exist ==="
1011- ensure_certificates " $VANILLA_SAMPLE_APP_DIR "
1012- ensure_certificates " $REACT_API_SAMPLE_APP_DIR "
1013+ ensure_certificates " $VANILLA_SAMPLE_APP_DIR " " server "
1014+ ensure_certificates " $REACT_API_SAMPLE_APP_DIR " " server "
10131015
10141016 ensure_crypto_file " $BACKEND_DIR /$SECURITY_DIR "
10151017
0 commit comments