@cheqd/studio 3.0.0-develop.1
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 +190 -0
- package/README.md +246 -0
- package/dist/app.d.ts +4 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +180 -0
- package/dist/app.js.map +1 -0
- package/dist/controllers/admin/api-key.d.ts +153 -0
- package/dist/controllers/admin/api-key.d.ts.map +1 -0
- package/dist/controllers/admin/api-key.js +389 -0
- package/dist/controllers/admin/api-key.js.map +1 -0
- package/dist/controllers/admin/organisation.d.ts +72 -0
- package/dist/controllers/admin/organisation.d.ts.map +1 -0
- package/dist/controllers/admin/organisation.js +139 -0
- package/dist/controllers/admin/organisation.js.map +1 -0
- package/dist/controllers/admin/prices.d.ts +37 -0
- package/dist/controllers/admin/prices.d.ts.map +1 -0
- package/dist/controllers/admin/prices.js +75 -0
- package/dist/controllers/admin/prices.js.map +1 -0
- package/dist/controllers/admin/product.d.ts +90 -0
- package/dist/controllers/admin/product.d.ts.map +1 -0
- package/dist/controllers/admin/product.js +187 -0
- package/dist/controllers/admin/product.js.map +1 -0
- package/dist/controllers/admin/subscriptions.d.ts +183 -0
- package/dist/controllers/admin/subscriptions.d.ts.map +1 -0
- package/dist/controllers/admin/subscriptions.js +512 -0
- package/dist/controllers/admin/subscriptions.js.map +1 -0
- package/dist/controllers/admin/webhook.d.ts +5 -0
- package/dist/controllers/admin/webhook.d.ts.map +1 -0
- package/dist/controllers/admin/webhook.js +90 -0
- package/dist/controllers/admin/webhook.js.map +1 -0
- package/dist/controllers/api/account.d.ts +84 -0
- package/dist/controllers/api/account.d.ts.map +1 -0
- package/dist/controllers/api/account.js +442 -0
- package/dist/controllers/api/account.js.map +1 -0
- package/dist/controllers/api/credential-status.d.ts +257 -0
- package/dist/controllers/api/credential-status.d.ts.map +1 -0
- package/dist/controllers/api/credential-status.js +1080 -0
- package/dist/controllers/api/credential-status.js.map +1 -0
- package/dist/controllers/api/credential.d.ts +207 -0
- package/dist/controllers/api/credential.d.ts.map +1 -0
- package/dist/controllers/api/credential.js +527 -0
- package/dist/controllers/api/credential.js.map +1 -0
- package/dist/controllers/api/did.d.ts +259 -0
- package/dist/controllers/api/did.d.ts.map +1 -0
- package/dist/controllers/api/did.js +673 -0
- package/dist/controllers/api/did.js.map +1 -0
- package/dist/controllers/api/key.d.ts +136 -0
- package/dist/controllers/api/key.d.ts.map +1 -0
- package/dist/controllers/api/key.js +268 -0
- package/dist/controllers/api/key.js.map +1 -0
- package/dist/controllers/api/presentation.d.ts +87 -0
- package/dist/controllers/api/presentation.d.ts.map +1 -0
- package/dist/controllers/api/presentation.js +264 -0
- package/dist/controllers/api/presentation.js.map +1 -0
- package/dist/controllers/api/resource.d.ts +118 -0
- package/dist/controllers/api/resource.d.ts.map +1 -0
- package/dist/controllers/api/resource.js +312 -0
- package/dist/controllers/api/resource.js.map +1 -0
- package/dist/controllers/validator/controller.d.ts +7 -0
- package/dist/controllers/validator/controller.d.ts.map +1 -0
- package/dist/controllers/validator/controller.js +31 -0
- package/dist/controllers/validator/controller.js.map +1 -0
- package/dist/controllers/validator/credential-status.d.ts +6 -0
- package/dist/controllers/validator/credential-status.d.ts.map +1 -0
- package/dist/controllers/validator/credential-status.js +36 -0
- package/dist/controllers/validator/credential-status.js.map +1 -0
- package/dist/controllers/validator/credential.d.ts +9 -0
- package/dist/controllers/validator/credential.d.ts.map +1 -0
- package/dist/controllers/validator/credential.js +103 -0
- package/dist/controllers/validator/credential.js.map +1 -0
- package/dist/controllers/validator/decorator.d.ts +2 -0
- package/dist/controllers/validator/decorator.d.ts.map +1 -0
- package/dist/controllers/validator/decorator.js +25 -0
- package/dist/controllers/validator/decorator.js.map +1 -0
- package/dist/controllers/validator/did-also-known-as.d.ts +8 -0
- package/dist/controllers/validator/did-also-known-as.d.ts.map +1 -0
- package/dist/controllers/validator/did-also-known-as.js +31 -0
- package/dist/controllers/validator/did-also-known-as.js.map +1 -0
- package/dist/controllers/validator/did-array.d.ts +7 -0
- package/dist/controllers/validator/did-array.d.ts.map +1 -0
- package/dist/controllers/validator/did-array.js +27 -0
- package/dist/controllers/validator/did-array.js.map +1 -0
- package/dist/controllers/validator/did-document-section-id.d.ts +7 -0
- package/dist/controllers/validator/did-document-section-id.d.ts.map +1 -0
- package/dist/controllers/validator/did-document-section-id.js +43 -0
- package/dist/controllers/validator/did-document-section-id.js.map +1 -0
- package/dist/controllers/validator/did-document.d.ts +11 -0
- package/dist/controllers/validator/did-document.d.ts.map +1 -0
- package/dist/controllers/validator/did-document.js +96 -0
- package/dist/controllers/validator/did-document.js.map +1 -0
- package/dist/controllers/validator/did-uri.d.ts +5 -0
- package/dist/controllers/validator/did-uri.d.ts.map +1 -0
- package/dist/controllers/validator/did-uri.js +14 -0
- package/dist/controllers/validator/did-uri.js.map +1 -0
- package/dist/controllers/validator/did.d.ts +35 -0
- package/dist/controllers/validator/did.d.ts.map +1 -0
- package/dist/controllers/validator/did.js +233 -0
- package/dist/controllers/validator/did.js.map +1 -0
- package/dist/controllers/validator/helpers.d.ts +7 -0
- package/dist/controllers/validator/helpers.d.ts.map +1 -0
- package/dist/controllers/validator/helpers.js +6 -0
- package/dist/controllers/validator/helpers.js.map +1 -0
- package/dist/controllers/validator/identifier.d.ts +20 -0
- package/dist/controllers/validator/identifier.d.ts.map +1 -0
- package/dist/controllers/validator/identifier.js +100 -0
- package/dist/controllers/validator/identifier.js.map +1 -0
- package/dist/controllers/validator/index.d.ts +42 -0
- package/dist/controllers/validator/index.d.ts.map +1 -0
- package/dist/controllers/validator/index.js +90 -0
- package/dist/controllers/validator/index.js.map +1 -0
- package/dist/controllers/validator/jsonld-proof.d.ts +5 -0
- package/dist/controllers/validator/jsonld-proof.d.ts.map +1 -0
- package/dist/controllers/validator/jsonld-proof.js +50 -0
- package/dist/controllers/validator/jsonld-proof.js.map +1 -0
- package/dist/controllers/validator/jwt-proof.d.ts +5 -0
- package/dist/controllers/validator/jwt-proof.d.ts.map +1 -0
- package/dist/controllers/validator/jwt-proof.js +45 -0
- package/dist/controllers/validator/jwt-proof.js.map +1 -0
- package/dist/controllers/validator/presentation.d.ts +9 -0
- package/dist/controllers/validator/presentation.d.ts.map +1 -0
- package/dist/controllers/validator/presentation.js +96 -0
- package/dist/controllers/validator/presentation.js.map +1 -0
- package/dist/controllers/validator/resource-also-known-as.d.ts +7 -0
- package/dist/controllers/validator/resource-also-known-as.d.ts.map +1 -0
- package/dist/controllers/validator/resource-also-known-as.js +47 -0
- package/dist/controllers/validator/resource-also-known-as.js.map +1 -0
- package/dist/controllers/validator/service-create-request.d.ts +10 -0
- package/dist/controllers/validator/service-create-request.d.ts.map +1 -0
- package/dist/controllers/validator/service-create-request.js +63 -0
- package/dist/controllers/validator/service-create-request.js.map +1 -0
- package/dist/controllers/validator/service.d.ts +11 -0
- package/dist/controllers/validator/service.d.ts.map +1 -0
- package/dist/controllers/validator/service.js +76 -0
- package/dist/controllers/validator/service.js.map +1 -0
- package/dist/controllers/validator/utils.d.ts +3 -0
- package/dist/controllers/validator/utils.d.ts.map +1 -0
- package/dist/controllers/validator/utils.js +21 -0
- package/dist/controllers/validator/utils.js.map +1 -0
- package/dist/controllers/validator/validator.d.ts +20 -0
- package/dist/controllers/validator/validator.d.ts.map +1 -0
- package/dist/controllers/validator/validator.js +2 -0
- package/dist/controllers/validator/validator.js.map +1 -0
- package/dist/controllers/validator/verification-method.d.ts +30 -0
- package/dist/controllers/validator/verification-method.d.ts.map +1 -0
- package/dist/controllers/validator/verification-method.js +211 -0
- package/dist/controllers/validator/verification-method.js.map +1 -0
- package/dist/database/connection/connection.d.ts +9 -0
- package/dist/database/connection/connection.d.ts.map +1 -0
- package/dist/database/connection/connection.js +27 -0
- package/dist/database/connection/connection.js.map +1 -0
- package/dist/database/entities/api.key.entity.d.ts +18 -0
- package/dist/database/entities/api.key.entity.d.ts.map +1 -0
- package/dist/database/entities/api.key.entity.js +102 -0
- package/dist/database/entities/api.key.entity.js.map +1 -0
- package/dist/database/entities/coin.entity.d.ts +11 -0
- package/dist/database/entities/coin.entity.d.ts.map +1 -0
- package/dist/database/entities/coin.entity.js +66 -0
- package/dist/database/entities/coin.entity.js.map +1 -0
- package/dist/database/entities/customer.entity.d.ts +14 -0
- package/dist/database/entities/customer.entity.d.ts.map +1 -0
- package/dist/database/entities/customer.entity.js +87 -0
- package/dist/database/entities/customer.entity.js.map +1 -0
- package/dist/database/entities/identifier.entity.d.ts +7 -0
- package/dist/database/entities/identifier.entity.d.ts.map +1 -0
- package/dist/database/entities/identifier.entity.js +26 -0
- package/dist/database/entities/identifier.entity.js.map +1 -0
- package/dist/database/entities/key.entity.d.ts +13 -0
- package/dist/database/entities/key.entity.d.ts.map +1 -0
- package/dist/database/entities/key.entity.js +63 -0
- package/dist/database/entities/key.entity.js.map +1 -0
- package/dist/database/entities/operation.entity.d.ts +17 -0
- package/dist/database/entities/operation.entity.d.ts.map +1 -0
- package/dist/database/entities/operation.entity.js +98 -0
- package/dist/database/entities/operation.entity.js.map +1 -0
- package/dist/database/entities/payment.account.entity.d.ts +16 -0
- package/dist/database/entities/payment.account.entity.d.ts.map +1 -0
- package/dist/database/entities/payment.account.entity.js +86 -0
- package/dist/database/entities/payment.account.entity.js.map +1 -0
- package/dist/database/entities/payment.entity.d.ts +20 -0
- package/dist/database/entities/payment.entity.d.ts.map +1 -0
- package/dist/database/entities/payment.entity.js +103 -0
- package/dist/database/entities/payment.entity.js.map +1 -0
- package/dist/database/entities/resource.entity.d.ts +21 -0
- package/dist/database/entities/resource.entity.d.ts.map +1 -0
- package/dist/database/entities/resource.entity.js +117 -0
- package/dist/database/entities/resource.entity.js.map +1 -0
- package/dist/database/entities/role.entity.d.ts +7 -0
- package/dist/database/entities/role.entity.d.ts.map +1 -0
- package/dist/database/entities/role.entity.js +60 -0
- package/dist/database/entities/role.entity.js.map +1 -0
- package/dist/database/entities/subscription.entity.d.ts +16 -0
- package/dist/database/entities/subscription.entity.d.ts.map +1 -0
- package/dist/database/entities/subscription.entity.js +102 -0
- package/dist/database/entities/subscription.entity.js.map +1 -0
- package/dist/database/entities/user.entity.d.ts +13 -0
- package/dist/database/entities/user.entity.d.ts.map +1 -0
- package/dist/database/entities/user.entity.js +67 -0
- package/dist/database/entities/user.entity.js.map +1 -0
- package/dist/database/migrations/AlterAPIKeyTable.d.ts +6 -0
- package/dist/database/migrations/AlterAPIKeyTable.d.ts.map +1 -0
- package/dist/database/migrations/AlterAPIKeyTable.js +51 -0
- package/dist/database/migrations/AlterAPIKeyTable.js.map +1 -0
- package/dist/database/migrations/AlterCustomerTable.d.ts +6 -0
- package/dist/database/migrations/AlterCustomerTable.d.ts.map +1 -0
- package/dist/database/migrations/AlterCustomerTable.js +15 -0
- package/dist/database/migrations/AlterCustomerTable.js.map +1 -0
- package/dist/database/migrations/AlterCustomerTableAddEmail.d.ts +6 -0
- package/dist/database/migrations/AlterCustomerTableAddEmail.d.ts.map +1 -0
- package/dist/database/migrations/AlterCustomerTableAddEmail.js +20 -0
- package/dist/database/migrations/AlterCustomerTableAddEmail.js.map +1 -0
- package/dist/database/migrations/AlterOperationTable.d.ts +6 -0
- package/dist/database/migrations/AlterOperationTable.d.ts.map +1 -0
- package/dist/database/migrations/AlterOperationTable.js +38 -0
- package/dist/database/migrations/AlterOperationTable.js.map +1 -0
- package/dist/database/migrations/AlterOperationTableAddCustomer.d.ts +6 -0
- package/dist/database/migrations/AlterOperationTableAddCustomer.d.ts.map +1 -0
- package/dist/database/migrations/AlterOperationTableAddCustomer.js +22 -0
- package/dist/database/migrations/AlterOperationTableAddCustomer.js.map +1 -0
- package/dist/database/migrations/AlterOperationTableNewCategory.d.ts +6 -0
- package/dist/database/migrations/AlterOperationTableNewCategory.d.ts.map +1 -0
- package/dist/database/migrations/AlterOperationTableNewCategory.js +17 -0
- package/dist/database/migrations/AlterOperationTableNewCategory.js.map +1 -0
- package/dist/database/migrations/AlterPaymentTable.d.ts +6 -0
- package/dist/database/migrations/AlterPaymentTable.d.ts.map +1 -0
- package/dist/database/migrations/AlterPaymentTable.js +61 -0
- package/dist/database/migrations/AlterPaymentTable.js.map +1 -0
- package/dist/database/migrations/AlterTableClaim.d.ts +6 -0
- package/dist/database/migrations/AlterTableClaim.d.ts.map +1 -0
- package/dist/database/migrations/AlterTableClaim.js +21 -0
- package/dist/database/migrations/AlterTableClaim.js.map +1 -0
- package/dist/database/migrations/AlterTableIdentifier.d.ts +6 -0
- package/dist/database/migrations/AlterTableIdentifier.d.ts.map +1 -0
- package/dist/database/migrations/AlterTableIdentifier.js +21 -0
- package/dist/database/migrations/AlterTableIdentifier.js.map +1 -0
- package/dist/database/migrations/AlterTableKey.d.ts +6 -0
- package/dist/database/migrations/AlterTableKey.d.ts.map +1 -0
- package/dist/database/migrations/AlterTableKey.js +36 -0
- package/dist/database/migrations/AlterTableKey.js.map +1 -0
- package/dist/database/migrations/CreateApiKeyMigration.d.ts +6 -0
- package/dist/database/migrations/CreateApiKeyMigration.d.ts.map +1 -0
- package/dist/database/migrations/CreateApiKeyMigration.js +40 -0
- package/dist/database/migrations/CreateApiKeyMigration.js.map +1 -0
- package/dist/database/migrations/CreateCoinTable.d.ts +6 -0
- package/dist/database/migrations/CreateCoinTable.d.ts.map +1 -0
- package/dist/database/migrations/CreateCoinTable.js +20 -0
- package/dist/database/migrations/CreateCoinTable.js.map +1 -0
- package/dist/database/migrations/CreateCustomerTable.d.ts +6 -0
- package/dist/database/migrations/CreateCustomerTable.d.ts.map +1 -0
- package/dist/database/migrations/CreateCustomerTable.js +24 -0
- package/dist/database/migrations/CreateCustomerTable.js.map +1 -0
- package/dist/database/migrations/CreateCustomersTable.d.ts +6 -0
- package/dist/database/migrations/CreateCustomersTable.d.ts.map +1 -0
- package/dist/database/migrations/CreateCustomersTable.js +21 -0
- package/dist/database/migrations/CreateCustomersTable.js.map +1 -0
- package/dist/database/migrations/CreateOperationTable.d.ts +6 -0
- package/dist/database/migrations/CreateOperationTable.d.ts.map +1 -0
- package/dist/database/migrations/CreateOperationTable.js +28 -0
- package/dist/database/migrations/CreateOperationTable.js.map +1 -0
- package/dist/database/migrations/CreatePaymentAccountTable.d.ts +6 -0
- package/dist/database/migrations/CreatePaymentAccountTable.d.ts.map +1 -0
- package/dist/database/migrations/CreatePaymentAccountTable.js +35 -0
- package/dist/database/migrations/CreatePaymentAccountTable.js.map +1 -0
- package/dist/database/migrations/CreatePaymentTable.d.ts +6 -0
- package/dist/database/migrations/CreatePaymentTable.d.ts.map +1 -0
- package/dist/database/migrations/CreatePaymentTable.js +55 -0
- package/dist/database/migrations/CreatePaymentTable.js.map +1 -0
- package/dist/database/migrations/CreateResourceTable.d.ts +6 -0
- package/dist/database/migrations/CreateResourceTable.d.ts.map +1 -0
- package/dist/database/migrations/CreateResourceTable.js +46 -0
- package/dist/database/migrations/CreateResourceTable.js.map +1 -0
- package/dist/database/migrations/CreateRoleTable.d.ts +6 -0
- package/dist/database/migrations/CreateRoleTable.d.ts.map +1 -0
- package/dist/database/migrations/CreateRoleTable.js +25 -0
- package/dist/database/migrations/CreateRoleTable.js.map +1 -0
- package/dist/database/migrations/CreateSubscriptionTable.d.ts +6 -0
- package/dist/database/migrations/CreateSubscriptionTable.d.ts.map +1 -0
- package/dist/database/migrations/CreateSubscriptionTable.js +30 -0
- package/dist/database/migrations/CreateSubscriptionTable.js.map +1 -0
- package/dist/database/migrations/CreateUserTable.d.ts +6 -0
- package/dist/database/migrations/CreateUserTable.d.ts.map +1 -0
- package/dist/database/migrations/CreateUserTable.js +32 -0
- package/dist/database/migrations/CreateUserTable.js.map +1 -0
- package/dist/database/migrations/MigrateData.d.ts +7 -0
- package/dist/database/migrations/MigrateData.d.ts.map +1 -0
- package/dist/database/migrations/MigrateData.js +138 -0
- package/dist/database/migrations/MigrateData.js.map +1 -0
- package/dist/database/ormconfig.d.ts +2 -0
- package/dist/database/ormconfig.d.ts.map +1 -0
- package/dist/database/ormconfig.js +3 -0
- package/dist/database/ormconfig.js.map +1 -0
- package/dist/database/types/enum.d.ts +21 -0
- package/dist/database/types/enum.d.ts.map +1 -0
- package/dist/database/types/enum.js +35 -0
- package/dist/database/types/enum.js.map +1 -0
- package/dist/database/types/types.d.ts +11 -0
- package/dist/database/types/types.d.ts.map +1 -0
- package/dist/database/types/types.js +127 -0
- package/dist/database/types/types.js.map +1 -0
- package/dist/helpers/faucet.d.ts +5 -0
- package/dist/helpers/faucet.d.ts.map +1 -0
- package/dist/helpers/faucet.js +24 -0
- package/dist/helpers/faucet.js.map +1 -0
- package/dist/helpers/fee-analyzer.d.ts +8 -0
- package/dist/helpers/fee-analyzer.d.ts.map +1 -0
- package/dist/helpers/fee-analyzer.js +73 -0
- package/dist/helpers/fee-analyzer.js.map +1 -0
- package/dist/helpers/helpers.d.ts +28 -0
- package/dist/helpers/helpers.d.ts.map +1 -0
- package/dist/helpers/helpers.js +167 -0
- package/dist/helpers/helpers.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware/auth/auth-gaurd.d.ts +51 -0
- package/dist/middleware/auth/auth-gaurd.d.ts.map +1 -0
- package/dist/middleware/auth/auth-gaurd.js +117 -0
- package/dist/middleware/auth/auth-gaurd.js.map +1 -0
- package/dist/middleware/auth/logto-helper.d.ts +44 -0
- package/dist/middleware/auth/logto-helper.d.ts.map +1 -0
- package/dist/middleware/auth/logto-helper.js +438 -0
- package/dist/middleware/auth/logto-helper.js.map +1 -0
- package/dist/middleware/auth/oauth/abstract.d.ts +22 -0
- package/dist/middleware/auth/oauth/abstract.d.ts.map +1 -0
- package/dist/middleware/auth/oauth/abstract.js +24 -0
- package/dist/middleware/auth/oauth/abstract.js.map +1 -0
- package/dist/middleware/auth/oauth/logto-provider.d.ts +15 -0
- package/dist/middleware/auth/oauth/logto-provider.d.ts.map +1 -0
- package/dist/middleware/auth/oauth/logto-provider.js +42 -0
- package/dist/middleware/auth/oauth/logto-provider.js.map +1 -0
- package/dist/middleware/auth/routes/admin/admin-auth.d.ts +8 -0
- package/dist/middleware/auth/routes/admin/admin-auth.d.ts.map +1 -0
- package/dist/middleware/auth/routes/admin/admin-auth.js +44 -0
- package/dist/middleware/auth/routes/admin/admin-auth.js.map +1 -0
- package/dist/middleware/auth/routes/api/account-auth.d.ts +5 -0
- package/dist/middleware/auth/routes/api/account-auth.d.ts.map +1 -0
- package/dist/middleware/auth/routes/api/account-auth.js +9 -0
- package/dist/middleware/auth/routes/api/account-auth.js.map +1 -0
- package/dist/middleware/auth/routes/api/auth-user-info.d.ts +5 -0
- package/dist/middleware/auth/routes/api/auth-user-info.d.ts.map +1 -0
- package/dist/middleware/auth/routes/api/auth-user-info.js +8 -0
- package/dist/middleware/auth/routes/api/auth-user-info.js.map +1 -0
- package/dist/middleware/auth/routes/api/credential-auth.d.ts +5 -0
- package/dist/middleware/auth/routes/api/credential-auth.d.ts.map +1 -0
- package/dist/middleware/auth/routes/api/credential-auth.js +17 -0
- package/dist/middleware/auth/routes/api/credential-auth.js.map +1 -0
- package/dist/middleware/auth/routes/api/credential-status-auth.d.ts +5 -0
- package/dist/middleware/auth/routes/api/credential-status-auth.d.ts.map +1 -0
- package/dist/middleware/auth/routes/api/credential-status-auth.js +20 -0
- package/dist/middleware/auth/routes/api/credential-status-auth.js.map +1 -0
- package/dist/middleware/auth/routes/api/did-auth.d.ts +5 -0
- package/dist/middleware/auth/routes/api/did-auth.d.ts.map +1 -0
- package/dist/middleware/auth/routes/api/did-auth.js +19 -0
- package/dist/middleware/auth/routes/api/did-auth.js.map +1 -0
- package/dist/middleware/auth/routes/api/key-auth.d.ts +5 -0
- package/dist/middleware/auth/routes/api/key-auth.d.ts.map +1 -0
- package/dist/middleware/auth/routes/api/key-auth.js +11 -0
- package/dist/middleware/auth/routes/api/key-auth.js.map +1 -0
- package/dist/middleware/auth/routes/api/presentation-auth.d.ts +5 -0
- package/dist/middleware/auth/routes/api/presentation-auth.d.ts.map +1 -0
- package/dist/middleware/auth/routes/api/presentation-auth.js +10 -0
- package/dist/middleware/auth/routes/api/presentation-auth.js.map +1 -0
- package/dist/middleware/auth/routes/api/resource-auth.d.ts +5 -0
- package/dist/middleware/auth/routes/api/resource-auth.d.ts.map +1 -0
- package/dist/middleware/auth/routes/api/resource-auth.js +11 -0
- package/dist/middleware/auth/routes/api/resource-auth.js.map +1 -0
- package/dist/middleware/auth/routes/auth-rule-provider.d.ts +33 -0
- package/dist/middleware/auth/routes/auth-rule-provider.d.ts.map +1 -0
- package/dist/middleware/auth/routes/auth-rule-provider.js +39 -0
- package/dist/middleware/auth/routes/auth-rule-provider.js.map +1 -0
- package/dist/middleware/auth/routes/auth-rule-repository.d.ts +21 -0
- package/dist/middleware/auth/routes/auth-rule-repository.d.ts.map +1 -0
- package/dist/middleware/auth/routes/auth-rule-repository.js +28 -0
- package/dist/middleware/auth/routes/auth-rule-repository.js.map +1 -0
- package/dist/middleware/auth/user-info-fetcher/api-token.d.ts +17 -0
- package/dist/middleware/auth/user-info-fetcher/api-token.d.ts.map +1 -0
- package/dist/middleware/auth/user-info-fetcher/api-token.js +60 -0
- package/dist/middleware/auth/user-info-fetcher/api-token.js.map +1 -0
- package/dist/middleware/auth/user-info-fetcher/base.d.ts +14 -0
- package/dist/middleware/auth/user-info-fetcher/base.d.ts.map +1 -0
- package/dist/middleware/auth/user-info-fetcher/base.js +38 -0
- package/dist/middleware/auth/user-info-fetcher/base.js.map +1 -0
- package/dist/middleware/auth/user-info-fetcher/idtoken.d.ts +18 -0
- package/dist/middleware/auth/user-info-fetcher/idtoken.d.ts.map +1 -0
- package/dist/middleware/auth/user-info-fetcher/idtoken.js +56 -0
- package/dist/middleware/auth/user-info-fetcher/idtoken.js.map +1 -0
- package/dist/middleware/auth/user-info-fetcher/m2m-creds-token.d.ts +18 -0
- package/dist/middleware/auth/user-info-fetcher/m2m-creds-token.d.ts.map +1 -0
- package/dist/middleware/auth/user-info-fetcher/m2m-creds-token.js +52 -0
- package/dist/middleware/auth/user-info-fetcher/m2m-creds-token.js.map +1 -0
- package/dist/middleware/auth/user-info-fetcher/portal-token.d.ts +20 -0
- package/dist/middleware/auth/user-info-fetcher/portal-token.d.ts.map +1 -0
- package/dist/middleware/auth/user-info-fetcher/portal-token.js +79 -0
- package/dist/middleware/auth/user-info-fetcher/portal-token.js.map +1 -0
- package/dist/middleware/auth/user-info-fetcher/swagger-ui.d.ts +16 -0
- package/dist/middleware/auth/user-info-fetcher/swagger-ui.d.ts.map +1 -0
- package/dist/middleware/auth/user-info-fetcher/swagger-ui.js +48 -0
- package/dist/middleware/auth/user-info-fetcher/swagger-ui.js.map +1 -0
- package/dist/middleware/authentication.d.ts +15 -0
- package/dist/middleware/authentication.d.ts.map +1 -0
- package/dist/middleware/authentication.js +110 -0
- package/dist/middleware/authentication.js.map +1 -0
- package/dist/middleware/event-tracker.d.ts +5 -0
- package/dist/middleware/event-tracker.d.ts.map +1 -0
- package/dist/middleware/event-tracker.js +34 -0
- package/dist/middleware/event-tracker.js.map +1 -0
- package/dist/middleware/hook.d.ts +9 -0
- package/dist/middleware/hook.d.ts.map +1 -0
- package/dist/middleware/hook.js +24 -0
- package/dist/middleware/hook.js.map +1 -0
- package/dist/middleware/middleware.d.ts +6 -0
- package/dist/middleware/middleware.d.ts.map +1 -0
- package/dist/middleware/middleware.js +36 -0
- package/dist/middleware/middleware.js.map +1 -0
- package/dist/services/admin/api-key.d.ts +30 -0
- package/dist/services/admin/api-key.d.ts.map +1 -0
- package/dist/services/admin/api-key.js +135 -0
- package/dist/services/admin/api-key.js.map +1 -0
- package/dist/services/admin/stripe.d.ts +18 -0
- package/dist/services/admin/stripe.d.ts.map +1 -0
- package/dist/services/admin/stripe.js +125 -0
- package/dist/services/admin/stripe.js.map +1 -0
- package/dist/services/admin/subscription.d.ts +16 -0
- package/dist/services/admin/subscription.d.ts.map +1 -0
- package/dist/services/admin/subscription.js +75 -0
- package/dist/services/admin/subscription.js.map +1 -0
- package/dist/services/api/coin.d.ts +13 -0
- package/dist/services/api/coin.d.ts.map +1 -0
- package/dist/services/api/coin.js +49 -0
- package/dist/services/api/coin.js.map +1 -0
- package/dist/services/api/credentials.d.ts +8 -0
- package/dist/services/api/credentials.d.ts.map +1 -0
- package/dist/services/api/credentials.js +38 -0
- package/dist/services/api/credentials.js.map +1 -0
- package/dist/services/api/customer.d.ts +19 -0
- package/dist/services/api/customer.d.ts.map +1 -0
- package/dist/services/api/customer.js +88 -0
- package/dist/services/api/customer.js.map +1 -0
- package/dist/services/api/identifier.d.ts +12 -0
- package/dist/services/api/identifier.d.ts.map +1 -0
- package/dist/services/api/identifier.js +38 -0
- package/dist/services/api/identifier.js.map +1 -0
- package/dist/services/api/key.d.ts +14 -0
- package/dist/services/api/key.d.ts.map +1 -0
- package/dist/services/api/key.js +49 -0
- package/dist/services/api/key.js.map +1 -0
- package/dist/services/api/operation.d.ts +14 -0
- package/dist/services/api/operation.d.ts.map +1 -0
- package/dist/services/api/operation.js +61 -0
- package/dist/services/api/operation.js.map +1 -0
- package/dist/services/api/payment-account.d.ts +14 -0
- package/dist/services/api/payment-account.d.ts.map +1 -0
- package/dist/services/api/payment-account.js +68 -0
- package/dist/services/api/payment-account.js.map +1 -0
- package/dist/services/api/payment.d.ts +17 -0
- package/dist/services/api/payment.d.ts.map +1 -0
- package/dist/services/api/payment.js +68 -0
- package/dist/services/api/payment.js.map +1 -0
- package/dist/services/api/resource.d.ts +17 -0
- package/dist/services/api/resource.d.ts.map +1 -0
- package/dist/services/api/resource.js +65 -0
- package/dist/services/api/resource.js.map +1 -0
- package/dist/services/api/role.d.ts +14 -0
- package/dist/services/api/role.d.ts.map +1 -0
- package/dist/services/api/role.js +53 -0
- package/dist/services/api/role.js.map +1 -0
- package/dist/services/api/store.d.ts +8 -0
- package/dist/services/api/store.d.ts.map +1 -0
- package/dist/services/api/store.js +18 -0
- package/dist/services/api/store.js.map +1 -0
- package/dist/services/api/user.d.ts +15 -0
- package/dist/services/api/user.d.ts.map +1 -0
- package/dist/services/api/user.js +54 -0
- package/dist/services/api/user.js.map +1 -0
- package/dist/services/connectors/verida.d.ts +40 -0
- package/dist/services/connectors/verida.d.ts.map +1 -0
- package/dist/services/connectors/verida.js +110 -0
- package/dist/services/connectors/verida.js.map +1 -0
- package/dist/services/helpers.d.ts +10 -0
- package/dist/services/helpers.d.ts.map +1 -0
- package/dist/services/helpers.js +44 -0
- package/dist/services/helpers.js.map +1 -0
- package/dist/services/identity/abstract.d.ts +51 -0
- package/dist/services/identity/abstract.d.ts.map +1 -0
- package/dist/services/identity/abstract.js +101 -0
- package/dist/services/identity/abstract.js.map +1 -0
- package/dist/services/identity/agent.d.ts +43 -0
- package/dist/services/identity/agent.d.ts.map +1 -0
- package/dist/services/identity/agent.js +625 -0
- package/dist/services/identity/agent.js.map +1 -0
- package/dist/services/identity/default.d.ts +19 -0
- package/dist/services/identity/default.d.ts.map +1 -0
- package/dist/services/identity/default.js +26 -0
- package/dist/services/identity/default.js.map +1 -0
- package/dist/services/identity/index.d.ts +59 -0
- package/dist/services/identity/index.d.ts.map +1 -0
- package/dist/services/identity/index.js +31 -0
- package/dist/services/identity/index.js.map +1 -0
- package/dist/services/identity/local.d.ts +33 -0
- package/dist/services/identity/local.d.ts.map +1 -0
- package/dist/services/identity/local.js +156 -0
- package/dist/services/identity/local.js.map +1 -0
- package/dist/services/identity/postgres.d.ts +59 -0
- package/dist/services/identity/postgres.d.ts.map +1 -0
- package/dist/services/identity/postgres.js +388 -0
- package/dist/services/identity/postgres.js.map +1 -0
- package/dist/services/identity/unauthorized.d.ts +6 -0
- package/dist/services/identity/unauthorized.d.ts.map +1 -0
- package/dist/services/identity/unauthorized.js +49 -0
- package/dist/services/identity/unauthorized.js.map +1 -0
- package/dist/services/track/admin/account-submitter.d.ts +11 -0
- package/dist/services/track/admin/account-submitter.d.ts.map +1 -0
- package/dist/services/track/admin/account-submitter.js +54 -0
- package/dist/services/track/admin/account-submitter.js.map +1 -0
- package/dist/services/track/admin/subscription-submitter.d.ts +13 -0
- package/dist/services/track/admin/subscription-submitter.d.ts.map +1 -0
- package/dist/services/track/admin/subscription-submitter.js +106 -0
- package/dist/services/track/admin/subscription-submitter.js.map +1 -0
- package/dist/services/track/api/credential-status-subscriber.d.ts +10 -0
- package/dist/services/track/api/credential-status-subscriber.d.ts.map +1 -0
- package/dist/services/track/api/credential-status-subscriber.js +35 -0
- package/dist/services/track/api/credential-status-subscriber.js.map +1 -0
- package/dist/services/track/api/credential-subscriber.d.ts +10 -0
- package/dist/services/track/api/credential-subscriber.d.ts.map +1 -0
- package/dist/services/track/api/credential-subscriber.js +35 -0
- package/dist/services/track/api/credential-subscriber.js.map +1 -0
- package/dist/services/track/api/did-subscriber.d.ts +10 -0
- package/dist/services/track/api/did-subscriber.d.ts.map +1 -0
- package/dist/services/track/api/did-subscriber.js +33 -0
- package/dist/services/track/api/did-subscriber.js.map +1 -0
- package/dist/services/track/api/key-subscriber.d.ts +10 -0
- package/dist/services/track/api/key-subscriber.d.ts.map +1 -0
- package/dist/services/track/api/key-subscriber.js +35 -0
- package/dist/services/track/api/key-subscriber.js.map +1 -0
- package/dist/services/track/api/presentation-subscriber.d.ts +10 -0
- package/dist/services/track/api/presentation-subscriber.d.ts.map +1 -0
- package/dist/services/track/api/presentation-subscriber.js +35 -0
- package/dist/services/track/api/presentation-subscriber.js.map +1 -0
- package/dist/services/track/api/resource-subscriber.d.ts +11 -0
- package/dist/services/track/api/resource-subscriber.d.ts.map +1 -0
- package/dist/services/track/api/resource-subscriber.js +107 -0
- package/dist/services/track/api/resource-subscriber.js.map +1 -0
- package/dist/services/track/base.d.ts +10 -0
- package/dist/services/track/base.d.ts.map +1 -0
- package/dist/services/track/base.js +26 -0
- package/dist/services/track/base.js.map +1 -0
- package/dist/services/track/helpers.d.ts +23 -0
- package/dist/services/track/helpers.d.ts.map +1 -0
- package/dist/services/track/helpers.js +35 -0
- package/dist/services/track/helpers.js.map +1 -0
- package/dist/services/track/notifiers.d.ts +12 -0
- package/dist/services/track/notifiers.d.ts.map +1 -0
- package/dist/services/track/notifiers.js +39 -0
- package/dist/services/track/notifiers.js.map +1 -0
- package/dist/services/track/observer.d.ts +14 -0
- package/dist/services/track/observer.d.ts.map +1 -0
- package/dist/services/track/observer.js +43 -0
- package/dist/services/track/observer.js.map +1 -0
- package/dist/services/track/operation-subscriber.d.ts +14 -0
- package/dist/services/track/operation-subscriber.d.ts.map +1 -0
- package/dist/services/track/operation-subscriber.js +112 -0
- package/dist/services/track/operation-subscriber.js.map +1 -0
- package/dist/services/track/submitter.d.ts +22 -0
- package/dist/services/track/submitter.d.ts.map +1 -0
- package/dist/services/track/submitter.js +2 -0
- package/dist/services/track/submitter.js.map +1 -0
- package/dist/services/track/tracker.d.ts +24 -0
- package/dist/services/track/tracker.d.ts.map +1 -0
- package/dist/services/track/tracker.js +79 -0
- package/dist/services/track/tracker.js.map +1 -0
- package/dist/services/track/types.d.ts +16 -0
- package/dist/services/track/types.d.ts.map +1 -0
- package/dist/services/track/types.js +2 -0
- package/dist/services/track/types.js.map +1 -0
- package/dist/services/w3c-credential.d.ts +32 -0
- package/dist/services/w3c-credential.d.ts.map +1 -0
- package/dist/services/w3c-credential.js +120 -0
- package/dist/services/w3c-credential.js.map +1 -0
- package/dist/services/w3c-presentation.d.ts +30 -0
- package/dist/services/w3c-presentation.d.ts.map +1 -0
- package/dist/services/w3c-presentation.js +95 -0
- package/dist/services/w3c-presentation.js.map +1 -0
- package/dist/static/custom-button.d.ts +2 -0
- package/dist/static/custom-button.d.ts.map +1 -0
- package/dist/static/custom-button.js +35 -0
- package/dist/static/custom-button.js.map +1 -0
- package/dist/static/swagger-admin.json +1191 -0
- package/dist/static/swagger-api.json +3564 -0
- package/dist/types/admin.d.ts +122 -0
- package/dist/types/admin.d.ts.map +1 -0
- package/dist/types/admin.js +2 -0
- package/dist/types/admin.js.map +1 -0
- package/dist/types/authentication.d.ts +30 -0
- package/dist/types/authentication.d.ts.map +1 -0
- package/dist/types/authentication.js +131 -0
- package/dist/types/authentication.js.map +1 -0
- package/dist/types/constants.d.ts +98 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/constants.js +138 -0
- package/dist/types/constants.js.map +1 -0
- package/dist/types/credential-status.d.ts +168 -0
- package/dist/types/credential-status.d.ts.map +1 -0
- package/dist/types/credential-status.js +12 -0
- package/dist/types/credential-status.js.map +1 -0
- package/dist/types/credential.d.ts +55 -0
- package/dist/types/credential.d.ts.map +1 -0
- package/dist/types/credential.js +2 -0
- package/dist/types/credential.js.map +1 -0
- package/dist/types/customer.d.ts +18 -0
- package/dist/types/customer.d.ts.map +1 -0
- package/dist/types/customer.js +2 -0
- package/dist/types/customer.js.map +1 -0
- package/dist/types/did.d.ts +56 -0
- package/dist/types/did.d.ts.map +1 -0
- package/dist/types/did.js +2 -0
- package/dist/types/did.js.map +1 -0
- package/dist/types/key.d.ts +23 -0
- package/dist/types/key.d.ts.map +1 -0
- package/dist/types/key.js +2 -0
- package/dist/types/key.js.map +1 -0
- package/dist/types/presentation.d.ts +19 -0
- package/dist/types/presentation.d.ts.map +1 -0
- package/dist/types/presentation.js +2 -0
- package/dist/types/presentation.js.map +1 -0
- package/dist/types/resource.d.ts +26 -0
- package/dist/types/resource.d.ts.map +1 -0
- package/dist/types/resource.js +2 -0
- package/dist/types/resource.js.map +1 -0
- package/dist/types/shared.d.ts +51 -0
- package/dist/types/shared.d.ts.map +1 -0
- package/dist/types/shared.js +24 -0
- package/dist/types/shared.js.map +1 -0
- package/dist/types/swagger-admin-types.d.ts +352 -0
- package/dist/types/swagger-admin-types.d.ts.map +1 -0
- package/dist/types/swagger-admin-types.js +353 -0
- package/dist/types/swagger-admin-types.js.map +1 -0
- package/dist/types/swagger-api-types.d.ts +1312 -0
- package/dist/types/swagger-api-types.d.ts.map +1 -0
- package/dist/types/swagger-api-types.js +1313 -0
- package/dist/types/swagger-api-types.js.map +1 -0
- package/dist/types/track.d.ts +72 -0
- package/dist/types/track.d.ts.map +1 -0
- package/dist/types/track.js +37 -0
- package/dist/types/track.js.map +1 -0
- package/dist/types/validation.d.ts +23 -0
- package/dist/types/validation.d.ts.map +1 -0
- package/dist/types/validation.js +2 -0
- package/dist/types/validation.js.map +1 -0
- package/dist/types/verida.d.ts +23 -0
- package/dist/types/verida.d.ts.map +1 -0
- package/dist/types/verida.js +2 -0
- package/dist/types/verida.js.map +1 -0
- package/example.env +43 -0
- package/package.json +156 -0
|
@@ -0,0 +1,1080 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { check, query } from '../validator/index.js';
|
|
8
|
+
import { fromString } from 'uint8arrays';
|
|
9
|
+
import { StatusCodes } from 'http-status-codes';
|
|
10
|
+
import { IdentityServiceStrategySetup } from '../../services/identity/index.js';
|
|
11
|
+
import { DefaultStatusActionPurposeMap, DefaultStatusActions, } from '../../types/credential-status.js';
|
|
12
|
+
import { DefaultStatusList2021Encodings, DefaultStatusList2021StatusPurposeTypes, } from '@cheqd/did-provider-cheqd';
|
|
13
|
+
import { toNetwork } from '../../helpers/helpers.js';
|
|
14
|
+
import { eventTracker } from '../../services/track/tracker.js';
|
|
15
|
+
import { OperationCategoryNameEnum, OperationNameEnum } from '../../types/constants.js';
|
|
16
|
+
import { FeeAnalyzer } from '../../helpers/fee-analyzer.js';
|
|
17
|
+
import { validate } from '../validator/decorator.js';
|
|
18
|
+
export class CredentialStatusController {
|
|
19
|
+
static createUnencryptedValidator = [
|
|
20
|
+
check('did').exists().withMessage('did: required').bail().isDID(),
|
|
21
|
+
check('statusPurpose')
|
|
22
|
+
.exists()
|
|
23
|
+
.withMessage('statusPurpose: required')
|
|
24
|
+
.bail()
|
|
25
|
+
.isString()
|
|
26
|
+
.withMessage('statusPurpose: should be a string')
|
|
27
|
+
.bail()
|
|
28
|
+
.isIn(Object.keys(DefaultStatusList2021StatusPurposeTypes))
|
|
29
|
+
.withMessage(`statusPurpose: invalid statusPurpose, should be one of ${Object.keys(DefaultStatusList2021StatusPurposeTypes).join(', ')}`)
|
|
30
|
+
.bail(),
|
|
31
|
+
check('statusListName')
|
|
32
|
+
.exists()
|
|
33
|
+
.withMessage('statusListName: required')
|
|
34
|
+
.bail()
|
|
35
|
+
.isString()
|
|
36
|
+
.withMessage('statusListName: should be a string')
|
|
37
|
+
.bail()
|
|
38
|
+
.notEmpty()
|
|
39
|
+
.withMessage('statusListName: should be a non-empty string')
|
|
40
|
+
.bail(),
|
|
41
|
+
check('statusListVersion').optional().isString().withMessage('statusListVersion: should be a string').bail(),
|
|
42
|
+
check('alsoKnownAs')
|
|
43
|
+
.optional()
|
|
44
|
+
.isArray()
|
|
45
|
+
.withMessage('alsoKnownAs: should be an array')
|
|
46
|
+
.bail()
|
|
47
|
+
.notEmpty()
|
|
48
|
+
.withMessage('alsoKnownAs: should be a non-empty array')
|
|
49
|
+
.bail()
|
|
50
|
+
.custom((value) => {
|
|
51
|
+
return value.every((item) => item.description &&
|
|
52
|
+
typeof item.description === 'string' &&
|
|
53
|
+
item.uri &&
|
|
54
|
+
typeof item.uri === 'string');
|
|
55
|
+
})
|
|
56
|
+
.withMessage('alsoKnownAs: should be an array of objects with `description` and `uri` properties of type string, non-empty')
|
|
57
|
+
.bail(),
|
|
58
|
+
check('length')
|
|
59
|
+
.optional()
|
|
60
|
+
.isNumeric()
|
|
61
|
+
.withMessage('length: should be a number')
|
|
62
|
+
.bail()
|
|
63
|
+
.custom((value) => !isNaN(parseInt(value.toString())) &&
|
|
64
|
+
isFinite(parseInt(value.toString())) &&
|
|
65
|
+
Number.isInteger(value))
|
|
66
|
+
.withMessage('length: should be an integer')
|
|
67
|
+
.bail()
|
|
68
|
+
.custom((value) => value > 0)
|
|
69
|
+
.withMessage('length: should be a positive integer')
|
|
70
|
+
.bail(),
|
|
71
|
+
check('encoding')
|
|
72
|
+
.optional()
|
|
73
|
+
.isIn(Object.keys(DefaultStatusList2021Encodings))
|
|
74
|
+
.withMessage(`encoding: invalid encoding, should be one of ${Object.keys(DefaultStatusList2021Encodings).join(', ')}`)
|
|
75
|
+
.bail(),
|
|
76
|
+
check('encodedList').optional().isString().withMessage('encodedList: should be a string').bail(),
|
|
77
|
+
];
|
|
78
|
+
static createEncryptedValidator = [
|
|
79
|
+
...CredentialStatusController.createUnencryptedValidator,
|
|
80
|
+
// define validation chain - case: content-type is application/json
|
|
81
|
+
check('paymentConditions')
|
|
82
|
+
.if((_value, { req }) => req?.headers?.['content-type'] === 'application/json')
|
|
83
|
+
.exists()
|
|
84
|
+
.withMessage('paymentConditions: required')
|
|
85
|
+
.bail()
|
|
86
|
+
.isArray()
|
|
87
|
+
.withMessage('paymentConditions: should be an array')
|
|
88
|
+
.bail()
|
|
89
|
+
.custom((value) => {
|
|
90
|
+
return value.length && value.length > 0;
|
|
91
|
+
})
|
|
92
|
+
.withMessage('paymentConditions: should be a non-empty array')
|
|
93
|
+
.bail()
|
|
94
|
+
.custom((value) => {
|
|
95
|
+
return value.every((item) => item.feePaymentAddress && typeof item.feePaymentAddress === 'string');
|
|
96
|
+
})
|
|
97
|
+
.withMessage('paymentConditions: should be an array of objects with feePaymentAddress property of type string, non-empty')
|
|
98
|
+
.bail()
|
|
99
|
+
.custom((value) => {
|
|
100
|
+
return value.every((item) => item.feePaymentAmount &&
|
|
101
|
+
typeof item.feePaymentAmount === 'number' &&
|
|
102
|
+
isFinite(parseFloat(item.feePaymentAmount.toString())) &&
|
|
103
|
+
/^[0-9]+(?:\.[0-9]{1,2})?$/.test(item.feePaymentAmount.toString()) // check if number is float with 2 decimal places max
|
|
104
|
+
);
|
|
105
|
+
})
|
|
106
|
+
.withMessage('paymentConditions: should be an array of objects with feePaymentAmount property of type number, non-empty, integer or float with 2 decimal places max')
|
|
107
|
+
.bail()
|
|
108
|
+
.custom((value) => {
|
|
109
|
+
return value.every((item) => item.feePaymentWindow &&
|
|
110
|
+
typeof item.feePaymentWindow === 'number' &&
|
|
111
|
+
!isNaN(parseInt(item.feePaymentWindow.toString())) &&
|
|
112
|
+
isFinite(parseInt(item.feePaymentWindow.toString())) &&
|
|
113
|
+
parseInt(item.feePaymentWindow.toString()) > 0);
|
|
114
|
+
})
|
|
115
|
+
.withMessage('paymentConditions: should be an array of objects with feePaymentWindow property of type number, non-empty, integer, strictly positive')
|
|
116
|
+
.bail(),
|
|
117
|
+
// define validation chain - case: content-type is application/x-www-form-urlencoded
|
|
118
|
+
check('feePaymentAddress')
|
|
119
|
+
.if((_value, { req }) => req?.headers?.['content-type'] === 'application/x-www-form-urlencoded')
|
|
120
|
+
.exists()
|
|
121
|
+
.withMessage('feePaymentAddress: required')
|
|
122
|
+
.bail()
|
|
123
|
+
.isString()
|
|
124
|
+
.withMessage('feePaymentAddress: should be a string')
|
|
125
|
+
.bail()
|
|
126
|
+
.notEmpty()
|
|
127
|
+
.withMessage('feePaymentAddress: should be a non-empty string')
|
|
128
|
+
.bail()
|
|
129
|
+
.matches(/^cheqd1/)
|
|
130
|
+
.withMessage('feePaymentAddress: should be a valid cheqd address')
|
|
131
|
+
.bail(),
|
|
132
|
+
check('feePaymentAmount')
|
|
133
|
+
.if((_value, { req }) => req?.headers?.['content-type'] === 'application/x-www-form-urlencoded')
|
|
134
|
+
.exists()
|
|
135
|
+
.withMessage('feePaymentAmount: required')
|
|
136
|
+
.bail()
|
|
137
|
+
.isNumeric()
|
|
138
|
+
.withMessage('feePaymentAmount: should be a number')
|
|
139
|
+
.bail()
|
|
140
|
+
.custom((value) => value > 0)
|
|
141
|
+
.withMessage('feePaymentAmount: should be a positive number')
|
|
142
|
+
.bail()
|
|
143
|
+
.matches(/^[0-9]+(?:\.[0-9]{1,2})?$/)
|
|
144
|
+
.withMessage('feePaymentAmount: should be a number, non-empty, integer or float with 2 decimal places max')
|
|
145
|
+
.bail(),
|
|
146
|
+
check('feePaymentWindow')
|
|
147
|
+
.if((_value, { req }) => req?.headers?.['content-type'] === 'application/x-www-form-urlencoded')
|
|
148
|
+
.exists()
|
|
149
|
+
.withMessage('feePaymentWindow: required')
|
|
150
|
+
.bail()
|
|
151
|
+
.isNumeric()
|
|
152
|
+
.withMessage('feePaymentWindow: should be a number')
|
|
153
|
+
.bail()
|
|
154
|
+
.custom((value) => value > 0)
|
|
155
|
+
.withMessage('feePaymentWindow: should be a positive number')
|
|
156
|
+
.bail()
|
|
157
|
+
.custom((value) => Number.isInteger(value))
|
|
158
|
+
.withMessage('feePaymentWindow: should be an integer')
|
|
159
|
+
.bail(),
|
|
160
|
+
];
|
|
161
|
+
static updateUnencryptedValidator = [
|
|
162
|
+
check('did').exists().withMessage('did: required').bail().isDID().bail(),
|
|
163
|
+
check('statusAction')
|
|
164
|
+
.exists()
|
|
165
|
+
.withMessage('statusAction: required')
|
|
166
|
+
.bail()
|
|
167
|
+
.isIn(Object.keys(DefaultStatusActions))
|
|
168
|
+
.withMessage(`statusAction: invalid statusAction, should be one of ${Object.keys(DefaultStatusActions).join(', ')}`)
|
|
169
|
+
.bail(),
|
|
170
|
+
check('indices')
|
|
171
|
+
.exists()
|
|
172
|
+
.withMessage('indices: required')
|
|
173
|
+
.bail()
|
|
174
|
+
.custom((value) => {
|
|
175
|
+
return (value &&
|
|
176
|
+
((Array.isArray(value) &&
|
|
177
|
+
value.every((item) => typeof item === 'number' && item >= 0 && Number.isInteger(item))) ||
|
|
178
|
+
(typeof value === 'number' && value >= 0 && Number.isInteger(value))));
|
|
179
|
+
})
|
|
180
|
+
.withMessage('indices: should be a positive integer or an array of positive integers')
|
|
181
|
+
.bail(),
|
|
182
|
+
check('statusListName')
|
|
183
|
+
.exists()
|
|
184
|
+
.withMessage('statusListName: required')
|
|
185
|
+
.bail()
|
|
186
|
+
.isString()
|
|
187
|
+
.withMessage('statusListName: should be a string')
|
|
188
|
+
.bail()
|
|
189
|
+
.notEmpty()
|
|
190
|
+
.withMessage('statusListName: should be a non-empty string')
|
|
191
|
+
.bail(),
|
|
192
|
+
check('statusListVersion').optional().isString().withMessage('statusListVersion: should be a string').bail(),
|
|
193
|
+
];
|
|
194
|
+
static updateEncryptedValidator = [
|
|
195
|
+
...CredentialStatusController.updateUnencryptedValidator,
|
|
196
|
+
check('symmetricKey')
|
|
197
|
+
.exists()
|
|
198
|
+
.withMessage('symmetricKey: required')
|
|
199
|
+
.bail()
|
|
200
|
+
.isString()
|
|
201
|
+
.withMessage('symmetricKey: should be a string')
|
|
202
|
+
.bail()
|
|
203
|
+
.notEmpty()
|
|
204
|
+
.withMessage('symmetricKey: should be a non-empty string')
|
|
205
|
+
.bail(),
|
|
206
|
+
// define validation chain - case: content-type is application/json, paymentConditions is optionally defined
|
|
207
|
+
check('paymentConditions')
|
|
208
|
+
.if((_value, { req }) => req?.headers?.['content-type'] === 'application/json')
|
|
209
|
+
.optional()
|
|
210
|
+
.isArray()
|
|
211
|
+
.withMessage('paymentConditions: should be an array')
|
|
212
|
+
.bail()
|
|
213
|
+
.custom((value) => {
|
|
214
|
+
return value.length && value.length > 0;
|
|
215
|
+
})
|
|
216
|
+
.withMessage('paymentConditions: should be a non-empty array')
|
|
217
|
+
.bail()
|
|
218
|
+
.custom((value) => {
|
|
219
|
+
return value.every((item) => item.feePaymentAddress && typeof item.feePaymentAddress === 'string');
|
|
220
|
+
})
|
|
221
|
+
.withMessage('paymentConditions: should be an array of objects with feePaymentAddress property of type string, non-empty')
|
|
222
|
+
.bail()
|
|
223
|
+
.custom((value) => {
|
|
224
|
+
return value.every((item) => item.feePaymentAmount &&
|
|
225
|
+
typeof item.feePaymentAmount === 'number' &&
|
|
226
|
+
isFinite(parseFloat(item.feePaymentAmount.toString())) &&
|
|
227
|
+
/^[0-9]+(?:\.[0-9]{1,2})?$/.test(item.feePaymentAmount.toString()) // check if number is float with 2 decimal places max
|
|
228
|
+
);
|
|
229
|
+
})
|
|
230
|
+
.withMessage('paymentConditions: should be an array of objects with feePaymentAmount property of type number, non-empty, integer or float with 2 decimal places max')
|
|
231
|
+
.bail()
|
|
232
|
+
.custom((value) => {
|
|
233
|
+
return value.every((item) => item.feePaymentWindow &&
|
|
234
|
+
typeof item.feePaymentWindow === 'number' &&
|
|
235
|
+
!isNaN(parseInt(item.feePaymentWindow.toString())) &&
|
|
236
|
+
isFinite(parseInt(item.feePaymentWindow.toString())) &&
|
|
237
|
+
parseInt(item.feePaymentWindow.toString()) > 0);
|
|
238
|
+
})
|
|
239
|
+
.withMessage('paymentConditions: should be an array of objects with feePaymentWindow property of type number, non-empty, integer, strictly positive')
|
|
240
|
+
.bail(),
|
|
241
|
+
// define validation chain - case: content-type is application/x-www-form-urlencoded
|
|
242
|
+
check('feePaymentAddress')
|
|
243
|
+
// skip, if content-type is not application/x-www-form-urlencoded
|
|
244
|
+
.if((_value, { req }) => req?.headers?.['content-type'] === 'application/x-www-form-urlencoded')
|
|
245
|
+
// validate, if any of is defined
|
|
246
|
+
.if((value, { req }) => value || req?.body?.feePaymentAmount || req?.body?.feePaymentWindow)
|
|
247
|
+
.exists()
|
|
248
|
+
.withMessage('feePaymentAddress: required')
|
|
249
|
+
.bail()
|
|
250
|
+
.isString()
|
|
251
|
+
.withMessage('feePaymentAddress: should be a string')
|
|
252
|
+
.bail()
|
|
253
|
+
.notEmpty()
|
|
254
|
+
.withMessage('feePaymentAddress: should be a non-empty string')
|
|
255
|
+
.bail()
|
|
256
|
+
.matches(/^cheqd1/)
|
|
257
|
+
.withMessage('feePaymentAddress: should be a valid cheqd address')
|
|
258
|
+
.bail(),
|
|
259
|
+
check('feePaymentAmount')
|
|
260
|
+
// skip, if content-type is not application/x-www-form-urlencoded
|
|
261
|
+
.if((_value, { req }) => req?.headers?.['content-type'] === 'application/x-www-form-urlencoded')
|
|
262
|
+
// validate, if any of is defined
|
|
263
|
+
.if((value, { req }) => value || req?.body?.feePaymentAddress || req?.body?.feePaymentWindow)
|
|
264
|
+
.exists()
|
|
265
|
+
.withMessage('feePaymentAmount: required')
|
|
266
|
+
.bail()
|
|
267
|
+
.isNumeric()
|
|
268
|
+
.withMessage('feePaymentAmount: should be a number')
|
|
269
|
+
.bail()
|
|
270
|
+
.custom((value) => value > 0)
|
|
271
|
+
.withMessage('feePaymentAmount: should be a positive number')
|
|
272
|
+
.bail()
|
|
273
|
+
.matches(/^[0-9]+(?:\.[0-9]{1,2})?$/)
|
|
274
|
+
.withMessage('feePaymentAmount: should be a number, non-empty, integer or float with 2 decimal places max')
|
|
275
|
+
.bail(),
|
|
276
|
+
check('feePaymentWindow')
|
|
277
|
+
// skip, if content-type is not application/x-www-form-urlencoded
|
|
278
|
+
.if((_value, { req }) => req?.headers?.['content-type'] === 'application/x-www-form-urlencoded')
|
|
279
|
+
// validate, if any of is defined
|
|
280
|
+
.if((value, { req }) => value || req?.body?.feePaymentAddress || req?.body?.feePaymentAmount)
|
|
281
|
+
.exists()
|
|
282
|
+
.withMessage('feePaymentWindow: required')
|
|
283
|
+
.bail()
|
|
284
|
+
.isNumeric()
|
|
285
|
+
.if((value) => typeof value !== 'undefined' && value !== null)
|
|
286
|
+
.withMessage('feePaymentWindow: should be a number')
|
|
287
|
+
.bail()
|
|
288
|
+
.custom((value) => value > 0)
|
|
289
|
+
.withMessage('feePaymentWindow: should be a positive number')
|
|
290
|
+
.bail()
|
|
291
|
+
.custom((value) => Number.isInteger(value))
|
|
292
|
+
.withMessage('feePaymentWindow: should be an integer'),
|
|
293
|
+
];
|
|
294
|
+
static checkValidator = [
|
|
295
|
+
check('did').exists().withMessage('did: required').isDID().bail(),
|
|
296
|
+
check('statusListName')
|
|
297
|
+
.exists()
|
|
298
|
+
.withMessage('statusListName: required')
|
|
299
|
+
.bail()
|
|
300
|
+
.isString()
|
|
301
|
+
.withMessage('statusListName: should be a string')
|
|
302
|
+
.bail()
|
|
303
|
+
.notEmpty()
|
|
304
|
+
.withMessage('statusListName: should be a non-empty string')
|
|
305
|
+
.bail(),
|
|
306
|
+
check('statusPurpose')
|
|
307
|
+
.exists()
|
|
308
|
+
.withMessage('statusPurpose: required')
|
|
309
|
+
.bail()
|
|
310
|
+
.isString()
|
|
311
|
+
.withMessage('statusPurpose: should be a string')
|
|
312
|
+
.bail()
|
|
313
|
+
.notEmpty()
|
|
314
|
+
.withMessage('statusPurpose: should be a non-empty string')
|
|
315
|
+
.bail()
|
|
316
|
+
.isIn(Object.keys(DefaultStatusList2021StatusPurposeTypes))
|
|
317
|
+
.withMessage(`statusPurpose: invalid statusPurpose, should be one of ${Object.keys(DefaultStatusList2021StatusPurposeTypes).join(', ')}`)
|
|
318
|
+
.bail(),
|
|
319
|
+
check('index')
|
|
320
|
+
.exists()
|
|
321
|
+
.withMessage('index: required')
|
|
322
|
+
.bail()
|
|
323
|
+
.isNumeric()
|
|
324
|
+
.withMessage('index: should be a number')
|
|
325
|
+
.bail()
|
|
326
|
+
.custom((value) => value >= 0)
|
|
327
|
+
.withMessage('index: should be a positive number')
|
|
328
|
+
.bail()
|
|
329
|
+
.custom((value) => Number.isInteger(value))
|
|
330
|
+
.withMessage('index: should be an integer')
|
|
331
|
+
.bail(),
|
|
332
|
+
check('makeFeePayment').optional().isBoolean().withMessage('makeFeePayment: should be a boolean').bail(),
|
|
333
|
+
];
|
|
334
|
+
static searchValidator = [
|
|
335
|
+
query('did').exists().withMessage('did: required').isDID().bail(),
|
|
336
|
+
query('statusListName')
|
|
337
|
+
.exists()
|
|
338
|
+
.withMessage('statusListName: required')
|
|
339
|
+
.bail()
|
|
340
|
+
.isString()
|
|
341
|
+
.withMessage('statusListName: should be a string')
|
|
342
|
+
.bail()
|
|
343
|
+
.notEmpty()
|
|
344
|
+
.withMessage('statusListName: should be a non-empty string')
|
|
345
|
+
.bail(),
|
|
346
|
+
query('statusPurpose')
|
|
347
|
+
.exists()
|
|
348
|
+
.withMessage('statusPurpose: required')
|
|
349
|
+
.bail()
|
|
350
|
+
.isString()
|
|
351
|
+
.withMessage('statusPurpose: should be a string')
|
|
352
|
+
.bail()
|
|
353
|
+
.notEmpty()
|
|
354
|
+
.withMessage('statusPurpose: should be a non-empty string')
|
|
355
|
+
.bail()
|
|
356
|
+
.isIn(Object.keys(DefaultStatusList2021StatusPurposeTypes))
|
|
357
|
+
.withMessage(`statusPurpose: invalid statusPurpose, should be one of ${Object.keys(DefaultStatusList2021StatusPurposeTypes).join(', ')}`)
|
|
358
|
+
.bail(),
|
|
359
|
+
];
|
|
360
|
+
/**
|
|
361
|
+
* @openapi
|
|
362
|
+
*
|
|
363
|
+
* /credential-status/create/unencrypted:
|
|
364
|
+
* post:
|
|
365
|
+
* tags: [ Credential Status ]
|
|
366
|
+
* summary: Create an unencrypted StatusList2021 credential status list.
|
|
367
|
+
* description: This endpoint creates an unencrypted StatusList2021 credential status list. The StatusList is published as a DID-Linked Resource on ledger. As input, it can can take input parameters needed to create the status list via a form, or a pre-assembled status list in JSON format. Status lists can be created as either encrypted or unencrypted; and with purpose as either revocation or suspension.
|
|
368
|
+
* parameters:
|
|
369
|
+
* - in: query
|
|
370
|
+
* name: statusPurpose
|
|
371
|
+
* description: The purpose of the status list. Can be either revocation or suspension. Once this is set, it cannot be changed. A new status list must be created to change the purpose.
|
|
372
|
+
* required: true
|
|
373
|
+
* schema:
|
|
374
|
+
* type: string
|
|
375
|
+
* enum:
|
|
376
|
+
* - revocation
|
|
377
|
+
* - suspension
|
|
378
|
+
* requestBody:
|
|
379
|
+
* content:
|
|
380
|
+
* application/x-www-form-urlencoded:
|
|
381
|
+
* schema:
|
|
382
|
+
* $ref: '#/components/schemas/CredentialStatusCreateUnencryptedRequest'
|
|
383
|
+
* application/json:
|
|
384
|
+
* schema:
|
|
385
|
+
* $ref: '#/components/schemas/CredentialStatusCreateUnencryptedRequest'
|
|
386
|
+
* responses:
|
|
387
|
+
* 200:
|
|
388
|
+
* description: The request was successful.
|
|
389
|
+
* content:
|
|
390
|
+
* application/json:
|
|
391
|
+
* schema:
|
|
392
|
+
* $ref: '#/components/schemas/CredentialStatusCreateUnencryptedResult'
|
|
393
|
+
* 400:
|
|
394
|
+
* $ref: '#/components/schemas/InvalidRequest'
|
|
395
|
+
* 401:
|
|
396
|
+
* $ref: '#/components/schemas/UnauthorizedError'
|
|
397
|
+
* 500:
|
|
398
|
+
* $ref: '#/components/schemas/InternalError'
|
|
399
|
+
*/
|
|
400
|
+
async createUnencryptedStatusList(request, response) {
|
|
401
|
+
// collect request parameters - case: body
|
|
402
|
+
const { did, encodedList, statusListName, alsoKnownAs, statusListVersion, length, encoding } = request.body;
|
|
403
|
+
// collect request parameters - case: query
|
|
404
|
+
const { statusPurpose } = request.query;
|
|
405
|
+
// define broadcast mode
|
|
406
|
+
const data = encodedList ? fromString(encodedList, encoding) : undefined;
|
|
407
|
+
// create agent
|
|
408
|
+
const identityServiceStrategySetup = new IdentityServiceStrategySetup(response.locals.customer.customerId);
|
|
409
|
+
try {
|
|
410
|
+
// broadcast, if applicable
|
|
411
|
+
if (data) {
|
|
412
|
+
const result = await identityServiceStrategySetup.agent.broadcastStatusList2021(did, { data, name: statusListName, alsoKnownAs, version: statusListVersion }, { encoding, statusPurpose }, response.locals.customer);
|
|
413
|
+
return response.status(StatusCodes.OK).json(result);
|
|
414
|
+
}
|
|
415
|
+
// create unencrypted status list
|
|
416
|
+
const result = (await identityServiceStrategySetup.agent.createUnencryptedStatusList2021(did, {
|
|
417
|
+
name: statusListName,
|
|
418
|
+
alsoKnownAs,
|
|
419
|
+
version: statusListVersion,
|
|
420
|
+
}, {
|
|
421
|
+
length,
|
|
422
|
+
encoding,
|
|
423
|
+
statusPurpose,
|
|
424
|
+
}, response.locals.customer));
|
|
425
|
+
// handle error
|
|
426
|
+
if (result.error) {
|
|
427
|
+
return response.status(StatusCodes.BAD_REQUEST).json({
|
|
428
|
+
...result,
|
|
429
|
+
error: result.error?.message || result.error.toString(),
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
// Keep track of resources
|
|
433
|
+
const trackInfo = {
|
|
434
|
+
category: OperationCategoryNameEnum.CREDENTIAL_STATUS,
|
|
435
|
+
name: OperationNameEnum.CREDENTIAL_STATUS_CREATE_UNENCRYPTED,
|
|
436
|
+
customer: response.locals.customer,
|
|
437
|
+
user: response.locals.user,
|
|
438
|
+
data: {
|
|
439
|
+
did,
|
|
440
|
+
resource: result.resourceMetadata,
|
|
441
|
+
encrypted: result.resource?.metadata?.encrypted,
|
|
442
|
+
symmetricKey: '',
|
|
443
|
+
},
|
|
444
|
+
};
|
|
445
|
+
// Track operation
|
|
446
|
+
eventTracker.emit('track', trackInfo);
|
|
447
|
+
return response.status(StatusCodes.OK).json({ ...result, encrypted: undefined });
|
|
448
|
+
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
// return catch-all error
|
|
451
|
+
return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
|
|
452
|
+
created: false,
|
|
453
|
+
error: `Internal error: ${error?.message || error}`,
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* @openapi
|
|
459
|
+
*
|
|
460
|
+
* /credential-status/create/encrypted:
|
|
461
|
+
* post:
|
|
462
|
+
* tags: [ Credential Status ]
|
|
463
|
+
* summary: Create an encrypted StatusList2021 credential status list.
|
|
464
|
+
* description: This endpoint creates an encrypted StatusList2021 credential status list. The StatusList is published as a DID-Linked Resource on ledger. As input, it can can take input parameters needed to create the status list via a form, or a pre-assembled status list in JSON format. Status lists can be created as either encrypted or unencrypted; and with purpose as either revocation or suspension.
|
|
465
|
+
* parameters:
|
|
466
|
+
* - in: query
|
|
467
|
+
* name: statusPurpose
|
|
468
|
+
* description: The purpose of the status list. Can be either revocation or suspension. Once this is set, it cannot be changed. A new status list must be created to change the purpose.
|
|
469
|
+
* required: true
|
|
470
|
+
* schema:
|
|
471
|
+
* type: string
|
|
472
|
+
* enum:
|
|
473
|
+
* - revocation
|
|
474
|
+
* - suspension
|
|
475
|
+
* requestBody:
|
|
476
|
+
* content:
|
|
477
|
+
* application/x-www-form-urlencoded:
|
|
478
|
+
* schema:
|
|
479
|
+
* $ref: '#/components/schemas/CredentialStatusCreateEncryptedFormRequest'
|
|
480
|
+
* application/json:
|
|
481
|
+
* schema:
|
|
482
|
+
* $ref: '#/components/schemas/CredentialStatusCreateEncryptedJsonRequest'
|
|
483
|
+
* responses:
|
|
484
|
+
* 200:
|
|
485
|
+
* description: The request was successful.
|
|
486
|
+
* content:
|
|
487
|
+
* application/json:
|
|
488
|
+
* schema:
|
|
489
|
+
* $ref: '#/components/schemas/CredentialStatusCreateEncryptedResult'
|
|
490
|
+
* 400:
|
|
491
|
+
* $ref: '#/components/schemas/InvalidRequest'
|
|
492
|
+
* 401:
|
|
493
|
+
* $ref: '#/components/schemas/UnauthorizedError'
|
|
494
|
+
* 500:
|
|
495
|
+
* $ref: '#/components/schemas/InternalError'
|
|
496
|
+
*/
|
|
497
|
+
async createEncryptedStatusList(request, response) {
|
|
498
|
+
// collect request parameters - case: body
|
|
499
|
+
const { did, statusListName, alsoKnownAs, statusListVersion, length, encoding, paymentConditions, feePaymentAddress, feePaymentAmount, feePaymentWindow, } = request.body;
|
|
500
|
+
// collect request parameters - case: query
|
|
501
|
+
const { statusPurpose } = request.query;
|
|
502
|
+
const identityServiceStrategySetup = new IdentityServiceStrategySetup(response.locals.customer.customerId);
|
|
503
|
+
try {
|
|
504
|
+
// create encrypted status list
|
|
505
|
+
const result = (await identityServiceStrategySetup.agent.createEncryptedStatusList2021(did, {
|
|
506
|
+
name: statusListName,
|
|
507
|
+
alsoKnownAs,
|
|
508
|
+
version: statusListVersion,
|
|
509
|
+
}, {
|
|
510
|
+
length,
|
|
511
|
+
encoding,
|
|
512
|
+
statusPurpose,
|
|
513
|
+
paymentConditions,
|
|
514
|
+
feePaymentAddress,
|
|
515
|
+
feePaymentAmount,
|
|
516
|
+
feePaymentWindow,
|
|
517
|
+
}, response.locals.customer));
|
|
518
|
+
// handle error
|
|
519
|
+
if (result.error) {
|
|
520
|
+
return response.status(StatusCodes.BAD_REQUEST).json({
|
|
521
|
+
...result,
|
|
522
|
+
error: result.error?.message || result.error.toString(),
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
// Keep track of resources
|
|
526
|
+
// For now we decided not to store symmetricKey yet
|
|
527
|
+
const trackInfo = {
|
|
528
|
+
name: OperationNameEnum.CREDENTIAL_STATUS_CREATE_ENCRYPTED,
|
|
529
|
+
category: OperationCategoryNameEnum.CREDENTIAL_STATUS,
|
|
530
|
+
customer: response.locals.customer,
|
|
531
|
+
user: response.locals.user,
|
|
532
|
+
data: {
|
|
533
|
+
did,
|
|
534
|
+
resource: result.resourceMetadata,
|
|
535
|
+
encrypted: true,
|
|
536
|
+
symmetricKey: '',
|
|
537
|
+
},
|
|
538
|
+
feePaymentOptions: {},
|
|
539
|
+
};
|
|
540
|
+
// Track operation
|
|
541
|
+
eventTracker.emit('track', trackInfo);
|
|
542
|
+
return response.status(StatusCodes.OK).json({ ...result, encrypted: undefined });
|
|
543
|
+
}
|
|
544
|
+
catch (error) {
|
|
545
|
+
// return catch-all error
|
|
546
|
+
return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
|
|
547
|
+
created: false,
|
|
548
|
+
error: `Internal error: ${error?.message || error}`,
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* @openapi
|
|
554
|
+
*
|
|
555
|
+
* /credential-status/update/unencrypted:
|
|
556
|
+
* post:
|
|
557
|
+
* tags: [ Credential Status ]
|
|
558
|
+
* summary: Update an existing unencrypted StatusList2021 credential status list.
|
|
559
|
+
* parameters:
|
|
560
|
+
* - in: query
|
|
561
|
+
* name: statusAction
|
|
562
|
+
* description: The update action to be performed on the unencrypted status list, can be revoke, suspend or reinstate
|
|
563
|
+
* required: true
|
|
564
|
+
* schema:
|
|
565
|
+
* type: string
|
|
566
|
+
* enum:
|
|
567
|
+
* - revoke
|
|
568
|
+
* - suspend
|
|
569
|
+
* - reinstate
|
|
570
|
+
* requestBody:
|
|
571
|
+
* content:
|
|
572
|
+
* application/x-www-form-urlencoded:
|
|
573
|
+
* schema:
|
|
574
|
+
* $ref: '#/components/schemas/CredentialStatusUpdateUnencryptedRequest'
|
|
575
|
+
* application/json:
|
|
576
|
+
* schema:
|
|
577
|
+
* $ref: '#/components/schemas/CredentialStatusUpdateUnencryptedRequest'
|
|
578
|
+
* responses:
|
|
579
|
+
* 200:
|
|
580
|
+
* description: The request was successful.
|
|
581
|
+
* content:
|
|
582
|
+
* application/json:
|
|
583
|
+
* schema:
|
|
584
|
+
* $ref: '#/components/schemas/CredentialStatusUpdateUnencryptedResult'
|
|
585
|
+
* 400:
|
|
586
|
+
* $ref: '#/components/schemas/InvalidRequest'
|
|
587
|
+
* 401:
|
|
588
|
+
* $ref: '#/components/schemas/UnauthorizedError'
|
|
589
|
+
* 500:
|
|
590
|
+
* $ref: '#/components/schemas/InternalError'
|
|
591
|
+
*/
|
|
592
|
+
async updateUnencryptedStatusList(request, response) {
|
|
593
|
+
// collect request parameters - case: body
|
|
594
|
+
const { did, statusListName, statusListVersion, indices } = request.body;
|
|
595
|
+
// collect request parameters - case: query
|
|
596
|
+
const { statusAction } = request.query;
|
|
597
|
+
// define identity service strategy setup
|
|
598
|
+
const identityServiceStrategySetup = new IdentityServiceStrategySetup(response.locals.customer.customerId);
|
|
599
|
+
// ensure unencrypted status list
|
|
600
|
+
const unencrypted = await identityServiceStrategySetup.agent.searchStatusList2021(did, statusListName, DefaultStatusActionPurposeMap[statusAction]);
|
|
601
|
+
// handle error
|
|
602
|
+
if (unencrypted.error) {
|
|
603
|
+
// handle notFound error
|
|
604
|
+
if (unencrypted.error === 'notFound') {
|
|
605
|
+
return response.status(StatusCodes.NOT_FOUND).json({
|
|
606
|
+
updated: false,
|
|
607
|
+
error: `update: error: status list '${statusListName}' not found`,
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
// handle generic error
|
|
611
|
+
return response.status(StatusCodes.BAD_REQUEST).json({
|
|
612
|
+
updated: false,
|
|
613
|
+
error: `update: error: ${unencrypted.error}`,
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
// validate unencrypted
|
|
617
|
+
if (unencrypted.resource?.metadata?.encrypted)
|
|
618
|
+
return response.status(StatusCodes.BAD_REQUEST).json({
|
|
619
|
+
updated: false,
|
|
620
|
+
error: `update: error: status list '${statusListName}' is encrypted`,
|
|
621
|
+
});
|
|
622
|
+
try {
|
|
623
|
+
// update unencrypted status list
|
|
624
|
+
const result = (await identityServiceStrategySetup.agent.updateUnencryptedStatusList2021(did, {
|
|
625
|
+
indices: typeof indices === 'number' ? [indices] : indices,
|
|
626
|
+
statusListName,
|
|
627
|
+
statusListVersion,
|
|
628
|
+
statusAction,
|
|
629
|
+
}, response.locals.customer));
|
|
630
|
+
// enhance result
|
|
631
|
+
result.updated = (function (that) {
|
|
632
|
+
// validate result - case: revocation
|
|
633
|
+
if (that?.revoked?.every((item) => !!item) &&
|
|
634
|
+
that?.revoked?.length !== 0)
|
|
635
|
+
return true;
|
|
636
|
+
// validate result - case: suspension
|
|
637
|
+
if (that?.suspended?.every((item) => !!item) &&
|
|
638
|
+
that?.suspended?.length !== 0)
|
|
639
|
+
return true;
|
|
640
|
+
// validate result - case: unsuspension
|
|
641
|
+
if (that?.unsuspended?.every((item) => !!item) &&
|
|
642
|
+
that?.unsuspended?.length !== 0)
|
|
643
|
+
return true;
|
|
644
|
+
return false;
|
|
645
|
+
})(result);
|
|
646
|
+
// handle error
|
|
647
|
+
if (result.error) {
|
|
648
|
+
return response.status(StatusCodes.BAD_REQUEST).json({
|
|
649
|
+
...result,
|
|
650
|
+
error: result.error?.message || result.error.toString(),
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
// construct formatted response
|
|
654
|
+
const formatted = {
|
|
655
|
+
updated: true,
|
|
656
|
+
revoked: result?.revoked || undefined,
|
|
657
|
+
suspended: result?.suspended || undefined,
|
|
658
|
+
unsuspended: result?.unsuspended || undefined,
|
|
659
|
+
resource: result.statusList,
|
|
660
|
+
resourceMetadata: result.resourceMetadata,
|
|
661
|
+
};
|
|
662
|
+
// track resource creation
|
|
663
|
+
if (result.resourceMetadata) {
|
|
664
|
+
const trackInfo = {
|
|
665
|
+
category: OperationCategoryNameEnum.CREDENTIAL_STATUS,
|
|
666
|
+
name: OperationNameEnum.CREDENTIAL_STATUS_UPDATE_UNENCRYPTED,
|
|
667
|
+
customer: response.locals.customer,
|
|
668
|
+
user: response.locals.user,
|
|
669
|
+
data: {
|
|
670
|
+
did,
|
|
671
|
+
resource: result.resourceMetadata,
|
|
672
|
+
encrypted: false,
|
|
673
|
+
symmetricKey: '',
|
|
674
|
+
},
|
|
675
|
+
};
|
|
676
|
+
// Track operation
|
|
677
|
+
eventTracker.emit('track', trackInfo);
|
|
678
|
+
}
|
|
679
|
+
return response.status(StatusCodes.OK).json(formatted);
|
|
680
|
+
}
|
|
681
|
+
catch (error) {
|
|
682
|
+
// return catch-all error
|
|
683
|
+
return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
|
|
684
|
+
updated: false,
|
|
685
|
+
error: `Internal error: ${error?.message || error}`,
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* @openapi
|
|
691
|
+
*
|
|
692
|
+
* /credential-status/update/encrypted:
|
|
693
|
+
* post:
|
|
694
|
+
* tags: [ Credential Status ]
|
|
695
|
+
* summary: Update an existing encrypted StatusList2021 credential status list.
|
|
696
|
+
* parameters:
|
|
697
|
+
* - in: query
|
|
698
|
+
* name: statusAction
|
|
699
|
+
* description: The update action to be performed on the encrypted status list, can be revoke, suspend or reinstate
|
|
700
|
+
* required: true
|
|
701
|
+
* schema:
|
|
702
|
+
* type: string
|
|
703
|
+
* enum:
|
|
704
|
+
* - revoke
|
|
705
|
+
* - suspend
|
|
706
|
+
* - reinstate
|
|
707
|
+
* requestBody:
|
|
708
|
+
* content:
|
|
709
|
+
* application/x-www-form-urlencoded:
|
|
710
|
+
* schema:
|
|
711
|
+
* $ref: '#/components/schemas/CredentialStatusUpdateEncryptedFormRequest'
|
|
712
|
+
* application/json:
|
|
713
|
+
* schema:
|
|
714
|
+
* $ref: '#/components/schemas/CredentialStatusUpdateEncryptedJsonRequest'
|
|
715
|
+
* responses:
|
|
716
|
+
* 200:
|
|
717
|
+
* description: The request was successful.
|
|
718
|
+
* content:
|
|
719
|
+
* application/json:
|
|
720
|
+
* schema:
|
|
721
|
+
* $ref: '#/components/schemas/CredentialStatusUpdateEncryptedResult'
|
|
722
|
+
* 400:
|
|
723
|
+
* $ref: '#/components/schemas/InvalidRequest'
|
|
724
|
+
* 401:
|
|
725
|
+
* $ref: '#/components/schemas/UnauthorizedError'
|
|
726
|
+
* 500:
|
|
727
|
+
* $ref: '#/components/schemas/InternalError'
|
|
728
|
+
*/
|
|
729
|
+
async updateEncryptedStatusList(request, response) {
|
|
730
|
+
// collect request parameters - case: body
|
|
731
|
+
const { did, statusListName, statusListVersion, indices, symmetricKey, paymentConditions, feePaymentAddress, feePaymentAmount, feePaymentWindow, } = request.body;
|
|
732
|
+
// collect request parameters - case: query
|
|
733
|
+
const { statusAction } = request.query;
|
|
734
|
+
// define identity service strategy setup
|
|
735
|
+
const identityServiceStrategySetup = new IdentityServiceStrategySetup(response.locals.customer.customerId);
|
|
736
|
+
// ensure encrypted status list
|
|
737
|
+
const encrypted = await identityServiceStrategySetup.agent.searchStatusList2021(did, statusListName, DefaultStatusActionPurposeMap[statusAction]);
|
|
738
|
+
// handle error
|
|
739
|
+
if (encrypted.error) {
|
|
740
|
+
// handle notFound error
|
|
741
|
+
if (encrypted.error === 'notFound') {
|
|
742
|
+
return response.status(StatusCodes.NOT_FOUND).json({
|
|
743
|
+
updated: false,
|
|
744
|
+
error: `update: error: status list '${statusListName}' not found`,
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
// handle generic error
|
|
748
|
+
return response.status(StatusCodes.BAD_REQUEST).json({
|
|
749
|
+
updated: false,
|
|
750
|
+
error: `update: error: ${encrypted.error}`,
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
// validate encrypted
|
|
754
|
+
if (!encrypted.resource?.metadata?.encrypted)
|
|
755
|
+
return response.status(StatusCodes.BAD_REQUEST).json({
|
|
756
|
+
updated: false,
|
|
757
|
+
error: `update: error: status list '${statusListName}' is unencrypted`,
|
|
758
|
+
});
|
|
759
|
+
try {
|
|
760
|
+
// update encrypted status list
|
|
761
|
+
const result = (await identityServiceStrategySetup.agent.updateEncryptedStatusList2021(did, {
|
|
762
|
+
indices: typeof indices === 'number' ? [indices] : indices,
|
|
763
|
+
statusListName,
|
|
764
|
+
statusListVersion,
|
|
765
|
+
statusAction,
|
|
766
|
+
paymentConditions,
|
|
767
|
+
symmetricKey,
|
|
768
|
+
feePaymentAddress,
|
|
769
|
+
feePaymentAmount,
|
|
770
|
+
feePaymentWindow,
|
|
771
|
+
}, response.locals.customer));
|
|
772
|
+
// enhance result
|
|
773
|
+
result.updated = (function (that) {
|
|
774
|
+
// validate result - case: revocation
|
|
775
|
+
if (that?.revoked?.every((item) => !!item) &&
|
|
776
|
+
that?.revoked?.length !== 0)
|
|
777
|
+
return true;
|
|
778
|
+
// validate result - case: suspension
|
|
779
|
+
if (that?.suspended?.every((item) => !!item) &&
|
|
780
|
+
that?.suspended?.length !== 0)
|
|
781
|
+
return true;
|
|
782
|
+
// validate result - case: unsuspension
|
|
783
|
+
if (that?.unsuspended?.every((item) => !!item) &&
|
|
784
|
+
that?.unsuspended?.length !== 0)
|
|
785
|
+
return true;
|
|
786
|
+
return false;
|
|
787
|
+
})(result);
|
|
788
|
+
// handle error
|
|
789
|
+
if (result.error)
|
|
790
|
+
return response.status(StatusCodes.BAD_REQUEST).json({
|
|
791
|
+
...result,
|
|
792
|
+
error: result.error?.message || result.error.toString(),
|
|
793
|
+
});
|
|
794
|
+
// construct formatted response
|
|
795
|
+
const formatted = {
|
|
796
|
+
updated: true,
|
|
797
|
+
revoked: result?.revoked || undefined,
|
|
798
|
+
suspended: result?.suspended || undefined,
|
|
799
|
+
unsuspended: result?.unsuspended || undefined,
|
|
800
|
+
resource: result.statusList,
|
|
801
|
+
resourceMetadata: result.resourceMetadata,
|
|
802
|
+
symmetricKey: result.symmetricKey,
|
|
803
|
+
};
|
|
804
|
+
// track resource creation
|
|
805
|
+
if (result.resourceMetadata) {
|
|
806
|
+
const trackInfo = {
|
|
807
|
+
category: OperationCategoryNameEnum.CREDENTIAL_STATUS,
|
|
808
|
+
name: OperationNameEnum.CREDENTIAL_STATUS_UPDATE_ENCRYPTED,
|
|
809
|
+
customer: response.locals.customer,
|
|
810
|
+
user: response.locals.user,
|
|
811
|
+
data: {
|
|
812
|
+
did,
|
|
813
|
+
resource: result.resourceMetadata,
|
|
814
|
+
encrypted: true,
|
|
815
|
+
symmetricKey: '',
|
|
816
|
+
},
|
|
817
|
+
feePaymentOptions: {},
|
|
818
|
+
};
|
|
819
|
+
// Track operation
|
|
820
|
+
eventTracker.emit('track', trackInfo);
|
|
821
|
+
}
|
|
822
|
+
return response.status(StatusCodes.OK).json(formatted);
|
|
823
|
+
}
|
|
824
|
+
catch (error) {
|
|
825
|
+
// return catch-all error
|
|
826
|
+
return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
|
|
827
|
+
updated: false,
|
|
828
|
+
error: `Internal error: ${error?.message || error}`,
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* @openapi
|
|
834
|
+
*
|
|
835
|
+
* /credential-status/check:
|
|
836
|
+
* post:
|
|
837
|
+
* tags: [ Credential Status ]
|
|
838
|
+
* summary: Check a StatusList2021 index for a given Verifiable Credential.
|
|
839
|
+
* description: This endpoint checks a StatusList2021 index for a given Verifiable Credential and reports whether it is revoked or suspended. It offers a standalone method for checking an index without passing the entire Verifiable Credential or Verifiable Presentation.
|
|
840
|
+
* parameters:
|
|
841
|
+
* - in: query
|
|
842
|
+
* name: statusPurpose
|
|
843
|
+
* description: The purpose of the status list. Can be either revocation or suspension.
|
|
844
|
+
* required: true
|
|
845
|
+
* schema:
|
|
846
|
+
* type: string
|
|
847
|
+
* enum:
|
|
848
|
+
* - revocation
|
|
849
|
+
* - suspension
|
|
850
|
+
* requestBody:
|
|
851
|
+
* content:
|
|
852
|
+
* application/x-www-form-urlencoded:
|
|
853
|
+
* schema:
|
|
854
|
+
* $ref: '#/components/schemas/CredentialStatusCheckRequest'
|
|
855
|
+
* application/json:
|
|
856
|
+
* schema:
|
|
857
|
+
* $ref: '#/components/schemas/CredentialStatusCheckRequest'
|
|
858
|
+
* responses:
|
|
859
|
+
* 200:
|
|
860
|
+
* description: The request was successful.
|
|
861
|
+
* content:
|
|
862
|
+
* application/json:
|
|
863
|
+
* schema:
|
|
864
|
+
* $ref: '#/components/schemas/CredentialStatusCheckResult'
|
|
865
|
+
* 400:
|
|
866
|
+
* $ref: '#/components/schemas/InvalidRequest'
|
|
867
|
+
* 401:
|
|
868
|
+
* $ref: '#/components/schemas/UnauthorizedError'
|
|
869
|
+
* 500:
|
|
870
|
+
* $ref: '#/components/schemas/InternalError'
|
|
871
|
+
*/
|
|
872
|
+
async checkStatusList(request, response) {
|
|
873
|
+
const feePaymentOptions = [];
|
|
874
|
+
// Make the base body for tracking
|
|
875
|
+
const trackInfo = {
|
|
876
|
+
name: OperationNameEnum.CREDENTIAL_STATUS_CHECK,
|
|
877
|
+
category: OperationCategoryNameEnum.CREDENTIAL_STATUS,
|
|
878
|
+
customer: response.locals.customer,
|
|
879
|
+
user: response.locals.user,
|
|
880
|
+
successful: false,
|
|
881
|
+
};
|
|
882
|
+
// collect request parameters - case: body
|
|
883
|
+
const { did, statusListName, index, makeFeePayment } = request.body;
|
|
884
|
+
// collect request parameters - case: query
|
|
885
|
+
const { statusPurpose } = request.query;
|
|
886
|
+
// define identity service strategy setup
|
|
887
|
+
const identityServiceStrategySetup = new IdentityServiceStrategySetup(response.locals.customer.customerId);
|
|
888
|
+
// ensure status list
|
|
889
|
+
const statusList = await identityServiceStrategySetup.agent.searchStatusList2021(did, statusListName, statusPurpose);
|
|
890
|
+
// handle error
|
|
891
|
+
if (statusList.error) {
|
|
892
|
+
// handle notFound error
|
|
893
|
+
if (statusList.error === 'notFound') {
|
|
894
|
+
return response.status(StatusCodes.NOT_FOUND).json({
|
|
895
|
+
checked: false,
|
|
896
|
+
error: `check: error: status list '${statusListName}' not found`,
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
// handle generic error
|
|
900
|
+
return response.status(StatusCodes.BAD_REQUEST).json({
|
|
901
|
+
checked: false,
|
|
902
|
+
error: `check: error: ${statusList.error}`,
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
try {
|
|
906
|
+
// make fee payment, if defined
|
|
907
|
+
if (makeFeePayment && statusList?.resource?.metadata?.encrypted) {
|
|
908
|
+
// make fee payment
|
|
909
|
+
const feePaymentResult = await Promise.all(statusList?.resource?.metadata?.paymentConditions?.map(async (condition) => {
|
|
910
|
+
return await identityServiceStrategySetup.agent.remunerateStatusList2021({
|
|
911
|
+
feePaymentAddress: condition.feePaymentAddress,
|
|
912
|
+
feePaymentAmount: condition.feePaymentAmount,
|
|
913
|
+
feePaymentNetwork: toNetwork(did),
|
|
914
|
+
memo: 'Automated status check fee payment, orchestrated by CaaS.',
|
|
915
|
+
}, response.locals.customer);
|
|
916
|
+
}) || []);
|
|
917
|
+
// Track the operation
|
|
918
|
+
await Promise.all(feePaymentResult.map(async (result) => {
|
|
919
|
+
const portion = await FeeAnalyzer.getPaymentTrack(result, toNetwork(did));
|
|
920
|
+
feePaymentOptions.push(...portion);
|
|
921
|
+
}));
|
|
922
|
+
// handle error
|
|
923
|
+
if (feePaymentResult.some((result) => result.error)) {
|
|
924
|
+
// Track payment information even in case of error
|
|
925
|
+
trackInfo.data = {
|
|
926
|
+
did: did,
|
|
927
|
+
resource: statusList.resourceMetadata,
|
|
928
|
+
encrypted: statusList.resource?.metadata?.encrypted,
|
|
929
|
+
};
|
|
930
|
+
trackInfo.successful = false;
|
|
931
|
+
trackInfo.feePaymentOptions = feePaymentOptions;
|
|
932
|
+
// Track operation
|
|
933
|
+
eventTracker.emit('track', trackInfo);
|
|
934
|
+
return response.status(StatusCodes.BAD_REQUEST).json({
|
|
935
|
+
checked: false,
|
|
936
|
+
error: `check: payment: error: ${feePaymentResult.find((result) => result.error)?.error}`,
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
// check status list
|
|
941
|
+
const result = await identityServiceStrategySetup.agent.checkStatusList2021(did, {
|
|
942
|
+
statusListIndex: index,
|
|
943
|
+
statusListName,
|
|
944
|
+
statusPurpose,
|
|
945
|
+
}, response.locals.customer);
|
|
946
|
+
// handle error
|
|
947
|
+
if (result.error) {
|
|
948
|
+
return response.status(StatusCodes.BAD_REQUEST).json(result);
|
|
949
|
+
}
|
|
950
|
+
(trackInfo.data = {
|
|
951
|
+
did: did,
|
|
952
|
+
resource: statusList.resourceMetadata,
|
|
953
|
+
encrypted: statusList.resource?.metadata?.encrypted,
|
|
954
|
+
}),
|
|
955
|
+
(trackInfo.successful = true);
|
|
956
|
+
trackInfo.feePaymentOptions = feePaymentOptions;
|
|
957
|
+
// Track operation
|
|
958
|
+
eventTracker.emit('track', trackInfo);
|
|
959
|
+
// return result
|
|
960
|
+
return response.status(StatusCodes.OK).json(result);
|
|
961
|
+
}
|
|
962
|
+
catch (error) {
|
|
963
|
+
// define error
|
|
964
|
+
const errorRef = error;
|
|
965
|
+
// handle doesn't meet condition
|
|
966
|
+
if (errorRef?.errorCode === 'NodeAccessControlConditionsReturnedNotAuthorized')
|
|
967
|
+
return response.status(StatusCodes.UNAUTHORIZED).json({
|
|
968
|
+
checked: false,
|
|
969
|
+
error: `check: error: ${errorRef?.message
|
|
970
|
+
? 'unauthorised: decryption conditions are not met'
|
|
971
|
+
: error.toString()}`,
|
|
972
|
+
});
|
|
973
|
+
// handle incorrect access control conditions
|
|
974
|
+
if (errorRef?.errorCode === 'incorrect_access_control_conditions')
|
|
975
|
+
return response.status(StatusCodes.BAD_REQUEST).json({
|
|
976
|
+
checked: false,
|
|
977
|
+
error: `check: error: ${errorRef?.message
|
|
978
|
+
? 'incorrect access control conditions'
|
|
979
|
+
: error.toString()}`,
|
|
980
|
+
});
|
|
981
|
+
// return catch-all error
|
|
982
|
+
return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
|
|
983
|
+
checked: false,
|
|
984
|
+
error: `Internal error: ${errorRef?.message || errorRef.toString()}`,
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* @openapi
|
|
990
|
+
*
|
|
991
|
+
* /credential-status/search:
|
|
992
|
+
* get:
|
|
993
|
+
* tags: [ Credential Status ]
|
|
994
|
+
* summary: Fetch StatusList2021 DID-Linked Resource based on search criteria.
|
|
995
|
+
* parameters:
|
|
996
|
+
* - in: query
|
|
997
|
+
* name: did
|
|
998
|
+
* description: The DID of the issuer of the status list.
|
|
999
|
+
* required: true
|
|
1000
|
+
* schema:
|
|
1001
|
+
* type: string
|
|
1002
|
+
* - in: query
|
|
1003
|
+
* name: statusPurpose
|
|
1004
|
+
* description: The purpose of the status list. Can be either revocation or suspension.
|
|
1005
|
+
* schema:
|
|
1006
|
+
* type: string
|
|
1007
|
+
* enum:
|
|
1008
|
+
* - revocation
|
|
1009
|
+
* - suspension
|
|
1010
|
+
* - in: query
|
|
1011
|
+
* name: statusListName
|
|
1012
|
+
* description: The name of the StatusList2021 DID-Linked Resource.
|
|
1013
|
+
* schema:
|
|
1014
|
+
* type: string
|
|
1015
|
+
* responses:
|
|
1016
|
+
* 200:
|
|
1017
|
+
* description: The request was successful.
|
|
1018
|
+
* content:
|
|
1019
|
+
* application/json:
|
|
1020
|
+
* schema:
|
|
1021
|
+
* $ref: '#/components/schemas/CredentialStatusListSearchResult'
|
|
1022
|
+
* 400:
|
|
1023
|
+
* $ref: '#/components/schemas/InvalidRequest'
|
|
1024
|
+
* 401:
|
|
1025
|
+
* $ref: '#/components/schemas/UnauthorizedError'
|
|
1026
|
+
* 500:
|
|
1027
|
+
* $ref: '#/components/schemas/InternalError'
|
|
1028
|
+
*/
|
|
1029
|
+
async searchStatusList(request, response) {
|
|
1030
|
+
// collect request parameters - case: query
|
|
1031
|
+
const { did, statusListName, statusPurpose } = request.query;
|
|
1032
|
+
try {
|
|
1033
|
+
// search status list
|
|
1034
|
+
const result = await new IdentityServiceStrategySetup().agent.searchStatusList2021(did, statusListName, statusPurpose);
|
|
1035
|
+
// handle error
|
|
1036
|
+
if (result.error) {
|
|
1037
|
+
// handle notFound error
|
|
1038
|
+
if (result.error === 'notFound') {
|
|
1039
|
+
return response.status(StatusCodes.NOT_FOUND).json({
|
|
1040
|
+
found: false,
|
|
1041
|
+
error: `search: error: status list '${statusListName}' not found`,
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
// handle generic error
|
|
1045
|
+
return response.status(StatusCodes.BAD_REQUEST).json({
|
|
1046
|
+
found: false,
|
|
1047
|
+
error: `search: error: ${result.error}`,
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
// return result
|
|
1051
|
+
return response.status(StatusCodes.OK).json(result);
|
|
1052
|
+
}
|
|
1053
|
+
catch (error) {
|
|
1054
|
+
// return catch-all error
|
|
1055
|
+
return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
|
|
1056
|
+
found: false,
|
|
1057
|
+
error: `Internal error: ${error?.message || error}`,
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
__decorate([
|
|
1063
|
+
validate
|
|
1064
|
+
], CredentialStatusController.prototype, "createUnencryptedStatusList", null);
|
|
1065
|
+
__decorate([
|
|
1066
|
+
validate
|
|
1067
|
+
], CredentialStatusController.prototype, "createEncryptedStatusList", null);
|
|
1068
|
+
__decorate([
|
|
1069
|
+
validate
|
|
1070
|
+
], CredentialStatusController.prototype, "updateUnencryptedStatusList", null);
|
|
1071
|
+
__decorate([
|
|
1072
|
+
validate
|
|
1073
|
+
], CredentialStatusController.prototype, "updateEncryptedStatusList", null);
|
|
1074
|
+
__decorate([
|
|
1075
|
+
validate
|
|
1076
|
+
], CredentialStatusController.prototype, "checkStatusList", null);
|
|
1077
|
+
__decorate([
|
|
1078
|
+
validate
|
|
1079
|
+
], CredentialStatusController.prototype, "searchStatusList", null);
|
|
1080
|
+
//# sourceMappingURL=credential-status.js.map
|