βWelcome to the Freedom ID SDK integration guide! This guide will help you smoothly integrate the Freedom ID SDK into your Android app, enabling secure authentication and user data permission management within the Freedom Holding ecosystem. Freedom ID serves as a single point of entry for users, ensuring top-level security and privacy while managing data permissions and accessing multiple services.βThe Freedom ID SDK is available for both Android (API level 24 and above) and iOS platforms. This guide specifically covers the Android platform. Let's get started! π
βAutomatically βYou can add the AAR via Project Structure's Dependency Tab as specified in the official docs here.βManually βAlternatively, you can use this method:
Place the freedom-id-sdk.aar in the libs directory of your app module. If the libs directory doesnβt exist, create it at the root of your app module (e.g., app/libs)
Add the AAR file as a dependency in the build.gradle file of your app module and settings.gradle
βTo authorize a user, call the authorize method of the FreedomID class. This method initiates the authorization flow. The authorize method takes three parameters:
1.
The FragmentManager of the activity or fragment where the authorization flow will be displayed.
2.
An array of DataGrants that the user needs to grant.
3.
A callback function that will be invoked when the authorization flow completes.
βThe authorization process returns an AuthResult object, which can be either:
βTo clear the SDK, call the clear method of the FreedomID class. βThis method clears the SDK's internal state and releases any resources used during the authorization process.
If an account exists: The user is navigated directly to the Home Screen, where their account(s) are displayed.
If no account exists: The user is taken to the Authentication Screen to log in. After successful authentication, the user is redirected to the Home Screen.
βThe user can log in using any of these methods:
Entering their phone number and receiving an OTP code via SMS.
Entering their email and password as credentials.
Entering their phone number and password as credentials.
βOptionally, users can enable 2FA for additional security. To enable 2FA, they need to manage their settings in their Freedom ID account on the web at https://passport.freedompay.kz
βThis enum represents a set of permissions that a host application can request from the SDK to grant access to specific profile data. βEach constant corresponds to a particular piece of user information, allowing the host app to selectively request access based on its needs. Below is a table describing the different DataGrants available in the Freedom ID SDK:
Enum Constant
Value
Description
READ_DATE_OF_BIRTH
read.data_of_birth
Grants access to the user's date of birth
READ_FIRSTNAME
read.firstname
Grants access to the user's first name
READ_LASTNAME
read.lastname
Grants access to the user's last name
READ_PATRONYMIC
read.patronymic
Grants access to the user's patronymic
READ_COUNTRY
read.country
Grants access to the user's country
READ_NATIONALITY
read.nationality
Grants access to the user's nationality
READ_GENDER
read.gender
Grants access to the user's gender
READ_IDENTIFIER
read.identifier
Grants access to the user's identifier such as citizen's ID
βThe GrantedProfile data class represents a user's profile information that is accessible after the required read permissions have been granted by the host application via the SDK.
βThe TransmissionErrors enum defines a set of possible errors that can occur during the transmission of requests in an authentication or communication process. βEach error represents a specific issue related to the request's structure, identification, application integrity, or the process of sending and receiving requests.
βThe NetworkError sealed interface defines a set of possible errors that may occur during network operations. Each subtype of NetworkError represents a specific issue, such as connection failures, stream interruptions, or problems with request/response handling.