Multiple wallets, users and devices support
Multiple Users
In order to support multiple users, we made minor changes to the JWT structure you provide on the SDK API's.
Under the Payload
section, the JWT should also include a device_id
, also user_id
is no longer optional.
See more on :
- Generating the JWT Token
- Creating a User’s Kin Account - login and logout.
- Requesting Payment for a Custom Earn Offer - custom native earn offers.
- Creating a Custom Spend Offer - custom native spend offers.
- Creating a Pay To User Offer - p2p transactions.
How it works
We create a map between kin_user_id
and all of his used wallets.
If user A is logged in and there are no wallets on his device, we will create a new one for him and add it to the mapping.
If user A is logging out and user B is logging in instead, the same will happen, if there are any wallets related to this user, we will load the last one used.
In order to support this behavior, you should call to Kin.logout()
if you want to log out from the current user.
This allows you to switch between users, so each will have their own wallets and not share one across users.
Support receiving Kin from external apps
SDK includes a target activity that can be open by other external apps using an explicit intent.
The user must approve accepting Kin from the external app.