@velocitycareerlabs/server-webwallet 1.26.0-dev-build.136727957 → 1.26.0-dev-build.1be965c48

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velocitycareerlabs/server-webwallet",
3
- "version": "1.26.0-dev-build.136727957",
3
+ "version": "1.26.0-dev-build.1be965c48",
4
4
  "description": "Web Wallet application",
5
5
  "repository": "https://github.com/velocitycareerlabs/packages",
6
6
  "engines": {
@@ -39,7 +39,7 @@
39
39
  "@velocitycareerlabs/config": "1.26.0-dev-build.10459764b",
40
40
  "@velocitycareerlabs/fastify-plugins": "1.26.0-dev-build.10459764b",
41
41
  "@velocitycareerlabs/jwt": "1.26.0-dev-build.10459764b",
42
- "@velocitycareerlabs/migrations": "1.26.0-dev-build.136727957",
42
+ "@velocitycareerlabs/migrations": "1.26.0-dev-build.1be965c48",
43
43
  "@velocitycareerlabs/request": "1.26.0-dev-build.10459764b",
44
44
  "@velocitycareerlabs/server-provider": "1.26.0-dev-build.10459764b",
45
45
  "@velocitycareerlabs/vc-checks": "1.26.0-dev-build.10459764b",
@@ -73,5 +73,5 @@
73
73
  "nodemon": "3.1.10",
74
74
  "prettier": "2.8.8"
75
75
  },
76
- "gitHead": "df32939ca7551a1e6cce635d7d89fb97f87a028e"
76
+ "gitHead": "44307b18469bbba20209bace16cb974e447f2e73"
77
77
  }
@@ -1,4 +1,5 @@
1
1
  const newError = require('http-errors');
2
+ const { omit, map } = require('lodash/fp');
2
3
  const { loadAdditionalRenderInfo } = require('../../entities');
3
4
  const { getCredentialCategories } = require('../../fetchers');
4
5
 
@@ -21,6 +22,7 @@ const credentialsController = async (fastify) => {
21
22
 
22
23
  const credentials = await repos.credentials.find({
23
24
  filter: { auth0UserId: req.user.sub },
25
+ projection: null,
24
26
  });
25
27
 
26
28
  const additionalRenderInfo = await loadAdditionalRenderInfo(
@@ -28,7 +30,16 @@ const credentialsController = async (fastify) => {
28
30
  req
29
31
  );
30
32
 
31
- return { credentials, ...additionalRenderInfo };
33
+ return {
34
+ credentials: map(
35
+ (credential) => ({
36
+ ...omit(['_id'], credential),
37
+ id: credential._id,
38
+ }),
39
+ credentials
40
+ ),
41
+ ...additionalRenderInfo,
42
+ };
32
43
  }
33
44
  );
34
45
 
@@ -9,6 +9,7 @@ const {
9
9
  VCLVerifiedProfile,
10
10
  VCLDidJwk,
11
11
  } = require('@velocitycareerlabs/vnf-nodejs-wallet-sdk');
12
+ const { omit, map } = require('lodash/fp');
12
13
  const {
13
14
  loadAdditionalRenderInfo,
14
15
  getCredentialsFromOffers,
@@ -174,7 +175,14 @@ const issuingController = async (fastify) => {
174
175
  }
175
176
 
176
177
  return {
177
- passedCredentials: savedCredentials || [],
178
+ passedCredentials:
179
+ map(
180
+ (credential) => ({
181
+ ...omit(['_id'], credential),
182
+ id: credential._id,
183
+ }),
184
+ savedCredentials
185
+ ) || [],
178
186
  failedCredentials: verifiableCredentials.failedCredentials || [],
179
187
  };
180
188
  }
@@ -1,5 +1,5 @@
1
1
  const newError = require('http-errors');
2
- const { get } = require('lodash/fp');
2
+ const { get, omit, map } = require('lodash/fp');
3
3
  const md5 = require('blueimp-md5');
4
4
  const { jwtDecode } = require('@velocitycareerlabs/jwt');
5
5
 
@@ -161,7 +161,13 @@ const issueIdentityCredentialsController = async (fastify) => {
161
161
  });
162
162
 
163
163
  return {
164
- credentials: savedCredentials,
164
+ credentials: map(
165
+ (credential) => ({
166
+ ...omit(['_id'], credential),
167
+ id: credential._id,
168
+ }),
169
+ savedCredentials
170
+ ),
165
171
  // trackingData is for Mixpanel tracking events
166
172
  trackingData: { offers, disclosureId, issuerName },
167
173
  };
@@ -1,37 +1,14 @@
1
+ const { omit } = require('lodash/fp');
2
+
1
3
  const offerToCredentialMongoDTO = (auth0UserId, userDid, credential) => {
2
- const {
3
- vc: {
4
- type,
5
- id: did,
6
- credentialStatus,
7
- linkCodeCommitment,
8
- issuer,
9
- contentHash,
10
- credentialSchema,
11
- vnfProtocolVersion,
12
- '@context': context,
13
- credentialSubject,
14
- relatedResource,
15
- },
16
- jti,
17
- iss,
18
- encodedCredential,
19
- } = credential;
4
+ const { vc, jti, iss, encodedCredential } = credential;
20
5
 
21
6
  return {
22
- type,
23
- did,
7
+ ...omit(['@context'], vc),
8
+ did: vc.id,
9
+ context: vc['@context'],
24
10
  auth0UserId,
25
11
  userDid,
26
- credentialStatus,
27
- linkCodeCommitment,
28
- issuer,
29
- relatedResource,
30
- contentHash,
31
- credentialSchema,
32
- vnfProtocolVersion,
33
- context,
34
- credentialSubject,
35
12
  jti,
36
13
  iss,
37
14
  encodedCredential,
@@ -131,6 +131,7 @@ const webWalletCredentialResponseSchema = {
131
131
  'createdAt',
132
132
  'updatedAt',
133
133
  ],
134
+ additionalProperties: true,
134
135
  };
135
136
 
136
137
  module.exports = {
@@ -1,95 +0,0 @@
1
- const webWalletCredentialResponseSchema = {
2
- $id: 'https://velocitycareerlabs.io/webwallet-credential-response.schema.json',
3
- title: 'webwallet-credentials-response',
4
- description: 'credentials response from webwallet',
5
- type: 'object',
6
- properties: {
7
- type: {
8
- type: 'array',
9
- items: {
10
- type: 'string',
11
- },
12
- },
13
- did: {
14
- type: 'string',
15
- },
16
- auth0UserId: {
17
- type: 'string',
18
- },
19
- credentialStatus: {
20
- type: 'object',
21
- additionalProperties: true,
22
- },
23
- linkCodeCommitment: {
24
- type: 'object',
25
- additionalProperties: true,
26
- },
27
- issuer: {
28
- type: 'object',
29
- properties: {
30
- id: {
31
- type: 'string',
32
- },
33
- },
34
- },
35
- contentHash: {
36
- type: 'object',
37
- additionalProperties: true,
38
- },
39
- credentialSchema: {
40
- type: 'object',
41
- additionalProperties: true,
42
- },
43
- vnfProtocolVersion: {
44
- type: 'number',
45
- },
46
- context: {
47
- type: 'array',
48
- items: {
49
- type: 'string',
50
- },
51
- },
52
- credentialSubject: {
53
- type: 'object',
54
- properties: {
55
- hasCredential: {
56
- type: 'object',
57
- additionalProperties: true,
58
- },
59
- type: {
60
- type: 'string',
61
- },
62
- '@context': {
63
- type: 'array',
64
- items: {
65
- type: 'string',
66
- },
67
- },
68
- },
69
- additionalProperties: true,
70
- },
71
- jti: {
72
- type: 'string',
73
- },
74
- iss: {
75
- type: 'string',
76
- },
77
- createdAt: {
78
- type: 'string',
79
- },
80
- updatedAt: {
81
- type: 'string',
82
- },
83
- relatedResource: {
84
- type: 'array',
85
- items: {
86
- type: 'object',
87
- additionalProperties: true,
88
- },
89
- },
90
- },
91
- };
92
-
93
- module.exports = {
94
- webWalletCredentialResponseSchema,
95
- };