@decaf-ts/for-fabric 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/bin/cli.cjs +3 -2
- package/lib/cjs/bin/cli.cjs.map +1 -0
- package/lib/cjs/cli-module.cjs +26 -25
- package/lib/cjs/cli-module.cjs.map +1 -0
- package/lib/cjs/cli-utils.cjs +5 -5
- package/lib/cjs/cli-utils.cjs.map +1 -0
- package/lib/cjs/client/FabricClientAdapter.cjs +46 -40
- package/lib/cjs/client/FabricClientAdapter.cjs.map +1 -0
- package/lib/cjs/client/FabricClientDispatch.cjs +8 -7
- package/lib/cjs/client/FabricClientDispatch.cjs.map +1 -0
- package/lib/cjs/client/FabricClientPaginator.cjs +1 -0
- package/lib/cjs/client/FabricClientPaginator.cjs.map +1 -0
- package/lib/cjs/client/FabricClientRepository.cjs +4 -3
- package/lib/cjs/client/FabricClientRepository.cjs.map +1 -0
- package/lib/cjs/client/FabricClientStatement.cjs +1 -0
- package/lib/cjs/client/FabricClientStatement.cjs.map +1 -0
- package/lib/cjs/client/collections/generation.cjs +3 -2
- package/lib/cjs/client/collections/generation.cjs.map +1 -0
- package/lib/cjs/client/collections/index.cjs +1 -0
- package/lib/cjs/client/collections/index.cjs.map +1 -0
- package/lib/cjs/client/constants.cjs +1 -0
- package/lib/cjs/client/constants.cjs.map +1 -0
- package/lib/cjs/client/crypto.cjs +12 -13
- package/lib/cjs/client/crypto.cjs.map +1 -0
- package/lib/cjs/client/erc20/FabricERC20ClientRepository.cjs +7 -6
- package/lib/cjs/client/erc20/FabricERC20ClientRepository.cjs.map +1 -0
- package/lib/cjs/client/erc20/index.cjs +1 -0
- package/lib/cjs/client/erc20/index.cjs.map +1 -0
- package/lib/cjs/client/fabric-fs.cjs +1 -0
- package/lib/cjs/client/fabric-fs.cjs.map +1 -0
- package/lib/cjs/client/fabric-hsm.cjs +3 -2
- package/lib/cjs/client/fabric-hsm.cjs.map +1 -0
- package/lib/cjs/client/ids/id-extraction.cjs +1 -0
- package/lib/cjs/client/ids/id-extraction.cjs.map +1 -0
- package/lib/cjs/client/ids/index.cjs +1 -0
- package/lib/cjs/client/ids/index.cjs.map +1 -0
- package/lib/cjs/client/index.cjs +10 -9
- package/lib/cjs/client/index.cjs.map +1 -0
- package/lib/cjs/client/indexes/generation.cjs +1 -0
- package/lib/cjs/client/indexes/generation.cjs.map +1 -0
- package/lib/cjs/client/indexes/index.cjs +1 -0
- package/lib/cjs/client/indexes/index.cjs.map +1 -0
- package/lib/cjs/client/logging.cjs +1 -0
- package/lib/cjs/client/logging.cjs.map +1 -0
- package/lib/cjs/client/services/FabricEnrollmentService.cjs +17 -32
- package/lib/cjs/client/services/FabricEnrollmentService.cjs.map +1 -0
- package/lib/cjs/client/services/FabricIdentityService.cjs +15 -14
- package/lib/cjs/client/services/FabricIdentityService.cjs.map +1 -0
- package/lib/cjs/client/services/RegistrationRequestBuilder.cjs +11 -5
- package/lib/cjs/client/services/RegistrationRequestBuilder.cjs.map +1 -0
- package/lib/cjs/client/services/constants.cjs +2 -9
- package/lib/cjs/client/services/constants.cjs.map +1 -0
- package/lib/cjs/client/services/index.cjs +1 -0
- package/lib/cjs/client/services/index.cjs.map +1 -0
- package/lib/cjs/client/types.cjs +1 -0
- package/lib/cjs/client/types.cjs.map +1 -0
- package/lib/cjs/client/utils.cjs +1 -0
- package/lib/cjs/client/utils.cjs.map +1 -0
- package/lib/cjs/contract/Address.cjs +14 -8
- package/lib/cjs/contract/Address.cjs.map +1 -0
- package/lib/cjs/contract/AddressContract.cjs +15 -9
- package/lib/cjs/contract/AddressContract.cjs.map +1 -0
- package/lib/cjs/contract/AuditContract.cjs +15 -9
- package/lib/cjs/contract/AuditContract.cjs.map +1 -0
- package/lib/cjs/contract/BatchContract.cjs +15 -9
- package/lib/cjs/contract/BatchContract.cjs.map +1 -0
- package/lib/cjs/contract/MarketContract.cjs +15 -9
- package/lib/cjs/contract/MarketContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherAuditContract.cjs +15 -9
- package/lib/cjs/contract/OtherAuditContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherBatchContract.cjs +15 -9
- package/lib/cjs/contract/OtherBatchContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherMarketContract.cjs +15 -9
- package/lib/cjs/contract/OtherMarketContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherProductContract.cjs +15 -9
- package/lib/cjs/contract/OtherProductContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherProductImageContract.cjs +15 -9
- package/lib/cjs/contract/OtherProductImageContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherProductSharedContract.cjs +15 -9
- package/lib/cjs/contract/OtherProductSharedContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherProductStrengthContract.cjs +15 -9
- package/lib/cjs/contract/OtherProductStrengthContract.cjs.map +1 -0
- package/lib/cjs/contract/Product.cjs +15 -9
- package/lib/cjs/contract/Product.cjs.map +1 -0
- package/lib/cjs/contract/ProductContract.cjs +15 -9
- package/lib/cjs/contract/ProductContract.cjs.map +1 -0
- package/lib/cjs/contract/ProductStrengthContract.cjs +15 -9
- package/lib/cjs/contract/ProductStrengthContract.cjs.map +1 -0
- package/lib/cjs/contract/SegregatedPrivateDocumentContract.cjs +15 -9
- package/lib/cjs/contract/SegregatedPrivateDocumentContract.cjs.map +1 -0
- package/lib/cjs/contract/SegregatedSharedDocumentContract.cjs +15 -9
- package/lib/cjs/contract/SegregatedSharedDocumentContract.cjs.map +1 -0
- package/lib/cjs/contract/User.cjs +13 -7
- package/lib/cjs/contract/User.cjs.map +1 -0
- package/lib/cjs/contract/UserContract.cjs +15 -9
- package/lib/cjs/contract/UserContract.cjs.map +1 -0
- package/lib/cjs/contract/index.cjs +31 -30
- package/lib/cjs/contract/index.cjs.map +1 -0
- package/lib/cjs/contract/logging-context.cjs +1 -0
- package/lib/cjs/contract/logging-context.cjs.map +1 -0
- package/lib/cjs/contract/models/Audit.cjs +17 -11
- package/lib/cjs/contract/models/Audit.cjs.map +1 -0
- package/lib/cjs/contract/models/BaseIdentifiedModel.cjs +15 -9
- package/lib/cjs/contract/models/BaseIdentifiedModel.cjs.map +1 -0
- package/lib/cjs/contract/models/BaseModel.cjs +13 -7
- package/lib/cjs/contract/models/BaseModel.cjs.map +1 -0
- package/lib/cjs/contract/models/Batch.cjs +24 -18
- package/lib/cjs/contract/models/Batch.cjs.map +1 -0
- package/lib/cjs/contract/models/GtinOwner.cjs +18 -12
- package/lib/cjs/contract/models/GtinOwner.cjs.map +1 -0
- package/lib/cjs/contract/models/History.cjs +15 -9
- package/lib/cjs/contract/models/History.cjs.map +1 -0
- package/lib/cjs/contract/models/Leaflet.cjs +25 -19
- package/lib/cjs/contract/models/Leaflet.cjs.map +1 -0
- package/lib/cjs/contract/models/LeafletFile.cjs +19 -13
- package/lib/cjs/contract/models/LeafletFile.cjs.map +1 -0
- package/lib/cjs/contract/models/Market.cjs +19 -13
- package/lib/cjs/contract/models/Market.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherAudit.cjs +20 -14
- package/lib/cjs/contract/models/OtherAudit.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherBatchShared.cjs +27 -21
- package/lib/cjs/contract/models/OtherBatchShared.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherLeaflet.cjs +27 -21
- package/lib/cjs/contract/models/OtherLeaflet.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherLeafletFile.cjs +18 -12
- package/lib/cjs/contract/models/OtherLeafletFile.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherMarket.cjs +21 -15
- package/lib/cjs/contract/models/OtherMarket.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherProduct.cjs +24 -18
- package/lib/cjs/contract/models/OtherProduct.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherProductImage.cjs +22 -16
- package/lib/cjs/contract/models/OtherProductImage.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherProductShared.cjs +32 -26
- package/lib/cjs/contract/models/OtherProductShared.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherProductStrength.cjs +21 -15
- package/lib/cjs/contract/models/OtherProductStrength.cjs.map +1 -0
- package/lib/cjs/contract/models/Product.cjs +24 -18
- package/lib/cjs/contract/models/Product.cjs.map +1 -0
- package/lib/cjs/contract/models/ProductStrength.cjs +19 -13
- package/lib/cjs/contract/models/ProductStrength.cjs.map +1 -0
- package/lib/cjs/contract/models/SegregatedDocument.cjs +23 -17
- package/lib/cjs/contract/models/SegregatedDocument.cjs.map +1 -0
- package/lib/cjs/contract/models/constants.cjs +3 -4
- package/lib/cjs/contract/models/constants.cjs.map +1 -0
- package/lib/cjs/contract/models/decorators-private.cjs +11 -10
- package/lib/cjs/contract/models/decorators-private.cjs.map +1 -0
- package/lib/cjs/contract/models/decorators.cjs +13 -12
- package/lib/cjs/contract/models/decorators.cjs.map +1 -0
- package/lib/cjs/contract/models/gtin.cjs +13 -7
- package/lib/cjs/contract/models/gtin.cjs.map +1 -0
- package/lib/cjs/contract/models/history-dec.cjs +11 -10
- package/lib/cjs/contract/models/history-dec.cjs.map +1 -0
- package/lib/cjs/contracts/ContractAdapter.cjs +27 -26
- package/lib/cjs/contracts/ContractAdapter.cjs.map +1 -0
- package/lib/cjs/contracts/ContractContext.cjs +1 -0
- package/lib/cjs/contracts/ContractContext.cjs.map +1 -0
- package/lib/cjs/contracts/FabricContractDispatch.cjs +1 -0
- package/lib/cjs/contracts/FabricContractDispatch.cjs.map +1 -0
- package/lib/cjs/contracts/FabricContractPaginator.cjs +5 -4
- package/lib/cjs/contracts/FabricContractPaginator.cjs.map +1 -0
- package/lib/cjs/contracts/FabricContractRepository.cjs +8 -7
- package/lib/cjs/contracts/FabricContractRepository.cjs.map +1 -0
- package/lib/cjs/contracts/FabricContractRepositoryObservableHandler.cjs +3 -2
- package/lib/cjs/contracts/FabricContractRepositoryObservableHandler.cjs.map +1 -0
- package/lib/cjs/contracts/FabricContractSequence.cjs +1 -0
- package/lib/cjs/contracts/FabricContractSequence.cjs.map +1 -0
- package/lib/cjs/contracts/FabricContractStatement.cjs +5 -4
- package/lib/cjs/contracts/FabricContractStatement.cjs.map +1 -0
- package/lib/cjs/contracts/MigrationContract.cjs +20 -14
- package/lib/cjs/contracts/MigrationContract.cjs.map +1 -0
- package/lib/cjs/contracts/PrivateSequence.cjs +11 -5
- package/lib/cjs/contracts/PrivateSequence.cjs.map +1 -0
- package/lib/cjs/contracts/auth/decorators.cjs +3 -2
- package/lib/cjs/contracts/auth/decorators.cjs.map +1 -0
- package/lib/cjs/contracts/auth/index.cjs +1 -0
- package/lib/cjs/contracts/auth/index.cjs.map +1 -0
- package/lib/cjs/contracts/crud/crud-contract.cjs +12 -11
- package/lib/cjs/contracts/crud/crud-contract.cjs.map +1 -0
- package/lib/cjs/contracts/crud/index.cjs +1 -0
- package/lib/cjs/contracts/crud/index.cjs.map +1 -0
- package/lib/cjs/contracts/crud/serialized-crud-contract.cjs +13 -7
- package/lib/cjs/contracts/crud/serialized-crud-contract.cjs.map +1 -0
- package/lib/cjs/contracts/erc20/erc20contract.cjs +53 -47
- package/lib/cjs/contracts/erc20/erc20contract.cjs.map +1 -0
- package/lib/cjs/contracts/erc20/index.cjs +3 -2
- package/lib/cjs/contracts/erc20/index.cjs.map +1 -0
- package/lib/cjs/contracts/erc20/models.cjs +11 -5
- package/lib/cjs/contracts/erc20/models.cjs.map +1 -0
- package/lib/cjs/contracts/index.cjs +1 -0
- package/lib/cjs/contracts/index.cjs.map +1 -0
- package/lib/cjs/contracts/logging.cjs +4 -3
- package/lib/cjs/contracts/logging.cjs.map +1 -0
- package/lib/cjs/contracts/overrides.cjs +3 -2
- package/lib/cjs/contracts/overrides.cjs.map +1 -0
- package/lib/cjs/contracts/types.cjs +1 -0
- package/lib/cjs/contracts/types.cjs.map +1 -0
- package/lib/cjs/contracts/uuid.cjs +1 -0
- package/lib/cjs/contracts/uuid.cjs.map +1 -0
- package/lib/cjs/index.cjs +6 -5
- package/lib/cjs/index.cjs.map +1 -0
- package/lib/cjs/shared/ClientSerializer.cjs +1 -0
- package/lib/cjs/shared/ClientSerializer.cjs.map +1 -0
- package/lib/cjs/shared/DeterministicSerializer.cjs +1 -0
- package/lib/cjs/shared/DeterministicSerializer.cjs.map +1 -0
- package/lib/cjs/shared/SimpleDeterministicSerializer.cjs +3 -2
- package/lib/cjs/shared/SimpleDeterministicSerializer.cjs.map +1 -0
- package/lib/cjs/shared/constants.cjs +3 -18
- package/lib/cjs/shared/constants.cjs.map +1 -0
- package/lib/cjs/shared/decorators.cjs +14 -13
- package/lib/cjs/shared/decorators.cjs.map +1 -0
- package/lib/cjs/shared/erc20/erc20-constants.cjs +2 -9
- package/lib/cjs/shared/erc20/erc20-constants.cjs.map +1 -0
- package/lib/cjs/shared/erc20/index.cjs +1 -0
- package/lib/cjs/shared/erc20/index.cjs.map +1 -0
- package/lib/cjs/shared/errors.cjs +1 -0
- package/lib/cjs/shared/errors.cjs.map +1 -0
- package/lib/cjs/shared/events.cjs +1 -0
- package/lib/cjs/shared/events.cjs.map +1 -0
- package/lib/cjs/shared/fabric-types.cjs +1 -0
- package/lib/cjs/shared/fabric-types.cjs.map +1 -0
- package/lib/cjs/shared/index.cjs +1 -0
- package/lib/cjs/shared/index.cjs.map +1 -0
- package/lib/cjs/shared/interfaces/Checkable.cjs +1 -0
- package/lib/cjs/shared/interfaces/Checkable.cjs.map +1 -0
- package/lib/cjs/shared/interfaces/index.cjs +1 -0
- package/lib/cjs/shared/interfaces/index.cjs.map +1 -0
- package/lib/cjs/shared/math.cjs +4 -3
- package/lib/cjs/shared/math.cjs.map +1 -0
- package/lib/cjs/shared/model/FabricBaseModel.cjs +13 -7
- package/lib/cjs/shared/model/FabricBaseModel.cjs.map +1 -0
- package/lib/cjs/shared/model/FabricIdentifiedBaseModel.cjs +15 -9
- package/lib/cjs/shared/model/FabricIdentifiedBaseModel.cjs.map +1 -0
- package/lib/cjs/shared/model/Identity.cjs +16 -10
- package/lib/cjs/shared/model/Identity.cjs.map +1 -0
- package/lib/cjs/shared/model/IdentityCredentials.cjs +11 -5
- package/lib/cjs/shared/model/IdentityCredentials.cjs.map +1 -0
- package/lib/cjs/shared/model/index.cjs +1 -0
- package/lib/cjs/shared/model/index.cjs.map +1 -0
- package/lib/cjs/shared/overrides/Model.cjs +1 -0
- package/lib/cjs/shared/overrides/Model.cjs.map +1 -0
- package/lib/cjs/shared/overrides/index.cjs +1 -0
- package/lib/cjs/shared/overrides/index.cjs.map +1 -0
- package/lib/cjs/shared/overrides/overrides.cjs +11 -10
- package/lib/cjs/shared/overrides/overrides.cjs.map +1 -0
- package/lib/cjs/shared/types.cjs +1 -0
- package/lib/cjs/shared/types.cjs.map +1 -0
- package/lib/cjs/version.cjs +2 -1
- package/lib/cjs/version.cjs.map +1 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/bin/cli.d.cts +1 -0
- package/lib/types/bin/cli.d.mts +1 -0
- package/lib/types/cli-module.d.cts +3 -0
- package/lib/types/cli-module.d.mts +3 -0
- package/lib/types/cli-utils.d.cts +21 -0
- package/lib/types/cli-utils.d.mts +21 -0
- package/lib/types/client/FabricClientAdapter.d.cts +404 -0
- package/lib/types/client/FabricClientAdapter.d.mts +404 -0
- package/lib/types/client/FabricClientDispatch.d.cts +133 -0
- package/lib/types/client/FabricClientDispatch.d.mts +133 -0
- package/lib/types/client/FabricClientPaginator.d.cts +12 -0
- package/lib/types/client/FabricClientPaginator.d.mts +12 -0
- package/lib/types/client/FabricClientRepository.d.cts +71 -0
- package/lib/types/client/FabricClientRepository.d.mts +71 -0
- package/lib/types/client/FabricClientStatement.d.cts +64 -0
- package/lib/types/client/FabricClientStatement.d.mts +64 -0
- package/lib/types/client/collections/generation.d.cts +46 -0
- package/lib/types/client/collections/generation.d.mts +46 -0
- package/lib/types/client/collections/index.d.cts +1 -0
- package/lib/types/client/collections/index.d.mts +1 -0
- package/lib/types/client/constants.d.cts +2 -0
- package/lib/types/client/constants.d.mts +2 -0
- package/lib/types/client/crypto.d.cts +107 -0
- package/lib/types/client/crypto.d.mts +107 -0
- package/lib/types/client/erc20/FabricERC20ClientRepository.d.cts +254 -0
- package/lib/types/client/erc20/FabricERC20ClientRepository.d.mts +254 -0
- package/lib/types/client/erc20/index.d.cts +1 -0
- package/lib/types/client/erc20/index.d.mts +1 -0
- package/lib/types/client/fabric-fs.d.cts +92 -0
- package/lib/types/client/fabric-fs.d.mts +92 -0
- package/lib/types/client/fabric-hsm.d.cts +24 -0
- package/lib/types/client/fabric-hsm.d.mts +24 -0
- package/lib/types/client/ids/id-extraction.d.cts +4 -0
- package/lib/types/client/ids/id-extraction.d.mts +4 -0
- package/lib/types/client/ids/index.d.cts +1 -0
- package/lib/types/client/ids/index.d.mts +1 -0
- package/lib/types/client/index.d.cts +23 -0
- package/lib/types/client/index.d.mts +23 -0
- package/lib/types/client/indexes/generation.d.cts +10 -0
- package/lib/types/client/indexes/generation.d.mts +10 -0
- package/lib/types/client/indexes/index.d.cts +1 -0
- package/lib/types/client/indexes/index.d.mts +1 -0
- package/lib/types/client/logging.d.cts +60 -0
- package/lib/types/client/logging.d.mts +60 -0
- package/lib/types/client/services/FabricEnrollmentService.d.cts +176 -0
- package/lib/types/client/services/FabricEnrollmentService.d.mts +176 -0
- package/lib/types/client/services/FabricIdentityService.d.cts +98 -0
- package/lib/types/client/services/FabricIdentityService.d.mts +98 -0
- package/lib/types/client/services/RegistrationRequestBuilder.d.cts +19 -0
- package/lib/types/client/services/RegistrationRequestBuilder.d.mts +19 -0
- package/lib/types/client/services/constants.d.cts +15 -0
- package/lib/types/client/services/constants.d.mts +15 -0
- package/lib/types/client/services/index.d.cts +4 -0
- package/lib/types/client/services/index.d.mts +4 -0
- package/lib/types/client/types.d.cts +20 -0
- package/lib/types/client/types.d.mts +20 -0
- package/lib/types/client/utils.d.cts +71 -0
- package/lib/types/client/utils.d.mts +71 -0
- package/lib/types/contract/Address.d.cts +13 -0
- package/lib/types/contract/Address.d.mts +13 -0
- package/lib/types/contract/AddressContract.d.cts +5 -0
- package/lib/types/contract/AddressContract.d.mts +5 -0
- package/lib/types/contract/AuditContract.d.cts +5 -0
- package/lib/types/contract/AuditContract.d.mts +5 -0
- package/lib/types/contract/BatchContract.d.cts +5 -0
- package/lib/types/contract/BatchContract.d.mts +5 -0
- package/lib/types/contract/MarketContract.d.cts +5 -0
- package/lib/types/contract/MarketContract.d.mts +5 -0
- package/lib/types/contract/OtherAuditContract.d.cts +5 -0
- package/lib/types/contract/OtherAuditContract.d.mts +5 -0
- package/lib/types/contract/OtherBatchContract.d.cts +5 -0
- package/lib/types/contract/OtherBatchContract.d.mts +5 -0
- package/lib/types/contract/OtherMarketContract.d.cts +5 -0
- package/lib/types/contract/OtherMarketContract.d.mts +5 -0
- package/lib/types/contract/OtherProductContract.d.cts +5 -0
- package/lib/types/contract/OtherProductContract.d.mts +5 -0
- package/lib/types/contract/OtherProductImageContract.d.cts +5 -0
- package/lib/types/contract/OtherProductImageContract.d.mts +5 -0
- package/lib/types/contract/OtherProductSharedContract.d.cts +5 -0
- package/lib/types/contract/OtherProductSharedContract.d.mts +5 -0
- package/lib/types/contract/OtherProductStrengthContract.d.cts +5 -0
- package/lib/types/contract/OtherProductStrengthContract.d.mts +5 -0
- package/lib/types/contract/Product.d.cts +7 -0
- package/lib/types/contract/Product.d.mts +7 -0
- package/lib/types/contract/ProductContract.d.cts +5 -0
- package/lib/types/contract/ProductContract.d.mts +5 -0
- package/lib/types/contract/ProductStrengthContract.d.cts +5 -0
- package/lib/types/contract/ProductStrengthContract.d.mts +5 -0
- package/lib/types/contract/SegregatedPrivateDocumentContract.d.cts +5 -0
- package/lib/types/contract/SegregatedPrivateDocumentContract.d.mts +5 -0
- package/lib/types/contract/SegregatedSharedDocumentContract.d.cts +5 -0
- package/lib/types/contract/SegregatedSharedDocumentContract.d.mts +5 -0
- package/lib/types/contract/User.d.cts +7 -0
- package/lib/types/contract/User.d.mts +7 -0
- package/lib/types/contract/UserContract.d.cts +5 -0
- package/lib/types/contract/UserContract.d.mts +5 -0
- package/lib/types/contract/index.d.cts +2 -0
- package/lib/types/contract/index.d.mts +2 -0
- package/lib/types/contract/logging-context.d.cts +8 -0
- package/lib/types/contract/logging-context.d.mts +8 -0
- package/lib/types/contract/models/Audit.d.cts +13 -0
- package/lib/types/contract/models/Audit.d.mts +13 -0
- package/lib/types/contract/models/BaseIdentifiedModel.d.cts +7 -0
- package/lib/types/contract/models/BaseIdentifiedModel.d.mts +7 -0
- package/lib/types/contract/models/BaseModel.d.cts +7 -0
- package/lib/types/contract/models/BaseModel.d.mts +7 -0
- package/lib/types/contract/models/Batch.d.cts +18 -0
- package/lib/types/contract/models/Batch.d.mts +18 -0
- package/lib/types/contract/models/GtinOwner.d.cts +8 -0
- package/lib/types/contract/models/GtinOwner.d.mts +8 -0
- package/lib/types/contract/models/History.d.cts +9 -0
- package/lib/types/contract/models/History.d.mts +9 -0
- package/lib/types/contract/models/Leaflet.d.cts +12 -0
- package/lib/types/contract/models/Leaflet.d.mts +12 -0
- package/lib/types/contract/models/LeafletFile.d.cts +9 -0
- package/lib/types/contract/models/LeafletFile.d.mts +9 -0
- package/lib/types/contract/models/Market.d.cts +12 -0
- package/lib/types/contract/models/Market.d.mts +12 -0
- package/lib/types/contract/models/OtherAudit.d.cts +15 -0
- package/lib/types/contract/models/OtherAudit.d.mts +15 -0
- package/lib/types/contract/models/OtherBatchShared.d.cts +18 -0
- package/lib/types/contract/models/OtherBatchShared.d.mts +18 -0
- package/lib/types/contract/models/OtherLeaflet.d.cts +16 -0
- package/lib/types/contract/models/OtherLeaflet.d.mts +16 -0
- package/lib/types/contract/models/OtherLeafletFile.d.cts +10 -0
- package/lib/types/contract/models/OtherLeafletFile.d.mts +10 -0
- package/lib/types/contract/models/OtherMarket.d.cts +13 -0
- package/lib/types/contract/models/OtherMarket.d.mts +13 -0
- package/lib/types/contract/models/OtherProduct.d.cts +12 -0
- package/lib/types/contract/models/OtherProduct.d.mts +12 -0
- package/lib/types/contract/models/OtherProductImage.d.cts +9 -0
- package/lib/types/contract/models/OtherProductImage.d.mts +9 -0
- package/lib/types/contract/models/OtherProductShared.d.cts +18 -0
- package/lib/types/contract/models/OtherProductShared.d.mts +18 -0
- package/lib/types/contract/models/OtherProductStrength.d.cts +12 -0
- package/lib/types/contract/models/OtherProductStrength.d.mts +12 -0
- package/lib/types/contract/models/Product.d.cts +15 -0
- package/lib/types/contract/models/Product.d.mts +15 -0
- package/lib/types/contract/models/ProductStrength.d.cts +11 -0
- package/lib/types/contract/models/ProductStrength.d.mts +11 -0
- package/lib/types/contract/models/SegregatedDocument.d.cts +18 -0
- package/lib/types/contract/models/SegregatedDocument.d.mts +18 -0
- package/lib/types/contract/models/constants.d.cts +24 -0
- package/lib/types/contract/models/constants.d.mts +24 -0
- package/lib/types/contract/models/decorators-private.d.cts +16 -0
- package/lib/types/contract/models/decorators-private.d.mts +16 -0
- package/lib/types/contract/models/decorators.d.cts +28 -0
- package/lib/types/contract/models/decorators.d.mts +28 -0
- package/lib/types/contract/models/gtin.d.cts +8 -0
- package/lib/types/contract/models/gtin.d.mts +8 -0
- package/lib/types/contract/models/history-dec.d.cts +6 -0
- package/lib/types/contract/models/history-dec.d.mts +6 -0
- package/lib/types/contracts/ContractAdapter.d.cts +287 -0
- package/lib/types/contracts/ContractAdapter.d.mts +287 -0
- package/lib/types/contracts/ContractContext.d.cts +89 -0
- package/lib/types/contracts/ContractContext.d.mts +89 -0
- package/lib/types/contracts/FabricContractDispatch.d.cts +7 -0
- package/lib/types/contracts/FabricContractDispatch.d.mts +7 -0
- package/lib/types/contracts/FabricContractPaginator.d.cts +105 -0
- package/lib/types/contracts/FabricContractPaginator.d.mts +105 -0
- package/lib/types/contracts/FabricContractRepository.d.cts +119 -0
- package/lib/types/contracts/FabricContractRepository.d.mts +119 -0
- package/lib/types/contracts/FabricContractRepositoryObservableHandler.d.cts +62 -0
- package/lib/types/contracts/FabricContractRepositoryObservableHandler.d.mts +62 -0
- package/lib/types/contracts/FabricContractSequence.d.cts +87 -0
- package/lib/types/contracts/FabricContractSequence.d.mts +87 -0
- package/lib/types/contracts/FabricContractStatement.d.cts +36 -0
- package/lib/types/contracts/FabricContractStatement.d.mts +36 -0
- package/lib/types/contracts/MigrationContract.d.cts +22 -0
- package/lib/types/contracts/MigrationContract.d.mts +22 -0
- package/lib/types/contracts/PrivateSequence.d.cts +15 -0
- package/lib/types/contracts/PrivateSequence.d.mts +15 -0
- package/lib/types/contracts/auth/decorators.d.cts +6 -0
- package/lib/types/contracts/auth/decorators.d.mts +6 -0
- package/lib/types/contracts/auth/index.d.cts +1 -0
- package/lib/types/contracts/auth/index.d.mts +1 -0
- package/lib/types/contracts/crud/crud-contract.d.cts +199 -0
- package/lib/types/contracts/crud/crud-contract.d.mts +199 -0
- package/lib/types/contracts/crud/index.d.cts +2 -0
- package/lib/types/contracts/crud/index.d.mts +2 -0
- package/lib/types/contracts/crud/serialized-crud-contract.d.cts +42 -0
- package/lib/types/contracts/crud/serialized-crud-contract.d.mts +42 -0
- package/lib/types/contracts/erc20/erc20contract.d.cts +152 -0
- package/lib/types/contracts/erc20/erc20contract.d.mts +152 -0
- package/lib/types/contracts/erc20/index.d.cts +2 -0
- package/lib/types/contracts/erc20/index.d.mts +2 -0
- package/lib/types/contracts/erc20/models.d.cts +114 -0
- package/lib/types/contracts/erc20/models.d.mts +114 -0
- package/lib/types/contracts/index.d.cts +20 -0
- package/lib/types/contracts/index.d.mts +20 -0
- package/lib/types/contracts/logging.d.cts +54 -0
- package/lib/types/contracts/logging.d.mts +54 -0
- package/lib/types/contracts/overrides.d.cts +1 -0
- package/lib/types/contracts/overrides.d.mts +1 -0
- package/lib/types/contracts/types.d.cts +38 -0
- package/lib/types/contracts/types.d.mts +38 -0
- package/lib/types/contracts/uuid.d.cts +2 -0
- package/lib/types/contracts/uuid.d.mts +2 -0
- package/lib/types/index.d.cts +8 -0
- package/lib/types/index.d.mts +8 -0
- package/lib/types/shared/ClientSerializer.d.cts +52 -0
- package/lib/types/shared/ClientSerializer.d.mts +52 -0
- package/lib/types/shared/DeterministicSerializer.d.cts +47 -0
- package/lib/types/shared/DeterministicSerializer.d.mts +47 -0
- package/lib/types/shared/SimpleDeterministicSerializer.d.cts +7 -0
- package/lib/types/shared/SimpleDeterministicSerializer.d.mts +7 -0
- package/lib/types/shared/constants.d.cts +35 -0
- package/lib/types/shared/constants.d.mts +35 -0
- package/lib/types/shared/decorators.d.cts +81 -0
- package/lib/types/shared/decorators.d.mts +81 -0
- package/lib/types/shared/erc20/erc20-constants.d.cts +25 -0
- package/lib/types/shared/erc20/erc20-constants.d.mts +25 -0
- package/lib/types/shared/erc20/index.d.cts +1 -0
- package/lib/types/shared/erc20/index.d.mts +1 -0
- package/lib/types/shared/errors.d.cts +140 -0
- package/lib/types/shared/errors.d.mts +140 -0
- package/lib/types/shared/events.d.cts +37 -0
- package/lib/types/shared/events.d.mts +37 -0
- package/lib/types/shared/fabric-types.d.cts +32 -0
- package/lib/types/shared/fabric-types.d.mts +32 -0
- package/lib/types/shared/index.d.cts +21 -0
- package/lib/types/shared/index.d.mts +21 -0
- package/lib/types/shared/interfaces/Checkable.d.cts +23 -0
- package/lib/types/shared/interfaces/Checkable.d.mts +23 -0
- package/lib/types/shared/interfaces/index.d.cts +1 -0
- package/lib/types/shared/interfaces/index.d.mts +1 -0
- package/lib/types/shared/math.d.cts +34 -0
- package/lib/types/shared/math.d.mts +34 -0
- package/lib/types/shared/model/FabricBaseModel.d.cts +7 -0
- package/lib/types/shared/model/FabricBaseModel.d.mts +7 -0
- package/lib/types/shared/model/FabricIdentifiedBaseModel.d.cts +7 -0
- package/lib/types/shared/model/FabricIdentifiedBaseModel.d.mts +7 -0
- package/lib/types/shared/model/Identity.d.cts +42 -0
- package/lib/types/shared/model/Identity.d.mts +42 -0
- package/lib/types/shared/model/IdentityCredentials.d.cts +41 -0
- package/lib/types/shared/model/IdentityCredentials.d.mts +41 -0
- package/lib/types/shared/model/index.d.cts +4 -0
- package/lib/types/shared/model/index.d.mts +4 -0
- package/lib/types/shared/overrides/Model.d.cts +22 -0
- package/lib/types/shared/overrides/Model.d.mts +22 -0
- package/lib/types/shared/overrides/index.d.cts +2 -0
- package/lib/types/shared/overrides/index.d.mts +2 -0
- package/lib/types/shared/overrides/overrides.d.cts +1 -0
- package/lib/types/shared/overrides/overrides.d.mts +1 -0
- package/lib/types/shared/types.d.cts +125 -0
- package/lib/types/shared/types.d.mts +125 -0
- package/lib/types/version.d.cts +2 -0
- package/lib/types/version.d.mts +2 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +10 -10
- package/lib/cjs/bin/cli.js.map +0 -1
- package/lib/cjs/cli-module.js.map +0 -1
- package/lib/cjs/cli-utils.js.map +0 -1
- package/lib/cjs/client/FabricClientAdapter.js.map +0 -1
- package/lib/cjs/client/FabricClientDispatch.js.map +0 -1
- package/lib/cjs/client/FabricClientPaginator.js.map +0 -1
- package/lib/cjs/client/FabricClientRepository.js.map +0 -1
- package/lib/cjs/client/FabricClientStatement.js.map +0 -1
- package/lib/cjs/client/collections/generation.js.map +0 -1
- package/lib/cjs/client/collections/index.js.map +0 -1
- package/lib/cjs/client/constants.js.map +0 -1
- package/lib/cjs/client/crypto.js.map +0 -1
- package/lib/cjs/client/erc20/FabricERC20ClientRepository.js.map +0 -1
- package/lib/cjs/client/erc20/index.js.map +0 -1
- package/lib/cjs/client/fabric-fs.js.map +0 -1
- package/lib/cjs/client/fabric-hsm.js.map +0 -1
- package/lib/cjs/client/ids/id-extraction.js.map +0 -1
- package/lib/cjs/client/ids/index.js.map +0 -1
- package/lib/cjs/client/index.js.map +0 -1
- package/lib/cjs/client/indexes/generation.js.map +0 -1
- package/lib/cjs/client/indexes/index.js.map +0 -1
- package/lib/cjs/client/logging.js.map +0 -1
- package/lib/cjs/client/services/FabricEnrollmentService.js.map +0 -1
- package/lib/cjs/client/services/FabricIdentityService.js.map +0 -1
- package/lib/cjs/client/services/RegistrationRequestBuilder.js.map +0 -1
- package/lib/cjs/client/services/constants.js.map +0 -1
- package/lib/cjs/client/services/index.js.map +0 -1
- package/lib/cjs/client/types.js.map +0 -1
- package/lib/cjs/client/utils.js.map +0 -1
- package/lib/cjs/contract/Address.js.map +0 -1
- package/lib/cjs/contract/AddressContract.js.map +0 -1
- package/lib/cjs/contract/AuditContract.js.map +0 -1
- package/lib/cjs/contract/BatchContract.js.map +0 -1
- package/lib/cjs/contract/MarketContract.js.map +0 -1
- package/lib/cjs/contract/OtherAuditContract.js.map +0 -1
- package/lib/cjs/contract/OtherBatchContract.js.map +0 -1
- package/lib/cjs/contract/OtherMarketContract.js.map +0 -1
- package/lib/cjs/contract/OtherProductContract.js.map +0 -1
- package/lib/cjs/contract/OtherProductImageContract.js.map +0 -1
- package/lib/cjs/contract/OtherProductSharedContract.js.map +0 -1
- package/lib/cjs/contract/OtherProductStrengthContract.js.map +0 -1
- package/lib/cjs/contract/Product.js.map +0 -1
- package/lib/cjs/contract/ProductContract.js.map +0 -1
- package/lib/cjs/contract/ProductStrengthContract.js.map +0 -1
- package/lib/cjs/contract/SegregatedPrivateDocumentContract.js.map +0 -1
- package/lib/cjs/contract/SegregatedSharedDocumentContract.js.map +0 -1
- package/lib/cjs/contract/User.js.map +0 -1
- package/lib/cjs/contract/UserContract.js.map +0 -1
- package/lib/cjs/contract/index.js.map +0 -1
- package/lib/cjs/contract/logging-context.js.map +0 -1
- package/lib/cjs/contract/models/Audit.js.map +0 -1
- package/lib/cjs/contract/models/BaseIdentifiedModel.js.map +0 -1
- package/lib/cjs/contract/models/BaseModel.js.map +0 -1
- package/lib/cjs/contract/models/Batch.js.map +0 -1
- package/lib/cjs/contract/models/GtinOwner.js.map +0 -1
- package/lib/cjs/contract/models/History.js.map +0 -1
- package/lib/cjs/contract/models/Leaflet.js.map +0 -1
- package/lib/cjs/contract/models/LeafletFile.js.map +0 -1
- package/lib/cjs/contract/models/Market.js.map +0 -1
- package/lib/cjs/contract/models/OtherAudit.js.map +0 -1
- package/lib/cjs/contract/models/OtherBatchShared.js.map +0 -1
- package/lib/cjs/contract/models/OtherLeaflet.js.map +0 -1
- package/lib/cjs/contract/models/OtherLeafletFile.js.map +0 -1
- package/lib/cjs/contract/models/OtherMarket.js.map +0 -1
- package/lib/cjs/contract/models/OtherProduct.js.map +0 -1
- package/lib/cjs/contract/models/OtherProductImage.js.map +0 -1
- package/lib/cjs/contract/models/OtherProductShared.js.map +0 -1
- package/lib/cjs/contract/models/OtherProductStrength.js.map +0 -1
- package/lib/cjs/contract/models/Product.js.map +0 -1
- package/lib/cjs/contract/models/ProductStrength.js.map +0 -1
- package/lib/cjs/contract/models/SegregatedDocument.js.map +0 -1
- package/lib/cjs/contract/models/constants.js.map +0 -1
- package/lib/cjs/contract/models/decorators-private.js.map +0 -1
- package/lib/cjs/contract/models/decorators.js.map +0 -1
- package/lib/cjs/contract/models/gtin.js.map +0 -1
- package/lib/cjs/contract/models/history-dec.js.map +0 -1
- package/lib/cjs/contracts/ContractAdapter.js.map +0 -1
- package/lib/cjs/contracts/ContractContext.js.map +0 -1
- package/lib/cjs/contracts/FabricContractDispatch.js.map +0 -1
- package/lib/cjs/contracts/FabricContractPaginator.js.map +0 -1
- package/lib/cjs/contracts/FabricContractRepository.js.map +0 -1
- package/lib/cjs/contracts/FabricContractRepositoryObservableHandler.js.map +0 -1
- package/lib/cjs/contracts/FabricContractSequence.js.map +0 -1
- package/lib/cjs/contracts/FabricContractStatement.js.map +0 -1
- package/lib/cjs/contracts/MigrationContract.js.map +0 -1
- package/lib/cjs/contracts/PrivateSequence.js.map +0 -1
- package/lib/cjs/contracts/auth/decorators.js.map +0 -1
- package/lib/cjs/contracts/auth/index.js.map +0 -1
- package/lib/cjs/contracts/crud/crud-contract.js.map +0 -1
- package/lib/cjs/contracts/crud/index.js.map +0 -1
- package/lib/cjs/contracts/crud/serialized-crud-contract.js.map +0 -1
- package/lib/cjs/contracts/erc20/erc20contract.js.map +0 -1
- package/lib/cjs/contracts/erc20/index.js.map +0 -1
- package/lib/cjs/contracts/erc20/models.js.map +0 -1
- package/lib/cjs/contracts/index.js.map +0 -1
- package/lib/cjs/contracts/logging.js.map +0 -1
- package/lib/cjs/contracts/overrides.js.map +0 -1
- package/lib/cjs/contracts/types.js.map +0 -1
- package/lib/cjs/contracts/uuid.js.map +0 -1
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/shared/ClientSerializer.js.map +0 -1
- package/lib/cjs/shared/DeterministicSerializer.js.map +0 -1
- package/lib/cjs/shared/SimpleDeterministicSerializer.js.map +0 -1
- package/lib/cjs/shared/constants.js.map +0 -1
- package/lib/cjs/shared/decorators.js.map +0 -1
- package/lib/cjs/shared/erc20/erc20-constants.js.map +0 -1
- package/lib/cjs/shared/erc20/index.js.map +0 -1
- package/lib/cjs/shared/errors.js.map +0 -1
- package/lib/cjs/shared/events.js.map +0 -1
- package/lib/cjs/shared/fabric-types.js.map +0 -1
- package/lib/cjs/shared/index.js.map +0 -1
- package/lib/cjs/shared/interfaces/Checkable.js.map +0 -1
- package/lib/cjs/shared/interfaces/index.js.map +0 -1
- package/lib/cjs/shared/math.js.map +0 -1
- package/lib/cjs/shared/model/FabricBaseModel.js.map +0 -1
- package/lib/cjs/shared/model/FabricIdentifiedBaseModel.js.map +0 -1
- package/lib/cjs/shared/model/Identity.js.map +0 -1
- package/lib/cjs/shared/model/IdentityCredentials.js.map +0 -1
- package/lib/cjs/shared/model/index.js.map +0 -1
- package/lib/cjs/shared/overrides/Model.js.map +0 -1
- package/lib/cjs/shared/overrides/index.js.map +0 -1
- package/lib/cjs/shared/overrides/overrides.js.map +0 -1
- package/lib/cjs/shared/types.js.map +0 -1
- package/lib/cjs/version.js.map +0 -1
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import FabricCAServices from "fabric-ca-client";
|
|
2
|
+
import { IEnrollResponse } from "fabric-ca-client";
|
|
3
|
+
import { User } from "fabric-common";
|
|
4
|
+
import { CAConfig, Credentials } from "../../shared/types.js";
|
|
5
|
+
import { Identity } from "../../shared/model/Identity.js";
|
|
6
|
+
import { AuthorizationError } from "@decaf-ts/core";
|
|
7
|
+
import { ConflictError } from "@decaf-ts/db-decorators";
|
|
8
|
+
import { CA_ROLE } from "./constants.js";
|
|
9
|
+
import { CertificateResponse, FabricIdentity, GetCertificatesRequest } from "../../shared/fabric-types.js";
|
|
10
|
+
import { LoggedClass } from "@decaf-ts/logging";
|
|
11
|
+
/**
|
|
12
|
+
* @description Hyperledger Fabric CA identity types.
|
|
13
|
+
* @summary Enumerates the supported identity types recognized by Fabric CA for registration and identity management.
|
|
14
|
+
* @enum {string}
|
|
15
|
+
* @readonly
|
|
16
|
+
* @memberOf module:for-fabric.client
|
|
17
|
+
*/
|
|
18
|
+
export declare enum HFCAIdentityType {
|
|
19
|
+
PEER = "peer",
|
|
20
|
+
ORDERER = "orderer",
|
|
21
|
+
CLIENT = "client",
|
|
22
|
+
USER = "user",
|
|
23
|
+
ADMIN = "admin"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @description Key/value attribute used during CA registration.
|
|
27
|
+
* @summary Represents an attribute entry that can be attached to a Fabric CA identity during registration, optionally marking it for inclusion in ecert.
|
|
28
|
+
* @interface IKeyValueAttribute
|
|
29
|
+
* @template T
|
|
30
|
+
* @param {string} name - Attribute name.
|
|
31
|
+
* @param {string} value - Attribute value.
|
|
32
|
+
* @param {boolean} [ecert] - Whether the attribute should be included in the enrollment certificate (ECert).
|
|
33
|
+
* @memberOf module:for-fabric.client
|
|
34
|
+
*/
|
|
35
|
+
export interface IKeyValueAttribute {
|
|
36
|
+
name: string;
|
|
37
|
+
value: string;
|
|
38
|
+
ecert?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @description Standard Fabric CA identity attribute keys.
|
|
42
|
+
* @summary Enumerates well-known Fabric CA attribute keys that can be assigned to identities for delegations and permissions.
|
|
43
|
+
* @enum {string}
|
|
44
|
+
* @readonly
|
|
45
|
+
* @memberOf module:for-fabric.client
|
|
46
|
+
*/
|
|
47
|
+
export declare enum HFCAIdentityAttributes {
|
|
48
|
+
HFREGISTRARROLES = "hf.Registrar.Roles",
|
|
49
|
+
HFREGISTRARDELEGATEROLES = "hf.Registrar.DelegateRoles",
|
|
50
|
+
HFREGISTRARATTRIBUTES = "hf.Registrar.Attributes",
|
|
51
|
+
HFINTERMEDIATECA = "hf.IntermediateCA",
|
|
52
|
+
HFREVOKER = "hf.Revoker",
|
|
53
|
+
HFAFFILIATIONMGR = "hf.AffiliationMgr",
|
|
54
|
+
HFGENCRL = "hf.GenCRL"
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @description Service wrapper for interacting with a Fabric CA.
|
|
58
|
+
* @summary Provides high-level operations for managing identities against a Hyperledger Fabric Certificate Authority, including registration, enrollment, revocation, and administrative queries. Encapsulates lower-level Fabric CA client calls with consistent logging and error mapping.
|
|
59
|
+
* @param {CAConfig} caConfig - Connection and TLS configuration for the target CA.
|
|
60
|
+
* @class FabricEnrollmentService
|
|
61
|
+
* @example
|
|
62
|
+
* // Register and enroll a new user
|
|
63
|
+
* const svc = new FabricEnrollmentService({
|
|
64
|
+
* url: 'https://localhost:7054',
|
|
65
|
+
* caName: 'Org1CA',
|
|
66
|
+
* tls: { trustedRoots: ['/path/to/ca.pem'], verify: false },
|
|
67
|
+
* caCert: '/path/to/admin/certDir',
|
|
68
|
+
* caKey: '/path/to/admin/keyDir'
|
|
69
|
+
* });
|
|
70
|
+
* await svc.register({ userName: 'alice', password: 's3cr3t' }, false, 'org1.department1', CA_ROLE.USER);
|
|
71
|
+
* const id = await svc.enroll('alice', 's3cr3t');
|
|
72
|
+
* @mermaid
|
|
73
|
+
* sequenceDiagram
|
|
74
|
+
* autonumber
|
|
75
|
+
* participant App
|
|
76
|
+
* participant Svc as FabricEnrollmentService
|
|
77
|
+
* participant CA as Fabric CA
|
|
78
|
+
* App->>Svc: register(credentials, ...)
|
|
79
|
+
* Svc->>CA: register(request, adminUser)
|
|
80
|
+
* CA-->>Svc: enrollmentSecret
|
|
81
|
+
* Svc-->>App: secret
|
|
82
|
+
* App->>Svc: enroll(enrollmentId, secret)
|
|
83
|
+
* Svc->>CA: enroll({enrollmentID, secret})
|
|
84
|
+
* CA-->>Svc: certificates
|
|
85
|
+
* Svc-->>App: Identity
|
|
86
|
+
*/
|
|
87
|
+
export declare class FabricEnrollmentService extends LoggedClass {
|
|
88
|
+
private caConfig;
|
|
89
|
+
private ca?;
|
|
90
|
+
private certificateService?;
|
|
91
|
+
private affiliationService?;
|
|
92
|
+
private identityService?;
|
|
93
|
+
private client?;
|
|
94
|
+
private user?;
|
|
95
|
+
constructor(caConfig: CAConfig);
|
|
96
|
+
protected User(): Promise<User>;
|
|
97
|
+
protected CA(): Promise<FabricCAServices>;
|
|
98
|
+
protected Client(): Promise<{
|
|
99
|
+
newCertificateService: any;
|
|
100
|
+
}>;
|
|
101
|
+
protected Certificate(): Promise<any>;
|
|
102
|
+
protected Affiliations(): Promise<FabricCAServices.AffiliationService>;
|
|
103
|
+
protected Identities(): Promise<FabricCAServices.IdentityService>;
|
|
104
|
+
/**
|
|
105
|
+
* @description Retrieve certificates from the CA.
|
|
106
|
+
* @summary Calls the CA certificate service to list certificates, optionally mapping to PEM strings only.
|
|
107
|
+
* @param {GetCertificatesRequest} [request] - Optional filter request for certificate lookup.
|
|
108
|
+
* @param {boolean} [doMap=true] - When true, returns array of PEM strings; otherwise returns full response object.
|
|
109
|
+
* @return {Promise<string[] | CertificateResponse>} Array of PEM strings or the full certificate response.
|
|
110
|
+
*/
|
|
111
|
+
getCertificates(request?: GetCertificatesRequest, doMap?: boolean): Promise<string[] | CertificateResponse>;
|
|
112
|
+
/**
|
|
113
|
+
* @description List identities registered in the CA.
|
|
114
|
+
* @summary Queries the CA identity service to fetch all identities and returns the list as FabricIdentity objects.
|
|
115
|
+
* @return {Promise<FabricIdentity[]>} The list of identities registered in the CA.
|
|
116
|
+
*/
|
|
117
|
+
getIdentities(): Promise<FabricIdentity[]>;
|
|
118
|
+
protected parseError(e: Error): AuthorizationError | ConflictError;
|
|
119
|
+
/**
|
|
120
|
+
* @description Retrieve affiliations from the CA.
|
|
121
|
+
* @summary Queries the CA for the list of affiliations available under the configured CA.
|
|
122
|
+
* @return {string} The affiliations result payload.
|
|
123
|
+
*/
|
|
124
|
+
getAffiliations(): Promise<any>;
|
|
125
|
+
/**
|
|
126
|
+
* @description Read identity details from the CA by enrollment ID.
|
|
127
|
+
* @summary Retrieves and validates a single identity, throwing NotFoundError when missing.
|
|
128
|
+
* @param {string} enrollmentId - Enrollment ID to lookup.
|
|
129
|
+
* @return {Promise<FabricIdentity>} The identity details stored in the CA.
|
|
130
|
+
*/
|
|
131
|
+
read(enrollmentId: string): Promise<FabricIdentity>;
|
|
132
|
+
/**
|
|
133
|
+
* @description Register a new identity with the CA.
|
|
134
|
+
* @summary Submits a registration request for a new enrollment ID, returning the enrollment secret upon success.
|
|
135
|
+
* @param {Credentials} model - Credentials containing userName and password for the new identity.
|
|
136
|
+
* @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
|
|
137
|
+
* @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
|
|
138
|
+
* @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
|
|
139
|
+
* @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
|
|
140
|
+
* @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
|
|
141
|
+
* @return {Promise<string>} The enrollment secret for the registered identity.
|
|
142
|
+
*/
|
|
143
|
+
register(model: Credentials, isSuperUser?: boolean, affiliation?: string, userRole?: CA_ROLE | string, attrs?: IKeyValueAttribute, maxEnrollments?: number): Promise<string>;
|
|
144
|
+
protected static identityFromEnrollment(enrollment: IEnrollResponse, mspId: string): Identity;
|
|
145
|
+
/**
|
|
146
|
+
* @description Enroll an identity with the CA using a registration secret.
|
|
147
|
+
* @summary Exchanges the enrollment ID and secret for certificates, returning a constructed Identity model.
|
|
148
|
+
* @param {string} enrollmentId - Enrollment ID to enroll.
|
|
149
|
+
* @param {string} registration - Enrollment secret returned at registration time.
|
|
150
|
+
* @return {Promise<Identity>} The enrolled identity object with credentials.
|
|
151
|
+
*/
|
|
152
|
+
enroll(enrollmentId: string, registration: string): Promise<Identity>;
|
|
153
|
+
/**
|
|
154
|
+
* @description Register and enroll a new identity in one step.
|
|
155
|
+
* @summary Registers a new enrollment ID with the CA and immediately exchanges the secret to enroll, returning the created Identity.
|
|
156
|
+
* @param {Credentials} model - Credentials for the new identity containing userName and password.
|
|
157
|
+
* @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
|
|
158
|
+
* @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
|
|
159
|
+
* @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
|
|
160
|
+
* @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
|
|
161
|
+
* @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
|
|
162
|
+
* @return {Promise<Identity>} The enrolled identity.
|
|
163
|
+
*/
|
|
164
|
+
registerAndEnroll(model: Credentials, isSuperUser?: boolean, affiliation?: string, userRole?: CA_ROLE | string, attrs?: IKeyValueAttribute, maxEnrollments?: number): Promise<Identity>;
|
|
165
|
+
/**
|
|
166
|
+
* Revokes the enrollment of an identity with the specified enrollment ID.
|
|
167
|
+
*
|
|
168
|
+
* @param enrollmentId - The enrollment ID of the identity to be revoked.
|
|
169
|
+
*
|
|
170
|
+
* @returns A Promise that resolves to the result of the revocation operation.
|
|
171
|
+
*
|
|
172
|
+
* @throws {NotFoundError} If the enrollment with the specified ID does not exist.
|
|
173
|
+
* @throws {InternalError} If there is an error during the revocation process.
|
|
174
|
+
*/
|
|
175
|
+
revoke(enrollmentId: string): Promise<FabricCAServices.IServiceResponse>;
|
|
176
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { AuthorizationError, ClientBasedService, Context, MaybeContextualArg } from "@decaf-ts/core";
|
|
2
|
+
import FabricCAServices, { AffiliationService, IdentityService, IEnrollResponse, IIdentityRequest, IRevokeRequest, IServiceResponse } from "fabric-ca-client";
|
|
3
|
+
import { CAConfig, Credentials } from "../../shared/types.cjs";
|
|
4
|
+
import { ConflictError } from "@decaf-ts/db-decorators";
|
|
5
|
+
import { CertificateResponse, FabricIdentity, GetCertificatesRequest } from "../../shared/fabric-types.cjs";
|
|
6
|
+
import { User } from "fabric-common";
|
|
7
|
+
import { CA_ROLE } from "./constants.cjs";
|
|
8
|
+
import { IKeyValueAttribute } from "./FabricEnrollmentService.cjs";
|
|
9
|
+
import { Identity } from "../../shared/index.cjs";
|
|
10
|
+
export declare class FabricIdentityService extends ClientBasedService<FabricCAServices, CAConfig> {
|
|
11
|
+
protected _user: User;
|
|
12
|
+
constructor();
|
|
13
|
+
protected get rootClient(): {
|
|
14
|
+
newCertificateService: any;
|
|
15
|
+
};
|
|
16
|
+
protected get user(): User;
|
|
17
|
+
protected get certificates(): any;
|
|
18
|
+
protected get affiliations(): AffiliationService;
|
|
19
|
+
protected get identities(): IdentityService;
|
|
20
|
+
protected getUser(cfg: CAConfig, ctx: Context): Promise<User>;
|
|
21
|
+
initialize(...args: MaybeContextualArg<any>): Promise<{
|
|
22
|
+
config: CAConfig;
|
|
23
|
+
client: FabricCAServices;
|
|
24
|
+
}>;
|
|
25
|
+
getCertificates(...args: MaybeContextualArg<any>): Promise<string[]>;
|
|
26
|
+
getCertificates(request: GetCertificatesRequest, ...args: MaybeContextualArg<any>): Promise<string[]>;
|
|
27
|
+
getCertificates<MAP extends boolean>(doMap: MAP, ...args: MaybeContextualArg<any>): Promise<MAP extends false ? CertificateResponse : string[]>;
|
|
28
|
+
getCertificates<MAP extends boolean>(request: GetCertificatesRequest, doMap: MAP, ...args: MaybeContextualArg<any>): Promise<MAP extends false ? CertificateResponse : string[]>;
|
|
29
|
+
getIdentities(ctx: Context): Promise<FabricIdentity[]>;
|
|
30
|
+
/**
|
|
31
|
+
* @description Retrieve affiliations from the CA.
|
|
32
|
+
* @summary Queries the CA for the list of affiliations available under the configured CA.
|
|
33
|
+
* @return {string} The affiliations result payload.
|
|
34
|
+
*/
|
|
35
|
+
getAffiliations(ctx: Context): Promise<any>;
|
|
36
|
+
protected parseError(e: Error): AuthorizationError | ConflictError;
|
|
37
|
+
/**
|
|
38
|
+
* @description Read identity details from the CA by enrollment ID.
|
|
39
|
+
* @summary Retrieves and validates a single identity, throwing NotFoundError when missing.
|
|
40
|
+
* @param {string} enrollmentId - Enrollment ID to lookup.
|
|
41
|
+
* @return {Promise<FabricIdentity>} The identity details stored in the CA.
|
|
42
|
+
*/
|
|
43
|
+
read(enrollmentId: string, ...args: MaybeContextualArg<any>): Promise<FabricIdentity>;
|
|
44
|
+
/**
|
|
45
|
+
* @description Register a new identity with the CA.
|
|
46
|
+
* @summary Submits a registration request for a new enrollment ID, returning the enrollment secret upon success.
|
|
47
|
+
* @param {Credentials} model - Credentials containing userName and password for the new identity.
|
|
48
|
+
* @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
|
|
49
|
+
* @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
|
|
50
|
+
* @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
|
|
51
|
+
* @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
|
|
52
|
+
* @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
|
|
53
|
+
* @return {Promise<string>} The enrollment secret for the registered identity.
|
|
54
|
+
*/
|
|
55
|
+
register(model: Credentials, isSuperUser?: boolean, affiliation?: string, userRole?: CA_ROLE | string, attrs?: IKeyValueAttribute, maxEnrollments?: number, ...args: MaybeContextualArg<any>): Promise<string>;
|
|
56
|
+
protected static identityFromEnrollment(enrollment: IEnrollResponse, mspId: string, ctx: Context): Identity;
|
|
57
|
+
/**
|
|
58
|
+
* @description Enroll an identity with the CA using a registration secret.
|
|
59
|
+
* @summary Exchanges the enrollment ID and secret for certificates, returning a constructed Identity model.
|
|
60
|
+
* @param {string} enrollmentId - Enrollment ID to enroll.
|
|
61
|
+
* @param {string} registration - Enrollment secret returned at registration time.
|
|
62
|
+
* @return {Promise<Identity>} The enrolled identity object with credentials.
|
|
63
|
+
*/
|
|
64
|
+
enroll(enrollmentId: string, registration: string, ...args: MaybeContextualArg<any>): Promise<Identity>;
|
|
65
|
+
/**
|
|
66
|
+
* @description Register and enroll a new identity in one step.
|
|
67
|
+
* @summary Registers a new enrollment ID with the CA and immediately exchanges the secret to enroll, returning the created Identity.
|
|
68
|
+
* @param {Credentials} model - Credentials for the new identity containing userName and password.
|
|
69
|
+
* @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
|
|
70
|
+
* @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
|
|
71
|
+
* @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
|
|
72
|
+
* @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
|
|
73
|
+
* @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
|
|
74
|
+
* @return {Promise<Identity>} The enrolled identity.
|
|
75
|
+
*/
|
|
76
|
+
registerAndEnroll(model: Credentials, isSuperUser?: boolean, affiliation?: string, userRole?: CA_ROLE | string, attrs?: IKeyValueAttribute, maxEnrollments?: number, ...args: MaybeContextualArg<any>): Promise<Identity>;
|
|
77
|
+
/**
|
|
78
|
+
* @description Re-enroll an existing identity using its current enrollment.
|
|
79
|
+
* @summary Renews the enrollment certificate by calling the CA reenroll.
|
|
80
|
+
* @param {User} currentUser - Already enrolled user, must have a signing identity.
|
|
81
|
+
* @return {Promise<Identity>} The renewed identity object with new credentials.
|
|
82
|
+
*/
|
|
83
|
+
updateIdentity(enrollmentId: string, identity: {
|
|
84
|
+
certificate: string;
|
|
85
|
+
privateKey: string;
|
|
86
|
+
}, identityRequest: IIdentityRequest, ...args: MaybeContextualArg<any>): Promise<Identity>;
|
|
87
|
+
/**
|
|
88
|
+
* Revokes the enrollment of an identity with the specified enrollment ID.
|
|
89
|
+
*
|
|
90
|
+
* @param enrollmentId - The enrollment ID of the identity to be revoked.
|
|
91
|
+
*
|
|
92
|
+
* @returns A Promise that resolves to the result of the revocation operation.
|
|
93
|
+
*
|
|
94
|
+
* @throws {NotFoundError} If the enrollment with the specified ID does not exist.
|
|
95
|
+
* @throws {InternalError} If there is an error during the revocation process.
|
|
96
|
+
*/
|
|
97
|
+
revoke(enrollmentId: string, revokeOptions: Omit<IRevokeRequest, "enrollmentID">, ...args: MaybeContextualArg<any>): Promise<IServiceResponse>;
|
|
98
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { AuthorizationError, ClientBasedService, Context, MaybeContextualArg } from "@decaf-ts/core";
|
|
2
|
+
import FabricCAServices, { AffiliationService, IdentityService, IEnrollResponse, IIdentityRequest, IRevokeRequest, IServiceResponse } from "fabric-ca-client";
|
|
3
|
+
import { CAConfig, Credentials } from "../../shared/types.js";
|
|
4
|
+
import { ConflictError } from "@decaf-ts/db-decorators";
|
|
5
|
+
import { CertificateResponse, FabricIdentity, GetCertificatesRequest } from "../../shared/fabric-types.js";
|
|
6
|
+
import { User } from "fabric-common";
|
|
7
|
+
import { CA_ROLE } from "./constants.js";
|
|
8
|
+
import { IKeyValueAttribute } from "./FabricEnrollmentService.js";
|
|
9
|
+
import { Identity } from "../../shared/index.js";
|
|
10
|
+
export declare class FabricIdentityService extends ClientBasedService<FabricCAServices, CAConfig> {
|
|
11
|
+
protected _user: User;
|
|
12
|
+
constructor();
|
|
13
|
+
protected get rootClient(): {
|
|
14
|
+
newCertificateService: any;
|
|
15
|
+
};
|
|
16
|
+
protected get user(): User;
|
|
17
|
+
protected get certificates(): any;
|
|
18
|
+
protected get affiliations(): AffiliationService;
|
|
19
|
+
protected get identities(): IdentityService;
|
|
20
|
+
protected getUser(cfg: CAConfig, ctx: Context): Promise<User>;
|
|
21
|
+
initialize(...args: MaybeContextualArg<any>): Promise<{
|
|
22
|
+
config: CAConfig;
|
|
23
|
+
client: FabricCAServices;
|
|
24
|
+
}>;
|
|
25
|
+
getCertificates(...args: MaybeContextualArg<any>): Promise<string[]>;
|
|
26
|
+
getCertificates(request: GetCertificatesRequest, ...args: MaybeContextualArg<any>): Promise<string[]>;
|
|
27
|
+
getCertificates<MAP extends boolean>(doMap: MAP, ...args: MaybeContextualArg<any>): Promise<MAP extends false ? CertificateResponse : string[]>;
|
|
28
|
+
getCertificates<MAP extends boolean>(request: GetCertificatesRequest, doMap: MAP, ...args: MaybeContextualArg<any>): Promise<MAP extends false ? CertificateResponse : string[]>;
|
|
29
|
+
getIdentities(ctx: Context): Promise<FabricIdentity[]>;
|
|
30
|
+
/**
|
|
31
|
+
* @description Retrieve affiliations from the CA.
|
|
32
|
+
* @summary Queries the CA for the list of affiliations available under the configured CA.
|
|
33
|
+
* @return {string} The affiliations result payload.
|
|
34
|
+
*/
|
|
35
|
+
getAffiliations(ctx: Context): Promise<any>;
|
|
36
|
+
protected parseError(e: Error): AuthorizationError | ConflictError;
|
|
37
|
+
/**
|
|
38
|
+
* @description Read identity details from the CA by enrollment ID.
|
|
39
|
+
* @summary Retrieves and validates a single identity, throwing NotFoundError when missing.
|
|
40
|
+
* @param {string} enrollmentId - Enrollment ID to lookup.
|
|
41
|
+
* @return {Promise<FabricIdentity>} The identity details stored in the CA.
|
|
42
|
+
*/
|
|
43
|
+
read(enrollmentId: string, ...args: MaybeContextualArg<any>): Promise<FabricIdentity>;
|
|
44
|
+
/**
|
|
45
|
+
* @description Register a new identity with the CA.
|
|
46
|
+
* @summary Submits a registration request for a new enrollment ID, returning the enrollment secret upon success.
|
|
47
|
+
* @param {Credentials} model - Credentials containing userName and password for the new identity.
|
|
48
|
+
* @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
|
|
49
|
+
* @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
|
|
50
|
+
* @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
|
|
51
|
+
* @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
|
|
52
|
+
* @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
|
|
53
|
+
* @return {Promise<string>} The enrollment secret for the registered identity.
|
|
54
|
+
*/
|
|
55
|
+
register(model: Credentials, isSuperUser?: boolean, affiliation?: string, userRole?: CA_ROLE | string, attrs?: IKeyValueAttribute, maxEnrollments?: number, ...args: MaybeContextualArg<any>): Promise<string>;
|
|
56
|
+
protected static identityFromEnrollment(enrollment: IEnrollResponse, mspId: string, ctx: Context): Identity;
|
|
57
|
+
/**
|
|
58
|
+
* @description Enroll an identity with the CA using a registration secret.
|
|
59
|
+
* @summary Exchanges the enrollment ID and secret for certificates, returning a constructed Identity model.
|
|
60
|
+
* @param {string} enrollmentId - Enrollment ID to enroll.
|
|
61
|
+
* @param {string} registration - Enrollment secret returned at registration time.
|
|
62
|
+
* @return {Promise<Identity>} The enrolled identity object with credentials.
|
|
63
|
+
*/
|
|
64
|
+
enroll(enrollmentId: string, registration: string, ...args: MaybeContextualArg<any>): Promise<Identity>;
|
|
65
|
+
/**
|
|
66
|
+
* @description Register and enroll a new identity in one step.
|
|
67
|
+
* @summary Registers a new enrollment ID with the CA and immediately exchanges the secret to enroll, returning the created Identity.
|
|
68
|
+
* @param {Credentials} model - Credentials for the new identity containing userName and password.
|
|
69
|
+
* @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
|
|
70
|
+
* @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
|
|
71
|
+
* @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
|
|
72
|
+
* @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
|
|
73
|
+
* @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
|
|
74
|
+
* @return {Promise<Identity>} The enrolled identity.
|
|
75
|
+
*/
|
|
76
|
+
registerAndEnroll(model: Credentials, isSuperUser?: boolean, affiliation?: string, userRole?: CA_ROLE | string, attrs?: IKeyValueAttribute, maxEnrollments?: number, ...args: MaybeContextualArg<any>): Promise<Identity>;
|
|
77
|
+
/**
|
|
78
|
+
* @description Re-enroll an existing identity using its current enrollment.
|
|
79
|
+
* @summary Renews the enrollment certificate by calling the CA reenroll.
|
|
80
|
+
* @param {User} currentUser - Already enrolled user, must have a signing identity.
|
|
81
|
+
* @return {Promise<Identity>} The renewed identity object with new credentials.
|
|
82
|
+
*/
|
|
83
|
+
updateIdentity(enrollmentId: string, identity: {
|
|
84
|
+
certificate: string;
|
|
85
|
+
privateKey: string;
|
|
86
|
+
}, identityRequest: IIdentityRequest, ...args: MaybeContextualArg<any>): Promise<Identity>;
|
|
87
|
+
/**
|
|
88
|
+
* Revokes the enrollment of an identity with the specified enrollment ID.
|
|
89
|
+
*
|
|
90
|
+
* @param enrollmentId - The enrollment ID of the identity to be revoked.
|
|
91
|
+
*
|
|
92
|
+
* @returns A Promise that resolves to the result of the revocation operation.
|
|
93
|
+
*
|
|
94
|
+
* @throws {NotFoundError} If the enrollment with the specified ID does not exist.
|
|
95
|
+
* @throws {InternalError} If there is an error during the revocation process.
|
|
96
|
+
*/
|
|
97
|
+
revoke(enrollmentId: string, revokeOptions: Omit<IRevokeRequest, "enrollmentID">, ...args: MaybeContextualArg<any>): Promise<IServiceResponse>;
|
|
98
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IRegisterRequest, IKeyValueAttribute } from "fabric-ca-client";
|
|
2
|
+
import { CA_ROLE } from "./constants.cjs";
|
|
3
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
4
|
+
export declare class RegistrationRequestBuilder extends Model {
|
|
5
|
+
affiliation: string;
|
|
6
|
+
attrs?: IKeyValueAttribute[];
|
|
7
|
+
enrollmentID: string;
|
|
8
|
+
enrollmentSecret: string;
|
|
9
|
+
maxEnrollments?: number;
|
|
10
|
+
role: string;
|
|
11
|
+
build(): IRegisterRequest;
|
|
12
|
+
setAffiliation(value: string): this;
|
|
13
|
+
addAttr(attr: IKeyValueAttribute): this;
|
|
14
|
+
setAttrs(value: IKeyValueAttribute[]): this;
|
|
15
|
+
setEnrollmentID(value: string): this;
|
|
16
|
+
setEnrollmentSecret(value: string): this;
|
|
17
|
+
setMaxEnrollments(value: number): this;
|
|
18
|
+
setRole(value: CA_ROLE | string): this;
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IRegisterRequest, IKeyValueAttribute } from "fabric-ca-client";
|
|
2
|
+
import { CA_ROLE } from "./constants.js";
|
|
3
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
4
|
+
export declare class RegistrationRequestBuilder extends Model {
|
|
5
|
+
affiliation: string;
|
|
6
|
+
attrs?: IKeyValueAttribute[];
|
|
7
|
+
enrollmentID: string;
|
|
8
|
+
enrollmentSecret: string;
|
|
9
|
+
maxEnrollments?: number;
|
|
10
|
+
role: string;
|
|
11
|
+
build(): IRegisterRequest;
|
|
12
|
+
setAffiliation(value: string): this;
|
|
13
|
+
addAttr(attr: IKeyValueAttribute): this;
|
|
14
|
+
setAttrs(value: IKeyValueAttribute[]): this;
|
|
15
|
+
setEnrollmentID(value: string): this;
|
|
16
|
+
setEnrollmentSecret(value: string): this;
|
|
17
|
+
setMaxEnrollments(value: number): this;
|
|
18
|
+
setRole(value: CA_ROLE | string): this;
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Certificate Authority role types used during enrollment and registration.
|
|
3
|
+
* @summary Enumerates the standard Hyperledger Fabric CA roles that can be assigned to identities when registering with the CA service.
|
|
4
|
+
* @enum {string}
|
|
5
|
+
* @readonly
|
|
6
|
+
* @memberOf module:for-fabric.client
|
|
7
|
+
*/
|
|
8
|
+
export declare enum CA_ROLE {
|
|
9
|
+
/** Administrator role with elevated privileges for managing identities and affiliations */
|
|
10
|
+
ADMIN = "admin",
|
|
11
|
+
/** Standard user role for application clients interacting with the network */
|
|
12
|
+
USER = "user",
|
|
13
|
+
/** Client role typically used for SDK-based interactions and service accounts */
|
|
14
|
+
CLIENT = "client"
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Certificate Authority role types used during enrollment and registration.
|
|
3
|
+
* @summary Enumerates the standard Hyperledger Fabric CA roles that can be assigned to identities when registering with the CA service.
|
|
4
|
+
* @enum {string}
|
|
5
|
+
* @readonly
|
|
6
|
+
* @memberOf module:for-fabric.client
|
|
7
|
+
*/
|
|
8
|
+
export declare enum CA_ROLE {
|
|
9
|
+
/** Administrator role with elevated privileges for managing identities and affiliations */
|
|
10
|
+
ADMIN = "admin",
|
|
11
|
+
/** Standard user role for application clients interacting with the network */
|
|
12
|
+
USER = "user",
|
|
13
|
+
/** Client role typically used for SDK-based interactions and service accounts */
|
|
14
|
+
CLIENT = "client"
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FabricFlags } from "../shared/index.cjs";
|
|
2
|
+
export type FabricClientFlags = FabricFlags & {
|
|
3
|
+
evaluateTimeout: number;
|
|
4
|
+
endorseTimeout: number;
|
|
5
|
+
submitTimeout: number;
|
|
6
|
+
commitTimeout: number;
|
|
7
|
+
endorsingOrgs?: string[];
|
|
8
|
+
keyCertOrDirectoryPath?: string | Buffer;
|
|
9
|
+
certCertOrDirectoryPath?: string | Buffer;
|
|
10
|
+
chaincodeName?: string;
|
|
11
|
+
contractName?: string;
|
|
12
|
+
sizeLimit?: number;
|
|
13
|
+
mspId?: string;
|
|
14
|
+
channel?: string;
|
|
15
|
+
legacy?: boolean;
|
|
16
|
+
allowGatewayOverride?: boolean;
|
|
17
|
+
allowManualEndorsingOrgs: boolean;
|
|
18
|
+
encryptTransient?: false | string | (() => string);
|
|
19
|
+
syntheticEvents?: boolean;
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FabricFlags } from "../shared/index.js";
|
|
2
|
+
export type FabricClientFlags = FabricFlags & {
|
|
3
|
+
evaluateTimeout: number;
|
|
4
|
+
endorseTimeout: number;
|
|
5
|
+
submitTimeout: number;
|
|
6
|
+
commitTimeout: number;
|
|
7
|
+
endorsingOrgs?: string[];
|
|
8
|
+
keyCertOrDirectoryPath?: string | Buffer;
|
|
9
|
+
certCertOrDirectoryPath?: string | Buffer;
|
|
10
|
+
chaincodeName?: string;
|
|
11
|
+
contractName?: string;
|
|
12
|
+
sizeLimit?: number;
|
|
13
|
+
mspId?: string;
|
|
14
|
+
channel?: string;
|
|
15
|
+
legacy?: boolean;
|
|
16
|
+
allowGatewayOverride?: boolean;
|
|
17
|
+
allowManualEndorsingOrgs: boolean;
|
|
18
|
+
encryptTransient?: false | string | (() => string);
|
|
19
|
+
syntheticEvents?: boolean;
|
|
20
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Identity, Signer } from "@hyperledger/fabric-gateway";
|
|
2
|
+
import { CryptoSetting, ICryptoSuite, User } from "fabric-common";
|
|
3
|
+
import { HSMOptions } from "../shared/types.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* @description Core utilities for interacting with files, crypto identities, and Fabric SDK helpers
|
|
6
|
+
* @summary Provides static helper methods to read credentials and keys from disk or raw content, construct Fabric gateway Identities and Signers, and perform common filesystem operations used by the Fabric client tooling.
|
|
7
|
+
* @class CoreUtils
|
|
8
|
+
* @example
|
|
9
|
+
* // Read an identity and signer from directories
|
|
10
|
+
* const identity = await CoreUtils.getIdentity('Org1MSP', '/msp/signcerts');
|
|
11
|
+
* const signer = await CoreUtils.getSigner('/msp/keystore');
|
|
12
|
+
* // Build a CA user
|
|
13
|
+
* const user = await CoreUtils.getCAUser('appUser', pemKey, pemCert, 'Org1MSP');
|
|
14
|
+
*/
|
|
15
|
+
export declare class CoreUtils {
|
|
16
|
+
private static logger;
|
|
17
|
+
private static cryptoSuite;
|
|
18
|
+
private constructor();
|
|
19
|
+
/**
|
|
20
|
+
* @description Resolve file content from a path or return provided raw content
|
|
21
|
+
* @summary If the input is a Uint8Array or PEM content, returns it as-is; otherwise uses a provided async fileReader to load the content from disk.
|
|
22
|
+
* @param {string|Uint8Array} contentOrPath - Either a raw content buffer/string or a filesystem path
|
|
23
|
+
* @param {function(string): Promise<string|Uint8Array|Buffer>} fileReader - Async function to read file content when a path is provided
|
|
24
|
+
* @return {Promise<string|Uint8Array|Buffer>} The content to be used downstream
|
|
25
|
+
*/
|
|
26
|
+
private static contentOfLoadFile;
|
|
27
|
+
/**
|
|
28
|
+
* @description Read file content from a path or return provided Buffer
|
|
29
|
+
* @summary Convenience wrapper that loads a file using fs.promises when a path string is provided; otherwise returns the given Buffer directly.
|
|
30
|
+
* @param {string|Buffer} contentOrPath - Path to a file on disk or an already-loaded Buffer
|
|
31
|
+
* @return {Promise<string|Uint8Array|Buffer>} The file content as a Buffer/string depending on reader
|
|
32
|
+
*/
|
|
33
|
+
static readFile(contentOrPath: string | Buffer): Promise<Buffer<ArrayBufferLike>>;
|
|
34
|
+
/**
|
|
35
|
+
* @description Create a Fabric CA User object with enrollment
|
|
36
|
+
* @summary Constructs a fabric-common User, sets a crypto suite, imports the provided private key, and sets enrollment with certificate and MSP ID.
|
|
37
|
+
* @param {string} userName - The user name for the CA user
|
|
38
|
+
* @param {string} privateKey - PEM-encoded private key
|
|
39
|
+
* @param {string} certificate - PEM-encoded X.509 certificate
|
|
40
|
+
* @param {string} mspId - Membership Service Provider identifier
|
|
41
|
+
* @return {Promise<User>} The enrolled Fabric User instance
|
|
42
|
+
*/
|
|
43
|
+
static getCAUser(userName: string, privateKey: string | undefined, certificate: string, mspId: string, options?: {
|
|
44
|
+
hsm?: HSMOptions;
|
|
45
|
+
}): Promise<User>;
|
|
46
|
+
static getCryptoSuite(options?: CryptoSetting): ICryptoSuite;
|
|
47
|
+
private static getSoftwareEnrollmentKey;
|
|
48
|
+
private static getHSMEnrollmentKey;
|
|
49
|
+
static getCertificateSKI(certificate: string): Promise<Buffer>;
|
|
50
|
+
/**
|
|
51
|
+
* @description Build a Fabric Gateway Identity from an MSP ID and certificate
|
|
52
|
+
* @summary Reads a certificate from a directory path or accepts raw content and returns an Identity object suitable for the Fabric Gateway.
|
|
53
|
+
* @param {string} mspId - Membership Service Provider ID
|
|
54
|
+
* @param {string} certDirectoryPath - Path to a directory containing the certificate file, or PEM content
|
|
55
|
+
* @return {Promise<Identity>} The identity containing mspId and certificate credentials
|
|
56
|
+
*/
|
|
57
|
+
static getIdentity(mspId: string, certDirectoryPath: string): Promise<Identity>;
|
|
58
|
+
static getFirstDirFileName(dirPath: string): Promise<string>;
|
|
59
|
+
static getFirstDirFileNameContent(dirPath: string): Promise<string>;
|
|
60
|
+
static getFileContent(filePath: string): Promise<string>;
|
|
61
|
+
static getSigner(keyDirectoryPath: string): Promise<Signer>;
|
|
62
|
+
private static extractPrivateKey;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Extracts the certificate Serial Number and the AKI (Authority Key Identifier)
|
|
66
|
+
* in the format Fabric CA expects (plain hex, no colons).
|
|
67
|
+
*/
|
|
68
|
+
export declare function getAkiAndSerialFromCert(cert: string): {
|
|
69
|
+
aki: string;
|
|
70
|
+
serial: string;
|
|
71
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Identity, Signer } from "@hyperledger/fabric-gateway";
|
|
2
|
+
import { CryptoSetting, ICryptoSuite, User } from "fabric-common";
|
|
3
|
+
import { HSMOptions } from "../shared/types.js";
|
|
4
|
+
/**
|
|
5
|
+
* @description Core utilities for interacting with files, crypto identities, and Fabric SDK helpers
|
|
6
|
+
* @summary Provides static helper methods to read credentials and keys from disk or raw content, construct Fabric gateway Identities and Signers, and perform common filesystem operations used by the Fabric client tooling.
|
|
7
|
+
* @class CoreUtils
|
|
8
|
+
* @example
|
|
9
|
+
* // Read an identity and signer from directories
|
|
10
|
+
* const identity = await CoreUtils.getIdentity('Org1MSP', '/msp/signcerts');
|
|
11
|
+
* const signer = await CoreUtils.getSigner('/msp/keystore');
|
|
12
|
+
* // Build a CA user
|
|
13
|
+
* const user = await CoreUtils.getCAUser('appUser', pemKey, pemCert, 'Org1MSP');
|
|
14
|
+
*/
|
|
15
|
+
export declare class CoreUtils {
|
|
16
|
+
private static logger;
|
|
17
|
+
private static cryptoSuite;
|
|
18
|
+
private constructor();
|
|
19
|
+
/**
|
|
20
|
+
* @description Resolve file content from a path or return provided raw content
|
|
21
|
+
* @summary If the input is a Uint8Array or PEM content, returns it as-is; otherwise uses a provided async fileReader to load the content from disk.
|
|
22
|
+
* @param {string|Uint8Array} contentOrPath - Either a raw content buffer/string or a filesystem path
|
|
23
|
+
* @param {function(string): Promise<string|Uint8Array|Buffer>} fileReader - Async function to read file content when a path is provided
|
|
24
|
+
* @return {Promise<string|Uint8Array|Buffer>} The content to be used downstream
|
|
25
|
+
*/
|
|
26
|
+
private static contentOfLoadFile;
|
|
27
|
+
/**
|
|
28
|
+
* @description Read file content from a path or return provided Buffer
|
|
29
|
+
* @summary Convenience wrapper that loads a file using fs.promises when a path string is provided; otherwise returns the given Buffer directly.
|
|
30
|
+
* @param {string|Buffer} contentOrPath - Path to a file on disk or an already-loaded Buffer
|
|
31
|
+
* @return {Promise<string|Uint8Array|Buffer>} The file content as a Buffer/string depending on reader
|
|
32
|
+
*/
|
|
33
|
+
static readFile(contentOrPath: string | Buffer): Promise<Buffer<ArrayBufferLike>>;
|
|
34
|
+
/**
|
|
35
|
+
* @description Create a Fabric CA User object with enrollment
|
|
36
|
+
* @summary Constructs a fabric-common User, sets a crypto suite, imports the provided private key, and sets enrollment with certificate and MSP ID.
|
|
37
|
+
* @param {string} userName - The user name for the CA user
|
|
38
|
+
* @param {string} privateKey - PEM-encoded private key
|
|
39
|
+
* @param {string} certificate - PEM-encoded X.509 certificate
|
|
40
|
+
* @param {string} mspId - Membership Service Provider identifier
|
|
41
|
+
* @return {Promise<User>} The enrolled Fabric User instance
|
|
42
|
+
*/
|
|
43
|
+
static getCAUser(userName: string, privateKey: string | undefined, certificate: string, mspId: string, options?: {
|
|
44
|
+
hsm?: HSMOptions;
|
|
45
|
+
}): Promise<User>;
|
|
46
|
+
static getCryptoSuite(options?: CryptoSetting): ICryptoSuite;
|
|
47
|
+
private static getSoftwareEnrollmentKey;
|
|
48
|
+
private static getHSMEnrollmentKey;
|
|
49
|
+
static getCertificateSKI(certificate: string): Promise<Buffer>;
|
|
50
|
+
/**
|
|
51
|
+
* @description Build a Fabric Gateway Identity from an MSP ID and certificate
|
|
52
|
+
* @summary Reads a certificate from a directory path or accepts raw content and returns an Identity object suitable for the Fabric Gateway.
|
|
53
|
+
* @param {string} mspId - Membership Service Provider ID
|
|
54
|
+
* @param {string} certDirectoryPath - Path to a directory containing the certificate file, or PEM content
|
|
55
|
+
* @return {Promise<Identity>} The identity containing mspId and certificate credentials
|
|
56
|
+
*/
|
|
57
|
+
static getIdentity(mspId: string, certDirectoryPath: string): Promise<Identity>;
|
|
58
|
+
static getFirstDirFileName(dirPath: string): Promise<string>;
|
|
59
|
+
static getFirstDirFileNameContent(dirPath: string): Promise<string>;
|
|
60
|
+
static getFileContent(filePath: string): Promise<string>;
|
|
61
|
+
static getSigner(keyDirectoryPath: string): Promise<Signer>;
|
|
62
|
+
private static extractPrivateKey;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Extracts the certificate Serial Number and the AKI (Authority Key Identifier)
|
|
66
|
+
* in the format Fabric CA expects (plain hex, no colons).
|
|
67
|
+
*/
|
|
68
|
+
export declare function getAkiAndSerialFromCert(cert: string): {
|
|
69
|
+
aki: string;
|
|
70
|
+
serial: string;
|
|
71
|
+
};
|