Skip to content

Commit df911c2

Browse files
committed
Updated to latest ACA-Py version for compatibility and improvements
1 parent f9a72ae commit df911c2

File tree

22 files changed

+756
-350
lines changed

22 files changed

+756
-350
lines changed
Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
FROM node:22 as build
2-
COPY . .
1+
FROM node:22
2+
3+
WORKDIR /app
4+
5+
# Copy package.json and package-lock.json
6+
COPY package*.json ./
7+
8+
# Install dependencies
39
RUN npm install
4-
ENTRYPOINT [ "npm", "start" ]
10+
11+
# Copy the rest of the application files
12+
COPY . .
13+
14+
# Expose the port the app runs on
15+
EXPOSE 80
16+
17+
# Start the application
18+
CMD ["node", "app.js"]

AliceFaberAcmeDemo/controllers/acme-controller/app.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,11 @@ app.use(function(err, req, res, next) {
5454
res.render('error');
5555
});
5656

57+
// Start the server
58+
const PORT = process.env.PORT || 80;
59+
app.listen(PORT, () => {
60+
console.log(`Server is running on port ${PORT}`);
61+
});
62+
63+
5764
module.exports = app;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3'
2+
services:
3+
acme-controller:
4+
build: .
5+
ports:
6+
- "8140:80" # Expose a different port for the controller
7+
environment:
8+
- AGENT_HOST=host.docker.internal
9+
- AGENT_PORT=8040
10+
networks:
11+
- aca
12+
networks:
13+
aca:

AliceFaberAcmeDemo/controllers/acme-controller/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"ext": "js,json,hbs,css"
1111
},
1212
"dependencies": {
13+
"axios": "^1.8.3",
1314
"cookie-parser": "^1.4.7",
1415
"debug": "^2.6.9",
1516
"express": "^4.21.1",

AliceFaberAcmeDemo/controllers/acme-controller/routes/connection.js

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ async function handleNewConnectionPost(req, res, next) {
6464
const agentService = require('../services/AgentService');
6565

6666
const invitation = await agentService.createInvitation();
67+
console.log('Invitation Object:', invitation); // Debugging log
6768
if (invitation) {
6869
invitation.invitation = JSON.stringify(invitation.invitation, null, 4);
6970
}
@@ -103,18 +104,80 @@ async function handleAcceptConnectionGet(req, res, next) {
103104
});
104105
}
105106

107+
// async function handleAcceptConnectionPost(req, res, next) {
108+
// const agentService = require('../services/AgentService');
109+
110+
// const errors = validationResult(req);
111+
// if (!errors.isEmpty()) {
112+
// req.errors = errors.array({ onlyFirstError: true });
113+
// req.invitaion = req.body;
114+
// return next();
115+
// }
116+
117+
// const result=await agentService.receiveInvitation(req.body.invitation_object);
118+
// console.log(result);
119+
// res.status(201).redirect('/connections/active');
120+
// }
121+
122+
// async function handleAcceptConnectionPost(req, res, next) {
123+
// const agentService = require('../services/AgentService');
124+
125+
// const errors = validationResult(req);
126+
// if (!errors.isEmpty()) {
127+
// req.errors = errors.array({ onlyFirstError: true });
128+
// req.invitaion = req.body;
129+
// return next();
130+
// }
131+
132+
// await agentService.receiveInvitation(req.body.invitation_object);
133+
// res.status(201).redirect('/connections/active');
134+
// }
135+
136+
137+
// async function handleAcceptConnectionPost(req, res, next) {
138+
// const agentService = require('../services/AgentService');
139+
140+
// const errors = validationResult(req);
141+
// if (!errors.isEmpty()) {
142+
// req.errors = errors.array({ onlyFirstError: true });
143+
// req.invitation = req.body;
144+
// console.error('Validation errors:', req.errors); // Debugging log
145+
// return next();
146+
// }
147+
148+
// console.log('Received invitation object:', req.body.invitation_object); // Debugging log
149+
150+
// try {
151+
// const response = await agentService.receiveInvitation(req.body.invitation_object);
152+
// console.log('API response from receiveInvitation:', response); // Debugging log
153+
// res.status(201).redirect('/connections/active');
154+
// } catch (error) {
155+
// console.error('Error in handleAcceptConnectionPost:', error); // Debugging log
156+
// res.status(500).send('Failed to process invitation');
157+
// }
158+
// }
159+
106160
async function handleAcceptConnectionPost(req, res, next) {
107161
const agentService = require('../services/AgentService');
108162

109163
const errors = validationResult(req);
110164
if (!errors.isEmpty()) {
111165
req.errors = errors.array({ onlyFirstError: true });
112-
req.invitaion = req.body;
166+
req.invitation = req.body;
167+
console.error('Validation errors:', req.errors); // Debugging log
113168
return next();
114169
}
115170

116-
await agentService.receiveInvitation(req.body.invitation_object);
117-
res.status(201).redirect('/connections/active');
171+
console.log('Received invitation object:', req.body.invitation_object); // Debugging log
172+
173+
try {
174+
const response = await agentService.receiveInvitation(req.body.invitation_object);
175+
console.log('API response from receiveInvitation:', response); // Debugging log
176+
res.status(201).redirect('/connections/active');
177+
} catch (error) {
178+
console.error('Error in handleAcceptConnectionPost:', error); // Debugging log
179+
res.status(500).send('Failed to process invitation');
180+
}
118181
}
119182

120183
router.get('/:id/remove', async function (req, res, next) {

AliceFaberAcmeDemo/controllers/acme-controller/routes/proof.js

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,56 @@ navLinkService.registerCustomLinks([
1010
]);
1111

1212
const proofJSON = {
13+
"comment": "This is a comment about the reason for the proof",
1314
"connection_id": "<Enter a valid Connection ID>",
14-
"proof_request": {
15-
"name": "Proof of Education",
16-
"version": "1.0",
17-
"requested_attributes": {
18-
"0_name_uuid": {
19-
"name": "name",
20-
"restrictions": [
21-
{
22-
"cred_def_id": "<Enter a valid Credential Definition ID>"
15+
"presentation_request": {
16+
"indy": {
17+
"name": "Proof of Education",
18+
"version": "1.0",
19+
"requested_attributes": {
20+
"0_name_uuid": {
21+
"name": "name",
22+
"restrictions": [
23+
{
24+
"cred_def_id": "<Enter a valid Credential Definition ID>"
25+
}
26+
]
27+
},
28+
"0_date_uuid": {
29+
"name": "date",
30+
"restrictions": [
31+
{
32+
"cred_def_id": "<Enter a valid Credential Definition ID>"
33+
}
34+
]
35+
},
36+
"0_degree_uuid": {
37+
"name": "degree",
38+
"restrictions": [
39+
{
40+
"cred_def_id": "<Enter a valid Credential Definition ID>"
41+
}
42+
]
43+
},
44+
"0_self_attested_thing_uuid": {
45+
"name": "self_attested_thing"
46+
}
47+
},
48+
"requested_predicates": {
49+
"0_age_GE_uuid": {
50+
"name": "birthdate_dateint",
51+
"p_type": ">=",
52+
"p_value": 18,
53+
"restrictions": [
54+
{
55+
"cred_def_id": "<Enter a valid Credential Definition ID>"
56+
}
57+
]
58+
}
2359
}
24-
]
25-
},
26-
"0_date_uuid": {
27-
"name": "date",
28-
"restrictions": [
29-
{
30-
"cred_def_id": "<Enter a valid Credential Definition ID>"
31-
}
32-
]
33-
},
34-
"0_degree_uuid": {
35-
"name": "degree",
36-
"restrictions": [
37-
{
38-
"cred_def_id": "<Enter a valid Credential Definition ID>"
39-
}
40-
]
41-
},
42-
"0_self_attested_thing_uuid": {
43-
"name": "self_attested_thing"
44-
}
45-
},
46-
"requested_predicates": {
47-
"0_age_GE_uuid": {
48-
"name": "birthdate_dateint",
49-
"p_type": ">=",
50-
"p_value": 18,
51-
"restrictions": [
52-
{
53-
"cred_def_id": "<Enter a valid Credential Definition ID>"
54-
}
55-
]
5660
}
57-
}
5861
}
59-
}
62+
};
6063

6164
router.use(function (req, res, next) {
6265
navLinkService.clearLinkClasses();

0 commit comments

Comments
 (0)