@velocitycareerlabs/server-webwallet 1.27.0-dev-build.12eb00e9e → 1.27.0-dev-build.1855c66b1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +24 -24
- package/src/controllers/accounts/autohooks.js +1 -1
- package/src/controllers/accounts/controller.js +6 -8
- package/src/controllers/consent/controller.js +4 -4
- package/src/controllers/credentials/autohooks.js +0 -2
- package/src/controllers/credentials/controller.js +6 -6
- package/src/controllers/disclosures/autohooks.js +2 -3
- package/src/controllers/disclosures/controller.js +14 -14
- package/src/controllers/feedback/controller.js +1 -1
- package/src/controllers/feeds/autohooks.js +2 -3
- package/src/controllers/feeds/controller.js +11 -11
- package/src/controllers/issuing/deep-link/autohooks.js +6 -7
- package/src/controllers/issuing/deep-link/controller.js +17 -19
- package/src/controllers/issuing/identity-credentials/autohooks.js +4 -6
- package/src/controllers/issuing/identity-credentials/controller.js +13 -14
- package/src/controllers/linkedin/controller.js +15 -15
- package/src/controllers/root/controller.js +2 -2
- package/src/entities/accounts/domains/validate-logo-size.js +1 -1
- package/src/entities/accounts/repos/accounts.repo.js +1 -1
- package/src/entities/credentials/orchestrators/load-additional-render-info.js +11 -14
- package/src/entities/credentials/repos/credentials.repo.js +9 -12
- package/src/entities/disclosures/repos/disclosures.repo.js +9 -12
- package/src/entities/feeds/orchestrators/feedsService.js +12 -14
- package/src/entities/feeds/repos/feeds.repo.js +9 -12
- package/src/entities/issuing/domain/does-user-have-fresh-pending-verification.js +1 -1
- package/src/entities/issuing/orchestrators/build-issuing-input-credentials.js +5 -3
- package/src/entities/issuing/orchestrators/generate-offers-by-deep-link.js +5 -5
- package/src/entities/issuing/orchestrators/get-identity-issuer.js +3 -4
- package/src/entities/issuing/orchestrators/get-identity-offers-by-deeplink.js +6 -6
- package/src/fetchers/career-wallet/create-did-fetcher.js +1 -1
- package/src/fetchers/career-wallet/get-app-config.js +1 -1
- package/src/fetchers/career-wallet/get-consents.js +1 -1
- package/src/fetchers/career-wallet/get-credential-categories.js +1 -1
- package/src/fetchers/career-wallet/post-consent.js +1 -1
- package/src/fetchers/career-wallet/verify-id-credential-confirm-code.js +2 -2
- package/src/fetchers/career-wallet/verify-id-credential-request-code.js +2 -2
- package/src/fetchers/credverify/remove-credentials.js +2 -2
- package/src/fetchers/lib-api/get-credential-display-schema.js +1 -1
- package/src/fetchers/linkedin/create-linkedin-post.js +2 -2
- package/src/fetchers/linkedin/get-access-token.js +3 -3
- package/src/fetchers/linkedin/get-linkedin-user-email.js +1 -1
- package/src/fetchers/linkedin/get-linkedin-user-id.js +1 -1
- package/src/fetchers/linkedin/register-image-to-upload.js +2 -2
- package/src/fetchers/linkedin/revoke-linkedin-access.js +3 -3
- package/src/fetchers/linkedin/upload-image-to-linkedin.js +1 -1
- package/src/init-server.js +4 -4
- package/src/plugins/crypto-services/jwt-sign-service-impl.js +2 -2
- package/src/plugins/crypto-services/key-service-impl.js +1 -1
- package/src/plugins/fetch-errors-handler-plugin.js +2 -1
- package/src/plugins/vnf-sdk-plugin.js +2 -2
- package/test/accounts-controller.test.js +7 -8
- package/test/consent-controller.test.js +0 -1
- package/test/credentials-controller.test.js +6 -8
- package/test/crypro-services/jwt-sign-service-impl.test.js +6 -6
- package/test/crypro-services/jwt-verify-service-impl.test.js +1 -3
- package/test/crypro-services/key-service-impl.test.js +2 -2
- package/test/disclosures-controller/disclosure-credentials.test.js +23 -25
- package/test/disclosures-controller/disclosures.test.js +5 -6
- package/test/disclosures-controller/mocks/presentation-request.js +1 -1
- package/test/disclosures-controller/mocks/presentation-submission.js +1 -2
- package/test/disclosures-controller/mocks/submission-result.js +2 -2
- package/test/factories/accounts.js +15 -18
- package/test/factories/credentials.js +54 -57
- package/test/factories/disclosures.js +93 -97
- package/test/factories/feeds.js +91 -94
- package/test/feedback-controller.test.js +0 -1
- package/test/feeds-controller.test.js +3 -3
- package/test/fetch-errors-handler-plugin.test.js +3 -5
- package/test/filter-deleted-credentials-extension.test.js +4 -4
- package/test/helpers/nock-linkedin-image-register.js +1 -1
- package/test/helpers/nock-linkedin-me.js +1 -1
- package/test/helpers/webwallet-build-fastify.js +1 -1
- package/test/issuing-controller/issuing-by-deeplink-empty-offers.test.js +10 -13
- package/test/issuing-controller/issuing-by-deeplink-failed-offers.test.js +9 -11
- package/test/issuing-controller/issuing-by-deeplink.test.js +29 -29
- package/test/issuing-controller/issuing-identity-credentials.test.js +17 -24
- package/test/issuing-controller/mocks/accept-offers-response.js +0 -1
- package/test/issuing-controller/mocks/credential-manifest.js +1 -2
- package/test/issuing-controller/mocks/offers.js +1 -1
- package/test/linkedin-controller.test.js +7 -10
- package/test/root.test.js +1 -1
- package/test/vcl-sdk-plugin.test.js +2 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velocitycareerlabs/server-webwallet",
|
|
3
|
-
"version": "1.27.0-dev-build.
|
|
3
|
+
"version": "1.27.0-dev-build.1855c66b1",
|
|
4
4
|
"description": "Web Wallet application",
|
|
5
5
|
"repository": "https://github.com/velocitycareerlabs/packages",
|
|
6
6
|
"engines": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"start:dev": "nodemon src/standalone.js",
|
|
16
16
|
"start:debug": "nodemon --inspect src/standalone.js",
|
|
17
17
|
"lint": "eslint . --format json >> eslint.json",
|
|
18
|
-
"lint:fix": "eslint --fix
|
|
18
|
+
"lint:fix": "eslint --fix.",
|
|
19
19
|
"migrate:status": "./node_modules/.bin/migrate-mongo status --file migrate-mongo.config.js",
|
|
20
20
|
"migrate:create": "./node_modules/.bin/migrate-mongo create --file migrate-mongo.config.js",
|
|
21
21
|
"migrate:up": "./node_modules/.bin/migrate-mongo up --file migrate-mongo.config.js",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"@fastify/swagger": "^9.0.0",
|
|
35
35
|
"@fastify/swagger-ui": "^5.0.0",
|
|
36
36
|
"@spencejs/spence-mongo-repos": "^0.10.2",
|
|
37
|
-
"@velocitycareerlabs/migrations": "1.27.0-dev-build.
|
|
38
|
-
"@verii/auth": "1.1.0-pre.
|
|
39
|
-
"@verii/common-functions": "1.1.0-pre.
|
|
40
|
-
"@verii/common-schemas": "1.1.0-pre.
|
|
41
|
-
"@verii/config": "1.1.0-pre.
|
|
42
|
-
"@verii/fastify-plugins": "1.1.0-pre.
|
|
43
|
-
"@verii/http-client": "1.1.0-pre.
|
|
44
|
-
"@verii/jwt": "1.1.0-pre.
|
|
45
|
-
"@verii/server-provider": "1.1.0-pre.
|
|
46
|
-
"@verii/vc-checks": "1.1.0-pre.
|
|
47
|
-
"@verii/vnf-nodejs-wallet-sdk": "1.1.0-pre.
|
|
37
|
+
"@velocitycareerlabs/migrations": "1.27.0-dev-build.1855c66b1",
|
|
38
|
+
"@verii/auth": "1.1.0-pre.1770700226",
|
|
39
|
+
"@verii/common-functions": "1.1.0-pre.1770700226",
|
|
40
|
+
"@verii/common-schemas": "1.1.0-pre.1770700226",
|
|
41
|
+
"@verii/config": "1.1.0-pre.1770700226",
|
|
42
|
+
"@verii/fastify-plugins": "1.1.0-pre.1770700226",
|
|
43
|
+
"@verii/http-client": "1.1.0-pre.1770700226",
|
|
44
|
+
"@verii/jwt": "1.1.0-pre.1770700226",
|
|
45
|
+
"@verii/server-provider": "1.1.0-pre.1770700226",
|
|
46
|
+
"@verii/vc-checks": "1.1.0-pre.1770700226",
|
|
47
|
+
"@verii/vnf-nodejs-wallet-sdk": "1.1.0-pre.1770700226",
|
|
48
48
|
"blueimp-md5": "2.19.0",
|
|
49
49
|
"env-var": "^7.0.0",
|
|
50
50
|
"fastify": "^5.0.0",
|
|
@@ -57,22 +57,22 @@
|
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@spencejs/spence-factories": "0.10.2",
|
|
60
|
-
"@verii/crypto": "1.1.0-pre.
|
|
61
|
-
"@verii/tests-helpers": "1.1.0-pre.
|
|
60
|
+
"@verii/crypto": "1.1.0-pre.1770700226",
|
|
61
|
+
"@verii/tests-helpers": "1.1.0-pre.1770700226",
|
|
62
62
|
"dotenv": "16.6.1",
|
|
63
|
-
"eslint": "
|
|
64
|
-
"eslint-config-airbnb-base": "
|
|
65
|
-
"eslint-config-prettier": "
|
|
66
|
-
"eslint-plugin-autofix": "
|
|
67
|
-
"eslint-plugin-better-mutation": "1.
|
|
63
|
+
"eslint": "9.29.0",
|
|
64
|
+
"eslint-config-airbnb-base": "15.0.0",
|
|
65
|
+
"eslint-config-prettier": "10.1.8",
|
|
66
|
+
"eslint-plugin-autofix": "2.2.0",
|
|
67
|
+
"eslint-plugin-better-mutation": "2.1.0",
|
|
68
68
|
"eslint-plugin-import": "2.32.0",
|
|
69
69
|
"eslint-plugin-prefer-arrow-functions": "3.6.2",
|
|
70
|
-
"eslint-plugin-prettier": "
|
|
71
|
-
"eslint-watch": "
|
|
70
|
+
"eslint-plugin-prettier": "5.5.5",
|
|
71
|
+
"eslint-watch": "8.0.0",
|
|
72
72
|
"expect": "30.2.0",
|
|
73
73
|
"nock": "v15.0.0-beta.6",
|
|
74
74
|
"nodemon": "3.1.11",
|
|
75
|
-
"prettier": "
|
|
75
|
+
"prettier": "3.8.1"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "fd86e9b81abf073929994a43100694f30cd97bd6"
|
|
78
78
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const { oauthPlugin } = require('@verii/auth');
|
|
2
|
+
const { extractAuth0IdTokenOrAccessToken } = require('../../entities');
|
|
2
3
|
const {
|
|
3
4
|
webWalletAccountsRequestSchema,
|
|
4
5
|
webWalletAccountsResponseSchema,
|
|
5
6
|
webWalletAccountsUpdateRequestSchema,
|
|
6
7
|
webwalletTestPersonasResponceSchema,
|
|
7
8
|
} = require('./schemas');
|
|
8
|
-
const { extractAuth0IdTokenOrAccessToken } = require('../../entities');
|
|
9
9
|
|
|
10
10
|
module.exports = async (fastify) => {
|
|
11
11
|
fastify.register(oauthPlugin, {
|
|
@@ -53,12 +53,12 @@ const accountsController = async (fastify) => {
|
|
|
53
53
|
const accountDidData = await buildDidData(
|
|
54
54
|
didKeyMetadatum,
|
|
55
55
|
accessToken,
|
|
56
|
-
req
|
|
56
|
+
req,
|
|
57
57
|
);
|
|
58
58
|
const initialCredentialsToInsert = getCredentialsFromOffers(
|
|
59
59
|
userId,
|
|
60
60
|
accountDidData.did,
|
|
61
|
-
initialCredentials
|
|
61
|
+
initialCredentials,
|
|
62
62
|
);
|
|
63
63
|
const [account] = await Promise.all([
|
|
64
64
|
repos.accounts.insert({
|
|
@@ -74,7 +74,7 @@ const accountsController = async (fastify) => {
|
|
|
74
74
|
]);
|
|
75
75
|
|
|
76
76
|
return { account };
|
|
77
|
-
}
|
|
77
|
+
},
|
|
78
78
|
);
|
|
79
79
|
|
|
80
80
|
fastify.patch(
|
|
@@ -117,13 +117,13 @@ const accountsController = async (fastify) => {
|
|
|
117
117
|
|
|
118
118
|
const account = await repos.accounts.update(
|
|
119
119
|
existingAccount._id,
|
|
120
|
-
req.body.account
|
|
120
|
+
req.body.account,
|
|
121
121
|
);
|
|
122
122
|
|
|
123
123
|
return {
|
|
124
124
|
account,
|
|
125
125
|
};
|
|
126
|
-
}
|
|
126
|
+
},
|
|
127
127
|
);
|
|
128
128
|
|
|
129
129
|
fastify.get(
|
|
@@ -141,9 +141,7 @@ const accountsController = async (fastify) => {
|
|
|
141
141
|
},
|
|
142
142
|
}),
|
|
143
143
|
},
|
|
144
|
-
async (req) =>
|
|
145
|
-
return getPersonas(req);
|
|
146
|
-
}
|
|
144
|
+
async (req) => getPersonas(req),
|
|
147
145
|
);
|
|
148
146
|
};
|
|
149
147
|
|
|
@@ -3,8 +3,8 @@ const {
|
|
|
3
3
|
postConsent,
|
|
4
4
|
getConsentLatest,
|
|
5
5
|
} = require('../../fetchers/career-wallet');
|
|
6
|
-
const { webWalletConsentResponseSchema } = require('./schemas');
|
|
7
6
|
const { WebWalletServerError } = require('../../errors/error-codes');
|
|
7
|
+
const { webWalletConsentResponseSchema } = require('./schemas');
|
|
8
8
|
|
|
9
9
|
const consentController = async (fastify) => {
|
|
10
10
|
fastify.get(
|
|
@@ -41,11 +41,11 @@ const consentController = async (fastify) => {
|
|
|
41
41
|
|
|
42
42
|
const consents = await getConsentLatest(
|
|
43
43
|
account.careerWalletAccountId,
|
|
44
|
-
req
|
|
44
|
+
req,
|
|
45
45
|
);
|
|
46
46
|
reply.status(200);
|
|
47
47
|
return consents;
|
|
48
|
-
}
|
|
48
|
+
},
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
fastify.post(
|
|
@@ -84,7 +84,7 @@ const consentController = async (fastify) => {
|
|
|
84
84
|
|
|
85
85
|
reply.status(200);
|
|
86
86
|
return consents;
|
|
87
|
-
}
|
|
87
|
+
},
|
|
88
88
|
);
|
|
89
89
|
};
|
|
90
90
|
|
|
@@ -5,12 +5,10 @@ const {
|
|
|
5
5
|
addressSchema,
|
|
6
6
|
locationSchema,
|
|
7
7
|
} = require('@verii/common-schemas');
|
|
8
|
-
|
|
9
8
|
const {
|
|
10
9
|
webWalletCredentialResponseSchema,
|
|
11
10
|
webWalletDisplayDescriptorResponseSchema,
|
|
12
11
|
} = require('../../entities');
|
|
13
|
-
|
|
14
12
|
const {
|
|
15
13
|
webWalletCredentialsResponseSchema,
|
|
16
14
|
webWalletCredentialCategoriesResponseSchema,
|
|
@@ -27,7 +27,7 @@ const credentialsController = async (fastify) => {
|
|
|
27
27
|
|
|
28
28
|
const additionalRenderInfo = await loadAdditionalRenderInfo(
|
|
29
29
|
credentials,
|
|
30
|
-
req
|
|
30
|
+
req,
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
return {
|
|
@@ -36,11 +36,11 @@ const credentialsController = async (fastify) => {
|
|
|
36
36
|
...omit(['_id'], credential),
|
|
37
37
|
id: credential._id,
|
|
38
38
|
}),
|
|
39
|
-
credentials
|
|
39
|
+
credentials,
|
|
40
40
|
),
|
|
41
41
|
...additionalRenderInfo,
|
|
42
42
|
};
|
|
43
|
-
}
|
|
43
|
+
},
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
fastify.delete(
|
|
@@ -61,7 +61,7 @@ const credentialsController = async (fastify) => {
|
|
|
61
61
|
},
|
|
62
62
|
async (
|
|
63
63
|
{ repos: { credentials: credentialsRepo }, params, user },
|
|
64
|
-
reply
|
|
64
|
+
reply,
|
|
65
65
|
) => {
|
|
66
66
|
const credential = await credentialsRepo.findOne({
|
|
67
67
|
filter: { _id: params.credentialId, auth0UserId: user.sub },
|
|
@@ -76,7 +76,7 @@ const credentialsController = async (fastify) => {
|
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
reply.code(204);
|
|
79
|
-
}
|
|
79
|
+
},
|
|
80
80
|
);
|
|
81
81
|
|
|
82
82
|
fastify.get(
|
|
@@ -96,7 +96,7 @@ const credentialsController = async (fastify) => {
|
|
|
96
96
|
const credentialCategories = await getCredentialCategories(req);
|
|
97
97
|
|
|
98
98
|
return credentialCategories;
|
|
99
|
-
}
|
|
99
|
+
},
|
|
100
100
|
);
|
|
101
101
|
};
|
|
102
102
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
const { values, forEach } = require('lodash/fp');
|
|
2
2
|
const { oauthPlugin } = require('@verii/auth');
|
|
3
|
-
|
|
4
|
-
const controllerSchemas = require('./schemas');
|
|
5
3
|
const disclosureSchemas = require('../../entities/disclosures/schemas');
|
|
4
|
+
const controllerSchemas = require('./schemas');
|
|
6
5
|
|
|
7
6
|
module.exports = async (fastify) => {
|
|
8
7
|
forEach(
|
|
9
8
|
(schema) => fastify.addSchema(schema),
|
|
10
|
-
[...values(disclosureSchemas), ...values(controllerSchemas)]
|
|
9
|
+
[...values(disclosureSchemas), ...values(controllerSchemas)],
|
|
11
10
|
);
|
|
12
11
|
|
|
13
12
|
fastify
|
|
@@ -35,15 +35,15 @@ const disclosureController = async (fastify) => {
|
|
|
35
35
|
},
|
|
36
36
|
async (req) => {
|
|
37
37
|
const presentationRequest = await req.vclSdk.getPresentationRequest(
|
|
38
|
-
new VCLPresentationRequestDescriptor(new VCLDeepLink(req.query.link))
|
|
38
|
+
new VCLPresentationRequestDescriptor(new VCLDeepLink(req.query.link)),
|
|
39
39
|
);
|
|
40
40
|
|
|
41
41
|
const { payload: presentation } = jwtDecode(
|
|
42
|
-
presentationRequest.jwt.encodedJwt
|
|
42
|
+
presentationRequest.jwt.encodedJwt,
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
return { presentation };
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
fastify.get(
|
|
@@ -71,7 +71,7 @@ const disclosureController = async (fastify) => {
|
|
|
71
71
|
} = await getAppConfig(req);
|
|
72
72
|
|
|
73
73
|
return { link, template };
|
|
74
|
-
}
|
|
74
|
+
},
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
fastify.post(
|
|
@@ -106,20 +106,20 @@ const disclosureController = async (fastify) => {
|
|
|
106
106
|
new VCLDeepLink(body.link),
|
|
107
107
|
null,
|
|
108
108
|
didJwk,
|
|
109
|
-
careerWalletAdminAccessToken
|
|
110
|
-
)
|
|
109
|
+
careerWalletAdminAccessToken,
|
|
110
|
+
),
|
|
111
111
|
);
|
|
112
112
|
|
|
113
113
|
if (!presentationRequest.feed && !body.credentials.length) {
|
|
114
114
|
throw newError.BadRequest(
|
|
115
|
-
'body/credentials must NOT have fewer than 1 items'
|
|
115
|
+
'body/credentials must NOT have fewer than 1 items',
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
const authToken = await getAuthToken(vclSdk, presentationRequest);
|
|
120
120
|
|
|
121
121
|
const { payload: presentation } = jwtDecode(
|
|
122
|
-
presentationRequest.jwt.encodedJwt
|
|
122
|
+
presentationRequest.jwt.encodedJwt,
|
|
123
123
|
);
|
|
124
124
|
|
|
125
125
|
let disclosure = {};
|
|
@@ -127,7 +127,7 @@ const disclosureController = async (fastify) => {
|
|
|
127
127
|
if (body.credentials.length) {
|
|
128
128
|
const submissionResult = await vclSdk.submitPresentation(
|
|
129
129
|
new VCLPresentationSubmission(presentationRequest, body.credentials),
|
|
130
|
-
authToken
|
|
130
|
+
authToken,
|
|
131
131
|
);
|
|
132
132
|
|
|
133
133
|
const { did: userDid } = await repos.accounts.findOne({
|
|
@@ -157,7 +157,7 @@ const disclosureController = async (fastify) => {
|
|
|
157
157
|
inspectorDid: presentation.iss,
|
|
158
158
|
credentialTypes:
|
|
159
159
|
presentation.presentation_definition.input_descriptors.map(
|
|
160
|
-
(descriptor) => descriptor.id
|
|
160
|
+
(descriptor) => descriptor.id,
|
|
161
161
|
),
|
|
162
162
|
inputDescriptors:
|
|
163
163
|
presentation.presentation_definition.input_descriptors,
|
|
@@ -166,7 +166,7 @@ const disclosureController = async (fastify) => {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
return { disclosure: mapDisclosureForResponse(disclosure) };
|
|
169
|
-
}
|
|
169
|
+
},
|
|
170
170
|
);
|
|
171
171
|
|
|
172
172
|
fastify.get(
|
|
@@ -188,7 +188,7 @@ const disclosureController = async (fastify) => {
|
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
return { disclosures };
|
|
191
|
-
}
|
|
191
|
+
},
|
|
192
192
|
);
|
|
193
193
|
|
|
194
194
|
fastify.delete(
|
|
@@ -226,7 +226,7 @@ const disclosureController = async (fastify) => {
|
|
|
226
226
|
presentationId: disclosure.jti,
|
|
227
227
|
exchangeId: disclosure.presentation.exchange_id,
|
|
228
228
|
},
|
|
229
|
-
req
|
|
229
|
+
req,
|
|
230
230
|
);
|
|
231
231
|
|
|
232
232
|
await disclosuresRepo.update(params.disclosureId, {
|
|
@@ -234,7 +234,7 @@ const disclosureController = async (fastify) => {
|
|
|
234
234
|
});
|
|
235
235
|
|
|
236
236
|
reply.code(204);
|
|
237
|
-
}
|
|
237
|
+
},
|
|
238
238
|
);
|
|
239
239
|
};
|
|
240
240
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
const { oauthPlugin } = require('@verii/auth');
|
|
2
2
|
const { values, forEach } = require('lodash/fp');
|
|
3
|
-
|
|
4
|
-
const controllerSchemas = require('./schemas');
|
|
5
3
|
const disclosureSchemas = require('../../entities/disclosures/schemas');
|
|
4
|
+
const controllerSchemas = require('./schemas');
|
|
6
5
|
|
|
7
6
|
module.exports = async (fastify) => {
|
|
8
7
|
forEach(
|
|
9
8
|
(schema) => fastify.addSchema(schema),
|
|
10
|
-
[...values(disclosureSchemas), ...values(controllerSchemas)]
|
|
9
|
+
[...values(disclosureSchemas), ...values(controllerSchemas)],
|
|
11
10
|
);
|
|
12
11
|
fastify
|
|
13
12
|
.autoSchemaPreset({
|
|
@@ -45,11 +45,11 @@ const feedsController = async (fastify) => {
|
|
|
45
45
|
const disclosureMap = feedsService.createDisclosureMap(disclosures);
|
|
46
46
|
const enrichedFeeds = feedsService.enrichFeedsWithDisclosureData(
|
|
47
47
|
feeds,
|
|
48
|
-
disclosureMap
|
|
48
|
+
disclosureMap,
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
return { feeds: enrichedFeeds };
|
|
52
|
-
}
|
|
52
|
+
},
|
|
53
53
|
);
|
|
54
54
|
|
|
55
55
|
fastify.delete(
|
|
@@ -87,7 +87,7 @@ const feedsController = async (fastify) => {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
reply.code(204);
|
|
90
|
-
}
|
|
90
|
+
},
|
|
91
91
|
);
|
|
92
92
|
fastify.post(
|
|
93
93
|
'/share-feed',
|
|
@@ -135,7 +135,7 @@ const feedsController = async (fastify) => {
|
|
|
135
135
|
|
|
136
136
|
const disclosurePromises = feeds.map(async (feed) => {
|
|
137
137
|
const credentialsMatch = body.credentials.filter((credential) =>
|
|
138
|
-
feed.credentialTypes.includes(credential.inputDescriptor)
|
|
138
|
+
feed.credentialTypes.includes(credential.inputDescriptor),
|
|
139
139
|
);
|
|
140
140
|
if (credentialsMatch.length === 0) {
|
|
141
141
|
return null;
|
|
@@ -146,12 +146,12 @@ const feedsController = async (fastify) => {
|
|
|
146
146
|
new VCLDeepLink(feed.deeplink),
|
|
147
147
|
null,
|
|
148
148
|
didJwk,
|
|
149
|
-
careerWalletAdminAccessToken
|
|
150
|
-
)
|
|
149
|
+
careerWalletAdminAccessToken,
|
|
150
|
+
),
|
|
151
151
|
);
|
|
152
152
|
|
|
153
153
|
const { payload: presentation } = jwtDecode(
|
|
154
|
-
presentationRequest.jwt.encodedJwt
|
|
154
|
+
presentationRequest.jwt.encodedJwt,
|
|
155
155
|
);
|
|
156
156
|
|
|
157
157
|
let { authToken } = feed;
|
|
@@ -163,13 +163,13 @@ const feedsController = async (fastify) => {
|
|
|
163
163
|
if (!authTokenValid) {
|
|
164
164
|
authToken = await vclSdk.getAuthToken(
|
|
165
165
|
new VCLAuthTokenDescriptor(presentationRequest),
|
|
166
|
-
feed.refreshToken
|
|
166
|
+
feed.refreshToken,
|
|
167
167
|
);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
const submissionResult = await vclSdk.submitPresentation(
|
|
171
171
|
new VCLPresentationSubmission(presentationRequest, credentialsMatch),
|
|
172
|
-
authToken
|
|
172
|
+
authToken,
|
|
173
173
|
);
|
|
174
174
|
|
|
175
175
|
const disclosure = await repos.disclosures.insert({
|
|
@@ -190,11 +190,11 @@ const feedsController = async (fastify) => {
|
|
|
190
190
|
});
|
|
191
191
|
|
|
192
192
|
const disclosures = (await Promise.all(disclosurePromises)).filter(
|
|
193
|
-
(disclosure) => disclosure !== null
|
|
193
|
+
(disclosure) => disclosure !== null,
|
|
194
194
|
);
|
|
195
195
|
|
|
196
196
|
return { disclosures };
|
|
197
|
-
}
|
|
197
|
+
},
|
|
198
198
|
);
|
|
199
199
|
};
|
|
200
200
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const { oauthPlugin } = require('@verii/auth');
|
|
2
|
-
|
|
3
2
|
const {
|
|
4
3
|
newOfferRelatedResourceSchema,
|
|
5
4
|
holderOfferSchema,
|
|
@@ -8,12 +7,6 @@ const {
|
|
|
8
7
|
addressSchema,
|
|
9
8
|
locationSchema,
|
|
10
9
|
} = require('@verii/common-schemas');
|
|
11
|
-
const {
|
|
12
|
-
webWalletDeepLinkOffersRequestSchema,
|
|
13
|
-
webWalletDeepLinkOffersResponseSchema,
|
|
14
|
-
webWalletDeepLinkAcceptOffersRequestSchema,
|
|
15
|
-
webWalletDeepLinkAcceptOffersResponseSchema,
|
|
16
|
-
} = require('./schemas');
|
|
17
10
|
const {
|
|
18
11
|
webWalletCredentialResponseSchema,
|
|
19
12
|
webWalletDisplayDescriptorResponseSchema,
|
|
@@ -23,6 +16,12 @@ const {
|
|
|
23
16
|
webWalletGetCredentialManifestQuerySchema,
|
|
24
17
|
webWalletGetCredentialManifestResponseSchema,
|
|
25
18
|
} = require('../common-schemas');
|
|
19
|
+
const {
|
|
20
|
+
webWalletDeepLinkOffersRequestSchema,
|
|
21
|
+
webWalletDeepLinkOffersResponseSchema,
|
|
22
|
+
webWalletDeepLinkAcceptOffersRequestSchema,
|
|
23
|
+
webWalletDeepLinkAcceptOffersResponseSchema,
|
|
24
|
+
} = require('./schemas');
|
|
26
25
|
|
|
27
26
|
module.exports = async (fastify) => {
|
|
28
27
|
fastify
|
|
@@ -41,8 +41,8 @@ const issuingController = async (fastify) => {
|
|
|
41
41
|
async (req) => {
|
|
42
42
|
const credentialManifest = await req.vclSdk.getCredentialManifest(
|
|
43
43
|
new VCLCredentialManifestDescriptorByDeepLink(
|
|
44
|
-
new VCLDeepLink(req.query.link)
|
|
45
|
-
)
|
|
44
|
+
new VCLDeepLink(req.query.link),
|
|
45
|
+
),
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
return {
|
|
@@ -53,7 +53,7 @@ const issuingController = async (fastify) => {
|
|
|
53
53
|
link: credentialManifest.deepLink.value,
|
|
54
54
|
},
|
|
55
55
|
};
|
|
56
|
-
}
|
|
56
|
+
},
|
|
57
57
|
);
|
|
58
58
|
|
|
59
59
|
fastify.post(
|
|
@@ -86,14 +86,14 @@ const issuingController = async (fastify) => {
|
|
|
86
86
|
VCLIssuingType.Career,
|
|
87
87
|
[],
|
|
88
88
|
await buildIssuingInputCredentials(inputCredentialsIds, req),
|
|
89
|
-
req
|
|
89
|
+
req,
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
const offersPayloadArr = offers.all.map((offer) => offer.payload);
|
|
93
93
|
|
|
94
94
|
const additionalRenderInfo = await loadAdditionalRenderInfo(
|
|
95
95
|
offersPayloadArr,
|
|
96
|
-
req
|
|
96
|
+
req,
|
|
97
97
|
);
|
|
98
98
|
|
|
99
99
|
return {
|
|
@@ -103,7 +103,7 @@ const issuingController = async (fastify) => {
|
|
|
103
103
|
challenge: offers.challenge,
|
|
104
104
|
...additionalRenderInfo,
|
|
105
105
|
};
|
|
106
|
-
}
|
|
106
|
+
},
|
|
107
107
|
);
|
|
108
108
|
|
|
109
109
|
fastify.post(
|
|
@@ -149,7 +149,7 @@ const issuingController = async (fastify) => {
|
|
|
149
149
|
new VCLVerifiedProfile(credentialManifest.verifiedProfile),
|
|
150
150
|
new VCLDeepLink(credentialManifest.link),
|
|
151
151
|
didJwk,
|
|
152
|
-
careerWalletAdminAccessToken
|
|
152
|
+
careerWalletAdminAccessToken,
|
|
153
153
|
);
|
|
154
154
|
const sessionToken = new VCLToken(token);
|
|
155
155
|
const verifiableCredentials = await vclSdk.finalizeOffers(
|
|
@@ -157,9 +157,9 @@ const issuingController = async (fastify) => {
|
|
|
157
157
|
vclCredentialManifest,
|
|
158
158
|
challenge,
|
|
159
159
|
offerIds,
|
|
160
|
-
[]
|
|
160
|
+
[],
|
|
161
161
|
),
|
|
162
|
-
sessionToken
|
|
162
|
+
sessionToken,
|
|
163
163
|
);
|
|
164
164
|
|
|
165
165
|
let savedCredentials;
|
|
@@ -167,10 +167,9 @@ const issuingController = async (fastify) => {
|
|
|
167
167
|
const credentials = getCredentialsFromOffers(
|
|
168
168
|
req.user.sub,
|
|
169
169
|
userDid,
|
|
170
|
-
verifiableCredentials.passedCredentials
|
|
170
|
+
verifiableCredentials.passedCredentials,
|
|
171
171
|
);
|
|
172
172
|
|
|
173
|
-
// eslint-disable-next-line no-unused-vars
|
|
174
173
|
savedCredentials = await req.repos.credentials.insertMany(credentials);
|
|
175
174
|
}
|
|
176
175
|
const feeds = await req.repos.feeds.find({
|
|
@@ -187,25 +186,24 @@ const issuingController = async (fastify) => {
|
|
|
187
186
|
id: credential._id,
|
|
188
187
|
feed: shouldShareViaFeeds(feeds, credential.type),
|
|
189
188
|
}),
|
|
190
|
-
savedCredentials
|
|
189
|
+
savedCredentials,
|
|
191
190
|
) || [],
|
|
192
191
|
failedCredentials: verifiableCredentials.failedCredentials || [],
|
|
193
192
|
};
|
|
194
|
-
}
|
|
193
|
+
},
|
|
195
194
|
);
|
|
196
195
|
|
|
197
|
-
const getDidJwkFromAccount = (account) =>
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
196
|
+
const getDidJwkFromAccount = (account) =>
|
|
197
|
+
account.didKeyMetadatum &&
|
|
198
|
+
Array.isArray(account.didKeyMetadatum) &&
|
|
199
|
+
account.didKeyMetadatum.length > 0
|
|
201
200
|
? VCLDidJwk.fromJSON(account.didKeyMetadatum[0])
|
|
202
201
|
: null;
|
|
203
|
-
};
|
|
204
202
|
|
|
205
203
|
const shouldShareViaFeeds = (feeds, credentialType) =>
|
|
206
204
|
feeds.some(
|
|
207
205
|
({ credentialTypes }) =>
|
|
208
|
-
!isEmpty(intersection(credentialTypes, credentialType))
|
|
206
|
+
!isEmpty(intersection(credentialTypes, credentialType)),
|
|
209
207
|
);
|
|
210
208
|
};
|
|
211
209
|
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
const { oauthPlugin } = require('@verii/auth');
|
|
2
|
-
|
|
3
2
|
const {
|
|
4
3
|
newOfferRelatedResourceSchema,
|
|
5
4
|
holderOfferSchema,
|
|
6
5
|
} = require('@verii/common-schemas');
|
|
7
|
-
|
|
8
6
|
const {
|
|
9
7
|
webWalletCredentialResponseSchema,
|
|
10
8
|
webWalletCredentialManifestSchema,
|
|
11
9
|
} = require('../../../entities');
|
|
10
|
+
const {
|
|
11
|
+
webWalletGetCredentialManifestQuerySchema,
|
|
12
|
+
webWalletGetCredentialManifestResponseSchema,
|
|
13
|
+
} = require('../common-schemas');
|
|
12
14
|
const {
|
|
13
15
|
webWalletIdentityCredentialsRequestCodeParamsSchema,
|
|
14
16
|
webWalletIdentityCredentialsRequestCodeBodySchema,
|
|
15
17
|
webWalletIdentityCredentialsConfirmBodySchema,
|
|
16
18
|
webWalletIdentityCredentialsConfirmResponseSchema,
|
|
17
19
|
} = require('./schemas');
|
|
18
|
-
const {
|
|
19
|
-
webWalletGetCredentialManifestQuerySchema,
|
|
20
|
-
webWalletGetCredentialManifestResponseSchema,
|
|
21
|
-
} = require('../common-schemas');
|
|
22
20
|
|
|
23
21
|
module.exports = async (fastify) => {
|
|
24
22
|
fastify
|