@velocitycareerlabs/server-webwallet 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.
Files changed (193) hide show
  1. package/.localdev.env +57 -0
  2. package/.standalone.env +22 -0
  3. package/LICENSE +248 -0
  4. package/README.md +11 -0
  5. package/jest.config.js +20 -0
  6. package/migrate-mongo.config.js +23 -0
  7. package/package.json +72 -0
  8. package/src/config/config.js +74 -0
  9. package/src/controllers/accounts/autohooks.js +28 -0
  10. package/src/controllers/accounts/controller.js +209 -0
  11. package/src/controllers/accounts/schemas/index.js +6 -0
  12. package/src/controllers/accounts/schemas/webwallet-accounts-request.schema.js +25 -0
  13. package/src/controllers/accounts/schemas/webwallet-accounts-response.schema.js +72 -0
  14. package/src/controllers/accounts/schemas/webwallet-accounts-update-request.schema.js +23 -0
  15. package/src/controllers/accounts/schemas/webwallet-test-personas-response.schema.js +110 -0
  16. package/src/controllers/consent/autohooks.js +14 -0
  17. package/src/controllers/consent/controller.js +91 -0
  18. package/src/controllers/consent/schemas/index.js +3 -0
  19. package/src/controllers/consent/schemas/webwallet-consent-response.schema.js +23 -0
  20. package/src/controllers/credentials/autohooks.js +36 -0
  21. package/src/controllers/credentials/controller.js +92 -0
  22. package/src/controllers/credentials/schemas/index.js +4 -0
  23. package/src/controllers/credentials/schemas/webwallet-credential-categories-response.schema.js +21 -0
  24. package/src/controllers/credentials/schemas/webwallet-credentials-response.schema.js +29 -0
  25. package/src/controllers/disclosures/autohooks.js +21 -0
  26. package/src/controllers/disclosures/controller.js +168 -0
  27. package/src/controllers/disclosures/schemas/index.js +7 -0
  28. package/src/controllers/disclosures/schemas/webwallet-accept-presentation-request-body.schema.js +28 -0
  29. package/src/controllers/disclosures/schemas/webwallet-accept-presentation-response.schema.js +16 -0
  30. package/src/controllers/disclosures/schemas/webwallet-get-disclosures-response.schema.js +18 -0
  31. package/src/controllers/disclosures/schemas/webwallet-get-presentation-request-query.schema.js +21 -0
  32. package/src/controllers/disclosures/schemas/webwallet-get-presentation-request-response.schema.js +16 -0
  33. package/src/controllers/feedback/autohooks.js +11 -0
  34. package/src/controllers/feedback/controller.js +48 -0
  35. package/src/controllers/issuing/common-schemas/index.js +10 -0
  36. package/src/controllers/issuing/common-schemas/webwallet-get-credential-manifest-query.schema.js +27 -0
  37. package/src/controllers/issuing/common-schemas/webwallet-get-credential-manifest-response.schema.js +31 -0
  38. package/src/controllers/issuing/deep-link/autohooks.js +51 -0
  39. package/src/controllers/issuing/deep-link/controller.js +192 -0
  40. package/src/controllers/issuing/deep-link/schemas/index.js +6 -0
  41. package/src/controllers/issuing/deep-link/schemas/webwallet-deep-link-accept-offers-request.schema.js +30 -0
  42. package/src/controllers/issuing/deep-link/schemas/webwallet-deep-link-accept-offers-response.schema.js +36 -0
  43. package/src/controllers/issuing/deep-link/schemas/webwallet-deep-link-offers-request.schema.js +28 -0
  44. package/src/controllers/issuing/deep-link/schemas/webwallet-deep-link-offers-response.schema.js +48 -0
  45. package/src/controllers/issuing/identity-credentials/autohooks.js +42 -0
  46. package/src/controllers/issuing/identity-credentials/controller.js +188 -0
  47. package/src/controllers/issuing/identity-credentials/schemas/index.js +6 -0
  48. package/src/controllers/issuing/identity-credentials/schemas/webwallet-identity-credentials-confirm-body.schema.js +20 -0
  49. package/src/controllers/issuing/identity-credentials/schemas/webwallet-identity-credentials-confirm-response.schema.js +37 -0
  50. package/src/controllers/issuing/identity-credentials/schemas/webwallet-identity-credentials-request-code-body.schema.js +14 -0
  51. package/src/controllers/issuing/identity-credentials/schemas/webwallet-identity-credentials-request-code-params.schema.js +19 -0
  52. package/src/controllers/linkedin/autohooks.js +16 -0
  53. package/src/controllers/linkedin/controller.js +276 -0
  54. package/src/controllers/linkedin/schemas/index.js +3 -0
  55. package/src/controllers/linkedin/schemas/webwallet-linkedin-me-response.schema.js +14 -0
  56. package/src/controllers/root/controller.js +29 -0
  57. package/src/entities/.gitkeep +0 -0
  58. package/src/entities/accounts/constants.js +5 -0
  59. package/src/entities/accounts/domains/extract-auth0-id-token-or-access-token.js +22 -0
  60. package/src/entities/accounts/domains/index.js +5 -0
  61. package/src/entities/accounts/domains/validate-account-permissions.js +36 -0
  62. package/src/entities/accounts/domains/validate-logo-size.js +25 -0
  63. package/src/entities/accounts/index.js +5 -0
  64. package/src/entities/accounts/repos/accounts.repo.js +63 -0
  65. package/src/entities/credentials/domains/index.js +3 -0
  66. package/src/entities/credentials/domains/offer-to-credential-mongo-dto.js +43 -0
  67. package/src/entities/credentials/index.js +6 -0
  68. package/src/entities/credentials/orchestrators/index.js +3 -0
  69. package/src/entities/credentials/orchestrators/load-additional-render-info.js +65 -0
  70. package/src/entities/credentials/repos/credentials.repo.js +132 -0
  71. package/src/entities/credentials/schemas/index.js +4 -0
  72. package/src/entities/credentials/schemas/webwallet-credential-response.schema.js +138 -0
  73. package/src/entities/credentials/schemas/webwallet-credentials-response.schemas.js +95 -0
  74. package/src/entities/credentials/schemas/webwallet-display-descriptor-response.schema.js +106 -0
  75. package/src/entities/disclosures/index.js +4 -0
  76. package/src/entities/disclosures/repos/disclosures.repo.js +31 -0
  77. package/src/entities/disclosures/schemas/index.js +10 -0
  78. package/src/entities/disclosures/schemas/webwallet-disclosure.schema.js +39 -0
  79. package/src/entities/disclosures/schemas/webwallet-presentation-request-field.schema.js +45 -0
  80. package/src/entities/disclosures/schemas/webwallet-presentation-request-filter.schema.js +30 -0
  81. package/src/entities/disclosures/schemas/webwallet-presentation-request-format.schema.js +36 -0
  82. package/src/entities/disclosures/schemas/webwallet-presentation-request-input-descriptors.schema.js +111 -0
  83. package/src/entities/disclosures/schemas/webwallet-presentation-request-schema.schema.js +14 -0
  84. package/src/entities/disclosures/schemas/webwallet-presentation-request-submission-requirements.schema.js +37 -0
  85. package/src/entities/disclosures/schemas/webwallet-presentation-request.schema.js +79 -0
  86. package/src/entities/index.js +6 -0
  87. package/src/entities/issuing/domain/constants.js +8 -0
  88. package/src/entities/issuing/domain/does-user-have-fresh-pending-verification.js +26 -0
  89. package/src/entities/issuing/domain/get-credentials-from-offers.js +18 -0
  90. package/src/entities/issuing/domain/index.js +5 -0
  91. package/src/entities/issuing/index.js +5 -0
  92. package/src/entities/issuing/orchestrators/build-issuing-input-credentials.js +35 -0
  93. package/src/entities/issuing/orchestrators/generate-offers-by-deep-link.js +74 -0
  94. package/src/entities/issuing/orchestrators/get-identity-issuer.js +35 -0
  95. package/src/entities/issuing/orchestrators/get-identity-offers-by-deeplink.js +74 -0
  96. package/src/entities/issuing/orchestrators/index.js +6 -0
  97. package/src/entities/issuing/schemas/index.js +9 -0
  98. package/src/entities/issuing/schemas/webwallet-credential-manifest.schema.js +198 -0
  99. package/src/errors/error-codes.js +12 -0
  100. package/src/fetchers/career-wallet/create-account-fetcher.js +7 -0
  101. package/src/fetchers/career-wallet/create-did-fetcher.js +17 -0
  102. package/src/fetchers/career-wallet/get-app-config.js +11 -0
  103. package/src/fetchers/career-wallet/get-consents.js +13 -0
  104. package/src/fetchers/career-wallet/get-credential-categories.js +7 -0
  105. package/src/fetchers/career-wallet/get-personas.js +7 -0
  106. package/src/fetchers/career-wallet/index.js +12 -0
  107. package/src/fetchers/career-wallet/post-consent.js +9 -0
  108. package/src/fetchers/career-wallet/send-feedback.js +14 -0
  109. package/src/fetchers/career-wallet/sign-fetcher.js +14 -0
  110. package/src/fetchers/career-wallet/verify-id-credential-confirm-code.js +19 -0
  111. package/src/fetchers/career-wallet/verify-id-credential-request-code.js +20 -0
  112. package/src/fetchers/index.js +4 -0
  113. package/src/fetchers/lib-api/get-credential-display-schema.js +12 -0
  114. package/src/fetchers/lib-api/index.js +3 -0
  115. package/src/fetchers/linkedin/create-linkedin-post.js +45 -0
  116. package/src/fetchers/linkedin/get-access-token.js +26 -0
  117. package/src/fetchers/linkedin/get-linkedin-user-email.js +13 -0
  118. package/src/fetchers/linkedin/get-linkedin-user-id.js +16 -0
  119. package/src/fetchers/linkedin/index.js +9 -0
  120. package/src/fetchers/linkedin/register-image-to-upload.js +30 -0
  121. package/src/fetchers/linkedin/revoke-linkedin-access.js +20 -0
  122. package/src/fetchers/linkedin/upload-image-to-linkedin.js +16 -0
  123. package/src/index.js +15 -0
  124. package/src/init-server.js +108 -0
  125. package/src/plugins/crypto-services/index.js +5 -0
  126. package/src/plugins/crypto-services/jwt-sign-service-impl.js +72 -0
  127. package/src/plugins/crypto-services/jwt-verify-service-impl.js +21 -0
  128. package/src/plugins/crypto-services/key-service-impl.js +28 -0
  129. package/src/plugins/fetch-errors-handler-plugin.js +64 -0
  130. package/src/plugins/index.js +4 -0
  131. package/src/plugins/vnf-sdk-plugin.js +53 -0
  132. package/src/standalone.js +8 -0
  133. package/test/accounts-controller.test.js +618 -0
  134. package/test/consent-controller.test.js +185 -0
  135. package/test/credentials-controller.test.js +307 -0
  136. package/test/crypro-services/jwt-sign-service-impl.test.js +83 -0
  137. package/test/crypro-services/jwt-verify-service-impl.test.js +27 -0
  138. package/test/crypro-services/key-service-impl.test.js +76 -0
  139. package/test/crypro-services/mocks/index.js +4 -0
  140. package/test/crypro-services/mocks/jwt-mock.js +15 -0
  141. package/test/crypro-services/mocks/public-jwk.js +14 -0
  142. package/test/disclosures-controller/disclosure-credentials.test.js +428 -0
  143. package/test/disclosures-controller/get-disclosures.test.js +169 -0
  144. package/test/disclosures-controller/mocks/get-credential-manifest.js +20 -0
  145. package/test/disclosures-controller/mocks/index.js +6 -0
  146. package/test/disclosures-controller/mocks/presentation-request.js +32 -0
  147. package/test/disclosures-controller/mocks/presentation-submission.js +21 -0
  148. package/test/disclosures-controller/mocks/submission-result.js +19 -0
  149. package/test/factories/accounts.js +25 -0
  150. package/test/factories/credentials.js +66 -0
  151. package/test/factories/disclosures.js +106 -0
  152. package/test/feedback-controller.test.js +125 -0
  153. package/test/fetch-errors-handler-plugin.test.js +97 -0
  154. package/test/filter-deleted-credentials-extension.test.js +82 -0
  155. package/test/helpers/.env.test +10 -0
  156. package/test/helpers/nock-consent-add.js +16 -0
  157. package/test/helpers/nock-consents-get.js +15 -0
  158. package/test/helpers/nock-feedback.js +9 -0
  159. package/test/helpers/nock-linkedin-access-token.js +9 -0
  160. package/test/helpers/nock-linkedin-email.js +15 -0
  161. package/test/helpers/nock-linkedin-image-register.js +28 -0
  162. package/test/helpers/nock-linkedin-me.js +13 -0
  163. package/test/helpers/nock-linkedin-post.js +37 -0
  164. package/test/helpers/nock-linkedin-revoke.js +9 -0
  165. package/test/helpers/nock-test-personas.js +13 -0
  166. package/test/helpers/webwallet-build-fastify.js +17 -0
  167. package/test/issuing-controller/issuing-by-deeplink-empty-offers.test.js +142 -0
  168. package/test/issuing-controller/issuing-by-deeplink-failed-offers.test.js +142 -0
  169. package/test/issuing-controller/issuing-by-deeplink.test.js +492 -0
  170. package/test/issuing-controller/issuing-identity-credentials.test.js +377 -0
  171. package/test/issuing-controller/mocks/accept-offers-response.js +90 -0
  172. package/test/issuing-controller/mocks/accepted-credentials.js +47 -0
  173. package/test/issuing-controller/mocks/credential-manifest-presentation.js +72 -0
  174. package/test/issuing-controller/mocks/credential-manifest.js +45 -0
  175. package/test/issuing-controller/mocks/identity-issuing/accept-offers.js +22 -0
  176. package/test/issuing-controller/mocks/identity-issuing/confirm-verification-code.js +5 -0
  177. package/test/issuing-controller/mocks/identity-issuing/get-app-config.js +52 -0
  178. package/test/issuing-controller/mocks/identity-issuing/get-organization.js +118 -0
  179. package/test/issuing-controller/mocks/identity-issuing/index.js +6 -0
  180. package/test/issuing-controller/mocks/index.js +6 -0
  181. package/test/issuing-controller/mocks/issuers.js +126 -0
  182. package/test/issuing-controller/mocks/offers.js +48 -0
  183. package/test/issuing-controller/mocks/schema.js +107 -0
  184. package/test/linkedin-controller.test.js +452 -0
  185. package/test/mocks/credential-categories.js +115 -0
  186. package/test/mocks/credentials.js +15 -0
  187. package/test/mocks/didjwk.js +25 -0
  188. package/test/mocks/index.js +7 -0
  189. package/test/mocks/issuers.js +88 -0
  190. package/test/mocks/jwk.js +53 -0
  191. package/test/mocks/schema.js +107 -0
  192. package/test/root.test.js +42 -0
  193. package/test/vcl-sdk-plugin.test.js +86 -0
@@ -0,0 +1,132 @@
1
+ const {
2
+ autoboxIdsExtension,
3
+ repoFactory,
4
+ } = require('@spencejs/spence-mongo-repos');
5
+
6
+ module.exports = (app, _, next = () => {}) => {
7
+ next();
8
+ return repoFactory(
9
+ {
10
+ name: 'credentials',
11
+ entityName: 'credentials',
12
+ defaultProjection: {
13
+ _id: 1,
14
+ /**
15
+ * @type {Array<string>}
16
+ */
17
+ type: 1,
18
+ /**
19
+ * @type {string}
20
+ */
21
+ did: 1,
22
+ /**
23
+ * @type {string}
24
+ */
25
+ auth0UserId: 1,
26
+ /**
27
+ * @type {string}
28
+ */
29
+ userDid: 1,
30
+ /**
31
+ * @typedef {Object} CredentialStatus
32
+ * @property {string} type
33
+ * @property {string} id
34
+ * @property {number} statusListIndex
35
+ * @property {string} statusListCredential
36
+ */
37
+ credentialStatus: 1,
38
+ /**
39
+ * @typedef {Object} LinkCodeCommitment
40
+ * @property {string} type
41
+ * @property {string} value
42
+ */
43
+ linkCodeCommitment: 1,
44
+ /**
45
+ * @typedef {Object} Issuer
46
+ * @property {string} id
47
+ */
48
+ issuer: 1,
49
+ /**
50
+ * @typedef {Object} ContentHash
51
+ * @property {string} type
52
+ * @property {string} value
53
+ */
54
+ contentHash: 1,
55
+ /**
56
+ * @type {string}
57
+ */
58
+ credentialSchema: 1,
59
+ /**
60
+ * @type {number}
61
+ */
62
+ vnfProtocolVersion: 1,
63
+ /**
64
+ * @type {Array<string>}
65
+ */
66
+ context: 1,
67
+ /**
68
+ * @typedef {Object} CredentialSubject
69
+ * @property {object} hasCredential
70
+ * @property {string} hasCredential.id
71
+ * @property {string} hasCredential.type
72
+ * @property {string} hasCredential.name
73
+ * @property {string} hasCredential.description
74
+ * @property {string} hasCredential.image
75
+ * @property {string} hasCredential.criteria
76
+ * @property {string} hasCredential.issuer
77
+ * @property {string} type
78
+ * @property {Array<string>} @context
79
+ */
80
+ credentialSubject: 1,
81
+ /**
82
+ * @type {number}
83
+ */
84
+ jti: 1,
85
+ /**
86
+ * @type {string}
87
+ */
88
+ iss: 1,
89
+ /**
90
+ * Original encoded credential JWT
91
+ * @type {string}
92
+ */
93
+ encodedCredential: 1,
94
+ /**
95
+ * @type {Date}
96
+ */
97
+ createdAt: 1,
98
+ /**
99
+ * @type {Date}
100
+ */
101
+ deletedAt: 1,
102
+ /**
103
+ * @type {Date}
104
+ */
105
+ updatedAt: 1,
106
+ /**
107
+ * @typedef {Object} RelatedResource
108
+ * @property {string} id
109
+ * @property {string} mediaType
110
+ */
111
+ /**
112
+ * @type {Array<RelatedResource>}
113
+ */
114
+ relatedResource: 1,
115
+ },
116
+ extensions: [autoboxIdsExtension, filterDeletedCredentialsExtension],
117
+ },
118
+ app
119
+ );
120
+ };
121
+
122
+ const filterDeletedCredentialsExtension = (parent) => {
123
+ return {
124
+ prepFilter: (filter) => {
125
+ return parent.prepFilter({
126
+ ...filter,
127
+ deletedAt: filter.deletedAt ?? { $exists: false },
128
+ });
129
+ },
130
+ extensions: parent.extensions.concat(['filterDeletedCredentialsExtension']),
131
+ };
132
+ };
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ ...require('./webwallet-credential-response.schema'),
3
+ ...require('./webwallet-display-descriptor-response.schema'),
4
+ };
@@ -0,0 +1,138 @@
1
+ const webWalletCredentialResponseSchema = {
2
+ $id: 'https://velocitycareerlabs.io/webwallet-credential-response.schema.json',
3
+ title: 'webwallet-credential-response',
4
+ description: 'credential response from webwallet',
5
+ type: 'object',
6
+ properties: {
7
+ id: {
8
+ type: 'string',
9
+ },
10
+ type: {
11
+ type: 'array',
12
+ items: {
13
+ type: 'string',
14
+ },
15
+ },
16
+ did: {
17
+ type: 'string',
18
+ },
19
+ auth0UserId: {
20
+ type: 'string',
21
+ },
22
+ userDid: {
23
+ type: 'string',
24
+ },
25
+ credentialStatus: {
26
+ type: 'object',
27
+ additionalProperties: true,
28
+ },
29
+ linkCodeCommitment: {
30
+ type: 'object',
31
+ additionalProperties: true,
32
+ },
33
+ issuer: {
34
+ type: 'object',
35
+ properties: {
36
+ id: {
37
+ type: 'string',
38
+ },
39
+ },
40
+ },
41
+ contentHash: {
42
+ type: 'object',
43
+ additionalProperties: true,
44
+ },
45
+ credentialSchema: {
46
+ type: 'object',
47
+ additionalProperties: true,
48
+ },
49
+ vnfProtocolVersion: {
50
+ type: 'number',
51
+ },
52
+ context: {
53
+ type: 'array',
54
+ items: {
55
+ type: 'string',
56
+ },
57
+ },
58
+ credentialSubject: {
59
+ type: 'object',
60
+ properties: {
61
+ hasCredential: {
62
+ type: 'object',
63
+ additionalProperties: true,
64
+ },
65
+ type: {
66
+ type: 'string',
67
+ },
68
+ '@context': {
69
+ oneOf: [
70
+ {
71
+ type: 'string',
72
+ },
73
+ {
74
+ type: 'array',
75
+ items: {
76
+ type: 'string',
77
+ },
78
+ },
79
+ ],
80
+ },
81
+ },
82
+ additionalProperties: true,
83
+ },
84
+ jti: {
85
+ type: 'string',
86
+ },
87
+ iss: {
88
+ type: 'string',
89
+ },
90
+ encodedCredential: {
91
+ type: 'string',
92
+ },
93
+ createdAt: {
94
+ type: 'string',
95
+ },
96
+ updatedAt: {
97
+ type: 'string',
98
+ },
99
+ relatedResource: {
100
+ type: 'array',
101
+ items: {
102
+ type: 'object',
103
+ additionalProperties: true,
104
+ properties: {
105
+ id: {
106
+ type: 'string',
107
+ },
108
+ mediaType: {
109
+ type: 'string',
110
+ },
111
+ },
112
+ },
113
+ },
114
+ },
115
+ required: [
116
+ 'id',
117
+ 'type',
118
+ 'did',
119
+ 'auth0UserId',
120
+ 'userDid',
121
+ 'credentialStatus',
122
+ 'issuer',
123
+ 'contentHash',
124
+ 'credentialSchema',
125
+ 'vnfProtocolVersion',
126
+ 'context',
127
+ 'credentialSubject',
128
+ 'jti',
129
+ 'iss',
130
+ 'encodedCredential',
131
+ 'createdAt',
132
+ 'updatedAt',
133
+ ],
134
+ };
135
+
136
+ module.exports = {
137
+ webWalletCredentialResponseSchema,
138
+ };
@@ -0,0 +1,95 @@
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
+ };
@@ -0,0 +1,106 @@
1
+ const webWalletDisplayDescriptorResponseSchema = {
2
+ $id: 'https://velocitycareerlabs.io/webwallet-display-descriptor-response.schema.json',
3
+ title: 'webwallet-display-descriptor-response',
4
+ description: 'display descriptor response from webwallet',
5
+ type: 'object',
6
+ properties: {
7
+ title: {
8
+ type: 'object',
9
+ properties: {
10
+ path: { type: 'array', items: { type: 'string' } },
11
+ schema: {
12
+ type: 'object',
13
+ properties: {
14
+ title: { type: 'string' },
15
+ format: { type: 'string' },
16
+ },
17
+ },
18
+ fallback: { type: 'string', default: '-' },
19
+ text: { type: 'string' },
20
+ },
21
+ },
22
+ subtitle: {
23
+ type: 'object',
24
+ properties: {
25
+ path: { type: 'array', items: { type: 'string' } },
26
+ schema: {
27
+ type: 'object',
28
+ properties: {
29
+ title: { type: 'string' },
30
+ format: { type: 'string' },
31
+ },
32
+ },
33
+ fallback: { type: 'string', default: '-' },
34
+ text: { type: 'string' },
35
+ },
36
+ },
37
+ summary_detail: {
38
+ type: 'object',
39
+ properties: {
40
+ path: { type: 'array', items: { type: 'string' } },
41
+ schema: {
42
+ type: 'object',
43
+ properties: {
44
+ title: { type: 'string' },
45
+ format: { type: 'string' },
46
+ },
47
+ },
48
+ fallback: { type: 'string', default: '-' },
49
+ text: { type: 'string' },
50
+ },
51
+ },
52
+ description: {
53
+ type: 'object',
54
+ properties: {
55
+ path: { type: 'array', items: { type: 'string' } },
56
+ schema: {
57
+ type: 'object',
58
+ properties: {
59
+ title: { type: 'string' },
60
+ format: { type: 'string' },
61
+ },
62
+ },
63
+ fallback: { type: 'string', default: '-' },
64
+ text: { type: 'string' },
65
+ },
66
+ },
67
+ logo: {
68
+ type: 'object',
69
+ properties: {
70
+ path: { type: 'array', items: { type: 'string' } },
71
+ schema: {
72
+ type: 'object',
73
+ properties: {
74
+ title: { type: 'string' },
75
+ format: { type: 'string' },
76
+ },
77
+ },
78
+ fallback: { type: 'string', default: '-' },
79
+ text: { type: 'string' },
80
+ },
81
+ },
82
+ properties: {
83
+ type: 'array',
84
+ items: {
85
+ type: 'object',
86
+ properties: {
87
+ label: { type: 'string' },
88
+ path: { type: 'array', items: { type: 'string' } },
89
+ schema: {
90
+ type: 'object',
91
+ properties: {
92
+ title: { type: 'string' },
93
+ format: { type: 'string' },
94
+ },
95
+ },
96
+ fallback: { type: 'string', default: '-' },
97
+ text: { type: 'string' },
98
+ },
99
+ },
100
+ },
101
+ },
102
+ };
103
+
104
+ module.exports = {
105
+ webWalletDisplayDescriptorResponseSchema,
106
+ };
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ disclosuresRepoPlugin: require('./repos/disclosures.repo'),
3
+ ...require('./schemas'),
4
+ };
@@ -0,0 +1,31 @@
1
+ const {
2
+ autoboxIdsExtension,
3
+ repoFactory,
4
+ } = require('@spencejs/spence-mongo-repos');
5
+
6
+ module.exports = (app, _, next = () => {}) => {
7
+ next();
8
+ return repoFactory(
9
+ {
10
+ name: 'disclosures',
11
+ entityName: 'disclosures',
12
+ defaultProjection: {
13
+ _id: 1,
14
+ auth0UserId: 1,
15
+ userDid: 1,
16
+ jti: 1,
17
+ presentationDefinitionId: 1,
18
+ submissionId: 1,
19
+ encodedJwt: 1,
20
+ presentation: 1,
21
+ token: 1,
22
+ sharedCredentials: 1,
23
+ type: 1,
24
+ createdAt: 1,
25
+ updatedAt: 1,
26
+ },
27
+ extensions: [autoboxIdsExtension],
28
+ },
29
+ app
30
+ );
31
+ };
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ ...require('./webwallet-presentation-request-schema.schema'),
3
+ ...require('./webwallet-presentation-request-field.schema'),
4
+ ...require('./webwallet-presentation-request-filter.schema'),
5
+ ...require('./webwallet-presentation-request-format.schema'),
6
+ ...require('./webwallet-presentation-request-submission-requirements.schema'),
7
+ ...require('./webwallet-presentation-request-input-descriptors.schema'),
8
+ ...require('./webwallet-presentation-request.schema'),
9
+ ...require('./webwallet-disclosure.schema'),
10
+ };
@@ -0,0 +1,39 @@
1
+ const webWalletDisclosureSchema = {
2
+ $id: 'https://velocitycareerlabs.io/webwallet-disclosure.schema.json',
3
+ title: 'webwallet-disclosure',
4
+ description: 'The schema of the accepted presentation request (disclosure)',
5
+ type: 'object',
6
+ properties: {
7
+ id: { type: 'string' },
8
+ jti: { type: 'string' },
9
+ submissionId: { type: 'string' },
10
+ presentationDefinitionId: { type: 'string' },
11
+ encodedJwt: { type: 'string' },
12
+ presentation: {
13
+ $ref: 'https://velocitycareerlabs.io/presentation-request.schema.json',
14
+ },
15
+ token: { type: 'string' },
16
+ sharedCredentials: {
17
+ type: 'array',
18
+ items: { type: 'string' },
19
+ },
20
+ type: { type: 'string', enum: ['public', 'linkedin'] },
21
+ createdAt: { type: 'string' },
22
+ updatedAt: { type: 'string' },
23
+ },
24
+ required: [
25
+ 'id',
26
+ 'jti',
27
+ 'submissionId',
28
+ 'presentationDefinitionId',
29
+ 'encodedJwt',
30
+ 'presentation',
31
+ 'token',
32
+ 'createdAt',
33
+ 'updatedAt',
34
+ ],
35
+ };
36
+
37
+ module.exports = {
38
+ webWalletDisclosureSchema,
39
+ };
@@ -0,0 +1,45 @@
1
+ const webWalletPresentationRequestFieldSchema = {
2
+ $id: 'https://velocitycareerlabs.io/webwallet-presentation-request-field.schema.json',
3
+ type: 'object',
4
+ oneOf: [
5
+ {
6
+ properties: {
7
+ id: { type: 'string' },
8
+ path: {
9
+ type: 'array',
10
+ items: { type: 'string' },
11
+ },
12
+ purpose: { type: 'string' },
13
+ filter: {
14
+ $ref: 'https://velocitycareerlabs.io/webwallet-presentation-request-filter.schema.json',
15
+ },
16
+ },
17
+ required: ['path'],
18
+ additionalProperties: false,
19
+ },
20
+ {
21
+ properties: {
22
+ id: { type: 'string' },
23
+ path: {
24
+ type: 'array',
25
+ items: { type: 'string' },
26
+ },
27
+ purpose: { type: 'string' },
28
+ filter: {
29
+ $ref: 'https://velocitycareerlabs.io/webwallet-presentation-request-filter.schema.json',
30
+ },
31
+ predicate: {
32
+ type: 'string',
33
+ enum: ['required', 'preferred'],
34
+ },
35
+ },
36
+ required: ['path', 'filter', 'predicate'],
37
+ additionalProperties: false,
38
+ },
39
+ ],
40
+ additionalProperties: false,
41
+ };
42
+
43
+ module.exports = {
44
+ webWalletPresentationRequestFieldSchema,
45
+ };
@@ -0,0 +1,30 @@
1
+ const webWalletPresentationRequestFilterSchema = {
2
+ $id: 'https://velocitycareerlabs.io/webwallet-presentation-request-filter.schema.json',
3
+ type: 'object',
4
+ properties: {
5
+ type: { type: 'string' },
6
+ format: { type: 'string' },
7
+ pattern: { type: 'string' },
8
+ minimum: { type: ['number', 'string'] },
9
+ minLength: { type: 'integer' },
10
+ maxLength: { type: 'integer' },
11
+ exclusiveMinimum: { type: ['number', 'string'] },
12
+ exclusiveMaximum: { type: ['number', 'string'] },
13
+ maximum: { type: ['number', 'string'] },
14
+ const: { type: ['number', 'string'] },
15
+ enum: {
16
+ type: 'array',
17
+ items: { type: ['number', 'string'] },
18
+ },
19
+ not: {
20
+ type: 'object',
21
+ minProperties: 1,
22
+ },
23
+ },
24
+ required: ['type'],
25
+ additionalProperties: false,
26
+ };
27
+
28
+ module.exports = {
29
+ webWalletPresentationRequestFilterSchema,
30
+ };
@@ -0,0 +1,36 @@
1
+ const webWalletPresentationRequestFormatSchema = {
2
+ $id: 'https://velocitycareerlabs.io/webwallet-presentation-request-format.schema.json',
3
+ type: 'object',
4
+ patternProperties: {
5
+ '^jwt$|^jwt_vc$|^jwt_vp$': {
6
+ type: 'object',
7
+ properties: {
8
+ alg: {
9
+ type: 'array',
10
+ minItems: 1,
11
+ items: { type: 'string' },
12
+ },
13
+ },
14
+ required: ['alg'],
15
+ additionalProperties: false,
16
+ },
17
+ '^ldp_vc$|^ldp_vp$|^ldp$': {
18
+ type: 'object',
19
+ properties: {
20
+ proof_type: {
21
+ type: 'array',
22
+ minItems: 1,
23
+ items: { type: 'string' },
24
+ },
25
+ },
26
+ required: ['proof_type'],
27
+ additionalProperties: false,
28
+ },
29
+ additionalProperties: false,
30
+ },
31
+ additionalProperties: false,
32
+ };
33
+
34
+ module.exports = {
35
+ webWalletPresentationRequestFormatSchema,
36
+ };