Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: AFJ Authentication #396

Merged
merged 175 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
db7f963
feat:added api key into ecosystem service
pallavighule Nov 24, 2023
2a5a306
feat:added api key inside sign transaction
pallavighule Nov 24, 2023
659f74d
refactor:API response
MoulikaKulkarni Dec 13, 2023
48b2ab0
Merge branch 'develop' of https://github.com/credebl/platform into ap…
MoulikaKulkarni Dec 13, 2023
3dfffa2
refactor:API response
MoulikaKulkarni Dec 14, 2023
5278e31
refactor:API response
MoulikaKulkarni Dec 14, 2023
e4dd8e6
chore:solved merged conflicts
pallavighule Dec 19, 2023
c1a90e3
Merge branch 'develop' of https://github.com/credebl/platform into Ag…
Dec 19, 2023
f6423d2
worked on the POST API of create schema refactoring
nishad-ayanworks Dec 19, 2023
c02c5b0
Handled negative scenarios for create schema
nishad-ayanworks Dec 20, 2023
bbc844e
cosmetic changes
nishad-ayanworks Dec 20, 2023
ccbb681
refactor:API response
MoulikaKulkarni Dec 20, 2023
57d054d
refactor:API response
MoulikaKulkarni Dec 20, 2023
d1bd078
refactor: sendNatsMessage function implementation
MoulikaKulkarni Dec 20, 2023
368aa9a
Added the token and store on the database
Dec 20, 2023
47f347d
handled agent errors in the schema service
nishad-ayanworks Dec 20, 2023
c30e9c6
Merge pull request #364 from credebl/354-refactor-ledger-service
vivekayanworks Dec 20, 2023
781884a
refactor:fetch user profile api
pranalidhanavade Dec 21, 2023
d6cae26
tested flow with token and checked cache
Dec 21, 2023
23f6ed7
refactor:users activity api
pranalidhanavade Dec 21, 2023
3dd3ee2
refactor: catch webhook connection response api
bhavanakarwade Dec 21, 2023
8de74f0
refactor interface names
bhavanakarwade Dec 21, 2023
bd51f77
Merge branch 'develop' of https://github.com/credebl/platform into Ag…
Dec 22, 2023
2e8a4f4
Merge branch 'develop' of https://github.com/credebl/platform into na…
nishad-ayanworks Dec 22, 2023
b4f8d97
worked on the fetch schemas by org
nishad-ayanworks Dec 22, 2023
e28af85
refactor: get connection details by connection id api
bhavanakarwade Dec 22, 2023
2ad881e
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
bhavanakarwade Dec 22, 2023
c6016bd
changes in the cred-def API
nishad-ayanworks Dec 22, 2023
bfd5ceb
Merge pull request #371 from credebl/354-schemas-by-org
nishad-ayanworks Dec 22, 2023
5429d1a
refactor: get all connections api
bhavanakarwade Dec 23, 2023
22a5c70
resolved sonarlint checks
bhavanakarwade Dec 23, 2023
71ea39a
fix:comments on user profile api
pranalidhanavade Dec 23, 2023
2ff012f
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
pranalidhanavade Dec 23, 2023
a55992d
fix:resolved comments of get user profile api
pranalidhanavade Dec 23, 2023
89baf0e
fix:resolved comments of get user profile api
pranalidhanavade Dec 23, 2023
4b8a8a5
refactor:user activity api summary and description
pranalidhanavade Dec 23, 2023
cf548b7
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
bhavanakarwade Dec 24, 2023
62f2df6
resolved comments
bhavanakarwade Dec 24, 2023
d227e59
refactor:email exist api
pranalidhanavade Dec 24, 2023
b0a6925
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
bhavanakarwade Dec 25, 2023
9e14b37
refactor: API agent health
Dec 25, 2023
0c8f00a
refactor: API create tenant
Dec 25, 2023
2139cb6
feat: delete organization invitation api
sanjay-k1910 Dec 26, 2023
1a7be17
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
sanjay-k1910 Dec 26, 2023
9bc2d7c
refactor: delete org invitation api
sanjay-k1910 Dec 26, 2023
63d0ca4
improve error handling
bhavanakarwade Dec 26, 2023
520166d
Worked on the GET API of credential definition by schema id
nishad-ayanworks Dec 26, 2023
5f4c39a
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
nishad-ayanworks Dec 26, 2023
db26e63
refactor: get connection details by connection id details
bhavanakarwade Dec 26, 2023
a49a85d
removed duplicate function
bhavanakarwade Dec 26, 2023
d560ce4
Merge pull request #368 from credebl/error-handling-of-user-module
vivekayanworks Dec 26, 2023
675a08a
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
bhavanakarwade Dec 26, 2023
d9c7466
removed optional fields from interface
bhavanakarwade Dec 26, 2023
93646fc
Merge pull request #372 from credebl/refactor-get-all-connections-api
vivekayanworks Dec 26, 2023
d583bdc
reafctor: create outbound connection API
bhavanakarwade Dec 26, 2023
005dda3
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
sanjay-k1910 Dec 26, 2023
04dfc64
refactor: response type
sanjay-k1910 Dec 26, 2023
fb0451e
resolved conflicts
bhavanakarwade Dec 26, 2023
f6b982c
Merge pull request #375 from credebl/feat-delete-org-invitations
vivekayanworks Dec 26, 2023
60a8dbb
refactor:verify-user-and-send-verification-mail-api
pranalidhanavade Dec 26, 2023
0d39f06
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
pranalidhanavade Dec 26, 2023
b48326a
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
nishad-ayanworks Dec 26, 2023
5eb9486
resolved conflicts
bhavanakarwade Dec 26, 2023
62795c7
Merge pull request #376 from credebl/354-schemas-by-org
vivekayanworks Dec 26, 2023
846969b
refactor: API agent spin-up
Dec 26, 2023
89491e2
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
Dec 26, 2023
b6c3276
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
Dec 26, 2023
898fca8
Changes in Response interface
Dec 26, 2023
e0659bb
resolved conflicts
bhavanakarwade Dec 26, 2023
f5bf53f
Changes on the comment in payload on the agent-service
Dec 26, 2023
9e0f535
Changes on the comment in payload on the agent-service
Dec 26, 2023
63a56c4
Changes on the comment in payload on the agent-service
Dec 26, 2023
c4b9a0a
Merge pull request #373 from credebl/API-agent-status
vivekayanworks Dec 26, 2023
20cd76b
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
Dec 26, 2023
e38398d
added parameters
bhavanakarwade Dec 26, 2023
37572f6
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
bhavanakarwade Dec 26, 2023
e0bafda
added comment for nats call
bhavanakarwade Dec 26, 2023
ef181a4
refactor:verify-user-and-send-verification-mail-api
pranalidhanavade Dec 26, 2023
f5c0d08
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
pranalidhanavade Dec 26, 2023
75965aa
refactor:verify-user-and-send-verification-mail-api
pranalidhanavade Dec 26, 2023
3f6f7f8
improved error handling for agent details
bhavanakarwade Dec 27, 2023
f15d4f1
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
bhavanakarwade Dec 27, 2023
39a4359
refactor interfaces
bhavanakarwade Dec 27, 2023
f96de9e
resolved:comments on code
pranalidhanavade Dec 27, 2023
8a67262
removed unwanted fields
bhavanakarwade Dec 27, 2023
9bdf0ec
Changes and solved the issue for the get org agent details related fu…
Dec 27, 2023
ef93f38
Merge pull request #370 from credebl/refactor-create-connection-api
vivekayanworks Dec 27, 2023
861b171
Merge pull request #377 from credebl/refactor-auth-module-api
vivekayanworks Dec 27, 2023
005a0fb
improve error handling for agent
bhavanakarwade Dec 27, 2023
32eb035
resolved conflicts
bhavanakarwade Dec 27, 2023
075b417
optimized data
bhavanakarwade Dec 27, 2023
2f6daa8
refactored response
bhavanakarwade Dec 27, 2023
b5ec57b
resolved conflicts
bhavanakarwade Dec 27, 2023
c660e29
Solved the conflicts as per comment
Dec 27, 2023
b46edab
Solved the conflicts as per comment
Dec 27, 2023
887369b
Merge pull request #374 from credebl/API-create-tenant
vivekayanworks Dec 27, 2023
0f7af0e
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
Dec 27, 2023
eda3786
Merge pull request #378 from credebl/get-conection-by-connectionid
vivekayanworks Dec 27, 2023
d908910
refactor:user-sign-in-and-sign-up-api
pranalidhanavade Dec 27, 2023
22c9980
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
pranalidhanavade Dec 27, 2023
9d15abd
refactor: issued credential list API
sanjay-k1910 Dec 27, 2023
4514dc5
refactor: issuance controller
sanjay-k1910 Dec 27, 2023
2358144
refactor:validations in dto
pranalidhanavade Dec 27, 2023
b66ff59
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
sanjay-k1910 Dec 27, 2023
4888cfc
Solved the query for the findFirst in get agent functionality
Dec 27, 2023
5b25aa4
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
Dec 27, 2023
f0c4745
Resolved comments
Dec 27, 2023
d7a4ef3
Merge pull request #379 from credebl/refactor-sign-in-sign-up-api
vivekayanworks Dec 27, 2023
41352c3
refactor: create connection url api
bhavanakarwade Dec 27, 2023
10300d7
resolved conflicts
bhavanakarwade Dec 27, 2023
f080852
refactored interfaces
bhavanakarwade Dec 27, 2023
20453a4
resolved conflicts
bhavanakarwade Dec 27, 2023
3e3d2eb
removed unnecessary fields
bhavanakarwade Dec 27, 2023
ed3c447
resolved eslint errors
bhavanakarwade Dec 27, 2023
dbd2153
refactored fields
bhavanakarwade Dec 27, 2023
eab25cd
resolved comments
bhavanakarwade Dec 27, 2023
970fedb
Merge pull request #382 from credebl/create-outbound-legacy-invitation
vivekayanworks Dec 27, 2023
83d7ff3
refactor:user exist api
pranalidhanavade Dec 27, 2023
5da26ea
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
pranalidhanavade Dec 27, 2023
a2e0e06
refactor: webhook proof presentation api
bhavanakarwade Dec 28, 2023
48d2f96
refactored fucntionality
bhavanakarwade Dec 28, 2023
7cdfe02
Resolved comments for error messages
Dec 28, 2023
f9a2a37
Merge pull request #381 from credebl/API-agent-spinup
vivekayanworks Dec 28, 2023
cc0fa59
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
Dec 28, 2023
8df1212
Added interface for the agent-service
Dec 28, 2023
5b10295
Common error function handling
Dec 28, 2023
9f73e8e
Common nats internal function
Dec 28, 2023
f0ea3b1
refactor: get all proof presentations api
bhavanakarwade Dec 28, 2023
6303f08
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
bhavanakarwade Dec 28, 2023
6dd2345
Solved duplicated code
Dec 28, 2023
78e68a4
Solved duplicated code
Dec 28, 2023
0ee8f61
Solved duplicated code
Dec 28, 2023
50f19f7
refactor interface fields
bhavanakarwade Dec 28, 2023
da8246a
Solved duplicated code
Dec 28, 2023
eaa840f
refactor interface
bhavanakarwade Dec 28, 2023
267b130
Solved duplicated code
Dec 28, 2023
e28d83d
Add await for the oob proof request
Dec 28, 2023
ea97846
Resolve the sonar lint issue on the verification service
Dec 28, 2023
ae0ce46
Merge pull request #384 from credebl/refactor-get-all-proof-presentat…
vivekayanworks Dec 28, 2023
0e0b935
Resolve the sonar lint duplication issuue on the verification service
Dec 28, 2023
3e4fc79
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
Dec 28, 2023
b8f4748
resolved conflicts
bhavanakarwade Dec 28, 2023
5bf51b1
Resolved the comments
Dec 28, 2023
0f5f344
refactored response messages
bhavanakarwade Dec 28, 2023
94515d7
refactored response messages
bhavanakarwade Dec 28, 2023
a94917b
Merge pull request #383 from credebl/Agent-Authentication
vivekayanworks Dec 28, 2023
9a9ca87
refactor:platform settings api and user credentials api
pranalidhanavade Dec 28, 2023
426efe2
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
pranalidhanavade Dec 28, 2023
797ee0e
Merge pull request #385 from credebl/webhook-proof-presentation
vivekayanworks Dec 28, 2023
4d5f054
Merge pull request #380 from credebl/refactor-issuance
vivekayanworks Dec 28, 2023
f549285
refactor:check user exist api flags
pranalidhanavade Dec 28, 2023
499ab80
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
pranalidhanavade Dec 28, 2023
32145fc
Changes the path for the port-file
Dec 28, 2023
ce82d94
Merge pull request #387 from credebl/Agent-Authentication
Sheetal-ayanworks Dec 28, 2023
ebaad15
Create token folder for the agent
Dec 28, 2023
0c1bc6c
Merge pull request #388 from credebl/Agent-Authentication
Sheetal-ayanworks Dec 28, 2023
a3e14a9
refactor:get organization invitations api
pranalidhanavade Dec 28, 2023
1e1cb9a
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
pranalidhanavade Dec 28, 2023
c8bff2e
Merge pull request #386 from credebl/refactor-user-org-invitation-api
vivekayanworks Dec 28, 2023
89dbe89
refactor:user profile api
pranalidhanavade Dec 28, 2023
b59b377
refactor:user profile api
pranalidhanavade Dec 28, 2023
ca3d3f5
refactor:user profile update message
pranalidhanavade Dec 28, 2023
c3ef4c7
refactor:user profile update
pranalidhanavade Dec 28, 2023
3fe451e
Merge pull request #389 from credebl/refactor-user-profile-and-passwo…
vivekayanworks Dec 29, 2023
d82af87
fix: create service name random in shell script
Dec 29, 2023
4c0a0c5
Merge branch 'nats-refactor' of https://github.com/credebl/platform i…
Dec 29, 2023
9845b49
fix:get user details api
pranalidhanavade Dec 29, 2023
5c7d0db
Merge pull request #392 from credebl/refactor-user-profile-and-passwo…
vivekayanworks Dec 29, 2023
4754574
Solved issue regarding the sonar lint
Dec 29, 2023
376c5a4
Merge pull request #393 from credebl/Agent-Authentication
KulkarniShashank Dec 29, 2023
c56a543
Solved issue in dockerfile.agent-provisioning
Dec 29, 2023
efa24be
Solved issue in dockerfile.agent-provisioning
Dec 29, 2023
0587a53
Merge pull request #395 from credebl/solved-dockerfile-agent-provisio…
Sheetal-ayanworks Dec 29, 2023
ba03b93
Merge pull request #394 from credebl/nats-refactor
nishad-ayanworks Dec 29, 2023
1ba7334
Merge branch 'develop' of https://github.com/credebl/platform into de…
nishad-ayanworks Dec 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ libs/prisma-service/prisma/data/credebl-master-table.json
uploadedFles/exports
uploadedFles/import
uploadedFles/export
nats-server.conf
nats-server.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Stage 1: Build the application
FROM node:18-alpine as build
RUN npm install -g pnpm
# RUN npm install -g pnpm
# Install AWS CLI
# RUN apk update
# RUN apk add openssh-client
# RUN apk update
# RUN apk add aws-cli
RUN npm install -g pnpm --ignore-scripts \
&& apk update \
&& apk add openssh-client \
&& apk add aws-cli

# Set the working directory
WORKDIR /app
Expand All @@ -23,24 +32,35 @@ RUN pnpm run build agent-provisioning

# Stage 2: Create the final image
FROM node:18-alpine as prod
# Install AWS CLI
# RUN apk update
# RUN apk add openssh-client
# RUN apk update
# RUN apk add aws-cli
RUN npm install -g pnpm --ignore-scripts \
&& apk update \
&& apk add openssh-client \
&& apk add aws-cli

WORKDIR /app
RUN npm install -g pnpm

RUN mkdir -p ./agent-provisioning/AFJ/endpoints
RUN mkdir -p ./agent-provisioning/AFJ/agent-config
RUN mkdir -p ./agent-provisioning/AFJ/port-file
RUN mkdir -p ./agent-provisioning/AFJ/token

# Copy the compiled code
COPY --from=build /app/dist/apps/agent-provisioning/ ./dist/apps/agent-provisioning/
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/apps/agent-provisioning/AFJ/scripts ./agent-provisioning/AFJ/scripts
COPY --from=build /app/apps/agent-provisioning/AFJ/port-files ./agent-provisioning/AFJ/port-file
COPY --from=build /app/apps/agent-provisioning/AFJ/port-file ./agent-provisioning/AFJ/port-file

# Set permissions
RUN chmod +x /app/agent-provisioning/AFJ/scripts/start_agent.sh
RUN chmod +x /app/agent-provisioning/AFJ/scripts/start_agent_ecs.sh
RUN chmod 777 /app/agent-provisioning/AFJ/endpoints
RUN chmod 777 /app/agent-provisioning/AFJ/agent-config

RUN chmod 777 /app/agent-provisioning/AFJ/token
# Copy the libs folder
COPY libs/ ./libs/

Expand Down
49 changes: 42 additions & 7 deletions apps/agent-provisioning/AFJ/scripts/start_agent.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

START_TIME=$(date +%s)

AGENCY=$1
Expand Down Expand Up @@ -76,12 +78,25 @@ else
mkdir ${PWD}/apps/agent-provisioning/AFJ/endpoints
fi

docker build . -t $AFJ_VERSION -f apps/agent-provisioning/AFJ/afj-controller/Dockerfile
if [ -d "${PWD}/apps/agent-provisioning/AFJ/agent-config" ]; then
echo "Endpoints directory exists."
else
echo "Error: Endpoints directory does not exists."
mkdir ${PWD}/apps/agent-provisioning/AFJ/agent-config
fi

AGENT_ENDPOINT="${PROTOCOL}://${EXTERNAL_IP}:${INBOUND_PORT}"

echo "-----$AGENT_ENDPOINT----"
cat <<EOF >>${PWD}/apps/agent-provisioning/AFJ/agent-config/${AGENCY}_${CONTAINER_NAME}.json
CONFIG_FILE="${PWD}/apps/agent-provisioning/AFJ/agent-config/${AGENCY}_${CONTAINER_NAME}.json"

# Check if the file exists
if [ -f "$CONFIG_FILE" ]; then
# If it exists, remove the file
rm "$CONFIG_FILE"
fi

cat <<EOF >>${CONFIG_FILE}
{
"label": "${AGENCY}_${CONTAINER_NAME}",
"walletId": "$WALLET_NAME",
Expand Down Expand Up @@ -117,7 +132,15 @@ cat <<EOF >>${PWD}/apps/agent-provisioning/AFJ/agent-config/${AGENCY}_${CONTAINE
EOF

FILE_NAME="docker-compose_${AGENCY}_${CONTAINER_NAME}.yaml"
cat <<EOF >>${PWD}/apps/agent-provisioning/AFJ/${FILE_NAME}

DOCKER_COMPOSE="${PWD}/apps/agent-provisioning/AFJ/${FILE_NAME}"

# Check if the file exists
if [ -f "$DOCKER_COMPOSE" ]; then
# If it exists, remove the file
rm "$DOCKER_COMPOSE"
fi
cat <<EOF >>${DOCKER_COMPOSE}
version: '3'

services:
Expand Down Expand Up @@ -152,7 +175,7 @@ if [ $? -eq 0 ]; then
echo "container-name::::::${CONTAINER_NAME}"
echo "file-name::::::$FILE_NAME"

docker-compose -f $FILE_NAME --project-name ${AGENCY}_${CONTAINER_NAME} up -d
docker compose -f $FILE_NAME up -d
if [ $? -eq 0 ]; then

n=0
Expand All @@ -177,10 +200,22 @@ if [ $? -eq 0 ]; then
done

echo "Creating agent config"
cat <<EOF >>${PWD}/endpoints/${AGENCY}_${CONTAINER_NAME}.json
ENDPOINT="${PWD}/endpoints/${AGENCY}_${CONTAINER_NAME}.json"

# Check if the file exists
if [ -f "$ENDPOINT" ]; then
# If it exists, remove the file
rm "$ENDPOINT"
fi
cat <<EOF >>${ENDPOINT}
{
"CONTROLLER_ENDPOINT":"${EXTERNAL_IP}:${ADMIN_PORT}"
}
EOF

cat <<EOF >>${PWD}/token/${AGENCY}_${CONTAINER_NAME}.json
{
"CONTROLLER_ENDPOINT":"${EXTERNAL_IP}:${ADMIN_PORT}",
"AGENT_ENDPOINT" : "${INTERNAL_IP}:${ADMIN_PORT}"
"token" : "$token"
}
EOF
echo "Agent config created"
Expand Down
28 changes: 23 additions & 5 deletions apps/agent-provisioning/AFJ/scripts/start_agent_ecs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,22 @@ S3_BUCKET_ARN=${18}
CLUSTER_NAME=${19}
TESKDEFINITION_FAMILY=${20}

SERVICE_NAME="${AGENCY}-${CONTAINER_NAME}-service"
DESIRED_COUNT=1

generate_random_string() {
echo "$(date +%s%N | sha256sum | base64 | head -c 12)"
}

# Call the function to generate a random string
random_string=$(generate_random_string)

# Print the generated random string
echo "Random String: $random_string"

SERVICE_NAME="${AGENCY}-${CONTAINER_NAME}-service-${random_string}"
EXTERNAL_IP=$(echo "$2" | tr -d '[:space:]')
ADMIN_PORT_FILE="$PWD/apps/agent-provisioning/AFJ/port-file/last-admin-port.txt"
INBOUND_PORT_FILE="$PWD/apps/agent-provisioning/AFJ/port-file/last-inbound-port.txt"
ADMIN_PORT_FILE="$PWD/agent-provisioning/AFJ/port-file/last-admin-port.txt"
INBOUND_PORT_FILE="$PWD/agent-provisioning/AFJ/port-file/last-inbound-port.txt"
ADMIN_PORT=8001
INBOUND_PORT=9001

Expand Down Expand Up @@ -80,7 +91,7 @@ echo "AGENT SPIN-UP STARTED"

AGENT_ENDPOINT="${PROTOCOL}://${EXTERNAL_IP}:${INBOUND_PORT}"

cat <<EOF >>/app/agent-provisioning/AFJ/agent-config/${AGENCY}_${CONTAINER_NAME}.json
cat <<EOF >/app/agent-provisioning/AFJ/agent-config/${AGENCY}_${CONTAINER_NAME}.json
{
"label": "${AGENCY}_${CONTAINER_NAME}",
"walletId": "$WALLET_NAME",
Expand Down Expand Up @@ -233,12 +244,19 @@ if [ $? -eq 0 ]; then
done

echo "Creating agent config"
cat <<EOF >>${PWD}/agent-provisioning/AFJ/endpoints/${AGENCY}_${CONTAINER_NAME}.json
cat <<EOF >${PWD}/agent-provisioning/AFJ/endpoints/${AGENCY}_${CONTAINER_NAME}.json
{
"CONTROLLER_ENDPOINT":"${EXTERNAL_IP}:${ADMIN_PORT}",
"AGENT_ENDPOINT" : "${INTERNAL_IP}:${ADMIN_PORT}"
}
EOF

cat <<EOF >${PWD}/agent-provisioning/AFJ/token/${AGENCY}_${CONTAINER_NAME}.json
{
"token" : ""
}
EOF

echo "Agent config created"
else
echo "==============="
Expand Down
15 changes: 9 additions & 6 deletions apps/agent-provisioning/src/agent-provisioning.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,24 @@
try {

const { containerName, externalIp, orgId, seed, walletName, walletPassword, walletStorageHost, walletStoragePassword, walletStoragePort, walletStorageUser, webhookEndpoint, agentType, protocol, afjVersion, tenant, indyLedger } = payload;

if (agentType === AgentType.AFJ) {
// The wallet provision command is used to invoke a shell script
const walletProvision = `${process.cwd() + process.env.AFJ_AGENT_SPIN_UP
} ${orgId} "${externalIp}" "${walletName}" "${walletPassword}" ${seed} ${webhookEndpoint} ${walletStorageHost} ${walletStoragePort} ${walletStorageUser} ${walletStoragePassword} ${containerName} ${protocol} ${tenant} ${afjVersion} ${indyLedger} ${process.env.AGENT_HOST} ${process.env.AWS_ACCOUNT_ID} ${process.env.S3_BUCKET_ARN} ${process.env.CLUSTER_NAME} ${process.env.TESKDEFINITION_FAMILY}`;

const walletProvision = `${process.cwd() + process.env.AFJ_AGENT_SPIN_UP} ${orgId} "${externalIp}" "${walletName}" "${walletPassword}" ${seed} ${webhookEndpoint} ${walletStorageHost} ${walletStoragePort} ${walletStorageUser} ${walletStoragePassword} ${containerName} ${protocol} ${tenant} ${afjVersion} ${indyLedger} ${process.env.AGENT_HOST} ${process.env.AWS_ACCOUNT_ID} ${process.env.S3_BUCKET_ARN} ${process.env.CLUSTER_NAME} ${process.env.TESKDEFINITION_FAMILY}`;
const spinUpResponse: object = new Promise(async (resolve) => {

await exec(walletProvision, async (err, stdout, stderr) => {

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium

This shell command depends on an uncontrolled
absolute path
.
this.logger.log(`shell script output: ${stdout}`);
if (stderr) {
this.logger.log(`shell script error: ${stderr}`);
}
const agentEndPoint: string = await fs.readFileSync(`${process.env.PWD}${process.env.AFJ_AGENT_ENDPOINT_PATH}${orgId}_${containerName}.json`, 'utf8');
resolve(agentEndPoint);

const agentEndPoint = await fs.readFileSync(`${process.cwd()}${process.env.AFJ_AGENT_ENDPOINT_PATH}${orgId}_${containerName}.json`, 'utf8');
const agentToken = await fs.readFileSync(`${process.cwd()}${process.env.AFJ_AGENT_TOKEN_PATH}${orgId}_${containerName}.json`, 'utf8');

resolve({
agentEndPoint: JSON.parse(agentEndPoint).CONTROLLER_ENDPOINT,
agentToken: JSON.parse(agentToken).token
});
});
});
return spinUpResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface IWalletProvision {
protocol: string;
afjVersion: string;
tenant: boolean;
apiKey?:string;
}

export interface IAgentSpinUp {
Expand Down
Loading
Loading