Create the wallet, store the authentication key, and access the new wallet:
Copy
// Check if the desired handle is availableconst handle = 'userInputAlias';const isAvailableHandle = await walletService.isAliasAvailable(handle);if (!isAvailableHandle) { throw new Error('Handle is not available');}// Create new walletawait walletService.createWalletAccount(keyPair.publicKey, email, handle);// Store the authentication key in a secure place so the user can access the wallet laterawait storeAuthenticationKey(keyPair.privateKey);// Get access to the new walletconst account = walletService.getWalletAccountFromAuthToken(keyPair.privateKey);
The following sequence diagram illustrates the wallet creation process:This diagram provides a visual representation of the interaction between the User, your App, and Handcash during the wallet creation process.