Skip to content

Commit 4c466e4

Browse files
committed
Add a simple object to hold users, check yoti user ids against scouty status #4
1 parent 97378d4 commit 4c466e4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/routes/confirmation.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ const sdkId = "06f10391-1f16-4e1c-af6c-d6cd6a8714af";
66
const yotiPem = Fs.readFileSync(Path.join(__dirname, '../keys/yoti.pem'));
77
const yotiClient = new Yoti(sdkId, yotiPem);
88

9+
const users = {
10+
'fAUhmIxQAMxKd7pQ0mACongkiz3OpS1oqLfHpamEN7QT0CCuBy4DCsgzpUn9g87G': {
11+
name: 'John Whiles',
12+
status: true
13+
}
14+
}
15+
916
const confirmationHandler = (request, reply) => {
1017
const token = request.query.token;
1118
if(!token) {
@@ -15,8 +22,11 @@ const confirmationHandler = (request, reply) => {
1522
const promise = yotiClient.getActivityDetails(token);
1623
promise.then((activityDetails) => {
1724
const userId = activityDetails.getUserId();
18-
const profile = activityDetails.getUserProfile();
19-
reply(profile);
25+
if (users[userId].status === true) {
26+
reply('they are a good scout');
27+
} else {
28+
reply('not a good scout');
29+
}
2030
})
2131
};
2232

0 commit comments

Comments
 (0)