@verii/server-credentialing-hub 2.0.0
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/LICENSE +202 -0
- package/README.md +13 -0
- package/package.json +87 -0
- package/src/assets/templates/app-redirect.hbs +22 -0
- package/src/config/config.js +118 -0
- package/src/config/index.js +19 -0
- package/src/controllers/app-redirect/controller.js +85 -0
- package/src/controllers/openid4vc/autohooks.js +22 -0
- package/src/controllers/openid4vc/oauth-controller.js +96 -0
- package/src/controllers/openid4vc/openid4vc-metadata-controller.js +66 -0
- package/src/controllers/openid4vc/openid4vci-controller.js +125 -0
- package/src/controllers/openid4vp/autohooks.js +22 -0
- package/src/controllers/openid4vp/openid4vp-controller.js +177 -0
- package/src/controllers/operator/autohooks.js +31 -0
- package/src/controllers/operator/credentials/credentials-controller.js +212 -0
- package/src/controllers/operator/credentials/schemas/credential.schema.js +46 -0
- package/src/controllers/operator/credentials/schemas/index.js +7 -0
- package/src/controllers/operator/credentials/schemas/new-credential.schema.json +23 -0
- package/src/controllers/operator/depots/depots-controller.js +154 -0
- package/src/controllers/operator/depots/schemas/depot.schema.js +34 -0
- package/src/controllers/operator/depots/schemas/index.js +24 -0
- package/src/controllers/operator/depots/schemas/new-depot.schema.json +30 -0
- package/src/controllers/operator/issue-links/issue-links-controller.js +74 -0
- package/src/controllers/operator/issuer-services/issuer-services-controller.js +200 -0
- package/src/controllers/operator/issuer-services/schemas/index.js +7 -0
- package/src/controllers/operator/issuer-services/schemas/issuer-service.schema.js +26 -0
- package/src/controllers/operator/issuer-services/schemas/new-issuer-service.schema.js +137 -0
- package/src/controllers/operator/presentation-links/presentation-links-controller.js +76 -0
- package/src/controllers/operator/presentations/presentations-controller.js +174 -0
- package/src/controllers/operator/presentations/schemas/base-presentation.schema.js +39 -0
- package/src/controllers/operator/presentations/schemas/credential-verification.schema.js +83 -0
- package/src/controllers/operator/presentations/schemas/index.js +23 -0
- package/src/controllers/operator/presentations/schemas/presentation-verification.schema.js +42 -0
- package/src/controllers/operator/presentations/schemas/presentation.schema.js +53 -0
- package/src/controllers/operator/presentations/schemas/w3c-presentation.js +52 -0
- package/src/controllers/operator/relying-party-services/relying-party-services-controller.js +202 -0
- package/src/controllers/operator/relying-party-services/schemas/index.js +7 -0
- package/src/controllers/operator/relying-party-services/schemas/new-relying-party-service.schema.js +91 -0
- package/src/controllers/operator/relying-party-services/schemas/relying-party-service.schema.js +26 -0
- package/src/controllers/operator/tenants/schemas/index.js +33 -0
- package/src/controllers/operator/tenants/schemas/jwk.schema.json +56 -0
- package/src/controllers/operator/tenants/schemas/key-metadata.schema.json +12 -0
- package/src/controllers/operator/tenants/schemas/new-key-metadata.schema.json +42 -0
- package/src/controllers/operator/tenants/schemas/new-key.schema.json +12 -0
- package/src/controllers/operator/tenants/schemas/new-tenant.schema.json +33 -0
- package/src/controllers/operator/tenants/schemas/secret-key.schema.json +33 -0
- package/src/controllers/operator/tenants/schemas/tenant.schema.json +44 -0
- package/src/controllers/operator/tenants/tenants-controller.js +165 -0
- package/src/controllers/root-controller.js +43 -0
- package/src/controllers/vn-api/schemas/index.js +25 -0
- package/src/controllers/vn-api/schemas/presentation-submission.schema.json +41 -0
- package/src/controllers/vn-api/schemas/velocity-presentation-submission.response.200.schema.json +36 -0
- package/src/controllers/vn-api/schemas/velocity-presentation-submission.schema.json +31 -0
- package/src/controllers/vn-api/vn-api-presentation-controller.js +158 -0
- package/src/controllers/vn-api/vn-issuing-controller.js +295 -0
- package/src/entities/credential-types/fetchers/fetch-credential-type-descriptors.js +36 -0
- package/src/entities/credential-types/fetchers/index.js +19 -0
- package/src/entities/credential-types/index.js +19 -0
- package/src/entities/credentials/domain/canonicalize-credentials.js +70 -0
- package/src/entities/credentials/domain/credential-errors.js +25 -0
- package/src/entities/credentials/domain/credential-format.js +21 -0
- package/src/entities/credentials/domain/index.js +22 -0
- package/src/entities/credentials/domain/validate-credential.js +74 -0
- package/src/entities/credentials/facades/anchor-verii-credentials-facade.js +45 -0
- package/src/entities/credentials/facades/build-verii-issuer.js +44 -0
- package/src/entities/credentials/facades/index.js +22 -0
- package/src/entities/credentials/facades/issue-verii-credentials-facade.js +62 -0
- package/src/entities/credentials/facades/sign-verii-credentials-facade.js +56 -0
- package/src/entities/credentials/factories/credential-factory.js +53 -0
- package/src/entities/credentials/factories/index.js +19 -0
- package/src/entities/credentials/index.js +23 -0
- package/src/entities/credentials/orchestrators/create-credentials.js +118 -0
- package/src/entities/credentials/orchestrators/index.js +19 -0
- package/src/entities/credentials/repo/finders-extension.js +94 -0
- package/src/entities/credentials/repo/index.js +19 -0
- package/src/entities/credentials/repo/repo.js +62 -0
- package/src/entities/credentials/repo/update-issued-credential.js +60 -0
- package/src/entities/depots/domain/depot-errors.js +23 -0
- package/src/entities/depots/domain/index.js +20 -0
- package/src/entities/depots/domain/validate-depot.js +38 -0
- package/src/entities/depots/factories/depot-factory.js +50 -0
- package/src/entities/depots/factories/index.js +19 -0
- package/src/entities/depots/index.js +22 -0
- package/src/entities/depots/orchestrators/create-depot.js +31 -0
- package/src/entities/depots/orchestrators/delete-depot.js +43 -0
- package/src/entities/depots/orchestrators/index.js +20 -0
- package/src/entities/depots/repo/find-depot-by-preauth-code.js +30 -0
- package/src/entities/depots/repo/find-depots-extension.js +34 -0
- package/src/entities/depots/repo/index.js +19 -0
- package/src/entities/depots/repo/refresh-preauth-code.js +30 -0
- package/src/entities/depots/repo/repo.js +61 -0
- package/src/entities/exchanges/adapters/index.js +17 -0
- package/src/entities/exchanges/adapters/sign-exchange-response.js +37 -0
- package/src/entities/exchanges/domain/authorize-exchange.js +29 -0
- package/src/entities/exchanges/domain/build-exchange-event.js +19 -0
- package/src/entities/exchanges/domain/build-presentation-request.js +174 -0
- package/src/entities/exchanges/domain/exchange-errors.js +28 -0
- package/src/entities/exchanges/domain/exchange-protocols.js +29 -0
- package/src/entities/exchanges/domain/exchange-states.js +53 -0
- package/src/entities/exchanges/domain/exchange-types.js +22 -0
- package/src/entities/exchanges/domain/generate-issuing-challenge.js +48 -0
- package/src/entities/exchanges/domain/index.js +32 -0
- package/src/entities/exchanges/domain/validate-message-settings.js +33 -0
- package/src/entities/exchanges/domain/validate-new-exchange.js +25 -0
- package/src/entities/exchanges/domain/validate-preauth.js +45 -0
- package/src/entities/exchanges/domain/validate-referenced-service.js +33 -0
- package/src/entities/exchanges/domain/verify-issuing-challenge.js +42 -0
- package/src/entities/exchanges/domain/verify-proof-of-key-possession.js +128 -0
- package/src/entities/exchanges/factories/index.js +19 -0
- package/src/entities/exchanges/factories/init-exchange-factory.js +58 -0
- package/src/entities/exchanges/hooks/exchange-error-hook.js +30 -0
- package/src/entities/exchanges/hooks/index.js +17 -0
- package/src/entities/exchanges/index.js +24 -0
- package/src/entities/exchanges/orchestrators/authenticate.js +67 -0
- package/src/entities/exchanges/orchestrators/credential-offer-request.js +70 -0
- package/src/entities/exchanges/orchestrators/get-credential-manifest.js +84 -0
- package/src/entities/exchanges/orchestrators/get-presentation-request.js +114 -0
- package/src/entities/exchanges/orchestrators/index.js +24 -0
- package/src/entities/exchanges/orchestrators/issue-credentials.js +132 -0
- package/src/entities/exchanges/orchestrators/post-presentation.js +58 -0
- package/src/entities/exchanges/repo/exchange-state-repo-extension.js +78 -0
- package/src/entities/exchanges/repo/index.js +19 -0
- package/src/entities/exchanges/repo/repo.js +52 -0
- package/src/entities/issuer-services/domain/index.js +20 -0
- package/src/entities/issuer-services/domain/issuer-services-errors.js +23 -0
- package/src/entities/issuer-services/domain/validate-issuer-service.js +23 -0
- package/src/entities/issuer-services/factories/index.js +19 -0
- package/src/entities/issuer-services/factories/issuer-service-factory.js +44 -0
- package/src/entities/issuer-services/index.js +21 -0
- package/src/entities/issuer-services/repo/find-issuer-services-extension.js +30 -0
- package/src/entities/issuer-services/repo/index.js +19 -0
- package/src/entities/issuer-services/repo/repo.js +59 -0
- package/src/entities/keys/adapters/index.js +19 -0
- package/src/entities/keys/adapters/load-primary-account.js +39 -0
- package/src/entities/keys/domain/cih-key-purposes.js +23 -0
- package/src/entities/keys/domain/get-key-with-purpose.js +22 -0
- package/src/entities/keys/domain/index.js +22 -0
- package/src/entities/keys/domain/key-errors.js +25 -0
- package/src/entities/keys/domain/normalize-tenant-key.js +33 -0
- package/src/entities/keys/domain/validate-tenant-keys.js +78 -0
- package/src/entities/keys/factories/index.js +19 -0
- package/src/entities/keys/factories/key-factory.js +61 -0
- package/src/entities/keys/index.js +22 -0
- package/src/entities/keys/plugins/index.js +17 -0
- package/src/entities/keys/plugins/kms-plugin.js +61 -0
- package/src/entities/links/domain/build-deep-link-url.js +58 -0
- package/src/entities/links/domain/build-openid4vci-credential-offer-link.js +31 -0
- package/src/entities/links/domain/build-openid4vp-authorization-request-link.js +36 -0
- package/src/entities/links/domain/build-redirect-url.js +29 -0
- package/src/entities/links/domain/build-vn-api-issuing-link.js +54 -0
- package/src/entities/links/domain/build-vn-api-presentation-link.js +49 -0
- package/src/entities/links/domain/index.js +28 -0
- package/src/entities/links/domain/is-preauth-code-auth.js +19 -0
- package/src/entities/links/domain/link-errors.js +23 -0
- package/src/entities/links/domain/validate-issue-link.js +39 -0
- package/src/entities/links/domain/validate-presentation-link.js +39 -0
- package/src/entities/links/index.js +20 -0
- package/src/entities/links/orchestrators/index.js +17 -0
- package/src/entities/links/orchestrators/refresh-links.js +139 -0
- package/src/entities/openid4vci/domain/index.js +20 -0
- package/src/entities/openid4vci/domain/openid4vci-errors.js +24 -0
- package/src/entities/openid4vci/domain/to-credential-configuration-id.js +21 -0
- package/src/entities/openid4vci/index.js +21 -0
- package/src/entities/openid4vci/orchestrators/create-access-token.js +85 -0
- package/src/entities/openid4vci/orchestrators/create-credential.js +108 -0
- package/src/entities/openid4vci/orchestrators/get-authorization-server-metadata.js +22 -0
- package/src/entities/openid4vci/orchestrators/get-credential-issuer-metadata.js +22 -0
- package/src/entities/openid4vci/orchestrators/handle-notification.js +94 -0
- package/src/entities/openid4vci/orchestrators/index.js +24 -0
- package/src/entities/openid4vci/plugins/index.js +19 -0
- package/src/entities/openid4vci/plugins/openid4vci-plugin.js +427 -0
- package/src/entities/openid4vp/domain/index.js +21 -0
- package/src/entities/openid4vp/domain/openid4vp-request-id.js +47 -0
- package/src/entities/openid4vp/domain/presentation-request-expiry.js +37 -0
- package/src/entities/openid4vp/domain/wallet-metadata.js +30 -0
- package/src/entities/openid4vp/index.js +21 -0
- package/src/entities/openid4vp/orchestrators/create-authorization-request.js +183 -0
- package/src/entities/openid4vp/orchestrators/index.js +20 -0
- package/src/entities/openid4vp/orchestrators/post-authorization-response.js +353 -0
- package/src/entities/openid4vp/plugins/index.js +19 -0
- package/src/entities/openid4vp/plugins/openid4vp-plugin.js +174 -0
- package/src/entities/presentations/domain/index.js +20 -0
- package/src/entities/presentations/domain/presentation-format.js +20 -0
- package/src/entities/presentations/domain/validate-presentation.js +178 -0
- package/src/entities/presentations/factories/index.js +19 -0
- package/src/entities/presentations/factories/presentation-factory.js +96 -0
- package/src/entities/presentations/index.js +21 -0
- package/src/entities/presentations/orchestrators/index.js +19 -0
- package/src/entities/presentations/orchestrators/verify-presentation.js +131 -0
- package/src/entities/presentations/repo/add-verification.js +31 -0
- package/src/entities/presentations/repo/finders-extension.js +50 -0
- package/src/entities/presentations/repo/index.js +19 -0
- package/src/entities/presentations/repo/repo.js +58 -0
- package/src/entities/relying-party-services/factories/index.js +19 -0
- package/src/entities/relying-party-services/factories/relying-party-service-factory.js +43 -0
- package/src/entities/relying-party-services/index.js +20 -0
- package/src/entities/relying-party-services/repo/find-relying-party-services-extension.js +30 -0
- package/src/entities/relying-party-services/repo/index.js +19 -0
- package/src/entities/relying-party-services/repo/repo.js +55 -0
- package/src/entities/service-configurations/domain/canonicalize-service-configuration.js +12 -0
- package/src/entities/service-configurations/domain/index.js +22 -0
- package/src/entities/service-configurations/domain/service-configuration-errors.js +24 -0
- package/src/entities/service-configurations/domain/validate-service-configuration.js +31 -0
- package/src/entities/service-configurations/domain/validate-update-service-configuration.js +19 -0
- package/src/entities/service-configurations/index.js +20 -0
- package/src/entities/service-configurations/orchestrators/create-service-configuration.js +34 -0
- package/src/entities/service-configurations/orchestrators/delete-service-configuration.js +41 -0
- package/src/entities/service-configurations/orchestrators/index.js +21 -0
- package/src/entities/service-configurations/orchestrators/update-service-configuration.js +40 -0
- package/src/entities/tenants/adapters/index.js +20 -0
- package/src/entities/tenants/adapters/load-tenant-did-doc.js +47 -0
- package/src/entities/tenants/adapters/load-tenant-profile.js +40 -0
- package/src/entities/tenants/domain/index.js +20 -0
- package/src/entities/tenants/domain/tenant-errors.js +29 -0
- package/src/entities/tenants/domain/validate-new-tenant.js +49 -0
- package/src/entities/tenants/factories/index.js +19 -0
- package/src/entities/tenants/factories/tenant-factory.js +41 -0
- package/src/entities/tenants/index.js +24 -0
- package/src/entities/tenants/orchestrators/create-tenant.js +116 -0
- package/src/entities/tenants/orchestrators/delete-tenant.js +45 -0
- package/src/entities/tenants/orchestrators/find-tenants.js +22 -0
- package/src/entities/tenants/orchestrators/index.js +21 -0
- package/src/entities/tenants/plugins/index.js +3 -0
- package/src/entities/tenants/plugins/tenant-loader-plugin.js +64 -0
- package/src/entities/tenants/repo/index.js +19 -0
- package/src/entities/tenants/repo/insert-tenant-extension.js +36 -0
- package/src/entities/tenants/repo/repo.js +51 -0
- package/src/entities/tokens/domains/access-token.js +74 -0
- package/src/entities/tokens/domains/index.js +19 -0
- package/src/entities/tokens/index.js +19 -0
- package/src/index.js +3 -0
- package/src/init-server.js +88 -0
- package/src/main.js +25 -0
- package/src/schemas/index.js +20 -0
- package/src/schemas/oauth-error-response.schema.js +27 -0
- package/src/standalone.js +8 -0
- package/src/start-app-server.js +27 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"$id": "new-credential",
|
|
4
|
+
"properties": {
|
|
5
|
+
"credentialReference": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"description": "reference for the offer in the host system"
|
|
8
|
+
},
|
|
9
|
+
"content": {
|
|
10
|
+
"$ref": "https://velocitycareerlabs.io/w3c-vc.schema.json"
|
|
11
|
+
},
|
|
12
|
+
"tags": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": [
|
|
20
|
+
"credentialReference",
|
|
21
|
+
"content"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Velocity Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
const { coerceArray } = require('@verii/common-functions');
|
|
18
|
+
const { tenantLoaderPlugin } = require('../../../entities/tenants');
|
|
19
|
+
const { createDepot, deleteDepot } = require('../../../entities/depots');
|
|
20
|
+
const { depotSchema, newDepotSchema } = require('./schemas');
|
|
21
|
+
|
|
22
|
+
const depotsController = async (fastify) => {
|
|
23
|
+
fastify
|
|
24
|
+
.addSchema(newDepotSchema)
|
|
25
|
+
.addSchema(depotSchema)
|
|
26
|
+
.register(tenantLoaderPlugin, { notFoundStatusCode: 400 })
|
|
27
|
+
.post(
|
|
28
|
+
'/create',
|
|
29
|
+
{
|
|
30
|
+
schema: fastify.autoSchema({
|
|
31
|
+
body: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
tenantId: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
},
|
|
37
|
+
serviceId: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
},
|
|
40
|
+
depot: { $ref: 'new-depot' },
|
|
41
|
+
},
|
|
42
|
+
required: ['tenantId', 'serviceId', 'depot'],
|
|
43
|
+
},
|
|
44
|
+
response: {
|
|
45
|
+
200: {
|
|
46
|
+
type: 'object',
|
|
47
|
+
properties: {
|
|
48
|
+
depot: {
|
|
49
|
+
$ref: 'depot#',
|
|
50
|
+
},
|
|
51
|
+
requestId: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
},
|
|
59
|
+
async (req) => {
|
|
60
|
+
const { depot: newDepot, serviceId } = req.body;
|
|
61
|
+
const depot = await createDepot(newDepot, serviceId, req);
|
|
62
|
+
return { depot };
|
|
63
|
+
},
|
|
64
|
+
)
|
|
65
|
+
.get(
|
|
66
|
+
'/get',
|
|
67
|
+
{
|
|
68
|
+
schema: fastify.autoSchema({
|
|
69
|
+
query: {
|
|
70
|
+
type: 'object',
|
|
71
|
+
properties: {
|
|
72
|
+
tenantId: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
},
|
|
75
|
+
serviceId: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
},
|
|
78
|
+
depotId: {
|
|
79
|
+
anyOf: [
|
|
80
|
+
{ type: 'string' },
|
|
81
|
+
{
|
|
82
|
+
type: 'array',
|
|
83
|
+
items: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
required: ['tenantId'],
|
|
91
|
+
},
|
|
92
|
+
response: {
|
|
93
|
+
200: {
|
|
94
|
+
type: 'object',
|
|
95
|
+
properties: {
|
|
96
|
+
depots: {
|
|
97
|
+
type: 'array',
|
|
98
|
+
items: {
|
|
99
|
+
$ref: 'depot',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
requestId: { type: 'string' },
|
|
103
|
+
},
|
|
104
|
+
required: ['depots', 'requestId'],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
},
|
|
109
|
+
async (req) => {
|
|
110
|
+
const { serviceId, depotId: depotIds } = req.query;
|
|
111
|
+
const depots = await req.repos.depots.findDepots(
|
|
112
|
+
serviceId,
|
|
113
|
+
coerceArray(depotIds),
|
|
114
|
+
);
|
|
115
|
+
return { depots };
|
|
116
|
+
},
|
|
117
|
+
)
|
|
118
|
+
.post(
|
|
119
|
+
'/delete',
|
|
120
|
+
{
|
|
121
|
+
schema: fastify.autoSchema({
|
|
122
|
+
body: {
|
|
123
|
+
type: 'object',
|
|
124
|
+
properties: {
|
|
125
|
+
tenantId: {
|
|
126
|
+
type: 'string',
|
|
127
|
+
},
|
|
128
|
+
serviceId: {
|
|
129
|
+
type: 'string',
|
|
130
|
+
minLength: 1,
|
|
131
|
+
},
|
|
132
|
+
depotId: {
|
|
133
|
+
type: 'string',
|
|
134
|
+
minLength: 1,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
required: ['tenantId', 'serviceId', 'depotId'],
|
|
138
|
+
},
|
|
139
|
+
response: {
|
|
140
|
+
200: {
|
|
141
|
+
type: 'object',
|
|
142
|
+
properties: {
|
|
143
|
+
requestId: { type: 'string' },
|
|
144
|
+
},
|
|
145
|
+
required: ['requestId'],
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
}),
|
|
149
|
+
},
|
|
150
|
+
async (req) => deleteDepot(req.body.depotId, req.body.serviceId, req),
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
module.exports = depotsController;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const { mutableEntitySchema } = require('@verii/common-schemas');
|
|
2
|
+
const newDepot = require('./new-depot.schema.json');
|
|
3
|
+
|
|
4
|
+
const depotSchema = {
|
|
5
|
+
$id: 'depot',
|
|
6
|
+
required: [
|
|
7
|
+
...mutableEntitySchema.required,
|
|
8
|
+
...newDepot.required,
|
|
9
|
+
'serviceId',
|
|
10
|
+
],
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
...mutableEntitySchema.properties,
|
|
14
|
+
...newDepot.properties,
|
|
15
|
+
serviceId: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'the serviceId this depot is used for',
|
|
18
|
+
},
|
|
19
|
+
messagingSettings: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
description: 'the wallet messaging settings',
|
|
22
|
+
properties: {
|
|
23
|
+
webhookUrl: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
},
|
|
26
|
+
authToken: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports = depotSchema;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Velocity Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const depotSchema = require('./depot.schema');
|
|
19
|
+
const newDepotSchema = require('./new-depot.schema.json');
|
|
20
|
+
|
|
21
|
+
module.exports = {
|
|
22
|
+
newDepotSchema,
|
|
23
|
+
depotSchema,
|
|
24
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "new-depot",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"required": [
|
|
5
|
+
"userReference"
|
|
6
|
+
],
|
|
7
|
+
"properties": {
|
|
8
|
+
"userReference": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The internal user reference for this depot. Typically a employee or student id of the system"
|
|
11
|
+
},
|
|
12
|
+
"authValues": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"description": "auth values to use for authenticating the user or session",
|
|
15
|
+
"items": {
|
|
16
|
+
"anyOf": [
|
|
17
|
+
{
|
|
18
|
+
"type": "number"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "boolean"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Velocity Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
const { refreshIssueLinks } = require('../../../entities/links');
|
|
18
|
+
const { tenantLoaderPlugin } = require('../../../entities/tenants');
|
|
19
|
+
|
|
20
|
+
const issueLinksController = async (fastify) => {
|
|
21
|
+
fastify.register(tenantLoaderPlugin, { notFoundStatusCode: 400 }).post(
|
|
22
|
+
'/refresh',
|
|
23
|
+
{
|
|
24
|
+
schema: fastify.autoSchema({
|
|
25
|
+
body: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
tenantId: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
},
|
|
31
|
+
serviceId: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
},
|
|
34
|
+
depotId: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
required: ['tenantId', 'serviceId'],
|
|
39
|
+
},
|
|
40
|
+
response: {
|
|
41
|
+
200: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
redirectUrl: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
format: 'uri',
|
|
47
|
+
},
|
|
48
|
+
vnProtocolLink: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
format: 'uri',
|
|
51
|
+
},
|
|
52
|
+
openidCredentialOffer: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
format: 'uri',
|
|
55
|
+
},
|
|
56
|
+
preauthCode: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
format: 'uri',
|
|
59
|
+
},
|
|
60
|
+
requestId: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
format: 'uri',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
required: ['redirectUrl', 'vnProtocolLink', 'requestId'],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
async (req) => refreshIssueLinks(req.body.serviceId, req.body.depotId, req),
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
module.exports = issueLinksController;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Velocity Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
const { coerceArray } = require('@verii/common-functions');
|
|
18
|
+
const { tenantLoaderPlugin } = require('../../../entities/tenants');
|
|
19
|
+
const { validateIssuerService } = require('../../../entities/issuer-services');
|
|
20
|
+
const {
|
|
21
|
+
createServiceConfiguration,
|
|
22
|
+
deleteServiceConfiguration,
|
|
23
|
+
updateServiceConfiguration,
|
|
24
|
+
validateUpdateServiceConfiguration,
|
|
25
|
+
} = require('../../../entities/service-configurations');
|
|
26
|
+
const {
|
|
27
|
+
issuerConfigurationSchema,
|
|
28
|
+
newIssuerConfigurationSchema,
|
|
29
|
+
} = require('./schemas');
|
|
30
|
+
|
|
31
|
+
const REPO_NAME = 'issuerServices';
|
|
32
|
+
const createIssuerServiceConfiguration = createServiceConfiguration(
|
|
33
|
+
REPO_NAME,
|
|
34
|
+
validateIssuerService,
|
|
35
|
+
);
|
|
36
|
+
const updateIssuerServiceConfiguration = updateServiceConfiguration(
|
|
37
|
+
REPO_NAME,
|
|
38
|
+
validateUpdateServiceConfiguration(validateIssuerService),
|
|
39
|
+
);
|
|
40
|
+
const deleteIssuerServiceConfiguration = deleteServiceConfiguration(REPO_NAME);
|
|
41
|
+
|
|
42
|
+
module.exports = async (fastify) => {
|
|
43
|
+
fastify
|
|
44
|
+
.addSchema(issuerConfigurationSchema)
|
|
45
|
+
.addSchema(newIssuerConfigurationSchema)
|
|
46
|
+
.register(tenantLoaderPlugin, { notFoundStatusCode: 400 })
|
|
47
|
+
.post(
|
|
48
|
+
'/create',
|
|
49
|
+
{
|
|
50
|
+
schema: fastify.autoSchema({
|
|
51
|
+
body: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
tenantId: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
},
|
|
57
|
+
service: {
|
|
58
|
+
$ref: 'new-issuer-service',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
required: ['tenantId', 'service'],
|
|
62
|
+
},
|
|
63
|
+
response: {
|
|
64
|
+
200: {
|
|
65
|
+
type: 'object',
|
|
66
|
+
properties: {
|
|
67
|
+
service: { $ref: 'issuer-service' },
|
|
68
|
+
requestId: { type: 'string' },
|
|
69
|
+
},
|
|
70
|
+
required: ['service', 'requestId'],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
74
|
+
},
|
|
75
|
+
async (req) => {
|
|
76
|
+
const service = await createIssuerServiceConfiguration(
|
|
77
|
+
req.body.service,
|
|
78
|
+
req,
|
|
79
|
+
);
|
|
80
|
+
return { service };
|
|
81
|
+
},
|
|
82
|
+
)
|
|
83
|
+
.get(
|
|
84
|
+
'/get',
|
|
85
|
+
{
|
|
86
|
+
schema: fastify.autoSchema({
|
|
87
|
+
query: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
properties: {
|
|
90
|
+
tenantId: {
|
|
91
|
+
type: 'string',
|
|
92
|
+
},
|
|
93
|
+
serviceId: {
|
|
94
|
+
anyOf: [
|
|
95
|
+
{ type: 'string' },
|
|
96
|
+
{
|
|
97
|
+
type: 'array',
|
|
98
|
+
items: {
|
|
99
|
+
type: 'string',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
required: ['tenantId'],
|
|
106
|
+
},
|
|
107
|
+
response: {
|
|
108
|
+
200: {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {
|
|
111
|
+
services: {
|
|
112
|
+
type: 'array',
|
|
113
|
+
items: {
|
|
114
|
+
$ref: 'issuer-service',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
requestId: { type: 'string' },
|
|
118
|
+
},
|
|
119
|
+
required: ['services', 'requestId'],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
}),
|
|
123
|
+
},
|
|
124
|
+
async (req) => {
|
|
125
|
+
const { query, repos } = req;
|
|
126
|
+
const services = await repos.issuerServices.findServices(
|
|
127
|
+
coerceArray(query.serviceId),
|
|
128
|
+
);
|
|
129
|
+
return { services };
|
|
130
|
+
},
|
|
131
|
+
)
|
|
132
|
+
.post(
|
|
133
|
+
'/update',
|
|
134
|
+
{
|
|
135
|
+
schema: fastify.autoSchema({
|
|
136
|
+
body: {
|
|
137
|
+
type: 'object',
|
|
138
|
+
properties: {
|
|
139
|
+
tenantId: {
|
|
140
|
+
type: 'string',
|
|
141
|
+
},
|
|
142
|
+
serviceId: {
|
|
143
|
+
type: 'string',
|
|
144
|
+
},
|
|
145
|
+
service: {
|
|
146
|
+
$ref: 'new-issuer-service',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
required: ['tenantId', 'serviceId', 'service'],
|
|
150
|
+
},
|
|
151
|
+
response: {
|
|
152
|
+
200: {
|
|
153
|
+
type: 'object',
|
|
154
|
+
properties: {
|
|
155
|
+
service: { $ref: 'issuer-service' },
|
|
156
|
+
requestId: { type: 'string' },
|
|
157
|
+
},
|
|
158
|
+
required: ['service', 'requestId'],
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
}),
|
|
162
|
+
},
|
|
163
|
+
async (req) => {
|
|
164
|
+
const service = await updateIssuerServiceConfiguration(
|
|
165
|
+
req.body.serviceId,
|
|
166
|
+
req.body.service,
|
|
167
|
+
req,
|
|
168
|
+
);
|
|
169
|
+
return { service };
|
|
170
|
+
},
|
|
171
|
+
)
|
|
172
|
+
.post(
|
|
173
|
+
'/delete',
|
|
174
|
+
{
|
|
175
|
+
schema: fastify.autoSchema({
|
|
176
|
+
body: {
|
|
177
|
+
type: 'object',
|
|
178
|
+
properties: {
|
|
179
|
+
tenantId: {
|
|
180
|
+
type: 'string',
|
|
181
|
+
},
|
|
182
|
+
serviceId: {
|
|
183
|
+
type: 'string',
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
required: ['tenantId', 'serviceId'],
|
|
187
|
+
},
|
|
188
|
+
response: {
|
|
189
|
+
200: {
|
|
190
|
+
type: 'object',
|
|
191
|
+
properties: {
|
|
192
|
+
requestId: { type: 'string' },
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
}),
|
|
197
|
+
},
|
|
198
|
+
async (req) => deleteIssuerServiceConfiguration(req.body.serviceId, req),
|
|
199
|
+
);
|
|
200
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const { mutableEntitySchema } = require('@verii/common-schemas');
|
|
2
|
+
const newIssuerConfigurationSchema = require('./new-issuer-service.schema');
|
|
3
|
+
|
|
4
|
+
const issuerServiceSchema = {
|
|
5
|
+
title: 'issuer-service',
|
|
6
|
+
$id: 'issuer-service',
|
|
7
|
+
description: 'The issuer service',
|
|
8
|
+
type: 'object',
|
|
9
|
+
additionalProperties: false,
|
|
10
|
+
properties: {
|
|
11
|
+
genericRedirectUrl: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
format: 'uri',
|
|
14
|
+
description:
|
|
15
|
+
'only returned if authMethod include `verifiable_presentation`',
|
|
16
|
+
},
|
|
17
|
+
...mutableEntitySchema.properties,
|
|
18
|
+
...newIssuerConfigurationSchema.properties,
|
|
19
|
+
},
|
|
20
|
+
required: [
|
|
21
|
+
...mutableEntitySchema.required,
|
|
22
|
+
...newIssuerConfigurationSchema.required,
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
module.exports = issuerServiceSchema;
|