@velocitycareerlabs/server-careerwallet 1.25.0-dev-build.12642c864
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 +47 -0
- package/.standalone.env +13 -0
- package/LICENSE +248 -0
- package/jest.config.js +20 -0
- package/migrate-mongo.config.js +25 -0
- package/migrations/20211017180227-create-personas.js +478 -0
- package/migrations/20211026185916-create-vanessa.js +79 -0
- package/migrations/20211026185917-update-personas.js +30 -0
- package/migrations/20211108124410-remove-surplus-personas.js +33 -0
- package/migrations/20211108132353-fix-vanessa-and-sheila.js +25 -0
- package/migrations/20220222123110-add-career-wallet-app-config.js +6 -0
- package/migrations/20220411104157-add-min-app-versions.js +15 -0
- package/migrations/20220419131726-create-nicole-flores-persona.js +63 -0
- package/migrations/20220515114034-update-persona-id-credentials.js +628 -0
- package/migrations/20220608093743-disable-mainnet-holderapp-id-verification.js +21 -0
- package/migrations/20220609063708-enable-mainnet-holderapp-id-verification.js +21 -0
- package/migrations/20220623091507-add-push-url.js +43 -0
- package/migrations/20220624133205-set-min-app-versions-to-11.js +16 -0
- package/migrations/20220710125326-set-min-app-version-to-0.10.7.js +16 -0
- package/migrations/20220811103500-add-verification-service-disclosure-deeplink.js +45 -0
- package/migrations/20220811123751-add-holderapp-dids-to-config.js +74 -0
- package/migrations/20220818072306-add-holderapp-endpoints-to-config.js +21 -0
- package/migrations/20220825090656-update-deeplink.js +46 -0
- package/migrations/20221003151823-app-config-add-public-verification-api.js +18 -0
- package/migrations/20221116085242-add-holderapp-sdk-to-config.js +15 -0
- package/migrations/20221121091030-update-holderapp-deeplink.js +19 -0
- package/migrations/20221128103425-update-holderapp-presentation-template.js +19 -0
- package/migrations/20221221091436-app-config-add-oauth.js +13 -0
- package/migrations/20221226205900-app-config-add-presentation-extension-api.js +18 -0
- package/migrations/20230120113141-update-holderapp-cashSiquence.js +15 -0
- package/migrations/20230123084103-update-holderapp-cacheSequence.js +15 -0
- package/migrations/20230214083430-update-holderapp-cache-Sequence.js +15 -0
- package/migrations/20230225173335-set-min-app-version-1.5.1.js +30 -0
- package/migrations/20230323120629-add-sunil-singh-persona.js +87 -0
- package/migrations/20230329081529-add-personas-by-env.js +294 -0
- package/migrations/20230329103219-remove-unused-personas.js +14 -0
- package/migrations/20230504090208-disable-yoti-migration.js +21 -0
- package/migrations/20230504123425-set-min-app-version-1.8.1.js +38 -0
- package/migrations/20230504185047-enable-yoti-migration.js +21 -0
- package/migrations/20230524053203-add-devices-index.js +16 -0
- package/migrations/20230704000002-add-common-holder-endpoints-to-config.js +16 -0
- package/migrations/20230704000003-add-linkedin-holder-endpoints-to-config.js +18 -0
- package/migrations/20230704104055-update-push-url-and-yoti-url.js +18 -0
- package/migrations/20230705000001-add-liburl-to-holderapp-config.js +20 -0
- package/migrations/20230814113134-app-config-add-oauth-client-id.js +18 -0
- package/migrations/20230821154136-yoti-new-session-url-fix.js +19 -0
- package/migrations/20230907134442-update-holderapp-cache-Sequence.js +15 -0
- package/migrations/20230919180000-set-holderapp-min-app-versions-1.15.0.js +16 -0
- package/migrations/20231011083137-update-holderapp-cache-sequence-6.js +15 -0
- package/migrations/20231102083252-set-holderapp-min-app-versions-1.14.0.js +16 -0
- package/migrations/20231108202229-set-holderapp-min-app-versions-1.15.0.js +16 -0
- package/migrations/20231115143332-holderapp-isDirectIssuerCheckOn-true.js +16 -0
- package/migrations/20231120100020-insert-didKeyMetadatum-for-old-accounts.js +59 -0
- package/migrations/20231207142742-remove-devices-from-accounts.js +46 -0
- package/migrations/20231226090805-app-config-set-direct-issuer-check.js +13 -0
- package/migrations/202312271524-set-holderapp-app-version-1.15.1.js +16 -0
- package/migrations/20232211171700-app-config-update-base-urls.js +18 -0
- package/migrations/20240102093506-holderapp-revert-version-1.15.0.js +16 -0
- package/migrations/202401041618111-holderapp-isDebugOn-false.js +17 -0
- package/migrations/20240131095122-test-personas-add-did.js +102 -0
- package/migrations/202402051547000-update-sdk.js +18 -0
- package/migrations/20240206101448-update-personas-vc-to-v2.js +137 -0
- package/migrations/202402061233000-set-xVnfProtocolVersion-2.js +13 -0
- package/migrations/202402081240000-set-xVnfProtocolVersion-1.js +13 -0
- package/migrations/202402131319-set-holderapp-min-versions-1.17.js +16 -0
- package/migrations/202402141152-set-holderapp-min-version-1.16.js +16 -0
- package/migrations/20240221123501-transform-account-keys-to-stringified-jwk.js +81 -0
- package/migrations/202402290955-update-holderapp-to-verifyMyCreds.js +36 -0
- package/migrations/20240311134223-update-keyid-persona.js +66 -0
- package/migrations/20240312141618-vl-7409-persona-update-maria-williams.js +82 -0
- package/migrations/202403181733000-remove-devices-from-all-accounts.js +27 -0
- package/migrations/20240401091041-set-holderapp-min-version-1.18.1.js +16 -0
- package/migrations/202404071847-app-config-update-yoti-url.js +19 -0
- package/migrations/20240724063405-vl-3827-new-yoti-session-url.js +19 -0
- package/migrations/20240731112302-vl-8160-add-persona-keys.js +101 -0
- package/migrations/20240911115206-vanessa-lin-id-credentials.js +57 -0
- package/migrations/202409201219-add-isWalletAvailable-field.js +13 -0
- package/migrations/202409221012-set-isWalletAvailable-true.js +13 -0
- package/migrations/20240922114643-holderapp-isWalletAvailable-refactor.js +36 -0
- package/migrations/20240923132213-update-android-ios-app-config.js +36 -0
- package/migrations/20240926061732-inc-cacheSequence-to-7.js +15 -0
- package/migrations/20240926073339-inc-cacheSequence-to-7-fix.js +18 -0
- package/migrations/202410081217-adam-smith-id-credntials.js +57 -0
- package/migrations/202410101243-adam_smith-id-credential.js +57 -0
- package/migrations/20241015124307-persona-key-id-type-fix.js +26 -0
- package/migrations/202501291027000-set-holderapp-did-web.js +37 -0
- package/migrations/environments/dev.env +34 -0
- package/migrations/environments/localdev.env +22 -0
- package/migrations/environments/prod.env +18 -0
- package/migrations/environments/qa.env +54 -0
- package/migrations/environments/staging.env +31 -0
- package/migrations/environments/test.env +18 -0
- package/package.json +84 -0
- package/src/assets/category-icons/assessment.png +0 -0
- package/src/assets/category-icons/badge.png +0 -0
- package/src/assets/category-icons/certification.png +0 -0
- package/src/assets/category-icons/education.png +0 -0
- package/src/assets/category-icons/employment.png +0 -0
- package/src/assets/category-icons/gig.png +0 -0
- package/src/assets/category-icons/identity.png +0 -0
- package/src/assets/category-icons/pharmacy.png +0 -0
- package/src/assets/category-icons/training.png +0 -0
- package/src/assets/credentialCategories.json +119 -0
- package/src/config/config.js +156 -0
- package/src/controllers/api/v0.6/accounts/autohooks.js +36 -0
- package/src/controllers/api/v0.6/accounts/controller.js +288 -0
- package/src/controllers/api/v0.6/accounts/schemas/careerwallet-accounts-didkeymetadatum-response.schema.js +41 -0
- package/src/controllers/api/v0.6/accounts/schemas/careerwallet-accounts-request.schema.js +49 -0
- package/src/controllers/api/v0.6/accounts/schemas/careerwallet-accounts-response.schema.js +74 -0
- package/src/controllers/api/v0.6/accounts/schemas/careerwallet-get-account-response.schema.js +72 -0
- package/src/controllers/api/v0.6/accounts/schemas/index.js +6 -0
- package/src/controllers/api/v0.6/careerwallet/appconfig/controller.js +25 -0
- package/src/controllers/api/v0.6/careerwallet/appconfig/repo.js +40 -0
- package/src/controllers/api/v0.6/careerwallet/autohooks.js +5 -0
- package/src/controllers/api/v0.6/careerwallet/consents/controller.js +66 -0
- package/src/controllers/api/v0.6/careerwallet/consents/latest/autohooks.js +7 -0
- package/src/controllers/api/v0.6/careerwallet/consents/latest/controller.js +76 -0
- package/src/controllers/api/v0.6/careerwallet/consents/repo.js +24 -0
- package/src/controllers/api/v0.6/careerwallet/consents/schemas/careerwallet-consent-response.schema.js +23 -0
- package/src/controllers/api/v0.6/careerwallet/consents/schemas/index.js +3 -0
- package/src/controllers/api/v0.6/create_did_key/autohooks.js +10 -0
- package/src/controllers/api/v0.6/create_did_key/controller.js +84 -0
- package/src/controllers/api/v0.6/create_did_key/schemas/index.js +4 -0
- package/src/controllers/api/v0.6/create_did_key/schemas/jwk-did-request.schema.js +20 -0
- package/src/controllers/api/v0.6/create_did_key/schemas/jwk-did-response.schema.js +41 -0
- package/src/controllers/api/v0.6/create_jwk/autohooks.js +10 -0
- package/src/controllers/api/v0.6/create_jwk/controller.js +46 -0
- package/src/controllers/api/v0.6/create_jwk/schemas/index.js +3 -0
- package/src/controllers/api/v0.6/create_jwk/schemas/jwk-response.schema.js +33 -0
- package/src/controllers/api/v0.6/credential-categories/controller.js +35 -0
- package/src/controllers/api/v0.6/devices/autohooks.js +11 -0
- package/src/controllers/api/v0.6/devices/controller.js +323 -0
- package/src/controllers/api/v0.6/devices/repo.js +27 -0
- package/src/controllers/api/v0.6/devices/schemas/device.schema.json +43 -0
- package/src/controllers/api/v0.6/devices/schemas/index.js +3 -0
- package/src/controllers/api/v0.6/feedback/controller.js +24 -0
- package/src/controllers/api/v0.6/feedback/schemas/index.js +3 -0
- package/src/controllers/api/v0.6/feedback/schemas/new-feedback.schema.js +47 -0
- package/src/controllers/api/v0.6/jwt/autohooks.js +10 -0
- package/src/controllers/api/v0.6/jwt/controller.js +44 -0
- package/src/controllers/api/v0.6/jwt/schemas/index.js +4 -0
- package/src/controllers/api/v0.6/jwt/schemas/jwt-request.schema.js +40 -0
- package/src/controllers/api/v0.6/jwt/schemas/jwt-response.schema.js +14 -0
- package/src/controllers/api/v0.6/oauth/controller.js +131 -0
- package/src/controllers/api/v0.6/push/controller.js +296 -0
- package/src/controllers/api/v0.6/push/firebase-initializer.js +21 -0
- package/src/controllers/api/v0.6/push/notification-types.js +37 -0
- package/src/controllers/api/v0.6/push/push-gateway-auth.js +123 -0
- package/src/controllers/api/v0.6/push/repo.js +24 -0
- package/src/controllers/api/v0.6/verification-offers/repo.js +25 -0
- package/src/controllers/api/v0.6/verify/autohooks.js +15 -0
- package/src/controllers/api/v0.6/verify/controller.js +348 -0
- package/src/controllers/api/v0.6/verify/repo.js +23 -0
- package/src/controllers/api/v0.6/verify/verification-credential-types.js +6 -0
- package/src/controllers/jwt/autohooks.js +10 -0
- package/src/controllers/jwt/controller.js +106 -0
- package/src/controllers/jwt/schemas/index.js +31 -0
- package/src/controllers/jwt/schemas/jwt-decode.response.200.schema.json +20 -0
- package/src/controllers/jwt/schemas/jwt-decode.schema.json +15 -0
- package/src/controllers/jwt/schemas/jwt-sign.response.200.schema.json +14 -0
- package/src/controllers/jwt/schemas/jwt-sign.schema.json +40 -0
- package/src/controllers/jwt/schemas/jwt-verify.response.200.schema.json +17 -0
- package/src/controllers/jwt/schemas/jwt-verify.schema.json +19 -0
- package/src/controllers/reference/autohooks.js +5 -0
- package/src/controllers/reference/countries/controller.js +81 -0
- package/src/controllers/reference/personas/controller.js +91 -0
- package/src/controllers/reference/personas/repo.js +29 -0
- package/src/controllers/reference/personas/schemas/index.js +3 -0
- package/src/controllers/reference/personas/schemas/persona.schema.json +108 -0
- package/src/controllers/root/controller.js +27 -0
- package/src/entities/accounts/constants.js +18 -0
- package/src/entities/accounts/domain/index.js +3 -0
- package/src/entities/accounts/domain/merge-scopes.js +9 -0
- package/src/entities/accounts/index.js +5 -0
- package/src/entities/accounts/repos/accounts.repo.js +64 -0
- package/src/entities/accounts/repos/id-token-claims-extension.js +31 -0
- package/src/entities/accounts/repos/index.js +3 -0
- package/src/entities/devices/constants.js +7 -0
- package/src/entities/devices/index.js +3 -0
- package/src/entities/feedback/domain/generate-feedback-email.js +23 -0
- package/src/entities/feedback/domain/index.js +3 -0
- package/src/entities/feedback/index.js +3 -0
- package/src/entities/index.js +9 -0
- package/src/entities/key-pairs/index.js +4 -0
- package/src/entities/key-pairs/orchestrators/generate-jwk.js +28 -0
- package/src/entities/key-pairs/orchestrators/get-key-pair.js +58 -0
- package/src/entities/key-pairs/orchestrators/index.js +4 -0
- package/src/entities/key-pairs/repos/index.js +3 -0
- package/src/entities/key-pairs/repos/key-pairs.repo.js +23 -0
- package/src/entities/oauth/constants.js +13 -0
- package/src/entities/oauth/domain/build-access-token.js +14 -0
- package/src/entities/oauth/domain/index.js +10 -0
- package/src/entities/oauth/domain/validate-audience.js +13 -0
- package/src/entities/oauth/domain/validate-client-id.js +13 -0
- package/src/entities/oauth/domain/validate-credential.js +16 -0
- package/src/entities/oauth/domain/validate-presentation.js +17 -0
- package/src/entities/oauth/domain/validate-refresh-token.js +17 -0
- package/src/entities/oauth/domain/validate-scope.js +30 -0
- package/src/entities/oauth/domain/verify-presentation.js +24 -0
- package/src/entities/oauth/index.js +4 -0
- package/src/entities/pushes/domains/errors.js +11 -0
- package/src/entities/pushes/domains/index.js +3 -0
- package/src/entities/pushes/index.js +3 -0
- package/src/entities/verification-code-attempts/index.js +3 -0
- package/src/entities/verification-code-attempts/orchestrators/index.js +3 -0
- package/src/entities/verification-code-attempts/orchestrators/validate-verification-code-attempts.js +79 -0
- package/src/entities/verification-code-attempts/repo.js +99 -0
- package/src/entities/verifications/constants.js +8 -0
- package/src/entities/verifications/index.js +3 -0
- package/src/helpers/caching-constants.js +6 -0
- package/src/helpers/index.js +3 -0
- package/src/index.js +15 -0
- package/src/init-server.js +88 -0
- package/src/plugins/index.js +4 -0
- package/src/plugins/vcl-verification-version-plugin.js +10 -0
- package/src/plugins/verify-access-token-plugin.js +116 -0
- package/src/standalone.js +8 -0
- package/test/accounts-controller.test.js +893 -0
- package/test/accounts-repo.test.js +92 -0
- package/test/careerwallet-config-controller.test.js +142 -0
- package/test/careerwallet-consents-controller.test.js +409 -0
- package/test/create_did_key-controller.test.js +397 -0
- package/test/create_jwk-controller.test.js +188 -0
- package/test/credential-categories-controller.test.js +29 -0
- package/test/credential-icons-controller.test.js +36 -0
- package/test/devices-controller.test.js +1025 -0
- package/test/factories/accounts-factory.js +15 -0
- package/test/factories/career-wallet-config-factory.js +60 -0
- package/test/factories/consents-career-wallet-factory.js +21 -0
- package/test/factories/devices-factory.js +16 -0
- package/test/factories/key-pairs-factory.js +18 -0
- package/test/factories/notifications-factory.js +16 -0
- package/test/factories/persona-factory.js +17 -0
- package/test/factories/refresh-tokens-factory.js +14 -0
- package/test/factories/verification-code-attempts-factory.js +17 -0
- package/test/factories/verification-factory.js +15 -0
- package/test/factories/verification-offer-factory.js +20 -0
- package/test/feedback-controller.test.js +225 -0
- package/test/helpers/.env.test +39 -0
- package/test/helpers/access-token.js +59 -0
- package/test/helpers/careerwallet-build-fastify.js +20 -0
- package/test/helpers/yoti.js +96 -0
- package/test/id-verification-controller.test.js +27 -0
- package/test/jwt-controller.test.js +1519 -0
- package/test/oauth-controller.test.js +639 -0
- package/test/push-controller.test.js +733 -0
- package/test/push-gateway-auth.test.js +208 -0
- package/test/reference-countries-controller.test.js +45 -0
- package/test/reference-personas-controller.test.js +179 -0
- package/test/root.test.js +21 -0
- package/test/swagger.test.js +21 -0
- package/test/verification-controller.test.js +1372 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const initAccountsRepo = require('../../src/entities/accounts/repos/accounts.repo');
|
|
3
|
+
|
|
4
|
+
module.exports = (app) =>
|
|
5
|
+
register(
|
|
6
|
+
'accounts',
|
|
7
|
+
initAccountsRepo(app)({ config: app.config }),
|
|
8
|
+
async (overrides) => ({
|
|
9
|
+
accountType: 'temp',
|
|
10
|
+
scope: [app.config.holderAppServerOAuthScopes.split(' ')[0]],
|
|
11
|
+
refreshToken: 'test_refresh_token',
|
|
12
|
+
didKeyMetadatum: [],
|
|
13
|
+
...overrides(),
|
|
14
|
+
})
|
|
15
|
+
);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
|
|
3
|
+
const careerWalletConfigRepoPlugin = require('../../src/controllers/api/v0.6/careerwallet/appconfig/repo');
|
|
4
|
+
|
|
5
|
+
module.exports = (app) =>
|
|
6
|
+
register(
|
|
7
|
+
'careerWalletConfig',
|
|
8
|
+
careerWalletConfigRepoPlugin(app)({ config: app.config }),
|
|
9
|
+
async (overrides) => {
|
|
10
|
+
return {
|
|
11
|
+
ios: {
|
|
12
|
+
isWalletAvailable: true,
|
|
13
|
+
},
|
|
14
|
+
android: {
|
|
15
|
+
isWalletAvailable: true,
|
|
16
|
+
},
|
|
17
|
+
yotiIDV: true,
|
|
18
|
+
latestAndroidVersion: '0.10.5',
|
|
19
|
+
latestIOSVersion: '0.10.5',
|
|
20
|
+
minAndroidVersion: '0.10.5',
|
|
21
|
+
minIOSVersion: '0.10.5',
|
|
22
|
+
pushUrl: 'https://example.com/push',
|
|
23
|
+
baseUrls: {
|
|
24
|
+
walletApi: 'https://example.walletapi.com',
|
|
25
|
+
verificationApi: 'https://example.verificationApi.com',
|
|
26
|
+
verificationServiceActionBaseUrl:
|
|
27
|
+
'https://example.publicVerificationApi.com',
|
|
28
|
+
presentationExtensionPeriodURL:
|
|
29
|
+
'https://example.get-extension-period',
|
|
30
|
+
libVnfUrl: 'https://example.lib.com',
|
|
31
|
+
},
|
|
32
|
+
sdk: {
|
|
33
|
+
cacheSequence: 1,
|
|
34
|
+
},
|
|
35
|
+
oauth: {
|
|
36
|
+
oauthAudience: 'testOauthAudience',
|
|
37
|
+
clientId: 'testOauthClientId',
|
|
38
|
+
},
|
|
39
|
+
idVerifierDid: 'idVerifierDid',
|
|
40
|
+
emailVerifierDid: 'emailVerifierDid',
|
|
41
|
+
phoneVerifierDid: 'phoneVerifierDid',
|
|
42
|
+
yotiNewSessionUrl: 'https://yoti.com',
|
|
43
|
+
verificationServiceDeepLink:
|
|
44
|
+
'https://example.verificationServiceDeepLink',
|
|
45
|
+
verificationServicePresentationLinkTemplate:
|
|
46
|
+
'https://example.verificationServicePresentationLinkTemplate',
|
|
47
|
+
commonUrls: {
|
|
48
|
+
supportLink: 'https://www.velocitycareerlabs.com/faq',
|
|
49
|
+
termsAndConditionsLink: 'https://app.prove.bio/privacy-policy',
|
|
50
|
+
},
|
|
51
|
+
linkedinEndpoints: {
|
|
52
|
+
authUrl: 'https://www.linkedin.com/oauth/v2',
|
|
53
|
+
apiUrl: 'https://api.linkedin.com/v2',
|
|
54
|
+
addToProfileUrl: 'https://www.linkedin.com/profile/add',
|
|
55
|
+
addToFeed: 'https://www.linkedin.com/feed/update',
|
|
56
|
+
},
|
|
57
|
+
...overrides(),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
const { register } = require('@spencejs/spence-factories');
|
|
3
|
+
|
|
4
|
+
const consentsRepoPlugin = require('../../src/controllers/api/v0.6/careerwallet/consents/repo');
|
|
5
|
+
|
|
6
|
+
module.exports = (app) => {
|
|
7
|
+
return register(
|
|
8
|
+
'consentsCareerWallet',
|
|
9
|
+
consentsRepoPlugin(app)({ config: app.config }),
|
|
10
|
+
async (overrides) => {
|
|
11
|
+
const date = new Date();
|
|
12
|
+
return {
|
|
13
|
+
accountId: 'mocked-user-id',
|
|
14
|
+
version: '1.0',
|
|
15
|
+
createdAt: date,
|
|
16
|
+
updatedAt: date,
|
|
17
|
+
...overrides(),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const { nanoid } = require('nanoid/non-secure');
|
|
3
|
+
const initDevicesRepo = require('../../src/controllers/api/v0.6/devices/repo');
|
|
4
|
+
|
|
5
|
+
module.exports = (app) =>
|
|
6
|
+
register(
|
|
7
|
+
'devices',
|
|
8
|
+
initDevicesRepo(app)({ config: app.config }),
|
|
9
|
+
async (overrides) => ({
|
|
10
|
+
deviceId: nanoid(),
|
|
11
|
+
deviceType: 'phone',
|
|
12
|
+
deviceOS: 'ios',
|
|
13
|
+
pushToken: nanoid(),
|
|
14
|
+
...overrides(),
|
|
15
|
+
})
|
|
16
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const initKeyPairsRepo = require('../../src/entities/key-pairs/repos/key-pairs.repo');
|
|
3
|
+
|
|
4
|
+
module.exports = (app) =>
|
|
5
|
+
register(
|
|
6
|
+
'keyPairs',
|
|
7
|
+
initKeyPairsRepo(app)({ config: app.config }),
|
|
8
|
+
async (overrides) => {
|
|
9
|
+
const date = new Date();
|
|
10
|
+
return {
|
|
11
|
+
encryptedPrivateKey: 'abc',
|
|
12
|
+
publicKey: 'cba',
|
|
13
|
+
createdAt: date,
|
|
14
|
+
updatedAt: date,
|
|
15
|
+
...overrides(),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const { nanoid } = require('nanoid/non-secure');
|
|
3
|
+
const initNotificationsRepo = require('../../src/controllers/api/v0.6/push/repo');
|
|
4
|
+
|
|
5
|
+
module.exports = (app) =>
|
|
6
|
+
register(
|
|
7
|
+
'notifications',
|
|
8
|
+
initNotificationsRepo(app)({ config: app.config }),
|
|
9
|
+
async (overrides) => ({
|
|
10
|
+
deviceId: nanoid(),
|
|
11
|
+
linkedDevice: nanoid(),
|
|
12
|
+
notification: {},
|
|
13
|
+
data: {},
|
|
14
|
+
...overrides(),
|
|
15
|
+
})
|
|
16
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const initPersonasRepo = require('../../src/controllers/reference/personas/repo');
|
|
3
|
+
|
|
4
|
+
module.exports = (app) =>
|
|
5
|
+
register(
|
|
6
|
+
'persona',
|
|
7
|
+
initPersonasRepo(app)({ config: app.config }),
|
|
8
|
+
async (overrides) => {
|
|
9
|
+
return {
|
|
10
|
+
name: 'Joe Smith',
|
|
11
|
+
email: 'joe.smith@example.com',
|
|
12
|
+
image: 'http://imgur.co/joe-smith.jpg',
|
|
13
|
+
vcs: [],
|
|
14
|
+
...overrides(),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const { refreshTokensRepoPlugin } = require('../../src/entities');
|
|
3
|
+
|
|
4
|
+
module.exports = (app) =>
|
|
5
|
+
register(
|
|
6
|
+
'refreshToken',
|
|
7
|
+
refreshTokensRepoPlugin(app)({ config: app.config }),
|
|
8
|
+
async (overrides) => {
|
|
9
|
+
return {
|
|
10
|
+
token: 'foo',
|
|
11
|
+
...overrides(),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
|
|
3
|
+
const verificationCodeAttemptsRepoPlugin = require('../../src/entities/verification-code-attempts/repo');
|
|
4
|
+
|
|
5
|
+
module.exports = (app) => {
|
|
6
|
+
return register(
|
|
7
|
+
'verificationCodeAttempt',
|
|
8
|
+
verificationCodeAttemptsRepoPlugin(app)({ config: app.config }),
|
|
9
|
+
async (overrides) => {
|
|
10
|
+
return {
|
|
11
|
+
attemptedAt: new Date(),
|
|
12
|
+
key: 'foo',
|
|
13
|
+
...overrides(),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const { generateRandomNumber } = require('@velocitycareerlabs/crypto');
|
|
3
|
+
const initVerificationRepo = require('../../src/controllers/api/v0.6/verify/repo');
|
|
4
|
+
|
|
5
|
+
module.exports = (app) =>
|
|
6
|
+
register(
|
|
7
|
+
'verification',
|
|
8
|
+
initVerificationRepo(app)({ config: app.config }),
|
|
9
|
+
async (overrides) => ({
|
|
10
|
+
type: 'email',
|
|
11
|
+
value: 'test@example.com',
|
|
12
|
+
attemptId: (await generateRandomNumber(6)).toString(),
|
|
13
|
+
...overrides(),
|
|
14
|
+
})
|
|
15
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const { register } = require('@spencejs/spence-factories');
|
|
2
|
+
const { nanoid } = require('nanoid/non-secure');
|
|
3
|
+
const { addHours } = require('date-fns/fp');
|
|
4
|
+
const VerificationCredentialTypes = require('../../src/controllers/api/v0.6/verify/verification-credential-types');
|
|
5
|
+
const initVerificationOfferRepo = require('../../src/controllers/api/v0.6/verification-offers/repo');
|
|
6
|
+
|
|
7
|
+
module.exports = (app) =>
|
|
8
|
+
register(
|
|
9
|
+
'verificationOffer',
|
|
10
|
+
initVerificationOfferRepo(app)({ config: app.config }),
|
|
11
|
+
async (overrides) => ({
|
|
12
|
+
type: [VerificationCredentialTypes.EmailAddressVerification],
|
|
13
|
+
value: 'alex@example.com',
|
|
14
|
+
offerId: nanoid(),
|
|
15
|
+
offerCreationDate: new Date(),
|
|
16
|
+
offerExpirationDate: addHours(1, new Date()),
|
|
17
|
+
claimed: false,
|
|
18
|
+
...overrides(),
|
|
19
|
+
})
|
|
20
|
+
);
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
require('aws-sdk');
|
|
2
|
+
const { errorResponseMatcher } = require('@velocitycareerlabs/tests-helpers');
|
|
3
|
+
const buildFastify = require('./helpers/careerwallet-build-fastify');
|
|
4
|
+
|
|
5
|
+
const mockSendEmail = jest.fn().mockReturnValue({ promise: jest.fn() });
|
|
6
|
+
jest.mock('aws-sdk', () => ({
|
|
7
|
+
SES: jest.fn().mockImplementation(() => ({ sendEmail: mockSendEmail })),
|
|
8
|
+
Credentials: jest.fn().mockImplementation(() => ({})),
|
|
9
|
+
KMS: jest.fn().mockImplementation(() => ({})),
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
describe('Feedback controller test suite', () => {
|
|
13
|
+
let fastify;
|
|
14
|
+
|
|
15
|
+
beforeAll(async () => {
|
|
16
|
+
fastify = buildFastify();
|
|
17
|
+
await fastify.ready();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
jest.clearAllMocks();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
afterAll(async () => {
|
|
25
|
+
await fastify.close();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should throw error if accountId does not exist', async () => {
|
|
29
|
+
const response = await fastify.inject({
|
|
30
|
+
method: 'POST',
|
|
31
|
+
url: '/api/v0.6/feedback',
|
|
32
|
+
payload: {},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
expect(response.statusCode).toEqual(400);
|
|
36
|
+
expect(response.json()).toEqual(
|
|
37
|
+
errorResponseMatcher({
|
|
38
|
+
error: 'Bad Request',
|
|
39
|
+
errorCode: 'request_validation_failed',
|
|
40
|
+
message: "body must have required property 'accountId'",
|
|
41
|
+
statusCode: 400,
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should throw error if feedBack does not exist', async () => {
|
|
47
|
+
const response = await fastify.inject({
|
|
48
|
+
method: 'POST',
|
|
49
|
+
url: '/api/v0.6/feedback',
|
|
50
|
+
payload: {
|
|
51
|
+
accountId: 'accountId',
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
expect(response.statusCode).toEqual(400);
|
|
56
|
+
expect(response.json()).toEqual(
|
|
57
|
+
errorResponseMatcher({
|
|
58
|
+
error: 'Bad Request',
|
|
59
|
+
errorCode: 'request_validation_failed',
|
|
60
|
+
message: "body must have required property 'feedback'",
|
|
61
|
+
statusCode: 400,
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should throw error if appVersion does not exist', async () => {
|
|
67
|
+
const response = await fastify.inject({
|
|
68
|
+
method: 'POST',
|
|
69
|
+
url: '/api/v0.6/feedback',
|
|
70
|
+
payload: {
|
|
71
|
+
accountId: 'accountId',
|
|
72
|
+
feedback: 'feedback',
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
expect(response.statusCode).toEqual(400);
|
|
77
|
+
expect(response.json()).toEqual(
|
|
78
|
+
errorResponseMatcher({
|
|
79
|
+
error: 'Bad Request',
|
|
80
|
+
errorCode: 'request_validation_failed',
|
|
81
|
+
message: "body must have required property 'appVersion'",
|
|
82
|
+
statusCode: 400,
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should throw error if deviceManufacturer does not exist', async () => {
|
|
88
|
+
const response = await fastify.inject({
|
|
89
|
+
method: 'POST',
|
|
90
|
+
url: '/api/v0.6/feedback',
|
|
91
|
+
payload: {
|
|
92
|
+
accountId: 'accountId',
|
|
93
|
+
feedback: 'feedback',
|
|
94
|
+
appVersion: 'appVersion',
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
expect(response.statusCode).toEqual(400);
|
|
99
|
+
expect(response.json()).toEqual(
|
|
100
|
+
errorResponseMatcher({
|
|
101
|
+
error: 'Bad Request',
|
|
102
|
+
errorCode: 'request_validation_failed',
|
|
103
|
+
message: "body must have required property 'deviceManufacturer'",
|
|
104
|
+
statusCode: 400,
|
|
105
|
+
})
|
|
106
|
+
);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('should throw error if deviceModel does not exist', async () => {
|
|
110
|
+
const response = await fastify.inject({
|
|
111
|
+
method: 'POST',
|
|
112
|
+
url: '/api/v0.6/feedback',
|
|
113
|
+
payload: {
|
|
114
|
+
accountId: 'accountId',
|
|
115
|
+
feedback: 'feedback',
|
|
116
|
+
appVersion: 'appVersion',
|
|
117
|
+
deviceManufacturer: 'deviceManufacturer',
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
expect(response.statusCode).toEqual(400);
|
|
122
|
+
expect(response.json()).toEqual(
|
|
123
|
+
errorResponseMatcher({
|
|
124
|
+
error: 'Bad Request',
|
|
125
|
+
errorCode: 'request_validation_failed',
|
|
126
|
+
message: "body must have required property 'deviceModel'",
|
|
127
|
+
statusCode: 400,
|
|
128
|
+
})
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('should throw error if deviceOS does not exist', async () => {
|
|
133
|
+
const response = await fastify.inject({
|
|
134
|
+
method: 'POST',
|
|
135
|
+
url: '/api/v0.6/feedback',
|
|
136
|
+
payload: {
|
|
137
|
+
accountId: 'accountId',
|
|
138
|
+
feedback: 'feedback',
|
|
139
|
+
appVersion: 'appVersion',
|
|
140
|
+
deviceManufacturer: 'deviceManufacturer',
|
|
141
|
+
deviceModel: 'deviceModel',
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
expect(response.statusCode).toEqual(400);
|
|
146
|
+
expect(response.json()).toEqual(
|
|
147
|
+
errorResponseMatcher({
|
|
148
|
+
error: 'Bad Request',
|
|
149
|
+
errorCode: 'request_validation_failed',
|
|
150
|
+
message: "body must have required property 'deviceOS'",
|
|
151
|
+
statusCode: 400,
|
|
152
|
+
})
|
|
153
|
+
);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('should throw error if ip does not exist', async () => {
|
|
157
|
+
const response = await fastify.inject({
|
|
158
|
+
method: 'POST',
|
|
159
|
+
url: '/api/v0.6/feedback',
|
|
160
|
+
payload: {
|
|
161
|
+
accountId: 'accountId',
|
|
162
|
+
feedback: 'feedback',
|
|
163
|
+
appVersion: 'appVersion',
|
|
164
|
+
deviceManufacturer: 'deviceManufacturer',
|
|
165
|
+
deviceModel: 'deviceModel',
|
|
166
|
+
deviceOS: 'deviceOS',
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
expect(response.statusCode).toEqual(400);
|
|
171
|
+
expect(response.json()).toEqual(
|
|
172
|
+
errorResponseMatcher({
|
|
173
|
+
error: 'Bad Request',
|
|
174
|
+
errorCode: 'request_validation_failed',
|
|
175
|
+
message: "body must have required property 'ip'",
|
|
176
|
+
statusCode: 400,
|
|
177
|
+
})
|
|
178
|
+
);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('should 204 and send email', async () => {
|
|
182
|
+
const response = await fastify.inject({
|
|
183
|
+
method: 'POST',
|
|
184
|
+
url: '/api/v0.6/feedback',
|
|
185
|
+
payload: {
|
|
186
|
+
accountId: 'accountId',
|
|
187
|
+
feedback: 'feedback',
|
|
188
|
+
appVersion: 'appVersion',
|
|
189
|
+
deviceManufacturer: 'deviceManufacturer',
|
|
190
|
+
deviceModel: 'deviceModel',
|
|
191
|
+
deviceOS: 'deviceOS',
|
|
192
|
+
ip: 'ip',
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
expect(response.statusCode).toEqual(204);
|
|
197
|
+
expect(mockSendEmail).toHaveBeenCalledTimes(1);
|
|
198
|
+
expect(mockSendEmail).toHaveBeenCalledWith({
|
|
199
|
+
Destination: {
|
|
200
|
+
ToAddresses: ['vcl.devnet@gmail.com'],
|
|
201
|
+
},
|
|
202
|
+
ReplyToAddresses: [undefined],
|
|
203
|
+
Source: 'no-reply@velocitynetwork.foundation',
|
|
204
|
+
Message: {
|
|
205
|
+
Body: {
|
|
206
|
+
Text: {
|
|
207
|
+
Data: `
|
|
208
|
+
Support Request - Account Feedback.
|
|
209
|
+
User Information:
|
|
210
|
+
Account ID: accountId
|
|
211
|
+
Feedback: feedback
|
|
212
|
+
Error Code (if applicable): undefined
|
|
213
|
+
App Version: appVersion
|
|
214
|
+
Device Manufacturer: deviceManufacturer
|
|
215
|
+
Device Model: deviceModel
|
|
216
|
+
Device OS: deviceOS
|
|
217
|
+
IP Address: ip
|
|
218
|
+
`,
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
Subject: { Data: 'TEST: Support Request - Account Feedback.' },
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
HOST_URL=http://localhost.test
|
|
2
|
+
MONGO_SECRET=1445253CA16FA4649F6D3C49E8D26
|
|
3
|
+
SECRET=1445253CA16FA4649F6D3C49E8D26
|
|
4
|
+
ADMIN_USER_NAME=velocity.admin@example.com
|
|
5
|
+
ROOT_DID=did:velocity:rootissuer1234567890
|
|
6
|
+
VERIFICATION_SENDER_EMAIL=sender@example.com
|
|
7
|
+
REGISTRAR_URL=http://registrar.localhost.test
|
|
8
|
+
LIB_URL=http://lib.localhost.test
|
|
9
|
+
AGENT_URL=http://credentialagent.localhost.test
|
|
10
|
+
YOTI_CLIENT_SDK_ID=024e10dd-fc2a-4352-b13e-ad5e3853d14a
|
|
11
|
+
YOTI_SECRET="-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAtwYz3SyHXPF390qoVrWY5WaxgJ8+EVKVqhXtKnEGgDKe7zg3\n75gucwYZ0OR2CPI+DqsCzxTZ49HzDmCS1U+YpMLUfHFYozj1q90YJMdTHYbqhel7\nt0cEDetp1zgANilz5vxGY6PTSRYzmejxG5RBR0mv6bVZk04l1AWBi4AMLZ5FByU9\noJnZZLyAicIWThIpo/dNP+8XD56JeskOLeqorV/8u+ozqH4+ywIvigEYsRihxIV/\nVVkf7gf/aOmnJ2vWS1mrUevrZux/J7O6M7WT9iZNW0p+OCmx+rmZDIoP4UREqpwL\ng2Bt0QxOkso4VP5sHMi/x7w0y2JBJQxlelivpwIDAQABAoIBABkOVFNXIUDsHcxR\nADK+savWHz7Ijiq475xVXB6PUqCCTZfaTm4Sm2lL0IT0geQ/pZdEeiH3bMzvlSLG\nvdNODkugEI7oxYWy6o8YuZFvaEWGjty+Vh2FL1zoeZjpJb5EdoWMy+YgK3C6BV5w\nsXFhHn6v69FG7nhoHm2kQ1Pht8kWwbMswYHmrKIBuQjGxla5HTjPRQHvBbtvVkEf\nKJ9Z6YhtW7pBMwjIIVyzUJ6lRm+9N6lRgg8+U40vphlfAFYBW+x3tv/WzsQv53F0\ne8sOQVwILJqSZ6r02jriOSwK5tp4Ce3hnjPDAhBaAw7GrHDbgxrYpWK2lZIx68i3\nbxW+tWECgYEA/xN8/fPDGyVxhKu12asmE6F6qNxe72GRU4r9lOMQTaebCcMTCb+3\nWUkKn9N7qzj7zpLn8CHK41TARKxmAiFniw53nlYkHj4QoMSADloZK7nvhWP1+Mul\ncpZ0JYDGuHp/sq8hRdSs4tI3vDj+b44KzBTdQn7VleIJwL/xes+mxcsCgYEAt6/o\nB49jKxxNEMvn98WFI8PQXSK8Gw4e95tpCqBEIak9PaA/N1IIAVUX7/wzyq/Rvh76\nezTqCK6lVroWB0NfM+cQvwsjCImRPIIiSZhEvcUD+U6rimgqKbbGwyViPvAZ7iWb\nhqRH3RNCCr0KztbufX7aeht6EoF/0icnP6mAohUCgYBpw4TiL77IdMAbCK/Ab2y8\nWwpnFejvTP9bKph2safC6yon5BDyy+GUTerv1lrC5j/SqasuMHTVygBm+Sza2Ur7\np6YFqyYSvB1c691FFiq1rMUaBBarcJVLbAMAweKj/3cPefpL4CFHc27UxrUJQFZN\nxKDxv3GEUlNE7tGL4Kn//QKBgA44rkw3i8QAsu7D+reyMTatqGotkEa/9yHQhHdw\nJRY+FiG5UGumDDyeK/ZGnnPo3OJNX7M+S4hUjTSDv8TcMHjCQQepgxLcI8R9hs4P\n3fKbWE1rC9jxa6JDJmxhbpPU3w0TGFF6Up4JKanPLREKjvhkY+HkUrUwFYddxKon\nI3BpAoGAN6VWcwMXAUcYvSJ9lt+Q/ore+rmuMyuiiW5TtgUkR7Vbmf2lmfN+xF5h\nYO8QoT2EguY3w15IlBB948vvU18GcAI50rsO5q0eBQ/vAuNm1GXdyOMZxfdPnnUd\nypq/4ikZrah2zKsB6XKitGBe/6XnuT1GHWhyx5x5SxolO9yoFao=\n-----END RSA PRIVATE KEY-----"
|
|
12
|
+
YOTI_IDV_API_URL=https://api.yoti.com/sandbox/idverify/v1
|
|
13
|
+
ID_VERIFICATION_TENANT_ID=did:velocity:test-id-verification-tenant-did
|
|
14
|
+
AWS_REGION=us-east-1
|
|
15
|
+
AWS_ENDPOINT=http://localhost:4566
|
|
16
|
+
BEARER_TOKEN=fake-bearer-token
|
|
17
|
+
HOLDER_APP_CLIENT_ID=abc
|
|
18
|
+
OAUTH_VCL_CREDENTIAL_VERIFICATION_PUBLIC_KEY="{"kty":"EC","x":"DtQuxvvWflgP4Kz3KrJ3hZDzBKr5di12w1EZZyHStBU","y":"ER7tm9EyhzK-bShZmkQ9pwjFn5kBihqlzeITJ9pCC1A","crv":"secp256k1"}"
|
|
19
|
+
ACCESS_TOKEN_PUBLIC_KEY="{"kty":"EC","x":"DtQuxvvWflgP4Kz3KrJ3hZDzBKr5di12w1EZZyHStBU","y":"ER7tm9EyhzK-bShZmkQ9pwjFn5kBihqlzeITJ9pCC1A","crv":"secp256k1"}"
|
|
20
|
+
HOLDER_APP_PROVIDER_DID=did:ion:abc
|
|
21
|
+
ACCESS_TOKEN_SIGNING_KEY=foo
|
|
22
|
+
FIREBASE_TYPE=service_account
|
|
23
|
+
FIREBASE_PROJECT_ID=velocity-career-labs-dev
|
|
24
|
+
FIREBASE_PRIVATE_KEY_ID=EMPTY
|
|
25
|
+
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDObmFSE0+ke8nV\nP0MCxqgHsdzlhB5p8h0FdSFG/P3ZEKIWQ009VUf26fOda5j04ksCIq3kDIi4y6Xp\n1PwjS7LJZd3MZIUKiJPo2iqO7D3cbv4FQxsJW/Mm2GnRGCxfo30D9xLuysj/IV5o\n09/J7akxttYnWnFDOQKOMbcflYiYo/M7WW+57aSSxxgjTXraZSkODAxCnXIt2lA7\n8hlEevTCQy37RRSuY/vPUOqG2aY7D1G4ZxHiGE1YtGYYCU5wRjwfmO/HVhwx87Md\nsPOLgFDVkFYd3yFFG2kKg+U6CV7JmZREidwtB4vWnHzUw+FGyBo9SYWd1g1TpQ1H\n3F6LEjlrAgMBAAECggEAPk/OW66Nl1pwccjPSvq5RN1ZDwTjA1r8jKWvHlUGsSuW\nqb62BYIFH5C+IzIT8TOPrbzXHaP070c1tVA/rc3PUYDIw0ZCbIwOjbaxKwQ/phbw\n4ZjAhAI38u1Xf7Da0CGy/mvp0J/wrSae72ipQDRXorSMj0N7Ne3zCgYSv1ttaJll\nt4D5fhJP7XzyGBnNA5EP79NCcQJPLxaI18Zt0NkvPRw437z6ntf3v2jIgubKdPkd\nPB74L6hZwmOtaxAEzYVR7l9NUtb5ifELAU0y+FPUHFsT0+AjtcWln2+02ZKhwGwC\nNEXF8zJf2/y/XmG+iIdbpSY4nRifmg8EXBQWSCScIQKBgQDy4lB1b8NEpxidScZO\n8dPbzhJLw+tHJhXkAXJyV7CAK5ZPLvm34LC1zx8SrYpR4SPWO2SOzOo+Sk4A+kmR\nYlP1mgGHj1f8/0rGB79Lomk43WPvBYy/Slga84AdfYf1wsDEhtFrScO8dGviL05f\nVlOICt1cqHbPU901yUTaEEnMCwKBgQDZlCIGR1jPUNJMe4PU0a5QmLbQA4rRvZnj\nMfKhF3GINZnUBn9J/W//95UN5mBIn5/KEwdwQJh4tS5Rni4ZSf1ivjrg21pC7acB\nTsBKO3KXhHEq2ZyIMdWDlfctwECIwBBxKqY8qMtiB5p2DFsTxXRoNe5hEL0V9vJx\nl2taQ5REIQKBgHBj1QNioiMEh1lRKBijwns10jWJBTg5IWwOV10dwqisgrNFc3xo\n1pxqqWBFOXpGCgU6GoARxlrom0vMhXpm258MkqSd6gNCRuF3+EcRcktD9thF4ykp\nR7fA8Ymz6tQIOJc4I3PYAGEWJk3VwhhPo/uRu3kC42dw0S3wYpHdc6idAoGAUKUC\nM3eQaE8Zk3WYeHI7fO4NnG4jrvfqqPYjaygIUackXB0IYwFH2QUIPz2rZF+d10VU\nVXvrx5nIEEJj7cWp4EaIBj3nZ7U0WFy7EwiTwas6UtqTlTt7Wyljk5aVlNozfe6D\n7SnXMH+G9chAncRrEBElSN7uZszAMfAgvzUbKGECgYBwvIKFYC985cnd1zp5goSr\nijrILDMxyLF4pILEw3JsK+kna8AIu81iNAh4oHyGpjbKkDUTS0qE7ibN2aasE6GA\npfl8X7aVuuqADRNF2FQ83w0dqTBnP5aAbqJh3K46dx+L9upDQUZzKanhLaAqan/u\ne4QVlVmalG6jjXEscbmaHw==\n-----END PRIVATE KEY-----\n"
|
|
26
|
+
FIREBASE_CLIENT_EMAIL=firebase-adminsdk-5uqzz@velocity-career-labs-dev.iam.gserviceaccount.com
|
|
27
|
+
FIREBASE_CLIENT_ID=EMPTY
|
|
28
|
+
FIREBASE_AUTH_URI=https://accounts.google.com/o/oauth2/auth
|
|
29
|
+
FIREBASE_TOKEN_URI=https://oauth2.googleapis.com/token
|
|
30
|
+
FIREBASE_AUTH_PROVIDER_X509_CERT_URL=https://www.googleapis.com/oauth2/v1/certs
|
|
31
|
+
FIREBASE_CLIENT_X509_CERT_URL=https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-5uqzz%40velocity-career-labs-dev.iam.gserviceaccount.com
|
|
32
|
+
TWILIO_ACCOUNT_SID="AC6498d1fc8777dcc3246b0979543d916"
|
|
33
|
+
TWILIO_HOST_NUMBER="+66676695136"
|
|
34
|
+
TWILIO_AUTH_TOKEN="666fcbb10252cb2c233e63d273525af6"
|
|
35
|
+
OAUTH_VERIFICATION_DISABLED_ENDPOINTS="GET:/api/v0.6/devices/:deviceId,GET:/api/v0.6/devices/:deviceId/pushes,DELETE:/api/v0.6/devices/:deviceId,PUT:/api/v0.6/devices/:deviceId,POST:/api/v0.6/verify/:valueType/request-code,POST:/api/v0.6/verify/confirm,POST:/api/v0.6/verify/issuing/identify,POST:/api/v0.6/verify/issuing/generate-offers,POST:/jwt/verify,POST:/jwt/decode,POST:/jwt/sign"
|
|
36
|
+
OAUTH0_DOMAIN=https://localhost/
|
|
37
|
+
AUTH0_CAREER_WALLET_AUDIENCE=foo
|
|
38
|
+
OAUTH0_WEBAPP_CLIENT_ID=foo
|
|
39
|
+
CAREERWALLET_SUPPORT_EMAIL=vcl.devnet@gmail.com
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const { errorResponseMatcher } = require('@velocitycareerlabs/tests-helpers');
|
|
2
|
+
const {
|
|
3
|
+
initBuildAccessToken,
|
|
4
|
+
} = require('../../src/entities/oauth/domain/build-access-token');
|
|
5
|
+
|
|
6
|
+
const createAccessToken = (scope, signingKey, accountId, issuer) =>
|
|
7
|
+
initBuildAccessToken(
|
|
8
|
+
signingKey,
|
|
9
|
+
issuer || 'test_issuer',
|
|
10
|
+
'1h'
|
|
11
|
+
)(scope, accountId || 'test_subject');
|
|
12
|
+
|
|
13
|
+
const missingAccessTokenExpectation = (response) => {
|
|
14
|
+
expect(response.statusCode).toEqual(401);
|
|
15
|
+
|
|
16
|
+
expect(response.json).toEqual(
|
|
17
|
+
errorResponseMatcher({
|
|
18
|
+
error: 'Unauthorized',
|
|
19
|
+
message: 'missing authorization header',
|
|
20
|
+
errorCode: 'missing_error_code',
|
|
21
|
+
statusCode: 401,
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const incorrectScopeExpectation = (response) => {
|
|
27
|
+
expect(response.statusCode).toEqual(403);
|
|
28
|
+
|
|
29
|
+
expect(response.json).toEqual(
|
|
30
|
+
errorResponseMatcher({
|
|
31
|
+
statusCode: 403,
|
|
32
|
+
error: 'Forbidden',
|
|
33
|
+
errorCode: 'missing_error_code',
|
|
34
|
+
message: expect.stringMatching(
|
|
35
|
+
/User must have one of the following scopes:/
|
|
36
|
+
),
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const incorrectAccessTokenExpectation = (response) => {
|
|
42
|
+
expect(response.statusCode).toEqual(401);
|
|
43
|
+
|
|
44
|
+
expect(response.json).toEqual(
|
|
45
|
+
errorResponseMatcher({
|
|
46
|
+
error: 'Unauthorized',
|
|
47
|
+
errorCode: 'missing_error_code',
|
|
48
|
+
message: 'invalid authorization header',
|
|
49
|
+
statusCode: 401,
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
module.exports = {
|
|
55
|
+
createAccessToken,
|
|
56
|
+
missingAccessTokenExpectation,
|
|
57
|
+
incorrectScopeExpectation,
|
|
58
|
+
incorrectAccessTokenExpectation,
|
|
59
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const { createTestServer } = require('@velocitycareerlabs/server-provider');
|
|
2
|
+
const {
|
|
3
|
+
loadTestEnv,
|
|
4
|
+
buildMongoConnection,
|
|
5
|
+
} = require('@velocitycareerlabs/tests-helpers');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
loadTestEnv(path.resolve(__dirname, '.env.test'));
|
|
9
|
+
|
|
10
|
+
const { flow } = require('lodash/fp');
|
|
11
|
+
const config = require('../../src/config/config');
|
|
12
|
+
const { initServer } = require('../../src/init-server');
|
|
13
|
+
|
|
14
|
+
const mongoConnection = buildMongoConnection('test-careerwallet');
|
|
15
|
+
|
|
16
|
+
module.exports = (overrideConfig = {}) =>
|
|
17
|
+
flow(
|
|
18
|
+
createTestServer,
|
|
19
|
+
initServer
|
|
20
|
+
)({ ...config, mongoConnection, ...overrideConfig });
|