@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,202 @@
|
|
|
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 {
|
|
20
|
+
createServiceConfiguration,
|
|
21
|
+
updateServiceConfiguration,
|
|
22
|
+
deleteServiceConfiguration,
|
|
23
|
+
validateServiceConfiguration,
|
|
24
|
+
validateUpdateServiceConfiguration,
|
|
25
|
+
} = require('../../../entities/service-configurations');
|
|
26
|
+
const {
|
|
27
|
+
relyingPartyConfigurationSchema,
|
|
28
|
+
newRelyingPartyConfigurationSchema,
|
|
29
|
+
} = require('./schemas');
|
|
30
|
+
|
|
31
|
+
const REPO_NAME = 'relyingPartyServices';
|
|
32
|
+
const createRelyingPartyServiceConfiguration = createServiceConfiguration(
|
|
33
|
+
REPO_NAME,
|
|
34
|
+
validateServiceConfiguration,
|
|
35
|
+
);
|
|
36
|
+
const updateRelyingPartyServiceConfiguration = updateServiceConfiguration(
|
|
37
|
+
REPO_NAME,
|
|
38
|
+
validateUpdateServiceConfiguration(validateServiceConfiguration),
|
|
39
|
+
);
|
|
40
|
+
const deleteRelyingPartyServiceConfiguration =
|
|
41
|
+
deleteServiceConfiguration(REPO_NAME);
|
|
42
|
+
|
|
43
|
+
module.exports = async (fastify) => {
|
|
44
|
+
fastify
|
|
45
|
+
.addSchema(relyingPartyConfigurationSchema)
|
|
46
|
+
.addSchema(newRelyingPartyConfigurationSchema)
|
|
47
|
+
.register(tenantLoaderPlugin, { notFoundStatusCode: 400 })
|
|
48
|
+
.post(
|
|
49
|
+
'/create',
|
|
50
|
+
{
|
|
51
|
+
schema: fastify.autoSchema({
|
|
52
|
+
body: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
tenantId: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
},
|
|
58
|
+
service: {
|
|
59
|
+
$ref: 'new-relying-party-service',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
required: ['tenantId', 'service'],
|
|
63
|
+
},
|
|
64
|
+
response: {
|
|
65
|
+
200: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
properties: {
|
|
68
|
+
service: { $ref: 'relying-party-service' },
|
|
69
|
+
requestId: { type: 'string' },
|
|
70
|
+
},
|
|
71
|
+
required: ['service', 'requestId'],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
},
|
|
76
|
+
async (req) => {
|
|
77
|
+
const service = await createRelyingPartyServiceConfiguration(
|
|
78
|
+
req.body.service,
|
|
79
|
+
req,
|
|
80
|
+
);
|
|
81
|
+
return { service };
|
|
82
|
+
},
|
|
83
|
+
)
|
|
84
|
+
.get(
|
|
85
|
+
'/get',
|
|
86
|
+
{
|
|
87
|
+
schema: fastify.autoSchema({
|
|
88
|
+
query: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
tenantId: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
},
|
|
94
|
+
serviceId: {
|
|
95
|
+
anyOf: [
|
|
96
|
+
{ type: 'string' },
|
|
97
|
+
{
|
|
98
|
+
type: 'array',
|
|
99
|
+
items: {
|
|
100
|
+
type: 'string',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
required: ['tenantId'],
|
|
107
|
+
},
|
|
108
|
+
response: {
|
|
109
|
+
200: {
|
|
110
|
+
type: 'object',
|
|
111
|
+
properties: {
|
|
112
|
+
services: {
|
|
113
|
+
type: 'array',
|
|
114
|
+
items: {
|
|
115
|
+
$ref: 'relying-party-service',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
requestId: { type: 'string' },
|
|
119
|
+
},
|
|
120
|
+
required: ['services', 'requestId'],
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
},
|
|
125
|
+
async (req) => {
|
|
126
|
+
const { query, repos } = req;
|
|
127
|
+
const services = await repos.relyingPartyServices.findServices(
|
|
128
|
+
coerceArray(query.serviceId),
|
|
129
|
+
);
|
|
130
|
+
return { services };
|
|
131
|
+
},
|
|
132
|
+
)
|
|
133
|
+
.post(
|
|
134
|
+
'/update',
|
|
135
|
+
{
|
|
136
|
+
schema: fastify.autoSchema({
|
|
137
|
+
body: {
|
|
138
|
+
type: 'object',
|
|
139
|
+
properties: {
|
|
140
|
+
tenantId: {
|
|
141
|
+
type: 'string',
|
|
142
|
+
},
|
|
143
|
+
serviceId: {
|
|
144
|
+
type: 'string',
|
|
145
|
+
},
|
|
146
|
+
service: {
|
|
147
|
+
$ref: 'new-relying-party-service',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
required: ['tenantId', 'serviceId', 'service'],
|
|
151
|
+
},
|
|
152
|
+
response: {
|
|
153
|
+
200: {
|
|
154
|
+
type: 'object',
|
|
155
|
+
properties: {
|
|
156
|
+
service: { $ref: 'relying-party-service' },
|
|
157
|
+
requestId: { type: 'string' },
|
|
158
|
+
},
|
|
159
|
+
required: ['service', 'requestId'],
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
}),
|
|
163
|
+
},
|
|
164
|
+
async (req) => {
|
|
165
|
+
const service = await updateRelyingPartyServiceConfiguration(
|
|
166
|
+
req.body.serviceId,
|
|
167
|
+
req.body.service,
|
|
168
|
+
req,
|
|
169
|
+
);
|
|
170
|
+
return { service };
|
|
171
|
+
},
|
|
172
|
+
)
|
|
173
|
+
.post(
|
|
174
|
+
'/delete',
|
|
175
|
+
{
|
|
176
|
+
schema: fastify.autoSchema({
|
|
177
|
+
body: {
|
|
178
|
+
type: 'object',
|
|
179
|
+
properties: {
|
|
180
|
+
tenantId: {
|
|
181
|
+
type: 'string',
|
|
182
|
+
},
|
|
183
|
+
serviceId: {
|
|
184
|
+
type: 'string',
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
required: ['tenantId', 'serviceId'],
|
|
188
|
+
},
|
|
189
|
+
response: {
|
|
190
|
+
200: {
|
|
191
|
+
type: 'object',
|
|
192
|
+
properties: {
|
|
193
|
+
requestId: { type: 'string' },
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
}),
|
|
198
|
+
},
|
|
199
|
+
async (req) =>
|
|
200
|
+
deleteRelyingPartyServiceConfiguration(req.body.serviceId, req),
|
|
201
|
+
);
|
|
202
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const newRelyingPartyConfigurationSchema = require('./new-relying-party-service.schema');
|
|
2
|
+
const relyingPartyConfigurationSchema = require('./relying-party-service.schema');
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
relyingPartyConfigurationSchema,
|
|
6
|
+
newRelyingPartyConfigurationSchema,
|
|
7
|
+
};
|
package/src/controllers/operator/relying-party-services/schemas/new-relying-party-service.schema.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const newRelyingPartyServiceSchema = {
|
|
2
|
+
title: 'new-relying-party-service',
|
|
3
|
+
$id: 'new-relying-party-service',
|
|
4
|
+
type: 'object',
|
|
5
|
+
description: 'The relying-party service describes how issuer is setup',
|
|
6
|
+
additionalProperties: false,
|
|
7
|
+
required: ['mode', 'velocityNetworkServiceId', 'termsUrl'],
|
|
8
|
+
properties: {
|
|
9
|
+
mode: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
enum: ['single', 'feed'],
|
|
12
|
+
default: 'single',
|
|
13
|
+
description: 'Single (default) deliveries or a feed',
|
|
14
|
+
},
|
|
15
|
+
velocityNetworkServiceId: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'Velocity Network Service Id',
|
|
18
|
+
},
|
|
19
|
+
description: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'Description field for the disclosure flow',
|
|
22
|
+
},
|
|
23
|
+
termsUrl: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description:
|
|
26
|
+
'link to a online terms and conditions for issuer or disclosure',
|
|
27
|
+
format: 'uri',
|
|
28
|
+
},
|
|
29
|
+
disclosureRequest: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
description:
|
|
32
|
+
'Required if `identificationMethod` contains `verifiable_presentation`',
|
|
33
|
+
required: ['types', 'purpose', 'retentionPeriod'],
|
|
34
|
+
properties: {
|
|
35
|
+
types: {
|
|
36
|
+
type: 'array',
|
|
37
|
+
description: 'the set of types that are to be disclosed.',
|
|
38
|
+
minItems: 1,
|
|
39
|
+
items: {
|
|
40
|
+
type: 'object',
|
|
41
|
+
properties: {
|
|
42
|
+
type: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
description: 'The credential type to be disclosed',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
purpose: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description:
|
|
52
|
+
// eslint-disable-next-line max-len
|
|
53
|
+
'purpose is a summary of the description\n\n*required*, if the `configurationType` is `inspection` or the `identificationMode` is `verifiable_presentation`',
|
|
54
|
+
},
|
|
55
|
+
retentionPeriod: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description:
|
|
58
|
+
// eslint-disable-next-line max-len
|
|
59
|
+
'*required*, if the `configurationType` is `inspection` or the `identificationMode` is `verifiable_presentation`\n\nLength of time the disclosure agreement will last. Duration can be any length of time.\n\nFollows the ISO 8601 standard on durations for time intervals.\n\nFormat:\n\nPxYxMxWxD\n\nWhere:\nx = an integer\nY = Years\nM = Months\nW = Weeks\nD = Days\n\nA valid format requires "P" plus at least one integer and time unit.\n\nExamples: \nP60D = 60 days\nP1Y30D = 1 year and 30 days.',
|
|
60
|
+
format: 'duration',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
presentationDefinition: {
|
|
65
|
+
type: 'object',
|
|
66
|
+
description:
|
|
67
|
+
'A spec compliant presentation definition. https://identity.foundation/presentation-exchange/#presentation-definition',
|
|
68
|
+
additionalProperties: true,
|
|
69
|
+
},
|
|
70
|
+
deactivationDate: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
format: 'date-time',
|
|
73
|
+
description:
|
|
74
|
+
'can be configured to deactivate at a predetermined time or to be deactivated on demand by setting this to now',
|
|
75
|
+
},
|
|
76
|
+
authTokensExpireIn: {
|
|
77
|
+
type: 'integer',
|
|
78
|
+
minimum: 1,
|
|
79
|
+
default: 604800,
|
|
80
|
+
},
|
|
81
|
+
presentationRequestsExpireIn: {
|
|
82
|
+
type: 'integer',
|
|
83
|
+
minimum: 1,
|
|
84
|
+
default: 600,
|
|
85
|
+
description:
|
|
86
|
+
'how many seconds before presentation requests issued by this service expire. Default is 10 minutes',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
module.exports = newRelyingPartyServiceSchema;
|
package/src/controllers/operator/relying-party-services/schemas/relying-party-service.schema.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const { mutableEntitySchema } = require('@verii/common-schemas');
|
|
2
|
+
const newRelyingPartyConfigurationSchema = require('./new-relying-party-service.schema');
|
|
3
|
+
|
|
4
|
+
const relyingPartyServiceSchema = {
|
|
5
|
+
title: 'relying-party-service',
|
|
6
|
+
$id: 'relying-party-service',
|
|
7
|
+
description: 'The relying-party 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
|
+
...newRelyingPartyConfigurationSchema.properties,
|
|
19
|
+
},
|
|
20
|
+
required: [
|
|
21
|
+
...mutableEntitySchema.required,
|
|
22
|
+
...newRelyingPartyConfigurationSchema.required,
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
module.exports = relyingPartyServiceSchema;
|
|
@@ -0,0 +1,33 @@
|
|
|
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 jwkSchema = require('./jwk.schema.json');
|
|
18
|
+
const newTenantSchema = require('./new-tenant.schema.json');
|
|
19
|
+
const tenantSchema = require('./tenant.schema.json');
|
|
20
|
+
const newKeyMetadataSchema = require('./new-key-metadata.schema.json');
|
|
21
|
+
const keyMetadataSchema = require('./key-metadata.schema.json');
|
|
22
|
+
const secretKeySchema = require('./secret-key.schema.json');
|
|
23
|
+
const newKeySchema = require('./new-key.schema.json');
|
|
24
|
+
|
|
25
|
+
module.exports = {
|
|
26
|
+
jwkSchema,
|
|
27
|
+
newTenantSchema,
|
|
28
|
+
tenantSchema,
|
|
29
|
+
newKeyMetadataSchema,
|
|
30
|
+
keyMetadataSchema,
|
|
31
|
+
secretKeySchema,
|
|
32
|
+
newKeySchema,
|
|
33
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "jwk",
|
|
3
|
+
"$id": "jwk",
|
|
4
|
+
"description": "jwk schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"kty"
|
|
8
|
+
],
|
|
9
|
+
"properties": {
|
|
10
|
+
"kty": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
},
|
|
13
|
+
"use": {
|
|
14
|
+
"type": "string"
|
|
15
|
+
},
|
|
16
|
+
"key_ops": {
|
|
17
|
+
"type": "string"
|
|
18
|
+
},
|
|
19
|
+
"x5u": {
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"x5c": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
"x5t": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
"x5t#S256": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"alg": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"kid": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
},
|
|
37
|
+
"exp": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"crv": {
|
|
41
|
+
"type": "string"
|
|
42
|
+
},
|
|
43
|
+
"y": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
},
|
|
46
|
+
"x": {
|
|
47
|
+
"type": "string"
|
|
48
|
+
},
|
|
49
|
+
"n": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"e": {
|
|
53
|
+
"type": "string"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "new-key-metadata",
|
|
3
|
+
"title": "New Key Metadata",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"purposes": {
|
|
7
|
+
"type": "array",
|
|
8
|
+
"minItems": 1,
|
|
9
|
+
"items": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"enum": [
|
|
12
|
+
"DLT_TRANSACTIONS",
|
|
13
|
+
"EXCHANGES",
|
|
14
|
+
"ISSUING_METADATA"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"algorithm": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"enum": [
|
|
21
|
+
"SECP256K1"
|
|
22
|
+
],
|
|
23
|
+
"default": "SECP256K1"
|
|
24
|
+
},
|
|
25
|
+
"encoding": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"enum": [
|
|
28
|
+
"hex",
|
|
29
|
+
"jwk"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"kidFragment": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"pattern": "^#[A-Za-z0-9._:?=&%;-]+$"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"required": [
|
|
38
|
+
"purposes",
|
|
39
|
+
"encoding",
|
|
40
|
+
"kidFragment"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Tenant creation",
|
|
3
|
+
"$id": "new-tenant",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"did": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"pattern": "^did:[a-z0-9]+:[A-Za-z0-9._:?=&%;-]+$"
|
|
9
|
+
},
|
|
10
|
+
"hostUrl": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"format": "uri"
|
|
13
|
+
},
|
|
14
|
+
"primaryAccount": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"caoDid": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"name": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"logo": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"format": "uri"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": [
|
|
29
|
+
"did",
|
|
30
|
+
"name",
|
|
31
|
+
"logo"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Secret key Value",
|
|
3
|
+
"$id": "secret-key",
|
|
4
|
+
"description": "A secret key",
|
|
5
|
+
"oneOf": [
|
|
6
|
+
{
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"key": {
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"encoding": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"enum": ["hex"]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["key"]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"type": "object",
|
|
21
|
+
"properties": {
|
|
22
|
+
"jwk": {
|
|
23
|
+
"$ref": "jwk#"
|
|
24
|
+
},
|
|
25
|
+
"encoding": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"enum": ["jwk"]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"required": ["jwk"]
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Tenant",
|
|
3
|
+
"$id": "tenant",
|
|
4
|
+
"additionalProperties": false,
|
|
5
|
+
"allOf": [
|
|
6
|
+
{
|
|
7
|
+
"$ref": "mutable-entity#"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"$ref": "new-tenant#"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"type": "object",
|
|
14
|
+
"properties": {
|
|
15
|
+
"did": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"pattern": "^did:[a-z0-9]+:[A-Za-z0-9._:?=&%;-]+$"
|
|
18
|
+
},
|
|
19
|
+
"name": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "did for the org"
|
|
22
|
+
},
|
|
23
|
+
"logo": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"format": "uri"
|
|
26
|
+
},
|
|
27
|
+
"description": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "did for the org"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"examples": [
|
|
35
|
+
{
|
|
36
|
+
"id": "5fsdflkdsfsdfsfwwerr",
|
|
37
|
+
"did": "did:ion:129031903190239123021312",
|
|
38
|
+
"name": "ACME Limited",
|
|
39
|
+
"logo": "http://example.com/logo.com",
|
|
40
|
+
"createdAt": "2019-08-24T14:15:22Z",
|
|
41
|
+
"updatedAt": "2019-08-24T14:15:22Z"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|