@verii/server-credentialagent 1.0.0-pre.1752076816
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.localdev.e2e.env +40 -0
- package/.localdev.env +41 -0
- package/.standalone.env +5 -0
- package/LICENSE +202 -0
- package/NOTICE +1 -0
- package/README.md +19 -0
- package/docker/compose.yml +33 -0
- package/e2e/README.md +12 -0
- package/e2e/org-registration-and-issuing.e2e.test.js +624 -0
- package/jest.config.js +20 -0
- package/migrate-mongo.config.js +36 -0
- package/migrations/20210317133137-add-index-to-offers-repo.js +57 -0
- package/migrations/20210416145639-add-index-to-revocation-list.js +27 -0
- package/migrations/20210719120225-add_unique_did_index_to_tenant.js +45 -0
- package/migrations/20230524053029-add-vendorUserIdMappings-index.js +32 -0
- package/migrations/20230616111907-add-configuration-type-index.js +32 -0
- package/package.json +108 -0
- package/src/assets/public/favicon.ico +0 -0
- package/src/assets/public/logo192.png +0 -0
- package/src/assets/public/logo512.png +0 -0
- package/src/assets/public/manifest.json +28 -0
- package/src/assets/templates/app-redirect.hbs +16 -0
- package/src/config/config.js +44 -0
- package/src/config/core-config.js +143 -0
- package/src/config/holder-config.js +104 -0
- package/src/config/index.js +22 -0
- package/src/config/operator-config.js +64 -0
- package/src/controllers/autoload-holder-api-controllers.js +30 -0
- package/src/controllers/autoload-operator-api-controllers.js +31 -0
- package/src/controllers/autoload-root-api-controller.js +30 -0
- package/src/controllers/autoload-saasoperator-api-controllers.js +31 -0
- package/src/controllers/holder/autohooks.js +55 -0
- package/src/controllers/holder/get-exchange-progress/autohooks.js +27 -0
- package/src/controllers/holder/get-exchange-progress/controller.js +50 -0
- package/src/controllers/holder/inspect/autohooks.js +35 -0
- package/src/controllers/holder/inspect/get-presentation-request/controller.js +100 -0
- package/src/controllers/holder/inspect/schemas/holder-disclosure.schema.json +73 -0
- package/src/controllers/holder/inspect/schemas/index.js +33 -0
- package/src/controllers/holder/inspect/schemas/presentation-definition.v1.schema.json +461 -0
- package/src/controllers/holder/inspect/schemas/presentation-request.schema.json +279 -0
- package/src/controllers/holder/inspect/schemas/presentation-submission.schema.json +41 -0
- package/src/controllers/holder/inspect/schemas/siop-presentation-submission.schema.json +74 -0
- package/src/controllers/holder/inspect/schemas/velocity-presentation-submission.response.200.schema.json +36 -0
- package/src/controllers/holder/inspect/schemas/velocity-presentation-submission.schema.json +34 -0
- package/src/controllers/holder/inspect/submit-presentation/controller.js +89 -0
- package/src/controllers/holder/issue/autohooks.js +23 -0
- package/src/controllers/holder/issue/get-credential-manifest/controller.js +193 -0
- package/src/controllers/holder/issue/offers/autohooks.js +35 -0
- package/src/controllers/holder/issue/offers/controller.js +164 -0
- package/src/controllers/holder/issue/offers/credential-offers/controller.js +460 -0
- package/src/controllers/holder/issue/submit-identification/autohooks.js +37 -0
- package/src/controllers/holder/issue/submit-identification/controller.js +63 -0
- package/src/controllers/holder/oauth/autohooks.js +19 -0
- package/src/controllers/holder/oauth/controller.js +140 -0
- package/src/controllers/index.js +22 -0
- package/src/controllers/operator/tenants/_tenantId/autohooks.js +40 -0
- package/src/controllers/operator/tenants/_tenantId/check-credentials/autohooks.js +24 -0
- package/src/controllers/operator/tenants/_tenantId/check-credentials/controller-v0.8.js +200 -0
- package/src/controllers/operator/tenants/_tenantId/check-credentials/schemas/index.js +19 -0
- package/src/controllers/operator/tenants/_tenantId/check-credentials/schemas/vendor-credential.schema.json +244 -0
- package/src/controllers/operator/tenants/_tenantId/controller-v0.8.js +221 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/_id/autohooks.js +30 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/_id/controller-v0.8.js +271 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/_id/feeds/autohooks.js +45 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/_id/feeds/controller-v0.8.js +199 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/_id/feeds/schemas/add-feed.schema.js +14 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/_id/feeds/schemas/feed.schema.json +27 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/_id/feeds/schemas/index.js +25 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/_id/feeds/schemas/modify-feed-update-body.schema.js +18 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/_id/feeds/schemas/modify-feed.schema.json +19 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/autohooks.js +34 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/controller-v0.8.js +100 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/schemas/agent-disclosure-presentation-definition.schema.json +404 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/schemas/agent-disclosure.schema.js +24 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/schemas/index.js +29 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/schemas/new-agent-disclosure.schema.json +166 -0
- package/src/controllers/operator/tenants/_tenantId/disclosures/schemas/update-agent-disclosure.schema.js +20 -0
- package/src/controllers/operator/tenants/_tenantId/exchanges/_exchangeId/autohooks.js +30 -0
- package/src/controllers/operator/tenants/_tenantId/exchanges/_exchangeId/controller-v0.8.js +73 -0
- package/src/controllers/operator/tenants/_tenantId/exchanges/autohooks.js +19 -0
- package/src/controllers/operator/tenants/_tenantId/exchanges/controller-v0.8.js +150 -0
- package/src/controllers/operator/tenants/_tenantId/exchanges/schemas/get-exchange.response.body.json +147 -0
- package/src/controllers/operator/tenants/_tenantId/exchanges/schemas/index.js +21 -0
- package/src/controllers/operator/tenants/_tenantId/issued-credentials/autohooks.js +27 -0
- package/src/controllers/operator/tenants/_tenantId/issued-credentials/controller-v0.8.js +303 -0
- package/src/controllers/operator/tenants/_tenantId/issued-credentials/schemas/index.js +23 -0
- package/src/controllers/operator/tenants/_tenantId/issued-credentials/schemas/issued-credential.schema.json +115 -0
- package/src/controllers/operator/tenants/_tenantId/issued-credentials/schemas/revoke-credentials.schema.json +18 -0
- package/src/controllers/operator/tenants/_tenantId/keys/controller-v0.8.js +168 -0
- package/src/controllers/operator/tenants/_tenantId/offer-data/controller-v0.8.js +78 -0
- package/src/controllers/operator/tenants/_tenantId/offers/autohooks.js +34 -0
- package/src/controllers/operator/tenants/_tenantId/offers/controller-v0.8.js +253 -0
- package/src/controllers/operator/tenants/_tenantId/offers/schemas/index.js +23 -0
- package/src/controllers/operator/tenants/_tenantId/offers/schemas/new-vendor-offer.schema.js +47 -0
- package/src/controllers/operator/tenants/_tenantId/offers/schemas/vendor-offer.schema.json +56 -0
- package/src/controllers/operator/tenants/_tenantId/users/autohooks.js +24 -0
- package/src/controllers/operator/tenants/_tenantId/users/controller-v0.8.js +92 -0
- package/src/controllers/operator/tenants/_tenantId/users/schemas/index.js +23 -0
- package/src/controllers/operator/tenants/_tenantId/users/schemas/new-user.schema.json +13 -0
- package/src/controllers/operator/tenants/_tenantId/users/schemas/user.schema.json +16 -0
- package/src/controllers/operator/tenants/_tenantId/vc-api/credentials/autohooks.js +34 -0
- package/src/controllers/operator/tenants/_tenantId/vc-api/credentials/controller-v0.8.js +110 -0
- package/src/controllers/operator/tenants/_tenantId/vc-api/credentials/schemas/Credential.schema.js +18 -0
- package/src/controllers/operator/tenants/_tenantId/vc-api/credentials/schemas/IssueCredentialOptions.schema.json +42 -0
- package/src/controllers/operator/tenants/_tenantId/vc-api/credentials/schemas/IssueCredentialRequest.schema.json +13 -0
- package/src/controllers/operator/tenants/_tenantId/vc-api/credentials/schemas/IssueCredentialResponse.schema.json +19 -0
- package/src/controllers/operator/tenants/_tenantId/vc-api/credentials/schemas/LinkedDataProof.schema.json +43 -0
- package/src/controllers/operator/tenants/_tenantId/vc-api/credentials/schemas/VerifiableCredential.schema.js +16 -0
- package/src/controllers/operator/tenants/_tenantId/vc-api/credentials/schemas/index.js +31 -0
- package/src/controllers/operator/tenants/autohooks.js +65 -0
- package/src/controllers/operator/tenants/controller-v0.8.js +167 -0
- package/src/controllers/operator/tenants/schemas/index.js +41 -0
- package/src/controllers/operator/tenants/schemas/modify-secret.schema.json +11 -0
- package/src/controllers/operator/tenants/schemas/modify-tenant-v0.8.schema.json +44 -0
- package/src/controllers/operator/tenants/schemas/new-tenant-v0.8.schema.json +19 -0
- package/src/controllers/operator/tenants/schemas/new-tenant.response.200.schema.json +7 -0
- package/src/controllers/operator/tenants/schemas/secret-key-metadata.schema.json +31 -0
- package/src/controllers/operator/tenants/schemas/secret-key.schema.json +29 -0
- package/src/controllers/operator/tenants/schemas/secret-kid.schema.json +13 -0
- package/src/controllers/operator/tenants/schemas/secret-new-tenant-v0.8.schema.json +28 -0
- package/src/controllers/operator/tenants/schemas/secret-tenant-key-v0.8.schema.json +13 -0
- package/src/controllers/operator/tenants/schemas/tenant-key-v0.8.schema.json +14 -0
- package/src/controllers/operator/tenants/schemas/tenant-v0.8.schema.json +62 -0
- package/src/controllers/root/autohooks.js +23 -0
- package/src/controllers/root/controller.js +173 -0
- package/src/controllers/saasoperator/groups/_id/autohooks.js +9 -0
- package/src/controllers/saasoperator/groups/_id/controller.js +121 -0
- package/src/controllers/saasoperator/groups/autohooks.js +19 -0
- package/src/controllers/saasoperator/groups/controller.js +65 -0
- package/src/controllers/saasoperator/groups/schemas/group.schema.js +17 -0
- package/src/controllers/saasoperator/groups/schemas/index.js +4 -0
- package/src/controllers/saasoperator/groups/schemas/new-group.schema.js +13 -0
- package/src/entities/common/domains/get-json-at-path.js +28 -0
- package/src/entities/common/domains/index.js +17 -0
- package/src/entities/common/index.js +17 -0
- package/src/entities/credentials/domains/credential-format.js +22 -0
- package/src/entities/credentials/domains/index.js +19 -0
- package/src/entities/credentials/index.js +17 -0
- package/src/entities/deep-links/domains/extract-did.js +11 -0
- package/src/entities/deep-links/domains/index.js +20 -0
- package/src/entities/deep-links/domains/velocity-protocol-uri-to-http-uri.js +32 -0
- package/src/entities/deep-links/index.js +19 -0
- package/src/entities/disclosures/domains/assert-disclosure-active.js +21 -0
- package/src/entities/disclosures/domains/compute-disclosure-configuration-type.js +29 -0
- package/src/entities/disclosures/domains/constants.js +61 -0
- package/src/entities/disclosures/domains/errors.js +34 -0
- package/src/entities/disclosures/domains/get-disclosure-configuration-type.js +60 -0
- package/src/entities/disclosures/domains/index.js +32 -0
- package/src/entities/disclosures/domains/is-issuing-disclosure.js +23 -0
- package/src/entities/disclosures/domains/parse-body-to-disclosure.js +17 -0
- package/src/entities/disclosures/domains/validate-by-identification-method.js +69 -0
- package/src/entities/disclosures/domains/validate-commercial-entity.js +26 -0
- package/src/entities/disclosures/domains/validate-disclosure-by-configuration-type.js +47 -0
- package/src/entities/disclosures/domains/validate-disclosure-default-issuing.js +77 -0
- package/src/entities/disclosures/domains/validate-disclosure.js +37 -0
- package/src/entities/disclosures/domains/validate-feed.js +16 -0
- package/src/entities/disclosures/domains/validate-presentation-definition.js +54 -0
- package/src/entities/disclosures/domains/validate-vendor-endpoint.js +22 -0
- package/src/entities/disclosures/domains/validate-vendor-webhook.js +18 -0
- package/src/entities/disclosures/factories/disclosure-factory.js +94 -0
- package/src/entities/disclosures/factories/index.js +19 -0
- package/src/entities/disclosures/index.js +22 -0
- package/src/entities/disclosures/orchestrators/get-disclosure.js +18 -0
- package/src/entities/disclosures/orchestrators/index.js +20 -0
- package/src/entities/disclosures/orchestrators/update-disclosure-configuration-type.js +32 -0
- package/src/entities/disclosures/repos/index.js +20 -0
- package/src/entities/disclosures/repos/repo.js +118 -0
- package/src/entities/disclosures/repos/set-configuration-type.js +33 -0
- package/src/entities/exchanges/adapters/index.js +17 -0
- package/src/entities/exchanges/adapters/sign-exchange-response.js +45 -0
- package/src/entities/exchanges/domains/build-exchange-progress.js +56 -0
- package/src/entities/exchanges/domains/constants.js +24 -0
- package/src/entities/exchanges/domains/ensure-exchange-state-valid.js +35 -0
- package/src/entities/exchanges/domains/errors.js +33 -0
- package/src/entities/exchanges/domains/index.js +25 -0
- package/src/entities/exchanges/domains/states.js +43 -0
- package/src/entities/exchanges/domains/types.js +31 -0
- package/src/entities/exchanges/factories/disclosure-exchange-factory.js +46 -0
- package/src/entities/exchanges/factories/index.js +20 -0
- package/src/entities/exchanges/factories/offer-exchange-factory.js +48 -0
- package/src/entities/exchanges/index.js +23 -0
- package/src/entities/exchanges/orchestrators/build-exchange-request-deep-link.js +50 -0
- package/src/entities/exchanges/orchestrators/index.js +19 -0
- package/src/entities/exchanges/repos/exchange-repo-projections.js +45 -0
- package/src/entities/exchanges/repos/exchange-state-repo-extension.js +76 -0
- package/src/entities/exchanges/repos/index.js +20 -0
- package/src/entities/exchanges/repos/repo.js +44 -0
- package/src/entities/feeds/factories/feed-factory.js +47 -0
- package/src/entities/feeds/factories/index.js +19 -0
- package/src/entities/feeds/index.js +20 -0
- package/src/entities/feeds/repos/index.js +19 -0
- package/src/entities/feeds/repos/repo.js +95 -0
- package/src/entities/groups/domains/format-group.js +11 -0
- package/src/entities/groups/domains/index.js +3 -0
- package/src/entities/groups/factories/group-factory.js +40 -0
- package/src/entities/groups/factories/index.js +19 -0
- package/src/entities/groups/index.js +22 -0
- package/src/entities/groups/orchestrators/find-group-or-error.js +16 -0
- package/src/entities/groups/orchestrators/index.js +6 -0
- package/src/entities/groups/orchestrators/validate-did.js +24 -0
- package/src/entities/groups/orchestrators/validate-group-by-user.js +16 -0
- package/src/entities/groups/orchestrators/validate-group.js +39 -0
- package/src/entities/groups/repos/delete-tenant-extension.js +13 -0
- package/src/entities/groups/repos/index.js +19 -0
- package/src/entities/groups/repos/repo.js +38 -0
- package/src/entities/groups/repos/update-or-error-extension.js +46 -0
- package/src/entities/index.js +37 -0
- package/src/entities/keys/domains/constants.js +37 -0
- package/src/entities/keys/domains/index.js +21 -0
- package/src/entities/keys/domains/is-matching-private-key-kid.js +41 -0
- package/src/entities/keys/domains/validate-key.js +62 -0
- package/src/entities/keys/factories/index.js +19 -0
- package/src/entities/keys/factories/key-factory.js +56 -0
- package/src/entities/keys/index.js +22 -0
- package/src/entities/keys/orchestrators/index.js +3 -0
- package/src/entities/keys/orchestrators/validate-did-doc-keys.js +69 -0
- package/src/entities/metadata-list-allocations/index.js +19 -0
- package/src/entities/metadata-list-allocations/repos/index.js +19 -0
- package/src/entities/metadata-list-allocations/repos/repo.js +40 -0
- package/src/entities/notifications/domains/index.js +19 -0
- package/src/entities/notifications/domains/notification-types.js +25 -0
- package/src/entities/notifications/index.js +19 -0
- package/src/entities/offers/domains/build-clean-pii-filter.js +35 -0
- package/src/entities/offers/domains/build-deeplink-url.js +120 -0
- package/src/entities/offers/domains/build-offer.js +88 -0
- package/src/entities/offers/domains/build-qr-code-url.js +37 -0
- package/src/entities/offers/domains/constants.js +32 -0
- package/src/entities/offers/domains/filter-object-ids.js +34 -0
- package/src/entities/offers/domains/generate-issuing-challenge.js +26 -0
- package/src/entities/offers/domains/generate-link-code.js +35 -0
- package/src/entities/offers/domains/index.js +31 -0
- package/src/entities/offers/domains/post-validation-offers-handler.js +31 -0
- package/src/entities/offers/domains/prepare-linked-credentials-for-holder.js +36 -0
- package/src/entities/offers/domains/resolve-subject.js +142 -0
- package/src/entities/offers/domains/validate-offer-commercial-entity.js +24 -0
- package/src/entities/offers/domains/validate-offer.js +90 -0
- package/src/entities/offers/factories/index.js +19 -0
- package/src/entities/offers/factories/offer-factory.js +119 -0
- package/src/entities/offers/index.js +22 -0
- package/src/entities/offers/orchestrators/create-verifiable-credentials.js +131 -0
- package/src/entities/offers/orchestrators/finalize-exchange.js +44 -0
- package/src/entities/offers/orchestrators/index.js +23 -0
- package/src/entities/offers/orchestrators/load-credential-refs.js +57 -0
- package/src/entities/offers/orchestrators/load-credential-types-map.js +44 -0
- package/src/entities/offers/orchestrators/prepare-offers.js +35 -0
- package/src/entities/offers/orchestrators/trigger-issued-credentials-webhook.js +63 -0
- package/src/entities/offers/repos/clean-pii-extension.js +85 -0
- package/src/entities/offers/repos/index.js +20 -0
- package/src/entities/offers/repos/issued-credential-projection.js +44 -0
- package/src/entities/offers/repos/repo.js +177 -0
- package/src/entities/presentations/domains/build-identity-doc.js +120 -0
- package/src/entities/presentations/domains/build-request-response-schema.js +46 -0
- package/src/entities/presentations/domains/build-vendor-data.js +31 -0
- package/src/entities/presentations/domains/check-payment-requirement.js +30 -0
- package/src/entities/presentations/domains/errors.js +28 -0
- package/src/entities/presentations/domains/extract-fields-from-id-credential.js +35 -0
- package/src/entities/presentations/domains/index.js +26 -0
- package/src/entities/presentations/domains/merge-credential-check-results.js +24 -0
- package/src/entities/presentations/domains/validate-presentation.js +128 -0
- package/src/entities/presentations/index.js +20 -0
- package/src/entities/presentations/orchestrators/create-presentation-request.js +148 -0
- package/src/entities/presentations/orchestrators/deduplicate-disclosure-exchange.js +52 -0
- package/src/entities/presentations/orchestrators/handle-presentation-submission.js +47 -0
- package/src/entities/presentations/orchestrators/index.js +20 -0
- package/src/entities/presentations/orchestrators/match-identity-on-exchange.js +114 -0
- package/src/entities/presentations/orchestrators/share-identification-credentials.js +110 -0
- package/src/entities/presentations/orchestrators/share-presentation.js +234 -0
- package/src/entities/push-delegate/get-push-delegate.js +37 -0
- package/src/entities/push-delegate/index.js +17 -0
- package/src/entities/redirect/index.js +3 -0
- package/src/entities/redirect/orchestrators/index.js +3 -0
- package/src/entities/redirect/orchestrators/load-org-info.js +40 -0
- package/src/entities/revocation-list-allocations/index.js +19 -0
- package/src/entities/revocation-list-allocations/repos/index.js +19 -0
- package/src/entities/revocation-list-allocations/repos/repo.js +40 -0
- package/src/entities/schemas/index.js +19 -0
- package/src/entities/schemas/orchestrators/index.js +19 -0
- package/src/entities/schemas/orchestrators/load-schema-validation.js +73 -0
- package/src/entities/tenants/domains/build-service-ids.js +27 -0
- package/src/entities/tenants/domains/extract-service.js +27 -0
- package/src/entities/tenants/domains/index.js +21 -0
- package/src/entities/tenants/domains/validate-service-ids.js +35 -0
- package/src/entities/tenants/factories/index.js +19 -0
- package/src/entities/tenants/factories/tenant-factory.js +37 -0
- package/src/entities/tenants/index.js +22 -0
- package/src/entities/tenants/orchestrators/add-primary-address-to-tenant.js +47 -0
- package/src/entities/tenants/orchestrators/create-tenant.js +91 -0
- package/src/entities/tenants/orchestrators/index.js +22 -0
- package/src/entities/tenants/orchestrators/refresh-tenant-dids.js +146 -0
- package/src/entities/tenants/orchestrators/set-tenant-default-issuing-disclosure.js +31 -0
- package/src/entities/tenants/repos/index.js +20 -0
- package/src/entities/tenants/repos/insert-tenant-extension.js +33 -0
- package/src/entities/tenants/repos/repo.js +52 -0
- package/src/entities/tenants/repos/tenant-default-projection.js +33 -0
- package/src/entities/tokens/adapters/access-token.js +49 -0
- package/src/entities/tokens/adapters/index.js +19 -0
- package/src/entities/tokens/index.js +19 -0
- package/src/entities/users/factories/index.js +19 -0
- package/src/entities/users/factories/user-factory.js +36 -0
- package/src/entities/users/index.js +20 -0
- package/src/entities/users/repos/add-anonymous-user-repo-extension.js +23 -0
- package/src/entities/users/repos/find-or-insert-vendor-user-repo-extension.js +30 -0
- package/src/entities/users/repos/index.js +19 -0
- package/src/entities/users/repos/repo.js +50 -0
- package/src/fetchers/index.js +20 -0
- package/src/fetchers/operator/identify-fetcher.js +36 -0
- package/src/fetchers/operator/index.js +21 -0
- package/src/fetchers/operator/inspection-fetcher.js +35 -0
- package/src/fetchers/operator/issuing-fetcher.js +50 -0
- package/src/fetchers/operator/webhook-auth-header.js +45 -0
- package/src/fetchers/push-gateway/generate-push-gateway-token.js +40 -0
- package/src/fetchers/push-gateway/index.js +19 -0
- package/src/fetchers/push-gateway/push-fetcher.js +39 -0
- package/src/index.js +19 -0
- package/src/init-holder-server.js +108 -0
- package/src/init-operator-server.js +101 -0
- package/src/init-server.js +120 -0
- package/src/main-holder.js +18 -0
- package/src/main-operator.js +19 -0
- package/src/main.js +18 -0
- package/src/plugins/autoload-repos.js +28 -0
- package/src/plugins/disclosure-loader-plugin.js +56 -0
- package/src/plugins/ensure-disclosure-active-plugin.js +30 -0
- package/src/plugins/ensure-disclosure-configuration-type-plugin.js +29 -0
- package/src/plugins/ensure-tenant-default-issuing-disclosure-id-plugin.js +60 -0
- package/src/plugins/ensure-tenant-primary-address-plugin.js +44 -0
- package/src/plugins/exchange-error-handler-plugin.js +51 -0
- package/src/plugins/exchange-loader-plugin.js +50 -0
- package/src/plugins/group-loader-plugin.js +51 -0
- package/src/plugins/index.js +32 -0
- package/src/plugins/kms-plugin.js +57 -0
- package/src/plugins/tenant-loader-plugin.js +91 -0
- package/src/plugins/validate-cao-plugin.js +81 -0
- package/src/plugins/vendor-routes-auth-plugin.js +24 -0
- package/src/plugins/verify-access-token-plugin.js +88 -0
- package/src/standalone.js +24 -0
- package/src/start-app-server.js +38 -0
- package/test/combined/app-redirect.test.js +199 -0
- package/test/combined/helpers/credentialagent-build-fastify.js +29 -0
- package/test/combined/helpers/index.js +22 -0
- package/test/combined/helpers/nock-registrar-app-schema-name.js +50 -0
- package/test/combined/helpers/nock-registrar-get-organization-diddoc.js +26 -0
- package/test/combined/helpers/nock-registrar-get-organization-verified-profile.js +33 -0
- package/test/combined/manifest.json.test.js +55 -0
- package/test/combined/root-controller.test.js +42 -0
- package/test/combined/schemas/education-degree.schema.json +166 -0
- package/test/combined/schemas/employment-current-v1.1.schema.json +253 -0
- package/test/combined/schemas/open-badge-credential.schema.json +1285 -0
- package/test/combined/schemas/past-employment-position-with-uri-id.schema.js +22 -0
- package/test/combined/schemas/past-employment-position.schema.json +148 -0
- package/test/combined/schemas/will-always-validate.json +10 -0
- package/test/combined/validate-cao-plugin.test.js +155 -0
- package/test/get-push-delegate.test.js +54 -0
- package/test/helpers/jwt-vc-expectation.js +109 -0
- package/test/holder/build-request-response-schema.test.js +55 -0
- package/test/holder/credential-manifest-controller.test.js +3192 -0
- package/test/holder/e2e-issuing-controller.test.js +425 -0
- package/test/holder/get-exchange-progress-controller.test.js +521 -0
- package/test/holder/get-presentation-request.test.js +906 -0
- package/test/holder/helpers/credential-type-metadata.js +98 -0
- package/test/holder/helpers/credentialagent-holder-build-fastify.js +32 -0
- package/test/holder/helpers/generate-presentation.js +441 -0
- package/test/holder/helpers/generate-test-access-token.js +54 -0
- package/test/holder/helpers/jwt-access-token-expectation.js +32 -0
- package/test/holder/helpers/jwt-vc-expectation.js +115 -0
- package/test/holder/issuing-controller.test.js +7076 -0
- package/test/holder/oauth-token-controller.test.js +412 -0
- package/test/holder/presentation-submission.test.js +2365 -0
- package/test/holder/submit-identification.test.js +4815 -0
- package/test/operator/check-credentials-controller-v0.8.test.js +832 -0
- package/test/operator/credentials-revoke.test.js +536 -0
- package/test/operator/disclosures-controller-v0.8.test.js +4157 -0
- package/test/operator/exchanges-controller-v0.8.test.js +414 -0
- package/test/operator/exchanges-id-controller-v0.8.test.js +162 -0
- package/test/operator/feeds-controller-v0.8.test.js +659 -0
- package/test/operator/generate-push-gateway-token.test.js +116 -0
- package/test/operator/groups-controller.test.js +145 -0
- package/test/operator/groups-id-controller.test.js +287 -0
- package/test/operator/helpers/create-test-org-doc.js +60 -0
- package/test/operator/helpers/credentialagent-operator-build-fastify.js +32 -0
- package/test/operator/helpers/find-kms-key.js +31 -0
- package/test/operator/helpers/generate-primary-and-add-operator-to-primary.js +63 -0
- package/test/operator/helpers/init-agent-kms.js +22 -0
- package/test/operator/issued-credentials-controller-v0.8.test.js +398 -0
- package/test/operator/keys-controller-v0.8.test.js +1130 -0
- package/test/operator/offer-data-controller-v0.8.test.js +253 -0
- package/test/operator/offers-controller-v0.8.test.js +3026 -0
- package/test/operator/set-configuration-type-modifier.test.js +75 -0
- package/test/operator/swagger.test.js +37 -0
- package/test/operator/tenant-controller-v0.8.test.js +730 -0
- package/test/operator/tenant-loader-plugin.test.js +96 -0
- package/test/operator/tenants-controller-v0.8.test.js +2093 -0
- package/test/operator/users-controller-v0.8.test.js +137 -0
- package/test/operator/vc-api-credentials.test.js +963 -0
- package/verification.env +28 -0
|
@@ -0,0 +1,624 @@
|
|
|
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 console = require('console');
|
|
18
|
+
const { MongoClient } = require('mongodb');
|
|
19
|
+
const { nanoid } = require('nanoid');
|
|
20
|
+
const { addYears } = require('date-fns');
|
|
21
|
+
const { filter, first, /* map, */ omit, replace } = require('lodash/fp');
|
|
22
|
+
const { KeyPurposes /* generateKeyPair */ } = require('@verii/crypto');
|
|
23
|
+
const {
|
|
24
|
+
// applyOverrides,
|
|
25
|
+
formatAsDate,
|
|
26
|
+
} = require('@verii/common-functions');
|
|
27
|
+
const {
|
|
28
|
+
DID_FORMAT,
|
|
29
|
+
OBJECT_ID_FORMAT,
|
|
30
|
+
ISO_DATETIME_FORMAT,
|
|
31
|
+
} = require('@verii/test-regexes');
|
|
32
|
+
const { ServiceTypes } = require('@verii/organizations-registry');
|
|
33
|
+
// const {
|
|
34
|
+
// jwtDecode,
|
|
35
|
+
// jwtVerify,
|
|
36
|
+
// generateDocJwt,
|
|
37
|
+
// generatePresentationJwt,
|
|
38
|
+
// toJwk,
|
|
39
|
+
// jwtSign,
|
|
40
|
+
// } = require('@verii/jwt');
|
|
41
|
+
// const { getDidUriFromJwk } = require('@verii/did-doc');
|
|
42
|
+
// const { hashOffer } = require('@verii/velocity-issuing');
|
|
43
|
+
// const { CheckResults } = require('@verii/vc-checks');
|
|
44
|
+
|
|
45
|
+
const { addMonths } = require('date-fns/fp');
|
|
46
|
+
const { initVerificationCoupon } = require('@verii/metadata-registration');
|
|
47
|
+
const { initProvider } = require('@verii/base-contract-io');
|
|
48
|
+
const dotenv = require('dotenv');
|
|
49
|
+
const path = require('path');
|
|
50
|
+
const { toHexString } = require('@verii/blockchain-functions');
|
|
51
|
+
const { Authorities } = require('@verii/endpoints-organizations-registrar');
|
|
52
|
+
// const {
|
|
53
|
+
// sampleEducationDegreeGraduation,
|
|
54
|
+
// } = require('@verii/sample-data');
|
|
55
|
+
// const { jwtVcExpectation } = require('../test/helpers/jwt-vc-expectation');
|
|
56
|
+
const { VendorEndpoint, ConfigurationType } = require('../src/entities');
|
|
57
|
+
|
|
58
|
+
const registrarUrl = 'https://localhost:13004';
|
|
59
|
+
const fineractUrl = 'http://localhost:13008';
|
|
60
|
+
const caUrl = 'http://localhost:13012';
|
|
61
|
+
const rpcUrl = 'http://localhost:18545';
|
|
62
|
+
const mockvendorUrl = 'http://localhost:13013';
|
|
63
|
+
|
|
64
|
+
const authenticate = () => 'TOKEN';
|
|
65
|
+
const rpcProvider = initProvider(rpcUrl, authenticate);
|
|
66
|
+
const e2eEnv = {};
|
|
67
|
+
dotenv.config({
|
|
68
|
+
path: path.resolve(
|
|
69
|
+
__dirname,
|
|
70
|
+
'..',
|
|
71
|
+
'..',
|
|
72
|
+
'..',
|
|
73
|
+
'samples',
|
|
74
|
+
'sample-registrar-server',
|
|
75
|
+
'.localdev.env'
|
|
76
|
+
),
|
|
77
|
+
processEnv: e2eEnv,
|
|
78
|
+
});
|
|
79
|
+
console.dir(e2eEnv);
|
|
80
|
+
|
|
81
|
+
const OPERATOR_API_TOKEN =
|
|
82
|
+
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoidmVsb2NpdHkuYWRtaW5AZXhhbXBsZS5jb20ifQ.kmp4qjkgnVOX3eXdgNdUwYKDZ7NgEfH5qMM-7k1D1c8';
|
|
83
|
+
// const EDUCATION_DEGREE_CREDENTIAL_TYPE = 'EducationDegreeGraduationV1.1';
|
|
84
|
+
|
|
85
|
+
describe('org registration and issuing e2e', () => {
|
|
86
|
+
let client;
|
|
87
|
+
|
|
88
|
+
// let holderKeyPair;
|
|
89
|
+
// let holderDid;
|
|
90
|
+
|
|
91
|
+
afterAll(async () => {
|
|
92
|
+
await client.close();
|
|
93
|
+
});
|
|
94
|
+
beforeAll(async () => {
|
|
95
|
+
client = await MongoClient.connect('mongodb://localhost:17017');
|
|
96
|
+
|
|
97
|
+
// Generate holder DID and key pair for fake wallet
|
|
98
|
+
// holderKeyPair = generateKeyPair({ format: 'jwk' });
|
|
99
|
+
// holderDid = getDidUriFromJwk(holderKeyPair.publicKey);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('register org, create tenant, preauth service, depot & credential and have holder claim it and finally verify a presentation', async () => {
|
|
103
|
+
const profilePayload = {
|
|
104
|
+
name: `ACME Corp: ${nanoid(6)}`,
|
|
105
|
+
logo: 'http://www.acmecorp.com/corporate-logo.png',
|
|
106
|
+
contactEmail: 'contact@acmecorp.com',
|
|
107
|
+
technicalEmail: 'contact@acmecorp.com',
|
|
108
|
+
commercialEntities: [
|
|
109
|
+
{
|
|
110
|
+
type: 'Brand',
|
|
111
|
+
name: 'BETA Max',
|
|
112
|
+
logo: 'https://www.acmecorp.com/betamax-logo.png',
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
website: 'https://www.credentialagent.com',
|
|
116
|
+
registrationNumbers: [
|
|
117
|
+
{
|
|
118
|
+
authority: Authorities.DunnAndBradstreet,
|
|
119
|
+
number: '123457779',
|
|
120
|
+
uri: 'https://uri.com',
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
location: {
|
|
124
|
+
countryCode: 'US',
|
|
125
|
+
regionCode: 'US-IL',
|
|
126
|
+
},
|
|
127
|
+
type: 'company',
|
|
128
|
+
founded: '2020-01-01',
|
|
129
|
+
description: 'Short description',
|
|
130
|
+
linkedInProfile: 'https://www.linkedin.com/in/test-profile',
|
|
131
|
+
physicalAddress: {
|
|
132
|
+
line1: '123 Main St',
|
|
133
|
+
line2: 'Suite 123',
|
|
134
|
+
line3: 'New York',
|
|
135
|
+
},
|
|
136
|
+
adminGivenName: 'Admin Given Name',
|
|
137
|
+
adminFamilyName: 'Admin Family Name',
|
|
138
|
+
adminTitle: 'Admin Title',
|
|
139
|
+
adminEmail: 'admin@email.com',
|
|
140
|
+
signatoryGivenName: 'Signatory Given Name',
|
|
141
|
+
signatoryFamilyName: 'Signatory Family Name',
|
|
142
|
+
signatoryTitle: 'Signatory Title',
|
|
143
|
+
signatoryEmail: 'signatory@email.com',
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const serviceEndpoints = [
|
|
147
|
+
{
|
|
148
|
+
id: '#cao1',
|
|
149
|
+
type: ServiceTypes.CredentialAgentOperatorType,
|
|
150
|
+
serviceEndpoint: replace('http', 'https', caUrl),
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: '#issuer1',
|
|
154
|
+
type: ServiceTypes.CareerIssuerType,
|
|
155
|
+
serviceEndpoint: replace('http', 'https', caUrl),
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: '#rp1',
|
|
159
|
+
type: ServiceTypes.InspectionType,
|
|
160
|
+
serviceEndpoint: replace('http', 'https', caUrl),
|
|
161
|
+
},
|
|
162
|
+
];
|
|
163
|
+
|
|
164
|
+
const authResponse = await fetch('http://localhost:13000/oauth/token', {
|
|
165
|
+
method: 'POST',
|
|
166
|
+
body: JSON.stringify({
|
|
167
|
+
client_id: 'client_id',
|
|
168
|
+
client_secret: 'client_secret',
|
|
169
|
+
audience: 'testAudience',
|
|
170
|
+
grant_type: 'client_credentials',
|
|
171
|
+
}),
|
|
172
|
+
headers: {
|
|
173
|
+
'Content-Type': 'application/json',
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
const authJson = await authResponse.json();
|
|
177
|
+
|
|
178
|
+
const createFullOrganizationResponse = await fetch(
|
|
179
|
+
`${registrarUrl}/api/v0.6/organizations/full`,
|
|
180
|
+
{
|
|
181
|
+
method: 'POST',
|
|
182
|
+
body: JSON.stringify({
|
|
183
|
+
profile: profilePayload,
|
|
184
|
+
serviceEndpoints,
|
|
185
|
+
}),
|
|
186
|
+
headers: {
|
|
187
|
+
'x-auto-activate': '1',
|
|
188
|
+
'Content-Type': 'application/json',
|
|
189
|
+
Authorization: `Bearer ${authJson.access_token}`,
|
|
190
|
+
},
|
|
191
|
+
}
|
|
192
|
+
).then((r) => r.json());
|
|
193
|
+
|
|
194
|
+
// json response checks
|
|
195
|
+
expect(createFullOrganizationResponse.id).toMatch(DID_FORMAT);
|
|
196
|
+
const { id: did, /* ids, profile, */ keys } =
|
|
197
|
+
createFullOrganizationResponse;
|
|
198
|
+
console.dir({ msg: 'Organization registered', did });
|
|
199
|
+
|
|
200
|
+
const fineractAuthResponse = await fetch(
|
|
201
|
+
'http://localhost:13000/oauth/token',
|
|
202
|
+
{
|
|
203
|
+
method: 'POST',
|
|
204
|
+
body: JSON.stringify({
|
|
205
|
+
client_id: 'client_id',
|
|
206
|
+
client_secret: 'client_secret',
|
|
207
|
+
audience: 'https://fineract.velocitycareerlabs.io',
|
|
208
|
+
grant_type: 'client_credentials',
|
|
209
|
+
}),
|
|
210
|
+
headers: {
|
|
211
|
+
'Content-Type': 'application/json',
|
|
212
|
+
},
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
const quantity = 100;
|
|
216
|
+
const expiry = addMonths(3, new Date());
|
|
217
|
+
const fineractAuthJson = await fineractAuthResponse.json();
|
|
218
|
+
const mint = await initMintBundle();
|
|
219
|
+
const { bundleId } = await mint({
|
|
220
|
+
toAddress: createFullOrganizationResponse.ids.ethereumAccount,
|
|
221
|
+
expirationTime: expiry,
|
|
222
|
+
quantity,
|
|
223
|
+
ownerDid: createFullOrganizationResponse.ids.did,
|
|
224
|
+
});
|
|
225
|
+
const createVoucherResponse = await fetch(
|
|
226
|
+
`${fineractUrl}/fineract-provider/api/v1/datatables/Voucher/${createFullOrganizationResponse.ids.fineractClientId}?genericResultSet=true`,
|
|
227
|
+
{
|
|
228
|
+
method: 'POST',
|
|
229
|
+
body: JSON.stringify({
|
|
230
|
+
couponBundleId: toHexString(bundleId),
|
|
231
|
+
symbol: 'VVO',
|
|
232
|
+
quantity: `${quantity}`,
|
|
233
|
+
used: '0',
|
|
234
|
+
locale: 'en',
|
|
235
|
+
dateFormat: 'yyyy-MM-dd',
|
|
236
|
+
expiry: formatAsDate(expiry),
|
|
237
|
+
}),
|
|
238
|
+
headers: {
|
|
239
|
+
'Content-Type': 'application/json',
|
|
240
|
+
Authorization: `Bearer ${fineractAuthJson.access_token}`,
|
|
241
|
+
'fineract-platform-tenantid': 'default',
|
|
242
|
+
},
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
expect(createVoucherResponse.status).toEqual(200);
|
|
246
|
+
await expect(createVoucherResponse.json()).resolves.toEqual({
|
|
247
|
+
clientId: parseInt(
|
|
248
|
+
createFullOrganizationResponse.ids.fineractClientId,
|
|
249
|
+
10
|
|
250
|
+
),
|
|
251
|
+
officeId: 1,
|
|
252
|
+
resourceId: expect.any(Number),
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
const balanceQuery2Response = await fetch(
|
|
256
|
+
`${fineractUrl}/fineract-provider/api/v1/vouchers/${createFullOrganizationResponse.ids.fineractClientId}/balance`,
|
|
257
|
+
{
|
|
258
|
+
method: 'GET',
|
|
259
|
+
headers: {
|
|
260
|
+
'Content-Type': 'application/json',
|
|
261
|
+
Authorization: `Bearer ${fineractAuthJson.access_token}`,
|
|
262
|
+
'fineract-platform-tenantid': 'default',
|
|
263
|
+
},
|
|
264
|
+
}
|
|
265
|
+
);
|
|
266
|
+
await expect(balanceQuery2Response.json()).resolves.toEqual({
|
|
267
|
+
balance: 100,
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// Tenant Creation
|
|
271
|
+
const createTenantPayload = {
|
|
272
|
+
did,
|
|
273
|
+
serviceIds: serviceEndpoints.map(({ id }) => `${did}${id}`),
|
|
274
|
+
keys: filter(
|
|
275
|
+
({ purposes }) =>
|
|
276
|
+
[
|
|
277
|
+
KeyPurposes.DLT_TRANSACTIONS,
|
|
278
|
+
KeyPurposes.EXCHANGES,
|
|
279
|
+
KeyPurposes.ISSUING_METADATA,
|
|
280
|
+
].includes(first(purposes)),
|
|
281
|
+
keys
|
|
282
|
+
),
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
// Create tenant
|
|
286
|
+
|
|
287
|
+
const createTenantResponse = await fetch(
|
|
288
|
+
`${caUrl}/operator-api/v0.8/tenants`,
|
|
289
|
+
{
|
|
290
|
+
method: 'POST',
|
|
291
|
+
body: JSON.stringify(createTenantPayload),
|
|
292
|
+
headers: {
|
|
293
|
+
'Content-Type': 'application/json',
|
|
294
|
+
Authorization: `Bearer ${OPERATOR_API_TOKEN}`,
|
|
295
|
+
},
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
expect(createTenantResponse.status).toEqual(201);
|
|
299
|
+
const createTenantJson = await createTenantResponse.json();
|
|
300
|
+
expect(createTenantJson).toEqual({
|
|
301
|
+
id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
302
|
+
createdAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
// Create mockvendor user
|
|
306
|
+
const user = {
|
|
307
|
+
firstName: 'Adam',
|
|
308
|
+
lastName: 'Smith',
|
|
309
|
+
emails: ['adam.smith@example.com'],
|
|
310
|
+
phones: ['+44 7963587331'],
|
|
311
|
+
address: {
|
|
312
|
+
line1: 'Sunburst Lane 1',
|
|
313
|
+
line2: 'Phoenix',
|
|
314
|
+
countryCode: 'US',
|
|
315
|
+
regionCode: 'AZ',
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
const createUserResponse = await fetch(`${mockvendorUrl}/api/users`, {
|
|
320
|
+
method: 'POST',
|
|
321
|
+
headers: {
|
|
322
|
+
'Content-Type': 'application/json',
|
|
323
|
+
},
|
|
324
|
+
body: JSON.stringify(user),
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
expect(createUserResponse.status).toEqual(200);
|
|
328
|
+
const createUserJson = await createUserResponse.json();
|
|
329
|
+
expect(createUserJson).toEqual({
|
|
330
|
+
...user,
|
|
331
|
+
id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
332
|
+
_id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
333
|
+
updatedAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
334
|
+
createdAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
// Create mockvendor offer
|
|
338
|
+
const offer = {
|
|
339
|
+
type: ['Course'],
|
|
340
|
+
issuer: {
|
|
341
|
+
id: 'did:ion:B1a3e076-8d23-4bcb-a066-6f90e161cf23',
|
|
342
|
+
},
|
|
343
|
+
credentialSubject: {
|
|
344
|
+
vendorUserId: 'adam.smith@example.com',
|
|
345
|
+
title: {
|
|
346
|
+
localized: {
|
|
347
|
+
en: 'Azure Basics',
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
description: {
|
|
351
|
+
localized: {
|
|
352
|
+
en: 'Introduction to Microsoft Azure Cloud Services',
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
contentProvider:
|
|
356
|
+
'did:velocity:0xd4df29726d500f9b85bc6c7f1b3c021f16305692',
|
|
357
|
+
contentProviderName: {
|
|
358
|
+
localized: {
|
|
359
|
+
en: 'Microsoft Corporation',
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
type: 'Specialty Training',
|
|
363
|
+
duration: '24h',
|
|
364
|
+
score: 90.0,
|
|
365
|
+
scoreRange: '78',
|
|
366
|
+
registrationDate: {
|
|
367
|
+
day: 15.0,
|
|
368
|
+
month: 3.0,
|
|
369
|
+
year: 2019.0,
|
|
370
|
+
},
|
|
371
|
+
startDate: {
|
|
372
|
+
day: 1.0,
|
|
373
|
+
month: 4.0,
|
|
374
|
+
year: 2019.0,
|
|
375
|
+
},
|
|
376
|
+
completionDate: {
|
|
377
|
+
day: 1.0,
|
|
378
|
+
month: 5.0,
|
|
379
|
+
year: 2019.0,
|
|
380
|
+
},
|
|
381
|
+
alignment: [
|
|
382
|
+
{
|
|
383
|
+
targetName: 'Microsoft top secret course',
|
|
384
|
+
targetUrl: 'https://www.microsoft.com',
|
|
385
|
+
targetDescription: 'Test Description Data',
|
|
386
|
+
},
|
|
387
|
+
],
|
|
388
|
+
},
|
|
389
|
+
offerId: '5539e308-6f2f-4d01-b946-5ca4ba7fee20',
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
const createOfferResponse = await fetch(`${mockvendorUrl}/api/offers`, {
|
|
393
|
+
method: 'POST',
|
|
394
|
+
headers: {
|
|
395
|
+
'Content-Type': 'application/json',
|
|
396
|
+
},
|
|
397
|
+
body: JSON.stringify(offer),
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
expect(createOfferResponse.status).toEqual(200);
|
|
401
|
+
const createOfferJson = await createOfferResponse.json();
|
|
402
|
+
expect(first(createOfferJson)).toEqual({
|
|
403
|
+
...expectedOffer(offer),
|
|
404
|
+
id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
405
|
+
_id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
406
|
+
createdAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
407
|
+
updatedAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
// Create disclosure
|
|
411
|
+
const disclosure = {
|
|
412
|
+
vendorDisclosureId: 'HR-PKG-USPS-CLRK',
|
|
413
|
+
purpose: 'Job Application',
|
|
414
|
+
description: 'Clerk',
|
|
415
|
+
duration: '6y',
|
|
416
|
+
sendPushOnVerification: false,
|
|
417
|
+
deactivationDate: addYears(new Date(), 10),
|
|
418
|
+
authTokensExpireIn: 10080,
|
|
419
|
+
types: [
|
|
420
|
+
{ type: 'PastEmploymentPosition' },
|
|
421
|
+
{ type: 'CurrentEmploymentPosition' },
|
|
422
|
+
],
|
|
423
|
+
identificationMethods: ['preauth'],
|
|
424
|
+
configurationType: ConfigurationType.ISSUING,
|
|
425
|
+
vendorEndpoint: VendorEndpoint.ISSUING_IDENTIFICATION,
|
|
426
|
+
offerMode: 'webhook',
|
|
427
|
+
termsUrl:
|
|
428
|
+
'https://www.velocityexperiencecenter.com/terms-and-conditions-vnf',
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
const createDisclosureResponse = await fetch(
|
|
432
|
+
`${caUrl}/operator-api/v0.8/tenants/${createTenantJson.id}/disclosures`,
|
|
433
|
+
{
|
|
434
|
+
method: 'POST',
|
|
435
|
+
headers: {
|
|
436
|
+
'Content-Type': 'application/json',
|
|
437
|
+
authorization: `Bearer ${OPERATOR_API_TOKEN}`,
|
|
438
|
+
},
|
|
439
|
+
body: JSON.stringify(disclosure),
|
|
440
|
+
}
|
|
441
|
+
);
|
|
442
|
+
|
|
443
|
+
expect(createDisclosureResponse.status).toEqual(201);
|
|
444
|
+
const createDisclosureJson = await createDisclosureResponse.json();
|
|
445
|
+
expect(createDisclosureJson).toEqual({
|
|
446
|
+
...omit(['setIssuingDefault'])(disclosure),
|
|
447
|
+
deactivationDate: expect.any(String),
|
|
448
|
+
identificationMethods: ['preauth'],
|
|
449
|
+
sendPushOnVerification: false,
|
|
450
|
+
feed: false,
|
|
451
|
+
id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
452
|
+
createdAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
453
|
+
updatedAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
454
|
+
});
|
|
455
|
+
}, 30000);
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
const initMintBundle = async () => {
|
|
459
|
+
const { mint } = await initVerificationCoupon(
|
|
460
|
+
{
|
|
461
|
+
privateKey: e2eEnv.ROOT_PRIVATE_KEY,
|
|
462
|
+
contractAddress: e2eEnv.COUPON_CONTRACT_ADDRESS,
|
|
463
|
+
rpcProvider,
|
|
464
|
+
},
|
|
465
|
+
{ log: console, traceId: nanoid() }
|
|
466
|
+
);
|
|
467
|
+
|
|
468
|
+
return mint;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
const expectedOffer = (payload, overrides = {}) =>
|
|
472
|
+
omit(['_id', 'createdAt', 'exchangeId', 'updatedAt'], {
|
|
473
|
+
...payload,
|
|
474
|
+
...overrides,
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
// const expectedTenant = (tenant, primaryAccount) => ({
|
|
478
|
+
// id: tenant._id ?? expect.stringMatching(OBJECT_ID_FORMAT),
|
|
479
|
+
// createdAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
480
|
+
// updatedAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
481
|
+
// hostUrl: 'http://localhost:13002',
|
|
482
|
+
// primaryAccount,
|
|
483
|
+
// ...omit(['_id', 'primaryAccount'], tenant),
|
|
484
|
+
// });
|
|
485
|
+
|
|
486
|
+
// const expectedKeyMetadatas = map((key) => ({
|
|
487
|
+
// ...omit(['key', 'didDocumentKey'], key),
|
|
488
|
+
// id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
489
|
+
// createdAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
490
|
+
// encoding: 'jwk',
|
|
491
|
+
// }));
|
|
492
|
+
|
|
493
|
+
// const expectedEntity = (payload, overrides) =>
|
|
494
|
+
// applyOverrides(
|
|
495
|
+
// {
|
|
496
|
+
// ...payload,
|
|
497
|
+
// id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
498
|
+
// createdAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
499
|
+
// updatedAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
500
|
+
// },
|
|
501
|
+
// overrides
|
|
502
|
+
// );
|
|
503
|
+
|
|
504
|
+
// const expectedSearchParams = (tenant, service, depot, preauthCode) => {
|
|
505
|
+
// let searchParamsString = `request_uri=${encodeURIComponent(
|
|
506
|
+
// caUrl
|
|
507
|
+
// )}%2Fvn-api%2Fr%2F${encodeURIComponent(
|
|
508
|
+
// encodeURI(tenant.did)
|
|
509
|
+
// )}%2Fget-credential-manifest%3Fid%3D${encodeURIComponent(service.id)}`;
|
|
510
|
+
// searchParamsString += `&issuerDid=${encodeURIComponent(tenant.did)}`;
|
|
511
|
+
// if (preauthCode != null) {
|
|
512
|
+
// searchParamsString += `&vendorOriginContext=${encodeURIComponent(
|
|
513
|
+
// `depot:${depot.id}:${preauthCode}`
|
|
514
|
+
// )}`;
|
|
515
|
+
// }
|
|
516
|
+
// return searchParamsString;
|
|
517
|
+
// };
|
|
518
|
+
|
|
519
|
+
// const expectedCredentialManifest = (
|
|
520
|
+
// profile,
|
|
521
|
+
// tenant,
|
|
522
|
+
// issuerService,
|
|
523
|
+
// payload
|
|
524
|
+
// ) => ({
|
|
525
|
+
// exchange_id: expect.any(String),
|
|
526
|
+
// output_descriptors: map(() => expect.any(Object), payload?.credential_types),
|
|
527
|
+
// issuer: {
|
|
528
|
+
// id: tenant.did,
|
|
529
|
+
// },
|
|
530
|
+
// presentation_definition: {
|
|
531
|
+
// id: expect.any(String),
|
|
532
|
+
// format: {
|
|
533
|
+
// jwt_vp: { alg: ['secp256k1'] },
|
|
534
|
+
// },
|
|
535
|
+
// name: issuerService.description,
|
|
536
|
+
// purpose: issuerService.disclosureRequest?.purpose ?? '',
|
|
537
|
+
// input_descriptors: map(
|
|
538
|
+
// () => expect.any(Object),
|
|
539
|
+
// issuerService.disclosureRequest?.types
|
|
540
|
+
// ),
|
|
541
|
+
// submission_requirements:
|
|
542
|
+
// issuerService.disclosureRequest?.types != null
|
|
543
|
+
// ? [
|
|
544
|
+
// {
|
|
545
|
+
// from: 'A',
|
|
546
|
+
// min: 1,
|
|
547
|
+
// rule: 'all',
|
|
548
|
+
// },
|
|
549
|
+
// ]
|
|
550
|
+
// : [],
|
|
551
|
+
// ...issuerService.presentationDefinition,
|
|
552
|
+
// },
|
|
553
|
+
// metadata: {
|
|
554
|
+
// client_name: issuerService.commercialEntity?.name ?? profile.name,
|
|
555
|
+
// logo_uri: issuerService.commercialEntity?.logo ?? profile.logo,
|
|
556
|
+
// tos_uri: issuerService.termsUrl,
|
|
557
|
+
// max_retention_period:
|
|
558
|
+
// issuerService.disclosureRequest?.retentionPeriod ?? '',
|
|
559
|
+
// progress_uri: `${caUrl}${vnUrl(tenant)}/get-exchange-progress`,
|
|
560
|
+
// submit_presentation_uri: `${caUrl}${vnUrl(tenant)}/authenticate`,
|
|
561
|
+
// check_offers_uri: `${caUrl}${vnUrl(tenant)}/credential-offers`,
|
|
562
|
+
// finalize_offers_uri: `${caUrl}${vnUrl(tenant)}/issue-credentials`,
|
|
563
|
+
// },
|
|
564
|
+
// });
|
|
565
|
+
|
|
566
|
+
// const buildProof = async (
|
|
567
|
+
// url,
|
|
568
|
+
// didJwk,
|
|
569
|
+
// keyPair,
|
|
570
|
+
// challenge,
|
|
571
|
+
// { useKid = true, ...payloadOverrides } = {}
|
|
572
|
+
// ) => {
|
|
573
|
+
// const options = {
|
|
574
|
+
// jwk: keyPair.publicKey,
|
|
575
|
+
// alg: keyPair.publicKey.crv === 'P-256' ? 'ES256' : 'ES256K',
|
|
576
|
+
// };
|
|
577
|
+
// if (useKid) options.kid = `${didJwk}#0`;
|
|
578
|
+
// const jwt = await jwtSign(
|
|
579
|
+
// applyOverrides(
|
|
580
|
+
// {
|
|
581
|
+
// aud: url,
|
|
582
|
+
// nonce: challenge,
|
|
583
|
+
// iss: didJwk,
|
|
584
|
+
// },
|
|
585
|
+
// payloadOverrides
|
|
586
|
+
// ),
|
|
587
|
+
// keyPair.privateKey,
|
|
588
|
+
// options
|
|
589
|
+
// );
|
|
590
|
+
// return {
|
|
591
|
+
// proof_type: 'jwt',
|
|
592
|
+
// jwt,
|
|
593
|
+
// };
|
|
594
|
+
// };
|
|
595
|
+
|
|
596
|
+
// const vnUrl = ({ did }) => `/vn-api/r/${encodeURI(did)}`;
|
|
597
|
+
|
|
598
|
+
// const generatePreauthCodeAuthJwt = (
|
|
599
|
+
// depot,
|
|
600
|
+
// vendorOriginContext,
|
|
601
|
+
// holderDid,
|
|
602
|
+
// keyPair
|
|
603
|
+
// ) => {
|
|
604
|
+
// const didJwk = getDidUriFromJwk(keyPair.publicKey);
|
|
605
|
+
// const options = {
|
|
606
|
+
// issuer: didJwk,
|
|
607
|
+
// jti: nanoid(),
|
|
608
|
+
// kid: `${didJwk}#0`,
|
|
609
|
+
// };
|
|
610
|
+
// const payload = {
|
|
611
|
+
// id: nanoid(),
|
|
612
|
+
// issuer: holderDid,
|
|
613
|
+
// vp: {
|
|
614
|
+
// presentation_submission: {
|
|
615
|
+
// id: nanoid(),
|
|
616
|
+
// definition_id: nanoid(),
|
|
617
|
+
// },
|
|
618
|
+
// },
|
|
619
|
+
// };
|
|
620
|
+
// if (vendorOriginContext != null) {
|
|
621
|
+
// payload.vp.vendorOriginContext = vendorOriginContext;
|
|
622
|
+
// }
|
|
623
|
+
// return generateDocJwt(payload, keyPair.privateKey, options);
|
|
624
|
+
// };
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 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 jestConfig = require('../../jest.config.base');
|
|
18
|
+
const pack = require('./package.json');
|
|
19
|
+
|
|
20
|
+
module.exports = jestConfig(pack.name, { roots: ['src', 'test', 'e2e'] });
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 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 env = require('env-var');
|
|
18
|
+
|
|
19
|
+
const config = {
|
|
20
|
+
mongodb: {
|
|
21
|
+
url: env.get('MONGO_URI').required(true).asString(),
|
|
22
|
+
|
|
23
|
+
options: {
|
|
24
|
+
useNewUrlParser: true, // removes a deprecation warning when connecting
|
|
25
|
+
useUnifiedTopology: true, // removes a deprecating warning when connecting
|
|
26
|
+
// connectTimeoutMS: 3600000, // increase connection timeout to 1 hour
|
|
27
|
+
// socketTimeoutMS: 3600000, // increase socket timeout to 1 hour
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
migrationsDir: 'migrations',
|
|
32
|
+
changelogCollectionName: 'changelog',
|
|
33
|
+
migrationFileExtension: '.js',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
module.exports = config;
|