@varity-labs/sdk 2.0.0-alpha.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/LICENSE +31 -0
- package/README.md +253 -0
- package/dist/analytics/index.d.ts +7 -0
- package/dist/analytics/index.d.ts.map +1 -0
- package/dist/analytics/index.js +6 -0
- package/dist/analytics/tracker.d.ts +128 -0
- package/dist/analytics/tracker.d.ts.map +1 -0
- package/dist/analytics/tracker.js +203 -0
- package/dist/blockchain/BlockchainService.d.ts +100 -0
- package/dist/blockchain/BlockchainService.d.ts.map +1 -0
- package/dist/blockchain/BlockchainService.js +188 -0
- package/dist/blockchain/NFTLicensingService.d.ts +69 -0
- package/dist/blockchain/NFTLicensingService.d.ts.map +1 -0
- package/dist/blockchain/NFTLicensingService.js +136 -0
- package/dist/blockchain/RevenueSplitService.d.ts +71 -0
- package/dist/blockchain/RevenueSplitService.d.ts.map +1 -0
- package/dist/blockchain/RevenueSplitService.js +111 -0
- package/dist/blockchain/index.d.ts +48 -0
- package/dist/blockchain/index.d.ts.map +1 -0
- package/dist/blockchain/index.js +46 -0
- package/dist/blockchain/types.d.ts +63 -0
- package/dist/blockchain/types.d.ts.map +1 -0
- package/dist/blockchain/types.js +6 -0
- package/dist/chains/arbitrum.d.ts +89 -0
- package/dist/chains/arbitrum.d.ts.map +1 -0
- package/dist/chains/arbitrum.js +134 -0
- package/dist/chains/base.d.ts +84 -0
- package/dist/chains/base.d.ts.map +1 -0
- package/dist/chains/base.js +131 -0
- package/dist/chains/index.d.ts +36 -0
- package/dist/chains/index.d.ts.map +1 -0
- package/dist/chains/index.js +32 -0
- package/dist/chains/registry.d.ts +113 -0
- package/dist/chains/registry.d.ts.map +1 -0
- package/dist/chains/registry.js +201 -0
- package/dist/chains/varityL3.d.ts +81 -0
- package/dist/chains/varityL3.d.ts.map +1 -0
- package/dist/chains/varityL3.js +125 -0
- package/dist/cli/commands/clone.d.ts +8 -0
- package/dist/cli/commands/clone.d.ts.map +1 -0
- package/dist/cli/commands/clone.js +391 -0
- package/dist/cli/commands/dev.d.ts +8 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +40 -0
- package/dist/cli/commands/generate.d.ts +8 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +303 -0
- package/dist/cli/commands/init.d.ts +8 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +317 -0
- package/dist/cli/commands/validate.d.ts +8 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +69 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +33 -0
- package/dist/cli/utils/logger.d.ts +17 -0
- package/dist/cli/utils/logger.d.ts.map +1 -0
- package/dist/cli/utils/logger.js +35 -0
- package/dist/cli/utils/prompts.d.ts +21 -0
- package/dist/cli/utils/prompts.d.ts.map +1 -0
- package/dist/cli/utils/prompts.js +103 -0
- package/dist/contracts/abis/iso/AccessControlRegistry.json +1468 -0
- package/dist/contracts/abis/iso/DataProofRegistry.json +797 -0
- package/dist/contracts/abis/iso/MerchantRegistry.json +1237 -0
- package/dist/contracts/abis/iso/RepPerformance.json +1351 -0
- package/dist/contracts/abis/iso/ResidualCalculator.json +1118 -0
- package/dist/contracts/abis/iso/TransactionVault.json +1588 -0
- package/dist/contracts/abis/iso/VarityWalletFactory.json +475 -0
- package/dist/contracts/addresses.d.ts +88 -0
- package/dist/contracts/addresses.d.ts.map +1 -0
- package/dist/contracts/addresses.js +94 -0
- package/dist/contracts/index.d.ts +7 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +6 -0
- package/dist/core/VaritySDK.d.ts +177 -0
- package/dist/core/VaritySDK.d.ts.map +1 -0
- package/dist/core/VaritySDK.js +325 -0
- package/dist/core/config.d.ts +120 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +187 -0
- package/dist/core/credentials-proxy.d.ts +157 -0
- package/dist/core/credentials-proxy.d.ts.map +1 -0
- package/dist/core/credentials-proxy.js +345 -0
- package/dist/core/credentials.d.ts +219 -0
- package/dist/core/credentials.d.ts.map +1 -0
- package/dist/core/credentials.js +345 -0
- package/dist/core/template-loader.d.ts +15 -0
- package/dist/core/template-loader.d.ts.map +1 -0
- package/dist/core/template-loader.js +380 -0
- package/dist/core/template.d.ts +321 -0
- package/dist/core/template.d.ts.map +1 -0
- package/dist/core/template.js +189 -0
- package/dist/core/types.d.ts +572 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +52 -0
- package/dist/dev/dev-server.d.ts +16 -0
- package/dist/dev/dev-server.d.ts.map +1 -0
- package/dist/dev/dev-server.js +119 -0
- package/dist/generators/contracts/generator.d.ts +21 -0
- package/dist/generators/contracts/generator.d.ts.map +1 -0
- package/dist/generators/contracts/generator.js +252 -0
- package/dist/generators/tests/generator.d.ts +20 -0
- package/dist/generators/tests/generator.d.ts.map +1 -0
- package/dist/generators/tests/generator.js +375 -0
- package/dist/generators/types/generator.d.ts +19 -0
- package/dist/generators/types/generator.d.ts.map +1 -0
- package/dist/generators/types/generator.js +165 -0
- package/dist/generators/ui/component-generator.d.ts +20 -0
- package/dist/generators/ui/component-generator.d.ts.map +1 -0
- package/dist/generators/ui/component-generator.js +749 -0
- package/dist/generators/ui/dashboard-generator.d.ts +20 -0
- package/dist/generators/ui/dashboard-generator.d.ts.map +1 -0
- package/dist/generators/ui/dashboard-generator.js +349 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/modules/analytics/AnalyticsModule.d.ts +349 -0
- package/dist/modules/analytics/AnalyticsModule.d.ts.map +1 -0
- package/dist/modules/analytics/AnalyticsModule.js +274 -0
- package/dist/modules/analytics/index.d.ts +3 -0
- package/dist/modules/analytics/index.d.ts.map +1 -0
- package/dist/modules/analytics/index.js +1 -0
- package/dist/modules/auth/AccessKeyModule.d.ts +189 -0
- package/dist/modules/auth/AccessKeyModule.d.ts.map +1 -0
- package/dist/modules/auth/AccessKeyModule.js +322 -0
- package/dist/modules/auth/AuthModule.d.ts +133 -0
- package/dist/modules/auth/AuthModule.d.ts.map +1 -0
- package/dist/modules/auth/AuthModule.js +214 -0
- package/dist/modules/auth/index.d.ts +8 -0
- package/dist/modules/auth/index.d.ts.map +1 -0
- package/dist/modules/auth/index.js +6 -0
- package/dist/modules/cache/CacheModule.d.ts +279 -0
- package/dist/modules/cache/CacheModule.d.ts.map +1 -0
- package/dist/modules/cache/CacheModule.js +493 -0
- package/dist/modules/cache/index.d.ts +3 -0
- package/dist/modules/cache/index.d.ts.map +1 -0
- package/dist/modules/cache/index.js +1 -0
- package/dist/modules/compute/ComputeModule.d.ts +226 -0
- package/dist/modules/compute/ComputeModule.d.ts.map +1 -0
- package/dist/modules/compute/ComputeModule.js +379 -0
- package/dist/modules/compute/index.d.ts +6 -0
- package/dist/modules/compute/index.d.ts.map +1 -0
- package/dist/modules/compute/index.js +4 -0
- package/dist/modules/contracts/ContractsModule.d.ts +164 -0
- package/dist/modules/contracts/ContractsModule.d.ts.map +1 -0
- package/dist/modules/contracts/ContractsModule.js +242 -0
- package/dist/modules/contracts/index.d.ts +6 -0
- package/dist/modules/contracts/index.d.ts.map +1 -0
- package/dist/modules/contracts/index.js +4 -0
- package/dist/modules/export/ExportModule.d.ts +346 -0
- package/dist/modules/export/ExportModule.d.ts.map +1 -0
- package/dist/modules/export/ExportModule.js +432 -0
- package/dist/modules/export/index.d.ts +3 -0
- package/dist/modules/export/index.d.ts.map +1 -0
- package/dist/modules/export/index.js +1 -0
- package/dist/modules/forecasting/ForecastingModule.d.ts +579 -0
- package/dist/modules/forecasting/ForecastingModule.d.ts.map +1 -0
- package/dist/modules/forecasting/ForecastingModule.js +310 -0
- package/dist/modules/forecasting/index.d.ts +3 -0
- package/dist/modules/forecasting/index.d.ts.map +1 -0
- package/dist/modules/forecasting/index.js +1 -0
- package/dist/modules/monitoring/MonitoringModule.d.ts +359 -0
- package/dist/modules/monitoring/MonitoringModule.d.ts.map +1 -0
- package/dist/modules/monitoring/MonitoringModule.js +483 -0
- package/dist/modules/monitoring/index.d.ts +3 -0
- package/dist/modules/monitoring/index.d.ts.map +1 -0
- package/dist/modules/monitoring/index.js +1 -0
- package/dist/modules/notifications/NotificationsModule.d.ts +336 -0
- package/dist/modules/notifications/NotificationsModule.d.ts.map +1 -0
- package/dist/modules/notifications/NotificationsModule.js +418 -0
- package/dist/modules/notifications/index.d.ts +3 -0
- package/dist/modules/notifications/index.d.ts.map +1 -0
- package/dist/modules/notifications/index.js +1 -0
- package/dist/modules/oracle/OracleModule.d.ts +110 -0
- package/dist/modules/oracle/OracleModule.d.ts.map +1 -0
- package/dist/modules/oracle/OracleModule.js +151 -0
- package/dist/modules/oracle/index.d.ts +6 -0
- package/dist/modules/oracle/index.d.ts.map +1 -0
- package/dist/modules/oracle/index.js +4 -0
- package/dist/modules/storage/S3Module.d.ts +377 -0
- package/dist/modules/storage/S3Module.d.ts.map +1 -0
- package/dist/modules/storage/S3Module.js +680 -0
- package/dist/modules/storage/StorageModule.d.ts +157 -0
- package/dist/modules/storage/StorageModule.d.ts.map +1 -0
- package/dist/modules/storage/StorageModule.js +302 -0
- package/dist/modules/storage/adapters/AdapterFactory.d.ts +100 -0
- package/dist/modules/storage/adapters/AdapterFactory.d.ts.map +1 -0
- package/dist/modules/storage/adapters/AdapterFactory.js +209 -0
- package/dist/modules/storage/adapters/FilecoinAdapter.d.ts +94 -0
- package/dist/modules/storage/adapters/FilecoinAdapter.d.ts.map +1 -0
- package/dist/modules/storage/adapters/FilecoinAdapter.js +263 -0
- package/dist/modules/storage/adapters/IStorageAdapter.d.ts +287 -0
- package/dist/modules/storage/adapters/IStorageAdapter.d.ts.map +1 -0
- package/dist/modules/storage/adapters/IStorageAdapter.js +81 -0
- package/dist/modules/storage/adapters/MultiTierAdapter.d.ts +187 -0
- package/dist/modules/storage/adapters/MultiTierAdapter.d.ts.map +1 -0
- package/dist/modules/storage/adapters/MultiTierAdapter.js +430 -0
- package/dist/modules/storage/adapters/index.d.ts +12 -0
- package/dist/modules/storage/adapters/index.d.ts.map +1 -0
- package/dist/modules/storage/adapters/index.js +12 -0
- package/dist/modules/storage/index.d.ts +16 -0
- package/dist/modules/storage/index.d.ts.map +1 -0
- package/dist/modules/storage/index.js +15 -0
- package/dist/modules/storage/tiering/AccessAnalyzer.d.ts +227 -0
- package/dist/modules/storage/tiering/AccessAnalyzer.d.ts.map +1 -0
- package/dist/modules/storage/tiering/AccessAnalyzer.js +367 -0
- package/dist/modules/storage/tiering/CostOptimizer.d.ts +248 -0
- package/dist/modules/storage/tiering/CostOptimizer.d.ts.map +1 -0
- package/dist/modules/storage/tiering/CostOptimizer.js +356 -0
- package/dist/modules/storage/tiering/MetadataStore.d.ts +287 -0
- package/dist/modules/storage/tiering/MetadataStore.d.ts.map +1 -0
- package/dist/modules/storage/tiering/MetadataStore.js +535 -0
- package/dist/modules/storage/tiering/TieringEngine.d.ts +237 -0
- package/dist/modules/storage/tiering/TieringEngine.d.ts.map +1 -0
- package/dist/modules/storage/tiering/TieringEngine.js +419 -0
- package/dist/modules/storage/tiering/example.d.ts +8 -0
- package/dist/modules/storage/tiering/example.d.ts.map +1 -0
- package/dist/modules/storage/tiering/example.js +250 -0
- package/dist/modules/storage/tiering/index.d.ts +17 -0
- package/dist/modules/storage/tiering/index.d.ts.map +1 -0
- package/dist/modules/storage/tiering/index.js +13 -0
- package/dist/modules/webhooks/WebhooksModule.d.ts +476 -0
- package/dist/modules/webhooks/WebhooksModule.d.ts.map +1 -0
- package/dist/modules/webhooks/WebhooksModule.js +359 -0
- package/dist/modules/webhooks/index.d.ts +3 -0
- package/dist/modules/webhooks/index.d.ts.map +1 -0
- package/dist/modules/webhooks/index.js +1 -0
- package/dist/modules/zk/ZKModule.d.ts +153 -0
- package/dist/modules/zk/ZKModule.d.ts.map +1 -0
- package/dist/modules/zk/ZKModule.js +262 -0
- package/dist/modules/zk/index.d.ts +7 -0
- package/dist/modules/zk/index.d.ts.map +1 -0
- package/dist/modules/zk/index.js +4 -0
- package/dist/thirdweb/BridgeClient.d.ts +228 -0
- package/dist/thirdweb/BridgeClient.d.ts.map +1 -0
- package/dist/thirdweb/BridgeClient.js +160 -0
- package/dist/thirdweb/EngineClient.d.ts +396 -0
- package/dist/thirdweb/EngineClient.d.ts.map +1 -0
- package/dist/thirdweb/EngineClient.js +386 -0
- package/dist/thirdweb/GatewayClient.d.ts +190 -0
- package/dist/thirdweb/GatewayClient.d.ts.map +1 -0
- package/dist/thirdweb/GatewayClient.js +257 -0
- package/dist/thirdweb/NebulaClient.d.ts +292 -0
- package/dist/thirdweb/NebulaClient.d.ts.map +1 -0
- package/dist/thirdweb/NebulaClient.js +180 -0
- package/dist/thirdweb/StorageClient.d.ts +445 -0
- package/dist/thirdweb/StorageClient.d.ts.map +1 -0
- package/dist/thirdweb/StorageClient.js +405 -0
- package/dist/thirdweb/ThirdwebWrapper.d.ts +236 -0
- package/dist/thirdweb/ThirdwebWrapper.d.ts.map +1 -0
- package/dist/thirdweb/ThirdwebWrapper.js +332 -0
- package/dist/thirdweb/index.d.ts +21 -0
- package/dist/thirdweb/index.d.ts.map +1 -0
- package/dist/thirdweb/index.js +28 -0
- package/dist/thirdweb/varity-chain.d.ts +48 -0
- package/dist/thirdweb/varity-chain.d.ts.map +1 -0
- package/dist/thirdweb/varity-chain.js +64 -0
- package/dist/thirdweb/x402Client.d.ts +319 -0
- package/dist/thirdweb/x402Client.d.ts.map +1 -0
- package/dist/thirdweb/x402Client.js +223 -0
- package/dist/tracking/gasTracker.d.ts +158 -0
- package/dist/tracking/gasTracker.d.ts.map +1 -0
- package/dist/tracking/gasTracker.js +227 -0
- package/dist/tracking/index.d.ts +10 -0
- package/dist/tracking/index.d.ts.map +1 -0
- package/dist/tracking/index.js +8 -0
- package/dist/tracking/types.d.ts +327 -0
- package/dist/tracking/types.d.ts.map +1 -0
- package/dist/tracking/types.js +8 -0
- package/dist/ui/components/ChartWidget.d.ts +36 -0
- package/dist/ui/components/ChartWidget.d.ts.map +1 -0
- package/dist/ui/components/ChartWidget.js +82 -0
- package/dist/ui/components/DashboardLayout.d.ts +41 -0
- package/dist/ui/components/DashboardLayout.d.ts.map +1 -0
- package/dist/ui/components/DashboardLayout.js +102 -0
- package/dist/ui/components/DataTable.d.ts +49 -0
- package/dist/ui/components/DataTable.d.ts.map +1 -0
- package/dist/ui/components/DataTable.js +96 -0
- package/dist/ui/components/EntityForm.d.ts +60 -0
- package/dist/ui/components/EntityForm.d.ts.map +1 -0
- package/dist/ui/components/EntityForm.js +182 -0
- package/dist/ui/components/KPICard.d.ts +29 -0
- package/dist/ui/components/KPICard.d.ts.map +1 -0
- package/dist/ui/components/KPICard.js +61 -0
- package/dist/ui/components/Modal.d.ts +34 -0
- package/dist/ui/components/Modal.d.ts.map +1 -0
- package/dist/ui/components/Modal.js +30 -0
- package/dist/ui/components/index.d.ts +18 -0
- package/dist/ui/components/index.d.ts.map +1 -0
- package/dist/ui/components/index.js +11 -0
- package/dist/validation/template-validator.d.ts +25 -0
- package/dist/validation/template-validator.d.ts.map +1 -0
- package/dist/validation/template-validator.js +305 -0
- package/package.json +102 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Varity SDK - Shared Development Credentials
|
|
3
|
+
*
|
|
4
|
+
* Provides shared development credentials for seamless developer experience.
|
|
5
|
+
* Developers can use Varity packages without manually setting up Privy and thirdweb credentials.
|
|
6
|
+
*
|
|
7
|
+
* **IMPORTANT**: These credentials are for DEVELOPMENT/TESTING ONLY.
|
|
8
|
+
* For production deployments, you MUST use your own credentials.
|
|
9
|
+
*
|
|
10
|
+
* @example Zero-config development
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { PrivyStack } from '@varity-labs/ui-kit';
|
|
13
|
+
*
|
|
14
|
+
* // Works immediately - uses shared dev credentials
|
|
15
|
+
* <PrivyStack>
|
|
16
|
+
* <YourApp />
|
|
17
|
+
* </PrivyStack>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example Production with custom credentials
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import { PrivyStack } from '@varity-labs/ui-kit';
|
|
23
|
+
*
|
|
24
|
+
* <PrivyStack
|
|
25
|
+
* appId={process.env.PRIVY_APP_ID}
|
|
26
|
+
* thirdwebClientId={process.env.THIRDWEB_CLIENT_ID}
|
|
27
|
+
* >
|
|
28
|
+
* <YourApp />
|
|
29
|
+
* </PrivyStack>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Shared development credentials configuration
|
|
34
|
+
*
|
|
35
|
+
* These credentials are managed by Varity and shared across all development environments.
|
|
36
|
+
* They enable developers to start building immediately without manual credential setup.
|
|
37
|
+
*
|
|
38
|
+
* **Security Notes**:
|
|
39
|
+
* - Rate limiting is applied to prevent abuse
|
|
40
|
+
* - Only works with Varity L3 Testnet (Chain ID 33529)
|
|
41
|
+
* - Not suitable for production use
|
|
42
|
+
* - May be rotated periodically
|
|
43
|
+
*
|
|
44
|
+
* **When to Upgrade**:
|
|
45
|
+
* - Moving to production
|
|
46
|
+
* - Need custom branding in auth flows
|
|
47
|
+
* - Require higher rate limits
|
|
48
|
+
* - Building on non-Varity chains
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* VARITY_DEV_CREDENTIALS - Loaded from Credential Proxy or Environment Variables
|
|
52
|
+
*
|
|
53
|
+
* SECURITY: Credentials are NO LONGER hardcoded in this file.
|
|
54
|
+
* They are fetched from:
|
|
55
|
+
* 1. Varity Credential Proxy (api.varity.so/credentials) - Recommended
|
|
56
|
+
* 2. Environment variables (VARITY_PRIVY_APP_ID, VARITY_THIRDWEB_CLIENT_ID)
|
|
57
|
+
*
|
|
58
|
+
* The credential proxy ensures credentials are never exposed in client bundles.
|
|
59
|
+
*/
|
|
60
|
+
export const VARITY_DEV_CREDENTIALS = {
|
|
61
|
+
/**
|
|
62
|
+
* Privy configuration
|
|
63
|
+
*
|
|
64
|
+
* Privy provides authentication (email, social, wallet).
|
|
65
|
+
* Get your own credentials at: https://dashboard.privy.io
|
|
66
|
+
*/
|
|
67
|
+
privy: {
|
|
68
|
+
/**
|
|
69
|
+
* Privy App ID - loaded from environment variable
|
|
70
|
+
*
|
|
71
|
+
* Set VARITY_PRIVY_APP_ID in your environment
|
|
72
|
+
* Or use the Varity Credential Proxy for automatic credentials
|
|
73
|
+
*/
|
|
74
|
+
appId: process.env.VARITY_PRIVY_APP_ID || '',
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* thirdweb configuration
|
|
78
|
+
*
|
|
79
|
+
* thirdweb provides blockchain infrastructure (chain abstraction, contracts, storage).
|
|
80
|
+
* Get your own credentials at: https://thirdweb.com/dashboard
|
|
81
|
+
*/
|
|
82
|
+
thirdweb: {
|
|
83
|
+
/**
|
|
84
|
+
* thirdweb Client ID - loaded from environment variable
|
|
85
|
+
*
|
|
86
|
+
* Set VARITY_THIRDWEB_CLIENT_ID in your environment
|
|
87
|
+
* Or use the Varity Credential Proxy for automatic credentials
|
|
88
|
+
*/
|
|
89
|
+
clientId: process.env.VARITY_THIRDWEB_CLIENT_ID || '',
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* Rate limiting information (informational only)
|
|
93
|
+
*/
|
|
94
|
+
rateLimits: {
|
|
95
|
+
privy: {
|
|
96
|
+
monthlyActiveUsers: 1000,
|
|
97
|
+
note: 'Shared via Varity Credential Proxy',
|
|
98
|
+
},
|
|
99
|
+
thirdweb: {
|
|
100
|
+
requestsPerSecond: 100,
|
|
101
|
+
note: 'Shared via Varity Credential Proxy',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Check if using shared development credentials
|
|
107
|
+
*
|
|
108
|
+
* @param appId - Privy app ID to check
|
|
109
|
+
* @param clientId - thirdweb client ID to check
|
|
110
|
+
* @returns true if using shared development credentials
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* if (isUsingDevCredentials(appId, clientId)) {
|
|
115
|
+
* console.warn('Using shared dev credentials - upgrade for production');
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export function isUsingDevCredentials(appId, clientId) {
|
|
120
|
+
const defaultAppId = VARITY_DEV_CREDENTIALS.privy.appId;
|
|
121
|
+
const defaultClientId = VARITY_DEV_CREDENTIALS.thirdweb.clientId;
|
|
122
|
+
return appId === defaultAppId || clientId === defaultClientId;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Check if credentials are suitable for production use
|
|
126
|
+
*
|
|
127
|
+
* @param appId - Privy app ID to check
|
|
128
|
+
* @param clientId - thirdweb client ID to check
|
|
129
|
+
* @returns true if credentials are production-ready
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* if (!isProductionCredentials(appId, clientId)) {
|
|
134
|
+
* throw new Error('Production requires custom credentials');
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export function isProductionCredentials(appId, clientId) {
|
|
139
|
+
return !isUsingDevCredentials(appId, clientId) && !!appId && !!clientId;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get warning message for development credential usage
|
|
143
|
+
*
|
|
144
|
+
* @param environment - Current environment (development, staging, production)
|
|
145
|
+
* @returns Warning message or null (deprecated - always returns null)
|
|
146
|
+
*
|
|
147
|
+
* @deprecated This function is deprecated. Varity now uses credential proxy
|
|
148
|
+
* and provides a seamless experience without warnings.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* const warning = getCredentialWarning('production');
|
|
153
|
+
* // Always returns null now
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
export function getCredentialWarning(environment) {
|
|
157
|
+
// Deprecated: Warnings removed to provide seamless developer experience
|
|
158
|
+
// Varity Credential Proxy handles credentials securely without user intervention
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Log development credential usage warning
|
|
163
|
+
*
|
|
164
|
+
* @param appId - Privy app ID being used
|
|
165
|
+
* @param clientId - thirdweb client ID being used
|
|
166
|
+
* @param usingProxy - Whether credentials are from proxy (suppresses warnings)
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* logCredentialUsage(appId, clientId);
|
|
171
|
+
* // Logs friendly message if using shared dev credentials
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
export function logCredentialUsage(appId, clientId, usingProxy = false) {
|
|
175
|
+
if (!isUsingDevCredentials(appId, clientId)) {
|
|
176
|
+
return; // Using custom credentials - no message needed
|
|
177
|
+
}
|
|
178
|
+
// If using proxy, it handles its own messaging
|
|
179
|
+
if (usingProxy) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
// Show single friendly message (only in development)
|
|
183
|
+
if (process.env.NODE_ENV === 'development') {
|
|
184
|
+
console.log('✓ Using Varity authentication (no setup required)');
|
|
185
|
+
}
|
|
186
|
+
// In production, silently use credentials without warnings
|
|
187
|
+
// Developer can upgrade to custom credentials when ready
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Resolve credentials with fallback to dev credentials
|
|
191
|
+
*
|
|
192
|
+
* @param appId - Custom Privy app ID (optional)
|
|
193
|
+
* @param clientId - Custom thirdweb client ID (optional)
|
|
194
|
+
* @param usingProxy - Whether credentials are from proxy (suppresses warnings)
|
|
195
|
+
* @returns Resolved credential configuration
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const creds = resolveCredentials(customAppId, customClientId);
|
|
200
|
+
* // Falls back to VARITY_DEV_CREDENTIALS if custom credentials not provided
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
export function resolveCredentials(appId, clientId, usingProxy = false) {
|
|
204
|
+
// Try to resolve from provided values, env vars, or VARITY_DEV_CREDENTIALS
|
|
205
|
+
const resolvedAppId = appId ||
|
|
206
|
+
process.env.VARITY_PRIVY_APP_ID ||
|
|
207
|
+
VARITY_DEV_CREDENTIALS.privy.appId;
|
|
208
|
+
const resolvedClientId = clientId ||
|
|
209
|
+
process.env.VARITY_THIRDWEB_CLIENT_ID ||
|
|
210
|
+
VARITY_DEV_CREDENTIALS.thirdweb.clientId;
|
|
211
|
+
// Check if we have valid credentials
|
|
212
|
+
if (!resolvedAppId || !resolvedClientId) {
|
|
213
|
+
throw new Error(`Varity credentials not configured.
|
|
214
|
+
|
|
215
|
+
Please provide credentials via:
|
|
216
|
+
1. Component props (appId, thirdwebClientId)
|
|
217
|
+
2. Environment variables (VARITY_PRIVY_APP_ID, VARITY_THIRDWEB_CLIENT_ID)
|
|
218
|
+
3. Varity Credential Proxy (automatic when deployed via Varity)
|
|
219
|
+
|
|
220
|
+
Get credentials at:
|
|
221
|
+
- Privy: https://dashboard.privy.io
|
|
222
|
+
- thirdweb: https://thirdweb.com/dashboard`);
|
|
223
|
+
}
|
|
224
|
+
const resolved = {
|
|
225
|
+
privy: {
|
|
226
|
+
appId: resolvedAppId,
|
|
227
|
+
},
|
|
228
|
+
thirdweb: {
|
|
229
|
+
clientId: resolvedClientId,
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
// Log usage info (suppressed if using proxy)
|
|
233
|
+
logCredentialUsage(resolved.privy.appId, resolved.thirdweb.clientId, usingProxy);
|
|
234
|
+
return resolved;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Validate credentials are configured correctly
|
|
238
|
+
*
|
|
239
|
+
* @param appId - Privy app ID to validate
|
|
240
|
+
* @param clientId - thirdweb client ID to validate
|
|
241
|
+
* @throws Error if credentials are invalid
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```typescript
|
|
245
|
+
* try {
|
|
246
|
+
* validateCredentials(appId, clientId);
|
|
247
|
+
* } catch (error) {
|
|
248
|
+
* console.error('Invalid credentials:', error.message);
|
|
249
|
+
* }
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
export function validateCredentials(appId, clientId) {
|
|
253
|
+
if (!appId || appId.trim() === '') {
|
|
254
|
+
throw new Error('Privy App ID is required. Get one at: https://dashboard.privy.io');
|
|
255
|
+
}
|
|
256
|
+
if (!clientId || clientId.trim() === '') {
|
|
257
|
+
throw new Error('thirdweb Client ID is required. Get one at: https://thirdweb.com/dashboard');
|
|
258
|
+
}
|
|
259
|
+
// Validate format (basic checks)
|
|
260
|
+
if (!appId.startsWith('clp')) {
|
|
261
|
+
console.warn(`⚠️ Privy App ID should start with 'clp'. Current: ${appId}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Get upgrade instructions for production
|
|
266
|
+
*
|
|
267
|
+
* @returns Markdown-formatted upgrade instructions
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```typescript
|
|
271
|
+
* console.log(getUpgradeInstructions());
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
export function getUpgradeInstructions() {
|
|
275
|
+
return `
|
|
276
|
+
# Upgrading to Production Credentials
|
|
277
|
+
|
|
278
|
+
## Why Upgrade?
|
|
279
|
+
|
|
280
|
+
Shared development credentials (VARITY_DEV_CREDENTIALS) are:
|
|
281
|
+
- Rate limited across all developers
|
|
282
|
+
- May be rotated periodically
|
|
283
|
+
- Not suitable for production use
|
|
284
|
+
- Lack custom branding options
|
|
285
|
+
|
|
286
|
+
## How to Upgrade
|
|
287
|
+
|
|
288
|
+
### 1. Get Privy App ID
|
|
289
|
+
|
|
290
|
+
1. Visit https://dashboard.privy.io
|
|
291
|
+
2. Sign up or log in
|
|
292
|
+
3. Create a new app
|
|
293
|
+
4. Copy your App ID (starts with 'clp')
|
|
294
|
+
5. Configure login methods (email, social, wallet)
|
|
295
|
+
|
|
296
|
+
### 2. Get thirdweb Client ID
|
|
297
|
+
|
|
298
|
+
1. Visit https://thirdweb.com/dashboard
|
|
299
|
+
2. Sign up or log in
|
|
300
|
+
3. Create a new project
|
|
301
|
+
4. Copy your Client ID
|
|
302
|
+
5. Configure allowed domains
|
|
303
|
+
|
|
304
|
+
### 3. Set Environment Variables
|
|
305
|
+
|
|
306
|
+
\`\`\`bash
|
|
307
|
+
# .env.local
|
|
308
|
+
PRIVY_APP_ID=your-privy-app-id
|
|
309
|
+
THIRDWEB_CLIENT_ID=your-thirdweb-client-id
|
|
310
|
+
\`\`\`
|
|
311
|
+
|
|
312
|
+
### 4. Update Your Code
|
|
313
|
+
|
|
314
|
+
\`\`\`tsx
|
|
315
|
+
import { PrivyStack } from '@varity-labs/ui-kit';
|
|
316
|
+
|
|
317
|
+
<PrivyStack
|
|
318
|
+
appId={process.env.PRIVY_APP_ID}
|
|
319
|
+
thirdwebClientId={process.env.THIRDWEB_CLIENT_ID}
|
|
320
|
+
>
|
|
321
|
+
<YourApp />
|
|
322
|
+
</PrivyStack>
|
|
323
|
+
\`\`\`
|
|
324
|
+
|
|
325
|
+
## Benefits
|
|
326
|
+
|
|
327
|
+
- ✅ Unlimited usage (within your plan limits)
|
|
328
|
+
- ✅ Custom branding in auth flows
|
|
329
|
+
- ✅ Production support
|
|
330
|
+
- ✅ Analytics and monitoring
|
|
331
|
+
- ✅ No credential rotation concerns
|
|
332
|
+
|
|
333
|
+
## Cost
|
|
334
|
+
|
|
335
|
+
Both Privy and thirdweb offer generous free tiers:
|
|
336
|
+
- **Privy**: Free up to 1,000 MAU
|
|
337
|
+
- **thirdweb**: Free tier available
|
|
338
|
+
|
|
339
|
+
## Need Help?
|
|
340
|
+
|
|
341
|
+
- Documentation: https://docs.varity.io/credentials
|
|
342
|
+
- Discord: https://discord.gg/varity
|
|
343
|
+
- Support: support@varity.io
|
|
344
|
+
`;
|
|
345
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Loader
|
|
3
|
+
*
|
|
4
|
+
* Utility for loading and registering built-in templates
|
|
5
|
+
*/
|
|
6
|
+
import { TemplateConfig } from './template';
|
|
7
|
+
/**
|
|
8
|
+
* Load built-in ISO template
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadISOTemplate(): TemplateConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Load all built-in templates
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadAllTemplates(): void;
|
|
15
|
+
//# sourceMappingURL=template-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-loader.d.ts","sourceRoot":"","sources":["../../src/core/template-loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAoB,MAAM,YAAY,CAAA;AAO7D;;GAEG;AACH,wBAAgB,eAAe,IAAI,cAAc,CAsWhD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC"}
|