Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

Multiple wallets, users and devices support

Compare
Choose a tag to compare
@YohayBar YohayBar released this 24 Jan 20:06
· 280 commits to dev since this release
94f5f83

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 :

  1. Generating the JWT Token
  2. Creating a User’s Kin Account - login and logout.
  3. Requesting Payment for a Custom Earn Offer - custom native earn offers.
  4. Creating a Custom Spend Offer - custom native spend offers.
  5. 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.