@verii/server-mockvendor 1.0.0-pre.1752076816
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/.localdev.env +15 -0
- package/.standalone.env +5 -0
- package/LICENSE +201 -0
- package/docker/compose.yml +25 -0
- package/jest.config.js +20 -0
- package/multilingual-string.schema.json +40 -0
- package/package.json +70 -0
- package/src/config/config.js +55 -0
- package/src/controllers/api/accepted-offers/controller.js +9 -0
- package/src/controllers/api/accepted-offers/repo.js +25 -0
- package/src/controllers/api/applicants/controller.js +9 -0
- package/src/controllers/api/applicants/repo.js +30 -0
- package/src/controllers/api/create_did_key/controller.js +29 -0
- package/src/controllers/api/create_did_key/schemas/index.js +4 -0
- package/src/controllers/api/create_did_key/schemas/jwk-did-request.schema.js +20 -0
- package/src/controllers/api/create_did_key/schemas/jwk-did-response.schema.js +41 -0
- package/src/controllers/api/create_jwk/controller.js +35 -0
- package/src/controllers/api/create_jwk/schemas/index.js +3 -0
- package/src/controllers/api/create_jwk/schemas/jwk-response.schema.js +33 -0
- package/src/controllers/api/credential-submissions/controller.js +59 -0
- package/src/controllers/api/credential-submissions/repo.js +16 -0
- package/src/controllers/api/identifications/controller.js +67 -0
- package/src/controllers/api/identifications/repo.js +22 -0
- package/src/controllers/api/issuing-exchanges/controller.js +218 -0
- package/src/controllers/api/issuing-exchanges/fetchers.js +45 -0
- package/src/controllers/api/issuing-exchanges/repo.js +27 -0
- package/src/controllers/api/jwt/controller.js +69 -0
- package/src/controllers/api/jwt/schemas/index.js +6 -0
- package/src/controllers/api/jwt/schemas/jwt-request.schema.js +40 -0
- package/src/controllers/api/jwt/schemas/jwt-response.schema.js +14 -0
- package/src/controllers/api/jwt/schemas/jwt-verify-request.schema.js +17 -0
- package/src/controllers/api/jwt/schemas/jwt-verify-response.schema.js +17 -0
- package/src/controllers/api/offers/autohooks.js +5 -0
- package/src/controllers/api/offers/controller.js +87 -0
- package/src/controllers/api/offers/new-mockvendor-offer.schema.js +22 -0
- package/src/controllers/api/offers/repo.js +33 -0
- package/src/controllers/api/users/controller.js +20 -0
- package/src/controllers/api/users/repo.js +29 -0
- package/src/controllers/autohooks.js +22 -0
- package/src/controllers/inspection/controller.js +39 -0
- package/src/controllers/issuing/controller.js +158 -0
- package/src/controllers/registrar/controller.js +67 -0
- package/src/controllers/registrar/repo.js +24 -0
- package/src/controllers/root/controller.js +15 -0
- package/src/controllers/schemas/index.js +21 -0
- package/src/controllers/schemas/issuer-data.schema.json +26 -0
- package/src/entities/index.js +4 -0
- package/src/entities/key-pairs/index.js +3 -0
- package/src/entities/key-pairs/key-pairs.js +73 -0
- package/src/entities/offers/index.js +3 -0
- package/src/entities/offers/schemas/generate-offers.schema.js +30 -0
- package/src/entities/offers/schemas/index.js +3 -0
- package/src/index.js +19 -0
- package/src/init-server.js +34 -0
- package/src/main.js +18 -0
- package/src/standalone.js +8 -0
- package/src/start-app-server.js +32 -0
- package/test/accepted-offers.test.js +47 -0
- package/test/api-users.test.js +170 -0
- package/test/create_did_key-controller.test.js +94 -0
- package/test/create_jwk-controller.test.js +86 -0
- package/test/credential-submissions.test.js +331 -0
- package/test/factories/accepted-offers.factory.js +16 -0
- package/test/factories/delayed-offer.factory.js +17 -0
- package/test/factories/identifications.factory.js +33 -0
- package/test/factories/offers.factory.js +64 -0
- package/test/factories/users.factory.js +24 -0
- package/test/helpers/PastEmploymentPosition-2007-2009-Junior-Project-Manager.json +26 -0
- package/test/helpers/PastEmploymentPosition-2009-2015-Project-Manager.json +26 -0
- package/test/helpers/helpers/PastEmploymentPosition-2009-2015-Project-Manager.json +26 -0
- package/test/helpers/latest-Adam-Smith.json +49 -0
- package/test/helpers/legacy-Adam-Smith.json +33 -0
- package/test/helpers/mockvendor-build-fastify.js +16 -0
- package/test/helpers/tools/verifgen/templates/PastEmploymentPosition-2009-2015-Project-Manager.json +26 -0
- package/test/identifications.test.js +56 -0
- package/test/issuing-exchanges.test.js +335 -0
- package/test/issuing-identify.test.js +137 -0
- package/test/jwt-controller.test.js +320 -0
- package/test/offers.test.js +682 -0
- package/test/registrar.test.js +276 -0
- package/test/root.test.js +25 -0
- package/test/swagger.test.js +21 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
const { mongoDb } = require('@spencejs/spence-mongo-repos');
|
|
2
|
+
const { ObjectId } = require('mongodb');
|
|
3
|
+
const { flow, map } = require('lodash/fp');
|
|
4
|
+
const {
|
|
5
|
+
addDays,
|
|
6
|
+
endOfDay,
|
|
7
|
+
formatISOWithOptions,
|
|
8
|
+
startOfDay,
|
|
9
|
+
subDays,
|
|
10
|
+
} = require('date-fns/fp');
|
|
11
|
+
const {
|
|
12
|
+
ISO_DATETIME_FORMAT,
|
|
13
|
+
OBJECT_ID_FORMAT,
|
|
14
|
+
} = require('@verii/test-regexes');
|
|
15
|
+
const buildFastify = require('./helpers/mockvendor-build-fastify');
|
|
16
|
+
const adamSmithId = require('./helpers/legacy-Adam-Smith.json');
|
|
17
|
+
const seniorPM = require('./helpers/PastEmploymentPosition-2009-2015-Project-Manager.json');
|
|
18
|
+
const juniorPM = require('./helpers/PastEmploymentPosition-2007-2009-Junior-Project-Manager.json');
|
|
19
|
+
|
|
20
|
+
describe('Credential Submissions', () => {
|
|
21
|
+
let fastify;
|
|
22
|
+
let disclosureMetadata;
|
|
23
|
+
let credentials;
|
|
24
|
+
const credentialChecks = {
|
|
25
|
+
TRUSTED_HOLDER: 'NOT_APPLICABLE',
|
|
26
|
+
TRUSTED_ISSUER: 'SELF_SIGNED',
|
|
27
|
+
UNEXPIRED: 'NOT_APPLICABLE',
|
|
28
|
+
UNREVOKED: 'PASS',
|
|
29
|
+
UNTAMPERED: 'PASS',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const prepareCredentialsApiResponse = map((c) => ({
|
|
33
|
+
...c,
|
|
34
|
+
...disclosureMetadata,
|
|
35
|
+
id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
36
|
+
_id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
37
|
+
updatedAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
38
|
+
createdAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
beforeAll(async () => {
|
|
42
|
+
fastify = buildFastify();
|
|
43
|
+
await fastify.ready();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
beforeEach(async () => {
|
|
47
|
+
await mongoDb().collection('applicants').deleteMany({});
|
|
48
|
+
await mongoDb().collection('credentialSubmissions').deleteMany({});
|
|
49
|
+
disclosureMetadata = {
|
|
50
|
+
exchangeId: new ObjectId().toString(),
|
|
51
|
+
presentationId: new ObjectId().toString(),
|
|
52
|
+
vendorOrganizationId: new ObjectId().toString(),
|
|
53
|
+
vendorDisclosureId: new ObjectId().toString(),
|
|
54
|
+
};
|
|
55
|
+
credentials = [
|
|
56
|
+
{
|
|
57
|
+
...adamSmithId,
|
|
58
|
+
...credentialChecks,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
...juniorPM,
|
|
62
|
+
...credentialChecks,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
...seniorPM,
|
|
66
|
+
...credentialChecks,
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
afterAll(async () => {
|
|
72
|
+
await fastify.close();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe('receive applicant flow', () => {
|
|
76
|
+
const applicant = {
|
|
77
|
+
email: 'adam.smith@example.com',
|
|
78
|
+
firstName: {
|
|
79
|
+
localized: {
|
|
80
|
+
en: 'Adam',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
lastName: {
|
|
84
|
+
localized: {
|
|
85
|
+
en: 'Smith',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
location: {
|
|
89
|
+
countryCode: 'US',
|
|
90
|
+
regionCode: 'CA',
|
|
91
|
+
},
|
|
92
|
+
phone: '+1 555 619 2191',
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const applicantCredentials = [
|
|
96
|
+
{
|
|
97
|
+
...juniorPM,
|
|
98
|
+
...credentialChecks,
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
it('should be able to create and add creds', async () => {
|
|
103
|
+
const applicantPayload = {
|
|
104
|
+
...disclosureMetadata,
|
|
105
|
+
...applicant,
|
|
106
|
+
};
|
|
107
|
+
const applicantResponse = await fastify.injectJson({
|
|
108
|
+
method: 'POST',
|
|
109
|
+
url: '/inspection/find-or-create-applicant',
|
|
110
|
+
payload: applicantPayload,
|
|
111
|
+
});
|
|
112
|
+
expect(applicantResponse.statusCode).toEqual(200);
|
|
113
|
+
expect(applicantResponse.json).toEqual({
|
|
114
|
+
vendorApplicantId: expect.any(String),
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const credentialsPayload = {
|
|
118
|
+
...disclosureMetadata,
|
|
119
|
+
vendorApplicantId: applicantResponse.json.vendorApplicantId,
|
|
120
|
+
credentials: applicantCredentials,
|
|
121
|
+
};
|
|
122
|
+
const credentialsResponse = await fastify.injectJson({
|
|
123
|
+
method: 'POST',
|
|
124
|
+
url: '/inspection/add-credentials-to-applicant',
|
|
125
|
+
payload: credentialsPayload,
|
|
126
|
+
});
|
|
127
|
+
expect(credentialsResponse.statusCode).toEqual(200);
|
|
128
|
+
expect(credentialsResponse.json).toEqual({
|
|
129
|
+
numProcessed: 1,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
expect(
|
|
133
|
+
(await fastify.injectJson({ method: 'GET', url: '/api/applicants' }))
|
|
134
|
+
.json
|
|
135
|
+
).toEqual([
|
|
136
|
+
{
|
|
137
|
+
...applicantPayload,
|
|
138
|
+
id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
139
|
+
_id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
140
|
+
updatedAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
141
|
+
createdAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
142
|
+
},
|
|
143
|
+
]);
|
|
144
|
+
|
|
145
|
+
expect(
|
|
146
|
+
(
|
|
147
|
+
await fastify.injectJson({
|
|
148
|
+
method: 'GET',
|
|
149
|
+
url: '/api/credential-submissions',
|
|
150
|
+
})
|
|
151
|
+
).json
|
|
152
|
+
).toEqual(
|
|
153
|
+
map(
|
|
154
|
+
(credential) => ({
|
|
155
|
+
...credential,
|
|
156
|
+
vendorApplicantId: applicantResponse.json.vendorApplicantId,
|
|
157
|
+
}),
|
|
158
|
+
prepareCredentialsApiResponse(credentialsPayload.credentials)
|
|
159
|
+
)
|
|
160
|
+
);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
describe('retrieving creds', () => {
|
|
165
|
+
let payload;
|
|
166
|
+
beforeEach(async () => {
|
|
167
|
+
payload = {
|
|
168
|
+
...disclosureMetadata,
|
|
169
|
+
credentials,
|
|
170
|
+
};
|
|
171
|
+
await fastify.injectJson({
|
|
172
|
+
method: 'POST',
|
|
173
|
+
url: '/inspection/receive-checked-credentials',
|
|
174
|
+
payload,
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
describe('filter by vendorDisclosureId', () => {
|
|
179
|
+
it('return nothing for non existing ids', async () => {
|
|
180
|
+
expect(
|
|
181
|
+
(
|
|
182
|
+
await fastify.injectJson({
|
|
183
|
+
method: 'GET',
|
|
184
|
+
url: '/api/credential-submissions?vendorDisclosureId=1111',
|
|
185
|
+
})
|
|
186
|
+
).json
|
|
187
|
+
).toEqual([]);
|
|
188
|
+
});
|
|
189
|
+
it('filter by ids', async () => {
|
|
190
|
+
expect(
|
|
191
|
+
(
|
|
192
|
+
await fastify.injectJson({
|
|
193
|
+
method: 'GET',
|
|
194
|
+
url: `/api/credential-submissions?vendorDisclosureId=${payload.vendorDisclosureId}`,
|
|
195
|
+
})
|
|
196
|
+
).json
|
|
197
|
+
).toEqual(
|
|
198
|
+
expect.arrayContaining(
|
|
199
|
+
prepareCredentialsApiResponse(payload.credentials)
|
|
200
|
+
)
|
|
201
|
+
);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
describe('filter by dates', () => {
|
|
205
|
+
it('return nothing if none on particular dateFrom', async () => {
|
|
206
|
+
expect(
|
|
207
|
+
(
|
|
208
|
+
await fastify.injectJson({
|
|
209
|
+
method: 'GET',
|
|
210
|
+
url: `/api/credential-submissions?dateFrom=${flow(
|
|
211
|
+
endOfDay,
|
|
212
|
+
addDays(1),
|
|
213
|
+
formatISOWithOptions({ representation: 'date' })
|
|
214
|
+
)(new Date())}`,
|
|
215
|
+
})
|
|
216
|
+
).json
|
|
217
|
+
).toEqual([]);
|
|
218
|
+
});
|
|
219
|
+
it('filter by dateFrom', async () => {
|
|
220
|
+
expect(
|
|
221
|
+
(
|
|
222
|
+
await fastify.injectJson({
|
|
223
|
+
method: 'GET',
|
|
224
|
+
url: `/api/credential-submissions?dateFrom=${flow(
|
|
225
|
+
startOfDay,
|
|
226
|
+
formatISOWithOptions({ representation: 'date' })
|
|
227
|
+
)(new Date())}`,
|
|
228
|
+
})
|
|
229
|
+
).json
|
|
230
|
+
).toEqual(
|
|
231
|
+
expect.arrayContaining(
|
|
232
|
+
prepareCredentialsApiResponse(payload.credentials)
|
|
233
|
+
)
|
|
234
|
+
);
|
|
235
|
+
});
|
|
236
|
+
it('return nothing if none on particular dateUntil', async () => {
|
|
237
|
+
expect(
|
|
238
|
+
(
|
|
239
|
+
await fastify.injectJson({
|
|
240
|
+
method: 'GET',
|
|
241
|
+
url: `/api/credential-submissions?dateUntil=${flow(
|
|
242
|
+
startOfDay,
|
|
243
|
+
subDays(1),
|
|
244
|
+
formatISOWithOptions({ representation: 'date' })
|
|
245
|
+
)(new Date())}`,
|
|
246
|
+
})
|
|
247
|
+
).json
|
|
248
|
+
).toEqual([]);
|
|
249
|
+
});
|
|
250
|
+
it('filter by dateUntil', async () => {
|
|
251
|
+
expect(
|
|
252
|
+
(
|
|
253
|
+
await fastify.injectJson({
|
|
254
|
+
method: 'GET',
|
|
255
|
+
url: `/api/credential-submissions?dateFrom=${flow(
|
|
256
|
+
startOfDay,
|
|
257
|
+
formatISOWithOptions({ representation: 'date' })
|
|
258
|
+
)(new Date())}`,
|
|
259
|
+
})
|
|
260
|
+
).json
|
|
261
|
+
).toEqual(
|
|
262
|
+
expect.arrayContaining(
|
|
263
|
+
prepareCredentialsApiResponse(payload.credentials)
|
|
264
|
+
)
|
|
265
|
+
);
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
describe('receive checked credentials flow', () => {
|
|
271
|
+
it('should be able to create and add creds', async () => {
|
|
272
|
+
const payload = {
|
|
273
|
+
...disclosureMetadata,
|
|
274
|
+
credentials,
|
|
275
|
+
};
|
|
276
|
+
const response = await fastify.injectJson({
|
|
277
|
+
method: 'POST',
|
|
278
|
+
url: '/inspection/receive-checked-credentials',
|
|
279
|
+
payload,
|
|
280
|
+
});
|
|
281
|
+
expect(response.statusCode).toEqual(200);
|
|
282
|
+
expect(response.json).toEqual({
|
|
283
|
+
numProcessed: 3,
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
expect(
|
|
287
|
+
(
|
|
288
|
+
await fastify.injectJson({
|
|
289
|
+
method: 'GET',
|
|
290
|
+
url: '/api/credential-submissions',
|
|
291
|
+
})
|
|
292
|
+
).json
|
|
293
|
+
).toEqual(
|
|
294
|
+
expect.arrayContaining(
|
|
295
|
+
prepareCredentialsApiResponse(payload.credentials)
|
|
296
|
+
)
|
|
297
|
+
);
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
describe('receive unchecked credentials flow', () => {
|
|
302
|
+
it('should be able to create and add creds', async () => {
|
|
303
|
+
const payload = {
|
|
304
|
+
...disclosureMetadata,
|
|
305
|
+
credentials,
|
|
306
|
+
};
|
|
307
|
+
const response = await fastify.injectJson({
|
|
308
|
+
method: 'POST',
|
|
309
|
+
url: '/inspection/receive-unchecked-credentials',
|
|
310
|
+
payload,
|
|
311
|
+
});
|
|
312
|
+
expect(response.statusCode).toEqual(200);
|
|
313
|
+
expect(response.json).toEqual({
|
|
314
|
+
numProcessed: 3,
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
expect(
|
|
318
|
+
(
|
|
319
|
+
await fastify.injectJson({
|
|
320
|
+
method: 'GET',
|
|
321
|
+
url: '/api/credential-submissions',
|
|
322
|
+
})
|
|
323
|
+
).json
|
|
324
|
+
).toEqual(
|
|
325
|
+
expect.arrayContaining(
|
|
326
|
+
prepareCredentialsApiResponse(payload.credentials)
|
|
327
|
+
)
|
|
328
|
+
);
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const { nanoid } = require('nanoid');
|
|
3
|
+
const initAcceptedOffersRepo = require('../../src/controllers/api/accepted-offers/repo');
|
|
4
|
+
|
|
5
|
+
module.exports = (app) =>
|
|
6
|
+
register(
|
|
7
|
+
'acceptedOffers',
|
|
8
|
+
initAcceptedOffersRepo(app)({ config: app.config }),
|
|
9
|
+
async (overrides) => {
|
|
10
|
+
return {
|
|
11
|
+
exchangeId: nanoid(),
|
|
12
|
+
offerIds: ['5539e308-6f2f-4d01-b946-5ca4ba7fee20'],
|
|
13
|
+
...overrides(),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const { nanoid } = require('nanoid');
|
|
3
|
+
const initIssuingExchangesRepo = require('../../src/controllers/api/issuing-exchanges/repo');
|
|
4
|
+
|
|
5
|
+
module.exports = (app) =>
|
|
6
|
+
register(
|
|
7
|
+
'issuingExchanges',
|
|
8
|
+
initIssuingExchangesRepo(app)({ config: app.config }),
|
|
9
|
+
async (overrides) => {
|
|
10
|
+
return {
|
|
11
|
+
exchangeId: nanoid(),
|
|
12
|
+
vendorUserId: 'adam.smith@example.com',
|
|
13
|
+
issuer: { id: 'did:velocity:issuer' },
|
|
14
|
+
...overrides(),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const { ObjectId } = require('mongodb');
|
|
3
|
+
const initIdentificationsRepo = require('../../src/controllers/api/identifications/repo');
|
|
4
|
+
|
|
5
|
+
module.exports = (app) =>
|
|
6
|
+
register(
|
|
7
|
+
'identification',
|
|
8
|
+
initIdentificationsRepo(app)({ config: app.config }),
|
|
9
|
+
async (overrides) => {
|
|
10
|
+
return {
|
|
11
|
+
identification: {
|
|
12
|
+
emailCredentials: [
|
|
13
|
+
{
|
|
14
|
+
credentialSubject: {
|
|
15
|
+
email: 'adam.smith@example.com',
|
|
16
|
+
},
|
|
17
|
+
credentialType: 'EmailV1.0',
|
|
18
|
+
issuer: 'did:velocity:0x0b154da48d0f213c26c4b1d040dc5ff1dbf99ffa',
|
|
19
|
+
issuanceDate: new Date(),
|
|
20
|
+
validFrom: new Date(),
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
idDocumentCredentials: [],
|
|
24
|
+
phoneCredentials: [],
|
|
25
|
+
emails: ['adam.smith@example.com'],
|
|
26
|
+
phones: [],
|
|
27
|
+
tenantDID: `did:ion:${new ObjectId()}`,
|
|
28
|
+
exchangeId: new ObjectId(),
|
|
29
|
+
},
|
|
30
|
+
...overrides(),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const initOffersRepo = require('../../src/controllers/api/offers/repo');
|
|
3
|
+
|
|
4
|
+
module.exports = (app) =>
|
|
5
|
+
register(
|
|
6
|
+
'offer',
|
|
7
|
+
initOffersRepo(app)({ config: app.config }),
|
|
8
|
+
async (overrides) => {
|
|
9
|
+
return {
|
|
10
|
+
type: ['Course'],
|
|
11
|
+
issuer: {
|
|
12
|
+
id: 'did:ion:B1a3e076-8d23-4bcb-a066-6f90e161cf23',
|
|
13
|
+
},
|
|
14
|
+
credentialSubject: {
|
|
15
|
+
vendorUserId: 'adam.smith@example.com',
|
|
16
|
+
title: {
|
|
17
|
+
localized: {
|
|
18
|
+
en: 'Azure Basics',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
description: {
|
|
22
|
+
localized: {
|
|
23
|
+
en: 'Introduction to Microsoft Azure Cloud Services',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
contentProvider:
|
|
27
|
+
'did:velocity:0xd4df29726d500f9b85bc6c7f1b3c021f16305692',
|
|
28
|
+
contentProviderName: {
|
|
29
|
+
localized: {
|
|
30
|
+
en: 'Microsoft Corporation',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
type: 'Specialty Training',
|
|
34
|
+
duration: '24h',
|
|
35
|
+
score: 90.0,
|
|
36
|
+
scoreRange: '78',
|
|
37
|
+
registrationDate: {
|
|
38
|
+
day: 15.0,
|
|
39
|
+
month: 3.0,
|
|
40
|
+
year: 2019.0,
|
|
41
|
+
},
|
|
42
|
+
startDate: {
|
|
43
|
+
day: 1.0,
|
|
44
|
+
month: 4.0,
|
|
45
|
+
year: 2019.0,
|
|
46
|
+
},
|
|
47
|
+
completionDate: {
|
|
48
|
+
day: 1.0,
|
|
49
|
+
month: 5.0,
|
|
50
|
+
year: 2019.0,
|
|
51
|
+
},
|
|
52
|
+
alignment: [
|
|
53
|
+
{
|
|
54
|
+
targetName: 'Microsoft top secret course',
|
|
55
|
+
targetUrl: 'https://www.microsoft.com',
|
|
56
|
+
targetDescription: 'Test Description Data',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
offerId: '5539e308-6f2f-4d01-b946-5ca4ba7fee20',
|
|
61
|
+
...overrides(),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const initUsersRepo = require('../../src/controllers/api/users/repo');
|
|
3
|
+
|
|
4
|
+
module.exports = (app) =>
|
|
5
|
+
register(
|
|
6
|
+
'user',
|
|
7
|
+
initUsersRepo(app)({ config: app.config }),
|
|
8
|
+
async (overrides) => {
|
|
9
|
+
return {
|
|
10
|
+
firstName: 'Adam',
|
|
11
|
+
lastName: 'Smith',
|
|
12
|
+
emails: ['adam.smith@example.com'],
|
|
13
|
+
phones: ['+44 7963587331'],
|
|
14
|
+
address: {
|
|
15
|
+
line1: 'Sunburst Lane 1',
|
|
16
|
+
line2: 'Phoenix',
|
|
17
|
+
countryCode: 'US',
|
|
18
|
+
regionCode: 'AZ',
|
|
19
|
+
},
|
|
20
|
+
label: 'test-label',
|
|
21
|
+
...overrides(),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"company": "did:velocity:bateissuer1234567890",
|
|
3
|
+
"companyName": {
|
|
4
|
+
"localized": {
|
|
5
|
+
"en": "BATE Corporation"
|
|
6
|
+
}
|
|
7
|
+
},
|
|
8
|
+
"title": {
|
|
9
|
+
"localized": {
|
|
10
|
+
"en": "Junior Project Manager"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"startMonthYear": {
|
|
14
|
+
"month": 2,
|
|
15
|
+
"year": 2007
|
|
16
|
+
},
|
|
17
|
+
"endMonthYear": {
|
|
18
|
+
"month": 8,
|
|
19
|
+
"year": 2009
|
|
20
|
+
},
|
|
21
|
+
"location": {
|
|
22
|
+
"countryCode": "US",
|
|
23
|
+
"regionCode": "AZ"
|
|
24
|
+
},
|
|
25
|
+
"description": "Business Operations Junior Project Manager\nManaged the delivery of all National Promotions"
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"company": "did:velocity:iamanissuer1234567890",
|
|
3
|
+
"companyName": {
|
|
4
|
+
"localized": {
|
|
5
|
+
"en": "ACME Corporation"
|
|
6
|
+
}
|
|
7
|
+
},
|
|
8
|
+
"title": {
|
|
9
|
+
"localized": {
|
|
10
|
+
"en": "Project Manager"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"startMonthYear": {
|
|
14
|
+
"month": 8,
|
|
15
|
+
"year": 2009
|
|
16
|
+
},
|
|
17
|
+
"endMonthYear": {
|
|
18
|
+
"month": 1,
|
|
19
|
+
"year": 2015
|
|
20
|
+
},
|
|
21
|
+
"location": {
|
|
22
|
+
"countryCode": "US",
|
|
23
|
+
"regionCode": "CA"
|
|
24
|
+
},
|
|
25
|
+
"description": "Business Delivery Project Manager\nManaged the Roll-out of the Widget Contact proposition to Widgets Vendors"
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"company": "did:velocity:iamanissuer1234567890",
|
|
3
|
+
"companyName": {
|
|
4
|
+
"localized": {
|
|
5
|
+
"en": "ACME Corporation"
|
|
6
|
+
}
|
|
7
|
+
},
|
|
8
|
+
"title": {
|
|
9
|
+
"localized": {
|
|
10
|
+
"en": "Project Manager"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"startMonthYear": {
|
|
14
|
+
"month": 8,
|
|
15
|
+
"year": 2009
|
|
16
|
+
},
|
|
17
|
+
"endMonthYear": {
|
|
18
|
+
"month": 1,
|
|
19
|
+
"year": 2015
|
|
20
|
+
},
|
|
21
|
+
"location": {
|
|
22
|
+
"countryCode": "US",
|
|
23
|
+
"regionCode": "CA"
|
|
24
|
+
},
|
|
25
|
+
"description": "Business Delivery Project Manager\nManaged the Roll-out of the Widget Contact proposition to Widgets Vendors"
|
|
26
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"firstName": { "localized": {"en": "Adam"}},
|
|
3
|
+
"lastName": { "localized": {"en": "Smith"}},
|
|
4
|
+
"emails": ["adam.smith@example.com"],
|
|
5
|
+
"phones": ["+15556192191"],
|
|
6
|
+
"dob": {
|
|
7
|
+
"day": 3,
|
|
8
|
+
"month": 3,
|
|
9
|
+
"year": 1971
|
|
10
|
+
},
|
|
11
|
+
"location": {
|
|
12
|
+
"countryCode": "US",
|
|
13
|
+
"regionCode": "CA"
|
|
14
|
+
},
|
|
15
|
+
"emailCredentials": [{
|
|
16
|
+
"kind": "EmailV1.0",
|
|
17
|
+
"credentialSubject": {
|
|
18
|
+
"email": "adam.smith@example.com"
|
|
19
|
+
}
|
|
20
|
+
}],
|
|
21
|
+
"phoneCredentials": [{
|
|
22
|
+
"kind": "PhoneV1.0",
|
|
23
|
+
"credentialSubject": {
|
|
24
|
+
"phone": "+15556192191"
|
|
25
|
+
}
|
|
26
|
+
}],
|
|
27
|
+
"idDocumentCredentials": [{
|
|
28
|
+
"kind": "DriversLicenseV1.0",
|
|
29
|
+
"credentialSubject": {
|
|
30
|
+
"authority": {
|
|
31
|
+
"name": "California DMV",
|
|
32
|
+
"locality": {
|
|
33
|
+
"addressCountry": "US",
|
|
34
|
+
"addressLocality": "US-CA"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"givenName": "Adam",
|
|
38
|
+
"lastName": "Smith",
|
|
39
|
+
"identityNumber": "12310312312",
|
|
40
|
+
"address": {
|
|
41
|
+
"addressStreet": "400 Bell St",
|
|
42
|
+
"addressCity": "East Palo Alto",
|
|
43
|
+
"addressCountry": "US",
|
|
44
|
+
"addressLocality": "US-CA",
|
|
45
|
+
"addressPostalCode": "94303"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}]
|
|
49
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"firstName": { "localized": {"en": "Adam"}},
|
|
3
|
+
"lastName": { "localized": {"en": "Smith"}},
|
|
4
|
+
"emails": ["adam.smith@example.com"],
|
|
5
|
+
"phones": ["+15556192191"],
|
|
6
|
+
"dob": {
|
|
7
|
+
"day": 3,
|
|
8
|
+
"month": 3,
|
|
9
|
+
"year": 1971
|
|
10
|
+
},
|
|
11
|
+
"location": {
|
|
12
|
+
"countryCode": "US",
|
|
13
|
+
"regionCode": "CA"
|
|
14
|
+
},
|
|
15
|
+
"idDocumentCredentials": [{
|
|
16
|
+
"kind": "DriversLicense",
|
|
17
|
+
"firstName": { "localized": {"en": "Adam"}},
|
|
18
|
+
"lastName": { "localized": {"en": "Smith"}},
|
|
19
|
+
"authority": { "localized": {"en": "California DMV" } },
|
|
20
|
+
"identityNumber": "12310312312",
|
|
21
|
+
"location": {
|
|
22
|
+
"countryCode": "US",
|
|
23
|
+
"regionCode": "CA"
|
|
24
|
+
}
|
|
25
|
+
}],
|
|
26
|
+
"address": {
|
|
27
|
+
"line1": "400 Bell St",
|
|
28
|
+
"line2": "East Palo Alto",
|
|
29
|
+
"postcode": "94303",
|
|
30
|
+
"regionCode": "CA",
|
|
31
|
+
"countryCode": "US"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const { createTestServer } = require('@verii/server-provider');
|
|
2
|
+
const {
|
|
3
|
+
loadTestEnv,
|
|
4
|
+
buildMongoConnection,
|
|
5
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
6
|
+
} = require('@verii/tests-helpers');
|
|
7
|
+
|
|
8
|
+
loadTestEnv();
|
|
9
|
+
|
|
10
|
+
const mongoConnection = buildMongoConnection('test-mockvendor');
|
|
11
|
+
const { flow } = require('lodash/fp');
|
|
12
|
+
const config = require('../../src/config/config');
|
|
13
|
+
const { initServer } = require('../../src/init-server');
|
|
14
|
+
|
|
15
|
+
module.exports = () =>
|
|
16
|
+
flow(createTestServer, initServer)({ ...config, mongoConnection });
|
package/test/helpers/tools/verifgen/templates/PastEmploymentPosition-2009-2015-Project-Manager.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"company": "did:velocity:iamanissuer1234567890",
|
|
3
|
+
"companyName": {
|
|
4
|
+
"localized": {
|
|
5
|
+
"en": "ACME Corporation"
|
|
6
|
+
}
|
|
7
|
+
},
|
|
8
|
+
"title": {
|
|
9
|
+
"localized": {
|
|
10
|
+
"en": "Project Manager"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"startMonthYear": {
|
|
14
|
+
"month": 8,
|
|
15
|
+
"year": 2009
|
|
16
|
+
},
|
|
17
|
+
"endMonthYear": {
|
|
18
|
+
"month": 1,
|
|
19
|
+
"year": 2015
|
|
20
|
+
},
|
|
21
|
+
"location": {
|
|
22
|
+
"countryCode": "US",
|
|
23
|
+
"regionCode": "CA"
|
|
24
|
+
},
|
|
25
|
+
"description": "Business Delivery Project Manager\nManaged the Roll-out of the Widget Contact proposition to Widgets Vendors"
|
|
26
|
+
}
|