#
Best Practices
This page covers some best practices for implementing Inkey in your dApp.
#
Connecting Accounts
The most important thing your app needs is a button that calls algonaut.inkeyConnect()
(or, sends a connect message manually via the PostMessage API).
Once the user is logged in, you should display the currently connected address. You receive this in the promise that inkeyConnect()
returns, e.g.:
const account = await algonaut.inkeyConnect({ siteName: 'Your App' })
Also, once this await
resolves, algonaut.account
will contain the authenticated address.
#
User Profiles
Once you receive an address (see the Quick Start), you can attach it to a user profile to keep that user's information with their Algorand account. There are many ways to do this, and we are working on a dencentralized solution currently!
#
Open Account Window
If a user wants to manage their Inkey account (i.e. set up FIDO or change their password), you need to provide access to that.
If a user is already authenticated, you just need to open Inkey and they can manage their account from there.
#
Disconnecting Account
Since users can disconnect from the account window in Inkey, you need to make sure to handle that disconnected state in your app.
See the PostMessage API for more on handling the disconnect
event.