AIR Kit
AIR Kit (1.1.x)
AIR Kit (1.1.x)
  • Introduction
    • Welcome!
    • Quickstart
  • Web SDK
    • Installation
    • Usage
    • Customization
    • Reference
    • Wagmi Connector
    • Release Notes
  • Flutter SDK
    • Installation
    • Usage
    • Reference
  • About
    • Moca Network
Powered by GitBook
On this page
  • Initialize Flutter SDK
  • Rehydration
  • Login
  • Mint Realm ID (⚠️ not ready yet in 0.2.x)
  1. Flutter SDK

Usage

Initialize Flutter SDK

After installation, the next step to use the AirKit SDK is to initialize AirService by calling the initialize method.

The partnerId you will receive from us and the redirectUrl parameter needs to match the schema discussed in the installation section. It is different for Android and iOS.

static Future<void> initialize(
      {required String partnerId,
      required Uri redirectUrl,
      Environment env = Environment.production}) async;

Rehydration

In case a user should be rehydrated after e.g. an app restart, rehydrate can be called to automatically login a previously logged in user with an existing valid session. Otherwise login needs to be called.

Login

Before the login method can be used, custom auth details need to be setup first on our end. Currently, the email address needs to be used as identifier inside the JWT which will be generated on your side.

An example JWT could look like following:

{
  "partnerId": "YOUR PARTNER ID",
  "partnerUserId": "YOUR USER ID", // optional
  "email": "YOUR USER EMAIL",
  "exp": 1728973684,
  "iat": 1728970084
}

In order to validate the JWTs on our end, we need to know your JWKS endpoint with following JSON:

{
  "keys": [
    {
      "kty": "EC",
      "use": "sig",
      "alg": "ES256",
      "kid": "{your_kid}",
      "crv": "P-256",
      "x": "{your_x}",
      "y": "{your_y}"
    }
  ]
}

The above JWKS should contain the public key only, but the JWT generated on your end needs to be signed with the private key.

Mint Realm ID (⚠️ not ready yet in 0.2.x)

PreviousInstallationNextReference

Calling claimId will start the mint flow which mints the Air ID based on your node (e.g. .moca) and also creates the AA for the user. If you want to have more control over the gating process, please refer to which explains how to setup a claim token.

following section