project-cpu-mcp 0.10.0 → 0.12.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/README.md +111 -35
- package/dist/api/authentication-required.error.d.ts +6 -0
- package/dist/api/authentication-required.error.d.ts.map +1 -0
- package/dist/api/authentication-required.error.js +9 -0
- package/dist/api/authentication-required.error.js.map +1 -0
- package/dist/api/client.d.ts +7 -5
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +29 -14
- package/dist/api/client.js.map +1 -1
- package/dist/api/constants.d.ts +2 -0
- package/dist/api/constants.d.ts.map +1 -1
- package/dist/api/constants.js +6 -0
- package/dist/api/constants.js.map +1 -1
- package/dist/api/types.d.ts +189 -220
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js +43 -29
- package/dist/api/types.js.map +1 -1
- package/dist/config/constants.d.ts +6 -2
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +6 -2
- package/dist/config/constants.js.map +1 -1
- package/dist/config/types.js +2 -2
- package/dist/config/types.js.map +1 -1
- package/dist/contracts/cell.abi.d.ts +26 -2
- package/dist/contracts/cell.abi.d.ts.map +1 -1
- package/dist/contracts/cell.abi.js +21 -2
- package/dist/contracts/cell.abi.js.map +1 -1
- package/dist/contracts/erc20.abi.d.ts.map +1 -1
- package/dist/contracts/erc20.abi.js +1 -2
- package/dist/contracts/erc20.abi.js.map +1 -1
- package/dist/contracts/trade.abi.d.ts +341 -0
- package/dist/contracts/trade.abi.d.ts.map +1 -1
- package/dist/contracts/trade.abi.js +163 -0
- package/dist/contracts/trade.abi.js.map +1 -1
- package/dist/contracts/trade.types.d.ts +14 -0
- package/dist/contracts/trade.types.d.ts.map +1 -0
- package/dist/contracts/trade.types.js +15 -0
- package/dist/contracts/trade.types.js.map +1 -0
- package/dist/contracts/transport.abi.d.ts +4 -0
- package/dist/contracts/transport.abi.d.ts.map +1 -1
- package/dist/contracts/transport.abi.js +1 -0
- package/dist/contracts/transport.abi.js.map +1 -1
- package/dist/index.js +40 -3
- package/dist/index.js.map +1 -1
- package/dist/logger/constants.d.ts +7 -0
- package/dist/logger/constants.d.ts.map +1 -1
- package/dist/logger/constants.js +11 -0
- package/dist/logger/constants.js.map +1 -1
- package/dist/logger/file-log.utils.d.ts +4 -0
- package/dist/logger/file-log.utils.d.ts.map +1 -0
- package/dist/logger/file-log.utils.js +23 -0
- package/dist/logger/file-log.utils.js.map +1 -0
- package/dist/logger/index.d.ts +1 -1
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +5 -3
- package/dist/logger/index.js.map +1 -1
- package/dist/logger/logger.d.ts +4 -0
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.js +48 -3
- package/dist/logger/logger.js.map +1 -1
- package/dist/logger/redact.utils.d.ts.map +1 -1
- package/dist/logger/redact.utils.js +7 -2
- package/dist/logger/redact.utils.js.map +1 -1
- package/dist/logger/types.d.ts +8 -0
- package/dist/logger/types.d.ts.map +1 -1
- package/dist/map/attention.utils.d.ts.map +1 -1
- package/dist/map/attention.utils.js +1 -0
- package/dist/map/attention.utils.js.map +1 -1
- package/dist/map/cell-view.utils.d.ts.map +1 -1
- package/dist/map/cell-view.utils.js +5 -3
- package/dist/map/cell-view.utils.js.map +1 -1
- package/dist/map/process-projection.utils.js +2 -2
- package/dist/map/process-projection.utils.js.map +1 -1
- package/dist/map/reader.utils.d.ts.map +1 -1
- package/dist/map/reader.utils.js +3 -2
- package/dist/map/reader.utils.js.map +1 -1
- package/dist/map/storage.utils.d.ts.map +1 -1
- package/dist/map/storage.utils.js +5 -1
- package/dist/map/storage.utils.js.map +1 -1
- package/dist/map/types.d.ts +21 -0
- package/dist/map/types.d.ts.map +1 -1
- package/dist/map/types.js +6 -0
- package/dist/map/types.js.map +1 -1
- package/dist/paybox/auth/authority.d.ts +46 -0
- package/dist/paybox/auth/authority.d.ts.map +1 -0
- package/dist/paybox/auth/authority.js +410 -0
- package/dist/paybox/auth/authority.js.map +1 -0
- package/dist/paybox/auth/browser-opener.d.ts +8 -0
- package/dist/paybox/auth/browser-opener.d.ts.map +1 -0
- package/dist/paybox/auth/browser-opener.js +22 -0
- package/dist/paybox/auth/browser-opener.js.map +1 -0
- package/dist/paybox/auth/browser-opener.utils.d.ts +2 -0
- package/dist/paybox/auth/browser-opener.utils.d.ts.map +1 -0
- package/dist/paybox/auth/browser-opener.utils.js +10 -0
- package/dist/paybox/auth/browser-opener.utils.js.map +1 -0
- package/dist/paybox/auth/constants.d.ts +16 -0
- package/dist/paybox/auth/constants.d.ts.map +1 -0
- package/dist/paybox/auth/constants.js +16 -0
- package/dist/paybox/auth/constants.js.map +1 -0
- package/dist/paybox/auth/coordinator.d.ts +21 -0
- package/dist/paybox/auth/coordinator.d.ts.map +1 -0
- package/dist/paybox/auth/coordinator.factory.d.ts +5 -0
- package/dist/paybox/auth/coordinator.factory.d.ts.map +1 -0
- package/dist/paybox/auth/coordinator.factory.js +5 -0
- package/dist/paybox/auth/coordinator.factory.js.map +1 -0
- package/dist/paybox/auth/coordinator.js +87 -0
- package/dist/paybox/auth/coordinator.js.map +1 -0
- package/dist/paybox/auth/coordinator.utils.d.ts +4 -0
- package/dist/paybox/auth/coordinator.utils.d.ts.map +1 -0
- package/dist/paybox/auth/coordinator.utils.js +8 -0
- package/dist/paybox/auth/coordinator.utils.js.map +1 -0
- package/dist/paybox/auth/flow-session.d.ts +24 -0
- package/dist/paybox/auth/flow-session.d.ts.map +1 -0
- package/dist/paybox/auth/flow-session.js +155 -0
- package/dist/paybox/auth/flow-session.js.map +1 -0
- package/dist/paybox/auth/loopback-flow.d.ts +49 -0
- package/dist/paybox/auth/loopback-flow.d.ts.map +1 -0
- package/dist/paybox/auth/loopback-flow.js +381 -0
- package/dist/paybox/auth/loopback-flow.js.map +1 -0
- package/dist/paybox/auth/loopback-flow.utils.d.ts +7 -0
- package/dist/paybox/auth/loopback-flow.utils.d.ts.map +1 -0
- package/dist/paybox/auth/loopback-flow.utils.js +47 -0
- package/dist/paybox/auth/loopback-flow.utils.js.map +1 -0
- package/dist/paybox/auth/loopback-page-fonts.constants.d.ts +3 -0
- package/dist/paybox/auth/loopback-page-fonts.constants.d.ts.map +1 -0
- package/dist/paybox/auth/loopback-page-fonts.constants.js +228 -0
- package/dist/paybox/auth/loopback-page-fonts.constants.js.map +1 -0
- package/dist/paybox/auth/loopback-page.utils.d.ts +4 -0
- package/dist/paybox/auth/loopback-page.utils.d.ts.map +1 -0
- package/dist/paybox/auth/loopback-page.utils.js +261 -0
- package/dist/paybox/auth/loopback-page.utils.js.map +1 -0
- package/dist/paybox/auth/provisioning.utils.d.ts +3 -0
- package/dist/paybox/auth/provisioning.utils.d.ts.map +1 -0
- package/dist/paybox/auth/provisioning.utils.js +27 -0
- package/dist/paybox/auth/provisioning.utils.js.map +1 -0
- package/dist/paybox/auth/signing-key.utils.d.ts +2 -0
- package/dist/paybox/auth/signing-key.utils.d.ts.map +1 -0
- package/dist/paybox/auth/signing-key.utils.js +14 -0
- package/dist/paybox/auth/signing-key.utils.js.map +1 -0
- package/dist/paybox/auth/types.d.ts +18 -0
- package/dist/paybox/auth/types.d.ts.map +1 -0
- package/dist/paybox/auth/types.js +6 -0
- package/dist/paybox/auth/types.js.map +1 -0
- package/dist/paybox/auth/utils.d.ts +5 -0
- package/dist/paybox/auth/utils.d.ts.map +1 -0
- package/dist/paybox/auth/utils.js +17 -0
- package/dist/paybox/auth/utils.js.map +1 -0
- package/dist/paybox/constants.d.ts +11 -0
- package/dist/paybox/constants.d.ts.map +1 -0
- package/dist/paybox/constants.js +11 -0
- package/dist/paybox/constants.js.map +1 -0
- package/dist/paybox/errors.d.ts +43 -0
- package/dist/paybox/errors.d.ts.map +1 -0
- package/dist/paybox/errors.js +141 -0
- package/dist/paybox/errors.js.map +1 -0
- package/dist/paybox/sdk/adapter.d.ts +16 -0
- package/dist/paybox/sdk/adapter.d.ts.map +1 -0
- package/dist/paybox/sdk/adapter.js +127 -0
- package/dist/paybox/sdk/adapter.js.map +1 -0
- package/dist/paybox/sdk/constants.d.ts +14 -0
- package/dist/paybox/sdk/constants.d.ts.map +1 -0
- package/dist/paybox/sdk/constants.js +23 -0
- package/dist/paybox/sdk/constants.js.map +1 -0
- package/dist/paybox/sdk/factory.d.ts +4 -0
- package/dist/paybox/sdk/factory.d.ts.map +1 -0
- package/dist/paybox/sdk/factory.js +24 -0
- package/dist/paybox/sdk/factory.js.map +1 -0
- package/dist/paybox/sdk/logging.utils.d.ts +4 -0
- package/dist/paybox/sdk/logging.utils.d.ts.map +1 -0
- package/dist/paybox/sdk/logging.utils.js +19 -0
- package/dist/paybox/sdk/logging.utils.js.map +1 -0
- package/dist/paybox/sdk/utils.d.ts +7 -0
- package/dist/paybox/sdk/utils.d.ts.map +1 -0
- package/dist/paybox/sdk/utils.js +182 -0
- package/dist/paybox/sdk/utils.js.map +1 -0
- package/dist/paybox/storage.d.ts +17 -0
- package/dist/paybox/storage.d.ts.map +1 -0
- package/dist/paybox/storage.js +87 -0
- package/dist/paybox/storage.js.map +1 -0
- package/dist/paybox/types.d.ts +481 -0
- package/dist/paybox/types.d.ts.map +1 -0
- package/dist/paybox/types.js +144 -0
- package/dist/paybox/types.js.map +1 -0
- package/dist/paybox/wallet/manager.d.ts +22 -0
- package/dist/paybox/wallet/manager.d.ts.map +1 -0
- package/dist/paybox/wallet/manager.js +111 -0
- package/dist/paybox/wallet/manager.js.map +1 -0
- package/dist/paybox/wallet/rpc.client.d.ts +16 -0
- package/dist/paybox/wallet/rpc.client.d.ts.map +1 -0
- package/dist/paybox/wallet/rpc.client.js +53 -0
- package/dist/paybox/wallet/rpc.client.js.map +1 -0
- package/dist/paybox/wallet/utils.d.ts +5 -0
- package/dist/paybox/wallet/utils.d.ts.map +1 -0
- package/dist/paybox/wallet/utils.js +82 -0
- package/dist/paybox/wallet/utils.js.map +1 -0
- package/dist/server.constants.d.ts.map +1 -1
- package/dist/server.constants.js +5 -2
- package/dist/server.constants.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +8 -2
- package/dist/server.js.map +1 -1
- package/dist/services/app-config.utils.d.ts.map +1 -1
- package/dist/services/app-config.utils.js +22 -11
- package/dist/services/app-config.utils.js.map +1 -1
- package/dist/services/auth.service.d.ts +3 -5
- package/dist/services/auth.service.d.ts.map +1 -1
- package/dist/services/auth.service.js +20 -77
- package/dist/services/auth.service.js.map +1 -1
- package/dist/services/cell.client.d.ts.map +1 -1
- package/dist/services/cell.client.js +22 -9
- package/dist/services/cell.client.js.map +1 -1
- package/dist/services/lot-return.constants.d.ts +3 -0
- package/dist/services/lot-return.constants.d.ts.map +1 -0
- package/dist/services/lot-return.constants.js +35 -0
- package/dist/services/lot-return.constants.js.map +1 -0
- package/dist/services/lot-return.service.d.ts +25 -0
- package/dist/services/lot-return.service.d.ts.map +1 -0
- package/dist/services/lot-return.service.js +151 -0
- package/dist/services/lot-return.service.js.map +1 -0
- package/dist/services/lot-return.types.d.ts +19 -0
- package/dist/services/lot-return.types.d.ts.map +1 -0
- package/dist/services/lot-return.types.js +2 -0
- package/dist/services/lot-return.types.js.map +1 -0
- package/dist/services/lot-return.utils.d.ts +33 -0
- package/dist/services/lot-return.utils.d.ts.map +1 -0
- package/dist/services/lot-return.utils.js +128 -0
- package/dist/services/lot-return.utils.js.map +1 -0
- package/dist/services/lot-terms.constants.d.ts +4 -0
- package/dist/services/lot-terms.constants.d.ts.map +1 -0
- package/dist/services/lot-terms.constants.js +5 -0
- package/dist/services/lot-terms.constants.js.map +1 -0
- package/dist/services/lot-terms.helpers.d.ts +11 -0
- package/dist/services/lot-terms.helpers.d.ts.map +1 -0
- package/dist/services/lot-terms.helpers.js +45 -0
- package/dist/services/lot-terms.helpers.js.map +1 -0
- package/dist/services/lot-terms.service.d.ts +20 -0
- package/dist/services/lot-terms.service.d.ts.map +1 -0
- package/dist/services/lot-terms.service.js +119 -0
- package/dist/services/lot-terms.service.js.map +1 -0
- package/dist/services/lot-terms.types.d.ts +25 -0
- package/dist/services/lot-terms.types.d.ts.map +1 -0
- package/dist/services/lot-terms.types.js +2 -0
- package/dist/services/lot-terms.types.js.map +1 -0
- package/dist/services/reveal-revert.utils.d.ts +1 -0
- package/dist/services/reveal-revert.utils.d.ts.map +1 -1
- package/dist/services/reveal-revert.utils.js +20 -0
- package/dist/services/reveal-revert.utils.js.map +1 -1
- package/dist/services/reveal.constants.d.ts +1 -1
- package/dist/services/reveal.constants.d.ts.map +1 -1
- package/dist/services/reveal.constants.js +1 -1
- package/dist/services/reveal.constants.js.map +1 -1
- package/dist/services/reveal.service.d.ts +4 -3
- package/dist/services/reveal.service.d.ts.map +1 -1
- package/dist/services/reveal.service.js +35 -10
- package/dist/services/reveal.service.js.map +1 -1
- package/dist/services/reveal.utils.d.ts +7 -8
- package/dist/services/reveal.utils.d.ts.map +1 -1
- package/dist/services/reveal.utils.js +15 -8
- package/dist/services/reveal.utils.js.map +1 -1
- package/dist/services/route.constants.d.ts +12 -1
- package/dist/services/route.constants.d.ts.map +1 -1
- package/dist/services/route.constants.js +66 -15
- package/dist/services/route.constants.js.map +1 -1
- package/dist/services/route.lots.d.ts +18 -0
- package/dist/services/route.lots.d.ts.map +1 -0
- package/dist/services/route.lots.js +33 -0
- package/dist/services/route.lots.js.map +1 -0
- package/dist/services/route.service.d.ts +13 -4
- package/dist/services/route.service.d.ts.map +1 -1
- package/dist/services/route.service.js +95 -13
- package/dist/services/route.service.js.map +1 -1
- package/dist/services/route.types.d.ts +76 -0
- package/dist/services/route.types.d.ts.map +1 -0
- package/dist/services/route.types.js +8 -0
- package/dist/services/route.types.js.map +1 -0
- package/dist/services/route.utils.d.ts +19 -0
- package/dist/services/route.utils.d.ts.map +1 -1
- package/dist/services/route.utils.js +35 -0
- package/dist/services/route.utils.js.map +1 -1
- package/dist/services/trade-eviction.constants.d.ts +12 -0
- package/dist/services/trade-eviction.constants.d.ts.map +1 -0
- package/dist/services/trade-eviction.constants.js +25 -0
- package/dist/services/trade-eviction.constants.js.map +1 -0
- package/dist/services/trade-eviction.service.d.ts +22 -0
- package/dist/services/trade-eviction.service.d.ts.map +1 -0
- package/dist/services/trade-eviction.service.js +101 -0
- package/dist/services/trade-eviction.service.js.map +1 -0
- package/dist/services/trade-eviction.types.d.ts +30 -0
- package/dist/services/trade-eviction.types.d.ts.map +1 -0
- package/dist/services/trade-eviction.types.js +2 -0
- package/dist/services/trade-eviction.types.js.map +1 -0
- package/dist/services/trade-eviction.utils.d.ts +9 -0
- package/dist/services/trade-eviction.utils.d.ts.map +1 -0
- package/dist/services/trade-eviction.utils.js +38 -0
- package/dist/services/trade-eviction.utils.js.map +1 -0
- package/dist/services/trade-rules.service.d.ts +15 -0
- package/dist/services/trade-rules.service.d.ts.map +1 -0
- package/dist/services/trade-rules.service.js +45 -0
- package/dist/services/trade-rules.service.js.map +1 -0
- package/dist/services/trade.client.d.ts +11 -1
- package/dist/services/trade.client.d.ts.map +1 -1
- package/dist/services/trade.client.js +87 -0
- package/dist/services/trade.client.js.map +1 -1
- package/dist/services/trade.constants.d.ts +9 -0
- package/dist/services/trade.constants.d.ts.map +1 -0
- package/dist/services/trade.constants.js +28 -0
- package/dist/services/trade.constants.js.map +1 -0
- package/dist/services/trade.helpers.d.ts +9 -1
- package/dist/services/trade.helpers.d.ts.map +1 -1
- package/dist/services/trade.helpers.js +40 -27
- package/dist/services/trade.helpers.js.map +1 -1
- package/dist/services/transport-revert.utils.d.ts +3 -0
- package/dist/services/transport-revert.utils.d.ts.map +1 -0
- package/dist/services/transport-revert.utils.js +15 -0
- package/dist/services/transport-revert.utils.js.map +1 -0
- package/dist/services/transport.client.d.ts.map +1 -1
- package/dist/services/transport.client.js +14 -6
- package/dist/services/transport.client.js.map +1 -1
- package/dist/services/types.d.ts +249 -21
- package/dist/services/types.d.ts.map +1 -1
- package/dist/services/types.js +25 -0
- package/dist/services/types.js.map +1 -1
- package/dist/services/warehouse.utils.d.ts +8 -0
- package/dist/services/warehouse.utils.d.ts.map +1 -1
- package/dist/services/warehouse.utils.js +25 -0
- package/dist/services/warehouse.utils.js.map +1 -1
- package/dist/session/manager.d.ts +1 -0
- package/dist/session/manager.d.ts.map +1 -1
- package/dist/session/manager.js +13 -0
- package/dist/session/manager.js.map +1 -1
- package/dist/session/storage.d.ts +0 -3
- package/dist/session/storage.d.ts.map +1 -1
- package/dist/session/storage.js +6 -43
- package/dist/session/storage.js.map +1 -1
- package/dist/session/types.d.ts +4 -98
- package/dist/session/types.d.ts.map +1 -1
- package/dist/session/types.js +0 -15
- package/dist/session/types.js.map +1 -1
- package/dist/tools/authenticate.d.ts +1 -1
- package/dist/tools/authenticate.d.ts.map +1 -1
- package/dist/tools/authenticate.js +19 -45
- package/dist/tools/authenticate.js.map +1 -1
- package/dist/tools/config/get-game-config/constants.d.ts +3 -0
- package/dist/tools/config/get-game-config/constants.d.ts.map +1 -1
- package/dist/tools/config/get-game-config/constants.js +13 -2
- package/dist/tools/config/get-game-config/constants.js.map +1 -1
- package/dist/tools/config/get-game-config/get-game-config.d.ts.map +1 -1
- package/dist/tools/config/get-game-config/get-game-config.js +6 -3
- package/dist/tools/config/get-game-config/get-game-config.js.map +1 -1
- package/dist/tools/config/get-game-config/get-game-config.utils.d.ts +4 -4
- package/dist/tools/config/get-game-config/get-game-config.utils.d.ts.map +1 -1
- package/dist/tools/config/get-game-config/get-game-config.utils.js +26 -9
- package/dist/tools/config/get-game-config/get-game-config.utils.js.map +1 -1
- package/dist/tools/config/get-game-config/types.d.ts +6 -2
- package/dist/tools/config/get-game-config/types.d.ts.map +1 -1
- package/dist/tools/config/resource-lens/resource-lens.utils.d.ts.map +1 -1
- package/dist/tools/config/resource-lens/resource-lens.utils.js +5 -4
- package/dist/tools/config/resource-lens/resource-lens.utils.js.map +1 -1
- package/dist/tools/map/attention/attention.d.ts.map +1 -1
- package/dist/tools/map/attention/attention.js +16 -5
- package/dist/tools/map/attention/attention.js.map +1 -1
- package/dist/tools/map/attention/constants.d.ts +6 -0
- package/dist/tools/map/attention/constants.d.ts.map +1 -1
- package/dist/tools/map/attention/constants.js +16 -2
- package/dist/tools/map/attention/constants.js.map +1 -1
- package/dist/tools/map/attention/evicted.service.d.ts +19 -0
- package/dist/tools/map/attention/evicted.service.d.ts.map +1 -0
- package/dist/tools/map/attention/evicted.service.js +73 -0
- package/dist/tools/map/attention/evicted.service.js.map +1 -0
- package/dist/tools/map/attention/evicted.utils.d.ts +16 -0
- package/dist/tools/map/attention/evicted.utils.d.ts.map +1 -0
- package/dist/tools/map/attention/evicted.utils.js +72 -0
- package/dist/tools/map/attention/evicted.utils.js.map +1 -0
- package/dist/tools/map/attention/panel.utils.d.ts.map +1 -1
- package/dist/tools/map/attention/panel.utils.js +1 -0
- package/dist/tools/map/attention/panel.utils.js.map +1 -1
- package/dist/tools/map/attention/types.d.ts +17 -0
- package/dist/tools/map/attention/types.d.ts.map +1 -1
- package/dist/tools/map/attention/types.js.map +1 -1
- package/dist/tools/map/get-map/constants.d.ts.map +1 -1
- package/dist/tools/map/get-map/constants.js +4 -2
- package/dist/tools/map/get-map/constants.js.map +1 -1
- package/dist/tools/reveal/constants.d.ts.map +1 -1
- package/dist/tools/reveal/constants.js +3 -1
- package/dist/tools/reveal/constants.js.map +1 -1
- package/dist/tools/trade/buy-lot/buy-lot.d.ts.map +1 -1
- package/dist/tools/trade/buy-lot/buy-lot.js +2 -0
- package/dist/tools/trade/buy-lot/buy-lot.js.map +1 -1
- package/dist/tools/trade/buy-lot/constants.d.ts.map +1 -1
- package/dist/tools/trade/buy-lot/constants.js +2 -0
- package/dist/tools/trade/buy-lot/constants.js.map +1 -1
- package/dist/tools/trade/buyer-guard/constants.d.ts +4 -0
- package/dist/tools/trade/buyer-guard/constants.d.ts.map +1 -0
- package/dist/tools/trade/buyer-guard/constants.js +11 -0
- package/dist/tools/trade/buyer-guard/constants.js.map +1 -0
- package/dist/tools/trade/buyer-guard/lot-open.guard.d.ts +9 -0
- package/dist/tools/trade/buyer-guard/lot-open.guard.d.ts.map +1 -0
- package/dist/tools/trade/buyer-guard/lot-open.guard.js +15 -0
- package/dist/tools/trade/buyer-guard/lot-open.guard.js.map +1 -0
- package/dist/tools/trade/buyer-guard/types.d.ts +6 -0
- package/dist/tools/trade/buyer-guard/types.d.ts.map +1 -0
- package/dist/tools/trade/buyer-guard/types.js +2 -0
- package/dist/tools/trade/buyer-guard/types.js.map +1 -0
- package/dist/tools/trade/constants.d.ts +5 -0
- package/dist/tools/trade/constants.d.ts.map +1 -0
- package/dist/tools/trade/constants.js +14 -0
- package/dist/tools/trade/constants.js.map +1 -0
- package/dist/tools/trade/create-lot/constants.d.ts.map +1 -1
- package/dist/tools/trade/create-lot/constants.js +4 -1
- package/dist/tools/trade/create-lot/constants.js.map +1 -1
- package/dist/tools/trade/create-lot/create-lot.d.ts +2 -1
- package/dist/tools/trade/create-lot/create-lot.d.ts.map +1 -1
- package/dist/tools/trade/create-lot/create-lot.js +15 -1
- package/dist/tools/trade/create-lot/create-lot.js.map +1 -1
- package/dist/tools/trade/evict-lot/constants.d.ts +4 -0
- package/dist/tools/trade/evict-lot/constants.d.ts.map +1 -0
- package/dist/tools/trade/evict-lot/constants.js +13 -0
- package/dist/tools/trade/evict-lot/constants.js.map +1 -0
- package/dist/tools/trade/evict-lot/evict-lot.d.ts +6 -0
- package/dist/tools/trade/evict-lot/evict-lot.d.ts.map +1 -0
- package/dist/tools/trade/evict-lot/evict-lot.js +35 -0
- package/dist/tools/trade/evict-lot/evict-lot.js.map +1 -0
- package/dist/tools/trade/evict-lot/format.utils.d.ts +5 -0
- package/dist/tools/trade/evict-lot/format.utils.d.ts.map +1 -0
- package/dist/tools/trade/evict-lot/format.utils.js +10 -0
- package/dist/tools/trade/evict-lot/format.utils.js.map +1 -0
- package/dist/tools/trade/evict-lot/types.d.ts +5 -0
- package/dist/tools/trade/evict-lot/types.d.ts.map +1 -0
- package/dist/tools/trade/evict-lot/types.js +8 -0
- package/dist/tools/trade/evict-lot/types.js.map +1 -0
- package/dist/tools/trade/format.utils.d.ts +2 -4
- package/dist/tools/trade/format.utils.d.ts.map +1 -1
- package/dist/tools/trade/format.utils.js +11 -13
- package/dist/tools/trade/format.utils.js.map +1 -1
- package/dist/tools/trade/get-lot/constants.d.ts.map +1 -1
- package/dist/tools/trade/get-lot/constants.js +2 -1
- package/dist/tools/trade/get-lot/constants.js.map +1 -1
- package/dist/tools/trade/list-lots/constants.d.ts +2 -0
- package/dist/tools/trade/list-lots/constants.d.ts.map +1 -1
- package/dist/tools/trade/list-lots/constants.js +5 -1
- package/dist/tools/trade/list-lots/constants.js.map +1 -1
- package/dist/tools/trade/list-lots/list-lots.d.ts.map +1 -1
- package/dist/tools/trade/list-lots/list-lots.js +2 -1
- package/dist/tools/trade/list-lots/list-lots.js.map +1 -1
- package/dist/tools/trade/list-lots/list-lots.utils.d.ts +8 -0
- package/dist/tools/trade/list-lots/list-lots.utils.d.ts.map +1 -0
- package/dist/tools/trade/list-lots/list-lots.utils.js +10 -0
- package/dist/tools/trade/list-lots/list-lots.utils.js.map +1 -0
- package/dist/tools/trade/list-mine/constants.d.ts.map +1 -1
- package/dist/tools/trade/list-mine/constants.js +3 -1
- package/dist/tools/trade/list-mine/constants.js.map +1 -1
- package/dist/tools/trade/lot-terms/constants.d.ts +5 -0
- package/dist/tools/trade/lot-terms/constants.d.ts.map +1 -0
- package/dist/tools/trade/lot-terms/constants.js +13 -0
- package/dist/tools/trade/lot-terms/constants.js.map +1 -0
- package/dist/tools/trade/lot-terms/factory.d.ts +4 -0
- package/dist/tools/trade/lot-terms/factory.d.ts.map +1 -0
- package/dist/tools/trade/lot-terms/factory.js +14 -0
- package/dist/tools/trade/lot-terms/factory.js.map +1 -0
- package/dist/tools/trade/lot-terms/format.utils.d.ts +4 -0
- package/dist/tools/trade/lot-terms/format.utils.d.ts.map +1 -0
- package/dist/tools/trade/lot-terms/format.utils.js +30 -0
- package/dist/tools/trade/lot-terms/format.utils.js.map +1 -0
- package/dist/tools/trade/lot-terms/lot-terms.d.ts +5 -0
- package/dist/tools/trade/lot-terms/lot-terms.d.ts.map +1 -0
- package/dist/tools/trade/lot-terms/lot-terms.js +23 -0
- package/dist/tools/trade/lot-terms/lot-terms.js.map +1 -0
- package/dist/tools/trade/lot-terms/types.d.ts +6 -0
- package/dist/tools/trade/lot-terms/types.d.ts.map +1 -0
- package/dist/tools/trade/lot-terms/types.js +7 -0
- package/dist/tools/trade/lot-terms/types.js.map +1 -0
- package/dist/tools/trade/market-index/constants.d.ts.map +1 -1
- package/dist/tools/trade/market-index/constants.js +2 -0
- package/dist/tools/trade/market-index/constants.js.map +1 -1
- package/dist/tools/trade/markets/constants.d.ts.map +1 -1
- package/dist/tools/trade/markets/constants.js +2 -1
- package/dist/tools/trade/markets/constants.js.map +1 -1
- package/dist/tools/trade/quote-buy/constants.d.ts.map +1 -1
- package/dist/tools/trade/quote-buy/constants.js +4 -2
- package/dist/tools/trade/quote-buy/constants.js.map +1 -1
- package/dist/tools/trade/quote-buy/quote-buy.d.ts.map +1 -1
- package/dist/tools/trade/quote-buy/quote-buy.js +2 -0
- package/dist/tools/trade/quote-buy/quote-buy.js.map +1 -1
- package/dist/tools/trade/quote-lot-return/constants.d.ts +2 -0
- package/dist/tools/trade/quote-lot-return/constants.d.ts.map +1 -0
- package/dist/tools/trade/quote-lot-return/constants.js +11 -0
- package/dist/tools/trade/quote-lot-return/constants.js.map +1 -0
- package/dist/tools/trade/quote-lot-return/quote-lot-return.d.ts +5 -0
- package/dist/tools/trade/quote-lot-return/quote-lot-return.d.ts.map +1 -0
- package/dist/tools/trade/quote-lot-return/quote-lot-return.js +20 -0
- package/dist/tools/trade/quote-lot-return/quote-lot-return.js.map +1 -0
- package/dist/tools/trade/return-lot/constants.d.ts +5 -0
- package/dist/tools/trade/return-lot/constants.d.ts.map +1 -0
- package/dist/tools/trade/return-lot/constants.js +26 -0
- package/dist/tools/trade/return-lot/constants.js.map +1 -0
- package/dist/tools/trade/return-lot/factory.d.ts +4 -0
- package/dist/tools/trade/return-lot/factory.d.ts.map +1 -0
- package/dist/tools/trade/return-lot/factory.js +18 -0
- package/dist/tools/trade/return-lot/factory.js.map +1 -0
- package/dist/tools/trade/return-lot/format.utils.d.ts +5 -0
- package/dist/tools/trade/return-lot/format.utils.d.ts.map +1 -0
- package/dist/tools/trade/return-lot/format.utils.js +39 -0
- package/dist/tools/trade/return-lot/format.utils.js.map +1 -0
- package/dist/tools/trade/return-lot/return-lot.d.ts +5 -0
- package/dist/tools/trade/return-lot/return-lot.d.ts.map +1 -0
- package/dist/tools/trade/return-lot/return-lot.js +25 -0
- package/dist/tools/trade/return-lot/return-lot.js.map +1 -0
- package/dist/tools/trade/return-lot/types.d.ts +11 -0
- package/dist/tools/trade/return-lot/types.d.ts.map +1 -0
- package/dist/tools/trade/return-lot/types.js +21 -0
- package/dist/tools/trade/return-lot/types.js.map +1 -0
- package/dist/tools/trade/types.d.ts +0 -4
- package/dist/tools/trade/types.d.ts.map +1 -1
- package/dist/tools/trade/types.js +4 -12
- package/dist/tools/trade/types.js.map +1 -1
- package/dist/tools/transport/constants.d.ts.map +1 -1
- package/dist/tools/transport/constants.js +9 -0
- package/dist/tools/transport/constants.js.map +1 -1
- package/dist/tools/transport/network/constants.d.ts +2 -0
- package/dist/tools/transport/network/constants.d.ts.map +1 -1
- package/dist/tools/transport/network/constants.js +2 -0
- package/dist/tools/transport/network/constants.js.map +1 -1
- package/dist/tools/transport/network/panel.utils.d.ts +2 -2
- package/dist/tools/transport/network/panel.utils.d.ts.map +1 -1
- package/dist/tools/transport/network/panel.utils.js +20 -0
- package/dist/tools/transport/network/panel.utils.js.map +1 -1
- package/dist/tools/transport/network/route-network.d.ts.map +1 -1
- package/dist/tools/transport/network/route-network.js +1 -1
- package/dist/tools/transport/network/route-network.js.map +1 -1
- package/dist/tools/transport/next-hops/next-hops.d.ts.map +1 -1
- package/dist/tools/transport/next-hops/next-hops.js +13 -3
- package/dist/tools/transport/next-hops/next-hops.js.map +1 -1
- package/dist/tools/transport/quote/constants.d.ts.map +1 -1
- package/dist/tools/transport/quote/constants.js +5 -3
- package/dist/tools/transport/quote/constants.js.map +1 -1
- package/dist/tools/transport/types.d.ts +2 -0
- package/dist/tools/transport/types.d.ts.map +1 -1
- package/dist/tools/transport/types.js +16 -0
- package/dist/tools/transport/types.js.map +1 -1
- package/dist/tools/types.d.ts +7 -1
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +16 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/wei.constants.d.ts +6 -0
- package/dist/utils/wei.constants.d.ts.map +1 -0
- package/dist/utils/wei.constants.js +6 -0
- package/dist/utils/wei.constants.js.map +1 -0
- package/dist/wallet/index.d.ts.map +1 -1
- package/dist/wallet/index.js +2 -3
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/types.d.ts +0 -9
- package/dist/wallet/types.d.ts.map +1 -1
- package/dist/wallet/types.js.map +1 -1
- package/package.json +2 -2
- package/dist/tools/trade/cancel-lot/cancel-lot.d.ts +0 -4
- package/dist/tools/trade/cancel-lot/cancel-lot.d.ts.map +0 -1
- package/dist/tools/trade/cancel-lot/cancel-lot.js +0 -20
- package/dist/tools/trade/cancel-lot/cancel-lot.js.map +0 -1
- package/dist/tools/trade/cancel-lot/constants.d.ts +0 -2
- package/dist/tools/trade/cancel-lot/constants.d.ts.map +0 -1
- package/dist/tools/trade/cancel-lot/constants.js +0 -8
- package/dist/tools/trade/cancel-lot/constants.js.map +0 -1
- package/dist/wallet/agw.manager.d.ts +0 -20
- package/dist/wallet/agw.manager.d.ts.map +0 -1
- package/dist/wallet/agw.manager.js +0 -90
- package/dist/wallet/agw.manager.js.map +0 -1
- package/dist/wallet/agw.provider.d.ts +0 -14
- package/dist/wallet/agw.provider.d.ts.map +0 -1
- package/dist/wallet/agw.provider.js +0 -48
- package/dist/wallet/agw.provider.js.map +0 -1
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import { getAddress } from 'viem';
|
|
2
|
+
import { PAYBOX_SCHEMA_VERSION, PAYBOX_TOKEN_REFRESH_WINDOW_MS } from '../constants.js';
|
|
3
|
+
import { payboxRefreshState, withPayboxRefreshState } from './coordinator.utils.js';
|
|
4
|
+
import { PayboxAuthInvalidError, PayboxFullAccessWalletRequiredError, PayboxTemporarilyUnavailableError, PayboxWalletSelectionError, } from '../errors.js';
|
|
5
|
+
import { PayboxAuthStatus, PayboxErrorCode, PayboxRefreshFailureDisposition, PayboxRefreshState, PayboxResetCause, PayboxSelectionPhase, } from '../types.js';
|
|
6
|
+
export class PayboxAuthority {
|
|
7
|
+
options;
|
|
8
|
+
onInvalidated;
|
|
9
|
+
wallet = null;
|
|
10
|
+
walletGeneration = null;
|
|
11
|
+
address = null;
|
|
12
|
+
authenticating = null;
|
|
13
|
+
restoring = null;
|
|
14
|
+
continuing = null;
|
|
15
|
+
material = null;
|
|
16
|
+
selection = null;
|
|
17
|
+
credentialId = null;
|
|
18
|
+
refreshing = null;
|
|
19
|
+
refreshPersistenceError = null;
|
|
20
|
+
generation = 0;
|
|
21
|
+
constructor(options, onInvalidated) {
|
|
22
|
+
this.options = options;
|
|
23
|
+
this.onInvalidated = onInvalidated;
|
|
24
|
+
const stored = options.storage.load();
|
|
25
|
+
if (stored?.tokens === null || stored?.signingKey === null || stored === null)
|
|
26
|
+
return;
|
|
27
|
+
if (payboxRefreshState(stored) === PayboxRefreshState.ExchangePending) {
|
|
28
|
+
this.refreshPersistenceError = new PayboxTemporarilyUnavailableError(null, PayboxRefreshFailureDisposition.Ambiguous);
|
|
29
|
+
}
|
|
30
|
+
this.material = { tokens: stored.tokens, signingKey: stored.signingKey };
|
|
31
|
+
if (stored.credentialId === null || stored.address === null)
|
|
32
|
+
return;
|
|
33
|
+
this.credentialId = stored.credentialId;
|
|
34
|
+
this.address = stored.address;
|
|
35
|
+
this.wallet = this.createWallet(this.material, stored.credentialId, stored.address, this.generation);
|
|
36
|
+
this.walletGeneration = this.generation;
|
|
37
|
+
}
|
|
38
|
+
isReady() {
|
|
39
|
+
return this.wallet !== null && this.walletGeneration === this.generation;
|
|
40
|
+
}
|
|
41
|
+
get() {
|
|
42
|
+
if (!this.isReady() || this.wallet === null) {
|
|
43
|
+
throw new Error('Paybox wallet is not authenticated. Call cpu_authenticate first.');
|
|
44
|
+
}
|
|
45
|
+
return this.wallet;
|
|
46
|
+
}
|
|
47
|
+
hasMaterial() {
|
|
48
|
+
return this.material !== null;
|
|
49
|
+
}
|
|
50
|
+
async authenticate(material, requestedCredentialId) {
|
|
51
|
+
if (material !== null) {
|
|
52
|
+
return this.continueAuthentication(material, requestedCredentialId, this.generation);
|
|
53
|
+
}
|
|
54
|
+
if (this.isReady())
|
|
55
|
+
return this.authenticateReadyWallet(requestedCredentialId);
|
|
56
|
+
const generation = await this.refreshIfExpiring();
|
|
57
|
+
if (this.material === null)
|
|
58
|
+
throw new Error('Paybox auth material is unavailable.');
|
|
59
|
+
return this.continueAuthentication(this.material, requestedCredentialId, generation);
|
|
60
|
+
}
|
|
61
|
+
reset() {
|
|
62
|
+
const authentication = this.authenticating;
|
|
63
|
+
this.generation += 1;
|
|
64
|
+
this.wallet = null;
|
|
65
|
+
this.walletGeneration = null;
|
|
66
|
+
this.address = null;
|
|
67
|
+
this.authenticating = null;
|
|
68
|
+
this.restoring = null;
|
|
69
|
+
this.continuing = null;
|
|
70
|
+
this.material = null;
|
|
71
|
+
this.selection = null;
|
|
72
|
+
this.credentialId = null;
|
|
73
|
+
this.refreshing = null;
|
|
74
|
+
this.refreshPersistenceError = null;
|
|
75
|
+
authentication?.controller.abort(new Error('Paybox authentication was invalidated.'));
|
|
76
|
+
let resetError = null;
|
|
77
|
+
for (const clear of [() => this.options.storage.clear(), () => this.options.authenticator.clearSession()]) {
|
|
78
|
+
try {
|
|
79
|
+
clear();
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
resetError ??= error instanceof Error ? error : new Error('Paybox authentication reset failed.');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (resetError !== null)
|
|
86
|
+
throw resetError;
|
|
87
|
+
}
|
|
88
|
+
async authenticateReadyWallet(requestedCredentialId) {
|
|
89
|
+
this.assertNoWalletSelection(requestedCredentialId);
|
|
90
|
+
if (this.wallet === null || this.address === null || this.credentialId === null) {
|
|
91
|
+
throw new Error('Paybox Wallet identity is incomplete.');
|
|
92
|
+
}
|
|
93
|
+
const generation = await this.refreshIfExpiring();
|
|
94
|
+
if (!this.isReady() || this.wallet === null || this.material === null) {
|
|
95
|
+
throw new Error('Paybox Wallet restoration failed.');
|
|
96
|
+
}
|
|
97
|
+
return this.authenticateRestored(this.wallet, this.material, generation, this.credentialId, this.address);
|
|
98
|
+
}
|
|
99
|
+
assertNoWalletSelection(requestedCredentialId) {
|
|
100
|
+
if (requestedCredentialId !== null) {
|
|
101
|
+
throw new PayboxWalletSelectionError(PayboxErrorCode.WalletSelectionNotPending);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
authenticateRestored(wallet, material, generation, credentialId, address) {
|
|
105
|
+
if (this.restoring !== null) {
|
|
106
|
+
if (this.restoring.generation === generation &&
|
|
107
|
+
this.restoring.credentialId === credentialId &&
|
|
108
|
+
this.restoring.address === address) {
|
|
109
|
+
return this.restoring.promise;
|
|
110
|
+
}
|
|
111
|
+
throw new Error('Paybox authentication is already in progress for another Wallet.');
|
|
112
|
+
}
|
|
113
|
+
const authentication = this.runRestoredAuthentication(wallet, material, generation, credentialId, address);
|
|
114
|
+
this.restoring = { credentialId, address, generation, promise: authentication };
|
|
115
|
+
return authentication;
|
|
116
|
+
}
|
|
117
|
+
async runRestoredAuthentication(wallet, material, generation, credentialId, address) {
|
|
118
|
+
try {
|
|
119
|
+
const discovery = await this.options.sdk.listEligibleAutonomousEvmGrants(material.tokens, material.signingKey);
|
|
120
|
+
this.assertCurrent(generation);
|
|
121
|
+
const selected = discovery.grants.find((grant) => grant.credentialId === credentialId);
|
|
122
|
+
if (selected === undefined || getAddress(selected.address) !== address) {
|
|
123
|
+
throw new PayboxAuthInvalidError('The selected Paybox Wallet grant is no longer valid.', PayboxResetCause.SelectedGrantMissing);
|
|
124
|
+
}
|
|
125
|
+
await this.authenticateFresh(wallet, generation, credentialId, address);
|
|
126
|
+
this.assertCurrent(generation);
|
|
127
|
+
return { status: PayboxAuthStatus.Authenticated, address };
|
|
128
|
+
}
|
|
129
|
+
finally {
|
|
130
|
+
if (this.restoring?.generation === generation &&
|
|
131
|
+
this.restoring.credentialId === credentialId &&
|
|
132
|
+
this.restoring.address === address) {
|
|
133
|
+
this.restoring = null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
continueAuthentication(material, requestedCredentialId, generation) {
|
|
138
|
+
if (this.continuing !== null) {
|
|
139
|
+
if (this.continuing.generation !== generation || this.continuing.material !== material) {
|
|
140
|
+
throw new Error('Paybox authentication is already in progress for another auth state.');
|
|
141
|
+
}
|
|
142
|
+
if (this.continuing.requestedCredentialId === requestedCredentialId ||
|
|
143
|
+
(requestedCredentialId === null && this.continuing.requestedCredentialId !== null)) {
|
|
144
|
+
return this.continuing.promise;
|
|
145
|
+
}
|
|
146
|
+
throw new PayboxWalletSelectionError(PayboxErrorCode.WalletSelectionNotPending);
|
|
147
|
+
}
|
|
148
|
+
const continuation = this.runContinuation(material, requestedCredentialId, generation);
|
|
149
|
+
this.continuing = { material, requestedCredentialId, generation, promise: continuation };
|
|
150
|
+
return continuation;
|
|
151
|
+
}
|
|
152
|
+
async runContinuation(material, requestedCredentialId, generation) {
|
|
153
|
+
try {
|
|
154
|
+
return await this.continueWithMaterial(material, requestedCredentialId, generation);
|
|
155
|
+
}
|
|
156
|
+
finally {
|
|
157
|
+
if (this.continuing?.generation === generation &&
|
|
158
|
+
this.continuing.material === material &&
|
|
159
|
+
this.continuing.requestedCredentialId === requestedCredentialId) {
|
|
160
|
+
this.continuing = null;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
async continueWithMaterial(material, requestedCredentialId, generation) {
|
|
165
|
+
if (this.selection?.phase === PayboxSelectionPhase.Activating) {
|
|
166
|
+
if (requestedCredentialId === null || this.selection.credentialId === requestedCredentialId) {
|
|
167
|
+
return this.selection.promise;
|
|
168
|
+
}
|
|
169
|
+
throw new PayboxWalletSelectionError(PayboxErrorCode.WalletSelectionNotPending);
|
|
170
|
+
}
|
|
171
|
+
if (this.selection?.phase === PayboxSelectionPhase.AwaitingChoice) {
|
|
172
|
+
if (requestedCredentialId === null) {
|
|
173
|
+
return { status: PayboxAuthStatus.WalletSelectionRequired, choices: this.selection.choices };
|
|
174
|
+
}
|
|
175
|
+
const choices = this.selection.choices;
|
|
176
|
+
const activation = this.selectGrant(material, requestedCredentialId, choices, generation);
|
|
177
|
+
this.selection = {
|
|
178
|
+
phase: PayboxSelectionPhase.Activating,
|
|
179
|
+
choices,
|
|
180
|
+
credentialId: requestedCredentialId,
|
|
181
|
+
promise: activation,
|
|
182
|
+
};
|
|
183
|
+
return activation;
|
|
184
|
+
}
|
|
185
|
+
if (requestedCredentialId !== null) {
|
|
186
|
+
throw new PayboxWalletSelectionError(PayboxErrorCode.WalletSelectionNotPending);
|
|
187
|
+
}
|
|
188
|
+
const discovery = await this.options.sdk.listEligibleAutonomousEvmGrants(material.tokens, material.signingKey);
|
|
189
|
+
this.assertCurrent(generation);
|
|
190
|
+
if (discovery.grants.length === 0) {
|
|
191
|
+
this.rememberMaterial(material);
|
|
192
|
+
throw new PayboxFullAccessWalletRequiredError(discovery.managementUrl);
|
|
193
|
+
}
|
|
194
|
+
if (discovery.grants.length > 1) {
|
|
195
|
+
this.rememberMaterial(material);
|
|
196
|
+
this.selection = { phase: PayboxSelectionPhase.AwaitingChoice, choices: discovery.grants };
|
|
197
|
+
return { status: PayboxAuthStatus.WalletSelectionRequired, choices: discovery.grants };
|
|
198
|
+
}
|
|
199
|
+
return this.activateGrant(material, discovery.grants[0], generation);
|
|
200
|
+
}
|
|
201
|
+
async selectGrant(material, requestedCredentialId, previousChoices, generation) {
|
|
202
|
+
let discovery;
|
|
203
|
+
try {
|
|
204
|
+
discovery = await this.options.sdk.listEligibleAutonomousEvmGrants(material.tokens, material.signingKey);
|
|
205
|
+
this.assertCurrent(generation);
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
this.restoreSelection(requestedCredentialId, previousChoices, generation);
|
|
209
|
+
throw error;
|
|
210
|
+
}
|
|
211
|
+
const selected = discovery.grants.find((grant) => grant.credentialId === requestedCredentialId);
|
|
212
|
+
if (selected === undefined) {
|
|
213
|
+
if (this.isSelectionActivation(requestedCredentialId, generation)) {
|
|
214
|
+
this.selection =
|
|
215
|
+
discovery.grants.length === 0
|
|
216
|
+
? null
|
|
217
|
+
: { phase: PayboxSelectionPhase.AwaitingChoice, choices: discovery.grants };
|
|
218
|
+
}
|
|
219
|
+
throw new PayboxWalletSelectionError(PayboxErrorCode.WalletSelectionInvalid);
|
|
220
|
+
}
|
|
221
|
+
try {
|
|
222
|
+
return await this.activateGrant(material, selected, generation);
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
this.restoreSelection(requestedCredentialId, discovery.grants, generation);
|
|
226
|
+
throw error;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
async activateGrant(material, grant, generation) {
|
|
230
|
+
const address = getAddress(grant.address);
|
|
231
|
+
const wallet = this.createWallet(material, grant.credentialId, address, generation);
|
|
232
|
+
await this.authenticateFresh(wallet, generation, grant.credentialId, address);
|
|
233
|
+
this.assertCurrent(generation);
|
|
234
|
+
this.options.storage.save({
|
|
235
|
+
version: PAYBOX_SCHEMA_VERSION,
|
|
236
|
+
tokens: material.tokens,
|
|
237
|
+
signingKey: material.signingKey,
|
|
238
|
+
credentialId: grant.credentialId,
|
|
239
|
+
address,
|
|
240
|
+
});
|
|
241
|
+
this.wallet = wallet;
|
|
242
|
+
this.walletGeneration = generation;
|
|
243
|
+
this.address = address;
|
|
244
|
+
this.credentialId = grant.credentialId;
|
|
245
|
+
this.material = material;
|
|
246
|
+
this.selection = null;
|
|
247
|
+
return { status: PayboxAuthStatus.Authenticated, address };
|
|
248
|
+
}
|
|
249
|
+
rememberMaterial(material) {
|
|
250
|
+
this.options.storage.save({
|
|
251
|
+
version: PAYBOX_SCHEMA_VERSION,
|
|
252
|
+
tokens: material.tokens,
|
|
253
|
+
signingKey: material.signingKey,
|
|
254
|
+
credentialId: null,
|
|
255
|
+
address: null,
|
|
256
|
+
});
|
|
257
|
+
this.material = material;
|
|
258
|
+
}
|
|
259
|
+
async refreshIfExpiring() {
|
|
260
|
+
if (this.refreshPersistenceError !== null)
|
|
261
|
+
throw this.refreshPersistenceError;
|
|
262
|
+
const material = this.material;
|
|
263
|
+
if (material === null ||
|
|
264
|
+
material.tokens.expiresAt === null ||
|
|
265
|
+
material.tokens.expiresAt > Date.now() + PAYBOX_TOKEN_REFRESH_WINDOW_MS) {
|
|
266
|
+
return this.generation;
|
|
267
|
+
}
|
|
268
|
+
if (this.refreshing !== null) {
|
|
269
|
+
await this.refreshing.promise;
|
|
270
|
+
return this.generation;
|
|
271
|
+
}
|
|
272
|
+
const generation = this.generation;
|
|
273
|
+
const refresh = this.rotateTokens(material, generation);
|
|
274
|
+
const flight = { generation, promise: refresh };
|
|
275
|
+
this.refreshing = flight;
|
|
276
|
+
try {
|
|
277
|
+
await refresh;
|
|
278
|
+
}
|
|
279
|
+
finally {
|
|
280
|
+
if (this.refreshing === flight)
|
|
281
|
+
this.refreshing = null;
|
|
282
|
+
}
|
|
283
|
+
return this.generation;
|
|
284
|
+
}
|
|
285
|
+
async rotateTokens(material, generation) {
|
|
286
|
+
if (material.tokens.refreshToken === null) {
|
|
287
|
+
throw new PayboxAuthInvalidError('Paybox OAuth refresh token is unavailable.', PayboxResetCause.InvalidRefresh);
|
|
288
|
+
}
|
|
289
|
+
const currentRecord = this.record(material);
|
|
290
|
+
this.options.storage.save(withPayboxRefreshState(currentRecord, PayboxRefreshState.ExchangePending));
|
|
291
|
+
let tokens;
|
|
292
|
+
try {
|
|
293
|
+
tokens = await this.options.sdk.refreshTokens(material.tokens);
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
const refreshError = error instanceof Error ? error : new Error('Paybox OAuth tokens could not be refreshed safely.');
|
|
297
|
+
if (this.generation === generation)
|
|
298
|
+
this.recoverRefreshFailure(currentRecord, refreshError);
|
|
299
|
+
throw refreshError;
|
|
300
|
+
}
|
|
301
|
+
this.assertCurrent(generation);
|
|
302
|
+
const refreshed = { tokens, signingKey: material.signingKey };
|
|
303
|
+
try {
|
|
304
|
+
this.options.storage.save(this.record(refreshed));
|
|
305
|
+
}
|
|
306
|
+
catch (error) {
|
|
307
|
+
this.refreshPersistenceError =
|
|
308
|
+
error instanceof Error ? error : new Error('Rotated Paybox OAuth tokens could not be persisted.');
|
|
309
|
+
throw this.refreshPersistenceError;
|
|
310
|
+
}
|
|
311
|
+
this.assertCurrent(generation);
|
|
312
|
+
this.material = refreshed;
|
|
313
|
+
}
|
|
314
|
+
recoverRefreshFailure(currentRecord, refreshError) {
|
|
315
|
+
if (!(refreshError instanceof PayboxTemporarilyUnavailableError)) {
|
|
316
|
+
this.refreshPersistenceError = refreshError;
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
try {
|
|
320
|
+
this.options.storage.save(withPayboxRefreshState(currentRecord, PayboxRefreshState.Ready));
|
|
321
|
+
this.refreshPersistenceError = null;
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
this.refreshPersistenceError =
|
|
325
|
+
error instanceof Error ? error : new Error('Paybox refresh recovery could not be persisted.');
|
|
326
|
+
throw this.refreshPersistenceError;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
record(material) {
|
|
330
|
+
return {
|
|
331
|
+
version: PAYBOX_SCHEMA_VERSION,
|
|
332
|
+
tokens: material.tokens,
|
|
333
|
+
signingKey: material.signingKey,
|
|
334
|
+
credentialId: this.credentialId,
|
|
335
|
+
address: this.address,
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
createWallet(material, credentialId, address, generation) {
|
|
339
|
+
return this.options.sdk.createWallet(material.tokens, material.signingKey, credentialId, address, this.walletAuthority(material, credentialId, address, generation));
|
|
340
|
+
}
|
|
341
|
+
walletAuthority(candidate, credentialId, address, generation) {
|
|
342
|
+
let authorityGeneration = generation;
|
|
343
|
+
return {
|
|
344
|
+
current: async () => {
|
|
345
|
+
this.assertCurrent(authorityGeneration);
|
|
346
|
+
if (this.credentialId === credentialId && this.address === address) {
|
|
347
|
+
await this.refreshIfExpiring();
|
|
348
|
+
if (this.credentialId !== credentialId || this.address !== address || this.material === null) {
|
|
349
|
+
throw new Error('Paybox Wallet authority was invalidated.');
|
|
350
|
+
}
|
|
351
|
+
authorityGeneration = this.generation;
|
|
352
|
+
return this.material;
|
|
353
|
+
}
|
|
354
|
+
return candidate;
|
|
355
|
+
},
|
|
356
|
+
invalidate: () => {
|
|
357
|
+
if (this.generation !== authorityGeneration)
|
|
358
|
+
return;
|
|
359
|
+
try {
|
|
360
|
+
this.reset();
|
|
361
|
+
}
|
|
362
|
+
finally {
|
|
363
|
+
this.onInvalidated();
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
async authenticateFresh(wallet, generation, credentialId, address) {
|
|
369
|
+
if (this.authenticating !== null) {
|
|
370
|
+
if (this.authenticating.generation === generation &&
|
|
371
|
+
this.authenticating.credentialId === credentialId &&
|
|
372
|
+
this.authenticating.address === address) {
|
|
373
|
+
return this.authenticating.promise;
|
|
374
|
+
}
|
|
375
|
+
throw new Error('Paybox authentication is already in progress for another Wallet.');
|
|
376
|
+
}
|
|
377
|
+
const controller = new AbortController();
|
|
378
|
+
const authentication = this.options.authenticator.authenticate(wallet, controller.signal);
|
|
379
|
+
const flight = {
|
|
380
|
+
credentialId,
|
|
381
|
+
address,
|
|
382
|
+
generation,
|
|
383
|
+
controller,
|
|
384
|
+
promise: authentication,
|
|
385
|
+
};
|
|
386
|
+
this.authenticating = flight;
|
|
387
|
+
try {
|
|
388
|
+
return await authentication;
|
|
389
|
+
}
|
|
390
|
+
finally {
|
|
391
|
+
if (this.authenticating === flight)
|
|
392
|
+
this.authenticating = null;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
restoreSelection(requestedCredentialId, choices, generation) {
|
|
396
|
+
if (this.isSelectionActivation(requestedCredentialId, generation)) {
|
|
397
|
+
this.selection = { phase: PayboxSelectionPhase.AwaitingChoice, choices };
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
isSelectionActivation(requestedCredentialId, generation) {
|
|
401
|
+
return (this.generation === generation &&
|
|
402
|
+
this.selection?.phase === PayboxSelectionPhase.Activating &&
|
|
403
|
+
this.selection.credentialId === requestedCredentialId);
|
|
404
|
+
}
|
|
405
|
+
assertCurrent(generation) {
|
|
406
|
+
if (this.generation !== generation)
|
|
407
|
+
throw new Error('Paybox authentication was invalidated.');
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
//# sourceMappingURL=authority.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authority.js","sourceRoot":"","sources":["../../../src/paybox/auth/authority.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGpF,OAAO,EACH,sBAAsB,EACtB,mCAAmC,EACnC,iCAAiC,EACjC,0BAA0B,GAC7B,MAAM,cAAc,CAAC;AACtB,OAAO,EACH,gBAAgB,EAChB,eAAe,EACf,+BAA+B,EAC/B,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,GAWvB,MAAM,aAAa,CAAC;A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MAAM,cAAc,CAAC;QAChC,CAAC;gBAAS,CAAC;YACP,IAAI,IAAI,CAAC,cAAc,KAAK,MAAM;gBAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QACnE,CAAC;IACL,CAAC;IAEO,gBAAgB,CACpB,qBAA6B,EAC7B,OAAmC,EACnC,UAAkB;QAElB,IAAI,IAAI,CAAC,qBAAqB,CAAC,qBAAqB,EAAE,UAAU,CAAC,EAAE,CAAC;YAChE,IAAI,CAAC,SAAS,GAAG,EAAE,KAAK,EAAE,oBAAoB,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC;QAC7E,CAAC;IACL,CAAC;IAEO,qBAAqB,CAAC,qBAA6B,EAAE,UAAkB;QAC3E,OAAO,CACH,IAAI,CAAC,UAAU,KAAK,UAAU;YAC9B,IAAI,CAAC,SAAS,EAAE,KAAK,KAAK,oBAAoB,CAAC,UAAU;YACzD,IAAI,CAAC,SAAS,CAAC,YAAY,KAAK,qBAAqB,CACxD,CAAC;IACN,CAAC;IAEO,aAAa,CAAC,UAAkB;QACpC,IAAI,IAAI,CAAC,UAAU,KAAK,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAClG,CAAC;CACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IPayboxBrowserOpener, PayboxBrowserSpawn } from '../types.js';
|
|
2
|
+
export declare class SystemBrowserOpener implements IPayboxBrowserOpener {
|
|
3
|
+
private readonly platform;
|
|
4
|
+
private readonly spawnProcess;
|
|
5
|
+
constructor(platform?: NodeJS.Platform, spawnProcess?: PayboxBrowserSpawn);
|
|
6
|
+
open(url: string): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=browser-opener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-opener.d.ts","sourceRoot":"","sources":["../../../src/paybox/auth/browser-opener.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE5E,qBAAa,mBAAoB,YAAW,oBAAoB;IAExD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,YAAY,GAAE,kBAA0B;IAGtD,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAUjC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { browserLaunchCommand } from './browser-opener.utils.js';
|
|
3
|
+
export class SystemBrowserOpener {
|
|
4
|
+
platform;
|
|
5
|
+
spawnProcess;
|
|
6
|
+
constructor(platform = process.platform, spawnProcess = spawn) {
|
|
7
|
+
this.platform = platform;
|
|
8
|
+
this.spawnProcess = spawnProcess;
|
|
9
|
+
}
|
|
10
|
+
open(url) {
|
|
11
|
+
const [command, args] = browserLaunchCommand(url, this.platform);
|
|
12
|
+
try {
|
|
13
|
+
const child = this.spawnProcess(command, args, { stdio: 'ignore', detached: true });
|
|
14
|
+
child.once('error', () => undefined);
|
|
15
|
+
child.unref();
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
// The authorization URL returned to the caller remains the headless fallback.
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=browser-opener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-opener.js","sourceRoot":"","sources":["../../../src/paybox/auth/browser-opener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,MAAM,OAAO,mBAAmB;IAEP;IACA;IAFrB,YACqB,WAA4B,OAAO,CAAC,QAAQ,EAC5C,eAAmC,KAAK;QADxC,aAAQ,GAAR,QAAQ,CAAoC;QAC5C,iBAAY,GAAZ,YAAY,CAA4B;IAC1D,CAAC;IAEG,IAAI,CAAC,GAAW;QACnB,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,oBAAoB,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjE,IAAI,CAAC;YACD,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YACpF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACrC,KAAK,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;QAAC,MAAM,CAAC;YACL,8EAA8E;QAClF,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-opener.utils.d.ts","sourceRoot":"","sources":["../../../src/paybox/auth/browser-opener.utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAQrH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function browserLaunchCommand(url, platform) {
|
|
2
|
+
if (platform === 'darwin') {
|
|
3
|
+
return ['open', [url]];
|
|
4
|
+
}
|
|
5
|
+
if (platform === 'win32') {
|
|
6
|
+
return ['rundll32', ['url.dll,FileProtocolHandler', url]];
|
|
7
|
+
}
|
|
8
|
+
return ['xdg-open', [url]];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=browser-opener.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-opener.utils.js","sourceRoot":"","sources":["../../../src/paybox/auth/browser-opener.utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,oBAAoB,CAAC,GAAW,EAAE,QAAyB;IACvE,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACxB,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACvB,OAAO,CAAC,UAAU,EAAE,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const OAUTH_DISCOVERY_PATH = "/.well-known/oauth-authorization-server";
|
|
2
|
+
export declare const OAUTH_SCOPE = "mcp offline_access";
|
|
3
|
+
export declare const PAYBOX_OAUTH_CLIENT_NAME = "Project CPU MCP";
|
|
4
|
+
export declare const OAUTH_CONFIRMED_AUTH_HTTP_STATUSES: Set<number>;
|
|
5
|
+
export declare const LOOPBACK_HOST = "127.0.0.1";
|
|
6
|
+
export declare const LOOPBACK_CALLBACK_PREFIX = "/oauth/callback/";
|
|
7
|
+
export declare const LOOPBACK_KEY_PREFIX = "/oauth/key/";
|
|
8
|
+
export declare const PAYBOX_AGENT_KEY_PATH = "/agent-key";
|
|
9
|
+
export declare const DEFAULT_LOOPBACK_TIMEOUT_MS: number;
|
|
10
|
+
export declare const KEY_BODY_LIMIT_BYTES = 4096;
|
|
11
|
+
export declare const HTML_HEADERS: {
|
|
12
|
+
'cache-control': string;
|
|
13
|
+
'content-security-policy': string;
|
|
14
|
+
'content-type': string;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/paybox/auth/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,4CAA4C,CAAC;AAC9E,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAChD,eAAO,MAAM,wBAAwB,oBAAoB,CAAC;AAC1D,eAAO,MAAM,kCAAkC,aAA2B,CAAC;AAC3E,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAC3D,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AACjD,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAClD,eAAO,MAAM,2BAA2B,QAAgB,CAAC;AACzD,eAAO,MAAM,oBAAoB,OAAO,CAAC;AACzC,eAAO,MAAM,YAAY;;;;CAKxB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const OAUTH_DISCOVERY_PATH = '/.well-known/oauth-authorization-server';
|
|
2
|
+
export const OAUTH_SCOPE = 'mcp offline_access';
|
|
3
|
+
export const PAYBOX_OAUTH_CLIENT_NAME = 'Project CPU MCP';
|
|
4
|
+
export const OAUTH_CONFIRMED_AUTH_HTTP_STATUSES = new Set([400, 401, 403]);
|
|
5
|
+
export const LOOPBACK_HOST = '127.0.0.1';
|
|
6
|
+
export const LOOPBACK_CALLBACK_PREFIX = '/oauth/callback/';
|
|
7
|
+
export const LOOPBACK_KEY_PREFIX = '/oauth/key/';
|
|
8
|
+
export const PAYBOX_AGENT_KEY_PATH = '/agent-key';
|
|
9
|
+
export const DEFAULT_LOOPBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
10
|
+
export const KEY_BODY_LIMIT_BYTES = 4096;
|
|
11
|
+
export const HTML_HEADERS = {
|
|
12
|
+
'cache-control': 'no-store',
|
|
13
|
+
'content-security-policy': "default-src 'none'; style-src 'unsafe-inline'; font-src data:; form-action 'self'; base-uri 'none'",
|
|
14
|
+
'content-type': 'text/html; charset=utf-8',
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/paybox/auth/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,yCAAyC,CAAC;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAChD,MAAM,CAAC,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;AAC1D,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC;AACzC,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;AACjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAClD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AACzC,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,eAAe,EAAE,UAAU;IAC3B,yBAAyB,EACrB,oGAAoG;IACxG,cAAc,EAAE,0BAA0B;CAC7C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ILogger } from '../../logger/types.js';
|
|
2
|
+
import type { WalletManager, WalletProvider } from '../../wallet/types.js';
|
|
3
|
+
import { type PayboxAuthenticateInput, type PayboxAuthenticateResult, type PayboxCoordinatorOptions } from '../types.js';
|
|
4
|
+
/** The sole lifecycle owner: auth transport returns material, this module decides persistence and selection. */
|
|
5
|
+
export declare class PayboxCoordinator implements WalletProvider {
|
|
6
|
+
private readonly logger;
|
|
7
|
+
private readonly authFlow;
|
|
8
|
+
private readonly authority;
|
|
9
|
+
private forcing;
|
|
10
|
+
constructor(options: PayboxCoordinatorOptions, logger?: ILogger);
|
|
11
|
+
isReady(): boolean;
|
|
12
|
+
get(): WalletManager;
|
|
13
|
+
authenticate(input: PayboxAuthenticateInput): Promise<PayboxAuthenticateResult>;
|
|
14
|
+
private runForcedAuthentication;
|
|
15
|
+
private authenticateForced;
|
|
16
|
+
private authenticateWithRecovery;
|
|
17
|
+
private advanceAuthentication;
|
|
18
|
+
private pollAuthFlow;
|
|
19
|
+
private resetAuthState;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../../src/paybox/auth/coordinator.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAO3E,OAAO,EAGH,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAChC,MAAM,aAAa,CAAC;AAErB,gHAAgH;AAChH,qBAAa,iBAAkB,YAAW,cAAc;IAOhD,OAAO,CAAC,QAAQ,CAAC,MAAM;IAN3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;IAC5C,OAAO,CAAC,OAAO,CAAkD;gBAG7D,OAAO,EAAE,wBAAwB,EAChB,MAAM,GAAE,OAA0B;IASvD,OAAO,IAAI,OAAO;IAIlB,GAAG,IAAI,aAAa;IAIpB,YAAY,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC;YAQjE,uBAAuB;YAQvB,kBAAkB;YAKlB,wBAAwB;IAgBtC,OAAO,CAAC,qBAAqB;YAMf,YAAY;IAa1B,OAAO,CAAC,cAAc;CAIzB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PayboxCoordinator } from './coordinator.js';
|
|
2
|
+
import type { ILogger } from '../../logger/types.js';
|
|
3
|
+
import type { PayboxCoordinatorOptions } from '../types.js';
|
|
4
|
+
export declare function createPayboxCoordinator(options: PayboxCoordinatorOptions, logger: ILogger): PayboxCoordinator;
|
|
5
|
+
//# sourceMappingURL=coordinator.factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.factory.d.ts","sourceRoot":"","sources":["../../../src/paybox/auth/coordinator.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,OAAO,GAAG,iBAAiB,CAE7G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.factory.js","sourceRoot":"","sources":["../../../src/paybox/auth/coordinator.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrD,MAAM,UAAU,uBAAuB,CAAC,OAAiC,EAAE,MAAe;IACtF,OAAO,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAC9E,CAAC"}
|