@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,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AES-256-GCM encryption/decryption with Argon2id key derivation.
|
|
3
|
+
*
|
|
4
|
+
* Design reference: 26-keystore-spec.md sections 2-3.
|
|
5
|
+
* - Argon2id: m=65536 (64 MiB), t=3, p=4, hashLength=32
|
|
6
|
+
* - AES-256-GCM: 12-byte IV, 16-byte authTag
|
|
7
|
+
* - Salt: 16-byte CSPRNG
|
|
8
|
+
*/
|
|
9
|
+
/** KDF parameters matching doc 26 specification. */
|
|
10
|
+
export declare const KDF_PARAMS: {
|
|
11
|
+
readonly memoryCost: 65536;
|
|
12
|
+
readonly timeCost: 3;
|
|
13
|
+
readonly parallelism: 4;
|
|
14
|
+
readonly hashLength: 32;
|
|
15
|
+
};
|
|
16
|
+
/** Encrypted data structure for keystore JSON serialization. */
|
|
17
|
+
export interface EncryptedData {
|
|
18
|
+
/** 12-byte AES-GCM nonce */
|
|
19
|
+
iv: Buffer;
|
|
20
|
+
/** Encrypted ciphertext (same length as plaintext for GCM stream cipher) */
|
|
21
|
+
ciphertext: Buffer;
|
|
22
|
+
/** 16-byte GCM authentication tag */
|
|
23
|
+
authTag: Buffer;
|
|
24
|
+
/** 16-byte CSPRNG salt for Argon2id */
|
|
25
|
+
salt: Buffer;
|
|
26
|
+
/** KDF parameters for self-describing keystore files */
|
|
27
|
+
kdfparams: {
|
|
28
|
+
memoryCost: number;
|
|
29
|
+
timeCost: number;
|
|
30
|
+
parallelism: number;
|
|
31
|
+
hashLength: number;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Derive a 32-byte AES-256 key from a password using Argon2id.
|
|
36
|
+
*
|
|
37
|
+
* @param password - Master password
|
|
38
|
+
* @param salt - Optional 16-byte salt. If not provided, generates a new CSPRNG salt.
|
|
39
|
+
* @returns 32-byte derived key and the salt used
|
|
40
|
+
*/
|
|
41
|
+
export declare function deriveKey(password: string, salt?: Buffer): Promise<{
|
|
42
|
+
key: Buffer;
|
|
43
|
+
salt: Buffer;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Encrypt plaintext with AES-256-GCM using an Argon2id-derived key.
|
|
47
|
+
*
|
|
48
|
+
* @param plaintext - Data to encrypt (e.g., private key bytes)
|
|
49
|
+
* @param password - Master password for key derivation
|
|
50
|
+
* @returns Encrypted data with all parameters needed for decryption
|
|
51
|
+
*/
|
|
52
|
+
export declare function encrypt(plaintext: Buffer, password: string): Promise<EncryptedData>;
|
|
53
|
+
/**
|
|
54
|
+
* Decrypt AES-256-GCM ciphertext using an Argon2id-derived key.
|
|
55
|
+
*
|
|
56
|
+
* @param encrypted - Encrypted data with IV, authTag, salt, and KDF params
|
|
57
|
+
* @param password - Master password for key derivation
|
|
58
|
+
* @returns Decrypted plaintext buffer
|
|
59
|
+
* @throws WAIaaSError with INVALID_MASTER_PASSWORD if authTag verification fails
|
|
60
|
+
*/
|
|
61
|
+
export declare function decrypt(encrypted: EncryptedData, password: string): Promise<Buffer>;
|
|
62
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/keystore/crypto.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,oDAAoD;AACpD,eAAO,MAAM,UAAU;;;;;CAKb,CAAC;AAEX,gEAAgE;AAChE,MAAM,WAAW,aAAa;IAC5B,4BAA4B;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,SAAS,EAAE;QACT,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAcxC;AAED;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAkBzF;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBzF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AES-256-GCM encryption/decryption with Argon2id key derivation.
|
|
3
|
+
*
|
|
4
|
+
* Design reference: 26-keystore-spec.md sections 2-3.
|
|
5
|
+
* - Argon2id: m=65536 (64 MiB), t=3, p=4, hashLength=32
|
|
6
|
+
* - AES-256-GCM: 12-byte IV, 16-byte authTag
|
|
7
|
+
* - Salt: 16-byte CSPRNG
|
|
8
|
+
*/
|
|
9
|
+
import { randomBytes, createCipheriv, createDecipheriv } from 'node:crypto';
|
|
10
|
+
import argon2 from 'argon2';
|
|
11
|
+
import { WAIaaSError } from '@waiaas/core';
|
|
12
|
+
/** KDF parameters matching doc 26 specification. */
|
|
13
|
+
export const KDF_PARAMS = {
|
|
14
|
+
memoryCost: 65536, // 64 MiB
|
|
15
|
+
timeCost: 3,
|
|
16
|
+
parallelism: 4,
|
|
17
|
+
hashLength: 32,
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Derive a 32-byte AES-256 key from a password using Argon2id.
|
|
21
|
+
*
|
|
22
|
+
* @param password - Master password
|
|
23
|
+
* @param salt - Optional 16-byte salt. If not provided, generates a new CSPRNG salt.
|
|
24
|
+
* @returns 32-byte derived key and the salt used
|
|
25
|
+
*/
|
|
26
|
+
export async function deriveKey(password, salt) {
|
|
27
|
+
const actualSalt = salt ?? randomBytes(16);
|
|
28
|
+
const rawHash = await argon2.hash(password, {
|
|
29
|
+
type: argon2.argon2id,
|
|
30
|
+
memoryCost: KDF_PARAMS.memoryCost,
|
|
31
|
+
timeCost: KDF_PARAMS.timeCost,
|
|
32
|
+
parallelism: KDF_PARAMS.parallelism,
|
|
33
|
+
hashLength: KDF_PARAMS.hashLength,
|
|
34
|
+
salt: actualSalt,
|
|
35
|
+
raw: true,
|
|
36
|
+
});
|
|
37
|
+
return { key: Buffer.from(rawHash), salt: actualSalt };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Encrypt plaintext with AES-256-GCM using an Argon2id-derived key.
|
|
41
|
+
*
|
|
42
|
+
* @param plaintext - Data to encrypt (e.g., private key bytes)
|
|
43
|
+
* @param password - Master password for key derivation
|
|
44
|
+
* @returns Encrypted data with all parameters needed for decryption
|
|
45
|
+
*/
|
|
46
|
+
export async function encrypt(plaintext, password) {
|
|
47
|
+
const iv = randomBytes(12); // GCM 96-bit nonce
|
|
48
|
+
const { key, salt } = await deriveKey(password);
|
|
49
|
+
const cipher = createCipheriv('aes-256-gcm', key, iv);
|
|
50
|
+
const ciphertext = Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
|
51
|
+
const authTag = cipher.getAuthTag();
|
|
52
|
+
// Zero the derived key from memory
|
|
53
|
+
key.fill(0);
|
|
54
|
+
return {
|
|
55
|
+
iv,
|
|
56
|
+
ciphertext,
|
|
57
|
+
authTag,
|
|
58
|
+
salt,
|
|
59
|
+
kdfparams: { ...KDF_PARAMS },
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Decrypt AES-256-GCM ciphertext using an Argon2id-derived key.
|
|
64
|
+
*
|
|
65
|
+
* @param encrypted - Encrypted data with IV, authTag, salt, and KDF params
|
|
66
|
+
* @param password - Master password for key derivation
|
|
67
|
+
* @returns Decrypted plaintext buffer
|
|
68
|
+
* @throws WAIaaSError with INVALID_MASTER_PASSWORD if authTag verification fails
|
|
69
|
+
*/
|
|
70
|
+
export async function decrypt(encrypted, password) {
|
|
71
|
+
const { key } = await deriveKey(password, encrypted.salt);
|
|
72
|
+
try {
|
|
73
|
+
const decipher = createDecipheriv('aes-256-gcm', key, encrypted.iv);
|
|
74
|
+
decipher.setAuthTag(encrypted.authTag);
|
|
75
|
+
const plaintext = Buffer.concat([decipher.update(encrypted.ciphertext), decipher.final()]);
|
|
76
|
+
return plaintext;
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
throw new WAIaaSError('INVALID_MASTER_PASSWORD', {
|
|
80
|
+
message: 'Decryption failed: wrong password or corrupted data (GCM authTag mismatch)',
|
|
81
|
+
cause: error instanceof Error ? error : undefined,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
// Zero the derived key from memory
|
|
86
|
+
key.fill(0);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=crypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../../src/infrastructure/keystore/crypto.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,oDAAoD;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU,EAAE,KAAK,EAAE,SAAS;IAC5B,QAAQ,EAAE,CAAC;IACX,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,EAAE;CACN,CAAC;AAqBX;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,QAAgB,EAChB,IAAa;IAEb,MAAM,UAAU,GAAG,IAAI,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC;IAE3C,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE;QAC1C,IAAI,EAAE,MAAM,CAAC,QAAQ;QACrB,UAA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,gBAAgB,CAAC,aAAa,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;QACpE,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC3F,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,WAAW,CAAC,yBAAyB,EAAE;YAC/C,OAAO,EAAE,4EAA4E;YACrF,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;SAClD,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,mCAAmC;QACnC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { deriveKey, encrypt, decrypt, KDF_PARAMS, type EncryptedData } from './crypto.js';
|
|
2
|
+
export { allocateGuarded, writeToGuarded, zeroAndRelease, isAvailable } from './memory.js';
|
|
3
|
+
export { LocalKeyStore, type KeystoreFileV1 } from './keystore.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/keystore/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Keystore module - AES-256-GCM encryption with Argon2id KDF and sodium guarded memory
|
|
2
|
+
export { deriveKey, encrypt, decrypt, KDF_PARAMS } from './crypto.js';
|
|
3
|
+
export { allocateGuarded, writeToGuarded, zeroAndRelease, isAvailable } from './memory.js';
|
|
4
|
+
export { LocalKeyStore } from './keystore.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/keystore/index.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAuB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocalKeyStore - encrypted keystore with guarded memory.
|
|
3
|
+
*
|
|
4
|
+
* Implements ILocalKeyStore from @waiaas/core.
|
|
5
|
+
* Design reference: 26-keystore-spec.md.
|
|
6
|
+
*
|
|
7
|
+
* - Generates Ed25519 key pairs (Solana) using sodium-native
|
|
8
|
+
* - Generates secp256k1 key pairs (EVM) using crypto.randomBytes + viem
|
|
9
|
+
* - Encrypts private keys with AES-256-GCM + Argon2id KDF
|
|
10
|
+
* - Stores as per-wallet JSON keystore files (format v1)
|
|
11
|
+
* - Protects decrypted keys in sodium guarded memory
|
|
12
|
+
* - Atomic file writes (write-then-rename pattern)
|
|
13
|
+
*/
|
|
14
|
+
import type { ILocalKeyStore, ChainType } from '@waiaas/core';
|
|
15
|
+
/** Keystore file format v1 JSON structure. */
|
|
16
|
+
export interface KeystoreFileV1 {
|
|
17
|
+
version: 1;
|
|
18
|
+
id: string;
|
|
19
|
+
chain: string;
|
|
20
|
+
network: string;
|
|
21
|
+
/** Cryptographic curve. Defaults to 'ed25519' for backward compat with pre-v1.4.1 files. */
|
|
22
|
+
curve: 'ed25519' | 'secp256k1';
|
|
23
|
+
publicKey: string;
|
|
24
|
+
crypto: {
|
|
25
|
+
cipher: 'aes-256-gcm';
|
|
26
|
+
cipherparams: {
|
|
27
|
+
iv: string;
|
|
28
|
+
};
|
|
29
|
+
ciphertext: string;
|
|
30
|
+
authTag: string;
|
|
31
|
+
kdf: 'argon2id';
|
|
32
|
+
kdfparams: {
|
|
33
|
+
salt: string;
|
|
34
|
+
memoryCost: number;
|
|
35
|
+
timeCost: number;
|
|
36
|
+
parallelism: number;
|
|
37
|
+
hashLength: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
metadata: {
|
|
41
|
+
name: string;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
lastUnlockedAt: string | null;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Local keystore implementation with AES-256-GCM encryption,
|
|
48
|
+
* Argon2id KDF, and sodium guarded memory protection.
|
|
49
|
+
*/
|
|
50
|
+
export declare class LocalKeyStore implements ILocalKeyStore {
|
|
51
|
+
private readonly keystoreDir;
|
|
52
|
+
/** Map from guarded buffer identity to walletId for tracking */
|
|
53
|
+
private readonly guardedKeys;
|
|
54
|
+
constructor(keystoreDir: string);
|
|
55
|
+
/**
|
|
56
|
+
* Generate a key pair for the given chain and store encrypted with master password.
|
|
57
|
+
*
|
|
58
|
+
* For Solana: generates Ed25519 keypair via sodium crypto_sign_keypair.
|
|
59
|
+
* The full 64-byte secret key (seed + public) is encrypted.
|
|
60
|
+
*
|
|
61
|
+
* For Ethereum (EVM): generates secp256k1 private key via crypto.randomBytes(32).
|
|
62
|
+
* Derives EIP-55 checksum address using viem privateKeyToAccount.
|
|
63
|
+
* The 32-byte private key is encrypted.
|
|
64
|
+
*
|
|
65
|
+
* @returns publicKey (base58 for Solana, 0x EIP-55 for EVM) and encrypted private key bytes
|
|
66
|
+
*/
|
|
67
|
+
generateKeyPair(walletId: string, chain: ChainType, network: string, masterPassword: string): Promise<{
|
|
68
|
+
publicKey: string;
|
|
69
|
+
encryptedPrivateKey: Uint8Array;
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Generate an Ed25519 keypair for Solana using sodium-native.
|
|
73
|
+
*/
|
|
74
|
+
private generateEd25519KeyPair;
|
|
75
|
+
/**
|
|
76
|
+
* Generate a secp256k1 keypair for EVM chains.
|
|
77
|
+
* Uses crypto.randomBytes(32) for CSPRNG entropy and viem for EIP-55 address derivation.
|
|
78
|
+
*/
|
|
79
|
+
private generateSecp256k1KeyPair;
|
|
80
|
+
/**
|
|
81
|
+
* Decrypt private key from keystore file and store in guarded memory.
|
|
82
|
+
*
|
|
83
|
+
* @returns Guarded buffer containing the decrypted private key (readonly)
|
|
84
|
+
*/
|
|
85
|
+
decryptPrivateKey(walletId: string, masterPassword: string): Promise<Uint8Array>;
|
|
86
|
+
/**
|
|
87
|
+
* Release a decrypted key from guarded memory (zero-fill).
|
|
88
|
+
*/
|
|
89
|
+
releaseKey(key: Uint8Array): void;
|
|
90
|
+
/**
|
|
91
|
+
* Check if a keystore file exists for the given wallet.
|
|
92
|
+
*/
|
|
93
|
+
hasKey(walletId: string): Promise<boolean>;
|
|
94
|
+
/**
|
|
95
|
+
* Delete keystore file and release any loaded key from memory.
|
|
96
|
+
*/
|
|
97
|
+
deleteKey(walletId: string): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Lock all keys -- zero and release all guarded buffers.
|
|
100
|
+
* Called during daemon shutdown.
|
|
101
|
+
*/
|
|
102
|
+
lockAll(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Check if sodium-native guarded memory is available.
|
|
105
|
+
*/
|
|
106
|
+
get sodiumAvailable(): boolean;
|
|
107
|
+
private keystorePath;
|
|
108
|
+
/**
|
|
109
|
+
* Write keystore file atomically using write-then-rename pattern.
|
|
110
|
+
* Sets file permission to 0600 (owner read/write only).
|
|
111
|
+
*/
|
|
112
|
+
private writeKeystoreFile;
|
|
113
|
+
private readKeystoreFile;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=keystore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keystore.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/keystore/keystore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAc9D,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,CAAC,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,4FAA4F;IAC5F,KAAK,EAAE,SAAS,GAAG,WAAW,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE;QACN,MAAM,EAAE,aAAa,CAAC;QACtB,YAAY,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;QAC7B,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,UAAU,CAAC;QAChB,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,CAAC;YACb,UAAU,EAAE,MAAM,CAAC;YACnB,QAAQ,EAAE,MAAM,CAAC;YACjB,WAAW,EAAE,MAAM,CAAC;YACpB,UAAU,EAAE,MAAM,CAAC;SACpB,CAAC;KACH,CAAC;IACF,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,CAAC;CACH;AAED;;;GAGG;AACH,qBAAa,aAAc,YAAW,cAAc;IAClD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,gEAAgE;IAChE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkC;gBAElD,WAAW,EAAE,MAAM;IAI/B;;;;;;;;;;;OAWG;IACG,eAAe,CACnB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,mBAAmB,EAAE,UAAU,CAAA;KAAE,CAAC;IAclE;;OAEG;YACW,sBAAsB;IAwDpC;;;OAGG;YACW,wBAAwB;IAwDtC;;;;OAIG;IACG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IA8BtF;;OAEG;IACH,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI;IAiBjC;;OAEG;IACG,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAShD;;OAEG;IACG,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBhD;;;OAGG;IACH,OAAO,IAAI,IAAI;IAOf;;OAEG;IACH,IAAI,eAAe,IAAI,OAAO,CAE7B;IAID,OAAO,CAAC,YAAY;IAIpB;;;OAGG;YACW,iBAAiB;YASjB,gBAAgB;CA4B/B"}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocalKeyStore - encrypted keystore with guarded memory.
|
|
3
|
+
*
|
|
4
|
+
* Implements ILocalKeyStore from @waiaas/core.
|
|
5
|
+
* Design reference: 26-keystore-spec.md.
|
|
6
|
+
*
|
|
7
|
+
* - Generates Ed25519 key pairs (Solana) using sodium-native
|
|
8
|
+
* - Generates secp256k1 key pairs (EVM) using crypto.randomBytes + viem
|
|
9
|
+
* - Encrypts private keys with AES-256-GCM + Argon2id KDF
|
|
10
|
+
* - Stores as per-wallet JSON keystore files (format v1)
|
|
11
|
+
* - Protects decrypted keys in sodium guarded memory
|
|
12
|
+
* - Atomic file writes (write-then-rename pattern)
|
|
13
|
+
*/
|
|
14
|
+
import { randomBytes, randomUUID } from 'node:crypto';
|
|
15
|
+
import { writeFile, readFile, unlink, stat, rename } from 'node:fs/promises';
|
|
16
|
+
import { createRequire } from 'node:module';
|
|
17
|
+
import { join, dirname } from 'node:path';
|
|
18
|
+
import { WAIaaSError } from '@waiaas/core';
|
|
19
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
20
|
+
import { encrypt, decrypt, KDF_PARAMS } from './crypto.js';
|
|
21
|
+
import { allocateGuarded, writeToGuarded, zeroAndRelease, isAvailable } from './memory.js';
|
|
22
|
+
const require = createRequire(import.meta.url);
|
|
23
|
+
function loadSodium() {
|
|
24
|
+
return require('sodium-native');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Local keystore implementation with AES-256-GCM encryption,
|
|
28
|
+
* Argon2id KDF, and sodium guarded memory protection.
|
|
29
|
+
*/
|
|
30
|
+
export class LocalKeyStore {
|
|
31
|
+
keystoreDir;
|
|
32
|
+
/** Map from guarded buffer identity to walletId for tracking */
|
|
33
|
+
guardedKeys = new Map();
|
|
34
|
+
constructor(keystoreDir) {
|
|
35
|
+
this.keystoreDir = keystoreDir;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Generate a key pair for the given chain and store encrypted with master password.
|
|
39
|
+
*
|
|
40
|
+
* For Solana: generates Ed25519 keypair via sodium crypto_sign_keypair.
|
|
41
|
+
* The full 64-byte secret key (seed + public) is encrypted.
|
|
42
|
+
*
|
|
43
|
+
* For Ethereum (EVM): generates secp256k1 private key via crypto.randomBytes(32).
|
|
44
|
+
* Derives EIP-55 checksum address using viem privateKeyToAccount.
|
|
45
|
+
* The 32-byte private key is encrypted.
|
|
46
|
+
*
|
|
47
|
+
* @returns publicKey (base58 for Solana, 0x EIP-55 for EVM) and encrypted private key bytes
|
|
48
|
+
*/
|
|
49
|
+
async generateKeyPair(walletId, chain, network, masterPassword) {
|
|
50
|
+
if (chain === 'ethereum') {
|
|
51
|
+
return this.generateSecp256k1KeyPair(walletId, network, masterPassword);
|
|
52
|
+
}
|
|
53
|
+
if (chain === 'solana') {
|
|
54
|
+
return this.generateEd25519KeyPair(walletId, network, masterPassword);
|
|
55
|
+
}
|
|
56
|
+
throw new WAIaaSError('CHAIN_NOT_SUPPORTED', {
|
|
57
|
+
message: `Key generation for chain '${chain}' is not supported. Supported: 'solana', 'ethereum'.`,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Generate an Ed25519 keypair for Solana using sodium-native.
|
|
62
|
+
*/
|
|
63
|
+
async generateEd25519KeyPair(walletId, network, masterPassword) {
|
|
64
|
+
const sodium = loadSodium();
|
|
65
|
+
// Generate Ed25519 keypair using sodium
|
|
66
|
+
const publicKeyBuf = Buffer.alloc(sodium.crypto_sign_PUBLICKEYBYTES);
|
|
67
|
+
const secretKeyBuf = Buffer.alloc(sodium.crypto_sign_SECRETKEYBYTES);
|
|
68
|
+
sodium.crypto_sign_keypair(publicKeyBuf, secretKeyBuf);
|
|
69
|
+
// Encode public key as base58
|
|
70
|
+
const publicKey = encodeBase58(publicKeyBuf);
|
|
71
|
+
// Encrypt the 64-byte secret key
|
|
72
|
+
const encrypted = await encrypt(secretKeyBuf, masterPassword);
|
|
73
|
+
// Zero the plaintext secret key immediately
|
|
74
|
+
sodium.sodium_memzero(secretKeyBuf);
|
|
75
|
+
// Build keystore file v1
|
|
76
|
+
const keystoreFile = {
|
|
77
|
+
version: 1,
|
|
78
|
+
id: randomUUID(),
|
|
79
|
+
chain: 'solana',
|
|
80
|
+
network,
|
|
81
|
+
curve: 'ed25519',
|
|
82
|
+
publicKey,
|
|
83
|
+
crypto: {
|
|
84
|
+
cipher: 'aes-256-gcm',
|
|
85
|
+
cipherparams: { iv: encrypted.iv.toString('hex') },
|
|
86
|
+
ciphertext: encrypted.ciphertext.toString('hex'),
|
|
87
|
+
authTag: encrypted.authTag.toString('hex'),
|
|
88
|
+
kdf: 'argon2id',
|
|
89
|
+
kdfparams: {
|
|
90
|
+
salt: encrypted.salt.toString('hex'),
|
|
91
|
+
...KDF_PARAMS,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
metadata: {
|
|
95
|
+
name: walletId,
|
|
96
|
+
createdAt: new Date().toISOString(),
|
|
97
|
+
lastUnlockedAt: null,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
// Write keystore file atomically (write-then-rename)
|
|
101
|
+
await this.writeKeystoreFile(walletId, keystoreFile);
|
|
102
|
+
return {
|
|
103
|
+
publicKey,
|
|
104
|
+
encryptedPrivateKey: new Uint8Array(encrypted.ciphertext),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Generate a secp256k1 keypair for EVM chains.
|
|
109
|
+
* Uses crypto.randomBytes(32) for CSPRNG entropy and viem for EIP-55 address derivation.
|
|
110
|
+
*/
|
|
111
|
+
async generateSecp256k1KeyPair(walletId, network, masterPassword) {
|
|
112
|
+
const sodium = loadSodium();
|
|
113
|
+
// Generate 32-byte random private key via CSPRNG
|
|
114
|
+
const privateKeyBuf = randomBytes(32);
|
|
115
|
+
// Derive EIP-55 checksum address using viem
|
|
116
|
+
const hexKey = `0x${privateKeyBuf.toString('hex')}`;
|
|
117
|
+
const account = privateKeyToAccount(hexKey);
|
|
118
|
+
const publicKey = account.address; // EIP-55 checksum address
|
|
119
|
+
// Encrypt the 32-byte private key
|
|
120
|
+
const encrypted = await encrypt(privateKeyBuf, masterPassword);
|
|
121
|
+
// Zero the plaintext private key immediately
|
|
122
|
+
sodium.sodium_memzero(privateKeyBuf);
|
|
123
|
+
// Build keystore file v1
|
|
124
|
+
const keystoreFile = {
|
|
125
|
+
version: 1,
|
|
126
|
+
id: randomUUID(),
|
|
127
|
+
chain: 'ethereum',
|
|
128
|
+
network,
|
|
129
|
+
curve: 'secp256k1',
|
|
130
|
+
publicKey,
|
|
131
|
+
crypto: {
|
|
132
|
+
cipher: 'aes-256-gcm',
|
|
133
|
+
cipherparams: { iv: encrypted.iv.toString('hex') },
|
|
134
|
+
ciphertext: encrypted.ciphertext.toString('hex'),
|
|
135
|
+
authTag: encrypted.authTag.toString('hex'),
|
|
136
|
+
kdf: 'argon2id',
|
|
137
|
+
kdfparams: {
|
|
138
|
+
salt: encrypted.salt.toString('hex'),
|
|
139
|
+
...KDF_PARAMS,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
metadata: {
|
|
143
|
+
name: walletId,
|
|
144
|
+
createdAt: new Date().toISOString(),
|
|
145
|
+
lastUnlockedAt: null,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
// Write keystore file atomically (write-then-rename)
|
|
149
|
+
await this.writeKeystoreFile(walletId, keystoreFile);
|
|
150
|
+
return {
|
|
151
|
+
publicKey,
|
|
152
|
+
encryptedPrivateKey: new Uint8Array(encrypted.ciphertext),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Decrypt private key from keystore file and store in guarded memory.
|
|
157
|
+
*
|
|
158
|
+
* @returns Guarded buffer containing the decrypted private key (readonly)
|
|
159
|
+
*/
|
|
160
|
+
async decryptPrivateKey(walletId, masterPassword) {
|
|
161
|
+
const keystoreFile = await this.readKeystoreFile(walletId);
|
|
162
|
+
const encrypted = {
|
|
163
|
+
iv: Buffer.from(keystoreFile.crypto.cipherparams.iv, 'hex'),
|
|
164
|
+
ciphertext: Buffer.from(keystoreFile.crypto.ciphertext, 'hex'),
|
|
165
|
+
authTag: Buffer.from(keystoreFile.crypto.authTag, 'hex'),
|
|
166
|
+
salt: Buffer.from(keystoreFile.crypto.kdfparams.salt, 'hex'),
|
|
167
|
+
kdfparams: keystoreFile.crypto.kdfparams,
|
|
168
|
+
};
|
|
169
|
+
const plaintext = await decrypt(encrypted, masterPassword);
|
|
170
|
+
// Store in guarded memory
|
|
171
|
+
const guarded = allocateGuarded(plaintext.length);
|
|
172
|
+
writeToGuarded(guarded, plaintext);
|
|
173
|
+
// Zero the plaintext Buffer
|
|
174
|
+
plaintext.fill(0);
|
|
175
|
+
// Track the guarded buffer
|
|
176
|
+
this.guardedKeys.set(guarded, walletId);
|
|
177
|
+
// Update lastUnlockedAt
|
|
178
|
+
keystoreFile.metadata.lastUnlockedAt = new Date().toISOString();
|
|
179
|
+
await this.writeKeystoreFile(walletId, keystoreFile);
|
|
180
|
+
return new Uint8Array(guarded.buffer, guarded.byteOffset, guarded.byteLength);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Release a decrypted key from guarded memory (zero-fill).
|
|
184
|
+
*/
|
|
185
|
+
releaseKey(key) {
|
|
186
|
+
// Find the guarded buffer that backs this Uint8Array
|
|
187
|
+
for (const [guarded] of this.guardedKeys) {
|
|
188
|
+
if (guarded.buffer === key.buffer &&
|
|
189
|
+
guarded.byteOffset === key.byteOffset &&
|
|
190
|
+
guarded.byteLength === key.byteLength) {
|
|
191
|
+
zeroAndRelease(guarded);
|
|
192
|
+
this.guardedKeys.delete(guarded);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// If not found in guardedKeys (e.g., fallback buffer), zero it manually
|
|
197
|
+
key.fill(0);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Check if a keystore file exists for the given wallet.
|
|
201
|
+
*/
|
|
202
|
+
async hasKey(walletId) {
|
|
203
|
+
try {
|
|
204
|
+
await stat(this.keystorePath(walletId));
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Delete keystore file and release any loaded key from memory.
|
|
213
|
+
*/
|
|
214
|
+
async deleteKey(walletId) {
|
|
215
|
+
// Release from memory if loaded
|
|
216
|
+
for (const [guarded, id] of this.guardedKeys) {
|
|
217
|
+
if (id === walletId) {
|
|
218
|
+
zeroAndRelease(guarded);
|
|
219
|
+
this.guardedKeys.delete(guarded);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
// Delete file
|
|
223
|
+
try {
|
|
224
|
+
await unlink(this.keystorePath(walletId));
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
// Ignore if file doesn't exist
|
|
228
|
+
if (error.code !== 'ENOENT') {
|
|
229
|
+
throw error;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Lock all keys -- zero and release all guarded buffers.
|
|
235
|
+
* Called during daemon shutdown.
|
|
236
|
+
*/
|
|
237
|
+
lockAll() {
|
|
238
|
+
for (const [guarded] of this.guardedKeys) {
|
|
239
|
+
zeroAndRelease(guarded);
|
|
240
|
+
}
|
|
241
|
+
this.guardedKeys.clear();
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Check if sodium-native guarded memory is available.
|
|
245
|
+
*/
|
|
246
|
+
get sodiumAvailable() {
|
|
247
|
+
return isAvailable();
|
|
248
|
+
}
|
|
249
|
+
// --- Private helpers ---
|
|
250
|
+
keystorePath(walletId) {
|
|
251
|
+
return join(this.keystoreDir, `${walletId}.json`);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Write keystore file atomically using write-then-rename pattern.
|
|
255
|
+
* Sets file permission to 0600 (owner read/write only).
|
|
256
|
+
*/
|
|
257
|
+
async writeKeystoreFile(walletId, data) {
|
|
258
|
+
const targetPath = this.keystorePath(walletId);
|
|
259
|
+
const tempPath = join(dirname(targetPath), `.${walletId}.json.tmp`);
|
|
260
|
+
const json = JSON.stringify(data, null, 2);
|
|
261
|
+
await writeFile(tempPath, json, { encoding: 'utf-8', mode: 0o600 });
|
|
262
|
+
await rename(tempPath, targetPath);
|
|
263
|
+
}
|
|
264
|
+
async readKeystoreFile(walletId) {
|
|
265
|
+
const filePath = this.keystorePath(walletId);
|
|
266
|
+
let content;
|
|
267
|
+
try {
|
|
268
|
+
content = await readFile(filePath, 'utf-8');
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
if (error.code === 'ENOENT') {
|
|
272
|
+
throw new WAIaaSError('WALLET_NOT_FOUND', {
|
|
273
|
+
message: `Keystore file not found for wallet '${walletId}'`,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
throw error;
|
|
277
|
+
}
|
|
278
|
+
const parsed = JSON.parse(content);
|
|
279
|
+
if (parsed.version !== 1) {
|
|
280
|
+
throw new WAIaaSError('KEYSTORE_LOCKED', {
|
|
281
|
+
message: `Unsupported keystore version: ${String(parsed.version)}`,
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
// Backward compat: files created before v1.4.1 lack the curve field
|
|
285
|
+
if (!parsed.curve) {
|
|
286
|
+
parsed.curve = 'ed25519';
|
|
287
|
+
}
|
|
288
|
+
return parsed;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// --- Base58 encoding (Bitcoin alphabet) ---
|
|
292
|
+
const BASE58_ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
293
|
+
/**
|
|
294
|
+
* Encode a Buffer as Base58 string (Solana public key format).
|
|
295
|
+
*/
|
|
296
|
+
function encodeBase58(buf) {
|
|
297
|
+
// Count leading zeros
|
|
298
|
+
let zeroes = 0;
|
|
299
|
+
for (let i = 0; i < buf.length && buf[i] === 0; i++) {
|
|
300
|
+
zeroes++;
|
|
301
|
+
}
|
|
302
|
+
// Convert to base58
|
|
303
|
+
const size = Math.ceil((buf.length * 138) / 100) + 1;
|
|
304
|
+
const b58 = new Uint8Array(size);
|
|
305
|
+
let length = 0;
|
|
306
|
+
for (let i = zeroes; i < buf.length; i++) {
|
|
307
|
+
let carry = buf[i];
|
|
308
|
+
let j = 0;
|
|
309
|
+
for (let k = size - 1; k >= 0 && (carry !== 0 || j < length); k--, j++) {
|
|
310
|
+
carry += 256 * (b58[k] ?? 0);
|
|
311
|
+
b58[k] = carry % 58;
|
|
312
|
+
carry = Math.floor(carry / 58);
|
|
313
|
+
}
|
|
314
|
+
length = j;
|
|
315
|
+
}
|
|
316
|
+
// Build string
|
|
317
|
+
let str = '1'.repeat(zeroes);
|
|
318
|
+
let leadingZeros = true;
|
|
319
|
+
for (let i = 0; i < size; i++) {
|
|
320
|
+
if (leadingZeros && b58[i] === 0)
|
|
321
|
+
continue;
|
|
322
|
+
leadingZeros = false;
|
|
323
|
+
str += BASE58_ALPHABET[b58[i]];
|
|
324
|
+
}
|
|
325
|
+
return str || '1';
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=keystore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keystore.js","sourceRoot":"","sources":["../../../src/infrastructure/keystore/keystore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI3F,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,SAAS,UAAU;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