Arcana Auth Flutter SDK


Arcana Auth SDK (Gaming)

Arcana Auth Flutter SDK

Mobile applications built with Flutter can easily onboard users and allow authenticated users to sign blockchain transactions by integrating with the Arcana Auth Flutter SDK. Arcana Auth enables the standard Ethereum provider for Web3 operations.

With Arcana Auth, users don't need to download a wallet extension or manage keys themselves to get started with interacting with any blockchain. Once authenticated, the Arcana wallet is instantly accessible to the user in the Unity app's context.

Developers can use plug-and-play user authentication using the built-in login UI or create a custom UI to onboard users. One or more authentication mechanisms can be configured using the Arcana Dashboard for onboarding users. Before integrating, developers must register the app using the Arcana Developer Dashboard and obtain a unique client ID.

The following authentication mechanisms are supported:

  • Social Login

    • Discord
    • GitHub
    • Google
    • Steam (Coming Soon!)
    • Twitter
    • Twitch
  • Passwordless, OTP based authentication

  • Custom IAM

    • Cognito
    • Firebase (Coming Soon!)

➡️ Using the SDK

Follow these steps to configure and integrate Arcana Auth Flutter SDK with any mobile app using Flutter:

Step 1: Configure Auth

Before you can install and integrate with the Arcana Auth Flutter SDK, first obtain a client ID for the Flutter app. Use the Arcana Developer Dashboard and register the app with Arcana Network. A unique client ID is assigned for each registered app. For details, see the 'How to configure Auth SDK'](https://docs.arcana.network/howto/configure-auth.html) documentation.

Step 2: Installation

The Arcana Auth Flutter SDK is available as a Flutter plugin package at Pub.dev.

Add the following line to the dependencies section in your app's pubspec.yaml file:

  arcana_auth_flutter: ^0.0.6 

Step 3: Integrate Auth with App

As part of integrating a Flutter app with the Auth SDK, specify the unique client ID assigned to the registered app in the previous step when creating an AuthProvider.

import 'package:arcana_sdk/arcana_sdk.dart';

final auth = AuthProvider(clientId:"xar_xxxx_...");
auth.init(context: context);

Once initialized, you can call the AuthProvider functions for onboarding users and signing blockchain transactions.

Auth SDK Functionality

Login/Logout

Login with Social

Use social providers such as Google to onboard users by calling loginWithSocial with the appropriate provider string.

auth.loginWithSocial("google").then((_) => {
  // On login Success
}).catchError(...);

Login with OTP

Onboard users to the Flutter app in a passwordless, no email-required manner with an OTP:

auth.loginWithOTP("${email_id}").then((_) => {
  // On login Success
}).catchError(...);

Logout

auth.logout().then((_) => {
  // On logout
});

Show/Hide wallet

Once a user authenticates, they can access the Arcana wallet and sign blockchain transactions. The Flutter apps can control when the Arcana wallet is displayed by using the following functions:

auth.showWallet();
auth.hideWallet();

To determine in the Flutter app if the Arcana wallet is visible in the app's context, get the visibility status:

var isVisible = auth.isVisible();

Flutter apps can clear the Webview cache:

auth.clearCache();

Web3 Operations

The AuthProvider supports the JSON-RPC requests for web3 operations:

EIP-1193 Request:

auth.request(method: "...", params: [...]).then(() => ...);

Get information for the logged in user:

auth.getUserInfo().then((UserInfo info) => ...);

Initiate send transaction request:

auth.sendTransaction({ to: "", value: "" }).then((hash) => ...);

Get user account address:

auth.getAccount().then((account) => ...);

💡 Support

For any support or integration-related queries, contact Arcana support team.

🤝 Contributing

We welcome all contributions to the Arcana Auth SDK from the community. Read our contributing guide to learn about the SDK development process, how to propose bug fixes and improvements, and the code of conduct that we expect the participants to adhere to. Refer to the build and test section of this readme for details on how to test and validate your changes to the Auth SDK code before submitting your contributions.

ℹ️ License

Arcana Auth SDK is distributed under the MIT License.

For details see Arcana License.

Libraries

arcana_sdk
common
strings