iOS -> v0.1.2
Start by downloading the client SDK.
Once you have the client SDK, you’re ready to integrate it with your (d)App.
- Copy the PocketID.framework file into your Xcode project directory.
- Select your project in the left pane of Xcode (the blue one), select your app target under "general", under "Embed Binaries", click the +, choose other and browse to the PocketID.framework file you copied earlier.
- Import PocketID in your code.
PocketID requires this mandatory step in order to
initialize the sdk before any of its features can be used.
You will find the class
PocketID is the main source of your interaction with the sdk.
To initialize the SDK, you’ll need to call
PocketID.initialize(“APP_ID”) in your AppDelegate’s
didFinishLaunchingWithOptions method and pass in your AppID.
In development environment use this sample AppID:
For production, please contact us to generate a prod AppID
Most of the SDK functionality will have associated events that will be called to notify you of progress and results.
To listen for these events, you may make your controller extend the
PocketIDDelegate and assign that controller to
PocketID.shared().deleagte = myViewController in your controller’s
We understand every application is unique with it’s own design and functional needs. PocketID sdk provides the necessary tools for customization.
PocketID.customize() is the main source of sdk customization. You can pass several optional parameters to that method to customize your experience.
For a full list of supported customization, please see the Reference.
The easiest and recommended way to initiate the login/registration process is through our dedicated ‘Login with PocketID’ button.
This is a great way to onboard both users who are new to your (d)App or users who may already have a PocketID account.
All that’s needed is to add a
UIView to your Storyboard or Xib layout file and assign it’s class to
The login button will render instantly in your Storyboard or Xib layout.
PocketID integration makes it very simple for your users to adopt blockchain without having the need or the pressure to fully understand it.
Your users will appreciate when your onboarding process is similar to what they are already used to, ie username and password.
All that is needed is to call
PocketID.login(loginType: PIDLoginType) and our client sdk will handle all the detailed work needed to generate an account.
.Register for the parameter
loginType if you want the initial screen to default to the Login or Registration flow.
- After login, the SDK will call the delegate method
- After registration, the SDK will call the delegate method
The end result will be a logged-in user
After the user has logged in, you can get the account detail by calling
PocketID.user() which will return a
PIDUser object via the
onCompletion callback parameter.
SSO (single sign-on)¶
Just like the major single sign-on platforms such as Facebook and Google, our login/onboarding process is meant to make it very easy and convenient for users to login to your app. The great aspect of SSO is that the user don’t have to re-login to your app every time and as a side benefit, user’s don’t need to login to other apps that support PocketID as well. This creates a level of comfort for users and will create a sphere of convenience. As a developer, you don’t have to do anything extra to enable this feature, it works by default on the respective platform.
The logged-in user will have a stored session in the client SDK. In order to log the user out, just call
This will clear the session from the sdk and
PocketID.isLoggedIn() will return
After logging out, the SDK will call the delegate method
Note that if the user is not logged in,
PocketID client SDK’s onboarding process comes built-in with forgot and reset password feature. This process have been simplified and is very seamless as the user will not have to go outside of the app at all to reset their password. This flow is built-in to the login process therefore the developer don’t have to do anything extra to support this feature.
Note that the end result of forgot/reset password will be a logged-in user after successful reset.
Main interactions with the sdk is through this class. Used as Singleton.
- Validates the state of the sdk
- If User is already logged in on the device, will set state to logged in
- True or False
- Customize the SDK
- Manually triggers the Login Flow
loginTypeparameter will start the flow with either the login or registration screen
- Logs out the current user and clears the global session
- Returns an instance of the current logged in user
Protocol PocketID Delegate¶
Methods that get called when events happen in the SDK
Contains information about the logged in user