trustbase-seller-backend 0.1.5
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/.agents/skills/wechatpay-payment-integration/SKILL.md +165 -0
- package/.agents/skills/wechatpay-payment-integration/references/APIv3/346/216/245/345/217/243/345/212/250/346/200/201/346/216/222/351/232/234.md +234 -0
- package/.agents/skills/wechatpay-payment-integration/references/wechatpay-dev-cli/344/275/277/347/224/250/350/257/264/346/230/216.md +74 -0
- package/.agents/skills/wechatpay-payment-integration/references//345/237/272/347/241/200/346/246/202/345/277/265/345/217/212/344/270/232/345/212/241/344/273/213/347/273/215.md +109 -0
- package/.agents/skills/wechatpay-payment-integration/references//345/246/202/344/275/225/347/220/206/350/247/243/347/224/250/346/210/267/351/227/256/351/242/230.md +55 -0
- package/.agents/skills/wechatpay-payment-integration/references//346/216/245/345/205/245/350/264/250/351/207/217/346/243/200/346/237/245/346/270/205/345/215/225.md +70 -0
- package/.agents/skills/wechatpay-payment-integration/references//346/226/207/346/241/243/346/243/200/347/264/242/344/270/216/351/227/256/347/255/224.md +99 -0
- package/.agents/skills/wechatpay-payment-integration/scripts/bash/extract_and_sign.sh +231 -0
- package/.agents/skills/wechatpay-payment-integration/scripts/powershell/extract_and_sign.ps1 +199 -0
- package/.agents/skills/wechatpay-payment-integration/scripts/wechatpay-resource-sync.py +646 -0
- package/.env.example +70 -0
- package/MERCHANT-EDITION.md +56 -0
- package/README.md +99 -0
- package/api/__tests__/test-utils.d.ts +33 -0
- package/api/__tests__/test-utils.d.ts.map +1 -0
- package/api/__tests__/test-utils.js +90 -0
- package/api/__tests__/test-utils.js.map +1 -0
- package/api/db/case-library-types.d.ts +47 -0
- package/api/db/case-library-types.d.ts.map +1 -0
- package/api/db/case-library-types.js +105 -0
- package/api/db/case-library-types.js.map +1 -0
- package/api/db/case-library.db.d.ts +5 -0
- package/api/db/case-library.db.d.ts.map +1 -0
- package/api/db/case-library.db.js +127 -0
- package/api/db/case-library.db.js.map +1 -0
- package/api/email.d.ts +56 -0
- package/api/email.d.ts.map +1 -0
- package/api/email.js +307 -0
- package/api/email.js.map +1 -0
- package/api/index.d.ts +22 -0
- package/api/index.d.ts.map +1 -0
- package/api/index.js +41 -0
- package/api/index.js.map +1 -0
- package/api/integration-helpers.d.ts +153 -0
- package/api/integration-helpers.d.ts.map +1 -0
- package/api/integration-helpers.js +361 -0
- package/api/integration-helpers.js.map +1 -0
- package/api/lib/case-summary.d.ts +10 -0
- package/api/lib/case-summary.d.ts.map +1 -0
- package/api/lib/case-summary.js +30 -0
- package/api/lib/case-summary.js.map +1 -0
- package/api/middleware/p2p-auth.d.ts +140 -0
- package/api/middleware/p2p-auth.d.ts.map +1 -0
- package/api/middleware/p2p-auth.js +510 -0
- package/api/middleware/p2p-auth.js.map +1 -0
- package/api/middleware/tool-policy.d.ts +47 -0
- package/api/middleware/tool-policy.d.ts.map +1 -0
- package/api/middleware/tool-policy.js +156 -0
- package/api/middleware/tool-policy.js.map +1 -0
- package/api/oauth-adapters.d.ts +192 -0
- package/api/oauth-adapters.d.ts.map +1 -0
- package/api/oauth-adapters.js +456 -0
- package/api/oauth-adapters.js.map +1 -0
- package/api/oauth-bridge.d.ts +56 -0
- package/api/oauth-bridge.d.ts.map +1 -0
- package/api/oauth-bridge.js +624 -0
- package/api/oauth-bridge.js.map +1 -0
- package/api/oauth-router.d.ts +36 -0
- package/api/oauth-router.d.ts.map +1 -0
- package/api/oauth-router.js +54 -0
- package/api/oauth-router.js.map +1 -0
- package/api/p2p-mcp.d.ts +69 -0
- package/api/p2p-mcp.d.ts.map +1 -0
- package/api/p2p-mcp.js +286 -0
- package/api/p2p-mcp.js.map +1 -0
- package/api/payment-store.d.ts +56 -0
- package/api/payment-store.d.ts.map +1 -0
- package/api/payment-store.js +163 -0
- package/api/payment-store.js.map +1 -0
- package/api/payment.d.ts +14 -0
- package/api/payment.d.ts.map +1 -0
- package/api/payment.js +216 -0
- package/api/payment.js.map +1 -0
- package/api/pwa-stats.d.ts +67 -0
- package/api/pwa-stats.d.ts.map +1 -0
- package/api/pwa-stats.js +269 -0
- package/api/pwa-stats.js.map +1 -0
- package/api/riskcontrol-adapters.d.ts +114 -0
- package/api/riskcontrol-adapters.d.ts.map +1 -0
- package/api/riskcontrol-adapters.js +210 -0
- package/api/riskcontrol-adapters.js.map +1 -0
- package/api/riskcontrol-event-whitelist.d.ts +81 -0
- package/api/riskcontrol-event-whitelist.d.ts.map +1 -0
- package/api/riskcontrol-event-whitelist.js +181 -0
- package/api/riskcontrol-event-whitelist.js.map +1 -0
- package/api/riskcontrol-rules.d.ts +105 -0
- package/api/riskcontrol-rules.d.ts.map +1 -0
- package/api/riskcontrol-rules.js +399 -0
- package/api/riskcontrol-rules.js.map +1 -0
- package/api/riskcontrol-scoring.d.ts +72 -0
- package/api/riskcontrol-scoring.d.ts.map +1 -0
- package/api/riskcontrol-scoring.js +335 -0
- package/api/riskcontrol-scoring.js.map +1 -0
- package/api/riskcontrol-service.d.ts +60 -0
- package/api/riskcontrol-service.d.ts.map +1 -0
- package/api/riskcontrol-service.js +206 -0
- package/api/riskcontrol-service.js.map +1 -0
- package/api/riskcontrol-stream.d.ts +112 -0
- package/api/riskcontrol-stream.d.ts.map +1 -0
- package/api/riskcontrol-stream.js +230 -0
- package/api/riskcontrol-stream.js.map +1 -0
- package/api/riskcontrol-v5-e2e-test.d.ts +15 -0
- package/api/riskcontrol-v5-e2e-test.d.ts.map +1 -0
- package/api/riskcontrol-v5-e2e-test.js +204 -0
- package/api/riskcontrol-v5-e2e-test.js.map +1 -0
- package/api/riskcontrol-v5-router.d.ts +48 -0
- package/api/riskcontrol-v5-router.d.ts.map +1 -0
- package/api/riskcontrol-v5-router.js +226 -0
- package/api/riskcontrol-v5-router.js.map +1 -0
- package/api/riskcontrol-webhook.d.ts +88 -0
- package/api/riskcontrol-webhook.d.ts.map +1 -0
- package/api/riskcontrol-webhook.js +326 -0
- package/api/riskcontrol-webhook.js.map +1 -0
- package/api/routes/case-library.d.ts +4 -0
- package/api/routes/case-library.d.ts.map +1 -0
- package/api/routes/case-library.js +91 -0
- package/api/routes/case-library.js.map +1 -0
- package/api/seller-earnings.d.ts +23 -0
- package/api/seller-earnings.d.ts.map +1 -0
- package/api/seller-earnings.js +258 -0
- package/api/seller-earnings.js.map +1 -0
- package/api/seller-orders.d.ts +25 -0
- package/api/seller-orders.d.ts.map +1 -0
- package/api/seller-orders.js +398 -0
- package/api/seller-orders.js.map +1 -0
- package/api/seller-products-chain.d.ts +31 -0
- package/api/seller-products-chain.d.ts.map +1 -0
- package/api/seller-products-chain.js +308 -0
- package/api/seller-products-chain.js.map +1 -0
- package/api/seller-products.d.ts +30 -0
- package/api/seller-products.d.ts.map +1 -0
- package/api/seller-products.js +453 -0
- package/api/seller-products.js.map +1 -0
- package/api/seller-reputation.d.ts +21 -0
- package/api/seller-reputation.d.ts.map +1 -0
- package/api/seller-reputation.js +204 -0
- package/api/seller-reputation.js.map +1 -0
- package/api/seller-router.d.ts +33 -0
- package/api/seller-router.d.ts.map +1 -0
- package/api/seller-router.js +53 -0
- package/api/seller-router.js.map +1 -0
- package/api/seller-settings.d.ts +23 -0
- package/api/seller-settings.d.ts.map +1 -0
- package/api/seller-settings.js +279 -0
- package/api/seller-settings.js.map +1 -0
- package/api/shipping-store.d.ts +44 -0
- package/api/shipping-store.d.ts.map +1 -0
- package/api/shipping-store.js +154 -0
- package/api/shipping-store.js.map +1 -0
- package/api/shipping.d.ts +16 -0
- package/api/shipping.d.ts.map +1 -0
- package/api/shipping.js +239 -0
- package/api/shipping.js.map +1 -0
- package/api/social-endpoint-verify.d.ts +8 -0
- package/api/social-endpoint-verify.d.ts.map +1 -0
- package/api/social-endpoint-verify.js +152 -0
- package/api/social-endpoint-verify.js.map +1 -0
- package/api/social-posts.d.ts +65 -0
- package/api/social-posts.d.ts.map +1 -0
- package/api/social-posts.js +534 -0
- package/api/social-posts.js.map +1 -0
- package/api/social-router.d.ts +36 -0
- package/api/social-router.d.ts.map +1 -0
- package/api/social-router.js +56 -0
- package/api/social-router.js.map +1 -0
- package/api/social-shares.d.ts +40 -0
- package/api/social-shares.d.ts.map +1 -0
- package/api/social-shares.js +379 -0
- package/api/social-shares.js.map +1 -0
- package/api/social-whitelist.d.ts +41 -0
- package/api/social-whitelist.d.ts.map +1 -0
- package/api/social-whitelist.js +261 -0
- package/api/social-whitelist.js.map +1 -0
- package/api/storefront-orders.d.ts +23 -0
- package/api/storefront-orders.d.ts.map +1 -0
- package/api/storefront-orders.js +349 -0
- package/api/storefront-orders.js.map +1 -0
- package/api/storefront-products.d.ts +21 -0
- package/api/storefront-products.d.ts.map +1 -0
- package/api/storefront-products.js +181 -0
- package/api/storefront-products.js.map +1 -0
- package/api/storefront-router.d.ts +33 -0
- package/api/storefront-router.d.ts.map +1 -0
- package/api/storefront-router.js +47 -0
- package/api/storefront-router.js.map +1 -0
- package/api/storefront-user.d.ts +23 -0
- package/api/storefront-user.d.ts.map +1 -0
- package/api/storefront-user.js +336 -0
- package/api/storefront-user.js.map +1 -0
- package/api/test-db-helper.d.ts +29 -0
- package/api/test-db-helper.d.ts.map +1 -0
- package/api/test-db-helper.js +107 -0
- package/api/test-db-helper.js.map +1 -0
- package/api/traffic.d.ts +22 -0
- package/api/traffic.d.ts.map +1 -0
- package/api/traffic.js +112 -0
- package/api/traffic.js.map +1 -0
- package/api/wc-credentials.d.ts +34 -0
- package/api/wc-credentials.d.ts.map +1 -0
- package/api/wc-credentials.js +296 -0
- package/api/wc-credentials.js.map +1 -0
- package/api/wc-tracker-receiver.d.ts +47 -0
- package/api/wc-tracker-receiver.d.ts.map +1 -0
- package/api/wc-tracker-receiver.js +264 -0
- package/api/wc-tracker-receiver.js.map +1 -0
- package/api/wc-v3.d.ts +40 -0
- package/api/wc-v3.d.ts.map +1 -0
- package/api/wc-v3.js +694 -0
- package/api/wc-v3.js.map +1 -0
- package/bin/tb-doctor.js +32 -0
- package/bin/tb-seller-backend.js +42 -0
- package/check.d.ts +2 -0
- package/check.d.ts.map +1 -0
- package/check.js +19 -0
- package/check.js.map +1 -0
- package/config/export-import.d.ts +108 -0
- package/config/export-import.d.ts.map +1 -0
- package/config/export-import.js +234 -0
- package/config/export-import.js.map +1 -0
- package/config/manager.d.ts +73 -0
- package/config/manager.d.ts.map +1 -0
- package/config/manager.js +246 -0
- package/config/manager.js.map +1 -0
- package/config/profile.d.ts +42 -0
- package/config/profile.d.ts.map +1 -0
- package/config/profile.js +111 -0
- package/config/profile.js.map +1 -0
- package/core/address.js +23 -0
- package/core/advanced-performance.d.ts +149 -0
- package/core/advanced-performance.d.ts.map +1 -0
- package/core/advanced-performance.js +374 -0
- package/core/advanced-performance.js.map +1 -0
- package/core/alerting.d.ts +91 -0
- package/core/alerting.d.ts.map +1 -0
- package/core/alerting.js +379 -0
- package/core/alerting.js.map +1 -0
- package/core/app-store.d.ts +77 -0
- package/core/app-store.d.ts.map +1 -0
- package/core/app-store.js +207 -0
- package/core/app-store.js.map +1 -0
- package/core/boot-env.js +39 -0
- package/core/business-scope-schema.d.ts +60 -0
- package/core/business-scope-schema.d.ts.map +1 -0
- package/core/business-scope-schema.js +165 -0
- package/core/business-scope-schema.js.map +1 -0
- package/core/cache.d.ts +53 -0
- package/core/cache.d.ts.map +1 -0
- package/core/cache.js +130 -0
- package/core/cache.js.map +1 -0
- package/core/chain-listener.d.ts +47 -0
- package/core/chain-listener.d.ts.map +1 -0
- package/core/chain-listener.js +254 -0
- package/core/chain-listener.js.map +1 -0
- package/core/chain-reject.js +107 -0
- package/core/chain-signer.js +258 -0
- package/core/cleanup.d.ts +42 -0
- package/core/cleanup.d.ts.map +1 -0
- package/core/cleanup.js +144 -0
- package/core/cleanup.js.map +1 -0
- package/core/cluster.d.ts +78 -0
- package/core/cluster.d.ts.map +1 -0
- package/core/cluster.js +215 -0
- package/core/cluster.js.map +1 -0
- package/core/community-review.d.ts +82 -0
- package/core/community-review.d.ts.map +1 -0
- package/core/community-review.js +201 -0
- package/core/community-review.js.map +1 -0
- package/core/connection-pool.d.ts +72 -0
- package/core/connection-pool.d.ts.map +1 -0
- package/core/connection-pool.js +173 -0
- package/core/connection-pool.js.map +1 -0
- package/core/consistency.d.ts +130 -0
- package/core/consistency.d.ts.map +1 -0
- package/core/consistency.js +340 -0
- package/core/consistency.js.map +1 -0
- package/core/content-ai.d.ts +303 -0
- package/core/content-ai.d.ts.map +1 -0
- package/core/content-ai.js +344 -0
- package/core/content-ai.js.map +1 -0
- package/core/content-backfill.d.ts +55 -0
- package/core/content-backfill.d.ts.map +1 -0
- package/core/content-backfill.js +174 -0
- package/core/content-backfill.js.map +1 -0
- package/core/conversion-rate-sync.d.ts +97 -0
- package/core/conversion-rate-sync.d.ts.map +1 -0
- package/core/conversion-rate-sync.js +195 -0
- package/core/conversion-rate-sync.js.map +1 -0
- package/core/coverage-backup.d.ts +87 -0
- package/core/coverage-backup.d.ts.map +1 -0
- package/core/coverage-backup.js +265 -0
- package/core/coverage-backup.js.map +1 -0
- package/core/db-installer.d.ts +108 -0
- package/core/db-installer.d.ts.map +1 -0
- package/core/db-installer.js +414 -0
- package/core/db-installer.js.map +1 -0
- package/core/device-analyzer.d.ts +96 -0
- package/core/device-analyzer.d.ts.map +1 -0
- package/core/device-analyzer.js +235 -0
- package/core/device-analyzer.js.map +1 -0
- package/core/discovery.d.ts +165 -0
- package/core/discovery.d.ts.map +1 -0
- package/core/discovery.js +363 -0
- package/core/discovery.js.map +1 -0
- package/core/distributed.d.ts +172 -0
- package/core/distributed.d.ts.map +1 -0
- package/core/distributed.js +422 -0
- package/core/distributed.js.map +1 -0
- package/core/doctor.js +249 -0
- package/core/enforcement.d.ts +57 -0
- package/core/enforcement.d.ts.map +1 -0
- package/core/enforcement.js +115 -0
- package/core/enforcement.js.map +1 -0
- package/core/error-handler.d.ts +131 -0
- package/core/error-handler.d.ts.map +1 -0
- package/core/error-handler.js +291 -0
- package/core/error-handler.js.map +1 -0
- package/core/federated-learning.d.ts +124 -0
- package/core/federated-learning.d.ts.map +1 -0
- package/core/federated-learning.js +338 -0
- package/core/federated-learning.js.map +1 -0
- package/core/fingerprint.d.ts +95 -0
- package/core/fingerprint.d.ts.map +1 -0
- package/core/fingerprint.js +313 -0
- package/core/fingerprint.js.map +1 -0
- package/core/geoip.d.ts +67 -0
- package/core/geoip.d.ts.map +1 -0
- package/core/geoip.js +174 -0
- package/core/geoip.js.map +1 -0
- package/core/gossip.d.ts +141 -0
- package/core/gossip.d.ts.map +1 -0
- package/core/gossip.js +372 -0
- package/core/gossip.js.map +1 -0
- package/core/governance.d.ts +147 -0
- package/core/governance.d.ts.map +1 -0
- package/core/governance.js +351 -0
- package/core/governance.js.map +1 -0
- package/core/indexer-enhancements.d.ts +164 -0
- package/core/indexer-enhancements.d.ts.map +1 -0
- package/core/indexer-enhancements.js +429 -0
- package/core/indexer-enhancements.js.map +1 -0
- package/core/intrusion-detection.d.ts +79 -0
- package/core/intrusion-detection.d.ts.map +1 -0
- package/core/intrusion-detection.js +322 -0
- package/core/intrusion-detection.js.map +1 -0
- package/core/lifecycle.d.ts +118 -0
- package/core/lifecycle.d.ts.map +1 -0
- package/core/lifecycle.js +310 -0
- package/core/lifecycle.js.map +1 -0
- package/core/location.d.ts +99 -0
- package/core/location.d.ts.map +1 -0
- package/core/location.js +219 -0
- package/core/location.js.map +1 -0
- package/core/maxmind-integration.d.ts +68 -0
- package/core/maxmind-integration.d.ts.map +1 -0
- package/core/maxmind-integration.js +245 -0
- package/core/maxmind-integration.js.map +1 -0
- package/core/migration.d.ts +58 -0
- package/core/migration.d.ts.map +1 -0
- package/core/migration.js +223 -0
- package/core/migration.js.map +1 -0
- package/core/monitoring.d.ts +153 -0
- package/core/monitoring.d.ts.map +1 -0
- package/core/monitoring.js +406 -0
- package/core/monitoring.js.map +1 -0
- package/core/offsite-backup.d.ts +71 -0
- package/core/offsite-backup.d.ts.map +1 -0
- package/core/offsite-backup.js +341 -0
- package/core/offsite-backup.js.map +1 -0
- package/core/order-intent-store.js +83 -0
- package/core/order-intent.js +273 -0
- package/core/paths.js +116 -0
- package/core/performance.d.ts +173 -0
- package/core/performance.d.ts.map +1 -0
- package/core/performance.js +386 -0
- package/core/performance.js.map +1 -0
- package/core/product-flag.d.ts +364 -0
- package/core/product-flag.d.ts.map +1 -0
- package/core/product-flag.js +465 -0
- package/core/product-flag.js.map +1 -0
- package/core/protection.d.ts +139 -0
- package/core/protection.d.ts.map +1 -0
- package/core/protection.js +327 -0
- package/core/protection.js.map +1 -0
- package/core/region-adapter.d.ts +152 -0
- package/core/region-adapter.d.ts.map +1 -0
- package/core/region-adapter.js +505 -0
- package/core/region-adapter.js.map +1 -0
- package/core/region-configs.d.ts +12 -0
- package/core/region-configs.d.ts.map +1 -0
- package/core/region-configs.js +907 -0
- package/core/region-configs.js.map +1 -0
- package/core/review-antifraud.d.ts +80 -0
- package/core/review-antifraud.d.ts.map +1 -0
- package/core/review-antifraud.js +193 -0
- package/core/review-antifraud.js.map +1 -0
- package/core/rules-updater.d.ts +89 -0
- package/core/rules-updater.d.ts.map +1 -0
- package/core/rules-updater.js +261 -0
- package/core/rules-updater.js.map +1 -0
- package/core/runtime-data.js +203 -0
- package/core/security.d.ts +144 -0
- package/core/security.d.ts.map +1 -0
- package/core/security.js +390 -0
- package/core/security.js.map +1 -0
- package/core/seller-identity.js +78 -0
- package/core/session-manager.d.ts +93 -0
- package/core/session-manager.d.ts.map +1 -0
- package/core/session-manager.js +262 -0
- package/core/session-manager.js.map +1 -0
- package/core/state-sync.d.ts +121 -0
- package/core/state-sync.d.ts.map +1 -0
- package/core/state-sync.js +287 -0
- package/core/state-sync.js.map +1 -0
- package/core/testing.d.ts +97 -0
- package/core/testing.d.ts.map +1 -0
- package/core/testing.js +361 -0
- package/core/testing.js.map +1 -0
- package/core/trust-score.d.ts +51 -0
- package/core/trust-score.d.ts.map +1 -0
- package/core/trust-score.js +188 -0
- package/core/trust-score.js.map +1 -0
- package/core/trustworthiness.d.ts +140 -0
- package/core/trustworthiness.d.ts.map +1 -0
- package/core/trustworthiness.js +375 -0
- package/core/trustworthiness.js.map +1 -0
- package/core/types.d.ts +258 -0
- package/core/types.d.ts.map +1 -0
- package/core/types.js +9 -0
- package/core/types.js.map +1 -0
- package/core/upgrade-manager.d.ts +114 -0
- package/core/upgrade-manager.d.ts.map +1 -0
- package/core/upgrade-manager.js +264 -0
- package/core/upgrade-manager.js.map +1 -0
- package/core/upgrader.d.ts +107 -0
- package/core/upgrader.d.ts.map +1 -0
- package/core/upgrader.js +389 -0
- package/core/upgrader.js.map +1 -0
- package/core/websocket.d.ts +78 -0
- package/core/websocket.d.ts.map +1 -0
- package/core/websocket.js +292 -0
- package/core/websocket.js.map +1 -0
- package/council/hidden-weight.d.ts +45 -0
- package/council/hidden-weight.d.ts.map +1 -0
- package/council/hidden-weight.js +135 -0
- package/council/hidden-weight.js.map +1 -0
- package/db/email-migrations.sql +31 -0
- package/db/oauth-migrate.d.ts +39 -0
- package/db/oauth-migrate.d.ts.map +1 -0
- package/db/oauth-migrate.js +201 -0
- package/db/oauth-migrate.js.map +1 -0
- package/db/oauth-migrations.sql +92 -0
- package/db/social-migrate.d.ts +12 -0
- package/db/social-migrate.d.ts.map +1 -0
- package/db/social-migrate.js +102 -0
- package/db/social-migrate.js.map +1 -0
- package/db/social-migrations.sql +94 -0
- package/db/store-migrate.d.ts +33 -0
- package/db/store-migrate.d.ts.map +1 -0
- package/db/store-migrate.js +149 -0
- package/db/store-migrate.js.map +1 -0
- package/db/store-migrations.sql +242 -0
- package/debug.d.ts +2 -0
- package/debug.d.ts.map +1 -0
- package/debug.js +18 -0
- package/debug.js.map +1 -0
- package/event-listener.d.ts +93 -0
- package/event-listener.d.ts.map +1 -0
- package/event-listener.js +321 -0
- package/event-listener.js.map +1 -0
- package/event-whitelist.d.ts +79 -0
- package/event-whitelist.d.ts.map +1 -0
- package/event-whitelist.js +533 -0
- package/event-whitelist.js.map +1 -0
- package/index.d.ts +45 -0
- package/index.d.ts.map +1 -0
- package/index.js +361 -0
- package/index.js.map +1 -0
- package/init-node.d.ts +9 -0
- package/init-node.d.ts.map +1 -0
- package/init-node.js +230 -0
- package/init-node.js.map +1 -0
- package/mcp/ai-tools.d.ts +2 -0
- package/mcp/ai-tools.d.ts.map +1 -0
- package/mcp/ai-tools.js +266 -0
- package/mcp/ai-tools.js.map +1 -0
- package/mcp/auto-dispatch-tools.d.ts +2 -0
- package/mcp/auto-dispatch-tools.d.ts.map +1 -0
- package/mcp/auto-dispatch-tools.js +348 -0
- package/mcp/auto-dispatch-tools.js.map +1 -0
- package/mcp/business-scope-tools.d.ts +11 -0
- package/mcp/business-scope-tools.d.ts.map +1 -0
- package/mcp/business-scope-tools.js +179 -0
- package/mcp/business-scope-tools.js.map +1 -0
- package/mcp/buyer-tools.d.ts +67 -0
- package/mcp/buyer-tools.d.ts.map +1 -0
- package/mcp/buyer-tools.js +445 -0
- package/mcp/buyer-tools.js.map +1 -0
- package/mcp/interfaces.d.ts +1058 -0
- package/mcp/interfaces.d.ts.map +1 -0
- package/mcp/interfaces.js +13 -0
- package/mcp/interfaces.js.map +1 -0
- package/mcp/m2m-chat-tool.d.ts +50 -0
- package/mcp/m2m-chat-tool.d.ts.map +1 -0
- package/mcp/m2m-chat-tool.js +432 -0
- package/mcp/m2m-chat-tool.js.map +1 -0
- package/mcp/migrations.d.ts +30 -0
- package/mcp/migrations.d.ts.map +1 -0
- package/mcp/migrations.js +391 -0
- package/mcp/migrations.js.map +1 -0
- package/mcp/peer-tools.d.ts +163 -0
- package/mcp/peer-tools.d.ts.map +1 -0
- package/mcp/peer-tools.js +532 -0
- package/mcp/peer-tools.js.map +1 -0
- package/mcp/plugin-management-tools.d.ts +2 -0
- package/mcp/plugin-management-tools.d.ts.map +1 -0
- package/mcp/plugin-management-tools.js +327 -0
- package/mcp/plugin-management-tools.js.map +1 -0
- package/mcp/product-type-tools.d.ts +2 -0
- package/mcp/product-type-tools.d.ts.map +1 -0
- package/mcp/product-type-tools.js +470 -0
- package/mcp/product-type-tools.js.map +1 -0
- package/mcp/security-tools.d.ts +2 -0
- package/mcp/security-tools.d.ts.map +1 -0
- package/mcp/security-tools.js +313 -0
- package/mcp/security-tools.js.map +1 -0
- package/mcp/seller-query-tools.d.ts +2 -0
- package/mcp/seller-query-tools.d.ts.map +1 -0
- package/mcp/seller-query-tools.js +179 -0
- package/mcp/seller-query-tools.js.map +1 -0
- package/mcp/server.d.ts +11 -0
- package/mcp/server.d.ts.map +1 -0
- package/mcp/server.js +68 -0
- package/mcp/server.js.map +1 -0
- package/mcp/standalone-server.d.ts +34 -0
- package/mcp/standalone-server.d.ts.map +1 -0
- package/mcp/standalone-server.js +261 -0
- package/mcp/standalone-server.js.map +1 -0
- package/mcp/tools-integration.d.ts +31 -0
- package/mcp/tools-integration.d.ts.map +1 -0
- package/mcp/tools-integration.js +288 -0
- package/mcp/tools-integration.js.map +1 -0
- package/mcp/web-panel.d.ts +18 -0
- package/mcp/web-panel.d.ts.map +1 -0
- package/mcp/web-panel.js +1657 -0
- package/mcp/web-panel.js.map +1 -0
- package/middleware/api-key-auth.d.ts +64 -0
- package/middleware/api-key-auth.d.ts.map +1 -0
- package/middleware/api-key-auth.js +255 -0
- package/middleware/api-key-auth.js.map +1 -0
- package/middleware/scope-auth.d.ts +54 -0
- package/middleware/scope-auth.d.ts.map +1 -0
- package/middleware/scope-auth.js +153 -0
- package/middleware/scope-auth.js.map +1 -0
- package/middleware/security.d.ts +48 -0
- package/middleware/security.d.ts.map +1 -0
- package/middleware/security.js +217 -0
- package/middleware/security.js.map +1 -0
- package/middleware/wallet-auth.d.ts +54 -0
- package/middleware/wallet-auth.d.ts.map +1 -0
- package/middleware/wallet-auth.js +158 -0
- package/middleware/wallet-auth.js.map +1 -0
- package/oauth/chain-revocation-sink.d.ts +24 -0
- package/oauth/chain-revocation-sink.d.ts.map +1 -0
- package/oauth/chain-revocation-sink.js +47 -0
- package/oauth/chain-revocation-sink.js.map +1 -0
- package/oauth/gossip-sync.d.ts +25 -0
- package/oauth/gossip-sync.d.ts.map +1 -0
- package/oauth/gossip-sync.js +62 -0
- package/oauth/gossip-sync.js.map +1 -0
- package/oauth/issuer-keys.d.ts +31 -0
- package/oauth/issuer-keys.d.ts.map +1 -0
- package/oauth/issuer-keys.js +117 -0
- package/oauth/issuer-keys.js.map +1 -0
- package/oauth/peer-resolver.d.ts +25 -0
- package/oauth/peer-resolver.d.ts.map +1 -0
- package/oauth/peer-resolver.js +81 -0
- package/oauth/peer-resolver.js.map +1 -0
- package/oauth/revocation-store.d.ts +58 -0
- package/oauth/revocation-store.d.ts.map +1 -0
- package/oauth/revocation-store.js +86 -0
- package/oauth/revocation-store.js.map +1 -0
- package/oauth/token-v2.d.ts +101 -0
- package/oauth/token-v2.d.ts.map +1 -0
- package/oauth/token-v2.js +167 -0
- package/oauth/token-v2.js.map +1 -0
- package/oracle/c5-glue.js +603 -0
- package/oracle/ops-console.js +623 -0
- package/oracle/oracle-sync.d.ts +29 -0
- package/oracle/oracle-sync.d.ts.map +1 -0
- package/oracle/oracle-sync.js +445 -0
- package/oracle/oracle-sync.js.map +1 -0
- package/oracle/registry.d.ts +30 -0
- package/oracle/registry.d.ts.map +1 -0
- package/oracle/registry.js +62 -0
- package/oracle/registry.js.map +1 -0
- package/p2p/availability.d.ts +188 -0
- package/p2p/availability.d.ts.map +1 -0
- package/p2p/availability.js +574 -0
- package/p2p/availability.js.map +1 -0
- package/p2p/bootstrap.d.ts +42 -0
- package/p2p/bootstrap.d.ts.map +1 -0
- package/p2p/bootstrap.js +146 -0
- package/p2p/bootstrap.js.map +1 -0
- package/p2p/buyer-client.d.ts +98 -0
- package/p2p/buyer-client.d.ts.map +1 -0
- package/p2p/buyer-client.js +199 -0
- package/p2p/buyer-client.js.map +1 -0
- package/p2p/cdn-ddns.d.ts +208 -0
- package/p2p/cdn-ddns.d.ts.map +1 -0
- package/p2p/cdn-ddns.js +500 -0
- package/p2p/cdn-ddns.js.map +1 -0
- package/p2p/cluster-sync.d.ts +115 -0
- package/p2p/cluster-sync.d.ts.map +1 -0
- package/p2p/cluster-sync.js +330 -0
- package/p2p/cluster-sync.js.map +1 -0
- package/p2p/consistency-check.d.ts +30 -0
- package/p2p/consistency-check.d.ts.map +1 -0
- package/p2p/consistency-check.js +168 -0
- package/p2p/consistency-check.js.map +1 -0
- package/p2p/endpoint-registry.d.ts +41 -0
- package/p2p/endpoint-registry.d.ts.map +1 -0
- package/p2p/endpoint-registry.js +128 -0
- package/p2p/endpoint-registry.js.map +1 -0
- package/p2p/ipv6.d.ts +120 -0
- package/p2p/ipv6.d.ts.map +1 -0
- package/p2p/ipv6.js +425 -0
- package/p2p/ipv6.js.map +1 -0
- package/p2p/protocol.d.ts +100 -0
- package/p2p/protocol.d.ts.map +1 -0
- package/p2p/protocol.js +330 -0
- package/p2p/protocol.js.map +1 -0
- package/p2p/reliability.d.ts +56 -0
- package/p2p/reliability.d.ts.map +1 -0
- package/p2p/reliability.js +240 -0
- package/p2p/reliability.js.map +1 -0
- package/p2p/seller-service.d.ts +53 -0
- package/p2p/seller-service.d.ts.map +1 -0
- package/p2p/seller-service.js +276 -0
- package/p2p/seller-service.js.map +1 -0
- package/p2p/signing.d.ts +31 -0
- package/p2p/signing.d.ts.map +1 -0
- package/p2p/signing.js +95 -0
- package/p2p/signing.js.map +1 -0
- package/package.json +73 -0
- package/payment/api.d.ts +9 -0
- package/payment/api.d.ts.map +1 -0
- package/payment/api.js +141 -0
- package/payment/api.js.map +1 -0
- package/payment/gateway.d.ts +114 -0
- package/payment/gateway.d.ts.map +1 -0
- package/payment/gateway.js +231 -0
- package/payment/gateway.js.map +1 -0
- package/payments/alipay/index.d.ts +18 -0
- package/payments/alipay/index.d.ts.map +1 -0
- package/payments/alipay/index.js +55 -0
- package/payments/alipay/index.js.map +1 -0
- package/payments/base.d.ts +13 -0
- package/payments/base.d.ts.map +1 -0
- package/payments/base.js +28 -0
- package/payments/base.js.map +1 -0
- package/payments/index.d.ts +18 -0
- package/payments/index.d.ts.map +1 -0
- package/payments/index.js +66 -0
- package/payments/index.js.map +1 -0
- package/payments/template/index.d.ts +18 -0
- package/payments/template/index.d.ts.map +1 -0
- package/payments/template/index.js +57 -0
- package/payments/template/index.js.map +1 -0
- package/payments/types.d.ts +42 -0
- package/payments/types.d.ts.map +1 -0
- package/payments/types.js +3 -0
- package/payments/types.js.map +1 -0
- package/payments/wechat/index.d.ts +18 -0
- package/payments/wechat/index.d.ts.map +1 -0
- package/payments/wechat/index.js +54 -0
- package/payments/wechat/index.js.map +1 -0
- package/peer/chain-signer.d.ts +74 -0
- package/peer/chain-signer.d.ts.map +1 -0
- package/peer/chain-signer.js +149 -0
- package/peer/chain-signer.js.map +1 -0
- package/peer/config.d.ts +71 -0
- package/peer/config.d.ts.map +1 -0
- package/peer/config.js +61 -0
- package/peer/config.js.map +1 -0
- package/peer/index.d.ts +12 -0
- package/peer/index.d.ts.map +1 -0
- package/peer/index.js +46 -0
- package/peer/index.js.map +1 -0
- package/peer/key-store.d.ts +66 -0
- package/peer/key-store.d.ts.map +1 -0
- package/peer/key-store.js +163 -0
- package/peer/key-store.js.map +1 -0
- package/peer/proto-codec.d.ts +103 -0
- package/peer/proto-codec.d.ts.map +1 -0
- package/peer/proto-codec.js +423 -0
- package/peer/proto-codec.js.map +1 -0
- package/peer/registrar.d.ts +88 -0
- package/peer/registrar.d.ts.map +1 -0
- package/peer/registrar.js +271 -0
- package/peer/registrar.js.map +1 -0
- package/peer/registry.d.ts +31 -0
- package/peer/registry.d.ts.map +1 -0
- package/peer/registry.js +143 -0
- package/peer/registry.js.map +1 -0
- package/plugins/auth.d.ts +193 -0
- package/plugins/auth.d.ts.map +1 -0
- package/plugins/auth.js +923 -0
- package/plugins/auth.js.map +1 -0
- package/plugins/manager.d.ts +37 -0
- package/plugins/manager.d.ts.map +1 -0
- package/plugins/manager.js +83 -0
- package/plugins/manager.js.map +1 -0
- package/plugins/oauth.d.ts +249 -0
- package/plugins/oauth.d.ts.map +1 -0
- package/plugins/oauth.js +979 -0
- package/plugins/oauth.js.map +1 -0
- package/plugins/p2p-message.d.ts +133 -0
- package/plugins/p2p-message.d.ts.map +1 -0
- package/plugins/p2p-message.js +443 -0
- package/plugins/p2p-message.js.map +1 -0
- package/plugins/postgresql.d.ts +54 -0
- package/plugins/postgresql.d.ts.map +1 -0
- package/plugins/postgresql.js +743 -0
- package/plugins/postgresql.js.map +1 -0
- package/plugins/relationship.d.ts +141 -0
- package/plugins/relationship.d.ts.map +1 -0
- package/plugins/relationship.js +395 -0
- package/plugins/relationship.js.map +1 -0
- package/plugins/sqlite.d.ts +200 -0
- package/plugins/sqlite.d.ts.map +1 -0
- package/plugins/sqlite.js +2412 -0
- package/plugins/sqlite.js.map +1 -0
- package/port-manager/disguise/ssh.d.ts +19 -0
- package/port-manager/disguise/ssh.d.ts.map +1 -0
- package/port-manager/disguise/ssh.js +104 -0
- package/port-manager/disguise/ssh.js.map +1 -0
- package/port-manager/port-manager.d.ts +65 -0
- package/port-manager/port-manager.d.ts.map +1 -0
- package/port-manager/port-manager.js +164 -0
- package/port-manager/port-manager.js.map +1 -0
- package/port-manager/port-scanner.d.ts +22 -0
- package/port-manager/port-scanner.d.ts.map +1 -0
- package/port-manager/port-scanner.js +187 -0
- package/port-manager/port-scanner.js.map +1 -0
- package/port-manager/types.d.ts +51 -0
- package/port-manager/types.d.ts.map +1 -0
- package/port-manager/types.js +6 -0
- package/port-manager/types.js.map +1 -0
- package/proto/amino/amino.proto +84 -0
- package/proto/cosmos/base/v1beta1/coin.proto +61 -0
- package/proto/cosmos/msg/v1/msg.proto +30 -0
- package/proto/cosmos_proto/cosmos.proto +112 -0
- package/proto/gogoproto/gogo.proto +145 -0
- package/proto/google/protobuf/descriptor.proto +1218 -0
- package/proto/trustchain/economy/v1/params.proto +133 -0
- package/proto/trustchain/economy/v1/tx.proto +162 -0
- package/proto/trustchain/marketplace/v1/params.proto +64 -0
- package/proto/trustchain/marketplace/v1/product.proto +21 -0
- package/proto/trustchain/marketplace/v1/tx.proto +131 -0
- package/proto/trustchain/order/v1/params.proto +94 -0
- package/proto/trustchain/order/v1/tx.proto +156 -0
- package/proto/trustchain/serviceprovider/v1/paymentfact.proto +32 -0
- package/proto/trustchain/serviceprovider/v1/serviceprovider.proto +38 -0
- package/proto/trustchain/serviceprovider/v1/tx.proto +106 -0
- package/proto/trustchain/subchain/v1/params.proto +26 -0
- package/proto/trustchain/subchain/v1/pool.proto +53 -0
- package/proto/trustchain/subchain/v1/tx.proto +159 -0
- package/proto/trustchain/trustcoin/v1/business_scope.proto +126 -0
- package/proto/trustchain/trustcoin/v1/genesis.proto +33 -0
- package/proto/trustchain/trustcoin/v1/params.proto +86 -0
- package/proto/trustchain/trustcoin/v1/query.proto +95 -0
- package/proto/trustchain/trustcoin/v1/tx.proto +160 -0
- package/proto/trustchain/verification/v1/params.proto +46 -0
- package/proto/trustchain/verification/v1/tx.proto +126 -0
- package/proto/trustchain/verification/v1/verification.proto +105 -0
- package/relationship-chain-api.d.ts +13 -0
- package/relationship-chain-api.d.ts.map +1 -0
- package/relationship-chain-api.js +139 -0
- package/relationship-chain-api.js.map +1 -0
- package/relationship-chain.d.ts +90 -0
- package/relationship-chain.d.ts.map +1 -0
- package/relationship-chain.js +201 -0
- package/relationship-chain.js.map +1 -0
- package/routes/agent-pay.js +419 -0
- package/routes/agent-serviceprovider.js +183 -0
- package/routes/ai.d.ts +54 -0
- package/routes/ai.d.ts.map +1 -0
- package/routes/ai.js +293 -0
- package/routes/ai.js.map +1 -0
- package/routes/api-keys.d.ts +12 -0
- package/routes/api-keys.d.ts.map +1 -0
- package/routes/api-keys.js +163 -0
- package/routes/api-keys.js.map +1 -0
- package/routes/app-store.d.ts +12 -0
- package/routes/app-store.d.ts.map +1 -0
- package/routes/app-store.js +207 -0
- package/routes/app-store.js.map +1 -0
- package/routes/auth-management.d.ts +17 -0
- package/routes/auth-management.d.ts.map +1 -0
- package/routes/auth-management.js +257 -0
- package/routes/auth-management.js.map +1 -0
- package/routes/auth.d.ts +9 -0
- package/routes/auth.d.ts.map +1 -0
- package/routes/auth.js +846 -0
- package/routes/auth.js.map +1 -0
- package/routes/brand.d.ts +3 -0
- package/routes/brand.d.ts.map +1 -0
- package/routes/brand.js +109 -0
- package/routes/brand.js.map +1 -0
- package/routes/chain-registry.d.ts +11 -0
- package/routes/chain-registry.d.ts.map +1 -0
- package/routes/chain-registry.js +51 -0
- package/routes/chain-registry.js.map +1 -0
- package/routes/chain-writes-insurance.d.ts +17 -0
- package/routes/chain-writes-insurance.d.ts.map +1 -0
- package/routes/chain-writes-insurance.js +69 -0
- package/routes/chain-writes-insurance.js.map +1 -0
- package/routes/chain-writes-pledge.d.ts +34 -0
- package/routes/chain-writes-pledge.d.ts.map +1 -0
- package/routes/chain-writes-pledge.js +206 -0
- package/routes/chain-writes-pledge.js.map +1 -0
- package/routes/chain-writes-products.d.ts +66 -0
- package/routes/chain-writes-products.d.ts.map +1 -0
- package/routes/chain-writes-products.js +394 -0
- package/routes/chain-writes-products.js.map +1 -0
- package/routes/chain-writes.d.ts +78 -0
- package/routes/chain-writes.d.ts.map +1 -0
- package/routes/chain-writes.js +658 -0
- package/routes/chain-writes.js.map +1 -0
- package/routes/chain.d.ts +10 -0
- package/routes/chain.d.ts.map +1 -0
- package/routes/chain.js +45 -0
- package/routes/chain.js.map +1 -0
- package/routes/compliance.d.ts +3 -0
- package/routes/compliance.d.ts.map +1 -0
- package/routes/compliance.js +53 -0
- package/routes/compliance.js.map +1 -0
- package/routes/council.d.ts +3 -0
- package/routes/council.d.ts.map +1 -0
- package/routes/council.js +477 -0
- package/routes/council.js.map +1 -0
- package/routes/crosschain.d.ts +11 -0
- package/routes/crosschain.d.ts.map +1 -0
- package/routes/crosschain.js +39 -0
- package/routes/crosschain.js.map +1 -0
- package/routes/device.d.ts +3 -0
- package/routes/device.d.ts.map +1 -0
- package/routes/device.js +73 -0
- package/routes/device.js.map +1 -0
- package/routes/devreward.d.ts +54 -0
- package/routes/devreward.d.ts.map +1 -0
- package/routes/devreward.js +129 -0
- package/routes/devreward.js.map +1 -0
- package/routes/economy.d.ts +50 -0
- package/routes/economy.d.ts.map +1 -0
- package/routes/economy.js +273 -0
- package/routes/economy.js.map +1 -0
- package/routes/flowback.d.ts +32 -0
- package/routes/flowback.d.ts.map +1 -0
- package/routes/flowback.js +97 -0
- package/routes/flowback.js.map +1 -0
- package/routes/insurance.d.ts +10 -0
- package/routes/insurance.d.ts.map +1 -0
- package/routes/insurance.js +70 -0
- package/routes/insurance.js.map +1 -0
- package/routes/m2m-viewer.js +195 -0
- package/routes/m2m.d.ts +10 -0
- package/routes/m2m.d.ts.map +1 -0
- package/routes/m2m.js +31 -0
- package/routes/m2m.js.map +1 -0
- package/routes/marketplace.d.ts +15 -0
- package/routes/marketplace.d.ts.map +1 -0
- package/routes/marketplace.js +396 -0
- package/routes/marketplace.js.map +1 -0
- package/routes/node-config.d.ts +6 -0
- package/routes/node-config.d.ts.map +1 -0
- package/routes/node-config.js +500 -0
- package/routes/node-config.js.map +1 -0
- package/routes/oauth-revocation.d.ts +42 -0
- package/routes/oauth-revocation.d.ts.map +1 -0
- package/routes/oauth-revocation.js +99 -0
- package/routes/oauth-revocation.js.map +1 -0
- package/routes/oauth.d.ts +17 -0
- package/routes/oauth.d.ts.map +1 -0
- package/routes/oauth.js +700 -0
- package/routes/oauth.js.map +1 -0
- package/routes/onboard.html +352 -0
- package/routes/onboard.js +435 -0
- package/routes/order.d.ts +8 -0
- package/routes/order.d.ts.map +1 -0
- package/routes/order.js +607 -0
- package/routes/order.js.map +1 -0
- package/routes/p2p-api.d.ts +33 -0
- package/routes/p2p-api.d.ts.map +1 -0
- package/routes/p2p-api.js +274 -0
- package/routes/p2p-api.js.map +1 -0
- package/routes/p2p-message.d.ts +20 -0
- package/routes/p2p-message.d.ts.map +1 -0
- package/routes/p2p-message.js +237 -0
- package/routes/p2p-message.js.map +1 -0
- package/routes/peer.d.ts +22 -0
- package/routes/peer.d.ts.map +1 -0
- package/routes/peer.js +220 -0
- package/routes/peer.js.map +1 -0
- package/routes/plugins.d.ts +4 -0
- package/routes/plugins.d.ts.map +1 -0
- package/routes/plugins.js +138 -0
- package/routes/plugins.js.map +1 -0
- package/routes/port-manager.d.ts +6 -0
- package/routes/port-manager.d.ts.map +1 -0
- package/routes/port-manager.js +212 -0
- package/routes/port-manager.js.map +1 -0
- package/routes/relationship.d.ts +7 -0
- package/routes/relationship.d.ts.map +1 -0
- package/routes/relationship.js +314 -0
- package/routes/relationship.js.map +1 -0
- package/routes/relay.d.ts +3 -0
- package/routes/relay.d.ts.map +1 -0
- package/routes/relay.js +182 -0
- package/routes/relay.js.map +1 -0
- package/routes/reputation.d.ts +10 -0
- package/routes/reputation.d.ts.map +1 -0
- package/routes/reputation.js +141 -0
- package/routes/reputation.js.map +1 -0
- package/routes/reward.d.ts +3 -0
- package/routes/reward.d.ts.map +1 -0
- package/routes/reward.js +130 -0
- package/routes/reward.js.map +1 -0
- package/routes/security-monitoring.d.ts +12 -0
- package/routes/security-monitoring.d.ts.map +1 -0
- package/routes/security-monitoring.js +373 -0
- package/routes/security-monitoring.js.map +1 -0
- package/routes/shop.d.ts +8 -0
- package/routes/shop.d.ts.map +1 -0
- package/routes/shop.js +164 -0
- package/routes/shop.js.map +1 -0
- package/routes/social.d.ts +22 -0
- package/routes/social.d.ts.map +1 -0
- package/routes/social.js +95 -0
- package/routes/social.js.map +1 -0
- package/routes/subchain.d.ts +18 -0
- package/routes/subchain.d.ts.map +1 -0
- package/routes/subchain.js +106 -0
- package/routes/subchain.js.map +1 -0
- package/routes/trustcoin.d.ts +17 -0
- package/routes/trustcoin.d.ts.map +1 -0
- package/routes/trustcoin.js +149 -0
- package/routes/trustcoin.js.map +1 -0
- package/routes/twofa.d.ts +7 -0
- package/routes/twofa.d.ts.map +1 -0
- package/routes/twofa.js +105 -0
- package/routes/twofa.js.map +1 -0
- package/routes/verification.d.ts +8 -0
- package/routes/verification.d.ts.map +1 -0
- package/routes/verification.js +234 -0
- package/routes/verification.js.map +1 -0
- package/routes/wallet.d.ts +4 -0
- package/routes/wallet.d.ts.map +1 -0
- package/routes/wallet.js +770 -0
- package/routes/wallet.js.map +1 -0
- package/run-auth.d.ts +8 -0
- package/run-auth.d.ts.map +1 -0
- package/run-auth.js +82 -0
- package/run-auth.js.map +1 -0
- package/run-p2p-message.d.ts +8 -0
- package/run-p2p-message.d.ts.map +1 -0
- package/run-p2p-message.js +82 -0
- package/run-p2p-message.js.map +1 -0
- package/run-relationship.d.ts +12 -0
- package/run-relationship.d.ts.map +1 -0
- package/run-relationship.js +182 -0
- package/run-relationship.js.map +1 -0
- package/run-unified.d.ts +13 -0
- package/run-unified.d.ts.map +1 -0
- package/run-unified.js +1067 -0
- package/run-unified.js.map +1 -0
- package/run.d.ts +12 -0
- package/run.d.ts.map +1 -0
- package/run.js +889 -0
- package/run.js.map +1 -0
- package/search/ranking.d.ts +55 -0
- package/search/ranking.d.ts.map +1 -0
- package/search/ranking.js +67 -0
- package/search/ranking.js.map +1 -0
- package/shipping/base.d.ts +15 -0
- package/shipping/base.d.ts.map +1 -0
- package/shipping/base.js +39 -0
- package/shipping/base.js.map +1 -0
- package/shipping/index.d.ts +19 -0
- package/shipping/index.d.ts.map +1 -0
- package/shipping/index.js +72 -0
- package/shipping/index.js.map +1 -0
- package/shipping/sf-express/index.d.ts +23 -0
- package/shipping/sf-express/index.d.ts.map +1 -0
- package/shipping/sf-express/index.js +71 -0
- package/shipping/sf-express/index.js.map +1 -0
- package/shipping/template/index.d.ts +20 -0
- package/shipping/template/index.d.ts.map +1 -0
- package/shipping/template/index.js +74 -0
- package/shipping/template/index.js.map +1 -0
- package/shipping/types.d.ts +71 -0
- package/shipping/types.d.ts.map +1 -0
- package/shipping/types.js +6 -0
- package/shipping/types.js.map +1 -0
- package/shipping/virtual/index.d.ts +19 -0
- package/shipping/virtual/index.d.ts.map +1 -0
- package/shipping/virtual/index.js +54 -0
- package/shipping/virtual/index.js.map +1 -0
- package/shipping/yto/index.d.ts +18 -0
- package/shipping/yto/index.d.ts.map +1 -0
- package/shipping/yto/index.js +59 -0
- package/shipping/yto/index.js.map +1 -0
- package/shipping/zto/index.d.ts +18 -0
- package/shipping/zto/index.d.ts.map +1 -0
- package/shipping/zto/index.js +59 -0
- package/shipping/zto/index.js.map +1 -0
- package/skills-lock.json +11 -0
- package/src/db/email-migrations.sql +31 -0
- package/src/db/oauth-migrations.sql +92 -0
- package/src/db/social-migrations.sql +94 -0
- package/src/db/store-migrations.sql +242 -0
- package/test-api-key-revoke.js +167 -0
- package/test-auth-register-ratelimit.js +132 -0
- package/test-auth-tv2.d.ts +2 -0
- package/test-auth-tv2.d.ts.map +1 -0
- package/test-auth-tv2.js +174 -0
- package/test-auth-tv2.js.map +1 -0
- package/test-canonsign-cross.d.ts +2 -0
- package/test-canonsign-cross.d.ts.map +1 -0
- package/test-canonsign-cross.js +32 -0
- package/test-canonsign-cross.js.map +1 -0
- package/test-chain-signer.js +127 -0
- package/test-env-truthy.js +50 -0
- package/test-onboard-contract.js +94 -0
- package/test-ops-console-boundary.js +147 -0
- package/test-oracle-glue.js +232 -0
- package/test-order-create-v394.js +358 -0
- package/test-order-intent.js +245 -0
- package/test-order-lifecycle-v394.js +528 -0
- package/test-p2p-message.d.ts +13 -0
- package/test-p2p-message.d.ts.map +1 -0
- package/test-p2p-message.js +106 -0
- package/test-p2p-message.js.map +1 -0
- package/test-relationship-chain.d.ts +13 -0
- package/test-relationship-chain.d.ts.map +1 -0
- package/test-relationship-chain.js +103 -0
- package/test-relationship-chain.js.map +1 -0
- package/test-runtime-data-path.js +217 -0
- package/test-seller-identity.js +74 -0
- package/test-signing-paths.js +104 -0
- package/test-token-v2.d.ts +2 -0
- package/test-token-v2.d.ts.map +1 -0
- package/test-token-v2.js +172 -0
- package/test-token-v2.js.map +1 -0
- package/test-wallet-auth-nonce.d.ts +12 -0
- package/test-wallet-auth-nonce.d.ts.map +1 -0
- package/test-wallet-auth-nonce.js +126 -0
- package/test-wallet-auth-nonce.js.map +1 -0
- package/test-wallet-submatch.d.ts +13 -0
- package/test-wallet-submatch.d.ts.map +1 -0
- package/test-wallet-submatch.js +86 -0
- package/test-wallet-submatch.js.map +1 -0
- package/tls/self-signed.d.ts +12 -0
- package/tls/self-signed.d.ts.map +1 -0
- package/tls/self-signed.js +63 -0
- package/tls/self-signed.js.map +1 -0
- package/tools/brand.d.ts +11 -0
- package/tools/brand.d.ts.map +1 -0
- package/tools/brand.js +75 -0
- package/tools/brand.js.map +1 -0
- package/tools/chainregistry.d.ts +18 -0
- package/tools/chainregistry.d.ts.map +1 -0
- package/tools/chainregistry.js +175 -0
- package/tools/chainregistry.js.map +1 -0
- package/tools/compliance.d.ts +14 -0
- package/tools/compliance.d.ts.map +1 -0
- package/tools/compliance.js +45 -0
- package/tools/compliance.js.map +1 -0
- package/tools/council.d.ts +17 -0
- package/tools/council.d.ts.map +1 -0
- package/tools/council.js +75 -0
- package/tools/council.js.map +1 -0
- package/tools/device.d.ts +13 -0
- package/tools/device.d.ts.map +1 -0
- package/tools/device.js +45 -0
- package/tools/device.js.map +1 -0
- package/tools/devreward.d.ts +15 -0
- package/tools/devreward.d.ts.map +1 -0
- package/tools/devreward.js +190 -0
- package/tools/devreward.js.map +1 -0
- package/tools/economy.d.ts +14 -0
- package/tools/economy.d.ts.map +1 -0
- package/tools/economy.js +172 -0
- package/tools/economy.js.map +1 -0
- package/tools/flowback.d.ts +14 -0
- package/tools/flowback.d.ts.map +1 -0
- package/tools/flowback.js +146 -0
- package/tools/flowback.js.map +1 -0
- package/tools/insurance.d.ts +13 -0
- package/tools/insurance.d.ts.map +1 -0
- package/tools/insurance.js +45 -0
- package/tools/insurance.js.map +1 -0
- package/tools/marketplace.d.ts +12 -0
- package/tools/marketplace.d.ts.map +1 -0
- package/tools/marketplace.js +124 -0
- package/tools/marketplace.js.map +1 -0
- package/tools/order.d.ts +12 -0
- package/tools/order.d.ts.map +1 -0
- package/tools/order.js +94 -0
- package/tools/order.js.map +1 -0
- package/tools/recovery.d.ts +14 -0
- package/tools/recovery.d.ts.map +1 -0
- package/tools/recovery.js +158 -0
- package/tools/recovery.js.map +1 -0
- package/tools/relay.d.ts +15 -0
- package/tools/relay.d.ts.map +1 -0
- package/tools/relay.js +152 -0
- package/tools/relay.js.map +1 -0
- package/tools/reputation.d.ts +20 -0
- package/tools/reputation.d.ts.map +1 -0
- package/tools/reputation.js +50 -0
- package/tools/reputation.js.map +1 -0
- package/tools/reputation_seller_credit.d.ts +16 -0
- package/tools/reputation_seller_credit.d.ts.map +1 -0
- package/tools/reputation_seller_credit.js +106 -0
- package/tools/reputation_seller_credit.js.map +1 -0
- package/tools/reward.d.ts +14 -0
- package/tools/reward.d.ts.map +1 -0
- package/tools/reward.js +76 -0
- package/tools/reward.js.map +1 -0
- package/tools/shop.d.ts +14 -0
- package/tools/shop.d.ts.map +1 -0
- package/tools/shop.js +95 -0
- package/tools/shop.js.map +1 -0
- package/tools/verification.d.ts +12 -0
- package/tools/verification.d.ts.map +1 -0
- package/tools/verification.js +89 -0
- package/tools/verification.js.map +1 -0
- package/types/store.d.ts +255 -0
- package/types/store.d.ts.map +1 -0
- package/types/store.js +19 -0
- package/types/store.js.map +1 -0
- package/utils/aes-gcm.d.ts +63 -0
- package/utils/aes-gcm.d.ts.map +1 -0
- package/utils/aes-gcm.js +179 -0
- package/utils/aes-gcm.js.map +1 -0
- package/utils/api-response.d.ts +51 -0
- package/utils/api-response.d.ts.map +1 -0
- package/utils/api-response.js +65 -0
- package/utils/api-response.js.map +1 -0
- package/utils/base32.d.ts +5 -0
- package/utils/base32.d.ts.map +1 -0
- package/utils/base32.js +20 -0
- package/utils/base32.js.map +1 -0
- package/utils/crypto.d.ts +77 -0
- package/utils/crypto.d.ts.map +1 -0
- package/utils/crypto.js +164 -0
- package/utils/crypto.js.map +1 -0
- package/utils/encryption.d.ts +81 -0
- package/utils/encryption.d.ts.map +1 -0
- package/utils/encryption.js +247 -0
- package/utils/encryption.js.map +1 -0
- package/utils/env.js +20 -0
- package/utils/jwt.d.ts +110 -0
- package/utils/jwt.d.ts.map +1 -0
- package/utils/jwt.js +275 -0
- package/utils/jwt.js.map +1 -0
- package/utils/qrcode-reader.d.ts +22 -0
- package/utils/qrcode-reader.d.ts.map +1 -0
- package/utils/qrcode-reader.js +90 -0
- package/utils/qrcode-reader.js.map +1 -0
- package/utils/qrcode.d.ts +26 -0
- package/utils/qrcode.d.ts.map +1 -0
- package/utils/qrcode.js +92 -0
- package/utils/qrcode.js.map +1 -0
- package/utils/totp.d.ts +3 -0
- package/utils/totp.d.ts.map +1 -0
- package/utils/totp.js +58 -0
- package/utils/totp.js.map +1 -0
- package/utils/two-factor-auth.d.ts +16 -0
- package/utils/two-factor-auth.d.ts.map +1 -0
- package/utils/two-factor-auth.js +150 -0
- package/utils/two-factor-auth.js.map +1 -0
- package/verifyer/hsm.d.ts +70 -0
- package/verifyer/hsm.d.ts.map +1 -0
- package/verifyer/hsm.js +482 -0
- package/verifyer/hsm.js.map +1 -0
- package/verifyer/index.d.ts +81 -0
- package/verifyer/index.d.ts.map +1 -0
- package/verifyer/index.js +372 -0
- package/verifyer/index.js.map +1 -0
- package/ws/peer-monitor-broadcaster.d.ts +24 -0
- package/ws/peer-monitor-broadcaster.d.ts.map +1 -0
- package/ws/peer-monitor-broadcaster.js +56 -0
- package/ws/peer-monitor-broadcaster.js.map +1 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* OnChainEndpointRegistrar — 索引器端到链上 IndexerEndpoint 的注册器(PRD-F §3.2)
|
|
4
|
+
*
|
|
5
|
+
* 启动流程(一次):
|
|
6
|
+
* 1. loadOrGeneratePeerKey → PeerKeyPair (deterministic node_id)
|
|
7
|
+
* 2. resolveEndpoint → ipv6/ipv4/relay(config 优先,auto-detect 兜底)
|
|
8
|
+
* 3. signIndexerEndpoint → 65 字节 compact 签名
|
|
9
|
+
* 4. connectWithSigner(rpc, DirectSecp256k1Wallet, { registry })
|
|
10
|
+
* 5. signAndBroadcast(MsgRegisterIndexerEndpoint) → tx hash
|
|
11
|
+
*
|
|
12
|
+
* 定时流程(每 rebroadcast_hours):
|
|
13
|
+
* 重新做 2-5(IP 可能漂了;last_updated 必须推进才能过 keeper 的 24h 限制)
|
|
14
|
+
*
|
|
15
|
+
* 关闭流程(best-effort):
|
|
16
|
+
* signAndBroadcast(MsgUnregisterIndexerEndpoint),timeout 5s
|
|
17
|
+
*
|
|
18
|
+
* Why DirectSecp256k1Wallet + SIGN_MODE_DIRECT:
|
|
19
|
+
* - trustchaind 的 x/indexer 模块用 protobuf 注册(RegisterServices),不接受 amino
|
|
20
|
+
* - amino 签名对应 SIGN_MODE_LEGACY_AMINO_JSON;protobuf 签名对应 SIGN_MODE_DIRECT
|
|
21
|
+
* - 我们的 peer key 不是 HD 派生,DirectSecp256k1Wallet.fromKey 直接吃 32 字节
|
|
22
|
+
* - node_id 和 privkey 公钥派生的 bech32 必须一致(钱包 getAccounts 内部就是这条)
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.resolveEndpoint = resolveEndpoint;
|
|
26
|
+
exports.createOnChainEndpointRegistrar = createOnChainEndpointRegistrar;
|
|
27
|
+
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
28
|
+
const stargate_1 = require("@cosmjs/stargate");
|
|
29
|
+
const encoding_1 = require("@cosmjs/encoding");
|
|
30
|
+
const config_1 = require("./config");
|
|
31
|
+
const key_store_1 = require("./key-store");
|
|
32
|
+
const chain_signer_1 = require("./chain-signer");
|
|
33
|
+
const proto_codec_1 = require("./proto-codec");
|
|
34
|
+
const registry_1 = require("./registry");
|
|
35
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
36
|
+
// Endpoint auto-detection
|
|
37
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
38
|
+
const endpoint_registry_1 = require("../p2p/endpoint-registry");
|
|
39
|
+
/**
|
|
40
|
+
* Combine config + auto-detection to resolve the final endpoint triple.
|
|
41
|
+
*
|
|
42
|
+
* Priority:
|
|
43
|
+
* 1. config.peer.endpoint.{ipv6|ipv4|relay_id} explicit (non-empty)
|
|
44
|
+
* 2. override argument (testing)
|
|
45
|
+
* 3. detectLocalIPv6 / detectLocalIPv4 from p2p/endpoint-registry
|
|
46
|
+
*
|
|
47
|
+
* Returns empty strings for fields we could not resolve (the keeper requires
|
|
48
|
+
* AT LEAST one of ipv6/ipv4/relay_id to be non-empty).
|
|
49
|
+
*/
|
|
50
|
+
function resolveEndpoint(config, override) {
|
|
51
|
+
const port = config.port || 3004;
|
|
52
|
+
const cfg = config.endpoint || {};
|
|
53
|
+
const ovr = override || {};
|
|
54
|
+
return {
|
|
55
|
+
ipv6: ovr.ipv6 ?? ((cfg.ipv6 && cfg.ipv6.trim()) || (0, endpoint_registry_1.detectLocalIPv6)(port) || ''),
|
|
56
|
+
ipv4: ovr.ipv4 ?? ((cfg.ipv4 && cfg.ipv4.trim()) || (0, endpoint_registry_1.detectLocalIPv4)(port) || ''),
|
|
57
|
+
relay_id: ovr.relay_id ?? ((cfg.relay_id && cfg.relay_id.trim()) || ''),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
61
|
+
// Factory
|
|
62
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
63
|
+
/**
|
|
64
|
+
* Create a registrar. Does NOT broadcast — call register() once at startup.
|
|
65
|
+
*/
|
|
66
|
+
async function createOnChainEndpointRegistrar(opts) {
|
|
67
|
+
const log = opts.log || ((m) => console.log(`[peer-registrar] ${m}`));
|
|
68
|
+
const bech32 = opts.deps.bech32Prefix ?? config_1.BECH32_PREFIX;
|
|
69
|
+
// 1. Keypair
|
|
70
|
+
const kp = opts.deps.keyPair ?? await (0, key_store_1.loadOrGeneratePeerKey)({
|
|
71
|
+
keyPath: opts.config.signing_key_path,
|
|
72
|
+
prefix: bech32,
|
|
73
|
+
});
|
|
74
|
+
log(`node_id=${kp.nodeId} pubkey=${(0, encoding_1.toBase64)(kp.pubkey).slice(0, 12)}…`);
|
|
75
|
+
// 2. Endpoint
|
|
76
|
+
const endpoint = resolveEndpoint(opts.config, opts.endpointOverride);
|
|
77
|
+
log(`endpoint ipv6=${endpoint.ipv6 || '(none)'} ipv4=${endpoint.ipv4 || '(none)'} relay=${endpoint.relay_id || '(none)'}`);
|
|
78
|
+
if (!endpoint.ipv6 && !endpoint.ipv4 && !endpoint.relay_id) {
|
|
79
|
+
throw new Error('No endpoint addresses resolved (need at least one of ipv6/ipv4/relay_id). ' +
|
|
80
|
+
'Either set peer.endpoint.* in config or ensure the host has a routable IP.');
|
|
81
|
+
}
|
|
82
|
+
// 3. Build the chain form
|
|
83
|
+
// (公网端点自宣告 xiaomu 拍板: baseEp 改 let — 每次 register 前重 resolve, IP 漂移即时更新)
|
|
84
|
+
let baseEp = {
|
|
85
|
+
node_id: kp.nodeId,
|
|
86
|
+
chain_id: opts.deps.chainId,
|
|
87
|
+
version: opts.config.version,
|
|
88
|
+
public_key: kp.pubkey,
|
|
89
|
+
ipv6: endpoint.ipv6,
|
|
90
|
+
ipv4: endpoint.ipv4,
|
|
91
|
+
relay_id: endpoint.relay_id,
|
|
92
|
+
capabilities: opts.config.capabilities,
|
|
93
|
+
last_updated: Math.floor(Date.now() / 1000),
|
|
94
|
+
};
|
|
95
|
+
const signed = await (0, chain_signer_1.signIndexerEndpoint)(baseEp, kp);
|
|
96
|
+
log(`signed endpoint: ${signed.signature.length}-byte compact sig (recovery=${signed.signature[0]})`);
|
|
97
|
+
// 4. Stargate client (lazy — only connect when we actually broadcast)
|
|
98
|
+
let signingClient = null;
|
|
99
|
+
let queryClient = null;
|
|
100
|
+
let rebroadcastTimer = null;
|
|
101
|
+
async function getClients() {
|
|
102
|
+
if (signingClient && queryClient)
|
|
103
|
+
return { signing: signingClient, query: queryClient };
|
|
104
|
+
const wallet = await proto_signing_1.DirectSecp256k1Wallet.fromKey(kp.privkey, bech32);
|
|
105
|
+
const registry = (0, registry_1.buildIndexerRegistry)();
|
|
106
|
+
signingClient = await stargate_1.SigningStargateClient.connectWithSigner(opts.deps.rpcUrl, wallet,
|
|
107
|
+
// 宝贝 2026-06-23: signAndBroadcast fee="auto" 需要 client 体脚初始化时 GasPrice,
|
|
108
|
+
// 否则报 "Gas price must be set in the client options when auto gas is used."
|
|
109
|
+
{ registry, gasPrice: stargate_1.GasPrice.fromString('0.025utct') });
|
|
110
|
+
queryClient = await stargate_1.StargateClient.connect(opts.deps.rpcUrl);
|
|
111
|
+
log(`connected to ${opts.deps.rpcUrl} (chain ${opts.deps.chainId})`);
|
|
112
|
+
return { signing: signingClient, query: queryClient };
|
|
113
|
+
}
|
|
114
|
+
// 5. Register (with retry + exponential backoff)
|
|
115
|
+
// (公网端点自宣告: 每次 register 重 resolve 地址 — detectLocalIPv6/v4 每次调用重新检测, IP 漂移即时上链)
|
|
116
|
+
async function register() {
|
|
117
|
+
const freshEp = resolveEndpoint(opts.config, opts.endpointOverride);
|
|
118
|
+
// 更新 baseEp 地址字段 (kimi #15324 P2a: 有→无要清链上旧值, 不能永远留 stale).
|
|
119
|
+
// 之前 freshEp.x || baseEp.x 让地址消失时保留旧值 → 链上永远挂着已消失的 IP.
|
|
120
|
+
// 三字段全空时 (keeper 要求至少一个非空) 才用旧值兜底, 防止注册被 keeper 拒.
|
|
121
|
+
const anyFresh = !!(freshEp.ipv6 || freshEp.ipv4 || freshEp.relay_id);
|
|
122
|
+
baseEp = {
|
|
123
|
+
...baseEp,
|
|
124
|
+
ipv6: anyFresh ? freshEp.ipv6 : baseEp.ipv6,
|
|
125
|
+
ipv4: anyFresh ? freshEp.ipv4 : baseEp.ipv4,
|
|
126
|
+
relay_id: anyFresh ? freshEp.relay_id : baseEp.relay_id,
|
|
127
|
+
};
|
|
128
|
+
if (baseEp.ipv6 !== freshEp.ipv6 || baseEp.ipv4 !== freshEp.ipv4 || baseEp.relay_id !== freshEp.relay_id) {
|
|
129
|
+
log(`endpoint 地址更新: ipv6=${freshEp.ipv6 || '(none)'} ipv4=${freshEp.ipv4 || '(none)'} relay=${freshEp.relay_id || '(none)'}`);
|
|
130
|
+
}
|
|
131
|
+
const ep = { ...baseEp, last_updated: Math.floor(Date.now() / 1000) };
|
|
132
|
+
const freshSigned = await (0, chain_signer_1.signIndexerEndpoint)(ep, kp);
|
|
133
|
+
if (opts.deps.dryRun || opts.config.dry_run) {
|
|
134
|
+
log(`[dry-run] would broadcast MsgRegisterIndexerEndpoint ` +
|
|
135
|
+
`creator=${kp.nodeId} sig=${(0, encoding_1.toBase64)(freshSigned.signature).slice(0, 16)}…`);
|
|
136
|
+
return { txHash: 'DRY-RUN', height: 0, code: 0 };
|
|
137
|
+
}
|
|
138
|
+
const { signing } = await getClients();
|
|
139
|
+
const maxRetries = opts.config.max_retries ?? 3;
|
|
140
|
+
let lastErr = null;
|
|
141
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
142
|
+
try {
|
|
143
|
+
const result = await signing.signAndBroadcast(kp.nodeId, [
|
|
144
|
+
{
|
|
145
|
+
typeUrl: proto_codec_1.TYPE_URL_MSG_REGISTER,
|
|
146
|
+
value: { creator: kp.nodeId, endpoint: freshSigned },
|
|
147
|
+
},
|
|
148
|
+
], 'auto', `peer.register v${opts.config.version}`);
|
|
149
|
+
if (result.code !== 0) {
|
|
150
|
+
throw new Error(`tx failed code=${result.code} log=${result.rawLog}`);
|
|
151
|
+
}
|
|
152
|
+
log(`registered: tx=${result.transactionHash} height=${result.height}`);
|
|
153
|
+
return {
|
|
154
|
+
txHash: result.transactionHash,
|
|
155
|
+
height: result.height,
|
|
156
|
+
gasUsed: result.gasUsed,
|
|
157
|
+
code: result.code,
|
|
158
|
+
rawLog: result.rawLog,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
lastErr = e;
|
|
163
|
+
const delay = Math.min(2 ** attempt * 1000, 30_000);
|
|
164
|
+
log(`register attempt ${attempt}/${maxRetries} failed: ${e.message}; retrying in ${delay}ms`);
|
|
165
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
throw new Error(`register failed after ${maxRetries} attempts: ${String(lastErr)}`);
|
|
169
|
+
}
|
|
170
|
+
// 6. Unregister (best-effort, with hard timeout)
|
|
171
|
+
async function unregister() {
|
|
172
|
+
if (opts.deps.dryRun || opts.config.dry_run) {
|
|
173
|
+
log(`[dry-run] would broadcast MsgUnregisterIndexerEndpoint creator=${kp.nodeId}`);
|
|
174
|
+
return { txHash: 'DRY-RUN', height: 0, code: 0 };
|
|
175
|
+
}
|
|
176
|
+
const timeoutMs = opts.config.unregister_timeout_ms ?? 5000;
|
|
177
|
+
let timer = null;
|
|
178
|
+
try {
|
|
179
|
+
const { signing } = await getClients();
|
|
180
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
181
|
+
timer = setTimeout(() => reject(new Error(`unregister timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
182
|
+
});
|
|
183
|
+
const result = await Promise.race([
|
|
184
|
+
signing.signAndBroadcast(kp.nodeId, [{ typeUrl: proto_codec_1.TYPE_URL_MSG_UNREGISTER, value: { creator: kp.nodeId } }], 'auto', 'peer.unregister'),
|
|
185
|
+
timeoutPromise,
|
|
186
|
+
]);
|
|
187
|
+
log(`unregistered: tx=${result.transactionHash} height=${result.height}`);
|
|
188
|
+
return {
|
|
189
|
+
txHash: result.transactionHash,
|
|
190
|
+
height: result.height,
|
|
191
|
+
gasUsed: result.gasUsed,
|
|
192
|
+
code: result.code,
|
|
193
|
+
rawLog: result.rawLog,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
catch (e) {
|
|
197
|
+
log(`unregister failed (best-effort, ignored): ${e.message}`);
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
finally {
|
|
201
|
+
if (timer)
|
|
202
|
+
clearTimeout(timer);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// 7. Rebroadcast loop + 5min drift watcher (公网端点自宣告: 地址变了立即重注册, 不等 24h tick)
|
|
206
|
+
function startRebroadcastLoop() {
|
|
207
|
+
const ms = Math.max(1, opts.config.rebroadcast_hours) * 60 * 60 * 1000;
|
|
208
|
+
log(`rebroadcast loop: every ${opts.config.rebroadcast_hours}h (${ms}ms)`);
|
|
209
|
+
rebroadcastTimer = setInterval(() => {
|
|
210
|
+
register().catch((e) => log(`rebroadcast failed: ${e.message}`));
|
|
211
|
+
}, ms);
|
|
212
|
+
// Don't keep the event loop alive just for the rebroadcast
|
|
213
|
+
if (rebroadcastTimer.unref)
|
|
214
|
+
rebroadcastTimer.unref();
|
|
215
|
+
// 5min drift watcher: 纯本地重 resolve, 地址变化立即 register (链上即时更新)
|
|
216
|
+
const driftMs = (opts.config.drift_watcher_minutes ?? 5) * 60 * 1000;
|
|
217
|
+
let lastAddr = `${baseEp.ipv6}|${baseEp.ipv4}|${baseEp.relay_id}`;
|
|
218
|
+
const driftTimer = setInterval(async () => {
|
|
219
|
+
try {
|
|
220
|
+
const fresh = resolveEndpoint(opts.config, opts.endpointOverride);
|
|
221
|
+
const nowAddr = `${fresh.ipv6}|${fresh.ipv4}|${fresh.relay_id}`;
|
|
222
|
+
if (nowAddr !== lastAddr && (fresh.ipv6 || fresh.ipv4 || fresh.relay_id)) {
|
|
223
|
+
log(`drift watcher: 地址变化 ${lastAddr} → ${nowAddr}, 立即重注册`);
|
|
224
|
+
try {
|
|
225
|
+
await register();
|
|
226
|
+
lastAddr = nowAddr; // kimi #15324 P2b: 重注册成功才推进 lastAddr — 失败保留旧值, 下轮继续重试
|
|
227
|
+
}
|
|
228
|
+
catch (e) {
|
|
229
|
+
log(`drift 重注册失败 (不推进 lastAddr, 下轮重试): ${e?.message ?? e}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
catch (e) {
|
|
234
|
+
log(`drift watcher 检查失败: ${e?.message ?? e}`);
|
|
235
|
+
}
|
|
236
|
+
}, driftMs);
|
|
237
|
+
if (driftTimer.unref)
|
|
238
|
+
driftTimer.unref();
|
|
239
|
+
return () => {
|
|
240
|
+
if (rebroadcastTimer) {
|
|
241
|
+
clearInterval(rebroadcastTimer);
|
|
242
|
+
rebroadcastTimer = null;
|
|
243
|
+
}
|
|
244
|
+
clearInterval(driftTimer);
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
// 8. Shutdown
|
|
248
|
+
async function shutdown() {
|
|
249
|
+
if (rebroadcastTimer) {
|
|
250
|
+
clearInterval(rebroadcastTimer);
|
|
251
|
+
rebroadcastTimer = null;
|
|
252
|
+
}
|
|
253
|
+
if (signingClient) {
|
|
254
|
+
await signingClient.disconnect();
|
|
255
|
+
signingClient = null;
|
|
256
|
+
}
|
|
257
|
+
if (queryClient) {
|
|
258
|
+
await queryClient.disconnect();
|
|
259
|
+
queryClient = null;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
nodeId: () => kp.nodeId,
|
|
264
|
+
pubkey: () => kp.pubkey,
|
|
265
|
+
register,
|
|
266
|
+
unregister,
|
|
267
|
+
startRebroadcastLoop,
|
|
268
|
+
shutdown,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=registrar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registrar.js","sourceRoot":"","sources":["../../src/peer/registrar.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;AA8FH,0CAaC;AASD,wEA0OC;AA5VD,yDAA8D;AAC9D,+CAAmF;AACnF,+CAA4C;AAE5C,qCAA0D;AAC1D,2CAGqB;AACrB,iDAGwB;AACxB,+CAGuB;AACvB,yCAAkD;AA0DlD,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E,gEAA4E;AAE5E;;;;;;;;;;GAUG;AACH,SAAgB,eAAe,CAC7B,MAAkB,EAClB,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gBAAgB,EAAE,CAAC;gBACrB,aAAa,CAAC,gBAAgB,CAAC,CAAC;gBAChC,gBAAgB,GAAG,IAAI,CAAC;YAC1B,CAAC;YACD,aAAa,CAAC,UAAU,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC;IAED,cAAc;IACd,KAAK,UAAU,QAAQ;QACrB,IAAI,gBAAgB,EAAE,CAAC;YACrB,aAAa,CAAC,gBAAgB,CAAC,CAAC;YAChC,gBAAgB,GAAG,IAAI,CAAC;QAC1B,CAAC;QACD,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,aAAa,CAAC,UAAU,EAAE,CAAC;YACjC,aAAa,GAAG,IAAI,CAAC;QACvB,CAAC;QACD,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,WAAW,CAAC,UAAU,EAAE,CAAC;YAC/B,WAAW,GAAG,IAAI,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO;QACL,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,MAAM;QACvB,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,MAAM;QACvB,QAAQ;QACR,UAAU;QACV,oBAAoB;QACpB,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* protobufjs-backed GeneratedType for the 3 indexer messages.
|
|
3
|
+
*
|
|
4
|
+
* Why we still keep our hand-rolled encoder (proto-codec.ts):
|
|
5
|
+
* - It produces identical bytes; we use it as the oracle.
|
|
6
|
+
* - The GeneratedType below is what we register with @cosmjs/stargate's
|
|
7
|
+
* SigningStargateClient so the client knows how to encode msgs at broadcast
|
|
8
|
+
* time (it calls GeneratedType.encode → our Writer → bytes).
|
|
9
|
+
*
|
|
10
|
+
* We import `protobufjs/minimal` (not the full `protobufjs`) to keep bundle
|
|
11
|
+
* size small — we only need Writer and Reader; no descriptor reflection.
|
|
12
|
+
*
|
|
13
|
+
* GeneratedType is a union of multiple shapes in @cosmjs/proto-signing. We
|
|
14
|
+
* match the `TelescopeGeneratedType` shape (encode / decode / fromPartial)
|
|
15
|
+
* since it's the most permissive and accepted by every code path in stargate.
|
|
16
|
+
*/
|
|
17
|
+
import type { ChainIndexerEndpoint } from './chain-signer';
|
|
18
|
+
/**
|
|
19
|
+
* Sanity check: our GeneratedType.encode for MsgRegister must produce identical
|
|
20
|
+
* bytes to our hand-rolled encoder. We expose this for tests.
|
|
21
|
+
*/
|
|
22
|
+
export declare function encodeMsgRegisterViaRegistry(creator: string, endpoint: ChainIndexerEndpoint): Uint8Array;
|
|
23
|
+
export declare function encodeMsgUnregisterViaRegistry(creator: string): Uint8Array;
|
|
24
|
+
/** Compare two Uint8Arrays for equality. */
|
|
25
|
+
export declare function bytesEq(a: Uint8Array, b: Uint8Array): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Return a Registry pre-populated with all 3 of our message types.
|
|
28
|
+
* Pass to `SigningStargateClient.connectWithSigner(rpc, signer, { registry })`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildIndexerRegistry(): any;
|
|
31
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/peer/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAUH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAmG3D;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,oBAAoB,GAC7B,UAAU,CAEZ;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAE1E;AAED,4CAA4C;AAC5C,wBAAgB,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAI7D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,QAOnC"}
|
package/peer/registry.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* protobufjs-backed GeneratedType for the 3 indexer messages.
|
|
4
|
+
*
|
|
5
|
+
* Why we still keep our hand-rolled encoder (proto-codec.ts):
|
|
6
|
+
* - It produces identical bytes; we use it as the oracle.
|
|
7
|
+
* - The GeneratedType below is what we register with @cosmjs/stargate's
|
|
8
|
+
* SigningStargateClient so the client knows how to encode msgs at broadcast
|
|
9
|
+
* time (it calls GeneratedType.encode → our Writer → bytes).
|
|
10
|
+
*
|
|
11
|
+
* We import `protobufjs/minimal` (not the full `protobufjs`) to keep bundle
|
|
12
|
+
* size small — we only need Writer and Reader; no descriptor reflection.
|
|
13
|
+
*
|
|
14
|
+
* GeneratedType is a union of multiple shapes in @cosmjs/proto-signing. We
|
|
15
|
+
* match the `TelescopeGeneratedType` shape (encode / decode / fromPartial)
|
|
16
|
+
* since it's the most permissive and accepted by every code path in stargate.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.encodeMsgRegisterViaRegistry = encodeMsgRegisterViaRegistry;
|
|
20
|
+
exports.encodeMsgUnregisterViaRegistry = encodeMsgUnregisterViaRegistry;
|
|
21
|
+
exports.bytesEq = bytesEq;
|
|
22
|
+
exports.buildIndexerRegistry = buildIndexerRegistry;
|
|
23
|
+
const minimal_1 = require("protobufjs/minimal");
|
|
24
|
+
const proto_codec_1 = require("./proto-codec");
|
|
25
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
26
|
+
// IndexerEndpoint
|
|
27
|
+
// message IndexerEndpoint {
|
|
28
|
+
// string node_id = 1;
|
|
29
|
+
// string chain_id = 2;
|
|
30
|
+
// string version = 3;
|
|
31
|
+
// bytes public_key = 4;
|
|
32
|
+
// string ipv6 = 5;
|
|
33
|
+
// string ipv4 = 6;
|
|
34
|
+
// string relay_id = 7;
|
|
35
|
+
// repeated string capabilities = 8;
|
|
36
|
+
// int64 last_updated = 9;
|
|
37
|
+
// bytes signature = 10;
|
|
38
|
+
// }
|
|
39
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
40
|
+
const IndexerEndpointType = {
|
|
41
|
+
encode: (message, writer) => {
|
|
42
|
+
const w = writer ?? minimal_1.Writer.create();
|
|
43
|
+
const ep = message;
|
|
44
|
+
if (ep.node_id !== undefined)
|
|
45
|
+
w.uint32((1 << 3) | 2).string(ep.node_id);
|
|
46
|
+
if (ep.chain_id !== undefined)
|
|
47
|
+
w.uint32((2 << 3) | 2).string(ep.chain_id);
|
|
48
|
+
if (ep.version !== undefined)
|
|
49
|
+
w.uint32((3 << 3) | 2).string(ep.version);
|
|
50
|
+
if (ep.public_key !== undefined)
|
|
51
|
+
w.uint32((4 << 3) | 2).bytes(ep.public_key);
|
|
52
|
+
if (ep.ipv6 !== undefined)
|
|
53
|
+
w.uint32((5 << 3) | 2).string(ep.ipv6);
|
|
54
|
+
if (ep.ipv4 !== undefined)
|
|
55
|
+
w.uint32((6 << 3) | 2).string(ep.ipv4);
|
|
56
|
+
if (ep.relay_id !== undefined)
|
|
57
|
+
w.uint32((7 << 3) | 2).string(ep.relay_id);
|
|
58
|
+
if (ep.capabilities) {
|
|
59
|
+
for (const c of ep.capabilities)
|
|
60
|
+
w.uint32((8 << 3) | 2).string(c);
|
|
61
|
+
}
|
|
62
|
+
if (ep.last_updated !== undefined && ep.last_updated !== null) {
|
|
63
|
+
w.uint32((9 << 3) | 0).int64(ep.last_updated);
|
|
64
|
+
}
|
|
65
|
+
if (ep.signature !== undefined)
|
|
66
|
+
w.uint32((10 << 3) | 2).bytes(ep.signature);
|
|
67
|
+
return w;
|
|
68
|
+
},
|
|
69
|
+
decode: () => { throw new Error('IndexerEndpoint.decode not used on send path'); },
|
|
70
|
+
// 宝贝 2026-06-23: cosmjs 0.32+ Registry.encode 会先调 fromPartial 透传,所以必须返回 msg
|
|
71
|
+
// 历史上写死 throw "not used" 会让 SigningStargateClient.simulate / signAndBroadcast 全炸
|
|
72
|
+
fromPartial: (msg) => msg,
|
|
73
|
+
};
|
|
74
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
75
|
+
// MsgRegisterIndexerEndpoint
|
|
76
|
+
// message MsgRegisterIndexerEndpoint {
|
|
77
|
+
// string creator = 1;
|
|
78
|
+
// IndexerEndpoint endpoint = 2;
|
|
79
|
+
// }
|
|
80
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
81
|
+
const MsgRegisterType = {
|
|
82
|
+
encode: (message, writer) => {
|
|
83
|
+
const w = writer ?? minimal_1.Writer.create();
|
|
84
|
+
if (message.creator !== undefined)
|
|
85
|
+
w.uint32((1 << 3) | 2).string(message.creator);
|
|
86
|
+
if (message.endpoint !== undefined) {
|
|
87
|
+
const inner = (0, proto_codec_1.encodeIndexerEndpoint)(message.endpoint);
|
|
88
|
+
w.uint32((2 << 3) | 2).bytes(inner);
|
|
89
|
+
}
|
|
90
|
+
return w;
|
|
91
|
+
},
|
|
92
|
+
decode: () => { throw new Error('MsgRegister.decode not used'); },
|
|
93
|
+
// 宝贝 2026-06-23: cosmjs simulate 必须能调 fromPartial → encode 链路;透传即可
|
|
94
|
+
fromPartial: (msg) => msg,
|
|
95
|
+
};
|
|
96
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
97
|
+
// MsgUnregisterIndexerEndpoint
|
|
98
|
+
// message MsgUnregisterIndexerEndpoint {
|
|
99
|
+
// string creator = 1;
|
|
100
|
+
// }
|
|
101
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
102
|
+
const MsgUnregisterType = {
|
|
103
|
+
encode: (message, writer) => {
|
|
104
|
+
const w = writer ?? minimal_1.Writer.create();
|
|
105
|
+
if (message.creator !== undefined)
|
|
106
|
+
w.uint32((1 << 3) | 2).string(message.creator);
|
|
107
|
+
return w;
|
|
108
|
+
},
|
|
109
|
+
decode: () => { throw new Error('MsgUnregister.decode not used'); },
|
|
110
|
+
fromPartial: (msg) => msg,
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Sanity check: our GeneratedType.encode for MsgRegister must produce identical
|
|
114
|
+
* bytes to our hand-rolled encoder. We expose this for tests.
|
|
115
|
+
*/
|
|
116
|
+
function encodeMsgRegisterViaRegistry(creator, endpoint) {
|
|
117
|
+
return MsgRegisterType.encode({ creator, endpoint }).finish();
|
|
118
|
+
}
|
|
119
|
+
function encodeMsgUnregisterViaRegistry(creator) {
|
|
120
|
+
return MsgUnregisterType.encode({ creator }).finish();
|
|
121
|
+
}
|
|
122
|
+
/** Compare two Uint8Arrays for equality. */
|
|
123
|
+
function bytesEq(a, b) {
|
|
124
|
+
if (a.length !== b.length)
|
|
125
|
+
return false;
|
|
126
|
+
for (let i = 0; i < a.length; i++)
|
|
127
|
+
if (a[i] !== b[i])
|
|
128
|
+
return false;
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Return a Registry pre-populated with all 3 of our message types.
|
|
133
|
+
* Pass to `SigningStargateClient.connectWithSigner(rpc, signer, { registry })`.
|
|
134
|
+
*/
|
|
135
|
+
function buildIndexerRegistry() {
|
|
136
|
+
const { Registry } = require('@cosmjs/proto-signing');
|
|
137
|
+
const registry = new Registry();
|
|
138
|
+
registry.register(proto_codec_1.TYPE_URL_INDEXER_ENDPOINT, IndexerEndpointType);
|
|
139
|
+
registry.register(proto_codec_1.TYPE_URL_MSG_REGISTER, MsgRegisterType);
|
|
140
|
+
registry.register(proto_codec_1.TYPE_URL_MSG_UNREGISTER, MsgUnregisterType);
|
|
141
|
+
return registry;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/peer/registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAiHH,oEAKC;AAED,wEAEC;AAGD,0BAIC;AAMD,oDAOC;AA5ID,gDAA4C;AAE5C,+CAKuB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AC,CAAC;IAC9D,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Plugin - 统一身份认证插件
|
|
3
|
+
*
|
|
4
|
+
* 功能:
|
|
5
|
+
* 1. 用户注册与登录
|
|
6
|
+
* 2. JWT 令牌管理
|
|
7
|
+
* 3. OAuth 2.0 授权流程
|
|
8
|
+
* 4. 权限验证
|
|
9
|
+
* 5. 2FA 双因素认证
|
|
10
|
+
*/
|
|
11
|
+
import { EventEmitter } from 'events';
|
|
12
|
+
export interface User {
|
|
13
|
+
id: string;
|
|
14
|
+
username: string;
|
|
15
|
+
email: string;
|
|
16
|
+
address: string;
|
|
17
|
+
avatar?: string;
|
|
18
|
+
bio?: string;
|
|
19
|
+
website?: string;
|
|
20
|
+
twitter?: string;
|
|
21
|
+
github?: string;
|
|
22
|
+
createdAt: number;
|
|
23
|
+
updatedAt: number;
|
|
24
|
+
lastLoginAt?: number;
|
|
25
|
+
isActive: boolean;
|
|
26
|
+
two_factor_enabled?: boolean;
|
|
27
|
+
two_factor_secret?: string;
|
|
28
|
+
two_factor_backup_codes?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface OAuthApp {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
clientId: string;
|
|
35
|
+
clientSecretHash: string;
|
|
36
|
+
redirectUris: string[];
|
|
37
|
+
scopes: string[];
|
|
38
|
+
ownerAddress: string;
|
|
39
|
+
createdAt: number;
|
|
40
|
+
updatedAt: number;
|
|
41
|
+
isActive: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface AuthToken {
|
|
44
|
+
accessToken: string;
|
|
45
|
+
refreshToken: string;
|
|
46
|
+
userId: string;
|
|
47
|
+
clientId?: string;
|
|
48
|
+
scopes: string[];
|
|
49
|
+
expiresAt: number;
|
|
50
|
+
createdAt: number;
|
|
51
|
+
}
|
|
52
|
+
export interface AuthPluginConfig {
|
|
53
|
+
dbPath?: string;
|
|
54
|
+
jwtSecret?: string;
|
|
55
|
+
accessTokenExpiry?: number;
|
|
56
|
+
refreshTokenExpiry?: number;
|
|
57
|
+
/**
|
|
58
|
+
* R2-2 第一方 token v2(kimi 14303 拍板:A+B 全做,grant 现场签):
|
|
59
|
+
* 配置了即登录/注册发 tv2 结构化令牌(跨节点 session 不失效)。
|
|
60
|
+
* 同 R2-1 基建:token-v2 签发 + S4 tv2h 存储 + grant 现场签验证。
|
|
61
|
+
*/
|
|
62
|
+
tokenV2?: {
|
|
63
|
+
issuerPrivkey: Uint8Array;
|
|
64
|
+
issuerNodeId: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* AuthPlugin - 统一身份认证插件
|
|
69
|
+
*/
|
|
70
|
+
export declare class AuthPlugin extends EventEmitter {
|
|
71
|
+
private db;
|
|
72
|
+
private config;
|
|
73
|
+
private initialized;
|
|
74
|
+
private jwtSecret;
|
|
75
|
+
constructor(config?: AuthPluginConfig);
|
|
76
|
+
init(dbPath?: string): Promise<void>;
|
|
77
|
+
private createTables;
|
|
78
|
+
register(username: string, email: string, password: string, grant?: any, grantSig?: string): Promise<any>;
|
|
79
|
+
login(usernameOrEmail: string, password: string, twoFACode?: string, grant?: any, grantSig?: string): Promise<any>;
|
|
80
|
+
getUser(userId: string): Promise<User | null>;
|
|
81
|
+
private generateTokens;
|
|
82
|
+
/**
|
|
83
|
+
* R2-2 范围 A: 校验登录携带的 grant 现场签(sub 必须等于该用户链上地址,
|
|
84
|
+
* scopes/iss 一致性检查)——签名由客户端钱包当场作出,服务端只验。
|
|
85
|
+
* 通过返回 grant 供 generateTokens 发 tv2;不通过抛错。
|
|
86
|
+
*/
|
|
87
|
+
private validateGrantForUser;
|
|
88
|
+
private generateMnemonic;
|
|
89
|
+
private encryptMnemonic;
|
|
90
|
+
/**
|
|
91
|
+
* 生成 2FA 密钥
|
|
92
|
+
*/
|
|
93
|
+
generate2FASecret(userId: string): Promise<{
|
|
94
|
+
qrCodeUrl: string;
|
|
95
|
+
secret: string;
|
|
96
|
+
backupCodes: string[];
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* 启用 2FA
|
|
100
|
+
*/
|
|
101
|
+
enable2FA(userId: string, secret: string, code: string): Promise<boolean>;
|
|
102
|
+
/**
|
|
103
|
+
* 禁用 2FA
|
|
104
|
+
*/
|
|
105
|
+
disable2FA(userId: string, password: string, code?: string): Promise<boolean>;
|
|
106
|
+
/**
|
|
107
|
+
* 验证 2FA 码
|
|
108
|
+
*/
|
|
109
|
+
verify2FA(userId: string, code: string): Promise<boolean>;
|
|
110
|
+
/**
|
|
111
|
+
* 验证令牌
|
|
112
|
+
*/
|
|
113
|
+
verifyToken(token: string): Promise<{
|
|
114
|
+
userId: string;
|
|
115
|
+
scopes: string[];
|
|
116
|
+
} | null>;
|
|
117
|
+
/**
|
|
118
|
+
* 更新用户信息
|
|
119
|
+
*/
|
|
120
|
+
updateUser(userId: string, updates: Partial<User>): Promise<User>;
|
|
121
|
+
/**
|
|
122
|
+
* 修改密码
|
|
123
|
+
*/
|
|
124
|
+
changePassword(userId: string, oldPassword: string, newPassword: string): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* 刷新访问令牌
|
|
127
|
+
*/
|
|
128
|
+
refreshAccessToken(refreshToken: string): Promise<{
|
|
129
|
+
accessToken: string;
|
|
130
|
+
refreshToken: string;
|
|
131
|
+
} | null>;
|
|
132
|
+
/**
|
|
133
|
+
* 撤销令牌
|
|
134
|
+
*/
|
|
135
|
+
revokeToken(token: string): Promise<boolean>;
|
|
136
|
+
/**
|
|
137
|
+
* 解密 mnemonic
|
|
138
|
+
*/
|
|
139
|
+
decryptMnemonic(encrypted: string, password: string): string;
|
|
140
|
+
/**
|
|
141
|
+
* 测试助记词加密/解密功能
|
|
142
|
+
*/
|
|
143
|
+
testMnemonicEncryption(): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* 从助记词派生私钥
|
|
146
|
+
* 使用 Cosmos 标准路径: m/44'/118'/0'/0/0
|
|
147
|
+
*
|
|
148
|
+
* @param mnemonic - 助记词
|
|
149
|
+
* @returns 派生的私钥(hex格式)
|
|
150
|
+
*/
|
|
151
|
+
derivePrivateKeyFromMnemonic(mnemonic: string): string;
|
|
152
|
+
/**
|
|
153
|
+
* 解密 Web3 Keystore
|
|
154
|
+
*/
|
|
155
|
+
private decryptWeb3Keystore;
|
|
156
|
+
/**
|
|
157
|
+
* 创建 Web3 Keystore
|
|
158
|
+
*/
|
|
159
|
+
private createWeb3Keystore;
|
|
160
|
+
/**
|
|
161
|
+
* 钱包导入登录
|
|
162
|
+
*/
|
|
163
|
+
importLogin(address: string, newPassword?: string, mnemonic?: string, privateKey?: string): Promise<{
|
|
164
|
+
token: string;
|
|
165
|
+
user: any;
|
|
166
|
+
}>;
|
|
167
|
+
/**
|
|
168
|
+
* 从助记词派生地址
|
|
169
|
+
*/
|
|
170
|
+
deriveAddressFromMnemonic(mnemonic: string): string;
|
|
171
|
+
/**
|
|
172
|
+
* Bech32 编码辅助函数
|
|
173
|
+
*/
|
|
174
|
+
private bech32ToWords;
|
|
175
|
+
/**
|
|
176
|
+
* Bech32 编码
|
|
177
|
+
*/
|
|
178
|
+
private bech32Encode;
|
|
179
|
+
/**
|
|
180
|
+
* Bech32 polymod
|
|
181
|
+
*/
|
|
182
|
+
private bech32Polymod;
|
|
183
|
+
/**
|
|
184
|
+
* Bech32 expand HRP
|
|
185
|
+
*/
|
|
186
|
+
private bech32ExpandHrp;
|
|
187
|
+
/**
|
|
188
|
+
* 验证密码强度
|
|
189
|
+
*/
|
|
190
|
+
validatePasswordStrength(password: string): boolean;
|
|
191
|
+
close(): Promise<void>;
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=auth.d.ts.map
|