@strapi/data-transfer 0.0.0-experimental.62ce06180fe9a772eaeb3d43d238b26644f39f7c → 0.0.0-experimental.6340da17068c3bed7fb006e7bcc554c71129e282
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 +19 -4
- package/dist/directory/index.d.ts +2 -0
- package/dist/directory/index.d.ts.map +1 -0
- package/dist/directory/index.js +8 -0
- package/dist/directory/index.js.map +1 -0
- package/dist/directory/index.mjs +3 -0
- package/dist/directory/index.mjs.map +1 -0
- package/dist/directory/providers/destination/index.d.ts +38 -0
- package/dist/directory/providers/destination/index.d.ts.map +1 -0
- package/dist/directory/providers/destination/index.js +184 -0
- package/dist/directory/providers/destination/index.js.map +1 -0
- package/dist/directory/providers/destination/index.mjs +177 -0
- package/dist/directory/providers/destination/index.mjs.map +1 -0
- package/dist/directory/providers/destination/utils.d.ts +8 -0
- package/dist/directory/providers/destination/utils.d.ts.map +1 -0
- package/dist/directory/providers/destination/utils.js +62 -0
- package/dist/directory/providers/destination/utils.js.map +1 -0
- package/dist/directory/providers/destination/utils.mjs +56 -0
- package/dist/directory/providers/destination/utils.mjs.map +1 -0
- package/dist/directory/providers/index.d.ts +3 -0
- package/dist/directory/providers/index.d.ts.map +1 -0
- package/dist/directory/providers/index.js +10 -0
- package/dist/directory/providers/index.js.map +1 -0
- package/dist/directory/providers/index.mjs +3 -0
- package/dist/directory/providers/index.mjs.map +1 -0
- package/dist/directory/providers/source/index.d.ts +27 -0
- package/dist/directory/providers/source/index.d.ts.map +1 -0
- package/dist/directory/providers/source/index.js +266 -0
- package/dist/directory/providers/source/index.js.map +1 -0
- package/dist/directory/providers/source/index.mjs +259 -0
- package/dist/directory/providers/source/index.mjs.map +1 -0
- package/dist/engine/errors.js +39 -0
- package/dist/engine/errors.js.map +1 -0
- package/dist/engine/errors.mjs +34 -0
- package/dist/engine/errors.mjs.map +1 -0
- package/dist/engine/index.d.ts +2 -3
- package/dist/engine/index.d.ts.map +1 -1
- package/dist/engine/index.js +922 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/index.mjs +917 -0
- package/dist/engine/index.mjs.map +1 -0
- package/dist/engine/validation/provider.d.ts +2 -2
- package/dist/engine/validation/provider.d.ts.map +1 -1
- package/dist/engine/validation/provider.js +19 -0
- package/dist/engine/validation/provider.js.map +1 -0
- package/dist/engine/validation/provider.mjs +17 -0
- package/dist/engine/validation/provider.mjs.map +1 -0
- package/dist/engine/validation/schemas/index.d.ts.map +1 -1
- package/dist/engine/validation/schemas/index.js +59 -0
- package/dist/engine/validation/schemas/index.js.map +1 -0
- package/dist/engine/validation/schemas/index.mjs +57 -0
- package/dist/engine/validation/schemas/index.mjs.map +1 -0
- package/dist/errors/base.js +13 -0
- package/dist/errors/base.js.map +1 -0
- package/dist/errors/base.mjs +11 -0
- package/dist/errors/base.mjs.map +1 -0
- package/dist/errors/constants.d.ts +1 -1
- package/dist/errors/constants.d.ts.map +1 -1
- package/dist/errors/constants.js +9 -0
- package/dist/errors/constants.js.map +1 -0
- package/dist/errors/constants.mjs +7 -0
- package/dist/errors/constants.mjs.map +1 -0
- package/dist/errors/providers.d.ts +1 -1
- package/dist/errors/providers.d.ts.map +1 -1
- package/dist/errors/providers.js +41 -0
- package/dist/errors/providers.js.map +1 -0
- package/dist/errors/providers.mjs +36 -0
- package/dist/errors/providers.mjs.map +1 -0
- package/dist/file/index.js +8 -0
- package/dist/file/index.js.map +1 -0
- package/dist/file/index.mjs +3 -0
- package/dist/file/index.mjs.map +1 -0
- package/dist/file/providers/destination/index.d.ts +3 -5
- package/dist/file/providers/destination/index.d.ts.map +1 -1
- package/dist/file/providers/destination/index.js +254 -0
- package/dist/file/providers/destination/index.js.map +1 -0
- package/dist/file/providers/destination/index.mjs +246 -0
- package/dist/file/providers/destination/index.mjs.map +1 -0
- package/dist/file/providers/destination/utils.d.ts +0 -1
- package/dist/file/providers/destination/utils.d.ts.map +1 -1
- package/dist/file/providers/destination/utils.js +63 -0
- package/dist/file/providers/destination/utils.js.map +1 -0
- package/dist/file/providers/destination/utils.mjs +60 -0
- package/dist/file/providers/destination/utils.mjs.map +1 -0
- package/dist/file/providers/index.js +10 -0
- package/dist/file/providers/index.js.map +1 -0
- package/dist/file/providers/index.mjs +3 -0
- package/dist/file/providers/index.mjs.map +1 -0
- package/dist/file/providers/source/index.d.ts +3 -3
- package/dist/file/providers/source/index.d.ts.map +1 -1
- package/dist/file/providers/source/index.js +336 -0
- package/dist/file/providers/source/index.js.map +1 -0
- package/dist/file/providers/source/index.mjs +328 -0
- package/dist/file/providers/source/index.mjs.map +1 -0
- package/dist/file/providers/source/utils.d.ts.map +1 -1
- package/dist/file/providers/source/utils.js +60 -0
- package/dist/file/providers/source/utils.js.map +1 -0
- package/dist/file/providers/source/utils.mjs +52 -0
- package/dist/file/providers/source/utils.mjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -4408
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -4382
- package/dist/index.mjs.map +1 -1
- package/dist/strapi/index.js +12 -0
- package/dist/strapi/index.js.map +1 -0
- package/dist/strapi/index.mjs +7 -0
- package/dist/strapi/index.mjs.map +1 -0
- package/dist/strapi/providers/index.js +18 -0
- package/dist/strapi/providers/index.js.map +1 -0
- package/dist/strapi/providers/index.mjs +8 -0
- package/dist/strapi/providers/index.mjs.map +1 -0
- package/dist/strapi/providers/local-destination/assets-destination-writable.d.ts +26 -0
- package/dist/strapi/providers/local-destination/assets-destination-writable.d.ts.map +1 -0
- package/dist/strapi/providers/local-destination/assets-destination-writable.js +125 -0
- package/dist/strapi/providers/local-destination/assets-destination-writable.js.map +1 -0
- package/dist/strapi/providers/local-destination/assets-destination-writable.mjs +123 -0
- package/dist/strapi/providers/local-destination/assets-destination-writable.mjs.map +1 -0
- package/dist/strapi/providers/local-destination/index.d.ts +5 -3
- package/dist/strapi/providers/local-destination/index.d.ts.map +1 -1
- package/dist/strapi/providers/local-destination/index.js +362 -0
- package/dist/strapi/providers/local-destination/index.js.map +1 -0
- package/dist/strapi/providers/local-destination/index.mjs +335 -0
- package/dist/strapi/providers/local-destination/index.mjs.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts +1 -2
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts.map +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.js +58 -0
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.mjs +51 -0
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.mjs.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/entities.d.ts +1 -2
- package/dist/strapi/providers/local-destination/strategies/restore/entities.d.ts.map +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/entities.js +54 -0
- package/dist/strapi/providers/local-destination/strategies/restore/entities.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/entities.mjs +52 -0
- package/dist/strapi/providers/local-destination/strategies/restore/entities.mjs.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/index.d.ts.map +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/index.js +124 -0
- package/dist/strapi/providers/local-destination/strategies/restore/index.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/index.mjs +120 -0
- package/dist/strapi/providers/local-destination/strategies/restore/index.mjs.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts +1 -2
- package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts.map +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/links.js +79 -0
- package/dist/strapi/providers/local-destination/strategies/restore/links.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/links.mjs +77 -0
- package/dist/strapi/providers/local-destination/strategies/restore/links.mjs.map +1 -0
- package/dist/strapi/providers/local-source/assets.d.ts +8 -2
- package/dist/strapi/providers/local-source/assets.d.ts.map +1 -1
- package/dist/strapi/providers/local-source/assets.js +151 -0
- package/dist/strapi/providers/local-source/assets.js.map +1 -0
- package/dist/strapi/providers/local-source/assets.mjs +147 -0
- package/dist/strapi/providers/local-source/assets.mjs.map +1 -0
- package/dist/strapi/providers/local-source/configuration.d.ts +0 -1
- package/dist/strapi/providers/local-source/configuration.d.ts.map +1 -1
- package/dist/strapi/providers/local-source/configuration.js +47 -0
- package/dist/strapi/providers/local-source/configuration.js.map +1 -0
- package/dist/strapi/providers/local-source/configuration.mjs +45 -0
- package/dist/strapi/providers/local-source/configuration.mjs.map +1 -0
- package/dist/strapi/providers/local-source/entities.d.ts +3 -2
- package/dist/strapi/providers/local-source/entities.d.ts.map +1 -1
- package/dist/strapi/providers/local-source/entities.js +66 -0
- package/dist/strapi/providers/local-source/entities.js.map +1 -0
- package/dist/strapi/providers/local-source/entities.mjs +63 -0
- package/dist/strapi/providers/local-source/entities.mjs.map +1 -0
- package/dist/strapi/providers/local-source/estimate-asset-totals.d.ts +11 -0
- package/dist/strapi/providers/local-source/estimate-asset-totals.d.ts.map +1 -0
- package/dist/strapi/providers/local-source/estimate-asset-totals.js +130 -0
- package/dist/strapi/providers/local-source/estimate-asset-totals.js.map +1 -0
- package/dist/strapi/providers/local-source/estimate-asset-totals.mjs +128 -0
- package/dist/strapi/providers/local-source/estimate-asset-totals.mjs.map +1 -0
- package/dist/strapi/providers/local-source/index.d.ts +6 -4
- package/dist/strapi/providers/local-source/index.d.ts.map +1 -1
- package/dist/strapi/providers/local-source/index.js +186 -0
- package/dist/strapi/providers/local-source/index.js.map +1 -0
- package/dist/strapi/providers/local-source/index.mjs +183 -0
- package/dist/strapi/providers/local-source/index.mjs.map +1 -0
- package/dist/strapi/providers/local-source/links.d.ts +0 -1
- package/dist/strapi/providers/local-source/links.d.ts.map +1 -1
- package/dist/strapi/providers/local-source/links.js +26 -0
- package/dist/strapi/providers/local-source/links.js.map +1 -0
- package/dist/strapi/providers/local-source/links.mjs +24 -0
- package/dist/strapi/providers/local-source/links.mjs.map +1 -0
- package/dist/strapi/providers/remote-destination/index.d.ts +13 -5
- package/dist/strapi/providers/remote-destination/index.d.ts.map +1 -1
- package/dist/strapi/providers/remote-destination/index.js +482 -0
- package/dist/strapi/providers/remote-destination/index.js.map +1 -0
- package/dist/strapi/providers/remote-destination/index.mjs +480 -0
- package/dist/strapi/providers/remote-destination/index.mjs.map +1 -0
- package/dist/strapi/providers/remote-source/index.d.ts +11 -6
- package/dist/strapi/providers/remote-source/index.d.ts.map +1 -1
- package/dist/strapi/providers/remote-source/index.js +538 -0
- package/dist/strapi/providers/remote-source/index.js.map +1 -0
- package/dist/strapi/providers/remote-source/index.mjs +536 -0
- package/dist/strapi/providers/remote-source/index.mjs.map +1 -0
- package/dist/strapi/providers/utils.d.ts +22 -16
- package/dist/strapi/providers/utils.d.ts.map +1 -1
- package/dist/strapi/providers/utils.js +178 -0
- package/dist/strapi/providers/utils.js.map +1 -0
- package/dist/strapi/providers/utils.mjs +174 -0
- package/dist/strapi/providers/utils.mjs.map +1 -0
- package/dist/strapi/queries/entity.d.ts.map +1 -1
- package/dist/strapi/queries/entity.js +125 -0
- package/dist/strapi/queries/entity.js.map +1 -0
- package/dist/strapi/queries/entity.mjs +123 -0
- package/dist/strapi/queries/entity.mjs.map +1 -0
- package/dist/strapi/queries/index.js +10 -0
- package/dist/strapi/queries/index.js.map +1 -0
- package/dist/strapi/queries/index.mjs +5 -0
- package/dist/strapi/queries/index.mjs.map +1 -0
- package/dist/strapi/queries/link.d.ts +1 -1
- package/dist/strapi/queries/link.d.ts.map +1 -1
- package/dist/strapi/queries/link.js +298 -0
- package/dist/strapi/queries/link.js.map +1 -0
- package/dist/strapi/queries/link.mjs +295 -0
- package/dist/strapi/queries/link.mjs.map +1 -0
- package/dist/strapi/remote/constants.d.ts.map +1 -1
- package/dist/strapi/remote/constants.js +11 -0
- package/dist/strapi/remote/constants.js.map +1 -0
- package/dist/strapi/remote/constants.mjs +8 -0
- package/dist/strapi/remote/constants.mjs.map +1 -0
- package/dist/strapi/remote/flows/default.d.ts.map +1 -1
- package/dist/strapi/remote/flows/default.js +43 -0
- package/dist/strapi/remote/flows/default.js.map +1 -0
- package/dist/strapi/remote/flows/default.mjs +41 -0
- package/dist/strapi/remote/flows/default.mjs.map +1 -0
- package/dist/strapi/remote/flows/index.d.ts +1 -1
- package/dist/strapi/remote/flows/index.d.ts.map +1 -1
- package/dist/strapi/remote/flows/index.js +54 -0
- package/dist/strapi/remote/flows/index.js.map +1 -0
- package/dist/strapi/remote/flows/index.mjs +52 -0
- package/dist/strapi/remote/flows/index.mjs.map +1 -0
- package/dist/strapi/remote/handlers/abstract.d.ts +4 -1
- package/dist/strapi/remote/handlers/abstract.d.ts.map +1 -1
- package/dist/strapi/remote/handlers/constants.js +10 -0
- package/dist/strapi/remote/handlers/constants.js.map +1 -0
- package/dist/strapi/remote/handlers/constants.mjs +8 -0
- package/dist/strapi/remote/handlers/constants.mjs.map +1 -0
- package/dist/strapi/remote/handlers/index.js +12 -0
- package/dist/strapi/remote/handlers/index.js.map +1 -0
- package/dist/strapi/remote/handlers/index.mjs +4 -0
- package/dist/strapi/remote/handlers/index.mjs.map +1 -0
- package/dist/strapi/remote/handlers/pull.d.ts +2 -3
- package/dist/strapi/remote/handlers/pull.d.ts.map +1 -1
- package/dist/strapi/remote/handlers/pull.js +369 -0
- package/dist/strapi/remote/handlers/pull.js.map +1 -0
- package/dist/strapi/remote/handlers/pull.mjs +367 -0
- package/dist/strapi/remote/handlers/pull.mjs.map +1 -0
- package/dist/strapi/remote/handlers/push.d.ts +16 -5
- package/dist/strapi/remote/handlers/push.d.ts.map +1 -1
- package/dist/strapi/remote/handlers/push.js +454 -0
- package/dist/strapi/remote/handlers/push.js.map +1 -0
- package/dist/strapi/remote/handlers/push.mjs +452 -0
- package/dist/strapi/remote/handlers/push.mjs.map +1 -0
- package/dist/strapi/remote/handlers/utils.d.ts +1 -2
- package/dist/strapi/remote/handlers/utils.d.ts.map +1 -1
- package/dist/strapi/remote/handlers/utils.js +318 -0
- package/dist/strapi/remote/handlers/utils.js.map +1 -0
- package/dist/strapi/remote/handlers/utils.mjs +312 -0
- package/dist/strapi/remote/handlers/utils.mjs.map +1 -0
- package/dist/strapi/remote/index.js +10 -0
- package/dist/strapi/remote/index.js.map +1 -0
- package/dist/strapi/remote/index.mjs +5 -0
- package/dist/strapi/remote/index.mjs.map +1 -0
- package/dist/strapi/utils/project-settings-logos.d.ts +29 -0
- package/dist/strapi/utils/project-settings-logos.d.ts.map +1 -0
- package/dist/strapi/utils/project-settings-logos.js +174 -0
- package/dist/strapi/utils/project-settings-logos.js.map +1 -0
- package/dist/strapi/utils/project-settings-logos.mjs +169 -0
- package/dist/strapi/utils/project-settings-logos.mjs.map +1 -0
- package/dist/types/common-entities.d.ts +149 -0
- package/dist/types/common-entities.d.ts.map +1 -0
- package/dist/types/encryption.d.ts +13 -0
- package/dist/types/encryption.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/providers.d.ts +49 -0
- package/dist/types/providers.d.ts.map +1 -0
- package/dist/types/remote/index.d.ts +2 -0
- package/dist/types/remote/index.d.ts.map +1 -0
- package/dist/types/remote/protocol/auth.d.ts +5 -0
- package/dist/types/remote/protocol/auth.d.ts.map +1 -0
- package/dist/types/remote/protocol/client/commands.d.ts +37 -0
- package/dist/types/remote/protocol/client/commands.d.ts.map +1 -0
- package/dist/types/remote/protocol/client/index.d.ts +9 -0
- package/dist/types/remote/protocol/client/index.d.ts.map +1 -0
- package/dist/types/remote/protocol/client/transfer/action.d.ts +5 -0
- package/dist/types/remote/protocol/client/transfer/action.d.ts.map +1 -0
- package/dist/types/remote/protocol/client/transfer/index.d.ts +12 -0
- package/dist/types/remote/protocol/client/transfer/index.d.ts.map +1 -0
- package/dist/types/remote/protocol/client/transfer/pull.d.ts +25 -0
- package/dist/types/remote/protocol/client/transfer/pull.d.ts.map +1 -0
- package/dist/types/remote/protocol/client/transfer/push.d.ts +29 -0
- package/dist/types/remote/protocol/client/transfer/push.d.ts.map +1 -0
- package/dist/types/remote/protocol/client/transfer/utils.d.ts +47 -0
- package/dist/types/remote/protocol/client/transfer/utils.d.ts.map +1 -0
- package/dist/types/remote/protocol/index.d.ts +4 -0
- package/dist/types/remote/protocol/index.d.ts.map +1 -0
- package/dist/types/remote/protocol/server/error.d.ts +18 -0
- package/dist/types/remote/protocol/server/error.d.ts.map +1 -0
- package/dist/types/remote/protocol/server/index.d.ts +3 -0
- package/dist/types/remote/protocol/server/index.d.ts.map +1 -0
- package/dist/types/remote/protocol/server/messaging.d.ts +37 -0
- package/dist/types/remote/protocol/server/messaging.d.ts.map +1 -0
- package/dist/types/transfer-engine.d.ts +148 -0
- package/dist/types/transfer-engine.d.ts.map +1 -0
- package/dist/types/utils.d.ts +82 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/utils/components.d.ts +23 -3
- package/dist/utils/components.d.ts.map +1 -1
- package/dist/utils/components.js +230 -0
- package/dist/utils/components.js.map +1 -0
- package/dist/utils/components.mjs +219 -0
- package/dist/utils/components.mjs.map +1 -0
- package/dist/{engine → utils}/diagnostic.d.ts +1 -0
- package/dist/utils/diagnostic.d.ts.map +1 -0
- package/dist/utils/diagnostic.js +51 -0
- package/dist/utils/diagnostic.js.map +1 -0
- package/dist/utils/diagnostic.mjs +49 -0
- package/dist/utils/diagnostic.mjs.map +1 -0
- package/dist/utils/encryption/decrypt.d.ts +6 -5
- package/dist/utils/encryption/decrypt.d.ts.map +1 -1
- package/dist/utils/encryption/decrypt.js +47 -0
- package/dist/utils/encryption/decrypt.js.map +1 -0
- package/dist/utils/encryption/decrypt.mjs +45 -0
- package/dist/utils/encryption/decrypt.mjs.map +1 -0
- package/dist/utils/encryption/encrypt.d.ts +6 -5
- package/dist/utils/encryption/encrypt.d.ts.map +1 -1
- package/dist/utils/encryption/encrypt.js +47 -0
- package/dist/utils/encryption/encrypt.js.map +1 -0
- package/dist/utils/encryption/encrypt.mjs +45 -0
- package/dist/utils/encryption/encrypt.mjs.map +1 -0
- package/dist/utils/encryption/index.js +10 -0
- package/dist/utils/encryption/index.js.map +1 -0
- package/dist/utils/encryption/index.mjs +3 -0
- package/dist/utils/encryption/index.mjs.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +28 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +17 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/json.d.ts.map +1 -1
- package/dist/utils/json.js +96 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/json.mjs +94 -0
- package/dist/utils/json.mjs.map +1 -0
- package/dist/utils/middleware.d.ts +1 -1
- package/dist/utils/middleware.d.ts.map +1 -1
- package/dist/utils/middleware.js +14 -0
- package/dist/utils/middleware.js.map +1 -0
- package/dist/utils/middleware.mjs +12 -0
- package/dist/utils/middleware.mjs.map +1 -0
- package/dist/utils/providers.js +12 -0
- package/dist/utils/providers.js.map +1 -0
- package/dist/utils/providers.mjs +10 -0
- package/dist/utils/providers.mjs.map +1 -0
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +32 -0
- package/dist/utils/schema.js.map +1 -0
- package/dist/utils/schema.mjs +29 -0
- package/dist/utils/schema.mjs.map +1 -0
- package/dist/utils/stream.d.ts +0 -1
- package/dist/utils/stream.d.ts.map +1 -1
- package/dist/utils/stream.js +96 -0
- package/dist/utils/stream.js.map +1 -0
- package/dist/utils/stream.mjs +92 -0
- package/dist/utils/stream.mjs.map +1 -0
- package/dist/utils/transaction.d.ts +1 -1
- package/dist/utils/transaction.d.ts.map +1 -1
- package/dist/utils/transaction.js +93 -0
- package/dist/utils/transaction.js.map +1 -0
- package/dist/utils/transaction.mjs +91 -0
- package/dist/utils/transaction.mjs.map +1 -0
- package/dist/utils/transfer-asset-chunk.d.ts +61 -0
- package/dist/utils/transfer-asset-chunk.d.ts.map +1 -0
- package/dist/utils/transfer-asset-chunk.js +118 -0
- package/dist/utils/transfer-asset-chunk.js.map +1 -0
- package/dist/utils/transfer-asset-chunk.mjs +112 -0
- package/dist/utils/transfer-asset-chunk.mjs.map +1 -0
- package/dist/utils/transfer-websocket-json.d.ts +24 -0
- package/dist/utils/transfer-websocket-json.d.ts.map +1 -0
- package/dist/utils/transfer-websocket-json.js +67 -0
- package/dist/utils/transfer-websocket-json.js.map +1 -0
- package/dist/utils/transfer-websocket-json.mjs +63 -0
- package/dist/utils/transfer-websocket-json.mjs.map +1 -0
- package/dist/utils/writable-async-write.d.ts +16 -0
- package/dist/utils/writable-async-write.d.ts.map +1 -0
- package/dist/utils/writable-async-write.js +61 -0
- package/dist/utils/writable-async-write.js.map +1 -0
- package/dist/utils/writable-async-write.mjs +59 -0
- package/dist/utils/writable-async-write.mjs.map +1 -0
- package/package.json +40 -26
- package/dist/engine/diagnostic.d.ts.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var events = require('events');
|
|
4
|
+
|
|
5
|
+
const createDiagnosticReporter = (options = {})=>{
|
|
6
|
+
const { stackSize = -1 } = options;
|
|
7
|
+
const emitter = new events.EventEmitter();
|
|
8
|
+
const stack = [];
|
|
9
|
+
const addListener = (event, listener)=>{
|
|
10
|
+
emitter.on(event, listener);
|
|
11
|
+
};
|
|
12
|
+
const isDiagnosticValid = (diagnostic)=>{
|
|
13
|
+
if (!diagnostic.kind || !diagnostic.details || !diagnostic.details.message) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
stack: {
|
|
20
|
+
get size () {
|
|
21
|
+
return stack.length;
|
|
22
|
+
},
|
|
23
|
+
get items () {
|
|
24
|
+
return stack;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
report (diagnostic) {
|
|
28
|
+
if (!isDiagnosticValid(diagnostic)) {
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
emitter.emit('diagnostic', diagnostic);
|
|
32
|
+
emitter.emit(`diagnostic.${diagnostic.kind}`, diagnostic);
|
|
33
|
+
if (stackSize !== -1 && stack.length >= stackSize) {
|
|
34
|
+
stack.shift();
|
|
35
|
+
}
|
|
36
|
+
stack.push(diagnostic);
|
|
37
|
+
return this;
|
|
38
|
+
},
|
|
39
|
+
onDiagnostic (listener) {
|
|
40
|
+
addListener('diagnostic', listener);
|
|
41
|
+
return this;
|
|
42
|
+
},
|
|
43
|
+
on (kind, listener) {
|
|
44
|
+
addListener(`diagnostic.${kind}`, listener);
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
exports.createDiagnosticReporter = createDiagnosticReporter;
|
|
51
|
+
//# sourceMappingURL=diagnostic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostic.js","sources":["../../src/utils/diagnostic.ts"],"sourcesContent":["import { EventEmitter } from 'events';\n\nexport interface IDiagnosticReporterOptions {\n stackSize?: number;\n}\n\nexport type GenericDiagnostic<K extends DiagnosticKind, T = unknown> = {\n kind: K;\n details: {\n message: string;\n createdAt: Date;\n } & T;\n};\n\nexport type DiagnosticKind = 'error' | 'warning' | 'info';\n\nexport type DiagnosticListener<T extends DiagnosticKind = DiagnosticKind> = (\n diagnostic: { kind: T } & Diagnostic extends infer U ? U : never\n) => void | Promise<void>;\n\nexport type DiagnosticEvent = 'diagnostic' | `diagnostic.${DiagnosticKind}`;\n\nexport type GetEventListener<E extends DiagnosticEvent> = E extends 'diagnostic'\n ? DiagnosticListener\n : E extends `diagnostic.${infer K}`\n ? K extends DiagnosticKind\n ? DiagnosticListener<K>\n : never\n : never;\n\nexport type Diagnostic = ErrorDiagnostic | WarningDiagnostic | InfoDiagnostic;\n\nexport type ErrorDiagnosticSeverity = 'fatal' | 'error' | 'silly';\n\nexport type ErrorDiagnostic = GenericDiagnostic<\n 'error',\n {\n name: string;\n severity: ErrorDiagnosticSeverity;\n error: Error;\n }\n>;\n\nexport type WarningDiagnostic = GenericDiagnostic<\n 'warning',\n {\n origin?: string;\n }\n>;\n\nexport type InfoDiagnostic<T = unknown> = GenericDiagnostic<\n 'info',\n {\n origin?: string;\n params?: T;\n }\n>;\n\nexport interface IDiagnosticReporter {\n stack: {\n readonly size: number;\n readonly items: Diagnostic[];\n };\n\n report(diagnostic: Diagnostic): IDiagnosticReporter;\n onDiagnostic(listener: DiagnosticListener): IDiagnosticReporter;\n on<T extends DiagnosticKind>(kind: T, listener: DiagnosticListener<T>): IDiagnosticReporter;\n}\n\nconst createDiagnosticReporter = (\n options: IDiagnosticReporterOptions = {}\n): IDiagnosticReporter => {\n const { stackSize = -1 } = options;\n\n const emitter = new EventEmitter();\n const stack: Diagnostic[] = [];\n\n const addListener = <T extends DiagnosticEvent>(event: T, listener: GetEventListener<T>) => {\n emitter.on(event, listener);\n };\n\n const isDiagnosticValid = (diagnostic: Diagnostic) => {\n if (!diagnostic.kind || !diagnostic.details || !diagnostic.details.message) {\n return false;\n }\n return true;\n };\n\n return {\n stack: {\n get size() {\n return stack.length;\n },\n\n get items() {\n return stack;\n },\n },\n\n report(diagnostic: Diagnostic) {\n if (!isDiagnosticValid(diagnostic)) {\n return this;\n }\n\n emitter.emit('diagnostic', diagnostic);\n emitter.emit(`diagnostic.${diagnostic.kind}`, diagnostic);\n\n if (stackSize !== -1 && stack.length >= stackSize) {\n stack.shift();\n }\n\n stack.push(diagnostic);\n\n return this;\n },\n\n onDiagnostic(listener: DiagnosticListener) {\n addListener('diagnostic', listener);\n\n return this;\n },\n\n on<T extends DiagnosticKind>(kind: T, listener: DiagnosticListener<T>) {\n addListener(`diagnostic.${kind}`, listener as never);\n\n return this;\n },\n };\n};\n\nexport { createDiagnosticReporter };\n"],"names":["createDiagnosticReporter","options","stackSize","emitter","EventEmitter","stack","addListener","event","listener","on","isDiagnosticValid","diagnostic","kind","details","message","size","length","items","report","emit","shift","push","onDiagnostic"],"mappings":";;;;AAqEA,MAAMA,wBAAAA,GAA2B,CAC/BC,OAAAA,GAAsC,EAAE,GAAA;AAExC,IAAA,MAAM,EAAEC,SAAAA,GAAY,EAAE,EAAE,GAAGD,OAAAA;AAE3B,IAAA,MAAME,UAAU,IAAIC,mBAAAA,EAAAA;AACpB,IAAA,MAAMC,QAAsB,EAAE;IAE9B,MAAMC,WAAAA,GAAc,CAA4BC,KAAAA,EAAUC,QAAAA,GAAAA;QACxDL,OAAAA,CAAQM,EAAE,CAACF,KAAAA,EAAOC,QAAAA,CAAAA;AACpB,IAAA,CAAA;AAEA,IAAA,MAAME,oBAAoB,CAACC,UAAAA,GAAAA;AACzB,QAAA,IAAI,CAACA,UAAAA,CAAWC,IAAI,IAAI,CAACD,UAAAA,CAAWE,OAAO,IAAI,CAACF,UAAAA,CAAWE,OAAO,CAACC,OAAO,EAAE;YAC1E,OAAO,KAAA;AACT,QAAA;QACA,OAAO,IAAA;AACT,IAAA,CAAA;IAEA,OAAO;QACLT,KAAAA,EAAO;AACL,YAAA,IAAIU,IAAAA,CAAAA,GAAO;AACT,gBAAA,OAAOV,MAAMW,MAAM;AACrB,YAAA,CAAA;AAEA,YAAA,IAAIC,KAAAA,CAAAA,GAAQ;gBACV,OAAOZ,KAAAA;AACT,YAAA;AACF,SAAA;AAEAa,QAAAA,MAAAA,CAAAA,CAAOP,UAAsB,EAAA;YAC3B,IAAI,CAACD,kBAAkBC,UAAAA,CAAAA,EAAa;AAClC,gBAAA,OAAO,IAAI;AACb,YAAA;YAEAR,OAAAA,CAAQgB,IAAI,CAAC,YAAA,EAAcR,UAAAA,CAAAA;YAC3BR,OAAAA,CAAQgB,IAAI,CAAC,CAAC,WAAW,EAAER,UAAAA,CAAWC,IAAI,EAAE,EAAED,UAAAA,CAAAA;AAE9C,YAAA,IAAIT,cAAc,EAAC,IAAKG,KAAAA,CAAMW,MAAM,IAAId,SAAAA,EAAW;AACjDG,gBAAAA,KAAAA,CAAMe,KAAK,EAAA;AACb,YAAA;AAEAf,YAAAA,KAAAA,CAAMgB,IAAI,CAACV,UAAAA,CAAAA;AAEX,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEAW,QAAAA,YAAAA,CAAAA,CAAad,QAA4B,EAAA;AACvCF,YAAAA,WAAAA,CAAY,YAAA,EAAcE,QAAAA,CAAAA;AAE1B,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;QAEAC,EAAAA,CAAAA,CAA6BG,IAAO,EAAEJ,QAA+B,EAAA;AACnEF,YAAAA,WAAAA,CAAY,CAAC,WAAW,EAAEM,IAAAA,CAAAA,CAAM,EAAEJ,QAAAA,CAAAA;AAElC,YAAA,OAAO,IAAI;AACb,QAAA;AACF,KAAA;AACF;;;;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
|
|
3
|
+
const createDiagnosticReporter = (options = {})=>{
|
|
4
|
+
const { stackSize = -1 } = options;
|
|
5
|
+
const emitter = new EventEmitter();
|
|
6
|
+
const stack = [];
|
|
7
|
+
const addListener = (event, listener)=>{
|
|
8
|
+
emitter.on(event, listener);
|
|
9
|
+
};
|
|
10
|
+
const isDiagnosticValid = (diagnostic)=>{
|
|
11
|
+
if (!diagnostic.kind || !diagnostic.details || !diagnostic.details.message) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
stack: {
|
|
18
|
+
get size () {
|
|
19
|
+
return stack.length;
|
|
20
|
+
},
|
|
21
|
+
get items () {
|
|
22
|
+
return stack;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
report (diagnostic) {
|
|
26
|
+
if (!isDiagnosticValid(diagnostic)) {
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
emitter.emit('diagnostic', diagnostic);
|
|
30
|
+
emitter.emit(`diagnostic.${diagnostic.kind}`, diagnostic);
|
|
31
|
+
if (stackSize !== -1 && stack.length >= stackSize) {
|
|
32
|
+
stack.shift();
|
|
33
|
+
}
|
|
34
|
+
stack.push(diagnostic);
|
|
35
|
+
return this;
|
|
36
|
+
},
|
|
37
|
+
onDiagnostic (listener) {
|
|
38
|
+
addListener('diagnostic', listener);
|
|
39
|
+
return this;
|
|
40
|
+
},
|
|
41
|
+
on (kind, listener) {
|
|
42
|
+
addListener(`diagnostic.${kind}`, listener);
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { createDiagnosticReporter };
|
|
49
|
+
//# sourceMappingURL=diagnostic.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostic.mjs","sources":["../../src/utils/diagnostic.ts"],"sourcesContent":["import { EventEmitter } from 'events';\n\nexport interface IDiagnosticReporterOptions {\n stackSize?: number;\n}\n\nexport type GenericDiagnostic<K extends DiagnosticKind, T = unknown> = {\n kind: K;\n details: {\n message: string;\n createdAt: Date;\n } & T;\n};\n\nexport type DiagnosticKind = 'error' | 'warning' | 'info';\n\nexport type DiagnosticListener<T extends DiagnosticKind = DiagnosticKind> = (\n diagnostic: { kind: T } & Diagnostic extends infer U ? U : never\n) => void | Promise<void>;\n\nexport type DiagnosticEvent = 'diagnostic' | `diagnostic.${DiagnosticKind}`;\n\nexport type GetEventListener<E extends DiagnosticEvent> = E extends 'diagnostic'\n ? DiagnosticListener\n : E extends `diagnostic.${infer K}`\n ? K extends DiagnosticKind\n ? DiagnosticListener<K>\n : never\n : never;\n\nexport type Diagnostic = ErrorDiagnostic | WarningDiagnostic | InfoDiagnostic;\n\nexport type ErrorDiagnosticSeverity = 'fatal' | 'error' | 'silly';\n\nexport type ErrorDiagnostic = GenericDiagnostic<\n 'error',\n {\n name: string;\n severity: ErrorDiagnosticSeverity;\n error: Error;\n }\n>;\n\nexport type WarningDiagnostic = GenericDiagnostic<\n 'warning',\n {\n origin?: string;\n }\n>;\n\nexport type InfoDiagnostic<T = unknown> = GenericDiagnostic<\n 'info',\n {\n origin?: string;\n params?: T;\n }\n>;\n\nexport interface IDiagnosticReporter {\n stack: {\n readonly size: number;\n readonly items: Diagnostic[];\n };\n\n report(diagnostic: Diagnostic): IDiagnosticReporter;\n onDiagnostic(listener: DiagnosticListener): IDiagnosticReporter;\n on<T extends DiagnosticKind>(kind: T, listener: DiagnosticListener<T>): IDiagnosticReporter;\n}\n\nconst createDiagnosticReporter = (\n options: IDiagnosticReporterOptions = {}\n): IDiagnosticReporter => {\n const { stackSize = -1 } = options;\n\n const emitter = new EventEmitter();\n const stack: Diagnostic[] = [];\n\n const addListener = <T extends DiagnosticEvent>(event: T, listener: GetEventListener<T>) => {\n emitter.on(event, listener);\n };\n\n const isDiagnosticValid = (diagnostic: Diagnostic) => {\n if (!diagnostic.kind || !diagnostic.details || !diagnostic.details.message) {\n return false;\n }\n return true;\n };\n\n return {\n stack: {\n get size() {\n return stack.length;\n },\n\n get items() {\n return stack;\n },\n },\n\n report(diagnostic: Diagnostic) {\n if (!isDiagnosticValid(diagnostic)) {\n return this;\n }\n\n emitter.emit('diagnostic', diagnostic);\n emitter.emit(`diagnostic.${diagnostic.kind}`, diagnostic);\n\n if (stackSize !== -1 && stack.length >= stackSize) {\n stack.shift();\n }\n\n stack.push(diagnostic);\n\n return this;\n },\n\n onDiagnostic(listener: DiagnosticListener) {\n addListener('diagnostic', listener);\n\n return this;\n },\n\n on<T extends DiagnosticKind>(kind: T, listener: DiagnosticListener<T>) {\n addListener(`diagnostic.${kind}`, listener as never);\n\n return this;\n },\n };\n};\n\nexport { createDiagnosticReporter };\n"],"names":["createDiagnosticReporter","options","stackSize","emitter","EventEmitter","stack","addListener","event","listener","on","isDiagnosticValid","diagnostic","kind","details","message","size","length","items","report","emit","shift","push","onDiagnostic"],"mappings":";;AAqEA,MAAMA,wBAAAA,GAA2B,CAC/BC,OAAAA,GAAsC,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AAEX,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEAW,QAAAA,YAAAA,CAAAA,CAAad,QAA4B,EAAA;AACvCF,YAAAA,WAAAA,CAAY,YAAA,EAAcE,QAAAA,CAAAA;AAE1B,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;QAEAC,EAAAA,CAAAA,CAA6BG,IAAO,EAAEJ,QAA+B,EAAA;AACnEF,YAAAA,WAAAA,CAAY,CAAC,WAAW,EAAEM,IAAAA,CAAAA,CAAM,EAAEJ,QAAAA,CAAAA;AAElC,YAAA,OAAO,IAAI;AACb,QAAA;AACF,KAAA;AACF;;;;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { createDecipheriv } from 'crypto';
|
|
2
|
+
import { Algorithm } from '../../types';
|
|
3
|
+
type Decipheriv = ReturnType<typeof createDecipheriv>;
|
|
4
4
|
/**
|
|
5
5
|
* It creates a cipher instance used for decryption
|
|
6
6
|
*
|
|
7
7
|
* @param key - The decryption key
|
|
8
8
|
* @param algorithm - The algorithm to use to create the Cipher
|
|
9
9
|
*
|
|
10
|
-
* @returns A {@link
|
|
10
|
+
* @returns A {@link Decipheriv} instance created with the given key & algorithm
|
|
11
11
|
*/
|
|
12
|
-
export declare const createDecryptionCipher: (key: string, algorithm?: Algorithm) =>
|
|
12
|
+
export declare const createDecryptionCipher: (key: string, algorithm?: Algorithm) => Decipheriv;
|
|
13
|
+
export {};
|
|
13
14
|
//# sourceMappingURL=decrypt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decrypt.d.ts","sourceRoot":"","sources":["../../../src/utils/encryption/decrypt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decrypt.d.ts","sourceRoot":"","sources":["../../../src/utils/encryption/decrypt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC7E,OAAO,EAAkC,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxE,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAkCtD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GACjC,KAAK,MAAM,EACX,YAAW,SAAyB,KACnC,UAEF,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var crypto = require('crypto');
|
|
4
|
+
|
|
5
|
+
// different key values depending on algorithm chosen
|
|
6
|
+
const getDecryptionStrategy = (algorithm)=>{
|
|
7
|
+
const strategies = {
|
|
8
|
+
'aes-128-ecb' (key) {
|
|
9
|
+
const hashedKey = crypto.scryptSync(key, '', 16);
|
|
10
|
+
const initVector = null;
|
|
11
|
+
const securityKey = hashedKey;
|
|
12
|
+
return crypto.createDecipheriv(algorithm, securityKey, initVector);
|
|
13
|
+
},
|
|
14
|
+
aes128 (key) {
|
|
15
|
+
const hashedKey = crypto.scryptSync(key, '', 32);
|
|
16
|
+
const initVector = hashedKey.subarray(16);
|
|
17
|
+
const securityKey = hashedKey.subarray(0, 16);
|
|
18
|
+
return crypto.createDecipheriv(algorithm, securityKey, initVector);
|
|
19
|
+
},
|
|
20
|
+
aes192 (key) {
|
|
21
|
+
const hashedKey = crypto.scryptSync(key, '', 40);
|
|
22
|
+
const initVector = hashedKey.subarray(24);
|
|
23
|
+
const securityKey = hashedKey.subarray(0, 24);
|
|
24
|
+
return crypto.createDecipheriv(algorithm, securityKey, initVector);
|
|
25
|
+
},
|
|
26
|
+
aes256 (key) {
|
|
27
|
+
const hashedKey = crypto.scryptSync(key, '', 48);
|
|
28
|
+
const initVector = hashedKey.subarray(32);
|
|
29
|
+
const securityKey = hashedKey.subarray(0, 32);
|
|
30
|
+
return crypto.createDecipheriv(algorithm, securityKey, initVector);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return strategies[algorithm];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* It creates a cipher instance used for decryption
|
|
37
|
+
*
|
|
38
|
+
* @param key - The decryption key
|
|
39
|
+
* @param algorithm - The algorithm to use to create the Cipher
|
|
40
|
+
*
|
|
41
|
+
* @returns A {@link Decipheriv} instance created with the given key & algorithm
|
|
42
|
+
*/ const createDecryptionCipher = (key, algorithm = 'aes-128-ecb')=>{
|
|
43
|
+
return getDecryptionStrategy(algorithm)(key);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
exports.createDecryptionCipher = createDecryptionCipher;
|
|
47
|
+
//# sourceMappingURL=decrypt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decrypt.js","sources":["../../../src/utils/encryption/decrypt.ts"],"sourcesContent":["import { scryptSync, CipherKey, BinaryLike, createDecipheriv } from 'crypto';\nimport { EncryptionStrategy, Strategies, Algorithm } from '../../types';\n\n// @types/node 20.x names this class Decipher; 24.x renames it to Decipheriv. Derive via ReturnType so signatures hold across both.\ntype Decipheriv = ReturnType<typeof createDecipheriv>;\n\n// different key values depending on algorithm chosen\nconst getDecryptionStrategy = (algorithm: Algorithm): EncryptionStrategy => {\n const strategies: Strategies = {\n 'aes-128-ecb'(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 16);\n const initVector: BinaryLike | null = null;\n const securityKey: CipherKey = hashedKey;\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes128(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 32);\n const initVector: BinaryLike | null = hashedKey.subarray(16);\n const securityKey: CipherKey = hashedKey.subarray(0, 16);\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes192(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 40);\n const initVector: BinaryLike | null = hashedKey.subarray(24);\n const securityKey: CipherKey = hashedKey.subarray(0, 24);\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes256(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 48);\n const initVector: BinaryLike | null = hashedKey.subarray(32);\n const securityKey: CipherKey = hashedKey.subarray(0, 32);\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n };\n\n return strategies[algorithm];\n};\n\n/**\n * It creates a cipher instance used for decryption\n *\n * @param key - The decryption key\n * @param algorithm - The algorithm to use to create the Cipher\n *\n * @returns A {@link Decipheriv} instance created with the given key & algorithm\n */\nexport const createDecryptionCipher = (\n key: string,\n algorithm: Algorithm = 'aes-128-ecb'\n): Decipheriv => {\n return getDecryptionStrategy(algorithm)(key);\n};\n"],"names":["getDecryptionStrategy","algorithm","strategies","key","hashedKey","scryptSync","initVector","securityKey","createDecipheriv","aes128","subarray","aes192","aes256","createDecryptionCipher"],"mappings":";;;;AAMA;AACA,MAAMA,wBAAwB,CAACC,SAAAA,GAAAA;AAC7B,IAAA,MAAMC,UAAAA,GAAyB;AAC7B,QAAA,aAAA,CAAA,CAAcC,GAAW,EAAA;YACvB,MAAMC,SAAAA,GAAYC,iBAAAA,CAAWF,GAAAA,EAAK,EAAA,EAAI,EAAA,CAAA;AACtC,YAAA,MAAMG,UAAAA,GAAgC,IAAA;AACtC,YAAA,MAAMC,WAAAA,GAAyBH,SAAAA;YAC/B,OAAOI,uBAAAA,CAAiBP,WAAWM,WAAAA,EAAaD,UAAAA,CAAAA;AAClD,QAAA,CAAA;AACAG,QAAAA,MAAAA,CAAAA,CAAON,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,iBAAAA,CAAWF,GAAAA,EAAK,EAAA,EAAI,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAAA,CAAUM,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAAA,GAAyBH,SAAAA,CAAUM,QAAQ,CAAC,CAAA,EAAG,EAAA,CAAA;YACrD,OAAOF,uBAAAA,CAAiBP,WAAWM,WAAAA,EAAaD,UAAAA,CAAAA;AAClD,QAAA,CAAA;AACAK,QAAAA,MAAAA,CAAAA,CAAOR,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,iBAAAA,CAAWF,GAAAA,EAAK,EAAA,EAAI,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAAA,CAAUM,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAAA,GAAyBH,SAAAA,CAAUM,QAAQ,CAAC,CAAA,EAAG,EAAA,CAAA;YACrD,OAAOF,uBAAAA,CAAiBP,WAAWM,WAAAA,EAAaD,UAAAA,CAAAA;AAClD,QAAA,CAAA;AACAM,QAAAA,MAAAA,CAAAA,CAAOT,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,iBAAAA,CAAWF,GAAAA,EAAK,EAAA,EAAI,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAAA,CAAUM,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAAA,GAAyBH,SAAAA,CAAUM,QAAQ,CAAC,CAAA,EAAG,EAAA,CAAA;YACrD,OAAOF,uBAAAA,CAAiBP,WAAWM,WAAAA,EAAaD,UAAAA,CAAAA;AAClD,QAAA;AACF,KAAA;IAEA,OAAOJ,UAAU,CAACD,SAAAA,CAAU;AAC9B,CAAA;AAEA;;;;;;;AAOC,IACM,MAAMY,sBAAAA,GAAyB,CACpCV,GAAAA,EACAF,YAAuB,aAAa,GAAA;AAEpC,IAAA,OAAOD,sBAAsBC,SAAAA,CAAAA,CAAWE,GAAAA,CAAAA;AAC1C;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { scryptSync, createDecipheriv } from 'crypto';
|
|
2
|
+
|
|
3
|
+
// different key values depending on algorithm chosen
|
|
4
|
+
const getDecryptionStrategy = (algorithm)=>{
|
|
5
|
+
const strategies = {
|
|
6
|
+
'aes-128-ecb' (key) {
|
|
7
|
+
const hashedKey = scryptSync(key, '', 16);
|
|
8
|
+
const initVector = null;
|
|
9
|
+
const securityKey = hashedKey;
|
|
10
|
+
return createDecipheriv(algorithm, securityKey, initVector);
|
|
11
|
+
},
|
|
12
|
+
aes128 (key) {
|
|
13
|
+
const hashedKey = scryptSync(key, '', 32);
|
|
14
|
+
const initVector = hashedKey.subarray(16);
|
|
15
|
+
const securityKey = hashedKey.subarray(0, 16);
|
|
16
|
+
return createDecipheriv(algorithm, securityKey, initVector);
|
|
17
|
+
},
|
|
18
|
+
aes192 (key) {
|
|
19
|
+
const hashedKey = scryptSync(key, '', 40);
|
|
20
|
+
const initVector = hashedKey.subarray(24);
|
|
21
|
+
const securityKey = hashedKey.subarray(0, 24);
|
|
22
|
+
return createDecipheriv(algorithm, securityKey, initVector);
|
|
23
|
+
},
|
|
24
|
+
aes256 (key) {
|
|
25
|
+
const hashedKey = scryptSync(key, '', 48);
|
|
26
|
+
const initVector = hashedKey.subarray(32);
|
|
27
|
+
const securityKey = hashedKey.subarray(0, 32);
|
|
28
|
+
return createDecipheriv(algorithm, securityKey, initVector);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return strategies[algorithm];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* It creates a cipher instance used for decryption
|
|
35
|
+
*
|
|
36
|
+
* @param key - The decryption key
|
|
37
|
+
* @param algorithm - The algorithm to use to create the Cipher
|
|
38
|
+
*
|
|
39
|
+
* @returns A {@link Decipheriv} instance created with the given key & algorithm
|
|
40
|
+
*/ const createDecryptionCipher = (key, algorithm = 'aes-128-ecb')=>{
|
|
41
|
+
return getDecryptionStrategy(algorithm)(key);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { createDecryptionCipher };
|
|
45
|
+
//# sourceMappingURL=decrypt.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decrypt.mjs","sources":["../../../src/utils/encryption/decrypt.ts"],"sourcesContent":["import { scryptSync, CipherKey, BinaryLike, createDecipheriv } from 'crypto';\nimport { EncryptionStrategy, Strategies, Algorithm } from '../../types';\n\n// @types/node 20.x names this class Decipher; 24.x renames it to Decipheriv. Derive via ReturnType so signatures hold across both.\ntype Decipheriv = ReturnType<typeof createDecipheriv>;\n\n// different key values depending on algorithm chosen\nconst getDecryptionStrategy = (algorithm: Algorithm): EncryptionStrategy => {\n const strategies: Strategies = {\n 'aes-128-ecb'(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 16);\n const initVector: BinaryLike | null = null;\n const securityKey: CipherKey = hashedKey;\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes128(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 32);\n const initVector: BinaryLike | null = hashedKey.subarray(16);\n const securityKey: CipherKey = hashedKey.subarray(0, 16);\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes192(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 40);\n const initVector: BinaryLike | null = hashedKey.subarray(24);\n const securityKey: CipherKey = hashedKey.subarray(0, 24);\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes256(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 48);\n const initVector: BinaryLike | null = hashedKey.subarray(32);\n const securityKey: CipherKey = hashedKey.subarray(0, 32);\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n };\n\n return strategies[algorithm];\n};\n\n/**\n * It creates a cipher instance used for decryption\n *\n * @param key - The decryption key\n * @param algorithm - The algorithm to use to create the Cipher\n *\n * @returns A {@link Decipheriv} instance created with the given key & algorithm\n */\nexport const createDecryptionCipher = (\n key: string,\n algorithm: Algorithm = 'aes-128-ecb'\n): Decipheriv => {\n return getDecryptionStrategy(algorithm)(key);\n};\n"],"names":["getDecryptionStrategy","algorithm","strategies","key","hashedKey","scryptSync","initVector","securityKey","createDecipheriv","aes128","subarray","aes192","aes256","createDecryptionCipher"],"mappings":";;AAMA;AACA,MAAMA,wBAAwB,CAACC,SAAAA,GAAAA;AAC7B,IAAA,MAAMC,UAAAA,GAAyB;AAC7B,QAAA,aAAA,CAAA,CAAcC,GAAW,EAAA;YACvB,MAAMC,SAAAA,GAAYC,UAAAA,CA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F,gBAAAA,CAAiBP,WAAWM,WAAAA,EAAaD,UAAAA,CAAAA;AAClD,QAAA;AACF,KAAA;IAEA,OAAOJ,UAAU,CAACD,SAAAA,CAAU;AAC9B,CAAA;AAEA;;;;;;;AAOC,IACM,MAAMY,sBAAAA,GAAyB,CACpCV,GAAAA,EACAF,YAAuB,aAAa,GAAA;AAEpC,IAAA,OAAOD,sBAAsBC,SAAAA,CAAAA,CAAWE,GAAAA,CAAAA;AAC1C;;;;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { createCipheriv } from 'crypto';
|
|
2
|
+
import { Algorithm } from '../../types';
|
|
3
|
+
type Cipheriv = ReturnType<typeof createCipheriv>;
|
|
4
4
|
/**
|
|
5
5
|
* It creates a cipher instance used for encryption
|
|
6
6
|
*
|
|
7
7
|
* @param key - The encryption key
|
|
8
8
|
* @param algorithm - The algorithm to use to create the Cipher
|
|
9
9
|
*
|
|
10
|
-
* @returns A {@link
|
|
10
|
+
* @returns A {@link Cipheriv} instance created with the given key & algorithm
|
|
11
11
|
*/
|
|
12
|
-
export declare const createEncryptionCipher: (key: string, algorithm?: Algorithm) =>
|
|
12
|
+
export declare const createEncryptionCipher: (key: string, algorithm?: Algorithm) => Cipheriv;
|
|
13
|
+
export {};
|
|
13
14
|
//# sourceMappingURL=encrypt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encrypt.d.ts","sourceRoot":"","sources":["../../../src/utils/encryption/encrypt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"encrypt.d.ts","sourceRoot":"","sources":["../../../src/utils/encryption/encrypt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,MAAM,QAAQ,CAAC;AAC3E,OAAO,EAAkC,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxE,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAkClD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GACjC,KAAK,MAAM,EACX,YAAW,SAAyB,KACnC,QAEF,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var crypto = require('crypto');
|
|
4
|
+
|
|
5
|
+
// different key values depending on algorithm chosen
|
|
6
|
+
const getEncryptionStrategy = (algorithm)=>{
|
|
7
|
+
const strategies = {
|
|
8
|
+
'aes-128-ecb' (key) {
|
|
9
|
+
const hashedKey = crypto.scryptSync(key, '', 16);
|
|
10
|
+
const initVector = null;
|
|
11
|
+
const securityKey = hashedKey;
|
|
12
|
+
return crypto.createCipheriv(algorithm, securityKey, initVector);
|
|
13
|
+
},
|
|
14
|
+
aes128 (key) {
|
|
15
|
+
const hashedKey = crypto.scryptSync(key, '', 32);
|
|
16
|
+
const initVector = hashedKey.subarray(16);
|
|
17
|
+
const securityKey = hashedKey.subarray(0, 16);
|
|
18
|
+
return crypto.createCipheriv(algorithm, securityKey, initVector);
|
|
19
|
+
},
|
|
20
|
+
aes192 (key) {
|
|
21
|
+
const hashedKey = crypto.scryptSync(key, '', 40);
|
|
22
|
+
const initVector = hashedKey.subarray(24);
|
|
23
|
+
const securityKey = hashedKey.subarray(0, 24);
|
|
24
|
+
return crypto.createCipheriv(algorithm, securityKey, initVector);
|
|
25
|
+
},
|
|
26
|
+
aes256 (key) {
|
|
27
|
+
const hashedKey = crypto.scryptSync(key, '', 48);
|
|
28
|
+
const initVector = hashedKey.subarray(32);
|
|
29
|
+
const securityKey = hashedKey.subarray(0, 32);
|
|
30
|
+
return crypto.createCipheriv(algorithm, securityKey, initVector);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return strategies[algorithm];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* It creates a cipher instance used for encryption
|
|
37
|
+
*
|
|
38
|
+
* @param key - The encryption key
|
|
39
|
+
* @param algorithm - The algorithm to use to create the Cipher
|
|
40
|
+
*
|
|
41
|
+
* @returns A {@link Cipheriv} instance created with the given key & algorithm
|
|
42
|
+
*/ const createEncryptionCipher = (key, algorithm = 'aes-128-ecb')=>{
|
|
43
|
+
return getEncryptionStrategy(algorithm)(key);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
exports.createEncryptionCipher = createEncryptionCipher;
|
|
47
|
+
//# sourceMappingURL=encrypt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encrypt.js","sources":["../../../src/utils/encryption/encrypt.ts"],"sourcesContent":["import { createCipheriv, scryptSync, CipherKey, BinaryLike } from 'crypto';\nimport { EncryptionStrategy, Strategies, Algorithm } from '../../types';\n\n// @types/node 20.x names this class Cipher; 24.x renames it to Cipheriv. Derive via ReturnType so signatures hold across both.\ntype Cipheriv = ReturnType<typeof createCipheriv>;\n\n// different key values depending on algorithm chosen\nconst getEncryptionStrategy = (algorithm: Algorithm): EncryptionStrategy => {\n const strategies: Strategies = {\n 'aes-128-ecb'(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 16);\n const initVector: BinaryLike | null = null;\n const securityKey: CipherKey = hashedKey;\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes128(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 32);\n const initVector: BinaryLike | null = hashedKey.subarray(16);\n const securityKey: CipherKey = hashedKey.subarray(0, 16);\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes192(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 40);\n const initVector: BinaryLike | null = hashedKey.subarray(24);\n const securityKey: CipherKey = hashedKey.subarray(0, 24);\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes256(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 48);\n const initVector: BinaryLike | null = hashedKey.subarray(32);\n const securityKey: CipherKey = hashedKey.subarray(0, 32);\n return createCipheriv(algorithm, securityKey, initVector);\n },\n };\n\n return strategies[algorithm];\n};\n\n/**\n * It creates a cipher instance used for encryption\n *\n * @param key - The encryption key\n * @param algorithm - The algorithm to use to create the Cipher\n *\n * @returns A {@link Cipheriv} instance created with the given key & algorithm\n */\nexport const createEncryptionCipher = (\n key: string,\n algorithm: Algorithm = 'aes-128-ecb'\n): Cipheriv => {\n return getEncryptionStrategy(algorithm)(key);\n};\n"],"names":["getEncryptionStrategy","algorithm","strategies","key","hashedKey","scryptSync","initVector","securityKey","createCipheriv","aes128","subarray","aes192","aes256","createEncryptionCipher"],"mappings":";;;;AAMA;AACA,MAAMA,wBAAwB,CAACC,SAAAA,GAAAA;AAC7B,IAAA,MAAMC,UAAAA,GAAyB;AAC7B,QAAA,aAAA,CAAA,CAAcC,GAAW,EAAA;YACvB,MAAMC,SAAAA,GAAYC,iBAAAA,CAAWF,GAAAA,EAAK,EAAA,EAAI,EAAA,CAAA;AACtC,YAAA,MAAMG,UAAAA,GAAgC,IAAA;AACtC,YAAA,MAAMC,WAAAA,GAAyBH,SAAAA;YAC/B,OAAOI,qBAAAA,CAAeP,WAAWM,WAAAA,EAAaD,UAAAA,CAAAA;AAChD,QAAA,CAAA;AACAG,QAAAA,MAAAA,CAAAA,CAAON,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,iBAAAA,CAAWF,GAAAA,EAAK,EAAA,EAAI,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAAA,CAAUM,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAAA,GAAyBH,SAAAA,CAAUM,QAAQ,CAAC,CAAA,EAAG,EAAA,CAAA;YACrD,OAAOF,qBAAAA,CAAeP,WAAWM,WAAAA,EAAaD,UAAAA,CAAAA;AAChD,QAAA,CAAA;AACAK,QAAAA,MAAAA,CAAAA,CAAOR,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,iBAAAA,CAAWF,GAAAA,EAAK,EAAA,EAAI,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAAA,CAAUM,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAAA,GAAyBH,SAAAA,CAAUM,QAAQ,CAAC,CAAA,EAAG,EAAA,CAAA;YACrD,OAAOF,qBAAAA,CAAeP,WAAWM,WAAAA,EAAaD,UAAAA,CAAAA;AAChD,QAAA,CAAA;AACAM,QAAAA,MAAAA,CAAAA,CAAOT,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,iBAAAA,CAAWF,GAAAA,EAAK,EAAA,EAAI,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAAA,CAAUM,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAAA,GAAyBH,SAAAA,CAAUM,QAAQ,CAAC,CAAA,EAAG,EAAA,CAAA;YACrD,OAAOF,qBAAAA,CAAeP,WAAWM,WAAAA,EAAaD,UAAAA,CAAAA;AAChD,QAAA;AACF,KAAA;IAEA,OAAOJ,UAAU,CAACD,SAAAA,CAAU;AAC9B,CAAA;AAEA;;;;;;;AAOC,IACM,MAAMY,sBAAAA,GAAyB,CACpCV,GAAAA,EACAF,YAAuB,aAAa,GAAA;AAEpC,IAAA,OAAOD,sBAAsBC,SAAAA,CAAAA,CAAWE,GAAAA,CAAAA;AAC1C;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { scryptSync, createCipheriv } from 'crypto';
|
|
2
|
+
|
|
3
|
+
// different key values depending on algorithm chosen
|
|
4
|
+
const getEncryptionStrategy = (algorithm)=>{
|
|
5
|
+
const strategies = {
|
|
6
|
+
'aes-128-ecb' (key) {
|
|
7
|
+
const hashedKey = scryptSync(key, '', 16);
|
|
8
|
+
const initVector = null;
|
|
9
|
+
const securityKey = hashedKey;
|
|
10
|
+
return createCipheriv(algorithm, securityKey, initVector);
|
|
11
|
+
},
|
|
12
|
+
aes128 (key) {
|
|
13
|
+
const hashedKey = scryptSync(key, '', 32);
|
|
14
|
+
const initVector = hashedKey.subarray(16);
|
|
15
|
+
const securityKey = hashedKey.subarray(0, 16);
|
|
16
|
+
return createCipheriv(algorithm, securityKey, initVector);
|
|
17
|
+
},
|
|
18
|
+
aes192 (key) {
|
|
19
|
+
const hashedKey = scryptSync(key, '', 40);
|
|
20
|
+
const initVector = hashedKey.subarray(24);
|
|
21
|
+
const securityKey = hashedKey.subarray(0, 24);
|
|
22
|
+
return createCipheriv(algorithm, securityKey, initVector);
|
|
23
|
+
},
|
|
24
|
+
aes256 (key) {
|
|
25
|
+
const hashedKey = scryptSync(key, '', 48);
|
|
26
|
+
const initVector = hashedKey.subarray(32);
|
|
27
|
+
const securityKey = hashedKey.subarray(0, 32);
|
|
28
|
+
return createCipheriv(algorithm, securityKey, initVector);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return strategies[algorithm];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* It creates a cipher instance used for encryption
|
|
35
|
+
*
|
|
36
|
+
* @param key - The encryption key
|
|
37
|
+
* @param algorithm - The algorithm to use to create the Cipher
|
|
38
|
+
*
|
|
39
|
+
* @returns A {@link Cipheriv} instance created with the given key & algorithm
|
|
40
|
+
*/ const createEncryptionCipher = (key, algorithm = 'aes-128-ecb')=>{
|
|
41
|
+
return getEncryptionStrategy(algorithm)(key);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { createEncryptionCipher };
|
|
45
|
+
//# sourceMappingURL=encrypt.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encrypt.mjs","sources":["../../../src/utils/encryption/encrypt.ts"],"sourcesContent":["import { createCipheriv, scryptSync, CipherKey, BinaryLike } from 'crypto';\nimport { EncryptionStrategy, Strategies, Algorithm } from '../../types';\n\n// @types/node 20.x names this class Cipher; 24.x renames it to Cipheriv. Derive via ReturnType so signatures hold across both.\ntype Cipheriv = ReturnType<typeof createCipheriv>;\n\n// different key values depending on algorithm chosen\nconst getEncryptionStrategy = (algorithm: Algorithm): EncryptionStrategy => {\n const strategies: Strategies = {\n 'aes-128-ecb'(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 16);\n const initVector: BinaryLike | null = null;\n const securityKey: CipherKey = hashedKey;\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes128(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 32);\n const initVector: BinaryLike | null = hashedKey.subarray(16);\n const securityKey: CipherKey = hashedKey.subarray(0, 16);\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes192(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 40);\n const initVector: BinaryLike | null = hashedKey.subarray(24);\n const securityKey: CipherKey = hashedKey.subarray(0, 24);\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes256(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 48);\n const initVector: BinaryLike | null = hashedKey.subarray(32);\n const securityKey: CipherKey = hashedKey.subarray(0, 32);\n return createCipheriv(algorithm, securityKey, initVector);\n },\n };\n\n return strategies[algorithm];\n};\n\n/**\n * It creates a cipher instance used for encryption\n *\n * @param key - The encryption key\n * @param algorithm - The algorithm to use to create the Cipher\n *\n * @returns A {@link Cipheriv} instance created with the given key & algorithm\n */\nexport const createEncryptionCipher = (\n key: string,\n algorithm: Algorithm = 'aes-128-ecb'\n): Cipheriv => {\n return getEncryptionStrategy(algorithm)(key);\n};\n"],"names":["getEncryptionStrategy","algorithm","strategies","key","hashedKey","scryptSync","initVector","securityKey","createCipheriv","aes128","subarray","aes192","aes256","createEncryptionCipher"],"mappings":";;AAMA;AACA,MAAMA,wBAAwB,CAACC,SAAAA,GAAAA;AAC7B,IAAA,MAAMC,UAAAA,GAAyB;AAC7B,QAAA,aAAA,CAAA,CAAcC,GAAW,EAAA;YACvB,MAAMC,SAAAA,GAAYC,UAAAA,CAAWF,GAAAA,EAAK,EAAA,EAAI,EAAA,CAAA;AACtC,YAAA,MAAMG,UAAAA,GAAgC,IAAA;AACtC,YAAA,MAAMC,WAAAA,GAAyBH,SAAAA;YAC/B,OA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;AAOC,IACM,MAAMY,sBAAAA,GAAyB,CACpCV,GAAAA,EACAF,YAAuB,aAAa,GAAA;AAEpC,IAAA,OAAOD,sBAAsBC,SAAAA,CAAAA,CAAWE,GAAAA,CAAAA;AAC1C;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var encrypt = require('./encrypt.js');
|
|
4
|
+
var decrypt = require('./decrypt.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.createEncryptionCipher = encrypt.createEncryptionCipher;
|
|
9
|
+
exports.createDecryptionCipher = decrypt.createDecryptionCipher;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * as encryption from './encryption';
|
|
2
|
+
export * from './transfer-asset-chunk';
|
|
3
|
+
export { write } from './writable-async-write';
|
|
2
4
|
export * as stream from './stream';
|
|
3
5
|
export * as json from './json';
|
|
4
6
|
export * as schema from './schema';
|
|
5
7
|
export * as transaction from './transaction';
|
|
6
8
|
export * as middleware from './middleware';
|
|
9
|
+
export * as diagnostics from './diagnostic';
|
|
7
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./encryption/index.js');
|
|
4
|
+
var transferAssetChunk = require('./transfer-asset-chunk.js');
|
|
5
|
+
var writableAsyncWrite = require('./writable-async-write.js');
|
|
6
|
+
var stream = require('./stream.js');
|
|
7
|
+
var json = require('./json.js');
|
|
8
|
+
var schema = require('./schema.js');
|
|
9
|
+
var transaction = require('./transaction.js');
|
|
10
|
+
var middleware = require('./middleware.js');
|
|
11
|
+
var diagnostic = require('./diagnostic.js');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.encryption = index;
|
|
16
|
+
exports.createTransferAssetStreamChunk = transferAssetChunk.createTransferAssetStreamChunk;
|
|
17
|
+
exports.createTransferAssetStreamChunkLegacy = transferAssetChunk.createTransferAssetStreamChunkLegacy;
|
|
18
|
+
exports.decodeTransferAssetStreamData = transferAssetChunk.decodeTransferAssetStreamData;
|
|
19
|
+
exports.decodeTransferAssetStreamItem = transferAssetChunk.decodeTransferAssetStreamItem;
|
|
20
|
+
exports.transferAssetStreamChunkByteLength = transferAssetChunk.transferAssetStreamChunkByteLength;
|
|
21
|
+
exports.write = writableAsyncWrite.write;
|
|
22
|
+
exports.stream = stream;
|
|
23
|
+
exports.json = json;
|
|
24
|
+
exports.schema = schema;
|
|
25
|
+
exports.transaction = transaction;
|
|
26
|
+
exports.middleware = middleware;
|
|
27
|
+
exports.diagnostics = diagnostic;
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as index from './encryption/index.mjs';
|
|
2
|
+
export { index as encryption };
|
|
3
|
+
export { createTransferAssetStreamChunk, createTransferAssetStreamChunkLegacy, decodeTransferAssetStreamData, decodeTransferAssetStreamItem, transferAssetStreamChunkByteLength } from './transfer-asset-chunk.mjs';
|
|
4
|
+
export { write } from './writable-async-write.mjs';
|
|
5
|
+
import * as stream from './stream.mjs';
|
|
6
|
+
export { stream };
|
|
7
|
+
import * as json from './json.mjs';
|
|
8
|
+
export { json };
|
|
9
|
+
import * as schema from './schema.mjs';
|
|
10
|
+
export { schema };
|
|
11
|
+
import * as transaction from './transaction.mjs';
|
|
12
|
+
export { transaction };
|
|
13
|
+
import * as middleware from './middleware.mjs';
|
|
14
|
+
export { middleware };
|
|
15
|
+
import * as diagnostic from './diagnostic.mjs';
|
|
16
|
+
export { diagnostic as diagnostics };
|
|
17
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
package/dist/utils/json.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/utils/json.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/utils/json.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,GAAI,GAAG,OAAO,EAAE,GAAG,OAAO,EAAE,MAAK,OAAyB,KAAG,IAAI,EAwEjF,CAAC;AAEF,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,OAAO;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;CACV;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO;IACpD,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAChB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;CACV;AAED,MAAM,MAAM,IAAI,CAAC,CAAC,GAAG,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAEhF,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fp = require('lodash/fp');
|
|
4
|
+
|
|
5
|
+
const createContext = ()=>({
|
|
6
|
+
path: []
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* Compute differences between two JSON objects and returns them
|
|
10
|
+
*
|
|
11
|
+
* @param a - First object
|
|
12
|
+
* @param b - Second object
|
|
13
|
+
* @param ctx - Context used to keep track of the current path during recursion
|
|
14
|
+
*/ const diff = (a, b, ctx = createContext())=>{
|
|
15
|
+
const diffs = [];
|
|
16
|
+
const { path } = ctx;
|
|
17
|
+
const aType = typeof a;
|
|
18
|
+
const bType = typeof b;
|
|
19
|
+
// Define helpers
|
|
20
|
+
const added = ()=>{
|
|
21
|
+
diffs.push({
|
|
22
|
+
kind: 'added',
|
|
23
|
+
path,
|
|
24
|
+
type: bType,
|
|
25
|
+
value: b
|
|
26
|
+
});
|
|
27
|
+
return diffs;
|
|
28
|
+
};
|
|
29
|
+
const deleted = ()=>{
|
|
30
|
+
diffs.push({
|
|
31
|
+
kind: 'deleted',
|
|
32
|
+
path,
|
|
33
|
+
type: aType,
|
|
34
|
+
value: a
|
|
35
|
+
});
|
|
36
|
+
return diffs;
|
|
37
|
+
};
|
|
38
|
+
const modified = ()=>{
|
|
39
|
+
diffs.push({
|
|
40
|
+
kind: 'modified',
|
|
41
|
+
path,
|
|
42
|
+
types: [
|
|
43
|
+
aType,
|
|
44
|
+
bType
|
|
45
|
+
],
|
|
46
|
+
values: [
|
|
47
|
+
a,
|
|
48
|
+
b
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
return diffs;
|
|
52
|
+
};
|
|
53
|
+
if (fp.isArray(a) && fp.isArray(b)) {
|
|
54
|
+
let k = 0;
|
|
55
|
+
for (const [aItem, bItem] of fp.zip(a, b)){
|
|
56
|
+
const kCtx = {
|
|
57
|
+
path: [
|
|
58
|
+
...path,
|
|
59
|
+
k.toString()
|
|
60
|
+
]
|
|
61
|
+
};
|
|
62
|
+
const kDiffs = diff(aItem, bItem, kCtx);
|
|
63
|
+
diffs.push(...kDiffs);
|
|
64
|
+
k += 1;
|
|
65
|
+
}
|
|
66
|
+
return diffs;
|
|
67
|
+
}
|
|
68
|
+
if (fp.isObject(a) && fp.isObject(b)) {
|
|
69
|
+
const keys = fp.uniq(Object.keys(a).concat(Object.keys(b)));
|
|
70
|
+
for (const key of keys){
|
|
71
|
+
const aValue = a[key];
|
|
72
|
+
const bValue = b[key];
|
|
73
|
+
const nestedDiffs = diff(aValue, bValue, {
|
|
74
|
+
path: [
|
|
75
|
+
...path,
|
|
76
|
+
key
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
diffs.push(...nestedDiffs);
|
|
80
|
+
}
|
|
81
|
+
return diffs;
|
|
82
|
+
}
|
|
83
|
+
if (!fp.isEqual(a, b)) {
|
|
84
|
+
if (aType === 'undefined') {
|
|
85
|
+
return added();
|
|
86
|
+
}
|
|
87
|
+
if (bType === 'undefined') {
|
|
88
|
+
return deleted();
|
|
89
|
+
}
|
|
90
|
+
return modified();
|
|
91
|
+
}
|
|
92
|
+
return diffs;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.diff = diff;
|
|
96
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sources":["../../src/utils/json.ts"],"sourcesContent":["import { isArray, isObject, zip, isEqual, uniq } from 'lodash/fp';\n\nconst createContext = (): Context => ({ path: [] });\n\n/**\n * Compute differences between two JSON objects and returns them\n *\n * @param a - First object\n * @param b - Second object\n * @param ctx - Context used to keep track of the current path during recursion\n */\nexport const diff = (a: unknown, b: unknown, ctx: Context = createContext()): Diff[] => {\n const diffs: Diff[] = [];\n const { path } = ctx;\n\n const aType = typeof a;\n const bType = typeof b;\n\n // Define helpers\n\n const added = () => {\n diffs.push({ kind: 'added', path, type: bType, value: b });\n return diffs;\n };\n\n const deleted = () => {\n diffs.push({ kind: 'deleted', path, type: aType, value: a });\n return diffs;\n };\n\n const modified = () => {\n diffs.push({\n kind: 'modified',\n path,\n types: [aType, bType],\n values: [a, b],\n });\n return diffs;\n };\n\n if (isArray(a) && isArray(b)) {\n let k = 0;\n\n for (const [aItem, bItem] of zip(a, b)) {\n const kCtx: Context = { path: [...path, k.toString()] };\n const kDiffs = diff(aItem, bItem, kCtx);\n\n diffs.push(...kDiffs);\n\n k += 1;\n }\n\n return diffs;\n }\n\n if (isObject(a) && isObject(b)) {\n const keys = uniq(Object.keys(a).concat(Object.keys(b)));\n\n for (const key of keys) {\n const aValue = (a as Record<string, unknown>)[key];\n const bValue = (b as Record<string, unknown>)[key];\n\n const nestedDiffs = diff(aValue, bValue, { path: [...path, key] });\n\n diffs.push(...nestedDiffs);\n }\n\n return diffs;\n }\n\n if (!isEqual(a, b)) {\n if (aType === 'undefined') {\n return added();\n }\n\n if (bType === 'undefined') {\n return deleted();\n }\n\n return modified();\n }\n\n return diffs;\n};\n\nexport interface AddedDiff<T = unknown> {\n kind: 'added';\n path: string[];\n type: string;\n value: T;\n}\n\nexport interface ModifiedDiff<T = unknown, P = unknown> {\n kind: 'modified';\n path: string[];\n types: [string, string];\n values: [T, P];\n}\n\nexport interface DeletedDiff<T = unknown> {\n kind: 'deleted';\n path: string[];\n type: string;\n value: T;\n}\n\nexport type Diff<T = unknown> = AddedDiff<T> | ModifiedDiff<T> | DeletedDiff<T>;\n\nexport interface Context {\n path: string[];\n}\n"],"names":["createContext","path","diff","a","b","ctx","diffs","aType","bType","added","push","kind","type","value","deleted","modified","types","values","isArray","k","aItem","bItem","zip","kCtx","toString","kDiffs","isObject","keys","uniq","Object","concat","key","aValue","bValue","nestedDiffs","isEqual"],"mappings":";;;;AAEA,MAAMA,aAAAA,GAAgB,KAAgB;AAAEC,QAAAA,IAAAA,EAAM;KAAG,CAAA;AAEjD;;;;;;AAMC,IACM,MAAMC,IAAAA,GAAO,CAACC,CAAAA,EAAYC,CAAAA,EAAYC,MAAeL,aAAAA,EAAe,GAAA;AACzE,IAAA,MAAMM,QAAgB,EAAE;IACxB,MAAM,EAAEL,IAAI,EAAE,GAAGI,GAAAA;AAEjB,IAAA,MAAME,QAAQ,OAAOJ,CAAAA;AACrB,IAAA,MAAMK,QAAQ,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