SDK Initialization
AIR Kit creates an iframe that loads the login flow and sets up communication streams between the iframe and the DApp's JavaScript context.
js
import { AirService, BUILD_ENV } from "@mocanetwork/airkit";
const airService = new AirService({
partnerId: YOUR_PARTNER_ID // Replace with your actual Partner ID
});
await airService.init({
buildEnv: BUILD_ENV.SANDBOX,
enableLogging: true,
preloadWallet: true, // Optional: Enable if wallet features will be used
preloadCredential: true // Optional: Enable if credential features will be used
});
// Without any parameters, this will trigger the default Air login dialog which provides different login methods for the user to choose from.
await airService.login();Once the SDK is installed and AirService is successfully initialized, it can be used to authenticate users.