@waiaas/daemon 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/error-hints.d.ts +15 -0
- package/dist/api/error-hints.d.ts.map +1 -0
- package/dist/api/error-hints.js +71 -0
- package/dist/api/error-hints.js.map +1 -0
- package/dist/api/index.d.ts +11 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +14 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/middleware/address-validation.d.ts +38 -0
- package/dist/api/middleware/address-validation.d.ts.map +1 -0
- package/dist/api/middleware/address-validation.js +134 -0
- package/dist/api/middleware/address-validation.js.map +1 -0
- package/dist/api/middleware/csp.d.ts +17 -0
- package/dist/api/middleware/csp.d.ts.map +1 -0
- package/dist/api/middleware/csp.js +31 -0
- package/dist/api/middleware/csp.js.map +1 -0
- package/dist/api/middleware/error-handler.d.ts +16 -0
- package/dist/api/middleware/error-handler.d.ts.map +1 -0
- package/dist/api/middleware/error-handler.js +46 -0
- package/dist/api/middleware/error-handler.js.map +1 -0
- package/dist/api/middleware/host-guard.d.ts +11 -0
- package/dist/api/middleware/host-guard.d.ts.map +1 -0
- package/dist/api/middleware/host-guard.js +25 -0
- package/dist/api/middleware/host-guard.js.map +1 -0
- package/dist/api/middleware/index.d.ts +13 -0
- package/dist/api/middleware/index.d.ts.map +1 -0
- package/dist/api/middleware/index.js +13 -0
- package/dist/api/middleware/index.js.map +1 -0
- package/dist/api/middleware/kill-switch-guard.d.ts +19 -0
- package/dist/api/middleware/kill-switch-guard.d.ts.map +1 -0
- package/dist/api/middleware/kill-switch-guard.js +49 -0
- package/dist/api/middleware/kill-switch-guard.js.map +1 -0
- package/dist/api/middleware/master-auth.d.ts +15 -0
- package/dist/api/middleware/master-auth.d.ts.map +1 -0
- package/dist/api/middleware/master-auth.js +35 -0
- package/dist/api/middleware/master-auth.js.map +1 -0
- package/dist/api/middleware/owner-auth.d.ts +30 -0
- package/dist/api/middleware/owner-auth.d.ts.map +1 -0
- package/dist/api/middleware/owner-auth.js +133 -0
- package/dist/api/middleware/owner-auth.js.map +1 -0
- package/dist/api/middleware/request-id.d.ts +10 -0
- package/dist/api/middleware/request-id.d.ts.map +1 -0
- package/dist/api/middleware/request-id.js +18 -0
- package/dist/api/middleware/request-id.js.map +1 -0
- package/dist/api/middleware/request-logger.d.ts +9 -0
- package/dist/api/middleware/request-logger.d.ts.map +1 -0
- package/dist/api/middleware/request-logger.js +18 -0
- package/dist/api/middleware/request-logger.js.map +1 -0
- package/dist/api/middleware/session-auth.d.ts +21 -0
- package/dist/api/middleware/session-auth.d.ts.map +1 -0
- package/dist/api/middleware/session-auth.js +51 -0
- package/dist/api/middleware/session-auth.js.map +1 -0
- package/dist/api/middleware/siwe-verify.d.ts +31 -0
- package/dist/api/middleware/siwe-verify.d.ts.map +1 -0
- package/dist/api/middleware/siwe-verify.js +55 -0
- package/dist/api/middleware/siwe-verify.js.map +1 -0
- package/dist/api/routes/actions.d.ts +56 -0
- package/dist/api/routes/actions.d.ts.map +1 -0
- package/dist/api/routes/actions.js +291 -0
- package/dist/api/routes/actions.js.map +1 -0
- package/dist/api/routes/admin.d.ts +99 -0
- package/dist/api/routes/admin.d.ts.map +1 -0
- package/dist/api/routes/admin.js +1304 -0
- package/dist/api/routes/admin.js.map +1 -0
- package/dist/api/routes/display-currency-helper.d.ts +26 -0
- package/dist/api/routes/display-currency-helper.d.ts.map +1 -0
- package/dist/api/routes/display-currency-helper.js +47 -0
- package/dist/api/routes/display-currency-helper.js.map +1 -0
- package/dist/api/routes/health.d.ts +14 -0
- package/dist/api/routes/health.d.ts.map +1 -0
- package/dist/api/routes/health.js +47 -0
- package/dist/api/routes/health.js.map +1 -0
- package/dist/api/routes/index.d.ts +15 -0
- package/dist/api/routes/index.d.ts.map +1 -0
- package/dist/api/routes/index.js +15 -0
- package/dist/api/routes/index.js.map +1 -0
- package/dist/api/routes/mcp.d.ts +30 -0
- package/dist/api/routes/mcp.d.ts.map +1 -0
- package/dist/api/routes/mcp.js +156 -0
- package/dist/api/routes/mcp.js.map +1 -0
- package/dist/api/routes/nonce.d.ts +20 -0
- package/dist/api/routes/nonce.d.ts.map +1 -0
- package/dist/api/routes/nonce.js +48 -0
- package/dist/api/routes/nonce.js.map +1 -0
- package/dist/api/routes/openapi-schemas.d.ts +2281 -0
- package/dist/api/routes/openapi-schemas.d.ts.map +1 -0
- package/dist/api/routes/openapi-schemas.js +770 -0
- package/dist/api/routes/openapi-schemas.js.map +1 -0
- package/dist/api/routes/policies.d.ts +29 -0
- package/dist/api/routes/policies.d.ts.map +1 -0
- package/dist/api/routes/policies.js +332 -0
- package/dist/api/routes/policies.js.map +1 -0
- package/dist/api/routes/sessions.d.ts +35 -0
- package/dist/api/routes/sessions.d.ts.map +1 -0
- package/dist/api/routes/sessions.js +347 -0
- package/dist/api/routes/sessions.js.map +1 -0
- package/dist/api/routes/skills.d.ts +9 -0
- package/dist/api/routes/skills.d.ts.map +1 -0
- package/dist/api/routes/skills.js +59 -0
- package/dist/api/routes/skills.js.map +1 -0
- package/dist/api/routes/tokens.d.ts +25 -0
- package/dist/api/routes/tokens.d.ts.map +1 -0
- package/dist/api/routes/tokens.js +161 -0
- package/dist/api/routes/tokens.js.map +1 -0
- package/dist/api/routes/transactions.d.ts +68 -0
- package/dist/api/routes/transactions.d.ts.map +1 -0
- package/dist/api/routes/transactions.js +576 -0
- package/dist/api/routes/transactions.js.map +1 -0
- package/dist/api/routes/utils.d.ts +9 -0
- package/dist/api/routes/utils.d.ts.map +1 -0
- package/dist/api/routes/utils.js +52 -0
- package/dist/api/routes/utils.js.map +1 -0
- package/dist/api/routes/wallet.d.ts +36 -0
- package/dist/api/routes/wallet.d.ts.map +1 -0
- package/dist/api/routes/wallet.js +358 -0
- package/dist/api/routes/wallet.js.map +1 -0
- package/dist/api/routes/wallets.d.ts +43 -0
- package/dist/api/routes/wallets.d.ts.map +1 -0
- package/dist/api/routes/wallets.js +630 -0
- package/dist/api/routes/wallets.js.map +1 -0
- package/dist/api/routes/wc.d.ts +46 -0
- package/dist/api/routes/wc.d.ts.map +1 -0
- package/dist/api/routes/wc.js +354 -0
- package/dist/api/routes/wc.js.map +1 -0
- package/dist/api/routes/x402.d.ts +61 -0
- package/dist/api/routes/x402.d.ts.map +1 -0
- package/dist/api/routes/x402.js +493 -0
- package/dist/api/routes/x402.js.map +1 -0
- package/dist/api/server.d.ts +81 -0
- package/dist/api/server.d.ts.map +1 -0
- package/dist/api/server.js +406 -0
- package/dist/api/server.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/action/action-provider-registry.d.ts +77 -0
- package/dist/infrastructure/action/action-provider-registry.d.ts.map +1 -0
- package/dist/infrastructure/action/action-provider-registry.js +239 -0
- package/dist/infrastructure/action/action-provider-registry.js.map +1 -0
- package/dist/infrastructure/action/api-key-store.d.ts +60 -0
- package/dist/infrastructure/action/api-key-store.d.ts.map +1 -0
- package/dist/infrastructure/action/api-key-store.js +130 -0
- package/dist/infrastructure/action/api-key-store.js.map +1 -0
- package/dist/infrastructure/action/index.d.ts +10 -0
- package/dist/infrastructure/action/index.d.ts.map +1 -0
- package/dist/infrastructure/action/index.js +9 -0
- package/dist/infrastructure/action/index.js.map +1 -0
- package/dist/infrastructure/adapter-pool.d.ts +50 -0
- package/dist/infrastructure/adapter-pool.d.ts.map +1 -0
- package/dist/infrastructure/adapter-pool.js +110 -0
- package/dist/infrastructure/adapter-pool.js.map +1 -0
- package/dist/infrastructure/backup/backup-service.d.ts +53 -0
- package/dist/infrastructure/backup/backup-service.d.ts.map +1 -0
- package/dist/infrastructure/backup/backup-service.js +158 -0
- package/dist/infrastructure/backup/backup-service.js.map +1 -0
- package/dist/infrastructure/backup/index.d.ts +2 -0
- package/dist/infrastructure/backup/index.d.ts.map +1 -0
- package/dist/infrastructure/backup/index.js +2 -0
- package/dist/infrastructure/backup/index.js.map +1 -0
- package/dist/infrastructure/config/index.d.ts +8 -0
- package/dist/infrastructure/config/index.d.ts.map +1 -0
- package/dist/infrastructure/config/index.js +7 -0
- package/dist/infrastructure/config/index.js.map +1 -0
- package/dist/infrastructure/config/loader.d.ts +555 -0
- package/dist/infrastructure/config/loader.d.ts.map +1 -0
- package/dist/infrastructure/config/loader.js +311 -0
- package/dist/infrastructure/config/loader.js.map +1 -0
- package/dist/infrastructure/database/checks.d.ts +19 -0
- package/dist/infrastructure/database/checks.d.ts.map +1 -0
- package/dist/infrastructure/database/checks.js +27 -0
- package/dist/infrastructure/database/checks.js.map +1 -0
- package/dist/infrastructure/database/compatibility.d.ts +36 -0
- package/dist/infrastructure/database/compatibility.d.ts.map +1 -0
- package/dist/infrastructure/database/compatibility.js +75 -0
- package/dist/infrastructure/database/compatibility.js.map +1 -0
- package/dist/infrastructure/database/connection.d.ts +36 -0
- package/dist/infrastructure/database/connection.d.ts.map +1 -0
- package/dist/infrastructure/database/connection.js +47 -0
- package/dist/infrastructure/database/connection.js.map +1 -0
- package/dist/infrastructure/database/id.d.ts +17 -0
- package/dist/infrastructure/database/id.d.ts.map +1 -0
- package/dist/infrastructure/database/id.js +20 -0
- package/dist/infrastructure/database/id.js.map +1 -0
- package/dist/infrastructure/database/index.d.ts +15 -0
- package/dist/infrastructure/database/index.d.ts.map +1 -0
- package/dist/infrastructure/database/index.js +12 -0
- package/dist/infrastructure/database/index.js.map +1 -0
- package/dist/infrastructure/database/migrate.d.ts +76 -0
- package/dist/infrastructure/database/migrate.d.ts.map +1 -0
- package/dist/infrastructure/database/migrate.js +1214 -0
- package/dist/infrastructure/database/migrate.js.map +1 -0
- package/dist/infrastructure/database/schema.d.ts +2352 -0
- package/dist/infrastructure/database/schema.d.ts.map +1 -0
- package/dist/infrastructure/database/schema.js +288 -0
- package/dist/infrastructure/database/schema.js.map +1 -0
- package/dist/infrastructure/jwt/index.d.ts +2 -0
- package/dist/infrastructure/jwt/index.d.ts.map +1 -0
- package/dist/infrastructure/jwt/index.js +2 -0
- package/dist/infrastructure/jwt/index.js.map +1 -0
- package/dist/infrastructure/jwt/jwt-secret-manager.d.ts +58 -0
- package/dist/infrastructure/jwt/jwt-secret-manager.d.ts.map +1 -0
- package/dist/infrastructure/jwt/jwt-secret-manager.js +222 -0
- package/dist/infrastructure/jwt/jwt-secret-manager.js.map +1 -0
- package/dist/infrastructure/keystore/crypto.d.ts +62 -0
- package/dist/infrastructure/keystore/crypto.d.ts.map +1 -0
- package/dist/infrastructure/keystore/crypto.js +89 -0
- package/dist/infrastructure/keystore/crypto.js.map +1 -0
- package/dist/infrastructure/keystore/index.d.ts +4 -0
- package/dist/infrastructure/keystore/index.d.ts.map +1 -0
- package/dist/infrastructure/keystore/index.js +5 -0
- package/dist/infrastructure/keystore/index.js.map +1 -0
- package/dist/infrastructure/keystore/keystore.d.ts +115 -0
- package/dist/infrastructure/keystore/keystore.d.ts.map +1 -0
- package/dist/infrastructure/keystore/keystore.js +327 -0
- package/dist/infrastructure/keystore/keystore.js.map +1 -0
- package/dist/infrastructure/keystore/memory.d.ts +45 -0
- package/dist/infrastructure/keystore/memory.d.ts.map +1 -0
- package/dist/infrastructure/keystore/memory.js +105 -0
- package/dist/infrastructure/keystore/memory.js.map +1 -0
- package/dist/infrastructure/oracle/coingecko-forex.d.ts +35 -0
- package/dist/infrastructure/oracle/coingecko-forex.d.ts.map +1 -0
- package/dist/infrastructure/oracle/coingecko-forex.js +69 -0
- package/dist/infrastructure/oracle/coingecko-forex.js.map +1 -0
- package/dist/infrastructure/oracle/coingecko-oracle.d.ts +73 -0
- package/dist/infrastructure/oracle/coingecko-oracle.d.ts.map +1 -0
- package/dist/infrastructure/oracle/coingecko-oracle.js +199 -0
- package/dist/infrastructure/oracle/coingecko-oracle.js.map +1 -0
- package/dist/infrastructure/oracle/coingecko-platform-ids.d.ts +32 -0
- package/dist/infrastructure/oracle/coingecko-platform-ids.d.ts.map +1 -0
- package/dist/infrastructure/oracle/coingecko-platform-ids.js +30 -0
- package/dist/infrastructure/oracle/coingecko-platform-ids.js.map +1 -0
- package/dist/infrastructure/oracle/forex-currencies.d.ts +36 -0
- package/dist/infrastructure/oracle/forex-currencies.d.ts.map +1 -0
- package/dist/infrastructure/oracle/forex-currencies.js +71 -0
- package/dist/infrastructure/oracle/forex-currencies.js.map +1 -0
- package/dist/infrastructure/oracle/forex-rate-service.d.ts +51 -0
- package/dist/infrastructure/oracle/forex-rate-service.d.ts.map +1 -0
- package/dist/infrastructure/oracle/forex-rate-service.js +149 -0
- package/dist/infrastructure/oracle/forex-rate-service.js.map +1 -0
- package/dist/infrastructure/oracle/index.d.ts +18 -0
- package/dist/infrastructure/oracle/index.d.ts.map +1 -0
- package/dist/infrastructure/oracle/index.js +19 -0
- package/dist/infrastructure/oracle/index.js.map +1 -0
- package/dist/infrastructure/oracle/oracle-chain.d.ts +101 -0
- package/dist/infrastructure/oracle/oracle-chain.d.ts.map +1 -0
- package/dist/infrastructure/oracle/oracle-chain.js +163 -0
- package/dist/infrastructure/oracle/oracle-chain.js.map +1 -0
- package/dist/infrastructure/oracle/oracle-errors.d.ts +42 -0
- package/dist/infrastructure/oracle/oracle-errors.d.ts.map +1 -0
- package/dist/infrastructure/oracle/oracle-errors.js +53 -0
- package/dist/infrastructure/oracle/oracle-errors.js.map +1 -0
- package/dist/infrastructure/oracle/price-age.d.ts +38 -0
- package/dist/infrastructure/oracle/price-age.d.ts.map +1 -0
- package/dist/infrastructure/oracle/price-age.js +44 -0
- package/dist/infrastructure/oracle/price-age.js.map +1 -0
- package/dist/infrastructure/oracle/price-cache.d.ts +99 -0
- package/dist/infrastructure/oracle/price-cache.d.ts.map +1 -0
- package/dist/infrastructure/oracle/price-cache.js +173 -0
- package/dist/infrastructure/oracle/price-cache.js.map +1 -0
- package/dist/infrastructure/oracle/pyth-feed-ids.d.ts +31 -0
- package/dist/infrastructure/oracle/pyth-feed-ids.d.ts.map +1 -0
- package/dist/infrastructure/oracle/pyth-feed-ids.js +44 -0
- package/dist/infrastructure/oracle/pyth-feed-ids.js.map +1 -0
- package/dist/infrastructure/oracle/pyth-oracle.d.ts +69 -0
- package/dist/infrastructure/oracle/pyth-oracle.d.ts.map +1 -0
- package/dist/infrastructure/oracle/pyth-oracle.js +149 -0
- package/dist/infrastructure/oracle/pyth-oracle.js.map +1 -0
- package/dist/infrastructure/settings/hot-reload.d.ts +71 -0
- package/dist/infrastructure/settings/hot-reload.d.ts.map +1 -0
- package/dist/infrastructure/settings/hot-reload.js +315 -0
- package/dist/infrastructure/settings/hot-reload.js.map +1 -0
- package/dist/infrastructure/settings/index.d.ts +13 -0
- package/dist/infrastructure/settings/index.d.ts.map +1 -0
- package/dist/infrastructure/settings/index.js +10 -0
- package/dist/infrastructure/settings/index.js.map +1 -0
- package/dist/infrastructure/settings/setting-keys.d.ts +28 -0
- package/dist/infrastructure/settings/setting-keys.d.ts.map +1 -0
- package/dist/infrastructure/settings/setting-keys.js +105 -0
- package/dist/infrastructure/settings/setting-keys.js.map +1 -0
- package/dist/infrastructure/settings/settings-crypto.d.ts +39 -0
- package/dist/infrastructure/settings/settings-crypto.d.ts.map +1 -0
- package/dist/infrastructure/settings/settings-crypto.js +73 -0
- package/dist/infrastructure/settings/settings-crypto.js.map +1 -0
- package/dist/infrastructure/settings/settings-service.d.ts +82 -0
- package/dist/infrastructure/settings/settings-service.d.ts.map +1 -0
- package/dist/infrastructure/settings/settings-service.js +267 -0
- package/dist/infrastructure/settings/settings-service.js.map +1 -0
- package/dist/infrastructure/telegram/index.d.ts +6 -0
- package/dist/infrastructure/telegram/index.d.ts.map +1 -0
- package/dist/infrastructure/telegram/index.js +5 -0
- package/dist/infrastructure/telegram/index.js.map +1 -0
- package/dist/infrastructure/telegram/telegram-api.d.ts +35 -0
- package/dist/infrastructure/telegram/telegram-api.d.ts.map +1 -0
- package/dist/infrastructure/telegram/telegram-api.js +82 -0
- package/dist/infrastructure/telegram/telegram-api.js.map +1 -0
- package/dist/infrastructure/telegram/telegram-auth.d.ts +57 -0
- package/dist/infrastructure/telegram/telegram-auth.d.ts.map +1 -0
- package/dist/infrastructure/telegram/telegram-auth.js +88 -0
- package/dist/infrastructure/telegram/telegram-auth.js.map +1 -0
- package/dist/infrastructure/telegram/telegram-bot-service.d.ts +95 -0
- package/dist/infrastructure/telegram/telegram-bot-service.d.ts.map +1 -0
- package/dist/infrastructure/telegram/telegram-bot-service.js +564 -0
- package/dist/infrastructure/telegram/telegram-bot-service.js.map +1 -0
- package/dist/infrastructure/telegram/telegram-keyboard.d.ts +27 -0
- package/dist/infrastructure/telegram/telegram-keyboard.d.ts.map +1 -0
- package/dist/infrastructure/telegram/telegram-keyboard.js +52 -0
- package/dist/infrastructure/telegram/telegram-keyboard.js.map +1 -0
- package/dist/infrastructure/telegram/telegram-types.d.ts +43 -0
- package/dist/infrastructure/telegram/telegram-types.d.ts.map +1 -0
- package/dist/infrastructure/telegram/telegram-types.js +8 -0
- package/dist/infrastructure/telegram/telegram-types.js.map +1 -0
- package/dist/infrastructure/token-registry/builtin-tokens.d.ts +39 -0
- package/dist/infrastructure/token-registry/builtin-tokens.d.ts.map +1 -0
- package/dist/infrastructure/token-registry/builtin-tokens.js +135 -0
- package/dist/infrastructure/token-registry/builtin-tokens.js.map +1 -0
- package/dist/infrastructure/token-registry/index.d.ts +8 -0
- package/dist/infrastructure/token-registry/index.d.ts.map +1 -0
- package/dist/infrastructure/token-registry/index.js +8 -0
- package/dist/infrastructure/token-registry/index.js.map +1 -0
- package/dist/infrastructure/token-registry/token-registry-service.d.ts +49 -0
- package/dist/infrastructure/token-registry/token-registry-service.d.ts.map +1 -0
- package/dist/infrastructure/token-registry/token-registry-service.js +93 -0
- package/dist/infrastructure/token-registry/token-registry-service.js.map +1 -0
- package/dist/infrastructure/version/index.d.ts +5 -0
- package/dist/infrastructure/version/index.d.ts.map +1 -0
- package/dist/infrastructure/version/index.js +5 -0
- package/dist/infrastructure/version/index.js.map +1 -0
- package/dist/infrastructure/version/version-check-service.d.ts +35 -0
- package/dist/infrastructure/version/version-check-service.d.ts.map +1 -0
- package/dist/infrastructure/version/version-check-service.js +92 -0
- package/dist/infrastructure/version/version-check-service.js.map +1 -0
- package/dist/lifecycle/daemon.d.ts +103 -0
- package/dist/lifecycle/daemon.d.ts.map +1 -0
- package/dist/lifecycle/daemon.js +934 -0
- package/dist/lifecycle/daemon.js.map +1 -0
- package/dist/lifecycle/index.d.ts +9 -0
- package/dist/lifecycle/index.d.ts.map +1 -0
- package/dist/lifecycle/index.js +9 -0
- package/dist/lifecycle/index.js.map +1 -0
- package/dist/lifecycle/signal-handler.d.ts +18 -0
- package/dist/lifecycle/signal-handler.d.ts.map +1 -0
- package/dist/lifecycle/signal-handler.js +37 -0
- package/dist/lifecycle/signal-handler.js.map +1 -0
- package/dist/lifecycle/workers.d.ts +46 -0
- package/dist/lifecycle/workers.d.ts.map +1 -0
- package/dist/lifecycle/workers.js +101 -0
- package/dist/lifecycle/workers.js.map +1 -0
- package/dist/notifications/channels/discord.d.ts +10 -0
- package/dist/notifications/channels/discord.d.ts.map +1 -0
- package/dist/notifications/channels/discord.js +54 -0
- package/dist/notifications/channels/discord.js.map +1 -0
- package/dist/notifications/channels/ntfy.d.ts +13 -0
- package/dist/notifications/channels/ntfy.d.ts.map +1 -0
- package/dist/notifications/channels/ntfy.js +58 -0
- package/dist/notifications/channels/ntfy.js.map +1 -0
- package/dist/notifications/channels/slack.d.ts +10 -0
- package/dist/notifications/channels/slack.d.ts.map +1 -0
- package/dist/notifications/channels/slack.js +55 -0
- package/dist/notifications/channels/slack.js.map +1 -0
- package/dist/notifications/channels/telegram.d.ts +10 -0
- package/dist/notifications/channels/telegram.d.ts.map +1 -0
- package/dist/notifications/channels/telegram.js +40 -0
- package/dist/notifications/channels/telegram.js.map +1 -0
- package/dist/notifications/index.d.ts +9 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +7 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/notification-service.d.ts +75 -0
- package/dist/notifications/notification-service.d.ts.map +1 -0
- package/dist/notifications/notification-service.js +213 -0
- package/dist/notifications/notification-service.js.map +1 -0
- package/dist/notifications/templates/message-templates.d.ts +12 -0
- package/dist/notifications/templates/message-templates.d.ts.map +1 -0
- package/dist/notifications/templates/message-templates.js +22 -0
- package/dist/notifications/templates/message-templates.js.map +1 -0
- package/dist/pipeline/database-policy-engine.d.ts +286 -0
- package/dist/pipeline/database-policy-engine.d.ts.map +1 -0
- package/dist/pipeline/database-policy-engine.js +992 -0
- package/dist/pipeline/database-policy-engine.js.map +1 -0
- package/dist/pipeline/default-policy-engine.d.ts +26 -0
- package/dist/pipeline/default-policy-engine.d.ts.map +1 -0
- package/dist/pipeline/default-policy-engine.js +25 -0
- package/dist/pipeline/default-policy-engine.js.map +1 -0
- package/dist/pipeline/index.d.ts +9 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +9 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/network-resolver.d.ts +22 -0
- package/dist/pipeline/network-resolver.d.ts.map +1 -0
- package/dist/pipeline/network-resolver.js +32 -0
- package/dist/pipeline/network-resolver.js.map +1 -0
- package/dist/pipeline/pipeline.d.ts +72 -0
- package/dist/pipeline/pipeline.d.ts.map +1 -0
- package/dist/pipeline/pipeline.js +87 -0
- package/dist/pipeline/pipeline.js.map +1 -0
- package/dist/pipeline/resolve-effective-amount-usd.d.ts +41 -0
- package/dist/pipeline/resolve-effective-amount-usd.d.ts.map +1 -0
- package/dist/pipeline/resolve-effective-amount-usd.js +208 -0
- package/dist/pipeline/resolve-effective-amount-usd.js.map +1 -0
- package/dist/pipeline/sign-only.d.ts +99 -0
- package/dist/pipeline/sign-only.d.ts.map +1 -0
- package/dist/pipeline/sign-only.js +267 -0
- package/dist/pipeline/sign-only.js.map +1 -0
- package/dist/pipeline/sleep.d.ts +6 -0
- package/dist/pipeline/sleep.d.ts.map +1 -0
- package/dist/pipeline/sleep.js +8 -0
- package/dist/pipeline/sleep.js.map +1 -0
- package/dist/pipeline/stages.d.ts +82 -0
- package/dist/pipeline/stages.d.ts.map +1 -0
- package/dist/pipeline/stages.js +784 -0
- package/dist/pipeline/stages.js.map +1 -0
- package/dist/services/autostop-rules.d.ts +79 -0
- package/dist/services/autostop-rules.d.ts.map +1 -0
- package/dist/services/autostop-rules.js +174 -0
- package/dist/services/autostop-rules.js.map +1 -0
- package/dist/services/autostop-service.d.ts +82 -0
- package/dist/services/autostop-service.d.ts.map +1 -0
- package/dist/services/autostop-service.js +223 -0
- package/dist/services/autostop-service.js.map +1 -0
- package/dist/services/kill-switch-service.d.ts +118 -0
- package/dist/services/kill-switch-service.d.ts.map +1 -0
- package/dist/services/kill-switch-service.js +291 -0
- package/dist/services/kill-switch-service.js.map +1 -0
- package/dist/services/monitoring/balance-monitor-service.d.ts +65 -0
- package/dist/services/monitoring/balance-monitor-service.d.ts.map +1 -0
- package/dist/services/monitoring/balance-monitor-service.js +207 -0
- package/dist/services/monitoring/balance-monitor-service.js.map +1 -0
- package/dist/services/wc-session-service.d.ts +123 -0
- package/dist/services/wc-session-service.d.ts.map +1 -0
- package/dist/services/wc-session-service.js +363 -0
- package/dist/services/wc-session-service.js.map +1 -0
- package/dist/services/wc-signing-bridge.d.ts +60 -0
- package/dist/services/wc-signing-bridge.d.ts.map +1 -0
- package/dist/services/wc-signing-bridge.js +334 -0
- package/dist/services/wc-signing-bridge.js.map +1 -0
- package/dist/services/wc-storage.d.ts +32 -0
- package/dist/services/wc-storage.d.ts.map +1 -0
- package/dist/services/wc-storage.js +64 -0
- package/dist/services/wc-storage.js.map +1 -0
- package/dist/services/x402/payment-signer.d.ts +88 -0
- package/dist/services/x402/payment-signer.d.ts.map +1 -0
- package/dist/services/x402/payment-signer.js +311 -0
- package/dist/services/x402/payment-signer.js.map +1 -0
- package/dist/services/x402/ssrf-guard.d.ts +27 -0
- package/dist/services/x402/ssrf-guard.d.ts.map +1 -0
- package/dist/services/x402/ssrf-guard.js +236 -0
- package/dist/services/x402/ssrf-guard.js.map +1 -0
- package/dist/services/x402/x402-domain-policy.d.ts +50 -0
- package/dist/services/x402/x402-domain-policy.d.ts.map +1 -0
- package/dist/services/x402/x402-domain-policy.js +78 -0
- package/dist/services/x402/x402-domain-policy.js.map +1 -0
- package/dist/services/x402/x402-handler.d.ts +71 -0
- package/dist/services/x402/x402-handler.d.ts.map +1 -0
- package/dist/services/x402/x402-handler.js +195 -0
- package/dist/services/x402/x402-handler.js.map +1 -0
- package/dist/services/x402/x402-usd-resolver.d.ts +26 -0
- package/dist/services/x402/x402-usd-resolver.d.ts.map +1 -0
- package/dist/services/x402/x402-usd-resolver.js +79 -0
- package/dist/services/x402/x402-usd-resolver.js.map +1 -0
- package/dist/workflow/approval-workflow.d.ts +103 -0
- package/dist/workflow/approval-workflow.d.ts.map +1 -0
- package/dist/workflow/approval-workflow.js +202 -0
- package/dist/workflow/approval-workflow.js.map +1 -0
- package/dist/workflow/delay-queue.d.ts +78 -0
- package/dist/workflow/delay-queue.d.ts.map +1 -0
- package/dist/workflow/delay-queue.js +174 -0
- package/dist/workflow/delay-queue.js.map +1 -0
- package/dist/workflow/index.d.ts +11 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +9 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/owner-state.d.ts +97 -0
- package/dist/workflow/owner-state.d.ts.map +1 -0
- package/dist/workflow/owner-state.js +168 -0
- package/dist/workflow/owner-state.js.map +1 -0
- package/package.json +71 -0
- package/public/admin/assets/index-BPoUSH8W.css +1 -0
- package/public/admin/assets/index-CDi1qoXB.js +1 -0
- package/public/admin/index.html +13 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Master auth middleware: verifies X-Master-Password header against Argon2id hash.
|
|
3
|
+
*
|
|
4
|
+
* Protects administrative endpoints (agent creation, policy CRUD).
|
|
5
|
+
* The password is sent as plaintext in the header (localhost-only, secured by hostGuard).
|
|
6
|
+
*
|
|
7
|
+
* Factory pattern: createMasterAuth(deps) returns middleware.
|
|
8
|
+
*
|
|
9
|
+
* @see docs/52-auth-redesign.md
|
|
10
|
+
*/
|
|
11
|
+
import { createMiddleware } from 'hono/factory';
|
|
12
|
+
import argon2 from 'argon2';
|
|
13
|
+
import { WAIaaSError } from '@waiaas/core';
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Middleware factory
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
export function createMasterAuth(deps) {
|
|
18
|
+
return createMiddleware(async (c, next) => {
|
|
19
|
+
const password = c.req.header('X-Master-Password');
|
|
20
|
+
if (!password) {
|
|
21
|
+
throw new WAIaaSError('INVALID_MASTER_PASSWORD', {
|
|
22
|
+
message: 'X-Master-Password header is required',
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
// Verify password against stored Argon2id hash
|
|
26
|
+
const isValid = await argon2.verify(deps.masterPasswordHash, password);
|
|
27
|
+
if (!isValid) {
|
|
28
|
+
throw new WAIaaSError('INVALID_MASTER_PASSWORD', {
|
|
29
|
+
message: 'Invalid master password',
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
await next();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=master-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"master-auth.js","sourceRoot":"","sources":["../../../src/api/middleware/master-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAU3C,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E,MAAM,UAAU,gBAAgB,CAAC,IAAoB;IACnD,OAAO,gBAAgB,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;QACxC,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;QAEnD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,WAAW,CAAC,yBAAyB,EAAE;gBAC/C,OAAO,EAAE,sCAAsC;aAChD,CAAC,CAAC;QACL,CAAC;QAED,+CAA+C;QAC/C,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;QAEvE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,WAAW,CAAC,yBAAyB,EAAE;gBAC/C,OAAO,EAAE,yBAAyB;aACnC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,IAAI,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owner auth middleware: verifies signature from owner wallet.
|
|
3
|
+
*
|
|
4
|
+
* Protects owner-only actions (transaction approval, KS recovery).
|
|
5
|
+
* The owner signs a message with their wallet, and this middleware verifies
|
|
6
|
+
* the signature against the registered owner_address on the agent.
|
|
7
|
+
*
|
|
8
|
+
* Headers required:
|
|
9
|
+
* - X-Owner-Signature: signature (base64 Ed25519 for Solana, 0x hex for EVM)
|
|
10
|
+
* - X-Owner-Message: the signed message (UTF-8 for Solana, EIP-4361 for EVM)
|
|
11
|
+
* - X-Owner-Address: the owner's wallet address (base58 for Solana, 0x for EVM)
|
|
12
|
+
*
|
|
13
|
+
* v1.2: Solana Ed25519.
|
|
14
|
+
* v1.4.1: EVM SIWE (EIP-4361 + EIP-191) via verifySIWE.
|
|
15
|
+
*
|
|
16
|
+
* Chain branching: agent.chain determines verification path:
|
|
17
|
+
* - solana -> Ed25519 detached signature verification (sodium-native)
|
|
18
|
+
* - ethereum -> SIWE (EIP-4361 + EIP-191) verification (viem)
|
|
19
|
+
*
|
|
20
|
+
* Factory pattern: createOwnerAuth(deps) returns middleware.
|
|
21
|
+
*
|
|
22
|
+
* @see docs/52-auth-redesign.md
|
|
23
|
+
*/
|
|
24
|
+
import type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
25
|
+
import type * as schema from '../../infrastructure/database/schema.js';
|
|
26
|
+
export interface OwnerAuthDeps {
|
|
27
|
+
db: BetterSQLite3Database<typeof schema>;
|
|
28
|
+
}
|
|
29
|
+
export declare function createOwnerAuth(deps: OwnerAuthDeps): import("hono").MiddlewareHandler<any, string, {}, Response>;
|
|
30
|
+
//# sourceMappingURL=owner-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owner-auth.d.ts","sourceRoot":"","sources":["../../../src/api/middleware/owner-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,KAAK,KAAK,MAAM,MAAM,yCAAyC,CAAC;AAiBvE,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,qBAAqB,CAAC,OAAO,MAAM,CAAC,CAAC;CAC1C;AAMD,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,+DAsGlD"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owner auth middleware: verifies signature from owner wallet.
|
|
3
|
+
*
|
|
4
|
+
* Protects owner-only actions (transaction approval, KS recovery).
|
|
5
|
+
* The owner signs a message with their wallet, and this middleware verifies
|
|
6
|
+
* the signature against the registered owner_address on the agent.
|
|
7
|
+
*
|
|
8
|
+
* Headers required:
|
|
9
|
+
* - X-Owner-Signature: signature (base64 Ed25519 for Solana, 0x hex for EVM)
|
|
10
|
+
* - X-Owner-Message: the signed message (UTF-8 for Solana, EIP-4361 for EVM)
|
|
11
|
+
* - X-Owner-Address: the owner's wallet address (base58 for Solana, 0x for EVM)
|
|
12
|
+
*
|
|
13
|
+
* v1.2: Solana Ed25519.
|
|
14
|
+
* v1.4.1: EVM SIWE (EIP-4361 + EIP-191) via verifySIWE.
|
|
15
|
+
*
|
|
16
|
+
* Chain branching: agent.chain determines verification path:
|
|
17
|
+
* - solana -> Ed25519 detached signature verification (sodium-native)
|
|
18
|
+
* - ethereum -> SIWE (EIP-4361 + EIP-191) verification (viem)
|
|
19
|
+
*
|
|
20
|
+
* Factory pattern: createOwnerAuth(deps) returns middleware.
|
|
21
|
+
*
|
|
22
|
+
* @see docs/52-auth-redesign.md
|
|
23
|
+
*/
|
|
24
|
+
import { createMiddleware } from 'hono/factory';
|
|
25
|
+
import { createRequire } from 'node:module';
|
|
26
|
+
import { eq } from 'drizzle-orm';
|
|
27
|
+
import { WAIaaSError } from '@waiaas/core';
|
|
28
|
+
import { wallets } from '../../infrastructure/database/schema.js';
|
|
29
|
+
import { verifySIWE } from './siwe-verify.js';
|
|
30
|
+
import { decodeBase58 } from './address-validation.js';
|
|
31
|
+
const require = createRequire(import.meta.url);
|
|
32
|
+
function loadSodium() {
|
|
33
|
+
return require('sodium-native');
|
|
34
|
+
}
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
// Middleware factory
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
export function createOwnerAuth(deps) {
|
|
39
|
+
return createMiddleware(async (c, next) => {
|
|
40
|
+
const signature = c.req.header('X-Owner-Signature');
|
|
41
|
+
const message = c.req.header('X-Owner-Message');
|
|
42
|
+
const ownerAddress = c.req.header('X-Owner-Address');
|
|
43
|
+
if (!signature || !message || !ownerAddress) {
|
|
44
|
+
throw new WAIaaSError('INVALID_SIGNATURE', {
|
|
45
|
+
message: 'X-Owner-Signature, X-Owner-Message, and X-Owner-Address headers are required',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
// Look up wallet to verify owner_address match.
|
|
49
|
+
// Prefer walletId from sessionAuth context (set on /v1/transactions/* routes)
|
|
50
|
+
// over c.req.param('id') which is the TRANSACTION ID on /v1/transactions/:id/*.
|
|
51
|
+
// For direct wallet routes like /v1/wallets/:id/*, c.req.param('id') IS the wallet ID.
|
|
52
|
+
const walletId = c.get('walletId') || c.req.param('id');
|
|
53
|
+
if (!walletId) {
|
|
54
|
+
throw new WAIaaSError('WALLET_NOT_FOUND', {
|
|
55
|
+
message: 'Wallet ID required for owner authentication',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const wallet = deps.db
|
|
59
|
+
.select()
|
|
60
|
+
.from(wallets)
|
|
61
|
+
.where(eq(wallets.id, walletId))
|
|
62
|
+
.get();
|
|
63
|
+
if (!wallet) {
|
|
64
|
+
throw new WAIaaSError('WALLET_NOT_FOUND');
|
|
65
|
+
}
|
|
66
|
+
if (!wallet.ownerAddress) {
|
|
67
|
+
throw new WAIaaSError('OWNER_NOT_CONNECTED', {
|
|
68
|
+
message: 'No owner address registered for this wallet',
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (wallet.ownerAddress !== ownerAddress) {
|
|
72
|
+
throw new WAIaaSError('INVALID_SIGNATURE', {
|
|
73
|
+
message: 'Owner address does not match wallet owner',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
// Branch verification by chain type
|
|
77
|
+
if (wallet.chain === 'ethereum') {
|
|
78
|
+
// EVM SIWE verification (EIP-4361 + EIP-191)
|
|
79
|
+
// For SIWE: X-Owner-Message is base64-encoded EIP-4361 message (multi-line messages
|
|
80
|
+
// cannot be sent as raw HTTP header values), X-Owner-Signature is 0x-prefixed hex
|
|
81
|
+
const decodedMessage = Buffer.from(message, 'base64').toString('utf8');
|
|
82
|
+
const result = await verifySIWE({
|
|
83
|
+
message: decodedMessage,
|
|
84
|
+
signature, // already hex 0x-prefixed from header
|
|
85
|
+
expectedAddress: ownerAddress,
|
|
86
|
+
});
|
|
87
|
+
if (!result.valid) {
|
|
88
|
+
throw new WAIaaSError('INVALID_SIGNATURE', {
|
|
89
|
+
message: result.error ?? 'SIWE signature verification failed',
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// Solana Ed25519 verification (existing logic)
|
|
95
|
+
// X-Owner-Signature is base64-encoded Ed25519 detached signature
|
|
96
|
+
try {
|
|
97
|
+
const sodium = loadSodium();
|
|
98
|
+
const signatureBytes = Buffer.from(signature, 'base64');
|
|
99
|
+
const messageBytes = Buffer.from(message, 'utf8');
|
|
100
|
+
const publicKeyBytes = decodeBase58(ownerAddress);
|
|
101
|
+
// Validate key length
|
|
102
|
+
if (publicKeyBytes.length !== sodium.crypto_sign_PUBLICKEYBYTES) {
|
|
103
|
+
throw new WAIaaSError('INVALID_SIGNATURE', {
|
|
104
|
+
message: `Invalid public key length: expected ${String(sodium.crypto_sign_PUBLICKEYBYTES)}, got ${String(publicKeyBytes.length)}`,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// Validate signature length
|
|
108
|
+
if (signatureBytes.length !== sodium.crypto_sign_BYTES) {
|
|
109
|
+
throw new WAIaaSError('INVALID_SIGNATURE', {
|
|
110
|
+
message: `Invalid signature length: expected ${String(sodium.crypto_sign_BYTES)}, got ${String(signatureBytes.length)}`,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const valid = sodium.crypto_sign_verify_detached(signatureBytes, messageBytes, publicKeyBytes);
|
|
114
|
+
if (!valid) {
|
|
115
|
+
throw new WAIaaSError('INVALID_SIGNATURE', {
|
|
116
|
+
message: 'Ed25519 signature verification failed',
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
if (err instanceof WAIaaSError)
|
|
122
|
+
throw err;
|
|
123
|
+
throw new WAIaaSError('INVALID_SIGNATURE', {
|
|
124
|
+
message: 'Signature verification failed',
|
|
125
|
+
cause: err instanceof Error ? err : undefined,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
c.set('ownerAddress', ownerAddress);
|
|
130
|
+
await next();
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=owner-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owner-auth.js","sourceRoot":"","sources":["../../../src/api/middleware/owner-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIvD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,SAAS,UAAU;IACjB,OAAO,OAAO,CAAC,eAAe,CAAiB,CAAC;AAClD,CAAC;AAUD,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E,MAAM,UAAU,eAAe,CAAC,IAAmB;IACjD,OAAO,gBAAgB,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;QACxC,MAAM,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAChD,MAAM,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAErD,IAAI,CAAC,SAAS,IAAI,CAAC,OAAO,IAAI,CAAC,YAAY,EAAE,C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,CAAC,2BAA2B,CAAC,cAAc,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;gBAC/F,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,MAAM,IAAI,WAAW,CAAC,mBAAmB,EAAE;wBACzC,OAAO,EAAE,uCAAuC;qBACjD,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,WAAW;oBAAE,MAAM,GAAG,CAAC;gBAC1C,MAAM,IAAI,WAAW,CAAC,mBAAmB,EAAE;oBACzC,OAAO,EAAE,+BAA+B;oBACxC,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;iBAC9C,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,CAAC,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QACpC,MAAM,IAAI,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request ID middleware: attaches a UUID v7 to every request.
|
|
3
|
+
*
|
|
4
|
+
* - Generates a new UUID v7 via generateId() for each request
|
|
5
|
+
* - If client sends X-Request-Id header, uses that instead
|
|
6
|
+
* - Sets X-Request-Id response header
|
|
7
|
+
* - Stores requestId in c.set('requestId', id) for downstream use
|
|
8
|
+
*/
|
|
9
|
+
export declare const requestId: import("hono").MiddlewareHandler<any, string, {}, Response>;
|
|
10
|
+
//# sourceMappingURL=request-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-id.d.ts","sourceRoot":"","sources":["../../../src/api/middleware/request-id.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,eAAO,MAAM,SAAS,6DAQpB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request ID middleware: attaches a UUID v7 to every request.
|
|
3
|
+
*
|
|
4
|
+
* - Generates a new UUID v7 via generateId() for each request
|
|
5
|
+
* - If client sends X-Request-Id header, uses that instead
|
|
6
|
+
* - Sets X-Request-Id response header
|
|
7
|
+
* - Stores requestId in c.set('requestId', id) for downstream use
|
|
8
|
+
*/
|
|
9
|
+
import { createMiddleware } from 'hono/factory';
|
|
10
|
+
import { generateId } from '../../infrastructure/database/id.js';
|
|
11
|
+
export const requestId = createMiddleware(async (c, next) => {
|
|
12
|
+
const clientId = c.req.header('X-Request-Id');
|
|
13
|
+
const id = clientId || generateId();
|
|
14
|
+
c.set('requestId', id);
|
|
15
|
+
c.header('X-Request-Id', id);
|
|
16
|
+
await next();
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=request-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-id.js","sourceRoot":"","sources":["../../../src/api/middleware/request-id.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;IAC1D,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC9C,MAAM,EAAE,GAAG,QAAQ,IAAI,UAAU,EAAE,CAAC;IAEpC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACvB,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IAE7B,MAAM,IAAI,EAAE,CAAC;AACf,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request logger middleware: logs method, path, status, and duration.
|
|
3
|
+
*
|
|
4
|
+
* Format: [REQ] GET /health 200 12ms
|
|
5
|
+
*
|
|
6
|
+
* Uses console.log for now; structured logger deferred to later milestone.
|
|
7
|
+
*/
|
|
8
|
+
export declare const requestLogger: import("hono").MiddlewareHandler<any, string, {}, Response>;
|
|
9
|
+
//# sourceMappingURL=request-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-logger.d.ts","sourceRoot":"","sources":["../../../src/api/middleware/request-logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,eAAO,MAAM,aAAa,6DAWxB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request logger middleware: logs method, path, status, and duration.
|
|
3
|
+
*
|
|
4
|
+
* Format: [REQ] GET /health 200 12ms
|
|
5
|
+
*
|
|
6
|
+
* Uses console.log for now; structured logger deferred to later milestone.
|
|
7
|
+
*/
|
|
8
|
+
import { createMiddleware } from 'hono/factory';
|
|
9
|
+
export const requestLogger = createMiddleware(async (c, next) => {
|
|
10
|
+
const start = Date.now();
|
|
11
|
+
await next();
|
|
12
|
+
const duration = Date.now() - start;
|
|
13
|
+
const method = c.req.method;
|
|
14
|
+
const path = c.req.path;
|
|
15
|
+
const status = c.res.status;
|
|
16
|
+
console.log(`[REQ] ${method} ${path} ${status} ${duration}ms`);
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=request-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-logger.js","sourceRoot":"","sources":["../../../src/api/middleware/request-logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;IAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEzB,MAAM,IAAI,EAAE,CAAC;IAEb,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IAC5B,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACxB,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC,SAAS,MAAM,IAAI,IAAI,IAAI,MAAM,IAAI,QAAQ,IAAI,CAAC,CAAC;AACjE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session auth middleware: validates wai_sess_ Bearer tokens, checks DB session, sets context.
|
|
3
|
+
*
|
|
4
|
+
* Validates Authorization header format (Bearer wai_sess_...),
|
|
5
|
+
* verifies JWT via JwtSecretManager (supports dual-key rotation),
|
|
6
|
+
* checks session existence and revocation in SQLite,
|
|
7
|
+
* and sets sessionId/walletId on Hono context.
|
|
8
|
+
*
|
|
9
|
+
* Factory pattern: createSessionAuth(deps) returns middleware.
|
|
10
|
+
*
|
|
11
|
+
* @see docs/52-auth-redesign.md
|
|
12
|
+
*/
|
|
13
|
+
import type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
14
|
+
import type { JwtSecretManager } from '../../infrastructure/jwt/index.js';
|
|
15
|
+
import type * as schema from '../../infrastructure/database/schema.js';
|
|
16
|
+
export interface SessionAuthDeps {
|
|
17
|
+
jwtSecretManager: JwtSecretManager;
|
|
18
|
+
db: BetterSQLite3Database<typeof schema>;
|
|
19
|
+
}
|
|
20
|
+
export declare function createSessionAuth(deps: SessionAuthDeps): import("hono").MiddlewareHandler<any, string, {}, Response>;
|
|
21
|
+
//# sourceMappingURL=session-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-auth.d.ts","sourceRoot":"","sources":["../../../src/api/middleware/session-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,KAAK,MAAM,MAAM,yCAAyC,CAAC;AAOvE,MAAM,WAAW,eAAe;IAC9B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,EAAE,EAAE,qBAAqB,CAAC,OAAO,MAAM,CAAC,CAAC;CAC1C;AAMD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,+DAoCtD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session auth middleware: validates wai_sess_ Bearer tokens, checks DB session, sets context.
|
|
3
|
+
*
|
|
4
|
+
* Validates Authorization header format (Bearer wai_sess_...),
|
|
5
|
+
* verifies JWT via JwtSecretManager (supports dual-key rotation),
|
|
6
|
+
* checks session existence and revocation in SQLite,
|
|
7
|
+
* and sets sessionId/walletId on Hono context.
|
|
8
|
+
*
|
|
9
|
+
* Factory pattern: createSessionAuth(deps) returns middleware.
|
|
10
|
+
*
|
|
11
|
+
* @see docs/52-auth-redesign.md
|
|
12
|
+
*/
|
|
13
|
+
import { createMiddleware } from 'hono/factory';
|
|
14
|
+
import { eq } from 'drizzle-orm';
|
|
15
|
+
import { WAIaaSError } from '@waiaas/core';
|
|
16
|
+
import { sessions } from '../../infrastructure/database/schema.js';
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Middleware factory
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
export function createSessionAuth(deps) {
|
|
21
|
+
return createMiddleware(async (c, next) => {
|
|
22
|
+
// 1. Extract Authorization header
|
|
23
|
+
const authHeader = c.req.header('Authorization');
|
|
24
|
+
if (!authHeader || !authHeader.startsWith('Bearer wai_sess_')) {
|
|
25
|
+
throw new WAIaaSError('INVALID_TOKEN', {
|
|
26
|
+
message: 'Missing or invalid Authorization header. Expected: Bearer wai_sess_<token>',
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
// 2. Extract the full token (including wai_sess_ prefix)
|
|
30
|
+
const token = authHeader.slice('Bearer '.length);
|
|
31
|
+
// 3. Verify JWT via JwtSecretManager (handles dual-key rotation)
|
|
32
|
+
const payload = await deps.jwtSecretManager.verifyToken(token);
|
|
33
|
+
// 4. Check session in DB (exists, not revoked)
|
|
34
|
+
const session = deps.db
|
|
35
|
+
.select()
|
|
36
|
+
.from(sessions)
|
|
37
|
+
.where(eq(sessions.id, payload.sub))
|
|
38
|
+
.get();
|
|
39
|
+
if (!session) {
|
|
40
|
+
throw new WAIaaSError('SESSION_NOT_FOUND');
|
|
41
|
+
}
|
|
42
|
+
if (session.revokedAt !== null) {
|
|
43
|
+
throw new WAIaaSError('SESSION_REVOKED');
|
|
44
|
+
}
|
|
45
|
+
// 5. Set context variables
|
|
46
|
+
c.set('sessionId', payload.sub);
|
|
47
|
+
c.set('walletId', payload.wlt);
|
|
48
|
+
await next();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=session-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-auth.js","sourceRoot":"","sources":["../../../src/api/middleware/session-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAWnE,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACrD,OAAO,gBAAgB,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;QACxC,kCAAkC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
* Verifies that:
|
|
5
|
+
* 1. The message is a valid EIP-4361 SIWE message (parseable, not expired, not before notBefore)
|
|
6
|
+
* 2. The EIP-191 personal_sign signature matches the expectedAddress
|
|
7
|
+
*
|
|
8
|
+
* Per design decision [v1.4.1]: nonce is NOT validated server-side
|
|
9
|
+
* (consistency with Solana owner-auth which has no server-side nonce check;
|
|
10
|
+
* security relies on expirationTime).
|
|
11
|
+
*
|
|
12
|
+
* @see docs/52-auth-redesign.md
|
|
13
|
+
* @see docs/28-daemon.md (owner-auth SIWE)
|
|
14
|
+
*/
|
|
15
|
+
export interface VerifySIWEParams {
|
|
16
|
+
/** EIP-4361 formatted message string */
|
|
17
|
+
message: string;
|
|
18
|
+
/** Hex-encoded 0x-prefixed EIP-191 signature */
|
|
19
|
+
signature: string;
|
|
20
|
+
/** 0x EIP-55 checksum address to match */
|
|
21
|
+
expectedAddress: string;
|
|
22
|
+
}
|
|
23
|
+
export interface VerifySIWEResult {
|
|
24
|
+
valid: boolean;
|
|
25
|
+
/** Recovered address on success */
|
|
26
|
+
address?: string;
|
|
27
|
+
/** Reason on failure */
|
|
28
|
+
error?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function verifySIWE(params: VerifySIWEParams): Promise<VerifySIWEResult>;
|
|
31
|
+
//# sourceMappingURL=siwe-verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"siwe-verify.d.ts","sourceRoot":"","sources":["../../../src/api/middleware/siwe-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AASH,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAsB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuCpF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* verifySIWE: Pure function for SIWE (EIP-4361) message verification.
|
|
3
|
+
*
|
|
4
|
+
* Verifies that:
|
|
5
|
+
* 1. The message is a valid EIP-4361 SIWE message (parseable, not expired, not before notBefore)
|
|
6
|
+
* 2. The EIP-191 personal_sign signature matches the expectedAddress
|
|
7
|
+
*
|
|
8
|
+
* Per design decision [v1.4.1]: nonce is NOT validated server-side
|
|
9
|
+
* (consistency with Solana owner-auth which has no server-side nonce check;
|
|
10
|
+
* security relies on expirationTime).
|
|
11
|
+
*
|
|
12
|
+
* @see docs/52-auth-redesign.md
|
|
13
|
+
* @see docs/28-daemon.md (owner-auth SIWE)
|
|
14
|
+
*/
|
|
15
|
+
import { parseSiweMessage, validateSiweMessage } from 'viem/siwe';
|
|
16
|
+
import { verifyMessage } from 'viem';
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Implementation
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
export async function verifySIWE(params) {
|
|
21
|
+
try {
|
|
22
|
+
// Step 1: Parse the EIP-4361 message
|
|
23
|
+
const parsed = parseSiweMessage(params.message);
|
|
24
|
+
// Step 2: Validate structural fields (expirationTime, notBefore, etc.)
|
|
25
|
+
// Per [v1.4.1] decision: skip nonce validation (no server-side nonce check)
|
|
26
|
+
const validation = await validateSiweMessage({ message: parsed });
|
|
27
|
+
if (!validation) {
|
|
28
|
+
// Check for specific expiration case
|
|
29
|
+
if (parsed.expirationTime && new Date(parsed.expirationTime) < new Date()) {
|
|
30
|
+
return { valid: false, error: 'SIWE message expired' };
|
|
31
|
+
}
|
|
32
|
+
return { valid: false, error: 'SIWE message validation failed' };
|
|
33
|
+
}
|
|
34
|
+
// Step 3: Verify EIP-191 personal_sign signature
|
|
35
|
+
const isValid = await verifyMessage({
|
|
36
|
+
address: params.expectedAddress,
|
|
37
|
+
message: params.message,
|
|
38
|
+
signature: params.signature,
|
|
39
|
+
});
|
|
40
|
+
if (!isValid) {
|
|
41
|
+
return { valid: false, error: 'EIP-191 signature verification failed' };
|
|
42
|
+
}
|
|
43
|
+
return { valid: true, address: params.expectedAddress };
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
// Parse errors, invalid message format, corrupted signatures, etc.
|
|
47
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
48
|
+
// Surface expiration-related errors clearly
|
|
49
|
+
if (errorMessage.toLowerCase().includes('expir')) {
|
|
50
|
+
return { valid: false, error: `SIWE message expired: ${errorMessage}` };
|
|
51
|
+
}
|
|
52
|
+
return { valid: false, error: `SIWE verification failed: ${errorMessage}` };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=siwe-verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"siwe-verify.js","sourceRoot":"","sources":["../../../src/api/middleware/siwe-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAuBrC,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAwB;IACvD,IAAI,CAAC;QACH,qCAAqC;QACrC,MAAM,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEhD,uEAAuE;QACvE,4EAA4E;QAC5E,MAAM,UAAU,GAAG,MAAM,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QAClE,IAAI,CAAC,UAAU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|
+
/**
|
|
2
|
+
* Action routes: POST /v1/actions/:provider/:action, GET /v1/actions/providers.
|
|
3
|
+
*
|
|
4
|
+
* POST /v1/actions/:provider/:action:
|
|
5
|
+
* - Requires sessionAuth (applied at server level in createApp())
|
|
6
|
+
* - Resolves action parameters via ActionProviderRegistry.executeResolve()
|
|
7
|
+
* - Injects the resulting ContractCallRequest into the existing 6-stage pipeline
|
|
8
|
+
* - Returns 201 with txId (same pattern as POST /v1/transactions/send)
|
|
9
|
+
*
|
|
10
|
+
* GET /v1/actions/providers:
|
|
11
|
+
* - Requires sessionAuth
|
|
12
|
+
* - Lists registered action providers with their actions and API key status
|
|
13
|
+
*
|
|
14
|
+
* @see docs/62-action-provider-architecture.md
|
|
15
|
+
*/
|
|
16
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
17
|
+
import type { IPolicyEngine } from '@waiaas/core';
|
|
18
|
+
import type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
19
|
+
import type { Database as SQLiteDatabase } from 'better-sqlite3';
|
|
20
|
+
import type { ActionProviderRegistry } from '../../infrastructure/action/action-provider-registry.js';
|
|
21
|
+
import type { ApiKeyStore } from '../../infrastructure/action/api-key-store.js';
|
|
22
|
+
import type { AdapterPool } from '../../infrastructure/adapter-pool.js';
|
|
23
|
+
import type { DaemonConfig } from '../../infrastructure/config/loader.js';
|
|
24
|
+
import type { LocalKeyStore } from '../../infrastructure/keystore/keystore.js';
|
|
25
|
+
import type * as schema from '../../infrastructure/database/schema.js';
|
|
26
|
+
import type { ApprovalWorkflow } from '../../workflow/approval-workflow.js';
|
|
27
|
+
import type { DelayQueue } from '../../workflow/delay-queue.js';
|
|
28
|
+
import type { OwnerLifecycleService } from '../../workflow/owner-state.js';
|
|
29
|
+
import type { NotificationService } from '../../notifications/notification-service.js';
|
|
30
|
+
import type { IPriceOracle } from '@waiaas/core';
|
|
31
|
+
import type { SettingsService } from '../../infrastructure/settings/settings-service.js';
|
|
32
|
+
export interface ActionRouteDeps {
|
|
33
|
+
registry: ActionProviderRegistry;
|
|
34
|
+
apiKeyStore: ApiKeyStore;
|
|
35
|
+
db: BetterSQLite3Database<typeof schema>;
|
|
36
|
+
adapterPool: AdapterPool;
|
|
37
|
+
config: DaemonConfig;
|
|
38
|
+
keyStore: LocalKeyStore;
|
|
39
|
+
policyEngine: IPolicyEngine;
|
|
40
|
+
masterPassword: string;
|
|
41
|
+
approvalWorkflow?: ApprovalWorkflow;
|
|
42
|
+
delayQueue?: DelayQueue;
|
|
43
|
+
ownerLifecycle?: OwnerLifecycleService;
|
|
44
|
+
sqlite?: SQLiteDatabase;
|
|
45
|
+
notificationService?: NotificationService;
|
|
46
|
+
priceOracle?: IPriceOracle;
|
|
47
|
+
settingsService?: SettingsService;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create action route sub-router.
|
|
51
|
+
*
|
|
52
|
+
* GET /actions/providers -> list registered providers + actions
|
|
53
|
+
* POST /actions/:provider/:action -> resolve + pipeline execution
|
|
54
|
+
*/
|
|
55
|
+
export declare function actionRoutes(deps: ActionRouteDeps): OpenAPIHono;
|
|
56
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/api/routes/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAGhE,OAAO,KAAK,EAA2C,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yDAAyD,CAAC;AACtG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,K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