Managing Bundles: A detailed guide on using ClientBundleController and WalletBundleController to create, retrieve, and clear bundles.
import { ClientBundleController, WalletBundleController } from'@tmawallet/sdk';import { TelegramCloudStorage } from'@tmawallet/sdk';(async () => {conststorage=newTelegramCloudStorage();constclientBundleController=newClientBundleController(storage);constwalletBundleController=newWalletBundleController(storage);// Create a new client bundleconstnewBundle=awaitclientBundleController.createNewBundle();console.log('New client bundle created:', newBundle);// Retrieve the existing bundleconstexistingBundle=awaitclientBundleController.getClientBundle();console.log('Existing bundle:', existingBundle);// Clear the client bundleawaitclientBundleController.clearClientBundle();console.log('Client bundle cleared');})();
Handling User Sessions: Best practices for managing sessions and key security across different user devices.
Session Persistence: Use Telegram's cloud storage to persist session data, ensuring that users can access their wallets across devices.
Key Security: Avoid storing sensitive keys locally. Instead, leverage MPC and TelegramCloudStorage to manage keys securely.
Session Expiry: Implement session expiry mechanisms to ensure that inactive sessions are securely terminated, reducing the risk of unauthorized access.