# 📖 SDK Docs Arcana Network provides two SDKs, the Chain Abstraction (CA) SDK and the Auth SDK. The CA SDK resolves liquidity fragmentation. It enables developers to let users spend a unified token balance across chains without bridging assets. The Auth SDK addresses account abstraction. It allows users to onboard via social login, skipping wallet creation. Both improve user experience and onboarding. Arcana also offers a standalone CA wallet for spending unified balances on select Web3 apps. # Chain Abstraction # Unify Balance Across Chains Let users spend [any](../web3-stack/ca_stack/#tokens) crypto asset on [any](../web3-stack/ca_stack/#chains) blockchain instantly - no chain switching, no bridging, no cross-chain swaps necessary. No hassle. Seamless transaction experience. Integrate Web3 app with the Arcana's [Chain Abstraction](../concepts/ca/chain-abstraction/) (CA) SDK. Enable app users to access [unified balance](../concepts/ca/unified-balance/) from all chains in one place. **TL;DR** | [Install](../ca/ca-sdk-installation/) | [Quick Start](#quick-start) | [Examples](../ca/examples/) | [Usage](../ca/ca-usage-guide/) ## Quick Start What kind of Web3 app do you have? Select the appropriate app type and get started with integrating the Arcana CA SDK. [Web Apps](../quick-start/ca-quick-start/) [Wagmi Apps](../quick-start/ca-wagmi-quick-start/) Advanced Usage You can let Web3 app users onboard via [social login](../concepts/social-login/) and spend [unified balance](../concepts/ca/unified-balance/) on any chain through [chain abstracted transactions](../concepts/ca/chain-abstraction/). For this, the app must be integrated with both the Arcana CA SDK as well as the Arcana Auth SDK. [Learn more...](../quick-start/auth-ca-wagmi-quick-start/) ## Demo Would you like to experience chain abstraction and how unified balance works before integrating a Web3 app with the Arcana CA SDK? Try the SDK integration demo app. [### SDK Integration Demo](https://sdk.arcana.network) ## CA Playground Seamless UX with unified balance across assets and chains [### Try Now](https://codesandbox.io/p/github/arcana-network/ca-wagmi-example/main) ## Spend on Any Chain Chain abstracted transactions are a game changer for Web3 app adoption. Integrate with Arcana CA SDK to enable unified balance in Web3 apps. - **Unified Balance** ______________________________________________________________________ Spend on any chain with unified balance of funds on the source chains and sign transactions on any destination chain with a third-party browser-based wallet. [Learn More...](../concepts/ca/unified-balance/) - **Track Status** ______________________________________________________________________ Use Arcana Intent Explorer to track status of chain abstracted transactions. [Learn More...](../concepts/ca/intent-explorer/) - **Integration Examples** ______________________________________________________________________ Get up and running quickly with integration examples: [`ca-sdk`](https://github.com/arcana-network/ca-sdk-example) [`ca-wagmi`](https://github.com/shaloo/sample-arcana-ca-wagmi-sdk) - **Resources** ______________________________________________________________________ Release notes, FAQ, audit reports, whitepaper and more. [Learn more...](https://docs.arcana.network/relnotes/latest-ca-release-note/) [Learn more...](../ca/why-ca-sdk/) ## Need Help? 📨 [Email Arcana Support](mailto:support@arcana.network) ✅ Be a part of the [Arcana Community](../support/). Stay informed about the new upcoming SDK capabilities and usage examples. # CA Demo Here is our showcase demonstrating chain abstraction technology. We use a two pronged approach for demo purposes: 1. Web3 Apps: Show CA in the context of popular Web3 apps by using a special CA enabled wallet. 1. SDK Demo: Show through a sample app integration how devs can enable chain abstracted transactions in any Web3 app by integrating the app with Arcana CA SDK. ## 1. Web3 Apps In these videos, you'll see how unified balance and chain abstracted transactions elevate the user experience in some of these popular Web3 apps. Note, these demo videos use the [Arcana CA Wallet](https://chromewebstore.google.com/detail/arcana-wallet/nieddmedbnibfkfokcionggafcmcgkpi) which is specially implemented to showcase the unified balance and chain abstracted transactions. It is not meant to be used as a full-fledged Web3 wallet, yet. Click on the app specific tab to see chain abstracted transactions in action. ## 2. SDK Demo Developers can integrate the Arcana CA SDK with any Web3 app to let users spend [unified balance](../../concepts/ca/unified-balance/) across chains via chain abstracted transactions. [CA SDK Demo](https://sdk.arcana.network) Have a Web3 app? *Have you integrated your app with our SDK?* **We would be delighted to add your app integration demo here and share it with the larger Arcana [community](../../support/#arcana-community)!** **Submit** a YouTube link at hello@arcana.network # Chain Abstraction SDKs Enable [unified balance](../../concepts/ca/unified-balance/) and [chain abstracted](../../concepts/ca/chain-abstraction/) transactions for Web3 app users. You may need to install one or more Arcana SDK packages according to the app type. Arcana CA SDK Flavors Install the appropriate CA SDK as per Web3 app type: | SDK Name | Web3 Application Type | Package Name | Dependency | | --- | --- | --- | --- | | Arcana CA SDK | For enabling unified balance in web apps: Vanilla HTML/CSS/JS Apps, Vite, Vue Apps | [`ca-sdk`](https://www.npmjs.com/package/@arcana/ca-sdk) | None | | Arcana CA Wagmi SDK | Wagmi Apps | [`ca-wagmi`](https://www.npmjs.com/package/@arcana/ca-wagmi) | [`ca-sdk`](https://www.npmjs.com/package/@arcana/ca-sdk) | ## Install SDKs ### Web Apps ``` npm install --save @arcana/ca-sdk ``` ### Wagmi Apps ``` npm install --save @arcana/ca-sdk @arcana/ca-wagmi ``` # API: `ca-sdk` Integrate Web3 app with the Arcana CA SDK's to enable: - Unified balance - Chain abstracted transactions [Arcana CA SDK Reference](https://ca-sdk-ref-guide.netlify.app/) Chain Abstraction allows Web3 app users to spend assets on **any** chain through [unified balance](../../concepts/ca/unified-balance/). Web3 app developers can enable unified balance for app users by integrating the appropriate **Arcana** CA SDK flavor. ## Integration Flow ``` flowchart LR subgraph Integrate [Select SDK for App Type] direction LR A00(((Start))) --> F00[App Type] F00 -- Web App --> G00[Arcana CA SDK] F00 -- Wagmi App --> H00[Arcana CA Wagmi SDK] G00 & H00 --> I00(Install & Integrate) end classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class E00 an-pink ``` ``` flowchart LR subgraph Integrate [Integrate SDK with App] direction LR A00(((Start))) --> F00[Install SDK] F00 -- Integrate App --> G00[Initialize SDK] G00 --> H00(Call SDK Functions) end classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class E00 an-pink ``` ## See Also - [Chain Abstraction](../../concepts/ca/chain-abstraction/) - [CA SDK](../../concepts/ca/casdk/) - [Download Arcana CA SDK](https://www.npmjs.com/package/@arcana/ca-sdk) # CA Users Spend crypto on any blockchain instantly - no chain switching, no bridges, no hassle. To enjoy [unified balance](../../concepts/ca/unified-balance/) Web3 users have two options: **Option 1:** Log in to an app integrated with Arcana's' Chain Abstraction SDK and connect any third-party browser-based wallet to view unified balance and sign transactions. For example, you can log into the [CA SDK demo app](https://sdk.arcana.network) to experience unified balance. Arcana CA SDK Demo App: Unified Balance **Option 2:** [Download](https://chromewebstore.google.com/detail/arcana-wallet/nieddmedbnibfkfokcionggafcmcgkpi) Arcana's' standalone CA Wallet browser extension to view unified balance across supported [chains](../../web3-stack/ca_stack/#chains) and [tokens](../../web3-stack/ca_stack/#tokens). This wallet showcases the [chain abstraction](../../concepts/ca/chain-abstraction/) solution and unified balance feature for a **select group of popular** [Web3 apps](../../web3-stack/ca_stack/#apps). Arcana CA Wallet See wallet [Help](https://arcananetwork.notion.site/Help-Content-127f11ed0804805fba4dc72ad3f8cdb2) and [FAQ](https://arcananetwork.notion.site/Frequently-Asked-Questions-128f11ed080480ed8679d90e4bb0b96d) resources for details. # API: `ca-wagmi` Integrate Web3 apps using Wagmi with the Arcana CA Wagmi SDK's to enable: - Unified balance - Chain abstracted transactions [Arcana CA Wagmi SDK Reference](https://ca-wagmi-sdk-ref-guide.netlify.app/) # Examples This is a Vue+TypeScript+Vite template that has been enhanced with the Arcana CA SDK integration code. [GitHub](https://github.com/arcana-network/ca-sdk-example/) [Try Now!](https://codesandbox.io/p/github/arcana-network/ca-sdk-example/main) This Wagmi example app demonstrates how to integrate the Arcana CA Wagmi SDK with a Wagmi app. [GitHub](https://github.com/arcana-network/ca-wagmi-example/) [Try Now!](https://codesandbox.io/p/github/arcana-network/ca-wagmi-example/main) This Wagmi example app demonstrates how to onboard users via social login and enable chain abstraction by integrating the Arcana CA Wagmi SDK and the Arcana Auth SDK with a Wagmi app. [GitHub](https://github.com/shaloo/sample-arcana-auth-ca-wagmi-sdks) [Try Now!](https://codesandbox.io/p/github/shaloo/sample-arcana-auth-ca-wagmi-sdks/sample-auth-ca-wagmi-integration) # Why CA SDK? Arcana’s Chain Abstraction SDK can integrate with any Web3 app and enable unified balance for the app users. Unified balance allows users to spend the consolidated multi-chain balance of source chain [tokens](../../web3-stack/ca_stack/#tokens) within the app context on any destination [chain](../../web3-stack/ca_stack/#chains). This allows Web3 apps to onboard users from any ecosystem effortlessly. Integration with the SDK requires minimal effort. ## Onboard Users on Any Chain - **Unified Balance** ______________________________________________________________________ Display users' consolidated balance across chains. Use Arcana’s plug-and-play UI or design your own. - **Flexible Gas Payments** ______________________________________________________________________ Users can pay gas fees in USDC or USDT if they do not have native gas tokens. - **Larger Transactions** ______________________________________________________________________ Users can seamlessly access and spend their entire multi-chain balance on the desired chain, in a single click. - **No Lock-In** ______________________________________________________________________ All assets are in user's custody, no compulsion to rely on Arcana for accessing funds. Users can freely spend their assets on any app. ## Quick Integration - **Frontend Code Updates** ______________________________________________________________________ Requires **minimal** changes to the Web3 app's front-end code. - **No Smart Contract Changes** ______________________________________________________________________ Requires **zero** migration or updates to Web3 app's smart contracts. - **Bring Existing Wallets** ______________________________________________________________________ Users can bring their existing EOA wallets such as MetaMask, Rabby, Rainbow, etc. - **Assets: Zero Lockups or Transfers** ______________________________________________________________________ Users do not need to transfer their funds to a new wallet address or lockup in a smart contract. Arcana CA SDK Demo App: Unified Balance ## Why Chain Abstraction? Chain abstraction addresses multiple blockchain usability issues. It eliminates liquidity fragmentation, enabling users to spend the available source chain unified balance on any destination chain. This offers a superior user experience by eliminating the need for users to navigate multiple blockchain hoops (bridges, token swaps, and determining the optimal route to consolidate funds acceptable on the destination chain). With unified balance, users can onboard a new chain with no assets or spend on a destination chain where the EOA has insufficient funds. The table below illustrates how the user experience is superior with a single-click chain abstracted transaction. | UX: Transact on New Chain | No CA: Complex, Multi-step UX | With CA: One-step UX | | --- | --- | --- | | Figure out which chain your app runs on | | | | Hunt for the best bridge to move assets | | | | Fund gas tokens on different chains | | | | Track and transfer balances across chains | | | | Issue a transaction on a new chain | | | [Learn more...](https://blog.arcana.network/) # Integrate Wagmi App Integrate ['Wagmi'](https://wagmi.sh/) apps with the [Arcana CA Wagmi SDK](../../../concepts/ca/casdk/) to enable: - [Unified balance](../../../concepts/ca/unified-balance/) - [Chain abstracted](../../../concepts/ca/chain-abstraction/) transactions App users can spend funds on any chain. They do not need to switch chains or bridge assets. ## Prerequisites Download and install the SDKs: ``` npm install --save @arcana/ca-sdk @arcana/ca-wagmi ``` ## `CAProvider` Initialize the `CAProvider` component and specify the `CA` object as the `client` param. ``` import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider } from 'wagmi' import { CA } from "@arcana/ca-sdk"; import { CAProvider } from '@arcana/ca-wagmi' import App from "./App.tsx"; import { config } from "./utils/config"; const ca = new CA(); const queryClient = new QueryClient() createRoot(document.getElementById("root")!).render( ); ``` For `CAProvider` methods, see [Arcana CA Wagmi SDK Reference](https://ca-wagmi-sdk-ref-guide.netlify.app//modules). The `CAProvider` component offers hooks with the same name as the Wagmi library. Replace the `useSendTransaction` and `useWriteContract` hooks from the Wagmi library. Instead, use the versions provided by the SDK. These support chain abstracted transactions. ## Wagmi Hooks Replace the following hooks used in the app from the Wagmi library with those from the Arcana CA Wagmi SDK package: ``` import { useSendTransaction, useWriteContract } from "@arcana/ca-wagmi"; // Replace the `wagmi` APIs `useSendTransaction` and `useSendTransactionAsync` const { sendTransaction, sendTransactionAsync } = useSendTransaction(); // Replace the wagmi APIs `useWriteContract` and `useWriteContractAsync` const { writeContract, writeContractAsync } = useWriteContract(); ``` ## Arcana Hooks The SDK also provides hooks for: - Accessing [unified balance](../../../concepts/ca/unified-balance/) - Issuing chain abstracted bridge and transfer functions - Getting a list of user intents - [`useBalance`](#usebalance) - to get the unified balance value across all supported chains for the specified token string - [`useBalances`](#usebalances) - to get the unified balance values across all supported chains for all supported tokens associated with the EOA - [`useBalanceModal`](#usebalancemodal) - to display or hide the unified balance popup widget - [`useCAFn()`](#usecafn) - for chain abstracted bridging and token transfer functionality - [`useGetMyIntents()`](#usegetmyintents) - get the list of intents created by the user ### useBalance The [`useBalance`](https://ca-wagmi-sdk-ref-guide.netlify.app/#md:usebalance) hook fetches the unified balance for the specified token. This is the value across all the supported chains associated with the user's EOA. `useBalance({ symbol: string })` #### Params `symbol`: Required parameter of type `string` with the value equal to one of the supported currency/token symbol. ``` import { useBalance } from "@arcana/ca-wagmi" const balance = useBalance({ symbol: "eth" }) ``` #### Response | Parameter | Type | | --- | --- | | loading | `boolean` | | value | `{ symbol: string, decimals: number, formatted: string, value: bigint} \| null` | | error | `Error \| null` | Sample `useBalance` Response ``` { loading: false, value: { symbol: "ETH", decimals: 18, formatted: "0.000785657313049966", value: 785657313049966n }, error: null } ``` ### useBalances The [`useBalances()`](https://ca-wagmi-sdk-ref-guide.netlify.app/#md:usebalances) hook returns the unified balance value across all the supported chains and all the supported tokens associated with the user's EOA. ``` import { useBalances } from "@arcana/ca-wagmi" const balances = useBalances() ``` #### Response returns response contains the following fields: | Parameter | Type | | --- | --- | | loading | `boolean` | | value | `UseBalanceValue[] \| null` | | error | `Error \| null` | Sample `useBalances` Response ``` { loading: false, value: [{ symbol: "ETH", decimals: 18, formatted: "0.000785657313049966" value: 785657313049966n, breakdown: [{ chain: { id: 1, name: "Ethereum", logo: "..." }, formatted: "0.000785657313049966", address: "0x0000000000000000000000000000000000000000", value: 785657313049966n }] }], error: null } ``` ### useBalanceModal The [`useBalanceModal()`](https://ca-wagmi-sdk-ref-guide.netlify.app/#md:usebalancemodal) hook can be used in the app to display or hide the unified balance modal. This modal displays the following information: - **Overall unified balance:** Total available balance in the user's EOA across all supported chains and tokens - **Per token unified balance:** Total available token balance across all the supported chains, breakup in a list of chains and per chain token balance. ``` import { useBalanceModal } from "@arcana/ca-wagmi" const { showModal, hideModal } = useBalanceModal() ``` #### Response | Field | Type | | --- | --- | | showModal | `() => void` | | hideModal | `() => void` | Plug & Play Unified Balance Widget ### useCAFn The `useCAFn()` hook allows chain abstracted `bridge` and `transfer` transactions. ``` import { useCAFn } from "@arcana/ca-wagmi" const { bridge, transfer } = useCAFn() await bridge({ token: "usdt", amount: "1.5", chain: 42161 }) const hash = await transfer({to: "0x80129F3d408545e51d051a6D3e194983EB7801e8", token: "usdt", amount: "1.5", chain: 10 }) ``` #### Response | Parameter | Type | | --- | --- | | bridge | `({ token: string, amount: string, chain: number }) => Promise` | | transfer | `({ token: string, amount: string, chain: number, to: "0x${string}" }) => Promise` | `useCAFn`: Chain Abstracted Bridge and Transfer ### useGetMyIntents Used to get a list of intents created by the user. `useGetMyIntents(page)` #### Params `page`: Page number; 1 returns latest, max 100 results per page ``` import { useGetMyIntents } from "@arcana/ca-wagmi"; const getMyIntentsResponse = useGetMyIntents(1); ``` #### Response `UseQueryResult` **Sample Response** ``` { isLoading: false, isFetching: false, isSuccess: true, isError: false, data: [{ id: 107, sources: [{ universe: "ETHEREUM", tokenAddress: "0x0b2c639c533813f4aa9d7837caf62653d097ff85", value: 18531n, chainID: 10, }], destinations: [{ tokenAddress: "0xaf88d065e77c8cc2239327c5edb3a432268e5831", value: 10000n, }], destinationUniverse: "ETHEREUM", destinationChainID: 42161 fulfilled: true, refunded: false, expiry: 1750070223, deposited: true }], error: null } ``` **Finished.** The 'Wagmi' app is all set to let users spend on any chain via unified balance and chain abstracted transactions. ## See Also Arcana CA Wagmi SDK Quick Links - [Arcana CA Wagmi SDK Reference](https://ca-wagmi-sdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-ca-release-note/) - [Changelog](https://github.com/arcana-network/ca-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/ca-wagmi) [Try CA Wagmi SDK CodeSandbox](https://codesandbox.io/p/github/shaloo/sample-arcana-auth-ca-wagmi-sdks/sample-auth-ca-wagmi-integration) # Integrate Web App Integrate 'Web3' apps with the [Arcana CA SDK](../../../concepts/ca/casdk/) to enable: - [Unified balance](../../../concepts/ca/unified-balance/) - [Chain abstracted](../../../concepts/ca/chain-abstraction/) transactions App users can spend funds on any chain. They do not need to switch chains or bridge assets. ## Prerequisites [Download](https://www.npmjs.com/package/@arcana/ca-sdk) and install the SDK. ``` npm install --save @arcana/ca-sdk ``` ## Initialize ``` import { CA } from '@arcana/ca-sdk' ``` ``` const provider = window.ethereum const ca = new CA(); //Set the EVM provider ca.setEVMProvider(provider); ``` ``` try { await ca.init() } catch (e) { // Handle exception case } ``` `ca.init()` Use `await` until the `init()` call is complete. Then call any other `CA` method listed in the [Arcana CA SDK Reference](https://ca-sdk-ref-guide.netlify.app/). ## Unified Balance Get unified balance on the supported source chains: - View the total EOA balance for all supported tokens and chains. - View the total EOA balance for a specified token across all chains. ``` //total chain abstracted unified balance across all chains/tokens const balances = await ca.getUnifiedBalances(); //total balance for a specific token across all chains const usdtBalance = await ca.getUnifiedBalance("usdt"); ``` ## CA Transactions Enable chain abstracted transactions through: - `transfer` - `request` - `bridge` ### `transfer` Use unified balance for chain abstracted transactions. ``` const handler = await ca.transfer({ to: "0x...", amount: 5, chainID: 10, //optional, defaults to current chain token: "eth", }); // Execute the transfer const hash = await handler.exec(); // Simulate the transfer, returns intent data and token info const response = await handler.simulate(); ``` ### `request` Replace the standard EIP-1193 provider with a chain-abstracted one using `getEVMProviderWithCA`. Then use it to call `request` with `eth_sendTransaction` to use unified balance. ``` const providerWithCA = ca.getEVMProviderWithCA(); await providerWithCA.request({ method: "eth_sendTransaction", params: [ { to: "0xEa46Fb4b4Dc7755BA29D09Ef2a57C67bab383A2f", from: "0x7f521A827Ce5e93f0C6D773525c0282a21466f8d", value: "0x001", }, ], }); ``` ### Bridge Use the unified balance to deposit tokens on a different chain. Chain abstracted transactions handle the transfer. ``` const handler = await ca.bridge({ token: "usdt", amount: 10, chainID: 137, }); // Execute the bridge await handler.exec(); // Simulate the bridge, returns intent data and token info const response = await handler.simulate(); ``` ## Allowance Allowances are set to `unlimited` by default for all supported chains and tokens. Developers can update the allowance settings via `setOnAllowanceHook()`. App users can approve chain abstracted transactions. They cannot change the allowance set by the app developers. ### `setOnAllowanceHook` Use `setOnAllowanceHook` to set up [allowances](../../../concepts/ca/allowances/) for chain abstracted transactions. The default value is set to `unlimited` for all chains. ``` ca.setOnAllowanceHook(async ({ allow, deny, sources }) => { // This is a hook for the dev to show user the allowances that need to be setup for the current tx to happen // sources: an array of objects with minAllowance, chainID, token symbol etc // allow(allowances): allowances is an array with allowance for each source (len(sources) == len(allowances)) // deny(): stop the flow }) ``` ### Get Allowance Get allowance values configured for the chain abstracted transactions. ``` // Get USDC allowance for Polygon await ca.allowance().tokens(["USDC"]).chain(137).get() // Get USDC & USDT allowance for all supported chains await ca.allowance().tokens(["USDC", "USDT"]).get() // Get all supported token allowances for all supported chains await ca.allowance().get() ``` ## Intents ### `setOnIntentHook` Use `setOnIntentHook` to show the intent details such as the source of funds, applicable fees. ``` ca.setOnIntentHook(({ intent, allow, deny, refresh }) => { // This is a hook for the dev to show user the intent, the sources and associated fees // intent: Intent data containing sources and fees for display purpose // allow(): accept the current intent // deny(): deny the intent and stop the flow // refresh(): should be on a timer of 5s to refresh the intent (if not refreshed old intents might fail due to fee changes) }) ``` ### Get Intents Get the list of intents representing user's request for funds. ``` import type { RFF } from "@arcana/ca-sdk" const page = 1 const intentList: RFF[] = await ca.getMyIntents(page); ``` ## Events Keep track of the user [intent](../../../concepts/ca/intent/) processing stages. Set up a listener to monitor various [intent processing stages](../../../concepts/ca/intent/#stages) during a chain abstracted transaction. ### Add Listener ``` ca.addCAEventListener((data) => { switch(data.type) { case "EXPECTED_STEPS":{ // store data.data(an array of steps which will be followed) state.value.steps = data.data.map(s => ({ ...s, done: false })) state.value.inProgress = true break; } case "STEP_DONE": { const v = state.value.steps.find(s => { return s.typeID === data.data.typeID }) if (v) { v.done = true } break; } } }); ``` ### Remove Listener ``` ca.removeCAEventListener((data) => {...}) ``` Check out the [integration example](https://codesandbox.io/p/github/arcana-network/ca-sdk-example/main) code. **Finished.** The 'Web3' app is all set to let users spend on any chain via unified balance and chain abstracted transactions. ## See Also Arcana CA SDK Quick Links - [Arcana CA SDK Reference](https://ca-sdk-ref-guide.netlify.app/) - [CA FAQ](../../../faq/ca/faq/) - [Release notes](../../../relnotes/latest-ca-release-note/) - [Changelog](https://github.com/arcana-network/ca-sdk/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/ca-sdk) [Try CA SDK Demo](https://sdk.arcana.network) [Vite + CA SDK Integration](https://codesandbox.io/p/github/shaloo/sample-arcana-ca-sdk/main?import=true) # Chain Abstraction Architecture Before we get into the details of Arcana's Chain Abstraction (CA) architecture, let's first understand some key concepts. ## What is CA? Managing multiple chains, tokens, and accounts fragments wallet liquidity for Web3 users. Even with enough assets overall, funds scattered across chains make transacting difficult and require complex, time-consuming conversions. Chain abstraction lets users access a [unified balance](../../../concepts/ca/unified-balance/) across all wallet-linked chains, enabling transactions anywhere. Instead of converting funds first, users specify a [clear intent](../../../concepts/ca/intent/). The protocol collects funds from source chains, shows intent and fees for confirmation, then publishes the intent to solvers. Solvers compete to provide liquidity on the destination chain, and once available, users confirm the transaction. Settlement with solvers happens asynchronously using the collected funds. As part of setup, devs configure [allowances](../../../concepts/ca/allowances/) per chain and token. Users approve or reject these allowances. For [supported tokens](../../../web3-stack/ca_stack/#tokens) on [source chains](../../../web3-stack/ca_stack/#chains), the protocol uses these allowances to deposit required funds for transactions on the destination chain. Arcana's Chain Abstraction ## Why Chain Abstraction? Chain abstraction enables unified balance to simplify and streamline Web3 transactions. It offers: - **Faster Intent Processing:** Enables quick and seamless transaction execution across chains. - **Unified Liquidity:** Provides a consolidated view of user assets across wallet-linked chains with no asset bridging. - **Simplified UX:** Removes multi-step hurdles for a seamless experience, making transactions easy for all users. - **Streamlined DX:** Developers can add unified balances to dApps with minimal changes and no smart contract updates for new chains. ## Arcana CA Offerings Arcana has two CA offerings, one targeted at the Web3 Users and the other for Web3 builders and developers. - Web Apps: Arcana CA SDK - Wagmi Apps: Arcana CA Wagmi SDK - Arcana Wallet (Standalone) ## Architecture Arcana's [Chain Abstraction (CA)](../../../concepts/ca/chain-abstraction/) protocol manages balances across multiple chains and tokens in Web3 apps. It solves liquidity fragmentation by enabling a unified balance across supported chains. The Arcana Vault smart contracts on each supported chain and the solver ecosystem are two key parts of the Arcana CA protocol. There’s no auction; it’s a first-come, first-served system where the first solver to accept an intent gets to fulfill it. The user's EOA state and intents are managed across multiple chains. Approved intents are published for 'solvers' to fulfill. Solvers compete to fulfill these intents and provide liquidity on the destination chain. The protocol handles state transitions and settles solver payments using transaction netting. How Arcana CA Works ## CA Protocol 1. Developer sets up Arcana Chain Abstraction settings enabling cross chain transactions on selected chain types and required [allowances](../../../concepts/ca/allowances/). 1. App users are required to permit the allowance values or reconfigure them if the app allows. Allowances enable Arcana Vault to collect required funds from the EOA account on one or more source chains, as per the user's intent. 1. User submits an intent to spend `n` tokens on a destination chain Y and transact via a Web3 app. 1. Arcana verifies that user has sufficient funds across the source chains in the user's EOA account and adequate allowances are pre-configured to enable chain abstraction, pay gas fees. 1. Funds are moved to the Arcana Vault and user's intent is announced to all listening solvers. 1. The assumption is that one of the available solvers in the system will agree to service the user's intent. As of today, only Arcana solver is supported. We are working with partners to onboard trusted third-party solvers into the ecosystem. 1. Once the solver services the intent and provides the necessary liquidity on the desired destination chain into the user's EOA, the user can instantly spend it. 1. Arcana takes care of managing the settlement at the agreed upon periodicity with the successful solvers. The settlement does not happen after every user transaction but after netting and verification process. 1. In case a transaction fails, or times out waiting for a solver, user's funds deposited from the source chain are refunded within a stipulated time period after verification. Arcana's Chain Abstraction is designed for onboarding users across a wide range of applications, but it is particularly impactful for DeFi applications that depend on deposits in stablecoins like USDC or USDT, as well as native tokens like ETH. Benefits - Remove friction of bridging with a unified multi-chain balance - Larger transaction values - Launch apps on emerging chains while onboarding users from established ecosystems ## Swaps Allow users to execute token swaps on a single chain DEX while using funds held in multiple assets across several chains as a unified balance. For example, a user holding ETH on Optimism and USDC on Arbitrum can seamlessly swap tokens to be able to spend USDT on Polygon without needing to bridge or consolidate assets manually. This removes friction for users, ensuring smoother transactions and higher conversion rates for swap protocols. ## Bridges Bridges enable users to move funds from Chain A to Chain B, but when users hold disparate assets across multiple chains, they face the challenge of tracking and transferring funds chain by chain. With Arcana’s Chain Abstraction, users can bridge their entire multi-chain balance to the desired chain in one step. Example User holds USDC on Arbitrum, USDT on Polygon, some ETH on Optimism and wants to consolidate their funds on Arbitrum. With chain abstraction, instead of manually bridging disparate tokens held across different chains, one at a time, users can issue a single intent to bridge their asset balance from source chains to a desired supported token on Arbitrum in a single step. ## Decentralized Exchanges (DEXes) For liquidity providers and traders, fragmented funds across chains often hinder participation in DEXes. With Arcana, users can trade or provide liquidity on a single-chain DEX (for example, Optimism) using their unified balance from multiple chains, such as Ethereum, Polygon, and Arbitrum. This enables more efficient capital utilization, increases trading volumes, and expands access to liquidity for DEX platforms. ## Perpetuals Trading For protocols that need users to deposit stable coins to a particular address on a specific chain (for example, Hyperliquid on Arbitrum) Arcana’s Chain Abstraction allows users to trade on a perpetual protocol on one chain, like Base, using a unified balance of funds held on Ethereum, Polygon, or other chains. This removes the need for manual bridging and ensures traders can respond quickly to market changes without delays in fund transfers. ## Prediction Markets Prediction markets often have strong user bases tied to specific chains. Arcana’s Chain Abstraction allows users to stake or wager assets on a prediction market hosted on a single chain (for example, Polymarket on Polygon) using funds held across multiple chains. For instance, a user can use their combined stablecoin holdings from Ethereum and Polygon to place a bet on Polygon, ensuring greater cross-chain participation and deeper liquidity for these markets. ## Lending Borrowers and lenders often face challenges when their assets are distributed across chains and they want to access new yield products on specific chains. With Arcana, a user can supply liquidity to a lending protocol on one chain, such as Ethereum, using their unified balance aggregated from other chains like Optimism and Base. This leads to larger deposit and borrow transactions with the access to a larger pool of capital. ## Staking/Restaking Restaking requires users to bring assets or derivatives to specific chains. Arcana enables users to stake or restake assets on a protocol running on a single chain (for example, Polygon) by leveraging their unified balance across multiple chains. For instance, a user with ETH on Ethereum and Arbitrum can stake and restake seamlessly on another chain without manual transfers. This allows users from multiple EVM ecosystems to participate in the protocol. *Stay tuned, Arcana is actively working on supporting additional use cases with the Arcana CA SDK.* How do I fix the polyfilling issues right after import statement when integrating React and Vite app with the Arcana CA SDK? To fix polyfilling issues, make sure `vite.config.ts` has the polyfilling options configured. ``` import { defineConfig, Plugin } from "vite"; import react from "@vitejs/plugin-react"; import { nodePolyfills, PolyfillOptions } from "vite-plugin-node-polyfills"; import tailwindcss from "@tailwindcss/vite"; const nodePolyfillsFix = (options?: PolyfillOptions | undefined): Plugin => { return { ...nodePolyfills(options), resolveId(source: string) { const m = /^vite-plugin-node-polyfills\/shims\/(buffer|global|process)$/.exec( source ); if (m) { return `node_modules/vite-plugin-node-polyfills/shims/${m[1]}/dist/index.cjs`; } }, }; }; // https://vite.dev/config/ export default defineConfig({ plugins: [ react(), tailwindcss(), nodePolyfillsFix({ include: ["buffer"], globals: { Buffer: true, global: true, process: true, }, }), ], define: { "process.env": {}, }, }); ``` Is there a refund if a chain abstracted transaction fails after funds have been pulled out of the source chains in the user's EOA? For chain abstracted transaction safety, follow these guidelines: 1. **Failed transactions?** *Don't panic* - you'll get your tokens back automatically in the next settlement cycle (usually within 15 minutes but it may take an hour in some cases). 1. **Before transacting:** Always check the transaction details including the gas fee requirements, before issuing a transaction. 1. **During transacting:** The status of the chain abstracted transaction is displayed in the app's context. Click on 'View Intent' details link and **save** the unique intent identifier associated with the transaction. You'll need the **intent identifier** if something goes wrong. 1. **Track your transaction:** Use the [Arcana Intent Explorer](https://explorer.arcana.network/) with your intent ID to monitor status. **Critical:** Keep your app/wallet open and logged in if you encounter a failed transaction—refunds require an active session and typically complete within 15 minutes. 1. **No refund after 1 hour:** The protocol auto-retries, but you must stay logged in. If you closed the app/wallet, reopen and log back in to enable refund processing. Did not get a refund? Contact Arcana team via the [support](../../../support/) channels and make sure you mention the **intent identifier** that failed to refund or your wallet address with date / time of the transaction. **Bottom line:** Your funds are protected - failed transactions always get refunded, either automatically or with the team's assistance. Viewing Refund To view the refund, the user must open or log into the app and access the wallet that was used to sign the intent and confirm the chain abstracted transaction. Why is liquidity fragmentation an issue and how does chain abstraction solve it? Liquidity fragmentation is an issue because it makes it difficult for users to spend their assets on any chain. Let us take a simple case of a user's wallet that contains 3 USDC on Arbitrum and 2 USDC on Optimism. If the user intends to send 4 USDC on Base, it is not possible to do so through a traditional wallet because there is liquidity fragmentation for USDC in the wallet across Arbitrum and Optimism. To be able to send USDC on Base, there are multiple complex steps for the user. First, there is no USDC on Base to be sent. The user cannot directly spend USDC on Base even though there are enough USDC tokens when put together on the other two chains in the same wallet account. To spend on Base, the user has to bridge tokens from one or more source chains. That is a complex, multi-step, multi-click, time-consuming process. It also needs non-trivial knowhow about secure bridging and getting the best token exchange deals. Next, the user is required to switch the network to Base and then send the tokens. [Chain Abstraction (CA)](../../../concepts/ca/chain-abstraction/) enables unified balance across source chains that can help the user spend 4 USDC on Base with a single click. The user is not required to manually convert the tokens on Optimism or Arbitrum to make this transaction on Base. With a unified balance, onboarding a new chain does not necessarily require the user to procure tokens on the new chain. The user can pledge or sign an intent to send tokens from any of the source chains to the destination chain. I'm a Web3 dApp developer. how can I enable unified balance for dApp users? Download and [install the appropriate CA SDK flavor](../../../ca/ca-sdk-installation/) as per the app type. - **Web3 apps**: Install the [Arcana CA SDK](https://www.npmjs.com/package/@arcana/ca-sdk). Check out the integration example in [codesandbox](https://codesandbox.io/p/github/arcana-network/ca-sdk-example/main) - Web3 apps using the **Wagmi library**: Install the [Arcana CA Wagmi SDK](https://www.npmjs.com/package/@arcana/ca-wagmi). Try the [codesandbox](https://codesandbox.io/p/github/arcana-network/ca-wagmi-example/main) integration example. Refer to the respective SDK quick start guide for integration details. I'm a Web3 wallet user, how can I enjoy unified balance with chain abstraction? Web3 wallet users can unify assets across chains and spend on any chain. To do this, they must log into a Web3 app that is integrated with the Arcana CA SDK and supports any third-party browser-based wallet. Alternatively, wallet users can [download](https://chromewebstore.google.com/detail/arcana-wallet/nieddmedbnibfkfokcionggafcmcgkpi) and install the Arcana Standalone CA wallet browser extension to try [unified balance](../../../concepts/ca/unified-balance/) in the context of some of the popular [Web3 apps](../../../web3-stack/ca_stack/#apps). Why do users need to pay gas fees to set up CA with Layer 1 chains? When setting up Arcana chain abstraction to include Layer 1 chains, users need ETH to pay gas fees for signing the token allowance transaction with the Arcana vault smart contract. The Arcana standalone CA wallet doesn't cover these Layer 1 chain gas fees. As a result, users who choose to include Layer 1 chains in their CA scope must pay these gas fees themselves to set up the CA allowance. What is a CA allowance and why are allowances needed? Allowance or 'Permit' in the blockchain context allows a third party, such as a smart contract, to perform transactions from a user's EOA for a specified amount — without accessing the user's private key. In Arcana chain abstraction, [allowances](../../../concepts/ca/allowances/) enable unified balance. This lets users spend on any destination chain when they have enough funds and gas fees on their source chains. Which ERC20 tokens does the unified balance feature support? Refer to the latest [supported token list](../../../web3-stack/ca_stack/#tokens). Which chains does the unified balance feature support? Arcana's chain abstraction and unified balance works for some select [chains](../../../web3-stack/ca_stack/#chains) and [tokens](../../../web3-stack/ca_stack/#tokens). We are working on adding support for more chains in the future. Does dApp integration with the Arcana CA SDK enable an in-app wallet like the Auth SDK? No there is no built-in in-app wallet offered by the Arcana SDKs. Web3 apps integrating with the Arcana CA SDK must use a third-party wallet for blockchain transactions. How does a dApp access unified balance for a user account? The dApp must download and integrate with the CA-SDK and use the EIP-1193 provider to access the unified balance in the context of an authenticated user. See [Arcana CA SDK Reference](https://ca-sdk-ref-guide.netlify.app/) and [the usage guide](../../../ca/ca-usage-guide/) for details. Does the Arcana CA SDK enable unified balance and chain abstracted transactions in a Web3 app built using Wagmi? For Web3 app built using Wagmi, integrate with the Arcana CA Wagmi SDK. How do I enable unified balance and chain abstracted `sendTransaction`, `bridge` and `transfer` functions in a Web3 app that uses the Wagmi library? To enable unified balance and chain abstraction in a Web3 app that uses the Wagmi library, integrate the app with the Arcana CA Wagmi SDK. This SDK replaces the Wagmi hooks: `useSendTransaction` and `useWriteContract`. Additionally, it provides hooks such as `useBalance`, `useBalanceModal` and `useCAFn` to enable unified balance plug-and-play popup modal and chain abstracted `bridge` and `transfer` functions. For details see [Arcana CA Wagmi SDK Quick Start Guide](../../../quick-start/ca-wagmi-quick-start/) and the [Arcana CA Wagmi SDK Reference](https://ca-wagmi-sdk-ref-guide.netlify.app/). Who is the target audience for the Arcana CA SDKs? Arcana CA SDKs help Web3 dApp developers handle fragmented blockchain assets, letting users spend on any chain. These SDKs can integrates with dApps to offer unified balances across chains and chain abstracted transactions. For a complete list of real life applications of unified balance, see [use cases](../../../ca/introduction/use-cases/) section. Who is the target audience for the standalone Arcana standalone CA wallet? The standalone Arcana standalone CA wallet is meant for wallet users that want to try unified balance in the context of some of the popular [Web3 apps](../../../web3-stack/ca_stack/#apps). It enables unified balance and solves liquidity fragmentation when using any of the supported [chains](../../../web3-stack/ca_stack/#chains) and [tokens](../../../web3-stack/ca_stack/#tokens) in the context of these supported [Web3 apps](../../../web3-stack/ca_stack/#apps). We will be adding support for newer Web3 apps soon. $100 limit The standalone Arcana standalone CA wallet has a $100 limit for transactions needing chain abstraction. Transfers on the same chain have no limit. Can you give me an example of liquidity fragmentation and how the CA SDK solves it? **Liquidity Fragmentation** Imagine a user with assets spread across chains: Arbitrum: 3 USDC Optimism: 4 USDC Base: 0 USDC Ethereum: 0.001 ETH If the user wants to send 5 USDC to Base, they can't because no single chain has enough funds. Liquidity fragmentation forces the user to make multiple transactions, complicating the process. **How unified balance through chain abstraction solves this?** With chain abstraction, users first set up allowances before issuing a multi-chain transaction intent. In this case, the user signs an intent to send 5 USDC to Base by pledging 3 USDC from Arbitrum and 2.2 USDC from Optimism (including gas and service fees). The intent specifies the amount to be deposited on source chains and the agreed amount received on the destination chain. Arcana's Chain Abstraction protocol collects the pledged tokens and gas fees based on the user's allowances. Once the intent is signed, Arcana processes the 5 USDC transaction on Base and deducts the gas fee from the pledged USDC. Can I request gas tokens using ERC20 through Arcana Chain Abstraction?? Yes, you can request gas tokens using ERC20 via Chain Abstraction. For example, if you have 13 USDC and 0 ETH on Optimism but need to make a 15 USDC transaction requiring 0.0000001 ETH for gas, you'll need an extra 2 USDC plus the gas fee. You can pledge or sign an intent to pay the additional USDC and gas fees using funds from other supported chains like Arbitrum or Base, assuming you have enough USDC to cover the deficit and fees. Once you sign the intent, Arcana CA SDK supplies the needed USDC and gas in a single transaction. Charges include the deficit amount, CA Gas Fees, protocol fees, and Solver fees. *Note: Fees are deducted from the main token requested, such as USDC. Arcana CA SDK supports ETH, USDC, and USDT.* Can a user review intent details before issuing a transaction that requires chain abstraction with two or more source chain tokens? Yes, user's can review the intent details before issuing a CA transaction via the Arcana CA Wallet. Before submitting a transaction, click 'View Intent' to see the intent details. Once the transaction is successful, there are options to view the intent details as well as the transaction details. To view the intent details at a later point in time, you need to save the intent identifier displayed in the details during the transaction, before closing the wallet screen. Use the Arcana Intent Explorer accessible at: and enter the intent ID to view details at a later time. View Intent Details Can I use `transfer` function to deposit chain abstracted unified balance funds to a smart contract and update the blockchain state? No. `transfer` does not support `data`. Use [`request` with `sendTransaction`](https://ca-sdk-ref-guide.netlify.app/#quick-start) to deposit funds to a smart contract and update the blockchain state. Sending 0.1 USDC from 0.3 USDC balance uses funds from other chains. Why isn't this a normal transaction since sufficient balance exists locally? The transaction uses chain abstraction because you need both sufficient tokens AND gas fees for a normal transaction. Even though 0.1 USDC < 0.3 USDC balance, the remaining 0.2 USDC may not cover the gas fees. When local funds can't cover transaction amount + gas fees, the system pulls from other chains' allowances to make up the difference, making it a chain-abstracted transaction instead of normal. # Auth # Web3 Made Effortless Seamlessly onboard Web3 app users without friction. Web3 app usage should not necessitate setting up and connecting a Web3 wallet for login and authentication. Onboard Web3 app users via familiar Web2 login providers. Enable authenticated users to immediately access the in-app, non-custodial Arcana wallet for signing blockchain transactions. Integrate Web3 apps with the Arcana Auth SDK to enable [social login](../concepts/social-login/). **TL;DR** | [Setup](../setup/config-auth/register-app/) | [Install](../auth/sdk-installation/) | [Quick Start](#quick-start) | [Examples](https://github.com/arcana-network/auth-examples) | [Usage](../introduction/) ## Quick Start What kind of Web3 app do you have? Select the appropriate app type and get started with integrating the Arcana Auth SDK. [Wagmi](../quick-start/wagmi-quick-start/) [RainbowKit](../quick-start/rainbowkit-quick-start/) [Web3-React](../quick-start/web3-react-quick-start/) [WalletConnect](../quick-start/walletconnect-quick-start/) [HTML/CSS/JS](../quick-start/vanilla-web-apps-quick-start/) [React/NextJS](../quick-start/react-nextjs-quick-start/) [Vue](../quick-start/vue-quick-start/) [Solana](../quick-start/solana-quick-start/) [MultiversX](../quick-start/mvx-quick-start/) [Near](../quick-start/near-quick-start/) [React-Native](../quick-start/react-native-quick-start/) [Flutter](../quick-start/flutter-quick-start/) [Unity](../quick-start/unity-quick-start/) Advanced Usage You can let Web3 app users onboard via [social login](../concepts/social-login/) and spend [unified balance](../concepts/ca/unified-balance/) on any chain through [chain abstracted transactions](../concepts/ca/chain-abstraction/). For this, the app must be integrated with both the Arcana CA SDK as well as the Arcana Auth SDK. [Learn more...](../quick-start/auth-ca-wagmi-quick-start/) ## Demo Would you like to experience how social login works without actually integrating your Web3 app with the Arcana Auth SDK? Try the SDK integration demo app. [### SDK Integration Demo](https://demo.arcana.network) ## Auth Playground [### Try Now](https://codesandbox.io/p/github/shaloo/auth-sdk-example-vite-vue/main?import=true) ## Onboard with Zero Friction Let users log into your Web3 app securely without having to deal with Web3 specific complexities. Integrate with Arcana Auth SDK to enable social login. - **Social Login** ______________________________________________________________________ Enable Web2-like login in Web3 apps with Arcana Auth SDK and enable in-app Arcana wallet. [Learn More...](../concepts/social-login/) - **Set up in 2m** ______________________________________________________________________ Use Arcana Developer Dashboard to register app, configure settings and manage user experience. [Configure](../setup/config-dApp-with-db/) - **Integration Examples** ______________________________________________________________________ Get up and running quickly with these integration examples for various supported Web3 apps. [Integration Examples](https://github.com/arcana-network/auth-examples) - **Resources** ______________________________________________________________________ Release notes, migration guides, Dashboard Settings Guide, FAQ, integration checklists and more. [Resources](https://docs.arcana.network/relnotes/latest-auth-release-note/) ## Need Help? 📨 [Email Arcana Support](mailto:support@arcana.network) ✅ Be a part of the [Arcana Community](../support/). Stay informed about the new upcoming SDK capabilities and usage examples. [Integration Checklist](../checklists/) # Auth-Core SDK The Arcana Auth-Core SDK is a client-side tool for developers to assign Web3 keys to authenticated users for signing blockchain transactions. Use this SDK instead of the Arcana Auth SDK for key assignment or when building a completely whitelisted solution. When initializing Arcana Auth-Core SDK, the developer sets the redirect URL. The SDK performs OAuth2 login with the chosen provider and returns the login token from the provider. At the specified redirect URL, the developer uses this token to fetch the user's private key. Limited Feature SDK The Arcana Auth-Core SDK has limited capabilities as compared to the Arcana Auth-Core SDK: - No built-in plug-and-play login UI feature - No built-in Arcana wallet UI - No support for Global keys, only app-specific keys (default) are allowed. - No support for enhanced wallet security via MFA. Contact [support](mailto:support@arcana.network) to access the latest release. [SDK Reference](https://auth-core-sdk-ref-guide.netlify.app/) ## Installation ### npm ``` npm install --save @arcana/auth-core ``` ### yarn ``` yarn add @arcana/auth-core ``` ### CDN ``` ``` ``` ``` ## Usage ### Import ``` const { AuthProvider, SocialLoginType, CURVE } = window.arcana.auth_core; // or import { AuthProvider, CURVE } from '@arcana/auth-core'; ``` ### Initialize `AuthProvider` ``` const auth = new AuthProvider({ curve: CURVE.ED25519, // defaults to CURVE.SECP256K1 appId: `${appId}`, redirectUri: '' }); ``` ### Initiate Social Login ``` await auth.loginWithSocial(SocialLoginType.google); ``` ### Initiate Passwordless Login ``` const result = await auth.loginWithPasswordlessStart(`${emailAddress}`, PasswordlessOptions); ``` ### Get Login Status ``` const loggedIn = auth.isLoggedIn(); /* boolean response */ ``` ### Get User Info After successful login, the user information is saved in memory. Before the page `unload` event, the user information gets stored in `session-storage`. After a successful page reload, it is fetched again to memory and removed from the `session-storage`. ``` const userInfo = auth.getUserInfo(); /* UserInfo: { loginType: 'google', userInfo: { id: 'abc@example.com', name: 'ABC DEF', email: '', picture: '' }, privateKey: '' } */ ``` For userInfo type details, see [Exported Types](#exported-types). ### Get Public Key ``` const publicKey = await auth.getPublicKey({ verifier: SocialLoginType.google, id: `abc@example.com`, }); ``` For details regarding `SocialLoginType`, see [Exported Enums](#exported-enums). ### Clear Login Session ``` await auth.logout(); ``` ## TypeScript Usage ### Exported Enums ``` enum SocialLoginType { apple = 'apple', google = 'google', discord = 'discord', twitch = 'twitch', github = 'github', twitter = 'twitter', telegram = 'telegram', passwordless = 'passwordless', } ``` ### Exported Types ``` interface KeystoreInput { id: string; verifier: LoginType; } interface InitParams { // arcana app id with network hint, ex xar_dev_xyz - xyz is the appId appId: string; network?: 'dev' | 'testnet'| 'mainnet'; /* defaults to testnet */ /** * autoRedirect: is redirected via SDK, instead of `loginWithSocial` * output being `{ url }` */ autoRedirect: boolean /* defaults to true */ /** * shouldVerifyState: state is compared internally, the state is stored * to local storage on login init */ shouldVerifyState: boolean /* defaults to true */ /** * revokeTokenPostLogin: Some tokens need to be revoked to get new tokens * on subsequent login or to prevent misuse, SDK does this internally. If * set to `false` there is a cleanup function that is output of the func * `auth.handleRedirectMode()` which should be called after token is used * for secondary purpose */ revokeTokenPostLogin: boolean /* defaults to true */ debug?: boolean; /* defaults to false */ } interface GetInfoOutput { loginType: SocialLoginType; userInfo: UserInfo { id: string; email?: string; name?: string; picture?: string; }; privateKey: string; } ``` ## Flow Modes ### Redirect `login.js` ``` window.onload = async () => { const auth = new AuthProvider({ appId: `${appId}`, redirectUri:'path/to/redirect' }); googleLoginBtn.addEventListener('click', async () => { await auth.loginWithSocial(SocialLoginType.google); }); } ``` `redirect.js` ``` window.onload = async () => { const auth = new AuthProvider({ appId: `${appId}`, redirectUri:'path/to/redirect' }); await auth.handleRedirect(); if(auth.isLoggedIn()) { const info = auth.getUserInfo(); } } ``` ### Variables - `origin` - Base URL of the app. # Auth Demo Do you wish to experience how social login can remove the friction of onboarding users to any Web3 app before you try to enable that in your Web3 app? Experience the power of social login for onboarding Web3 apps in a frictionless manner. Click to log into the Arcana Auth SDK demo app. [### SDK Integration Demo](https://demo.arcana.network) This sample app integrated with the Arcana Auth SDK, demonstrates the following features: - Any user, even those who do not yet have their own keys or a wallet to connect to the app, can onboard Web3 app integrated with the Arcana Auth SDK. - Use of familiar Web2 authentication mechanisms (for example, Google, passwordless login, etc.) to onboard Web3 app - Automatic access to a secure, self-custodial, in-app, embedded, built-in Arcana wallet right after user authenticates. - No need to download or set up a Web3 wallet - own your in-app wallet and its assets. - Upon subsequent log ins, access the same wallet. - In-app wallet allows users to import keys if they wish to use EOA accounts associated with any third-party browser-based wallets. # Auth Errors If you integrate a Web3 app with the Arcana Auth SDK, you might encounter some of the following errors depending on user actions, app logic, and the sequence of Arcana Auth SDK function calls. For more insights, refer to the [Arcana Auth SDK troubleshooting guide](../../troubleshooting/). ## Error Messages | Error | Description | | --- | --- | | wallet_not_initialized | Wallet is not initialized. Please run `await wallet.init()` before calling any other wallet functions. | | user_not_logged_in | User is not logged in. First, trigger user login and after successful authentication, you can use wallet functions. | ## Passwordless Authentication Errors | Error | Description | | --- | --- | | authorize_params_missing | Missing one or more required params. | | login_token_already_used | Login token is invalid or has already been used. | | login_token_not_found | Login token not found in query params. | | login_token_invalid | Login token is invalid. | | user_token_not_found | User token not found in header or query. | | user_token_invalid | User token is invalid. | # Arcana Auth SDK Usage Use the Arcana Auth SDK to onboard users via social login, allow users to access the in-app Arcana wallet and sign blockchain transactions. \[[Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/)\](https://authsdk-ref-guide.netlify.app/) ## Installation ### NPM/Yarn Install ``` npm install --save @arcana/auth yarn add @arcana/auth ``` ### CDN Install ``` ``` ``` ``` ______________________________________________________________________ ## Quick Start with `ethers.js` ``` import { AuthProvider } from '@arcana/auth' import { ethers } from 'ethers' // clientId: Arcana Unique App Identifier via Dashboard const auth = new AuthProvider(`${clientId}`) window.onload = async () => { try { await auth.init() const arcanaProvider = await auth.connect() const provider = new ethers.providers.Web3Provider(arcanaProvider) await provider.getBlockNumber() // 14983200 } catch (e) { // log error } } ``` ______________________________________________________________________ ## Quick Start with `web3.js` ``` import { AuthProvider } from '@arcana/auth' import Web3 from 'web3' // clientId: Arcana Unique App Identifier via Dashboard const auth = new AuthProvider(`${clientId}`) window.onload = async () => { try { await auth.init() const arcanaProvider = await auth.connect() const provider = new Web3(arcanaProvider) await provider.getBlockNumber() } catch (e) { // log error } } ``` ______________________________________________________________________ ## Usage ### AuthProvider #### Import AuthProvider ``` const { AuthProvider } = window.arcana.auth // From CDN // or import { AuthProvider } from '@arcana/auth' // From npm ``` #### Initialize AuthProvider ``` import { AuthProvider } from '@arcana/auth' const auth = new AuthProvider(`${clientId}`, { position: 'left', // default - right theme: 'light', // default - dark alwaysVisible: false, // default - true setWindowProvider: true, // default - false connectOptions: { compact: true, // default - false }, }) await auth.init() ``` See [Get Started with Auth SDK](https://docs.arcana.network/quick-start/wagmi-quick-start/) for more Auth SDK usage insights. ### Auth API #### Plug and Play Authentication ``` const provider = await auth.connect() ``` #### Custom Login Social login ``` // loginType - Apple, Cognito, Discord, GitHub, Google, Steam, Twitch, Twitter const provider = await auth.loginWithSocial(`${loginType}`) // Note: Use loginWithBearer method for Telegram, Firebase ``` Passwordless login via an email verification OTP ``` await auth.loginWithLink(`${email}`) ``` Deprecated `loginWithLink` is deprecated. Use `loginWithOTPStart`, `loginWithOTPComplete` for passwordless login with OTP. The OTP will be received via email supplied in `loginWithOTPStart` call. Passwordless login via OTP ``` try { const loginState = await auth.loginWithOTPStart("john.doe@somemail.com"); await loginState.begin() if(loginState.isCompleteRequired) { // App is using default app-specific keys // App must ask the user to input a 6-digit code received in mail var userInput = prompt("Please enter a 6-digit code:", "111111"); // Validate if the input is a 6-digit code if (userInput !== null && userInput.length === 6 && !isNaN(userInput)) { const complete = await auth.loginWithOTPComplete( userInput, onMFARequired() => { //Hide overlay, if used in the app }); console.log("complete:",complete); } else { console.log("Invalid input. Please enter a valid 6-digit code."); } } else { // App is using global keys, built-in OTP input UI is displayed by the SDK // App is not required to add code for OTP input } } catch (e) { console.log(e); } ``` Check if a user is logged in ``` const isloggedIn = await auth.isLoggedIn() // boolean ``` Check and reconnect, if required, within a 30-minute window after logout. ``` const canReconnect = await auth.canReconnect() // auth.reconnect() should be on a click event since it opens a new tab await auth.reconnect() ``` Get user information. The loginToken is a JWT Token that can be verified by using the public JWT Key. In the future this will be deprecated. Refer to userDIDToken. It is base64 encoded data `base64(JSON.stringify([sig, claims]))` ``` const info = await auth.getUser() /* interface UserInfo { address: string; email?: string; id: string; userDIDToken: string; loginToken: string; loginType: Logins | "passwordless"; name?: string; picture?: string; publicKey: string; } */ ``` Show wallet UI ``` auth.showWallet() ``` #### Logout ``` await auth.logout() ``` ### Get Public Key Get the public key associated with an email. ``` await auth.getPublicKey(`${email}`) ``` ### Encryption #### ECIES Encryption The wallet uses ECIES to decrypt cipher text, so a complementary encryption method has to be used from package `eth-crypto`. ``` import EthCrypto from 'eth-crypto' const encrypted = await EthCrypto.encryptWithPublicKey( 'bf1cc3154424dc22191941d9f4f50b063a2b663a2337e5548abea633c1d06ece...', // publicKey 'foobar' // message ) ``` ______________________________________________________________________ ## Arcana Wallet Operations Arcana wallet is an embedded Web3 wallet offered via the Auth SDK. It uses [Ethereum JSON-RPC](https://ethereum.github.io/execution-apis/api-documentation/) to interact with the blockchains. ### JSON RPC Support Arcana wallet implements the following common interfaces exposed by all Ethereum clients: - [eth_accounts](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts) - [eth_getBalance](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getbalance) - [eth_sendTransaction](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - [eth_sign](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign) - [eth_call](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_call) ### Switching Chains #### `wallet_addEthereumChain` This method is specified by [EIP-3085](https://eips.ethereum.org/EIPS/eip-3085). ``` try { await provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: '0xABCDEF', chainName: 'My Custom Chain', rpcUrls: ['...'] }] }) } catch(error) { ... } interface AddEthereumChainParameter { chainId: string; // A 0x-prefixed hexadecimal string chainName: string; nativeCurrency: { name: string; symbol: string; // 2-6 characters long decimals: 18; }; rpcUrls: string[]; blockExplorerUrls?: string[]; } ``` #### `wallet_switchEthereumChain` This method is specified by [EIP-3326](https://eips.ethereum.org/EIPS/eip-3326). ``` try { await provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0xf00' }], }); } catch(error) { ... } interface SwitchEthereumChainParameter { chainId: string; // A 0x-prefixed hexadecimal string } ``` If the error code (error.code) is 4902, then the requested chain has not been added, and you have to request to add it via `wallet_addEthereumChain`. #### `wallet_watchAsset` This method is specified by [EIP-747](https://eips.ethereum.org/EIPS/eip-747) ``` await provider.request({ method: 'wallet_watchAsset', params: { type: 'ERC20', options: { address: '0xB983E01458529665007fF7E0CDdeCDB74B967Eb6', symbol: 'FOO', decimals: 18, image: 'https://foo.io/token-image.svg', }, }, }) ``` Check out [Auth SDK Reference Guide](https://authsdk-ref-guide.netlify.app/) for details. # Integrate Custom Auth App Integrate ['Custom-Auth'](../../concepts/authtype/custom-auth/) apps with [Arcana Auth SDK](../../concepts/authsdk/) and allow authenticated users to sign blockchain transactions with the in-app [Arcana wallet](../../concepts/anwallet/). ## Prerequisites - The app should be [registered and configured for using custom Auth](../../setup/config-custom-auth/) using the Arcana Developer Dashboard. - You will require the following to integrate the app with the SDK: - Unique *Client ID* assigned to the app after registration. - *Provider identifier* value displayed in the registered app settings in the dashboard **after configuring and saving** the custom Auth settings. ## 1. Install Depending upon the [app type](../../web3-stack/apps/), you may need to [install one or more SDKs](../sdk-installation/) and the integration code may vary from one app type to another. ## 2. Integrate App Select the app type and follow the instructions to integrate the app with the SDK. [HTML/CSS/JS App](../integrate/vanilla-html-css-js/) [React/Next.js App](../integrate/react-nextjs/) [Wagmi App](../integrate/wagmi/) [WalletConnect App](../integrate/walletconnect/) [RainbowKit App](../integrate/rainbow/) [Web3-React App](../integrate/web3-react/) [Unity App](../integrate/unity/) [Flutter Apps](../mobile/flutter-get-started/) [React-Native Apps](../mobile/react-native-get-started/) [Custom Auth](./) No user onboarding When using custom authentication, apps **do not onboard users** via the social login feature of the Arcana Auth SDK. Simply integrate with the SDK, access `AuthProvider` and call `loginWithCustomProvider` to provision the user's keys for signing blockchain transactions. ## 3. Call `loginWithCustomProvider` After the user logs in successfully via custom authentication solutions, get the JWT and provide it as input to the Arcana Auth SDK method below: ``` await auth.loginWithCustomProvider({ token: params.token, //JWT Token userID: params.userID, // Email or ID as configured in the Dashboard settings provider: "provider-id-name", //Custom Auth Provider identifier displayed in the Dashboard }); ``` Upon success, `loginWithCustomProvider` will ensure that the authenticated user's key shares are fetched locally and the user key is generated within the app/user context securely, with full privacy. Sample Code Refer to [Custom Auth Frontend](https://github.com/arcana-network/custom-provider-fe-example) and [Custom Auth Server](https://github.com/arcana-network/custom-provider-server-example) for details. These are examples of a custom authentication server and a frontend that uses the `loginWithCustomProvider` method for fetching authenticated user's keys to perform blockchain transactions. ## What's Next? Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../web3-ops/evm/) in the authenticated user's context. ## See also **'Custom-Auth'** integration example: See `sample-auth-custom-oauth` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../faq/faq-gen/) - [Troubleshooting Guide](../../troubleshooting/) - [Arcana Auth SDK Errors](../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../auth-usage-guide/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) [Try Demo App](https://demo.arcana.network) # Custom Wallet UI Learn how a Web3 app can use a custom wallet UI instead of the default, built-in, [Arcana wallet](../../concepts/anwallet/) UI and integrate with the [Arcana wallet](../../concepts/authsdk/) to enable [social login](../../concepts/social-login/) and allow users to sign blockchain transactions. ## Prerequisites To log into the Arcana Developer Dashboard, you’ll need an account with a supported social login or use email for passwordless access. - Google - GitHub - Twitch - Discord ## 1. Dashboard Login Use to log in with one of the available options. Developer Dashboard Login Page Aggregate Login The [aggregate login](../../concepts/aggregatelogin/) feature in the Arcana Auth SDK merges login identities from social providers into one Arcana account if the email ID is the same across these providers. Developers can log into the Arcana Developer Dashboard using any supported provider and still access the same Arcana account and app settings. ## 2. Register App Use the dashboard to create a new app entry and [register the app](../../setup/config-auth/register-app/). While specifying the new app name and other details, specify the **Wallet UI Mode** setting as 'Custom UI'. By default, it is set to use the built-in, Arcana wallet UI. Then click the 'Create' button to confirm app registration. Once registered, you cannot change the **Wallet UI Mode** setting. Choose Custom Wallet UI ## 3. Configure Social Login Follow the instructions to [configure social login](../../setup/) and [custom IAM providers](../../setup/config-idm/) if required, before integrating the app with the Arcana Auth SDK. ## 4. Integrate App Select the app type and follow the instructions to integrate the app with the SDK. [HTML/CSS/JS App](../integrate/vanilla-html-css-js/) [React/Next.js App](../integrate/react-nextjs/) [Wagmi App](../integrate/wagmi/) [WalletConnect App](../integrate/walletconnect/) [RainbowKit App](../integrate/rainbow/) [Web3-React App](../integrate/web3-react/) [Unity App](../integrate/unity/) [Flutter Apps](../mobile/flutter-get-started/) [React-Native Apps](../mobile/react-native-get-started/) [Custom Auth](../custom-auth/) ## 5. Onboard Users Apps that are integrated with the Arcana Auth SDK can choose the built-in [plug-and-play login UI](../../concepts/plug-and-play-auth/) or use custom login ui to onboard users. User Onboarding Considerations 1. **Log in Options:** What options are offered by the app to the onboard users via social login? *Configure the required [social login providers](../../setup/config-auth/) via the dashboard.* 1. **Built-in or Custom Login UI:** Does the Web3 app have a custom login UI or do they need to use the built-in, [plug-and-play login UI](../../concepts/plug-and-play-auth/) modal offered by the Arcana Auth SDK? *Choose the appropriate onboarding functions of the `AuthProvider`.* 1. **Session Management:** Does the authenticated user stay logged in if they accidentally close the browser tab? If yes, what is the acceptable Web3 app security window for the session? After how long should the session expire and a user re-login is necessitated for security? *Configure the [session management settings](../../setup/config-dApp-with-db/#login-session-management) via the dashboard.* 1. **Reconnect:** Does the Web3 app allow users to stay connected or require re-authentication after a certain time has elapsed? *Use `isConnected`, `canReconnect` and `reconnect` functions of the `AuthProvider`.* [Wagmi Apps](../onboard/wagmi/wagmi-pnp-ui/) [RainbowKit Apps](../onboard/rainbow/rainbow-pnp-ui/) [WalletConnect Apps](../onboard/walletconnect/walletconnect-pnp-ui/) [Web3-React Apps](../onboard/web3-react/web3-react-pnp-ui/) [React/Next.js Apps](../onboard/react-nextjs/use-plug-play-auth/) [Vanilla HTML/CSS/JS App](../onboard/vanilla/use-plug-play-auth/) [Vue App](../onboard/vue/use-plug-play-auth/) [Flutter Apps](../mobile/flutter-get-started/) [React-Native Apps](../mobile/react-native-get-started/) [Wagmi Apps](../onboard/wagmi/wagmi-custom-ui/) [RainbowKit Apps](../onboard/rainbow/rainbow-custom-ui/) [WalletConnect Apps](../onboard/walletconnect/walletconnect-custom-ui/) [Web3-React Apps](../onboard/web3-react/web3-react-custom-ui/) [React/Next.js Apps](../onboard/react-nextjs/custom-ui/) [Vanilla HTML/CSS/JS App](../onboard/vanilla/custom-ui/) [Vue App](../onboard/vue/custom-ui/) [Flutter Apps](../mobile/flutter-get-started/) [React-Native Apps](../mobile/react-native-get-started/) ## Advanced Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. Global vs. App Specific Keys Apps using app-specific keys must use a custom login UI that allows users to input the OTP. In this case, the `isCompleteRequired` boolean returns `true` after initiating login with OTP. Apps using global keys are not required to use a custom login UI. A built-in login UI is automatically displayed for the user for OTP. Users must enter the OTP received via email in this UI. MFA Enabled / Disabled During passwordless login via OTP, apps configured for MFA and those using overlays must hide it to enable OTP input. Use the `isMFARequired` callback in the `loginWithOTPComplete` method to hide the overlay. Reconnect Users Use `canReconnect` and `reconnect` methods of `AuthProvider` within a 30-min window of the user-logout action. Allow users to automatically reconnect to the app without re-authentication. See [`canReconnect`](https://authsdk-ref-guide.netlify.app/classes/authprovider#canReconnect) and [`reconnect`](https://authsdk-ref-guide.netlify.app/classes/authprovider#reconnect) for details. Apps Using Custom Auth Web3 apps that use custom user authentication solutions and require authenticated users to sign blockchain transactions can also integrate with the Arcana Auth SDK. These apps can skip the social onboarding feature and use `loginWithCustomProvider` function of the `AuthProvider` to assign keys securely. [Learn more...](../custom-auth/) ## 6. Plug in Custom Wallet UI Once user onboarding logic is in place, add code to wire your custom wallet UI to enable wallet operations. - Issue Wallet Ops - Manage User Control - Export Private Key ### Issue Wallet Ops During app integration with Arcana Auth SDK, an `AuthProvider` is created. This provider is a standard Ethereum EIP-1193 provider. It facilitates wallet interactions with the blockchain. Use `AuthProvider` to call the [JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/) and handle [Web3 wallet operations for the selected chains](../web3-ops/evm/). Add code to trigger wallet actions like sending transactions, signing messages, and executing contract calls. Sample Code The following code snippet shows how an HTML/CSS/JS app can integrate with the Arcana Auth SDK, onboard users via plug-and-play login UI and use the standard EIP-1193 Ethereum provider for issuing blockchain transactions through a custom wallet UI. ``` import { AuthProvider } from "@arcana/auth"; import { ethers } from 'ethers'; let provider; const auth = new AuthProvider('xar_live_nnnnnnnnnnnnnnncdddddddd') //Use registered app client Id // initialize the Arcana AuthProvider before calling any AuthProvider functions ... await auth.init() ... // onboard users - for e.g. using plug-and-play ui const arcanaProvider = await auth.connect() // alternatively, onboard users by calling loginWithLink(deprecated), `loginWithOTPStart`, `loginWithOTPComplete`, loginWithSocial, loginWithBearer for passwordless, social or IAM providers. ... const provider = new ethers.providers.Web3Provider(arcanaProvider) // Call ethers provider APIs see https://docs.ethers.org/v5/api/providers/provider/ for details await provider.getBlockNumber() // Use the Arcana provider to sign a message using JSON RPC calls async function signMessage() { // Display a notification in custom wallet UI showing the message details and seeking user's approval ... // Once user approves, issue the request via the Arcana Auth SDK to sign transaction const { sig } = await arcanaProvider.request({ method: 'eth_sign', params: [ { from, // sender account address data: 'Some message data', }, ], }) console.log({ sig }) } ... // You can send tokens or use eth_sendtransaction functionality in custom wallet UI // Show a UI notification displaying the transaction details and ask for user's approval ... // Use the Arcana provider to issue the send transaction async function sendTransaction() { const hash = await arcanaProvider.request({ method: 'eth_sendTransaction', params: [{ from, gasPrice: 0, to: '0xE28F01Cf69f27Ee17e552bFDFB7ff301ca07e780', // receiver account address value: '0x0de0b6b3a7640000', },], }) console.log({ hash }) } ... ``` ### Manage User Control For a smooth user experience, ensure your custom UI displays clear approval/rejection prompts when blockchain requests are made. Users must be able to view the details and accept or reject these actions. ### Export Key Option When using the default Arcana wallet UI, authenticated users can access and copy their private key from the profile tab. For custom wallet UI, developers should include secure options for users to export their private key. Use the `AuthProvider` to access the private key and make a JSON/RPC `request` call with the `_arcana_getPrivateKey` method to retrieve the key securely in the user's context. Sample Code ``` // Only valid when custom wallet UI is selected in the dashboard // during app registration async function onClickGetUserPrivateKey() { const authProvider = window.ethereum //assuming setWindowProvider is set when AuthProvider was instantiated try { const userPkey = await authProvider.request({ method: '_arcana_getPrivateKey', params: [] }); // Do something with the key in custom wallet UI // For e.g., display it in the app context, allow user to copy it } catch(error) { console.log(error); }; } ``` Access Limitation If the app is configured through the Arcana Developer Dashboard for using the default [app specific keys option](../../concepts/keyspace-types/), then `_arcana_getPrivateKey` can be used. Not available for the Global Keys [Keyspace configuration setting](../../concepts/keyspace-types/) for security reason. ## What's Next? Add code to use the `AuthProvider` and issue blockchain transactions in the context of the authenticated user and seek the user's approval, if required. The JSON/RPC functions and Web3 wallet operations supported by the Arcana Auth SDK for [EVM chains](../web3-ops/evm/) may differ from those supported for the non-EVM chains. [Learn more...](../../concepts/non-evm-chains/) ## See also - [FAQ](../../faq/faq-gen/) - [Troubleshooting Guide](../../troubleshooting/) - [Arcana Auth SDK Errors](../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../auth-usage-guide/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) # Handle Provider Events This guide lists the standard EIP-1193 events raised by the `AuthProvider` in the Arcana Auth SDK and how app developers can handle those events in the app. ## Prerequisites - To receive and handle the `AuthProvider` events, register the app, configure social login and wallet settings and integrate the app with the SDK. ## Events `AuthProvider` emits the following standard [EIP-1193 events](https://eips.ethereum.org/EIPS/eip-1193#events): - **connect**: the provider is ready to submit the blockchain requests to the chain on behalf of the user (*Use `provider.isConnected()` to check if the `AuthProvider` is connected.*) - **disconnect**: the `AuthProvider` is unable to submit RPC requests to a chain - **chainChanged**: the chain associated with the Provider has changed - **accountsChanged**: the `AuthProvider` emits this event when the return value of the `eth_accounts` RPC method changes After initialization, when the provider is ready to submit the blockchain requests to the chain on behalf of the user, the **connect** event is generated. Use `provider.isConnected()` to check if the `AuthProvider` is connected. The **disconnect** event occurs when there is any connectivity issue with the blockchain network. If the chain is switched programmatically via the app and approved by the user or if it is changed via the Arcana wallet UI by the user, the **chainChanged** event occurs. Similarly, when the account associated with the `AuthProvider` changes, the **accountsChanged** event is emitted. ## Examples ### Connect Event ``` interface ConnectEventInfo { chainId: string; } const auth = new AuthProvider("...") await auth.init() ... auth.provider.on('connect', handler: (data: ConnectEventInfo) => void); ``` ### Disconnect Event When the `AuthProvider` becomes disconnected from the chains it emits the event `disconnect` with the error [ProviderRpcError](https://eips.ethereum.org/EIPS/eip-1193#rpc-errors). ``` interface ProviderRpcError extends Error { code: number; data?: unknown; } const auth = new AuthProvider("...") await auth.init() ... auth.provider.on('disconnect', handler: (error: ProviderRpcError) => void); ``` ### Chain Changed Event ``` const auth = new AuthProvider("...") await auth.init() ... auth.provider.on('chainChanged', (chainId: string) => { console.log(chainId); // Use chainId }); ``` ### Accounts Changed Event If the accounts available to the `AuthProvider` change, it emits the event **accountsChanged** with value **accounts: string[]**, containing the account addresses. ``` const auth = new AuthProvider("...") await auth.init() ... auth.provider.on('accountsChanged', handler: (accounts: Array) => void); ``` Remove Listener Make sure that you remove event listeners once you're done listening to an event in the app. For example: ``` const auth = new AuthProvider("...") await auth.init() ... function handleSomeEvent(accounts) { // Handle the event } auth.provider.on('someEvent', handleSomeEvent); // Later, when the component is unloaded or you are done watching the event auth.provider.removeListener('someEvent', handleSomeEvent); ``` **That is all.** *You are all set to handle the events emitted by the `AuthProvider`.* ## What's Next? Authenticated users can use the Arcana wallet to sign blockchain transactions, send and receive native, ERC20, or custom tokens, and [more](../../user-guides/wallet-ui/). ## See also - [Arcana wallet capabilities](../../concepts/anwallet/) - [Using Web3 wallet operations](../../user-guides/wallet-ui/) Apps using Arcana Auth SDK can enable passkey login in two ways: - Allow new users to sign up with passkeys, making it the only login option. - Let existing users set up passkeys as an alternative login method, alongside other social login options. ## Passkey Sign-up To sign up with passkeys, use `registerWithPasskey()`, followed by `loginWithPasskey()`. This will allow users to sign up and log in one step. Users must provide a unique identifier for passkey registration such as a name, email, device ID, biometrics data, PIN, or pattern. This sign-up flow is ideal for apps that only allow passkey onboarding. [See details...](../onboard/passkey-auth/passkey-signup/) ## Passkey Login To use passkeys as an alternative login, users first need to onboard through another method, like social login. Once logged in, they can set up a passkey for future logins. Use `linkPasskey()` to create and associate passkey with the app or website. Next time, when user chooses passkey option to log in, the app can call `loginWithPasskey()`, triggering the device or browser to display a UI where the user can choose the previously set passkey. This flow works best for apps that support multiple onboarding methods. [See details...](../onboard/passkey-auth/passkey-login/) # Install Arcana Auth SDK Arcana Auth SDK supports various [app types](../../web3-stack/apps/). You may be required to install one or more Arcana Auth SDK packages depending upon the app type. For example, Vue apps, HTML/CSS/JS apps only require installation of the `auth` package. For other app types, you may need to install app-type-specific packages along with the companion `auth` package. See table for more details: Arcana Auth SDK Flavors In some cases, you need to install and integrate the app with the `auth` package in addition to the app-specific package listed below. | SDK Name | Web3 Application Type | Package Name | Requires companion SDK | | --- | --- | --- | --- | | Arcana Auth SDK | For enabling user onboarding in web apps: Vanilla HTML/CSS/JS Apps, Vue Apps | [`auth`](https://www.npmjs.com/package/@arcana/auth) | None | | Arcana Auth React SDK | React Apps | [`auth-react`](https://www.npmjs.com/package/@arcana/auth-react) | [`auth`](https://www.npmjs.com/package/@arcana/auth) | | Arcana Auth Wagmi SDK | Apps using wallet connectors such as Wagmi, RainbowKit, WalletConnect | [`auth-wagmi`](https://www.npmjs.com/package/@arcana/auth-wagmi) | [`auth`](https://www.npmjs.com/package/@arcana/auth) | | Arcana Auth Web3 React SDK | Apps using Web3-React wallet connector | [`auth-web3-react`](https://www.npmjs.com/package/@arcana/auth-web3-react) | [`auth`](https://www.npmjs.com/package/@arcana/auth) | | Arcana Auth Flutter SDK | Mobile apps built using Flutter | `arcana_auth_flutter` | None | | Arcana Auth React-Native SDK | Mobile apps built using React Native | `auth-react-native` | None | | Arcana Auth-Core SDK | Auth SDK for user onboarding features usage only and ability to assign keys to authenticated users, with no embedded wallet feature | `auth-core` | None | | Arcana Auth Unity SDK | Gaming apps built using Unity | `arcana-auth-sdk` | None | ## Arcana Auth SDK ### HTML/CSS/JS, Vue Apps ``` npm install --save @arcana/auth ``` ``` yarn add @arcana/auth ``` ### React/Next.js Apps ``` npm install --save @arcana/auth @arcana/auth-react ``` ``` yarn add @arcana/auth @arcana/auth-react ``` ### Wagmi/RainbowKit/WalletConnect Apps **Wagmi 2.0** ``` npm install --save @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` npm install --save @arcana/auth-wagmi@2.0.0 @arcana/auth ``` **Wagmi 2.0** ``` yarn add @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` yarn add @arcana/auth-wagmi@2.0.0 @arcana/auth ``` ### Web3-React Apps ``` npm install --save @arcana/auth-web3-react @arcana/auth ``` ``` yarn add @arcana/auth-web3-react @arcana/auth ``` ### Unity Framework Download the Arcana Auth Unity SDK package: [https://npm-registry.arcana.network/](https://npm-registry.arcana.network/-/web/detail/arcana-auth-sdk). Unzip the contents and copy them to the **Assets** folder of the Unity Project. Unity Settings Developers must update the Unity Project settings in addition to installing the Arcana Auth Unity SDK. This is required to enable SDK usage in Unity Apps. See [Unity Setup](../../quick-start/unity-quick-start/#1-unity-setup-auth-install). ## Mobile SDKs ### Flutter Apps pubspec.yaml ``` dependencies: flutter: # Required for every Flutter project sdk: flutter # Required for every Flutter project flutter_localizations: # Required to enable localization sdk: flutter # Required to enable localization arcana_auth_flutter: ^0.0.6 ``` ### React-Native Apps ``` npm i @arcana/auth-react-native (cd ios && pod install) ``` # Wallet UI Errors The Arcana wallet users may encounter the following run-time errors when using the wallet to sign blockchain transactions or while using other wallet UI features such as adding or switching networks, setting up enhanced security via [MFA](../../concepts/mfa/), etc. ## Error Messages | Error | Description | | --- | --- | | W-101: RPC URL is already specified in profile. | Cannot add this RPC URL more than once. | | W-102: Chain Id already exists in profile. | Cannot add same chain ID more than once. | | W-103: This network is currently active. Select a different to make it active. | You may be trying to switch to a network which is already selected as the active network. Try again. | | W-104: Enter the pin to continue. | For enhanced security via MFA, you need to enter the pin to authorize access. | | Wallet address copied. | The wallet address is copied successfully to the clipboard. | | W-105: Please enter a valid wallet address. | Check the specified wallet address for the blockchain transaction. | | Answer all the questions to recover the key. | You must answer at least 3 security questions correctly in order to authorize access. | | Each questions must be unique! | You cannot specify the same security question more than once during MFA setup or recovery. | | W-106: Please provide the gas fee. | You have not specified the required gas fees for this transaction. | | W-107: Insufficient balance to pay for the gas fee. | Top up your account to pay for the gas fee, otherwise the transaction will fail due to insufficient balance. | | W-108: Cannot estimate gas fee. Please try again later. | For some unknown reason, we are not able to estimate the gas fees for this transaction. The network may not be responding or loaded so try again after some time. | | W-109: Gas limit cannot be set to a value less than the required gas fee for this transaction. | You have set up a gas limit which is insufficient to cover the gas fees for this transaction, change the gas limit. | | W-110: Enter all the details to continue. | You need to provide all the required details before this transaction can occur. | | Token Added successfully. | - | | Token already added. | This token is already available in the wallet, you cannot add it more than once. | | Token belongs to Ethereum Mainnet. | This token is not available on the current selected network but on the Mainnet, try switching network. | | Token sent successfully. | - | | W-111: Insufficient balance for specified transfer amount. | The account balance is insufficient for this transaction. Try topping up the balance before performing this transaction. | | W-112: Amount cannot be greater than the maximum available balance. | The amount of tokens specified should be less than or equal to the balance available in the current account. | | NFT Added. | - | | NFT already added. | This NFT is already added to the wallet, cannot add an NFT more than once. | | W-112: Unsupported NFT. | The wallet supports only these NFT types: ERC-721, ERC-1155. | | W-113: You don't have ownership for this NFT. | Cannot add NFT to the current wallet as this wallet address does not own the specified NFT. | | NFT Deleted. | - | | W-114: Insufficient NFTs. At most, you can send NFTs. | The quantity of NFTs specified in the transaction is more than available NFTs, fix and resubmit the transaction. | | W-116: Error creating NFT. Please try again. | - | | W-115: Invalid contract address. | - | | MFA setup completed. | - | | W-116: Incorrect answers. | MFA recovery answers are not correct, recovery failed. | | W-117: Incorrect pin. | MFA recovery failed due to incorrect pin. | | W-118: Please fill in all the questionnaires. | - | | W-119: Questions cannot be repeated. | - | | W-120: Questions cannot be empty. | - | | W-121: User cancelled the setup. | MFA setup was cancelled by the user, no enhanced security is set up for this account. | | W-122: Incorrect combination of chain Id and RPC URL. | Check RPC URL does not match with the specified chain Id. | | W-123: Invalid RPC URL! | Check the RPC URL and provide the correct one for the blockchain. | | W-124: Failed to copy. | Could not copy the selected item in the wallet UI. | | W-125: Failed to copy wallet address. | The wallet address could not be copied to the local clipboard. | | W-126: Failed to get balance. | Could not retrieve the balance for the current wallet address. It could be an intermittent error due to network issues. | | W-148: No valid wallet is associated for the given address. | The specified address does not belong to a valid wallet. | | W-127: Invalid token Id. | Check the token Id specified while manually adding a token asset through the wallet UI. | | W-128: Error occurred while setting up MFA. Please try again! | Retry MFA Setup. | | W-129: Please enter a valid quantity. | Check the number of tokens specified in the transaction. It should be less than or equal to the balance available. | | W-130: Please make the request again. | For some unknown reason the request failed, try again. | | W-131: Something went wrong, please try again. | Unknown error, try again. | | W-132: Please fill all values! | All input values must be specified, they are not optional in this case. | | W-133: Failed to initialize one or more on-ramps. | Transak encountered an error while initializing the on-ramp provider, try again. | | W-134: Could not get token. | Login failure as the token is not available. | | W-136: Failed to add to activities list. | Due to some unknown reason, the activity tab was not updated for this current transaction. | | W-137: Could not verify credentials. | Passwordless login failed as the OTP/email link credentials could not be verified successfully. | | W-138: Could not contact parent page causing login failure. Retry login. | Redirect to the specified URL failed causing a failed login. Check auth settings. | | W-139: Could not log in, an unexpected error occurred. | Login failed unexpectedly, try again and report error if it persists. | | W-140: Local or session storage doesn't work, falling back to in-memory storage. | There is some unknown issue in the local or session storage of the browser, falling back to in-memory storage. Your changes may not be saved across browser sessions. | | W-141: Required params missing. | Token validation error, expected input parameters are missing. | | W-142: Token already added. | The token already exists in the wallet, cannot be added more than once. | | W-143: Token belongs to Ethereum Mainnet. | You can use the Mainnet Token only when using the Mainnet App Client ID. Check the integration code. | | W-144: Invalid contract address. | The specified contract address for the transaction is invalid, check again. | | W-145: You do not own this token. | Token can be added to the wallet or transacted only if it is owned by the wallet address. | | W-146: Invalid token. | Invalid JWT Token specified for accessing keys. | | W-147: Failed to fetch details. | Token validation failed as details could not be fetched and verified. | # Integrate MultiversX App Integrate 'MultiversX' apps with [Arcana Auth SDK](../../../concepts/authsdk/) and onboard users via [social login](../../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../../concepts/anwallet/). ## Prerequisites - [Register](../../../setup/config-dApp-with-db-for-mvx/) the 'MultiversX' app and configure the Arcana Auth SDK usage [settings for social login](../../../setup/) providers, manage app [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). Non-EVM Chains When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain. MultiversX Shard Selection MultiversX uses [adaptive state sharding](https://docs.multiversx.com/technology/adaptive-state-sharding/) for horizontal scaling. Shards allow it to process far more transactions through parallelization, improving transaction throughput and efficiency. Choose your shard once when registering a MultiversX app on the Arcana Developer Dashboard. It cannot be changed later. By default, Arcana uses 'Shard 0' to deploy all app contracts and allocate wallet addresses for users. The benefit is that when addresses from the same shard interact with contracts on the same shard, latencies are much lower than in cross-shard interactions. ## 1. Install Depending upon the [app type](../../../web3-stack/apps/), you may need to [install one or more Arcana Auth SDK flavors](../../sdk-installation/) and the integration steps may vary. ## 2. Integrate App Select your 'MultiversX' app type and follow the integration instructions. [HTML/CSS/JS App](../vanilla-html-css-js/) [React/Next.js App](../react-nextjs/) [Wagmi App](../wagmi/) [WalletConnect App](../walletconnect/) [RainbowKit App](../rainbow/) [Web3-React App](../web3-react/) [Unity App](../unity/) [Flutter Apps](../../mobile/flutter-get-started/) [React-Native Apps](../../mobile/react-native-get-started/) [Custom Auth](../../custom-auth/) ## What's Next? Add code to [onboard users](../../onboard/mvx/). Use `AuthProvider`, the standard EIP-1193 Web3 provider to call support JSON/RPC functions and Web3 wallet operations. [Learn more...](../../web3-ops/mvx/) ## See also **'MultiversX'** integration example: See `sample-auth-multiversx` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [MultiversX FAQ](../../../faq/faq-mvx/) [Try Demo App](https://demo.arcana.network) # Integrate Near App Integrate 'Near' apps with [Arcana Auth SDK](../../../concepts/authsdk/) and onboard users via [social login](../../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../../concepts/anwallet/). ## Prerequisites - [Register](../../../setup/config-dApp-with-db-for-near/) the 'Near' app and configure Arcana Auth SDK SDK usage [settings for social login](../../../setup/) providers, manage app [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). Non-EVM Chains When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain. ## 1. Install Depending upon the [app type](../../../web3-stack/apps/), you may need to [install one or more Arcana Auth SDK SDK flavors](../../sdk-installation/) and the integration steps may vary. ## 2. Integrate App Select your 'Near' app type and follow the integration instructions. [HTML/CSS/JS App](../vanilla-html-css-js/) [React/Next.js App](../react-nextjs/) [Wagmi App](../wagmi/) [WalletConnect App](../walletconnect/) [RainbowKit App](../rainbow/) [Web3-React App](../web3-react/) [Unity App](../unity/) [Flutter Apps](../../mobile/flutter-get-started/) [React-Native Apps](../../mobile/react-native-get-started/) [Custom Auth](../../custom-auth/) ## What's Next? Add code to [onboard users](../../onboard/near/). Use `AuthProvider`, the standard EIP-1193 Web3 provider to call support JSON/RPC functions and Web3 wallet operations. [Learn more...](../../web3-ops/near/) ## See also **'Near'** integration example: See `sample-auth-near` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [Near FAQ](../../../faq/faq-near/) [Try Demo App](https://demo.arcana.network) # Integrate Rainbow App [RainbowKit](https://www.rainbowkit.com/) allows Web3 apps to connect to multiple Web3 wallets. It relies on [Wagmi](https://wagmi.sh/) and [Viem](https://viem.sh/). Integrate 'RainbowKit' apps with Arcana Auth SDK and onboard users via [social login](../../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../../concepts/anwallet/). ## Prerequisites - [Register](../../../setup/config-auth/register-app/) the 'RainbowKit' app and configure SDK usage [settings for social login](../../../setup/) providers, manage app [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). Non-EVM Chains When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain. ## Steps ### 1. Install **Wagmi 2.0** ``` npm install --save @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` npm install --save @arcana/auth-wagmi@2.0.0 @arcana/auth ``` **Wagmi 2.0** ``` yarn add @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` yarn add @arcana/auth-wagmi@2.0.0 @arcana/auth ``` ### 2. Create `AuthProvider` & `ArcanaConnector` ``` import { AuthProvider } from "@arcana/auth"; import { ArcanaConnector } from "@arcana/auth-wagmi" const auth = new AuthProvider('your-client-id'); const connector = new ArcanaConnector({ auth }); ``` `AuthProvider` Optional Parameters Besides Client ID input parameter, you can optionally customize these settings in the `AuthProvider` constructor: ______________________________________________________________________ **`position`:** wallet position within the app context - `left`|`right` **`theme`:** wallet theme - `light`|`dark` **`connectOptions`:** [compact mode](../../../concepts/plug-and-play-auth/#compact-modal) for the built-in plug-and-play login UI - `true`|`false` ``` connectOptions: { compact: true // default - false }, ``` ______________________________________________________________________ See [`AuthProvider` constructor parameters](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) for details. Compact Mode While creating the `AuthProvider`, you can choose the [compact mode (optional)](../../../concepts/plug-and-play-auth/#compact-modal) for the plug-and-play login UI. ### 3. Create `ArcanaRainbowConnector` Initialize the `connectorsForWallets` in the RainbowKit with the `ArcanaRainbowConnector`. ``` //This example uses Arcana Rainbow connector and MetaMask import { connectorsForWallets } from "@rainbow-me/rainbowkit"; import { metaMaskWallet } from "@rainbow-me/rainbowkit/wallets"; import { getAuthProvider } from "./getArcanaAuth"; import { ArcanaConnector } from "@arcana/auth-wagmi"; import { sequenceLogo } from "./logo"; export const ArcanaRainbowConnector = ({ chains }) => { return { id: "arcana-auth", name: "Login with Email/Social", iconUrl: sequenceLogo, iconBackground: "#101010", createConnector: () => { const connector = new ArcanaConnector({ chains, options: { auth: getAuthProvider() } }); return { connector }; } }; }; const connectors = (chains) => connectorsForWallets([ { groupName: "Recommended", wallets: [ArcanaRainbowConnector({ chains }), metaMaskWallet({ chains })] } ]); export { connectors }; ``` Use the `ArcanaRainbowConnector` and set up `WagmiConfig`. ``` // Note: // This sample code is for // wagmi versions 1.x.x and auth-wagmi 2.0.0 import { configureChains, createConfig, WagmiConfig } from "wagmi"; import { polygon, mainnet, optimism, arbitrum } from "wagmi/chains"; import { publicProvider } from "wagmi/providers/public"; import { RainbowKitProvider } from "@rainbow-me/rainbowkit"; import { connectors } from "./wallet"; import { useAccount, useConnect } from 'wagmi' import { Connect } from "./Connect"; const { chains, publicClient } = configureChains( [mainnet, polygon, optimism, arbitrum], [publicProvider()] ); const wagmiEntity = createConfig({ connectors: connectors(chains), autoConnect: true, publicClient, }); ... ``` ``` // Note: // This sample code is for // wagmi versions <1.x.x and auth-wagmi <2.0.0 import "../styles/globals.css"; import "@rainbow-me/rainbowkit/styles.css"; import { configureChains, createClient, WagmiConfig } from "wagmi"; import { polygon, mainnet } from "wagmi/chains"; import { publicProvider } from "wagmi/providers/public"; import { RainbowKitProvider } from "@rainbow-me/rainbowkit"; import { connectors } from "../utils/wallet"; const { chains, provider } = configureChains( [mainnet, polygon], [publicProvider()] ); const wagmiEntity = createClient({ connectors: connectors(chains), autoConnect: true, provider, }); ... ``` Use the `WagmiConfig` to initialize the `RainbowKitProvider` components in the app. ``` // Pass wagmi client configured with ArcanaRainbowKitConnector to the RainbowKit Context Provider export default function App({ Component, pageProps }) { return ( ); } ``` ``` // Pass wagmi client configured with ArcanaRainbowKitConnector to the RainbowKit Context Provider export default function App({ Component, pageProps }) { return ( ); } ``` The 'RainbowKit' Web3 app is now **integrated** with the Arcana Auth SDK. ## What's Next? Onboard users via the [built-in plug-and-play login UI](../../onboard/rainbow/rainbow-pnp-ui/) or a [custom login UI](../../onboard/rainbow/rainbow-custom-ui/). Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../web3-ops/evm/) in the authenticated user's context. ## See also **'RainbowKit'** integration example: See \`\`sample-auth-rainbowkit-viem`, `sample-auth-rainbowkit\` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../faq/faq-gen/) - [Troubleshooting Guide](../../../troubleshooting/) - [Arcana Auth SDK Errors](../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../auth-usage-guide/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) [Try Demo App](https://demo.arcana.network) # Integrate React/Next.js App Integrate 'React/NextJS' apps with[Arcana Auth SDK](../../../concepts/authsdk/) and onboard users via [social login](../../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../../concepts/anwallet/). ## Prerequisites - [Register](../../../setup/config-auth/register-app/) the 'React/NextJS' app and configure SDK usage [settings for social login](../../../setup/) providers, manage app [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). Non-EVM Chains When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain. ## Steps ### 1. Install ``` npm install --save @arcana/auth ``` ``` yarn add @arcana/auth ``` ``` npm install --save @arcana/auth @arcana/auth-react ``` ``` yarn add @arcana/auth @arcana/auth-react ``` ### 2. Initialize `AuthProvider`, `ProviderAuth` ``` import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import { AuthProvider } from "@arcana/auth"; import { ProvideAuth } from "@arcana/auth-react"; import App from "./App"; const rootElement = document.getElementById("root"); const root = createRoot(rootElement); const provider = new AuthProvider( "xar_live_d7c88d9b033d100e4200d21a5c4897b896e60063" ); root.render( ); ``` ``` import React from "react"; import { Auth } from "@arcana/auth-react"; export default function App() { return (

Sample Auth React App

); ``` ### Step 4: `useAuth` Hook ``` import { useAuth } from "@arcana/auth-react"; function App() { const { loading, isLoggedIn, connect, user } = useAuth() const onConnectClick = async () => { try { await connect(); // Built-in, plug & play login UI } catch (err) { console.log({ err }); // Handle error } }; if (loading) { return

Loading...

; } if (!isLoggedIn) { return ( ); } } export default App ``` ## What's Next? Onboard users via the [built-in plug-and-play login UI](../../onboard/react-nextjs/use-plug-play-auth/) or a [custom login UI](../../onboard/react-nextjs/custom-ui/). Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../web3-ops/evm/) in the authenticated user's context. ## See also **'React/NextJS'** integration example: See `sample-auth-react` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../faq/faq-gen/) - [Troubleshooting Guide](../../../troubleshooting/) - [Arcana Auth SDK Errors](../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../auth-usage-guide/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) [Try Demo App](https://demo.arcana.network) # Integrate Solana App Integrate 'Solana' apps with [Arcana Auth SDK](../../../concepts/authsdk/) and onboard users via [social login](../../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../../concepts/anwallet/). ## Prerequisites - [Register](../../../setup/config-dApp-with-db-for-Solana/) the 'Solana' app and configure Arcana Auth SDK SDK usage [settings for social login](../../../setup/) providers, manage app [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). Non-EVM Chains When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain. ## Steps Select your 'Solana' app type and follow the integration instructions. Solana apps will require to initialize and use **Solana Provider** in addition to the `AuthProvider`. ## 1. Install Depending upon the [app type](../../../web3-stack/apps/), you may need to [install one or more Arcana Auth SDK SDK flavors](../../sdk-installation/) and the integration steps may vary. ### 2. Integrate App Select your 'Solana' app type and follow the integration instructions. [HTML/CSS/JS App](../vanilla-html-css-js/) [React/Next.js App](../react-nextjs/) [Wagmi App](../wagmi/) [WalletConnect App](../walletconnect/) [RainbowKit App](../rainbow/) [Web3-React App](../web3-react/) [Unity App](../unity/) [Flutter Apps](../../mobile/flutter-get-started/) [React-Native Apps](../../mobile/react-native-get-started/) [Custom Auth](../../custom-auth/) ## 3. Initialize Solana Provider Solana apps can use the `auth.provider` to make standard JSON RPC calls in the context of an authenticated user. ``` const provider = auth.provider; ``` Use the Solana provider for issuing Solana Web3 wallet operations in the context of an authenticated user. ``` const solanaP = auth.solana; ``` ## What's Next? Add code to [onboard users](../../onboard/solana/). Use `AuthProvider`, the standard EIP-1193 Web3 provider to call support JSON/RPC functions and Web3 wallet operations. [Learn more...](../../web3-ops/solana/) ## See also **'Solana'** integration example: See `sample-auth-solana` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [Solana FAQ](../../../faq/faq-solana/) [Try Demo App](https://demo.arcana.network) # Integrate Unity App Integrate 'Unity' apps with [Arcana Auth SDK](../../../concepts/authsdk/) and onboard users via [social login](../../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../../concepts/anwallet/). ## Prerequisites - [Register](../../../setup/config-dApp-with-db-for-Unity/) the 'Unity' app and configure SDK usage [settings for social login](../../../setup/) providers, manage app [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). Non-EVM Chains When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain. ## Steps ### 1. Setup #### Setup Unity - Install [NuGetForUnity](https://github.com/GlitchEnzo/NuGetForUnity). - In the NuGet Toolbar at the top, click **NuGet > Manage NuGet packages**. Manage NuGet Packages - Install the following packages by STA: `Nethereum.Web3`, `WebsocketSharp.Core` - Use the Unity Editor Project Settings window to edit package settings for your project. Click **Edit > Project Settings > Package Manager**. - [Edit Project Settings](https://docs.unity3d.com/Manual/class-PackageManager.html) with URL **https://npm-registry.arcana.network/** and set the scope to `com.cysharp.unitask, dev.voltstro` Edit Project Settings - Add another new scoped registry with URL **https://unitynuget-registry.azurewebsites.net** and set the scope to `org.nuget`. Add Scoped Registry - In the NuGet window, use the NuGet Toolbar at the top, and click **Window > Package Manager > Add Package by Name**. Add Package by Name - Add the following packages: `com.cysharp.unitask`, \`\`dev.voltstro.unitywebbrowser.engine.cef\` - **Windows**: `dev.voltstro.unitywebbrowser.engine.cef.win.x64` - **Linux**: `dev.voltstro.unitywebbrowser.engine.cef.linux.x64` - **MacOS**: `dev.voltstro.unitywebbrowser.engine.cef.macos.x64` See [Unity Web Browser package list](https://projects.voltstro.dev/UnityWebBrowser/latest/articles/user/packages/#package-list) for details. - Download the Arcana Auth Unity SDK package: [https://npm-registry.arcana.network/](https://npm-registry.arcana.network/-/web/detail/arcana-auth-sdk). Unzip the contents and copy them to the **Assets** folder of the Unity Project. - Search for **ArcanaSDK** prefab in the 'Project Window' of the Unity Editor. Click **Assets > ArcanaSDK > Prefabs > ArcanaSDK**. Drag this prefab into the project 'Hierarchy' and configure the prefab as shown here: Configure Arcana Prefab #### Install Auth SDK ``` npm install --save @arcana/auth ``` ``` yarn add @arcana/auth ``` ### 2. Initialize Auth SDK ``` using ArcanaSDK; await arcanaSDK.InitializeSDK(env, "unique_clientID_for_registed_app"); ``` ## What's Next? After integrating an app with the Arcana Auth Unity SDK, developers can add code to [onboard users](../../onboard/unity/) and [enable Web3 wallet operations](../../web3-ops/unity-wallet-ops/) for authenticated users to sign transactions. ## See also **'Unity'** integration example: See `sample-auth-unity` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) [Try Demo App](https://demo.arcana.network) # Integrate HTML/CSS/JS App Integrate 'HTML/CSS/JS' apps with[Arcana Auth SDK](../../../concepts/authsdk/) and onboard users via [social login](../../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../../concepts/anwallet/). ## Prerequisites - [Register](../../../setup/config-auth/register-app/) the 'HTML/CSS/JS' app and configure SDK usage [settings for social login](../../../setup/) providers, manage app [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). Non-EVM Chains When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain. ## Steps ### 1. Install ``` npm install --save @arcana/auth ``` ``` yarn add @arcana/auth ``` ### 2. Initialize `AuthProvider` ``` import { AuthProvider } from '@arcana/auth' ``` ``` const auth = new AuthProvider( "xar_test_445007f942xxxxxxxxxxxxxxxxxx484cAfd2", // App client ID { alwaysVisible: false, // default: true, wallet always visible connectOptions: { compact: true // default: false, regular plug-and-play login UI }, position: 'left', // default: right setWindowProvider: true, // default: false, window.ethereum not set theme: 'light', // default: dark }) ``` Initialize First! After creating the `AuthProvider`, wait until the `init` call is complete before invoking any of the other SDK functions. ``` try { await auth.init() } catch (e) { // Handle exception case } ``` `AuthProvider` Optional Parameters Besides Client ID input parameter, you can optionally customize these settings in the `AuthProvider` constructor: ______________________________________________________________________ **`position`:** wallet position within the app context - `left`|`right` **`theme`:** wallet theme - `light`|`dark` **`connectOptions`:** [compact mode](../../../concepts/plug-and-play-auth/#compact-modal) for the built-in plug-and-play login UI - `true`|`false` ``` connectOptions: { compact: true // default - false }, ``` ______________________________________________________________________ See [`AuthProvider` constructor parameters](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) for details. The 'HTML/CSS/JS' Web3 app is now **integrated** with the Arcana Auth SDK. ## What's Next? Onboard users via the [built-in plug-and-play login UI](../../onboard/vanilla/use-plug-play-auth/) or a [custom login UI](../../onboard/vanilla/custom-ui/). Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../web3-ops/evm/) in the authenticated user's context. ## See also **'HTML/CSS/JS'** integration example: See `sample-auth-html-css-js` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../faq/faq-gen/) - [Troubleshooting Guide](../../../troubleshooting/) - [Arcana Auth SDK Errors](../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../auth-usage-guide/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) [Try Demo App](https://demo.arcana.network) # Integrate Vue App Integrate 'Vue' apps with[Arcana Auth SDK](../../../concepts/authsdk/) and onboard users via [social login](../../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../../concepts/anwallet/). ## Prerequisites - [Register](../../../setup/config-auth/register-app/) the 'Vue' app and configure SDK usage [settings for social login](../../../setup/) providers, manage app [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). Non-EVM Chains When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain. ## Steps ### 1. Install ``` npm install --save @arcana/auth ``` ``` yarn add @arcana/auth ``` ### 2. Initialize `AuthProvider` ``` import { AuthProvider } from "@arcana/auth"; let authInstance; //Mainnet ClientId const clientId = "xar_live_d7c88d9b033d100e4200d21a5c4897b896e60063"; if (authInstance == null) { authInstance = new AuthProvider(clientId); await authInstance.init(); } // Use authInstance for user onboarding, JSON/RPC and wallet ops ``` `AuthProvider` Optional Parameters Besides Client ID input parameter, you can optionally customize these settings in the `AuthProvider` constructor: ______________________________________________________________________ **`position`:** wallet position within the app context - `left`|`right` **`theme`:** wallet theme - `light`|`dark` **`connectOptions`:** [compact mode](../../../concepts/plug-and-play-auth/#compact-modal) for the built-in plug-and-play login UI - `true`|`false` ``` connectOptions: { compact: true // default - false }, ``` ______________________________________________________________________ See [`AuthProvider` constructor parameters](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) for details. The 'Vue' Web3 app is now **integrated** with the Arcana Auth SDK. ## What's Next? Onboard users via the [built-in plug-and-play login UI](../../onboard/vue/use-plug-play-auth/) or a [custom login UI](../../onboard/vanilla/custom-ui/). Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../web3-ops/evm/) in the authenticated user's context. ## See also **'Vue'** integration example: See `sample-auth-vue` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../faq/faq-gen/) - [Troubleshooting Guide](../../../troubleshooting/) - [Arcana Auth SDK Errors](../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../auth-usage-guide/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) [Try Demo App](https://demo.arcana.network) # Integrate Wagmi App [Wagmi](https://wagmi.sh/) is a React Hooks library for Ethereum that simplifies connecting Web3 apps to multiple wallets and chains. Integrate 'Wagmi' apps with Arcana Auth SDK and onboard users via [social login](../../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../../concepts/anwallet/). ## Prerequisites - [Register](../../../setup/config-auth/register-app/) the 'Wagmi' app and configure SDK usage [settings for social login](../../../setup/) providers, manage app [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). Non-EVM Chains When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain. ## Steps ### 1. Install **Wagmi 2.0** ``` npm install --save @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` npm install --save @arcana/auth-wagmi@2.0.0 @arcana/auth ``` **Wagmi 2.0** ``` yarn add @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` yarn add @arcana/auth-wagmi@2.0.0 @arcana/auth ``` ### 2. Create `AuthProvider` & `ArcanaConnector` Specify the **Client ID** assigned to the registered app to create the `AuthProvider`. Then use the `AuthProvider` to create `ArcanaConnector`. ``` import { AuthProvider } from "@arcana/auth"; import { ArcanaConnector } from "@arcana/auth-wagmi" const auth = new AuthProvider('your-client-id'); const connector = new ArcanaConnector({ auth }); ``` `AuthProvider` Optional Parameters Besides Client ID input parameter, you can optionally customize these settings in the `AuthProvider` constructor: ______________________________________________________________________ **`position`:** wallet position within the app context - `left`|`right` **`theme`:** wallet theme - `light`|`dark` **`connectOptions`:** [compact mode](../../../concepts/plug-and-play-auth/#compact-modal) for the built-in plug-and-play login UI - `true`|`false` ``` connectOptions: { compact: true // default - false }, ``` ______________________________________________________________________ See [`AuthProvider` constructor parameters](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) for details. Compact Mode While creating the `AuthProvider`, you can choose the [compact mode (optional)](../../../concepts/plug-and-play-auth/#compact-modal) for the plug-and-play login UI. ### 3. Setup `WagmiConfig` Create Wagmi config and specify the `ArcanaConnector`. ``` import { http, createConfig } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' import { coinbaseWallet, injected, walletConnect } from 'wagmi/connectors' import { AuthProvider } from '@arcana/auth'; import { ArcanaConnector } from "@arcana/auth-wagmi" let auth: AuthProvider | null; if (!auth) { auth = new AuthProvider( "xar_dev_c2fb7be163754e57d384e24257ea2c8d2a5dd31a" ); } export const connector = () => { return new ArcanaConnector({auth,}) }; export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ injected(), coinbaseWallet({ appName: 'Create Wagmi' }), walletConnect({ projectId: import.meta.env.VITE_WC_PROJECT_ID }), connector(), ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) declare module 'wagmi' { interface Register { config: typeof config } } ``` ``` // Note: // This sample code is for // wagmi versions 1.x.y and auth-wagmi 2.a.b import { configureChains, createConfig, WagmiConfig } from "wagmi"; import { publicProvider } from "wagmi/providers/public"; import { ArcanaConnector } from "@arcana/auth-wagmi"; import { polygon, polygonAmoy } from "wagmi/chains"; import { newAuthProvider } from "./utils/newArcanaAuth"; import { useAccount, useConnect, useDisconnect, useBalance } from 'wagmi' import "../styles/globals.css"; const { chains, provider, webSocketProvider } = configureChains( [mainnet, polygon, polygonAmoy], [publicProvider()], { targetQuorum: 1 } ); export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: newAuthProvider(), login: { provider: "google", }, }, }); }; const { chains, publicClient } = configureChains( [polygon, polygonAmoy], [publicProvider()] ); export const wagmiEntity = createConfig({ autoConnect: true, connectors: [connector(chains)], publicClient, }); ... ``` The 'Wagmi' Web3 app is now **integrated** with the Arcana Auth SDK. ## What's Next? Onboard users via the [built-in plug-and-play login UI](../../onboard/wagmi/wagmi-pnp-ui/) or a [custom login UI](../../onboard/wagmi/wagmi-custom-ui/). Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../web3-ops/evm/) in the authenticated user's context. ## See also **'Wagmi'** integration example: See `sample-auth-wagmi-2`, `sample-auth-wagmi-viem`, `sample-auth-wagmi` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../faq/faq-gen/) - [Troubleshooting Guide](../../../troubleshooting/) - [Arcana Auth SDK Errors](../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../auth-usage-guide/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) [Try Demo App](https://demo.arcana.network) # Integrate WalletConnect App [WalletConnect](https://walletconnect.com/) allows Web3 app users to seamlessly switch between multiple connected wallets within a dApp. Integrate 'WalletConnect' apps with Arcana Auth SDK and onboard users via [social login](../../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../../concepts/anwallet/). ## Prerequisites - [Register](../../../setup/config-auth/register-app/) the 'WalletConnect' app and configure SDK usage [settings for social login](../../../setup/) providers, manage app [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). Non-EVM Chains When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain. ## Steps ### 1. Install **Wagmi 2.0** ``` npm install --save @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` npm install --save @arcana/auth-wagmi@2.0.0 @arcana/auth ``` **Wagmi 2.0** ``` yarn add @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` yarn add @arcana/auth-wagmi@2.0.0 @arcana/auth ``` ### 2. Create `AuthProvider` & `ArcanaConnector` ``` // Set up Arcana Auth import { AuthProvider } from "@arcana/auth"; let auth: AuthProvider | null; const getAuthProvider = () => { if (!auth) { auth = new AuthProvider( "xar_test_b2dde12aad64eb35d72b2c80926338e178b1fa3f" ); } return auth; }; export { getAuthProvider }; ``` Initialize First! After creating the `AuthProvider`, wait until the `init` call is complete before invoking any of the other SDK functions. ``` try { await auth.init() } catch (e) { // Handle exception case } ``` ``` //This example uses Arcana Wallet connector and Coinbase Wallet import { http, createConfig } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' import { coinbaseWallet, injected, walletConnect } from 'wagmi/connectors' import { ArcanaConnector } from "@arcana/auth-wagmi"; import { getAuthProvider } from './arcanaConnector'; export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ injected(), coinbaseWallet({ appName: 'Create Wagmi' }), walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', //WalletConnect ProjectID }), ArcanaConnector( { auth: getAuthProvider(), } ) ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) declare module 'wagmi' { interface Register { config: typeof config } } ``` `AuthProvider` Optional Parameters Besides Client ID input parameter, you can optionally customize these settings in the `AuthProvider` constructor: ______________________________________________________________________ **`position`:** wallet position within the app context - `left`|`right` **`theme`:** wallet theme - `light`|`dark` **`connectOptions`:** [compact mode](../../../concepts/plug-and-play-auth/#compact-modal) for the built-in plug-and-play login UI - `true`|`false` ``` connectOptions: { compact: true // default - false }, ``` ______________________________________________________________________ See [`AuthProvider` constructor parameters](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) for details. ### 3. Set up `WagmiProvider` Create Wagmi config and specify the `ArcanaConnector`. ``` //Use "`auth-wagmi` version > v2.0.0" import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { Buffer } from 'buffer' import React from 'react' import ReactDOM from 'react-dom/client' import { WagmiProvider } from 'wagmi' import App from './App.tsx' import { config } from './wagmi.ts' import './index.css' globalThis.Buffer = Buffer const queryClient = new QueryClient() ReactDOM.createRoot(document.getElementById('root')!).render( , ) ``` The 'WalletConnect' Web3 app is now **integrated** with the Arcana Auth SDK. ## What's Next? Onboard users via the [built-in plug-and-play login UI](../../onboard/walletconnect/walletconnect-pnp-ui/) or a [custom login UI](../../onboard/walletconnect/walletconnect-custom-ui/). Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../web3-ops/evm/) in the authenticated user's context. ## See also **'WalletConnect'** integration example: See `sample-auth-walletconnect` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../faq/faq-gen/) - [Troubleshooting Guide](../../../troubleshooting/) - [Arcana Auth SDK Errors](../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../auth-usage-guide/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) [Try Demo App](https://demo.arcana.network) # Integrate Web3-React App [Web3-React](https://www.npmjs.com/package/web3-react) framework allows Connectors for various Web3 wallets. Integrate 'Web3-React' apps with Arcana Auth SDK and onboard users via [social login](../../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../../concepts/anwallet/). ## Prerequisites - [Register](../../../setup/config-auth/register-app/) the Wa'Web3-React'gmi app and configure SDK usage [settings for social login](../../../setup/) providers, manage app [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). Non-EVM Chains When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain. ## Steps ### 1. Install **Wagmi 2.0** ``` npm install --save @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` npm install --save @arcana/auth-wagmi@2.0.0 @arcana/auth ``` **Wagmi 2.0** ``` yarn add @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` yarn add @arcana/auth-wagmi@2.0.0 @arcana/auth ``` ### 2. Create `AuthProvider` and `ArcanaConnector` ``` import { initializeConnector } from "@web3-react/core"; import { ArcanaConnector } from "@arcana/auth-web3-react"; import { AuthProvider } from "@arcana/auth"; import { URLS } from "../chains"; const auth = new AuthProvider( "xar_test_b2ddexxxxxxxxxxxxxxxxxxxx8b1fa3f" //App client ID via Dashboard ); export const [arcanaConnect, hooks] = initializeConnector( (actions) => new ArcanaConnector(auth, { actions, }) ); ... ``` ### 3. `ArcanaConnectCard` Component In the Web3-React app, use the `ArcanaConnector` and React hooks to connect `ArcanaConnector` with the Web3-React ecosystem via `ArcanaConnectCard`. ``` import { useEffect, useState } from "react"; import { MAINNET_CHAINS } from "../../chains"; import { hooks, arcanaConnect } from "../../connectors/arcanaWallet"; import { Card } from "../Card"; const CHAIN_IDS = Object.keys(MAINNET_CHAINS).map(Number); const { useChainId, useAccounts, useIsActivating, useIsActive, useProvider, useENSNames, } = hooks; export default function ArcanaConnectCard() { const chainId = useChainId(); const accounts = useAccounts(); const isActivating = useIsActivating(); const isActive = useIsActive(); const provider = useProvider(); const ENSNames = useENSNames(provider); const [error, setError] = useState(undefined); // attempt to connect eagerly on mount useEffect(() => { arcanaConnect.connectEagerly().catch((error) => { console.debug("Failed to connect eagerly to arcanaConnect", error); }); }, []); return ( ); } ``` Now, you are all set to onboard users in the Web3-React app using the plug-and-play login UI and enable Arcana wallet for the authenticated users. pages/index.tsx ``` import ArcanaConnectCard from "../components/connectorCards/ArcanaConnectCard"; import CoinbaseWalletCard from "../components/connectorCards/CoinbaseWalletCard"; import GnosisSafeCard from "../components/connectorCards/GnosisSafeCard"; import MetaMaskCard from "../components/connectorCards/MetaMaskCard"; import NetworkCard from "../components/connectorCards/NetworkCard"; import WalletConnectCard from "../components/connectorCards/WalletConnectCard"; import WalletConnectV2Card from "../components/connectorCards/WalletConnectV2Card"; import ProviderExample from "../components/ProviderExample"; export default function Home() { return ( <>
); } ``` The 'Web3-React' Web3 app is now **integrated** with the Arcana Auth SDK. ## What's Next? Onboard users via the [built-in plug-and-play login UI](../../onboard/web3-react/web3-react-pnp-ui/) or a [custom login UI](../../onboard/web3-react/web3-react-custom-ui/). Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../web3-ops/evm/) in the authenticated user's context. ## See also **'Web3-React'** integration example: See `sample-auth-web3-react` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../faq/faq-gen/) - [Troubleshooting Guide](../../../troubleshooting/) - [Arcana Auth SDK Errors](../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../auth-usage-guide/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) [Try Demo App](https://demo.arcana.network) # Architecture: Auth Arcana Auth SDK allows Web3 app developers to onboard app users at scale using social and passwordless login. Authenticated users can instantly access the embedded, non-custodial Arcana wallet from within the app's context. Developers can whitelist app operations and enable gasless transactions through the Arcana wallet or third-party wallets. Here is a high-level overview of the technical architecture and components that power the Arcana Auth SDK. ## Auth Components - [Arcana Developer Dashboard](../../../concepts/dashboard/) - [Arcana Gateway](../../../concepts/gateway-node/) - [Arcana Auth SDK](../../../concepts/authsdk/) - [Asynchronous Distributed Key Generation (ADKG)](../../../concepts/adkg/) - Arcana Auth protocol (Back-end Subsystem) Auth Components ### Arcana Developer Dashboard Arcana Developer Dashboard is the user interface offered to Web3 app developers for registering an app and configuring the authentication providers and gasless transaction usage settings as per the app requirements. ### Arcana Gateway The Gateway is one of the key back-end components that works with the Arcana Developer Dashboard as well as the SDK integrated with the app. It is responsible for storing and managing SDK usage configuration details for various apps and manages developer accounts, app usage and billing, etc. All transactions initiated by the Arcana wallet are processed via the Gateway. It also handles gasless transactions for the Arcana wallet. ### Arcana Auth SDK The Arcana Auth SDK integrates with the app and enables user onboarding through social login providers, IAM providers, and passwordless login. It also enables Web3 operations through the embedded Arcana wallet. ### Asynchronous Distributed Key Generation (ADKG) A core back-end component that generates and manages key shares securely. It works with the SDK integrated with the app to securely dispense key shares. Some of the nodes running ADKG logic are owned by trusted third-party validators. In the future, we plan to make this component fully decentralized. ### Arcana Auth protocol (Back-end Subsystem) This refers to a bunch of entities in the back-end that implement the core system logic and algorithms on blockchain using [Arcana smart contracts](../../../concepts/ansmartc/an-smart-contracts/). See [Arcana Technical White paper](https://www.notion.so/Arcana-Technical-Docs-a1d7fd0d2970452586c693e4fee14d08) for details. # Arcana Auth Use Cases The Arcana Auth SDK allows developers to supercharge their Web3 apps with plug-and-play user authentication. Also, authenticated app users can instantly access the in-app, self-custodial Arcana wallet to securely sign blockchain transactions without having to install any browser extension or manage keys. Web3 developers can integrate apps with the Arcana Auth SDK to: - Authenticate and onboard users with social login - Automatically enable in-app wallet for authenticated users to sign blockchain transactions - Monitor app usage ## User Authentication - **Plug-and-Play Auth**: Onboard users with a single line of code. Call `connect` method to bring up plug-and-play login UI that displays the configured Web2 social login providers, IAM providers and passwordless login options. - **Build-your-own-Auth-UI**: Create your own login UX and call `loginWithSocial` method to enable authentication via popular Web2 social login providers, `loginWithBearer` for IAM providers. Use `loginWithLink` (deprecated), `loginWithOTPStart`, and `loginWithOTPComplete` methods for onboarding users via the passwordless option. - **Customize Onboarding**: Choose which providers/login options are visible to the user at the time of logging into the Web3 application. ## Sign Blockchain Transactions - **Accessible & Secure Wallet**: Enable *authenticated app users* to sign blockchain transactions without having to learn the Web3 nuances or expose them to tedious key management hoops. At the same time, provide a secure wallet that works only in the context of an app for an authenticated user. - **Customize Wallet Usage Experience**: Control the Arcana wallet visibility by choosing whether it should be always visible in the context of a Web3 application or whether it shows up only when a blockchain transaction is triggered. - **Wallet Branding**: Allows Web3 application developers to customize the Arcana wallet theme. - **No Browser Extension Deployment**: Arcana Auth SDK allows quick wallet onboarding for users without any prior need to generate Web3 keys or install any wallet or browser extension to onboard Web3 apps. - **Web3 Wallet Operations**: Enable typical wallet functions in the application for authenticated users: - Sign blockchain transactions - Send Transaction - Send/Receive native, custom tokens - Send/Receive NFTs - Browse NFTs, view NFT details - Add [supported networks](../../../web3-stack/chains/) - Switch networks - Monitor transaction activity - JSON-RPC method support - Buy crypto via fiat/on-ramp providers ## Monitor App Usage - **Register Apps**: Developers can register and configure the Arcana Auth SDK usage and wallet user experience by using the Arcana Developer Dashboard as per their app requirements. - **Monitor App Usage**: Developers can manage and monitor application usage in terms of **Monthly Active Users (MAU)**. They can also configure how apps are deployed on the Arcana Testnet and Mainnet. Billing is done only for Arcana Mainnet usage. Usage across all apps deployed on Mainnet can be tracked by the developers. ## Secure with MFA Gaming, DeFi and other Web3 apps that deal with user's crypto assets, NFTs can further secure user data by utilizing the [MFA feature](../../../concepts/mfa/). A user can set up various recovery methods for their wallet to enhance security. Whenever they try to log in from a new device they will have to provide one of the two in order to login. The Arcana Auth SDK works across devices and browsers. # Why Auth SDK? At Arcana, our mission is to build an ecosystem of components that enables developers to build Web3 applications quickly, securely, and with complete data privacy and ownership for application users. This is totally unlike Web2, where user data is owned by the applications and corporations. Web2 users have no control over who sees or accesses their data. ## Privacy-Preserving Applications If you are building Web3 apps that require complete data privacy, and security, the Arcana SDKs does the heavy lifting for you to onboard users using popular authentication providers and passwordless options. It allows authenticated users to sign blockchain transactions, manage tokens, and more without having to bother about the Web3 secret and key management complexities. At Arcana, we take security, privacy, and ownership seriously. We are actively working towards tracking and plugging in any vulnerabilities in our solution. Take a quick look at the overview of the [architecture and key components](../auth-architecture/) of the {{ no such element: dict object['product_name'] }} and see [Arcana Network Technical White Paper v1.0](https://www.notion.so/arcananetwork/Arcana-Technical-Docs-a1d7fd0d2970452586c693e4fee14d08) for implementation details. ## Build Web3 Apps Faster As a Web3 app developer, you can focus on core application logic while delegating essential tasks related to end-user onboarding, signing blockchain transactions, and managing the security and privacy of user access to the {{ no such element: dict object['product_name'] }} product. ### 1. Onboard App Users Effortlessly Developers can plug in the popular Web2 sign-up/login mechanisms in the Web3 apps and lower the barrier to entry for Web3 users. To onboard users in a Web3 app, the Arcana Auth SDK allows developers to select and configure user authentication providers for the app. Developers can choose the default, built-in plug-and-play user authentication UI via `connect` function of the Arcana Auth SDK. Or, they can customize and build a custom user authentication UI, add a few lines of code to call `loginWithSocial`, `loginWithLink`(deprecated), `loginWithOTPStart` and `loginWithOTPComplete` functions to onboard users. Read more about the [plug-and-play feature](../../../concepts/plug-and-play-auth/), and [how to onboard users](../../onboard/vanilla/use-plug-play-auth/) via the built-in, plug-and-play login UI or [custom login UI](../../onboard/vanilla/custom-ui/build-pwdless-auth/). Before you can integrate an app with the Arcana Auth SDK, developers must use the Arcana Developer Dashboard and configure onboarding options and user experience for signing blockchain transactions. Learn about [authentication providers](../../../concepts/authtype/), and [how to configure authentication providers](../../../setup/config-auth/) using the Arcana Developer Dashboard. ### 2. Sign blockchain transactions securely Allow authenticated Web3 application users to securely sign blockchain operations without bothering about managing secrets and keys. No centralized authority manages user keys in the {{ no such element: dict object['product_name'] }} DKG subsystem. Use the embedded, non-custodial Arcana wallet provided by the Arcana Auth SDK to let the authenticated users review and sign blockchain transactions. Read more about the [Arcana wallet features](../../../concepts/anwallet/) and [how to transact using the Arcana wallet](../../web3-ops/evm/). Check out the [Arcana wallet User Guide](../../../user-guides/wallet-ui/) to learn more about various Web3 wallet operations that can be accessed by the application users. ## Flexibility & Choice Tailor the user experience for your Web3 applications as per your use case and target audience. Learn more about the \[\[use-cases|{{ no such element: dict object['product_name'] }} Use Cases\]\]. ## See Also - [Social Login Demo App](https://demo.arcana.network) - [Arcana Auth SDK Usage Guide](../../auth-usage-guide/) - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) # Get Started: Flutter Apps 'Flutter' Web3 apps can onboard users via social login by integrating with the Arcana Auth Flutter SDK! ## Prerequisites - Flutter [v3.15.0](https://flutter-ko.dev/development/tools/sdk/releases) or higher ## 1. Register & Configure - App must be [registered](../../../setup/config-auth/register-app/) via the Arcana Developer Dashboard: - Optionally [configure auth settings](../../../setup/config-auth/) such as [social login](../../../concepts/social-login/), [wallet user experience](../../../concepts/anwallet/), etc. ## 2. Install SDK The Arcana Auth Flutter SDK is available at 'Pub.dev' as a [Flutter plugin](https://docs.flutter.dev/packages-and-plugins/developing-packages) package called [`arcana_auth_flutter`](https://pub.dev/packages/arcana_auth_flutter). Add the following line to the dependencies section in your app's `pubspec.yaml` file: pubspec.yaml ``` dependencies: flutter: # Required for every Flutter project sdk: flutter # Required for every Flutter project flutter_localizations: # Required to enable localization sdk: flutter # Required to enable localization arcana_auth_flutter: ^0.0.6 ``` Use latest Arcana Auth Flutter SDK Use latest Arcana Auth Flutter SDK release **v0.0.6** available at [pub.dev](https://pub.dev/packages/arcana_auth_flutter). ## 3. Integrate Once installed, integrate the app with the Arcana Auth Flutter SDK. Create an `AuthProvider` instance and specify the unique **client ID** assigned to the registered app. ``` import 'package:arcana_sdk/arcana_sdk.dart'; final auth = AuthProvider(clientId:"xar_xxxx_..."); auth.init(context: context); ``` Next, add code to onboard users and allow authenticated users to sign blockchain transactions using Arcana wallet. ### Onboard Users Add code to onboard users through one of the configured social login providers or via OTP login option. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. **Social Login** ``` auth.loginWithSocial("google").then((_) => { // On login Success }).catchError(...); ``` **OTP Login** ``` auth.loginWithOTP("${email_id}").then((_) => { // On login Success }).catchError(...); ``` **Logout** Call the logout method in response to a user's choice to log out. The built-in Arcana wallet UI has a **Logout** option in the user profile tab. ``` auth.logout().then((_) => { // On logout }); ``` **Get User Address** ``` auth.getAccount().then((account) => ...); ``` **Get User Details** ``` auth.getUserInfo().then((UserInfo info) => ...); ``` **Show/Hide Wallet UI** Developers can choose to show or hide the wallet as per the app requirements. ``` auth.showWallet(); ``` ``` auth.hideWallet(); ``` **Check Wallet Visibility** 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(); ``` **Clear Cache** Flutter apps can use `clearCache` to clear the Webview cache: ``` auth.clearCache(); ``` ### Sign Transactions The `AuthProvider` supports the JSON-RPC requests for the following Web3 operations: ``` auth.request(method: "...", params: [...]).then(() => ...); ``` ``` auth.sendTransaction({ to: "", value: "" }).then((hash) => ...); ``` ## 4. Deploy **That's all!** The 'Flutter' app is ready to onboard users and allow them to sign blockchain transactions. ## See also - **'Flutter'** integration example: See `sample-auth-flutter` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) Arcana Auth Flutter SDK Quick Links - [Release notes](../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-flutter/releases) - [Download SDK](https://pub.dev/packages/arcana_auth_flutter) # Get Started: React-Native Apps 'React-Native' Web3 apps can onboard users via social login by integrating with the Arcana Auth React-Native SDK! ## Prerequisites - React-Native [v0.71.8](https://reactnative.dev/versions) or higher ## 1. Register & Configure - App must be [registered](../../../setup/config-auth/register-app/) via the Arcana Developer Dashboard: - Optionally [configure auth settings](../../../setup/config-auth/) such as [social login](../../../concepts/social-login/), [wallet user experience](../../../concepts/anwallet/), etc. ## 2. Install SDK For 'React-Native' Web3 apps, install the [`auth-react-native`](https://www.npmjs.com/package/@arcana/auth-react-native) package. ``` npm i @arcana/auth-react-native (cd ios && pod install) ``` **Note:** You are **not required** to manually link this module, as it supports React Native auto-linking. Use latest SDKs Use the latest Arcana Auth React-Native SDK release **v0.0.4** available at [npm](https://www.npmjs.com/package/@arcana/auth-react-native). ## 3. Integrate Use the unique client ID assigned to the app during registration to integrate with the SDK. ``` import React, { useState } from "react"; import { Button, View } from "react-native"; import Auth from "@arcana/auth-react-native"; export default function App() { const authRef = React.useRef(null); return ( ); } ``` ``` ``` ### Onboard Users Call `Auth` functions and onboard users through the configured authentication providers. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. **Google Login**\* ``` // For logging in const loginWithGoogle = () => { if(authRef !== null){ authRef.current.loginWithSocial('google').then(() => { // logged in }).catch(err => { // already logged in // or error during login }) } } ``` **Logout** Add code to provide user log out option via the `logout` method or let authenticated users log out using the wallet UI logout option in the 'User Profile' tab. ``` // Logout User from session const logout = () => { if(authRef !== null){ authRef.current.logout().then(() => { // on logout }); } }; ``` **Show/Hide Wallet** Once the user logs into the app, they can instantly access the Arcana wallet. Developers can choose to show and hide the wallet as required by the app. ``` // For showing wallet const showWallet = () => { if(authRef !== null){ authRef.current.showWallet(); } } // For hiding wallet const hideWallet = () => { if(authRef !== null){ authRef.current.hideWallet(); } } ``` ``` // For getting logged in user info const getUserInfo = async () => { if(authRef !== null){ return authRef.current.getUserInfo(); } }; ``` ``` // For getting current account const getAccount = async () => { if(authRef !== null){ return await authRef.current.getAccount(); } }; ``` ``` return ( ); } } export default App ``` The figure below shows the built-in login UI plug-and-play pop-up authentication screen for a test app. Plug-and-play Login UI Compact Mode While creating the `AuthProvider`, use `connectoOptions` to optionally choose the [compact mode](../../../../concepts/plug-and-play-auth/#compact-modal) for the plug-and-play login UI. ``` connectOptions: { compact: true // default - false }, ``` Login UI Options No plug-and-play support for Firebase authentication. The [plug and play feature](../../../../concepts/plug-and-play-auth/) of the Arcana Auth SDK does not support social login via Firebase. Developers must build a custom login UI and add code to onboard users. For details, see [onboarding users via Firebase and custom login UI](../custom-ui/build-idm/firebase-login/) No plug-and-play support for Telegram authentication. The [plug and play feature](../../../../concepts/plug-and-play-auth/) of the Arcana Auth SDK does not support social login via Telegram. Developers must build a custom login UI and add code to onboard users. For details, see \[\[{{ no such element: dict object['telegram_custom_ui_tag'] }}|onboarding users via Telegram and custom login UI\]\]. ## What's Next? Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../../web3-ops/evm/) in the authenticated user's context. ## See also **'React/Next.js'** integration example: See `sample-auth-react`,`sample-auth-nextjs` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../../faq/faq-gen/) - [Troubleshooting Guide](../../../../troubleshooting/) - [Arcana Auth SDK Errors](../../../auth-error-msg/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) [Try Demo App](https://demo.arcana.network) # Custom Login UI [Enable Passwordless Auth](build-pwdless-auth/) [Social Login Providers](build-social/) [IAM Providers](build-idm/) # Build Passwordless Auth Learn how React/Next.js app can use custom login UI and allow users to onboard via passwordless login option. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - The app must be [registered using the Arcana Developer Dashboard](../../../../../setup/config-auth/register-app/) and a unique Client ID must be already assigned to it. This Client ID is essential for integrating the app with the Arcana Auth SDK - Follow the instructions to [integrate the React app](../../../../integrate/react-nextjs/) with the Arcana Auth SDK and initialize the `AuthProvider` instance. No Setup Required for Passwordless Passwordless login does **not** require any configuration setup through the Arcana Developer Dashboard. When prompted, app users must supply an email ID to receive the OTP for logging into the app. On receiving the OTP in email, user must provide the same in the app to authenticate and access the in-app Arcana wallet to sign transactions. ## Steps `useAuth() hook` Use `loginWithLink` (deprecated) `loginWithOTPStart` and `loginWithOTPComplete` through the `useAuth` hook offered by the Arcana Auth React SDK and trigger passwordless login to onboard the users. ### Login with link ``` await auth.loginWithLink(`${email}`) ``` Deprecated `loginWithLink` is deprecated. Use `loginWithOTPStart`, `loginWithOTPComplete` for passwordless login with OTP. The OTP will be received via email supplied in `loginWithOTPStart` call. ### Login with OTP ``` try { const loginState = await auth.loginWithOTPStart("john.doe@somemail.com"); await loginState.begin() if(loginState.isCompleteRequired) { // App is using default app-specific keys // App must ask the user to input a 6-digit code received in mail var userInput = prompt("Please enter a 6-digit code:", "111111"); // Validate if the input is a 6-digit code if (userInput !== null && userInput.length === 6 && !isNaN(userInput)) { const complete = await auth.loginWithOTPComplete( userInput, onMFARequired() => { //Hide overlay, if used in the app }); console.log("complete:",complete); } else { console.log("Invalid input. Please enter a valid 6-digit code."); } } else { // App is using global keys, built-in OTP input UI is displayed by the SDK // App is not required to add code for OTP input } } catch (e) { console.log(e); } ``` Global vs. App Specific Keys Apps using app-specific keys must use a custom login UI that allows users to input the OTP. In this case, the `isCompleteRequired` boolean returns `true` after initiating login with OTP. Apps using global keys are not required to use a custom login UI. A built-in login UI is automatically displayed for the user for OTP. Users must enter the OTP received via email in this UI. MFA Enabled / Disabled During passwordless login via OTP, apps configured for MFA and those using overlays must hide it to enable OTP input. Use the `isMFARequired` callback in the `loginWithOTPComplete` method to hide the overlay. ## What's Next? Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../web3-ops/evm/) ## See also **React/Next.js** integration example: See `sample-auth-react`,`sample-auth-nextjs` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../../../faq/faq-gen/) - [Troubleshooting Guide](../../../../../troubleshooting/) - [Arcana Auth SDK Errors](../../../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../../../auth-usage-guide/) - [Arcana Auth React SDK Reference](https://auth-react-sdk-ref-guide.netlify.app/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth React SDK Quick Links - [Arcana Auth React SDK Reference Guide](https://auth-react-sdk-ref-guide.netlify.app/) - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Arcana Auth SDK Release notes](../../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-react/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-react) [Try Demo App](https://demo.arcana.network) # IAM Provider: Custom Login UI Developers can choose to **not** use the plug-and-play login UI and instead build a custom login UI to onboard users. In this case, developers must build custom login UI themselves after configuring the IAM Providers in the Arcana Developer Dashboard. This custom login UI must call appropriate user onboarding functions offered by the Arcana Auth SDK for every configured IAM provider. [Cognito](cognito-oauth/) [Firebase](firebase-login/) # User Login with Cognito In this guide, you will learn how a React/Next.js app integrated with the Arcana Auth SDK and Arcana Auth React SDK can onboard users with a custom login UI through Cognito authentication. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Cognito](../../../../../../setup/config-idm/cognito-oauth/) as the authentication provider. - Use the instructions and [integrate the React app](../../../../../integrate/react-nextjs/) with the Arcana Auth SDK and the Arcana Auth React SDK before adding code to onboard users. ## Steps *Using Cognito to onboard users in a React/Next.js app requires a single line of code.* ## Step 1: Use `loginWithSocial` App.js ``` import { useAuth } from "@arcana/auth-react"; function App() { const { loading, isLoggedIn, loginWithSocial } = useAuth() // custom login UI const onConnectClick = async () => { try { await loginWithSocial('aws'); } catch (err) { console.log({ err }); // Handle error } }; if (loading) { return

Loading...

; } if (!isLoggedIn) { return ( ); } } export default App ``` **That is all.** The React/Next.js app is all set for onboarding users via Cognito. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/). - [Arcana Auth React SDK Reference Guide](https://auth-react-sdk-ref-guide.netlify.app/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Firebase In this guide, you will learn how a React/Next.js app integrated with the Arcana Auth SDK and Firebase SDK can onboard users via custom login UI and Firebase as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Firebase](../../../../../../setup/config-idm/firebase-auth/) as the authentication provider. - Install the Firebase SDK and integrate the app as explained in the Firebase documentation for [iOS apps](https://firebase.google.com/docs/ios/setup), [Android apps](https://firebase.google.com/docs/android/setup) and [web apps](https://firebase.google.com/docs/web/setup). Use [Firebase authentication](https://firebase.google.com/docs/auth) as per the Web3 app type, mobile or web app. Once a user is authenticated by Firebase, the developer must obtain the token and user identifier and provide it as input to the `loginWithBearer` function of the Arcana Auth SDK for onboarding users to Web3. - Install the Arcana Auth SDK and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK by using the appropriate integration method as per the app type. After that follow the steps listed below and add code to onboard users to Web3 and enable them to sign blockchain transactions. ## Steps *Using Firebase to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ### Call `loginWithBearer` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with both the Firebase SDK as well as the Arcana Auth SDK, before adding code to onboard users via Firebase. App.vue ``` import { initializeApp } from 'firebase/app' import { getAuth, createUserWithEmailAndPassword, signInWithEmailAndPassword } from 'firebase/auth' import { AuthProvider, BearerAuthentication } from '@arcana/auth' const config = { apiKey: "AIzaSyBddysLWM9CcpNEVLbUz52YwyQL_uytQX0", // Obtain this after registering app at Firebase console authDomain: "arc4n4-docx.firebaseapp.com", // Project ID Domain setting in the Firebase console projectId: "some-projectid-example-arc4n4-docx", storageBucket: "some-storage-arc4n4-docx.appspot.com", messagingSenderId: "2xxxx318486297382", appId: "4:3184ddddddd7382:web:8b639axxxxxxxx39f85fe7", measurementId: "G-EGccccccLDR" }; const firebaseApp = initializeApp(config) const firebaseAuth = getAuth(firebaseApp) //Create Arcana Auth Provider // Get client ID 'xar_live_xxxxxx' from Arcana Developer Dashboard const auth = new AuthProvider("xar_live_123940ytyoxxxxxxx343o404",{ network: "mainnet", //change it to testnet or mainnet }) export default { name: 'App', data: () => ({ email: '', password: '' }), mounted () { AP.init().then((k) => console.log(k)).catch(e => console.error(e)) //Initialize the Auth Provider }, methods: { async ultimate (upm) { if (await AP.isLoggedIn()) { window.alert('Already logged in') return } await auth.loginWithBearer(BearerAuthentication.firebase, { uid: upm.user.uid, token: upm.user.accessToken }) }, async login () { //Sign in existing Firebase users const data = await signInWithEmailAndPassword(firebaseAuth, this.email, this.password) console.log('Data:', data) return this.ultimate(data) }, async register () { //Sign up new users with Firebase Auth const data = await createUserWithEmailAndPassword(firebaseAuth, this.email, this.password) console.log('Data:', data) return this.ultimate(data) } } } ... ``` Refer to the [Sample Firebase Vue app integration example](https://github.com/arcana-network/auth-examples) to see how the `loginWithBearer` function is used. After onboarding users, developers can add code to access the other Arcana Auth SDK functions in the app. See [Arcana Auth SDK Usage Guide](../../../../../auth-usage-guide/) for details. **That is all.** Your app is all set for authenticating users via Firebase. Authenticated users can instantly access the Arcana wallet to sign blockchain transactions. No Aggregate Login with Firebase The [aggregate login feature](../../../../../../concepts/aggregatelogin/) does not work for third-party IAM providers such as Firebase. If a user has the same email ID registered with say a social login provider and with Firebase, logging into an app using Firebase will create a new unique user account even if the user uses the same email as the one used with a social login provider or via the passwordless option. What this means is that the wallet address for the same user will be different when Firebase is used to log in and subsequently a social login provider or passwordless login is used by the same user having the same email ID. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handing authentication errors](../../../../../auth-error-msg/) - [Get Firebase User token](https://firebase.google.com/docs/reference/js/auth.user.md#usergetidtoken) - [Using Firebase Auth](https://firebase.google.com/docs/auth) - [Auth Examples](https://github.com/arcana-network/auth-examples) # Social Login Providers: Custom Login UI Developers can choose to **not** use the plug-and-play login UI and instead build a custom login UI to onboard users. In this case, developers must build custom login UI themselves after configuring the social login providers in the Arcana Developer Dashboard. This custom login UI must call appropriate user onboarding functions offered by the Arcana Auth SDK for configured social login providers. [Apple](apple-oauth/) [Discord](discord-oauth/) [GitHub](github-oauth/) [Google](google-oauth/) [Steam](steam-oauth/) [Telegram](telegram-oauth/) [Twitch](twitch-oauth/) [Twitter](twitter-oauth/) # User Login with Apple In this guide, you will learn how a React/Next.js app integrated with the Arcana Auth SDK and Arcana Auth React SDK can onboard users with a custom login UI through Apple authentication. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Apple](../../../../../../setup/config-social/apple-oauth/) as the authentication provider. - Use the instructions and [integrate the React app](../../../../../integrate/react-nextjs/) with the Arcana Auth SDK and the Arcana Auth React SDK before adding code to onboard users. ## Steps *Using Apple to onboard users in a React/Next.js app requires a single line of code.* ## Step 1: Use `loginWithSocial` App.js ``` import { useAuth } from "@arcana/auth-react"; function App() { const { loading, isLoggedIn, loginWithSocial } = useAuth() // custom login UI const onConnectClick = async () => { try { await loginWithSocial('apple'); } catch (err) { console.log({ err }); // Handle error } }; if (loading) { return

Loading...

; } if (!isLoggedIn) { return ( ); } } export default App ``` **That is all.** The React/Next.js app is all set for onboarding users via Apple. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/). - [Arcana Auth React SDK Reference Guide](https://auth-react-sdk-ref-guide.netlify.app/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Discord In this guide, you will learn how a React/Next.js app integrated with the Arcana Auth SDK and Arcana Auth React SDK can onboard users with a custom login UI through Discord authentication. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Discord](../../../../../../setup/config-social/discord-oauth/) as the authentication provider. - Use the instructions and [integrate the React app](../../../../../integrate/react-nextjs/) with the Arcana Auth SDK and the Arcana Auth React SDK before adding code to onboard users. ## Steps *Using Discord to onboard users in a React/Next.js app requires a single line of code.* ## Step 1: Use `loginWithSocial` App.js ``` import { useAuth } from "@arcana/auth-react"; function App() { const { loading, isLoggedIn, loginWithSocial } = useAuth() // custom login UI const onConnectClick = async () => { try { await loginWithSocial('discord'); } catch (err) { console.log({ err }); // Handle error } }; if (loading) { return

Loading...

; } if (!isLoggedIn) { return ( ); } } export default App ``` **That is all.** The React/Next.js app is all set for onboarding users via Discord. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/). - [Arcana Auth React SDK Reference Guide](https://auth-react-sdk-ref-guide.netlify.app/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with GitHub In this guide, you will learn how a React/Next.js app integrated with the Arcana Auth SDK and Arcana Auth React SDK can onboard users with a custom login UI through GitHub authentication. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure GitHub](../../../../../../setup/config-social/github-oauth/) as the authentication provider. - Use the instructions and [integrate the React app](../../../../../integrate/react-nextjs/) with the Arcana Auth SDK and the Arcana Auth React SDK before adding code to onboard users. ## Steps *Using GitHub to onboard users in a React/Next.js app requires a single line of code.* ## Step 1: Use `loginWithSocial` App.js ``` import { useAuth } from "@arcana/auth-react"; function App() { const { loading, isLoggedIn, loginWithSocial } = useAuth() // custom login UI const onConnectClick = async () => { try { await loginWithSocial('github'); } catch (err) { console.log({ err }); // Handle error } }; if (loading) { return

Loading...

; } if (!isLoggedIn) { return ( ); } } export default App ``` **That is all.** The React/Next.js app is all set for onboarding users via GitHub. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/). - [Arcana Auth React SDK Reference Guide](https://auth-react-sdk-ref-guide.netlify.app/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Google In this guide, you will learn how a React/Next.js app integrated with the Arcana Auth SDK and Arcana Auth React SDK can onboard users with a custom login UI through Google authentication. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Google](../../../../../../setup/config-social/google-oauth/) as the authentication provider. - Use the instructions and [integrate the React app](../../../../../integrate/react-nextjs/) with the Arcana Auth SDK and the Arcana Auth React SDK before adding code to onboard users. ## Steps *Using Google to onboard users in a React/Next.js app requires a single line of code.* ## Step 1: Use `loginWithSocial` App.js ``` import { useAuth } from "@arcana/auth-react"; function App() { const { loading, isLoggedIn, loginWithSocial } = useAuth() // custom login UI const onConnectClick = async () => { try { await loginWithSocial('google'); } catch (err) { console.log({ err }); // Handle error } }; if (loading) { return

Loading...

; } if (!isLoggedIn) { return ( ); } } export default App ``` **That is all.** The React/Next.js app is all set for onboarding users via Google. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/). - [Arcana Auth React SDK Reference Guide](https://auth-react-sdk-ref-guide.netlify.app/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Steam In this guide, you will learn how a React/Next.js app integrated with the Arcana Auth SDK and Arcana Auth React SDK can onboard users with a custom login UI through Steam authentication. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Steam](../../../../../../setup/config-social/steam-oauth/) as the authentication provider. - Use the instructions and [integrate the React app](../../../../../integrate/react-nextjs/) with the Arcana Auth SDK and the Arcana Auth React SDK before adding code to onboard users. ## Steps *Using Steam to onboard users in a React/Next.js app requires a single line of code.* ## Step 1: Use `loginWithSocial` App.js ``` import { useAuth } from "@arcana/auth-react"; function App() { const { loading, isLoggedIn, loginWithSocial } = useAuth() // custom login UI const onConnectClick = async () => { try { await loginWithSocial('steam'); } catch (err) { console.log({ err }); // Handle error } }; if (loading) { return

Loading...

; } if (!isLoggedIn) { return ( ); } } export default App ``` **That is all.** The React/Next.js app is all set for onboarding users via Steam. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/). - [Arcana Auth React SDK Reference Guide](https://auth-react-sdk-ref-guide.netlify.app/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Telegram In this guide, you will learn how a React/Next.js app integrated with the Arcana Auth SDK and Arcana Auth React SDK can onboard users with a custom login UI through Telegram authentication. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Telegram](../../../../../../setup/config-social/telegram-oauth/) as the authentication provider. - Use the instructions and [integrate the React app](../../../../../integrate/react-nextjs/) with the Arcana Auth SDK and the Arcana Auth React SDK before adding code to onboard users. ## Steps *Using Telegram to onboard users in a React/Next.js app requires a single line of code.* ## Step 1: Use `loginWithSocial` App.js ``` import { useAuth } from "@arcana/auth-react"; function App() { const { loading, isLoggedIn, loginWithSocial } = useAuth() // custom login UI const onConnectClick = async () => { try { await loginWithSocial('telegram'); } catch (err) { console.log({ err }); // Handle error } }; if (loading) { return

Loading...

; } if (!isLoggedIn) { return ( ); } } export default App ``` **That is all.** The React/Next.js app is all set for onboarding users via Telegram. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/). - [Arcana Auth React SDK Reference Guide](https://auth-react-sdk-ref-guide.netlify.app/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Twitch In this guide, you will learn how a React/Next.js app integrated with the Arcana Auth SDK and Arcana Auth React SDK can onboard users with a custom login UI through Twitch authentication. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Twitch](../../../../../../setup/config-social/twitch-oauth/) as the authentication provider. - Use the instructions and [integrate the React app](../../../../../integrate/react-nextjs/) with the Arcana Auth SDK and the Arcana Auth React SDK before adding code to onboard users. ## Steps *Using Twitch to onboard users in a React/Next.js app requires a single line of code.* ## Step 1: Use `loginWithSocial` App.js ``` import { useAuth } from "@arcana/auth-react"; function App() { const { loading, isLoggedIn, loginWithSocial } = useAuth() // custom login UI const onConnectClick = async () => { try { await loginWithSocial('twitch'); } catch (err) { console.log({ err }); // Handle error } }; if (loading) { return

Loading...

; } if (!isLoggedIn) { return ( ); } } export default App ``` **That is all.** The React/Next.js app is all set for onboarding users via Twitch. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/). - [Arcana Auth React SDK Reference Guide](https://auth-react-sdk-ref-guide.netlify.app/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Twitter In this guide, you will learn how a React/Next.js app integrated with the Arcana Auth SDK and Arcana Auth React SDK can onboard users with a custom login UI through Twitter authentication. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Twitter](../../../../../../setup/config-social/twitter-oauth/) as the authentication provider. - Use the instructions and [integrate the React app](../../../../../integrate/react-nextjs/) with the Arcana Auth SDK and the Arcana Auth React SDK before adding code to onboard users. ## Steps *Using Twitter to onboard users in a React/Next.js app requires a single line of code.* ## Step 1: Use `loginWithSocial` App.js ``` import { useAuth } from "@arcana/auth-react"; function App() { const { loading, isLoggedIn, loginWithSocial } = useAuth() // custom login UI const onConnectClick = async () => { try { await loginWithSocial('twitter'); } catch (err) { console.log({ err }); // Handle error } }; if (loading) { return

Loading...

; } if (!isLoggedIn) { return ( ); } } export default App ``` **That is all.** The React/Next.js app is all set for onboarding users via Twitter. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/). - [Arcana Auth React SDK Reference Guide](https://auth-react-sdk-ref-guide.netlify.app/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # Plug-and-Play Login UI Use the built-in, [plug-and-play login UI modal](../../../../concepts/plug-and-play-auth/) to quickly onboard users in a 'Vanilla HTML/CSS/JS' app integrated with the Arcana Auth Wagmi SDK. Custom Login UI You can onboard users through a [custom login UI](../../../../concepts/custom-login-ui/) instead of the [built-in plug-and-play](../../../../concepts/plug-and-play-auth/) one. See [how to use custom login UI](../custom-ui/) and onboard users in a 'Vanilla HTML/CSS/JS' app. ## Prerequisites - [Register](../../../../setup/config-auth/register-app/) the app that uses `wagmi` and configure the SDK usage [settings for social login](../../../../setup/) providers, [manage app chains](../../../../setup/config-wallet-chains/) and [wallet user experience](../../../../setup/config-wallet/). - Install the [required SDK packages](../../../sdk-installation/) for 'Vanilla HTML/CSS/JS'. - [Integrate](../../../integrate/wagmi/) 'Vanilla HTML/CSS/JS' app, create and initialize the `AuthProvider`. ## Steps ### 1. `connect` Use the `connect()` function to bring up the plug-and-play pop-up modal in the app context and display the available options for user onboarding. Only those options are displayed that were earlier configured by the developer using the Arcana Developer Dashboard. The passwordless login option is enabled by default. ``` await auth.connect(); ``` Plug-and-Play Login UI Compact Mode While creating the `AuthProvider`, use `connectoOptions` to optionally choose the [compact mode](../../../../concepts/plug-and-play-auth/#compact-modal) for the plug-and-play login UI. ``` connectOptions: { compact: true // default - false }, ``` Login UI Options Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use.. No plug-and-play support for Firebase authentication. The [plug and play feature](../../../../concepts/plug-and-play-auth/) of the Arcana Auth SDK does not support social login via Firebase. Developers must build a custom login UI and add code to onboard users. For details, see [onboarding users via Firebase and custom login UI](../custom-ui/build-idm/firebase-login/) No plug-and-play support for Telegram authentication. The [plug and play feature](../../../../concepts/plug-and-play-auth/) of the Arcana Auth SDK does not support social login via Telegram. Developers must build a custom login UI and add code to onboard users. For details, see \[\[{{ no such element: dict object['telegram_custom_ui_tag'] }}|onboarding users via Telegram and custom login UI\]\]. ## What's Next? Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../../web3-ops/evm/) in the authenticated user's context. ## See also **'Vanilla HTML/CSS/JS'** integration example: See `sample-auth-html-css-js` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../../faq/faq-gen/) - [Troubleshooting Guide](../../../../troubleshooting/) - [Arcana Auth SDK Errors](../../../auth-error-msg/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) [Try Demo App](https://demo.arcana.network) # Custom Login UI [Passwordless Auth](build-pwdless-auth/) [Social Providers](build-social/) [IAM Providers](build-idm/) Refer to the [Auth Examples](https://github.com/arcana-network/auth-examples) for sample applications that use custom login UI to onboard users. # Build Custom Passwordless Auth In this guide, you will learn how to integrate 'Vanilla HTML/CSS/JS' app with the Arcana Auth SDK and then onboard users through custom login UI and passwordless login option. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - The app must be [registered using the Arcana Developer Dashboard](../../../../../setup/config-auth/register-app/). A unique Client ID is assigned after app registration. It is required for integrating the app with the Arcana Auth SDK - Follow the instructions as per the app type and [integrate the app](../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK. Configuring App Unlike other user onboarding options that require enabling authentication providers, passwordless login can be enabled without any configuration setup using the Arcana Developer Dashboard. Developers can optionally choose to modify the default settings for branding and the Arcana wallet settings in the Arcana Developer Dashboard. ## Steps *Follow these steps for enabling passwordless login in a Web3 app that is integrated with the Arcana Auth SDK.* After integrating the app, add the code to onboard users in a passwordless manner using the SDK method listed below. App users must supply an email ID to receive the OTP for logging into the app. An OTP is sent to the specified email ID. When the user provides the same OTP in the app context, authentication is complete and a wallet address is assigned to the user. ### Login with link ``` await auth.loginWithLink(`${email}`) ``` Deprecated `loginWithLink` is deprecated. Use `loginWithOTPStart`, `loginWithOTPComplete` for passwordless login with OTP. The OTP will be received via email supplied in `loginWithOTPStart` call. ### Login with OTP ``` try { const loginState = await auth.loginWithOTPStart("john.doe@somemail.com"); await loginState.begin() if(loginState.isCompleteRequired) { // App is using default app-specific keys // App must ask the user to input a 6-digit code received in mail var userInput = prompt("Please enter a 6-digit code:", "111111"); // Validate if the input is a 6-digit code if (userInput !== null && userInput.length === 6 && !isNaN(userInput)) { const complete = await auth.loginWithOTPComplete( userInput, onMFARequired() => { //Hide overlay, if used in the app }); console.log("complete:",complete); } else { console.log("Invalid input. Please enter a valid 6-digit code."); } } else { // App is using global keys, built-in OTP input UI is displayed by the SDK // App is not required to add code for OTP input } } catch (e) { console.log(e); } ``` Global vs. App Specific Keys Apps using app-specific keys must use a custom login UI that allows users to input the OTP. In this case, the `isCompleteRequired` boolean returns `true` after initiating login with OTP. Apps using global keys are not required to use a custom login UI. A built-in login UI is automatically displayed for the user for OTP. Users must enter the OTP received via email in this UI. MFA Enabled / Disabled During passwordless login via OTP, apps configured for MFA and those using overlays must hide it to enable OTP input. Use the `isMFARequired` callback in the `loginWithOTPComplete` method to hide the overlay. Check if the user has logged in successfully: ``` const connected = await auth.isLoggedIn() ``` Log out the dApp user when requested: ``` await auth.logout() ``` **That is all.** Your dApp is all set for onboarding users via the passwordless login option. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../concepts/authtype/) - [Configure Social Providers](../../../../../setup/) - [Arcana Auth SDK Errors](../../../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../../../auth-usage-guide/) - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) # IAM Providers: Custom Login UI Developers can choose to **not** use Arcana's plug-and-play login UI for third-party IAM providers and instead build a custom login UI to onboard users. In this case, developers must build the custom login UI themselves after configuring the IAM providers in the Arcana Developer Dashboard . This custom login UI must call appropriate user onboarding functions offered by the Arcana Auth SDK for the third-party IAM providers. [Cognito](cognito-oauth/) [Firebase](firebase-login/) # User Login with AWS Cognito In this guide, you will learn how a Vanilla HTML/CSS/JS app integrated with the Arcana Auth SDK can onboard users via custom login UI and AWS Cognito as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure AWS Cognito](../../../../../../setup/config-idm/cognito-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using AWS Cognito to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ### Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via AWS Cognito. ``` await auth.loginWithSocial('aws') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` After onboarding users, developers can add code to access the other Arcana Auth SDK functions in the app. See [Arcana Auth SDK Usage Guide](../../../../../auth-usage-guide/) for details. Add code in the application to log out an authenticated user: ``` await auth.logout() ``` **That is all.** Your app is all set for authenticating users via AWS Cognito. Authenticated users can instantly access the Arcana wallet to sign blockchain transactions. Apps using IAM Providers Apps usually use Arcana Auth SDK for user onboarding and blockchain transaction signing. Authentication providers must be set up in the Arcana Developer Dashboard before integrating with the SDK. Some apps might use third-party IAM providers like AWS Cognito for authentication but still use Arcana Auth SDK to access Arcana wallet. The setup is different since third-party IAM providers support authentication verifiers like Google directly. Developers only need to set up the IAM provider in the Arcana Developer Dashboard. They don't need to configure authentication verifiers that work directly with the IAM providers. Use the IAM provider's console, like Cognito Developer Console, to set up authentication verifiers like Google, not the Arcana Developer Dashboard. No Aggregate Login with Cognito The [aggregate login feature](../../../../../../concepts/aggregatelogin/) does not work for the third-party IAM providers such as Cognito. If a user has the same email ID registered with say a social login provider and with Cognito, logging into an app using Cognito will create a new unique user account even if the user uses the same email as the one used with a social login provider or via the passwordless option. What this means is that the wallet address for the same user will be different when Cognito is used to log in and subsequently a social login provider or passwordless login is used by the same user having the same email ID. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handing authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Firebase In this guide, you will learn how a Vanilla HTML/CSS/JS app integrated with the Arcana Auth SDK and Firebase SDK can onboard users via custom login UI and Firebase as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Firebase](../../../../../../setup/config-idm/firebase-auth/) as the authentication provider. - Install the Firebase SDK and integrate the app as explained in the Firebase documentation for [iOS apps](https://firebase.google.com/docs/ios/setup), [Android apps](https://firebase.google.com/docs/android/setup) and [web apps](https://firebase.google.com/docs/web/setup). Use [Firebase authentication](https://firebase.google.com/docs/auth) as per the Web3 app type, mobile or web app. Once a user is authenticated by Firebase, the developer must obtain the token and user identifier and provide it as input to the `loginWithBearer` function of the Arcana Auth SDK for onboarding users to Web3. - Install the Arcana Auth SDK and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK by using the appropriate integration method as per the app type. After that follow the steps listed below and add code to onboard users to Web3 and enable them to sign blockchain transactions. ## Steps *Using Firebase to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ### Call `loginWithBearer` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with both the Firebase SDK as well as the Arcana Auth SDK, before adding code to onboard users via Firebase. App.vue ``` import { initializeApp } from 'firebase/app' import { getAuth, createUserWithEmailAndPassword, signInWithEmailAndPassword } from 'firebase/auth' import { AuthProvider, BearerAuthentication } from '@arcana/auth' const config = { apiKey: "AIzaSyBddysLWM9CcpNEVLbUz52YwyQL_uytQX0", // Obtain this after registering app at Firebase console authDomain: "arc4n4-docx.firebaseapp.com", // Project ID Domain setting in the Firebase console projectId: "some-projectid-example-arc4n4-docx", storageBucket: "some-storage-arc4n4-docx.appspot.com", messagingSenderId: "2xxxx318486297382", appId: "4:3184ddddddd7382:web:8b639axxxxxxxx39f85fe7", measurementId: "G-EGccccccLDR" }; const firebaseApp = initializeApp(config) const firebaseAuth = getAuth(firebaseApp) //Create Arcana Auth Provider // Get client ID 'xar_live_xxxxxx' from Arcana Developer Dashboard const auth = new AuthProvider("xar_live_123940ytyoxxxxxxx343o404",{ network: "mainnet", //change it to testnet or mainnet }) export default { name: 'App', data: () => ({ email: '', password: '' }), mounted () { AP.init().then((k) => console.log(k)).catch(e => console.error(e)) //Initialize the Auth Provider }, methods: { async ultimate (upm) { if (await AP.isLoggedIn()) { window.alert('Already logged in') return } await auth.loginWithBearer(BearerAuthentication.firebase, { uid: upm.user.uid, token: upm.user.accessToken }) }, async login () { //Sign in existing Firebase users const data = await signInWithEmailAndPassword(firebaseAuth, this.email, this.password) console.log('Data:', data) return this.ultimate(data) }, async register () { //Sign up new users with Firebase Auth const data = await createUserWithEmailAndPassword(firebaseAuth, this.email, this.password) console.log('Data:', data) return this.ultimate(data) } } } ... ``` Refer to the [Sample Firebase Vue app integration example](https://github.com/arcana-network/auth-examples) to see how the `loginWithBearer` function is used. After onboarding users, developers can add code to access the other Arcana Auth SDK functions in the app. See [Arcana Auth SDK Usage Guide](../../../../../auth-usage-guide/) for details. **That is all.** Your app is all set for authenticating users via Firebase. Authenticated users can instantly access the Arcana wallet to sign blockchain transactions. No Aggregate Login with Firebase The [aggregate login feature](../../../../../../concepts/aggregatelogin/) does not work for third-party IAM providers such as Firebase. If a user has the same email ID registered with say a social login provider and with Firebase, logging into an app using Firebase will create a new unique user account even if the user uses the same email as the one used with a social login provider or via the passwordless option. What this means is that the wallet address for the same user will be different when Firebase is used to log in and subsequently a social login provider or passwordless login is used by the same user having the same email ID. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handing authentication errors](../../../../../auth-error-msg/) - [Get Firebase User token](https://firebase.google.com/docs/reference/js/auth.user.md#usergetidtoken) - [Using Firebase Auth](https://firebase.google.com/docs/auth) - [Auth Examples](https://github.com/arcana-network/auth-examples) # Social Login Providers: Custom Login UI Developers can choose to **not** use the plug-and-play login UI and instead build a custom login UI to onboard users. In this case, developers must build custom login UI themselves after configuring the social login providers in the Arcana Developer Dashboard. This custom login UI must call appropriate user onboarding functions offered by the Arcana Auth SDK for every configured social login provider. [Apple](apple-oauth/) [Discord](discord-oauth/) [GitHub](github-oauth/) [Google](google-oauth/) [Steam](steam-oauth/) [Telegram](telegram-oauth/) [Twitch](twitch-oauth/) [Twitter](twitter-oauth/) # User Login with Apple In this guide, you will learn how a 'Vanilla HTML/CSS/JS' app integrated with the Arcana Auth SDK can onboard users via custom login UI and Apple as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - [Follow the instructions to configure Apple](../../../../../../setup/config-social/apple-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Apple to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Apple. ``` await auth.loginWithSocial('apple') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the app to log out an authenticated user: ``` await auth.logout() ``` **That is all** The Web3 app is all set for onboarding users via Apple. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Discord In this guide, you will learn how a Vanilla HTML/CSS/JS app integrated with the Arcana Auth SDK can onboard users via custom login UI and Discord as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Discord](../../../../../../setup/config-social/discord-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Discord to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Discord. ``` await auth.loginWithSocial('discord') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the app to log out an authenticated user: ``` await auth.logout() ``` **That is all.** The Web3 app is all set for onboarding users via Discord. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with GitHub In this guide, you will learn how a Vanilla HTML/CSS/JS app integrated with the Arcana Auth SDK can onboard users via custom login UI and GitHub as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure GitHub](../../../../../../setup/config-social/github-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using GitHub to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via GitHub. ``` await auth.loginWithSocial('github') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the app to log out an authenticated user: ``` await auth.logout() ``` **That is all.** The Web3 app is all set for onboarding users via GitHub. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Google In this guide, you will learn how a 'Vanilla HTML/CSS/JS' app integrated with the Arcana Auth SDK can onboard users via custom login UI and Google as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Google](../../../../../../setup/config-social/google-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Google to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Google. ``` await auth.loginWithSocial('google') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the app to log out an authenticated user: ``` await auth.logout() ``` **That is all.** The Web3 app is all set for onboarding users via Google. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Steam OAuth In this guide, you will learn how a 'Vanilla HTML/CSS/JS' app integrated with the Arcana Auth SDK can onboard users via custom login UI and Steam as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to obtain Steam API key and set it up in the dashboard](../../../../../../setup/config-social/steam-oauth/) for user authentication. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Steam to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Steam OAuth. ``` await auth.loginWithSocial('steam') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` After onboarding users, developers can add code to access the other Arcana Auth SDK functions in the app. See [Arcana Auth SDK Usage Guide](../../../../../auth-usage-guide/) for details. Add code in the application to log out an authenticated user: ``` await auth.logout() ``` **That is all.** Your app is all set for authenticating users via Steam OAuth. Authenticated users can instantly access the Arcana wallet to sign blockchain transactions. No Aggregate Login with Steam OAuth The [aggregate login feature](../../../../../../concepts/aggregatelogin/) does not work for the Steam OAuth login mechanism. When a user has the same email registered with a social login provider and Steam OAuth, logging in with Steam makes a new unique account. Even if the user later logs in with the same email through a social login provider or passwordless, it creates a different wallet address for the same user. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handing authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Telegram In this guide, you will learn how a 'Vanilla HTML/CSS/JS' app integrated with the Arcana Auth SDK can onboard users via custom login UI and Telegram as the social authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - [Follow the instructions to configure Telegram](../../../../../../setup/config-social/telegram-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Telegram to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithBearer` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Telegram. ``` window.onload = () => { const btn = document.getElementById("telegram-login"); btn.onclick = () => { const url = new URL("/auth", "https://oauth.telegram.org"); url.searchParams.append("bot_id", "7097916610"); url.searchParams.append("scope", "profile"); url.searchParams.append("origin", "https://zcnk5z-5000.csb.app"); url.searchParams.append("return_to", "https://zcnk5z-5000.csb.app/redirect"); setTimeout(() => (window.location.href = url.toString()), 50); }; }; ``` ``` const { AuthProvider } = window.arcana.auth; window.onload = async () => { const auth = new AuthProvider( //Use ClientID to create AuthProvider "xar_dev_92ecc87db08e4c13b1fcd9b37ca9bf54fa874355" ); await auth.init(); //Initialize the Auth Provider const u = new URL(window.location.href); if (u.hash) { const p = new URLSearchParams(u.hash.substring(1)); const t = p.get("tgAuthResult"); if (t) { cleanURL(); //Initiate social login, must set app domain in Telegram bot for successful login await auth.loginWithBearer("telegram", { token: t }); } } }; function cleanURL() { const cleanUrl = window.location.origin + window.location.pathname; window.history.replaceState(null, "", cleanUrl); } ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the app to log out an authenticated user: ``` await auth.logout() ``` **That is all.** The Web3 app is all set for onboarding users via Telegram. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Twitch In this guide, you will learn how a 'Vanilla HTML/CSS/JS' app integrated with the Arcana Auth SDK can onboard users via custom login UI and Twitch as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Twitch](../../../../../../setup/config-social/twitch-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Twitch to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Twitch. ``` await auth.loginWithSocial('twitch') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the app to log out an authenticated user: ``` await auth.logout() ``` **That is all.** The Web3 app is all set for onboarding users via Twitch. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Twitter In this guide, you will learn how a 'Vanilla HTML/CSS/JS' app integrated with the Arcana Auth SDK can onboard users via custom login UI and Twitter as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Twitter](../../../../../../setup/config-social/twitter-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Twitter to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Twitter. ``` await auth.loginWithSocial('twitter') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the application to log out an authenticated user: ``` await auth.logout() ``` **That is all.** The Web3 app is all set for onboarding users via Twitter. No Aggregate Login with Twitter OAuth The [aggregate login feature](../../../../../../concepts/aggregatelogin/) does not work for the Steam OAuth login mechanism. When a user has the same email registered with a social login provider and Steam OAuth, logging in with Steam makes a new unique account. Even if the user later logs in with the same email through a social login provider or passwordless, it creates a different wallet address for the same user. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # Plug-and-Play Login UI Use the built-in, [plug-and-play login UI modal](../../../../concepts/plug-and-play-auth/) to quickly onboard users in a 'Vue' app integrated with the Arcana Auth Wagmi SDK. Custom Login UI You can onboard users through a [custom login UI](../../../../concepts/custom-login-ui/) instead of the [built-in plug-and-play](../../../../concepts/plug-and-play-auth/) one. See [how to use custom login UI](../custom-ui/) and onboard users in a 'Vue' app. ## Prerequisites - [Register](../../../../setup/config-auth/register-app/) the app that uses `wagmi` and configure the SDK usage [settings for social login](../../../../setup/) providers, [manage app chains](../../../../setup/config-wallet-chains/) and [wallet user experience](../../../../setup/config-wallet/). - Install the [required SDK packages](../../../sdk-installation/) for 'Vue'. - [Integrate](../../../integrate/wagmi/) 'Vue' app, create and initialize the `AuthProvider`. ## Steps ### 1. `connect` Use the `connect()` function to bring up the plug-and-play pop-up modal in the app context and display the available options for user onboarding. Only those options are displayed that were earlier configured by the developer using the Arcana Developer Dashboard. The passwordless login option is enabled by default. ``` await auth.connect(); ``` Plug-and-Play Login UI Compact Mode While creating the `AuthProvider`, use `connectoOptions` to optionally choose the [compact mode](../../../../concepts/plug-and-play-auth/#compact-modal) for the plug-and-play login UI. ``` connectOptions: { compact: true // default - false }, ``` Login UI Options Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use.. No plug-and-play support for Firebase authentication. The [plug and play feature](../../../../concepts/plug-and-play-auth/) of the Arcana Auth SDK does not support social login via Firebase. Developers must build a custom login UI and add code to onboard users. For details, see [onboarding users via Firebase and custom login UI](../../vanilla/custom-ui/build-idm/firebase-login/) No plug-and-play support for Telegram authentication. The [plug and play feature](../../../../concepts/plug-and-play-auth/) of the Arcana Auth SDK does not support social login via Telegram. Developers must build a custom login UI and add code to onboard users. For details, see \[\[{{ no such element: dict object['telegram_custom_ui_tag'] }}|onboarding users via Telegram and custom login UI\]\]. ## What's Next? Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../../web3-ops/evm/) in the authenticated user's context. ## See also **'Vue'** integration example: See `sample-auth-vue` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../../faq/faq-gen/) - [Troubleshooting Guide](../../../../troubleshooting/) - [Arcana Auth SDK Errors](../../../auth-error-msg/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) [Try Demo App](https://demo.arcana.network) # Custom Login UI [Passwordless Auth](build-pwdless-auth/) [Social Login Provider](build-social/) [IAM Provider](build-idm/) # Build Custom Passwordless Auth In this guide, you will learn how to integrate Vue app with the Arcana Auth SDK and then onboard users through custom login UI and passwordless login option. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - The app must be [registered using the Arcana Developer Dashboard](../../../../../setup/config-auth/register-app/). A unique Client ID is assigned after app registration. It is required for integrating the app with the Arcana Auth SDK - Follow the instructions as per the app type and [integrate the app](../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK. Configuring App Unlike other user onboarding options that require enabling authentication providers, passwordless login can be enabled without any configuration setup using the Arcana Developer Dashboard. Developers can optionally choose to modify the default settings for branding and the Arcana wallet settings in the Arcana Developer Dashboard. ## Steps *Follow these steps for enabling passwordless login in a Web3 app that is integrated with the Arcana Auth SDK.* After integrating the app, add the code to onboard users in a passwordless manner using the SDK method listed below. App users must supply an email ID to receive the OTP for logging into the app. An OTP is sent to the specified email ID. When the user provides the same OTP in the app context, authentication is complete and a wallet address is assigned to the user. ### Login with link ``` await auth.loginWithLink(`${email}`) ``` Deprecated `loginWithLink` is deprecated. Use `loginWithOTPStart`, `loginWithOTPComplete` for passwordless login with OTP. The OTP will be received via email supplied in `loginWithOTPStart` call. ### Login with OTP ``` try { const loginState = await auth.loginWithOTPStart("john.doe@somemail.com"); await loginState.begin() if(loginState.isCompleteRequired) { // App is using default app-specific keys // App must ask the user to input a 6-digit code received in mail var userInput = prompt("Please enter a 6-digit code:", "111111"); // Validate if the input is a 6-digit code if (userInput !== null && userInput.length === 6 && !isNaN(userInput)) { const complete = await auth.loginWithOTPComplete( userInput, onMFARequired() => { //Hide overlay, if used in the app }); console.log("complete:",complete); } else { console.log("Invalid input. Please enter a valid 6-digit code."); } } else { // App is using global keys, built-in OTP input UI is displayed by the SDK // App is not required to add code for OTP input } } catch (e) { console.log(e); } ``` Global vs. App Specific Keys Apps using app-specific keys must use a custom login UI that allows users to input the OTP. In this case, the `isCompleteRequired` boolean returns `true` after initiating login with OTP. Apps using global keys are not required to use a custom login UI. A built-in login UI is automatically displayed for the user for OTP. Users must enter the OTP received via email in this UI. MFA Enabled / Disabled During passwordless login via OTP, apps configured for MFA and those using overlays must hide it to enable OTP input. Use the `isMFARequired` callback in the `loginWithOTPComplete` method to hide the overlay. Check if the user has logged in successfully: ``` const connected = await auth.isLoggedIn() ``` Log out the dApp user when requested: ``` await auth.logout() ``` **That is all.** Your dApp is all set for onboarding users via the passwordless login option. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../concepts/authtype/) - [Configure Social Providers](../../../../../setup/) - [Arcana Auth SDK Errors](../../../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../../../auth-usage-guide/) - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) # IAM Providers: Custom Login UI Developers can choose to **not** use Arcana's plug-and-play login UI for third-party IAM providers and instead build a custom login UI to onboard users. In this case, developers must build the custom login UI themselves after configuring the IAM providers in the Arcana Developer Dashboard. This custom login UI must call appropriate user onboarding functions offered by the Arcana Auth SDK for the third-party IAM providers. [Cognito](cognito-oauth/) [Firebase](firebase-login/) # User Login with AWS Cognito In this guide, you will learn how a Vue app integrated with the Arcana Auth SDK can onboard users via custom login UI and AWS Cognito as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure AWS Cognito](../../../../../../setup/config-idm/cognito-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using AWS Cognito to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ### Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via AWS Cognito. ``` await auth.loginWithSocial('aws') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` After onboarding users, developers can add code to access the other Arcana Auth SDK functions in the app. See [Arcana Auth SDK Usage Guide](../../../../../auth-usage-guide/) for details. Add code in the application to log out an authenticated user: ``` await auth.logout() ``` **That is all.** Your app is all set for authenticating users via AWS Cognito. Authenticated users can instantly access the Arcana wallet to sign blockchain transactions. Apps using IAM Providers Apps usually use Arcana Auth SDK for user onboarding and blockchain transaction signing. Authentication providers must be set up in the Arcana Developer Dashboard before integrating with the SDK. Some apps might use third-party IAM providers like AWS Cognito for authentication but still use Arcana Auth SDK to access Arcana wallet. The setup is different since third-party IAM providers support authentication verifiers like Google directly. Developers only need to set up the IAM provider in the Arcana Developer Dashboard. They don't need to configure authentication verifiers that work directly with the IAM providers. Use the IAM provider's console, like Cognito Developer Console, to set up authentication verifiers like Google, not the Arcana Developer Dashboard. No Aggregate Login with Cognito The [aggregate login feature](../../../../../../concepts/aggregatelogin/) does not work for the third-party IAM providers such as Cognito. If a user has the same email ID registered with say a social login provider and with Cognito, logging into an app using Cognito will create a new unique user account even if the user uses the same email as the one used with a social login provider or via the passwordless option. What this means is that the wallet address for the same user will be different when Cognito is used to log in and subsequently a social login provider or passwordless login is used by the same user having the same email ID. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handing authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Firebase In this guide, you will learn how a Vue app integrated with the Arcana Auth SDK and Firebase SDK can onboard users via custom login UI and Firebase as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Firebase](../../../../../../setup/config-idm/firebase-auth/) as the authentication provider. - Install the Firebase SDK and integrate the app as explained in the Firebase documentation for [iOS apps](https://firebase.google.com/docs/ios/setup), [Android apps](https://firebase.google.com/docs/android/setup) and [web apps](https://firebase.google.com/docs/web/setup). Use [Firebase authentication](https://firebase.google.com/docs/auth) as per the Web3 app type, mobile or web app. Once a user is authenticated by Firebase, the developer must obtain the token and user identifier and provide it as input to the `loginWithBearer` function of the Arcana Auth SDK for onboarding users to Web3. - Install the Arcana Auth SDK and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK by using the appropriate integration method as per the app type. After that follow the steps listed below and add code to onboard users to Web3 and enable them to sign blockchain transactions. ## Steps *Using Firebase to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ### Call `loginWithBearer` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with both the Firebase SDK as well as the Arcana Auth SDK, before adding code to onboard users via Firebase. App.vue ``` import { initializeApp } from 'firebase/app' import { getAuth, createUserWithEmailAndPassword, signInWithEmailAndPassword } from 'firebase/auth' import { AuthProvider, BearerAuthentication } from '@arcana/auth' const config = { apiKey: "AIzaSyBddysLWM9CcpNEVLbUz52YwyQL_uytQX0", // Obtain this after registering app at Firebase console authDomain: "arc4n4-docx.firebaseapp.com", // Project ID Domain setting in the Firebase console projectId: "some-projectid-example-arc4n4-docx", storageBucket: "some-storage-arc4n4-docx.appspot.com", messagingSenderId: "2xxxx318486297382", appId: "4:3184ddddddd7382:web:8b639axxxxxxxx39f85fe7", measurementId: "G-EGccccccLDR" }; const firebaseApp = initializeApp(config) const firebaseAuth = getAuth(firebaseApp) //Create Arcana Auth Provider // Get client ID 'xar_live_xxxxxx' from Arcana Developer Dashboard const auth = new AuthProvider("xar_live_123940ytyoxxxxxxx343o404",{ network: "mainnet", //change it to testnet or mainnet }) export default { name: 'App', data: () => ({ email: '', password: '' }), mounted () { AP.init().then((k) => console.log(k)).catch(e => console.error(e)) //Initialize the Auth Provider }, methods: { async ultimate (upm) { if (await AP.isLoggedIn()) { window.alert('Already logged in') return } await auth.loginWithBearer(BearerAuthentication.firebase, { uid: upm.user.uid, token: upm.user.accessToken }) }, async login () { //Sign in existing Firebase users const data = await signInWithEmailAndPassword(firebaseAuth, this.email, this.password) console.log('Data:', data) return this.ultimate(data) }, async register () { //Sign up new users with Firebase Auth const data = await createUserWithEmailAndPassword(firebaseAuth, this.email, this.password) console.log('Data:', data) return this.ultimate(data) } } } ... ``` Refer to the [Sample Firebase Vue app integration example](https://github.com/arcana-network/auth-examples) to see how the `loginWithBearer` function is used. After onboarding users, developers can add code to access the other Arcana Auth SDK functions in the app. See [Arcana Auth SDK Usage Guide](../../../../../auth-usage-guide/) for details. **That is all.** Your app is all set for authenticating users via Firebase. Authenticated users can instantly access the Arcana wallet to sign blockchain transactions. No Aggregate Login with Firebase The [aggregate login feature](../../../../../../concepts/aggregatelogin/) does not work for third-party IAM providers such as Firebase. If a user has the same email ID registered with say a social login provider and with Firebase, logging into an app using Firebase will create a new unique user account even if the user uses the same email as the one used with a social login provider or via the passwordless option. What this means is that the wallet address for the same user will be different when Firebase is used to log in and subsequently a social login provider or passwordless login is used by the same user having the same email ID. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handing authentication errors](../../../../../auth-error-msg/) - [Get Firebase User token](https://firebase.google.com/docs/reference/js/auth.user.md#usergetidtoken) - [Using Firebase Auth](https://firebase.google.com/docs/auth) - [Auth Examples](https://github.com/arcana-network/auth-examples) # Social Login Providers: Custom Login UI Developers can choose to **not** use the plug-and-play login UI and instead build a custom login UI to onboard users. In this case, developers must build custom login UI themselves after configuring the social login providers in the Arcana Developer Dashboard. This custom login UI must call appropriate user onboarding functions offered by the Arcana Auth SDK for every configured social login provider. [Apple](apple-oauth/) [Discord](discord-oauth/) [GitHub](github-oauth/) [Google](google-oauth/) [Steam](steam-oauth/) [Telegram](telegram-oauth/) [Twitch](twitch-oauth/) [Twitter](twitter-oauth/) # User Login with Apple In this guide, you will learn how a Vue app integrated with the Arcana Auth SDK can onboard users via custom login UI and Apple as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - [Follow the instructions to configure Apple](../../../../../../setup/config-social/apple-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Apple to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Apple. ``` await auth.loginWithSocial('apple') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the app to log out an authenticated user: ``` await auth.logout() ``` **That is all** The Web3 app is all set for onboarding users via Apple. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Discord In this guide, you will learn how a Vue app integrated with the Arcana Auth SDK can onboard users via custom login UI and Discord as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Discord](../../../../../../setup/config-social/discord-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Discord to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Discord. ``` await auth.loginWithSocial('discord') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the app to log out an authenticated user: ``` await auth.logout() ``` **That is all.** The Web3 app is all set for onboarding users via Discord. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with GitHub In this guide, you will learn how a Vue app integrated with the Arcana Auth SDK can onboard users via custom login UI and GitHub as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure GitHub](../../../../../../setup/config-social/github-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using GitHub to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via GitHub. ``` await auth.loginWithSocial('github') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the app to log out an authenticated user: ``` await auth.logout() ``` **That is all.** The Web3 app is all set for onboarding users via GitHub. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Google In this guide, you will learn how a Vue app integrated with the Arcana Auth SDK can onboard users via custom login UI and Google as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Google](../../../../../../setup/config-social/google-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Google to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Google. ``` await auth.loginWithSocial('google') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the app to log out an authenticated user: ``` await auth.logout() ``` **That is all.** The Web3 app is all set for onboarding users via Google. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Steam OAuth In this guide, you will learn how a Vue app integrated with the Arcana Auth SDK can onboard users via custom login UI and Steam as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to obtain Steam API key and set it up in the dashboard](../../../../../../setup/config-social/steam-oauth/) for user authentication. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Steam to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Steam OAuth. ``` await auth.loginWithSocial('steam') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` After onboarding users, developers can add code to access the other Arcana Auth SDK functions in the app. See [Arcana Auth SDK Usage Guide](../../../../../auth-usage-guide/) for details. Add code in the application to log out an authenticated user: ``` await auth.logout() ``` **That is all.** Your app is all set for authenticating users via Steam OAuth. Authenticated users can instantly access the Arcana wallet to sign blockchain transactions. No Aggregate Login with Steam OAuth The [aggregate login feature](../../../../../../concepts/aggregatelogin/) does not work for the Steam OAuth login mechanism. When a user has the same email registered with a social login provider and Steam OAuth, logging in with Steam makes a new unique account. Even if the user later logs in with the same email through a social login provider or passwordless, it creates a different wallet address for the same user. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handing authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Telegram In this guide, you will learn how a Vue app integrated with the Arcana Auth SDK can onboard users via custom login UI and Telegram as the social authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - [Follow the instructions to configure Telegram](../../../../../../setup/config-social/telegram-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Telegram to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithBearer` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Telegram. ``` window.onload = () => { const btn = document.getElementById("telegram-login"); btn.onclick = () => { const url = new URL("/auth", "https://oauth.telegram.org"); url.searchParams.append("bot_id", "7097916610"); url.searchParams.append("scope", "profile"); url.searchParams.append("origin", "https://zcnk5z-5000.csb.app"); url.searchParams.append("return_to", "https://zcnk5z-5000.csb.app/redirect"); setTimeout(() => (window.location.href = url.toString()), 50); }; }; ``` ``` const { AuthProvider } = window.arcana.auth; window.onload = async () => { const auth = new AuthProvider( //Use ClientID to create AuthProvider "xar_dev_92ecc87db08e4c13b1fcd9b37ca9bf54fa874355" ); await auth.init(); //Initialize the Auth Provider const u = new URL(window.location.href); if (u.hash) { const p = new URLSearchParams(u.hash.substring(1)); const t = p.get("tgAuthResult"); if (t) { cleanURL(); //Initiate social login, must set app domain in Telegram bot for successful login await auth.loginWithBearer("telegram", { token: t }); } } }; function cleanURL() { const cleanUrl = window.location.origin + window.location.pathname; window.history.replaceState(null, "", cleanUrl); } ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the app to log out an authenticated user: ``` await auth.logout() ``` **That is all.** The Web3 app is all set for onboarding users via Telegram. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Twitch In this guide, you will learn how a Vue app integrated with the Arcana Auth SDK can onboard users via custom login UI and Twitch as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Twitch](../../../../../../setup/config-social/twitch-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Twitch to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Twitch. ``` await auth.loginWithSocial('twitch') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the app to log out an authenticated user: ``` await auth.logout() ``` **That is all.** The Web3 app is all set for onboarding users via Twitch. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # User Login with Twitter In this guide, you will learn how a Vue app integrated with the Arcana Auth SDK can onboard users via custom login UI and Twitter as the authentication provider. ## Prerequisites - Make sure you can access the Arcana Developer Dashboard: - Use the [Arcana Developer Dashboard](../../../../../../concepts/dashboard/) to [register the app](../../../../../../setup/config-auth/register-app/) and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK. - Carefully [follow the instructions to configure Twitter](../../../../../../setup/config-social/twitter-oauth/) as the authentication provider. - Use the appropriate integration method as per the app type and [integrate the app](../../../../../integrate/vanilla-html-css-js/) with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK. ## Steps *Using Twitter to onboard users in a Web3 app that is integrated with the Arcana Auth SDK requires a single line of code.* ## Step 1: Call `loginWithSocial` function Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Twitter. ``` await auth.loginWithSocial('twitter') ``` Check if a user is logged in: ``` const connected = await auth.isLoggedIn() ``` Add code in the application to log out an authenticated user: ``` await auth.logout() ``` **That is all.** The Web3 app is all set for onboarding users via Twitter. No Aggregate Login with Twitter OAuth The [aggregate login feature](../../../../../../concepts/aggregatelogin/) does not work for the Steam OAuth login mechanism. When a user has the same email registered with a social login provider and Steam OAuth, logging in with Steam makes a new unique account. Even if the user later logs in with the same email through a social login provider or passwordless, it creates a different wallet address for the same user. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../../../../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## What's Next? Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the `AuthProvider` EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. [Learn more...](../../../../../web3-ops/evm/) ## See also - [Authentication Types](../../../../../../concepts/authtype/) - [Handling authentication errors](../../../../../auth-error-msg/) - [Auth Examples](https://github.com/arcana-network/auth-examples) # Custom Login UI Onboard users in a 'Wagmi' app integrated with the Arcana Auth SDK through a custom login UI. Plug-and-Play Login UI You can onboard users in a 'Wagmi' app faster through the built-in, [plug-and-play login UI](../../../../concepts/plug-and-play-auth/) instead of choosing to build a custom login UI. [Learn more...](../wagmi-pnp-ui/) ## Prerequisites - [Register](../../../../setup/config-auth/register-app/) the Wagmi app and configure SDK usage [settings for social login](../../../../setup/) providers, [manage app chains](../../../../setup/config-wallet-chains/) and [wallet user experience](../../../../setup/config-wallet/). - Install the [required SDK packages](../../../sdk-installation/) for 'Wagmi'. - [Integrate](../../../integrate/wagmi/) 'Wagmi' app and create `AuthProvider`, `ArcanaConnector`. ## Steps ### 1. Configure `ArcanaConnector` `ArcanaConnector` is created earlier as part of SDK integration. When using a custom login UI to onboard users, configure `ArcanaConnector` differently. Add code in the custom UI for onboarding via social login and passwordless options by using the `setLogin` function. *Enable Authentication Provider* ``` import { AuthProvider } from "@arcana/auth"; import { ArcanaConnector } from "@arcana/auth-wagmi"; import { polygon, polygonAmoy } from "wagmi/chains"; import { configureChains, createClient, Chain } from "wagmi"; import { publicProvider } from "wagmi/providers/public"; /* Using Custom UI for user login via Google */ const auth = new AuthProvider(`${arcana_client_id}`) // Singleton export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: auth, login: { provider: 'google', //See 'Custom Login UI' section in the documentation for other supported providers. } // Optional, specify here during ArcanaConnector instantiation or in the setLogin function }, }); }; // Custom UI Alternative // Use setLogin function after creating the connector. /* const auth = new AuthProvider(`${arcana_client_id}`) // Singleton export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: auth }, }); }; connector.setLogin({ provider: 'google' }) */ ... ``` *Enable Passwordless Login* ``` import { AuthProvider } from "@arcana/auth"; import { ArcanaConnector } from "@arcana/auth-wagmi"; import { polygon, polygonAmoy } from "wagmi/chains"; import { configureChains, createClient, Chain } from "wagmi"; import { publicProvider } from "wagmi/providers/public"; /* Using Custom UI for Passwordless user login */ const auth = new AuthProvider(`${arcana_client_id}`) // Singleton export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: auth, login: { provider: 'passwordless', email: 'abc@example.com' //optional } // Optional, specify login details here or during ArcanaConnector instantiation or in the setLogin function }, }); }; // Custom UI Alternative // Use setLogin function after creating the connector. /* const auth = new AuthProvider(`${arcana_client_id}`) // Singleton export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: auth }, }); }; connector.setLogin({ provider: 'passwordless', email: 'abc@example.com' //optional }) */ ... ``` Single Provider Optimization When using a single social login provider, specify it when creating ArcanaConnector to optimize onboarding. There's no need to use setLogin later in the custom login UI code. For multiple social login providers, create ArcanaConnector without specifying a provider. Use the setLogin function later based on the user's choice. ### 2. Set up `WagmiConfig` Use the `ArcanaConnector` and set up [Wagmi config](https://wagmi.sh/react/getting-started). ``` import { http, createConfig } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' import { coinbaseWallet, injected, walletConnect } from 'wagmi/connectors' import { AuthProvider } from '@arcana/auth'; import { ArcanaConnector } from "@arcana/auth-wagmi" let auth: AuthProvider | null; if (!auth) { auth = new AuthProvider( "xar_dev_c2fb7be163754e57d384e24257ea2c8d2a5dd31a" ); } export const connector = () => { return new ArcanaConnector({auth,}) }; export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ injected(), coinbaseWallet({ appName: 'Create Wagmi' }), walletConnect({ projectId: import.meta.env.VITE_WC_PROJECT_ID }), connector(), ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) declare module 'wagmi' { interface Register { config: typeof config } } ``` ``` // Note: // This sample code is for // wagmi versions 1.x.y and auth-wagmi 2.a.b import { configureChains, createConfig, WagmiConfig } from "wagmi"; import { publicProvider } from "wagmi/providers/public"; import { ArcanaConnector } from "@arcana/auth-wagmi"; import { polygon, polygonAmoy } from "wagmi/chains"; import { newAuthProvider } from "./utils/newArcanaAuth"; import { useAccount, useConnect, useDisconnect, useBalance } from 'wagmi' import "../styles/globals.css"; const { chains, provider, webSocketProvider } = configureChains( [mainnet, polygon, polygonAmoy], [publicProvider()], { targetQuorum: 1 } ); export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: newAuthProvider(), login: { provider: "google", }, }, }); }; const { chains, publicClient } = configureChains( [polygon, polygonAmoy], [publicProvider()] ); export const wagmiEntity = createConfig({ autoConnect: true, connectors: [connector(chains)], publicClient, }); ... ``` ### 3. Initialize Wagmi App Components ``` // // For apps using Wagmi versions v2.a.b and auth-wagmi v3.x.y // import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { Buffer } from 'buffer' import React from 'react' import ReactDOM from 'react-dom/client' import { WagmiProvider } from 'wagmi' import App from './App.tsx' import { config } from './wagmi.ts' import './index.css' globalThis.Buffer = Buffer const queryClient = new QueryClient() ReactDOM.createRoot(document.getElementById('root')!).render( , ) ``` ``` // // For apps using Wagmi versions v1.a.b and auth-wagmi v2.x.y // function App({ Component, pageProps }: AppProps) { return ( ); } ``` ## What's Next? Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../../web3-ops/evm/) in the authenticated user's context. ## See also **'Wagmi'** integration example: See `sample-auth-wagmi-2`, `sample-auth-wagmi-viem`, `sample-auth-wagmi` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../../faq/faq-gen/) - [Troubleshooting Guide](../../../../troubleshooting/) - [Arcana Auth SDK Errors](../../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../../auth-usage-guide/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) [Try Demo App](https://demo.arcana.network) # Plug-and-Play Login UI Use the built-in, [plug-and-play login UI modal](../../../../concepts/plug-and-play-auth/) to quickly onboard users in a 'Wagmi' app integrated with the Arcana Auth Wagmi SDK. Custom Login UI You can onboard users through a [custom login UI](../../../../concepts/custom-login-ui/) instead of the [built-in plug-and-play](../../../../concepts/plug-and-play-auth/) one. See [how to use custom login UI](../wagmi-custom-ui/) and onboard users in a 'Wagmi' app. ## Prerequisites - [Register](../../../../setup/config-auth/register-app/) the Wagmi app and configure Arcana Auth SDK SDK usage [settings for social login](../../../../setup/) providers, [manage app chains](../../../../setup/config-wallet-chains/) and [wallet user experience](../../../../setup/config-wallet/). - Install the [required SDK packages](../../../sdk-installation/) for 'Wagmi'. - [Integrate](../../../integrate/wagmi/) 'Wagmi' app and create `AuthProvider`, `ArcanaConnector`. ## Steps ### 1. Setup `WagmiConfig` Use the `ArcanaConnector` created during app integration to set up [Wagmi config](https://wagmi.sh/react/getting-started). ``` // // For apps using Wagmi versions v2.a.b and auth-wagmi v3.x.y // import { http, createConfig } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' import { coinbaseWallet, injected, walletConnect } from 'wagmi/connectors' import { AuthProvider } from '@arcana/auth' import { ArcanaConnector } from "@arcana/auth-wagmi" let auth: AuthProvider | null; if (!auth) { auth = new AuthProvider( "Your-app-Client-ID" ); } const connector = new ArcanaConnector({ auth }); export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ injected(), coinbaseWallet({ appName: 'Create Wagmi' }), walletConnect({ projectId: import.meta.env.VITE_WC_PROJECT_ID }), connector(), ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) declare module 'wagmi' { interface Register { config: typeof config } } ... ``` ``` // // For apps using Wagmi versions v1.x.y and auth-wagmi v2.a.b // import { configureChains, createConfig, WagmiConfig } from "wagmi"; import { publicProvider } from "wagmi/providers/public"; import { polygon, polygonAmoy } from "wagmi/chains"; import { useAccount, useConnect, useDisconnect, useBalance } from 'wagmi' import "../styles/globals.css"; import { AuthProvider } from '@arcana/auth' import { ArcanaConnector } from "@arcana/auth-wagmi" let auth: AuthProvider | null; if (!auth) { auth = new AuthProvider( "Your-app-Client-ID" ); } const { chains, provider, webSocketProvider } = configureChains( [mainnet, polygon, polygonAmoy], [publicProvider()], { targetQuorum: 1 } ); export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: auth, }, }); }; const { chains, publicClient } = configureChains( [polygon, polygonAmoy], [publicProvider()] ); export const wagmiEntity = createConfig({ autoConnect: true, connectors: [connector(chains)], publicClient, }); ... ``` ### 2. Initialize `WagmiProvider` Use the Wagmi config to initialize the `WagmiProvider`. ``` // // For apps using Wagmi versions v2.a.b and auth-wagmi v3.x.y // import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { Buffer } from 'buffer' import React from 'react' import ReactDOM from 'react-dom/client' import { WagmiProvider } from 'wagmi' import App from './App.tsx' import { config } from './wagmi.ts' import './index.css' globalThis.Buffer = Buffer const queryClient = new QueryClient() ReactDOM.createRoot(document.getElementById('root')!).render( , ) ``` ``` // // For apps using Wagmi versions v1.a.b and auth-wagmi v2.x.y // function App({ Component, pageProps }: AppProps) { return ( ); } ``` ## What's Next? Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../../web3-ops/evm/) in the authenticated user's context. ## See also **'Wagmi'** integration example: See `sample-auth-wagmi-2`, `sample-auth-wagmi-viem`, `sample-auth-wagmi` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../../faq/faq-gen/) - [Troubleshooting Guide](../../../../troubleshooting/) - [Arcana Auth SDK Errors](../../../auth-error-msg/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) [Try Demo App](https://demo.arcana.network) # Custom Login UI Onboard users in a 'WalletConnect' app integrated with the Arcana Auth SDK through a custom login UI. Plug-and-Play Login UI You can onboard users in a 'WalletConnect' app faster through the built-in, [plug-and-play login UI](../../../../concepts/plug-and-play-auth/) instead of choosing to build a custom login UI. [Learn more...](../walletconnect-pnp-ui/) ## Prerequisites - [Register](../../../../setup/config-auth/register-app/) the Wagmi app and configure SDK usage [settings for social login](../../../../setup/) providers, [manage app chains](../../../../setup/config-wallet-chains/) and [wallet user experience](../../../../setup/config-wallet/). - Install the [required SDK packages](../../../sdk-installation/) for 'WalletConnect'. - [Integrate](../../../integrate/wagmi/) 'WalletConnect' app and create `AuthProvider`, `ArcanaConnector`. ## Steps ### 1. Configure `ArcanaConnector` `ArcanaConnector` is created earlier as part of SDK integration. When using a custom login UI to onboard users, configure `ArcanaConnector` differently. Add code in the custom UI for onboarding via social login and passwordless options by using the `setLogin` function. *Enable Authentication Provider* ``` import { AuthProvider } from "@arcana/auth"; import { ArcanaConnector } from "@arcana/auth-wagmi"; import { polygon, polygonAmoy } from "wagmi/chains"; import { configureChains, createClient, Chain } from "wagmi"; import { publicProvider } from "wagmi/providers/public"; /* Using Custom UI for user login via Google */ const auth = new AuthProvider(`${arcana_client_id}`) // Singleton export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: auth, login: { provider: 'google', //See 'Custom Login UI' section in the documentation for other supported providers. } // Optional, specify here during ArcanaConnector instantiation or in the setLogin function }, }); }; // Custom UI Alternative // Use setLogin function after creating the connector. /* const auth = new AuthProvider(`${arcana_client_id}`) // Singleton export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: auth }, }); }; connector.setLogin({ provider: 'google' }) */ ... ``` *Enable Passwordless Login* ``` import { AuthProvider } from "@arcana/auth"; import { ArcanaConnector } from "@arcana/auth-wagmi"; import { polygon, polygonAmoy } from "wagmi/chains"; import { configureChains, createClient, Chain } from "wagmi"; import { publicProvider } from "wagmi/providers/public"; /* Using Custom UI for Passwordless user login */ const auth = new AuthProvider(`${arcana_client_id}`) // Singleton export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: auth, login: { provider: 'passwordless', email: 'abc@example.com' //optional } // Optional, specify login details here or during ArcanaConnector instantiation or in the setLogin function }, }); }; // Custom UI Alternative // Use setLogin function after creating the connector. /* const auth = new AuthProvider(`${arcana_client_id}`) // Singleton export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: auth }, }); }; connector.setLogin({ provider: 'passwordless', email: 'abc@example.com' //optional }) */ ... ``` Single Provider Optimization When using a single social login provider, specify it when creating ArcanaConnector to optimize onboarding. There's no need to use setLogin later in the custom login UI code. For multiple social login providers, create ArcanaConnector without specifying a provider. Use the setLogin function later based on the user's choice. ### 2. Set up `WagmiConfig` Use the `ArcanaConnector` and set up [Wagmi config](https://wagmi.sh/react/getting-started). ``` //Use "`auth-wagmi` version > v2.0.0" import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { Buffer } from 'buffer' import React from 'react' import ReactDOM from 'react-dom/client' import { WagmiProvider } from 'wagmi' import App from './App.tsx' import { config } from './wagmi.ts' import './index.css' globalThis.Buffer = Buffer const queryClient = new QueryClient() ReactDOM.createRoot(document.getElementById('root')!).render( , ) ``` ### 3. Initialize WalletConnect App Component ``` // // For apps using Wagmi versions v2.a.b and auth-wagmi v3.x.y // import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { Buffer } from 'buffer' import React from 'react' import ReactDOM from 'react-dom/client' import { WagmiProvider } from 'wagmi' import App from './App.tsx' import { config } from './wagmi.ts' import './index.css' globalThis.Buffer = Buffer const queryClient = new QueryClient() ReactDOM.createRoot(document.getElementById('root')!).render( , ) ``` ``` // // For apps using Wagmi versions v1.a.b and auth-wagmi v2.x.y // function App({ Component, pageProps }: AppProps) { return ( ); } ``` ## What's Next? Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../../web3-ops/evm/) in the authenticated user's context. ## See also **'WalletConnect'** integration example: See `sample-auth-walletconnect` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../../faq/faq-gen/) - [Troubleshooting Guide](../../../../troubleshooting/) - [Arcana Auth SDK Errors](../../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../../auth-usage-guide/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) [Try Demo App](https://demo.arcana.network) # Plug-and-Play Login UI Use the built-in, [plug-and-play login UI modal](../../../../concepts/plug-and-play-auth/) to quickly onboard users in a 'WalletConnect' app integrated with the Arcana Auth Wagmi SDK. Custom Login UI You can onboard users through a [custom login UI](../../../../concepts/custom-login-ui/) instead of the [built-in plug-and-play](../../../../concepts/plug-and-play-auth/) one. See [how to use custom login UI](../walletconnect-custom-ui/) and onboard users in a 'WalletConnect' app. ## Prerequisites - [Register](../../../../setup/config-auth/register-app/) the Wagmi app and configure SDK usage [settings for social login](../../../../setup/) providers, [manage app chains](../../../../setup/config-wallet-chains/) and [wallet user experience](../../../../setup/config-wallet/). - Install the [required SDK packages](../../../sdk-installation/) for 'WalletConnect'. - [Integrate](../../../integrate/wagmi/) 'WalletConnect' app and create `AuthProvider`, `ArcanaConnector`. ## Steps ### 1. Setup `WagmiConfig` Use the `ArcanaConnector` created during app integration to set up [Wagmi config](https://wagmi.sh/react/getting-started). ``` //Use "`auth-wagmi` version > v2.0.0" import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { Buffer } from 'buffer' import React from 'react' import ReactDOM from 'react-dom/client' import { WagmiProvider } from 'wagmi' import App from './App.tsx' import { config } from './wagmi.ts' import './index.css' globalThis.Buffer = Buffer const queryClient = new QueryClient() ReactDOM.createRoot(document.getElementById('root')!).render( , ) ``` ### 2. Set up `WagmiProvider` Next, use the `WagmiProvider` with this specified Wagmi config and initialize `WagmiProvider` in the app. ``` //This example uses Arcana Wallet connector and Coinbase Wallet import { http, createConfig } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' import { coinbaseWallet, injected, walletConnect } from 'wagmi/connectors' import { ArcanaConnector } from "@arcana/auth-wagmi"; import { getAuthProvider } from './arcanaConnector'; export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ injected(), coinbaseWallet({ appName: 'Create Wagmi' }), walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', //WalletConnect ProjectID }), ArcanaConnector( { auth: getAuthProvider(), } ) ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) declare module 'wagmi' { interface Register { config: typeof config } } ``` ## What's Next? Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../../web3-ops/evm/) in the authenticated user's context. ## See also **'WalletConnect'** integration example: See `sample-auth-walletconnect` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../../faq/faq-gen/) - [Troubleshooting Guide](../../../../troubleshooting/) - [Arcana Auth SDK Errors](../../../auth-error-msg/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) [Try Demo App](https://demo.arcana.network) # Custom Login UI Onboard users in a 'Web3-React' app integrated with the Arcana Auth SDK through a custom login UI. Plug-and-Play Login UI You can onboard users in a 'Web3-React' app faster through the built-in, [plug-and-play login UI](../../../../concepts/plug-and-play-auth/) instead of choosing to build a custom login UI. [Learn more...](../web3-react-pnp-ui/) ## Prerequisites - [Register](../../../../setup/config-auth/register-app/) the Wagmi app and configure SDK usage [settings for social login](../../../../setup/) providers, [manage app chains](../../../../setup/config-wallet-chains/) and [wallet user experience](../../../../setup/config-wallet/). - Install the [required SDK packages](../../../sdk-installation/) for 'Web3-React'. - [Integrate](../../../integrate/wagmi/) 'Web3-React' app and create `AuthProvider`, `ArcanaConnector`. ## Steps ### 1. Configure `ArcanaConnector` `ArcanaConnector` is created earlier as part of SDK integration. When using a custom login UI to onboard users, configure `ArcanaConnector` differently. Add code in the custom UI for onboarding via social login and passwordless options by using the `setLogin` function. #### Social Login example/connectors/arcanaWallet.ts ``` // custom ui onboarding - google import { ArcanaConnector } from "@arcana/auth-web3-react" import { AuthProvider } from "@arcana/auth" import { initializeConnector } from "@web3-react/core" const auth = new AuthProvider(`${arcana_client_id}`) // Singleton export const [authConnect, hooks] = initializeConnector( (actions) => new ArcanaConnector(auth, { actions, login: { provider: 'google', } // either add here or in setLogin function }) ) // Custom UI Alternative // Use setLogin function after creating the connector. /* export const [authConnect, hooks] = initializeConnector( (actions) => new ArcanaConnector(auth, { actions, }) ) authConnect.setLogin({ provider: 'google' }) */ ... ``` #### Passwordless Login example/connectors/arcanaWallet.ts ``` //custom ui onboarding - passwordless import { ArcanaConnector } from "@arcana/auth-web3-react" import { AuthProvider } from "@arcana/auth" import { initializeConnector } from "@web3-react/core" const auth = new AuthProvider(`${arcana_client_id}`) // Singleton export const [authConnect, hooks] = initializeConnector( (actions) => new ArcanaConnector(auth, { actions, login: { provider: 'passwordless', email: 'abc@example.com' } // either add here or in setLogin function }) ) // Custom UI Alternative // Use setLogin function after creating the connector. /* export const [authConnect, hooks] = initializeConnector( (actions) => new ArcanaConnector(auth, { actions, }) ) authConnect.setLogin({ provider: 'passwordless', email: 'abc@example.com' }) */ ... ``` Single Provider Optimization When using a single social login provider, specify it when creating ArcanaConnector to optimize onboarding. There's no need to use setLogin later in the custom login UI code. For multiple social login providers, create ArcanaConnector without specifying a provider. Use the setLogin function later based on the user's choice. ### 2. Use `ArcanaConnector` In the Web3-React app, use the `ArcanaConnector` created earlier and set up the required hooks: ``` import { useEffect, useState } from "react"; import { MAINNET_CHAINS } from "../../chains"; import { hooks, arcanaConnect } from "../../connectors/arcanaWallet"; import { Card } from "../Card"; const CHAIN_IDS = Object.keys(MAINNET_CHAINS).map(Number); const { useChainId, useAccounts, useIsActivating, useIsActive, useProvider, useENSNames, } = hooks; export default function ArcanaConnectCard() { const chainId = useChainId(); const accounts = useAccounts(); const isActivating = useIsActivating(); const isActive = useIsActive(); const provider = useProvider(); const ENSNames = useENSNames(provider); const [error, setError] = useState(undefined); // attempt to connect eagerly on mount useEffect(() => { arcanaConnect.connectEagerly().catch((error) => { console.debug("Failed to connect eagerly to arcanaConnect", error); }); }, []); return ( ); } ``` Now, you are all set to onboard users in the Web3-React app using the custom login UI and enable Arcana wallet for the authenticated users. pages/index.tsx ``` import ArcanaConnectCard from "../components/connectorCards/ArcanaConnectCard"; import CoinbaseWalletCard from "../components/connectorCards/CoinbaseWalletCard"; import GnosisSafeCard from "../components/connectorCards/GnosisSafeCard"; import MetaMaskCard from "../components/connectorCards/MetaMaskCard"; import NetworkCard from "../components/connectorCards/NetworkCard"; import WalletConnectCard from "../components/connectorCards/WalletConnectCard"; import WalletConnectV2Card from "../components/connectorCards/WalletConnectV2Card"; import ProviderExample from "../components/ProviderExample"; export default function Home() { return ( <>
); } ``` Web3-React App integrated with the Arcana Auth ## What's Next? Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../../web3-ops/evm/) in the authenticated user's context. ## See also **'Web3-React'** integration example: See `sample-auth-web3-react` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../../faq/faq-gen/) - [Troubleshooting Guide](../../../../troubleshooting/) - [Arcana Auth SDK Errors](../../../auth-error-msg/) - [Arcana Auth SDK Usage Guide](../../../auth-usage-guide/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) [Try Demo App](https://demo.arcana.network) # Plug-and-Play Login UI Use the built-in, [plug-and-play login UI modal](../../../../concepts/plug-and-play-auth/) to quickly onboard users in a 'Web3-React' app integrated with the Arcana Auth Wagmi SDK. Custom Login UI You can onboard users through a [custom login UI](../../../../concepts/custom-login-ui/) instead of the [built-in plug-and-play](../../../../concepts/plug-and-play-auth/) one. See [how to use custom login UI](../web3-react-custom-ui/) and onboard users in a 'Web3-React' app. ## Prerequisites - [Register](../../../../setup/config-auth/register-app/) the Wagmi app and configure SDK usage [settings for social login](../../../../setup/) providers, [manage app chains](../../../../setup/config-wallet-chains/) and [wallet user experience](../../../../setup/config-wallet/). - Install the [required SDK packages](../../../sdk-installation/) for 'Web3-React'. - [Integrate](../../../integrate/wagmi/) 'Web3-React' app and create `AuthProvider`, `ArcanaConnector`. ## Steps ### 1. Create `AuthProvider` and `ArcanaConnector` ``` import { initializeConnector } from "@web3-react/core"; import { ArcanaConnector } from "@arcana/auth-web3-react"; import { AuthProvider } from "@arcana/auth"; import { URLS } from "../chains"; const auth = new AuthProvider( "xar_test_b2ddexxxxxxxxxxxxxxxxxxxx8b1fa3f" //App client ID via Dashboard ); export const [arcanaConnect, hooks] = initializeConnector( (actions) => new ArcanaConnector(auth, { actions, }) ); ... ``` Compact Mode While creating the `AuthProvider`, you can choose the [compact mode (optional)](../../../../concepts/plug-and-play-auth/#compact-modal) for the plug-and-play login UI. ### 2. Use `ArcanaConnector` In the Web3-React app, use the `ArcanaConnector` and React hooks to connect `ArcanaConnector` with the Web3-React ecosystem via `ArcanaConnectCard`. ``` import { useEffect, useState } from "react"; import { MAINNET_CHAINS } from "../../chains"; import { hooks, arcanaConnect } from "../../connectors/arcanaWallet"; import { Card } from "../Card"; const CHAIN_IDS = Object.keys(MAINNET_CHAINS).map(Number); const { useChainId, useAccounts, useIsActivating, useIsActive, useProvider, useENSNames, } = hooks; export default function ArcanaConnectCard() { const chainId = useChainId(); const accounts = useAccounts(); const isActivating = useIsActivating(); const isActive = useIsActive(); const provider = useProvider(); const ENSNames = useENSNames(provider); const [error, setError] = useState(undefined); // attempt to connect eagerly on mount useEffect(() => { arcanaConnect.connectEagerly().catch((error) => { console.debug("Failed to connect eagerly to arcanaConnect", error); }); }, []); return ( ); } ``` Now, you are all set to onboard users in the Web3-React app using the plug-and-play login UI and enable Arcana wallet for the authenticated users. pages/index.tsx ``` import ArcanaConnectCard from "../components/connectorCards/ArcanaConnectCard"; import CoinbaseWalletCard from "../components/connectorCards/CoinbaseWalletCard"; import GnosisSafeCard from "../components/connectorCards/GnosisSafeCard"; import MetaMaskCard from "../components/connectorCards/MetaMaskCard"; import NetworkCard from "../components/connectorCards/NetworkCard"; import WalletConnectCard from "../components/connectorCards/WalletConnectCard"; import WalletConnectV2Card from "../components/connectorCards/WalletConnectV2Card"; import ProviderExample from "../components/ProviderExample"; export default function Home() { return ( <>
); } ``` Web3-React App integrated with the Arcana Auth ## What's Next? Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../../web3-ops/evm/) in the authenticated user's context. ## See also **'Web3-React'** integration example: See `sample-auth-web3-react` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) - [FAQ](../../../../faq/faq-gen/) - [Troubleshooting Guide](../../../../troubleshooting/) - [Arcana Auth SDK Errors](../../../auth-error-msg/) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) [Try Demo App](https://demo.arcana.network) # EVM Wallet Ops The Arcana wallet supports [standard Ethereum JSON-RPC specification API](https://ethereum.org/en/developers/docs/apis/json-rpc/) via the `AuthProvider`. Non-EVM Chains Note that the JSON/RPC functions and Web3 wallet operations supported by the `AuthProvider` may vary across EVM chains and other chains such as [Solana](../solana/), [MultiversX](../mvx/), [Near](../near/), etc. ## Prerequisites - [Register](../../../setup/config-auth/register-app/) the Near app and configure SDK usage [settings for social login](../../../setup/) providers, [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). - Install the [required SDK packages](../../sdk-installation/), integrate the SDK with the app and create `AuthProvider`. ## Handle Events ``` const auth = new AuthProvider( "xar_test_445007f942xxxxxxxxxxxxxxxxxx484cAfd2", // App client ID ) ``` ``` try { await auth.init() } catch (e) { // Handle exception case } ``` ``` // Assuming Auth SDK is integrated and initialized try { provider = auth.provider const connected = await auth.isLoggedIn() console.log({ connected }) setHooks() } catch (e) { // Handle exception case } // setHooks: Manage chain or account switch in Arcana wallet function setHooks() { provider.on('connect', async (params) => { console.log({ type: 'connect', params: params }) const isLoggedIn = await auth.isLoggedIn() console.log({ isLoggedIn }) }) provider.on('accountsChanged', (params) => { //Handle console.log({ type: 'accountsChanged', params: params }) }) provider.on('chainChanged', async (params) => { console.log({ type: 'chainChanged', params: params }) }) } ``` ## Supported Web3 Operations - `eth_getBalance` - `eth_accounts` - `eth_signTransaction` - `eth_sendTransaction` - `wallet_addEthereumChain` - `wallet_switchEthereumChain` - `wallet_watchAsset` - `_arcana_getAccountType` - `_arcana_switchAccountType` ### Get Accounts ``` // get from eth_accounts let from = '' async function getAccounts() { console.log('Requesting accounts') try { const accounts = await provider.request({ method: 'eth_accounts' }) console.log({ accounts }) from = accounts[0] // Use this account address to get wallet balance } catch (e) { console.log({ e }) } } ``` ### Get Balance ``` let balance = '' async function getBalance() { console.log('Requesting Balance') try { provider.request({ method: 'eth_getBalance' }).then((balance) => { // convert a currency unit from wei to ether const balanceInEth = ethers.utils.formatEther(balance) console.log(`balance: ${balanceInEth} ETH`) }) } catch (e) { console.log({ e }) } } ``` ### Add Network Only EVM Chains Apps can programmatically add only the EVM-compatible chains to the preconfigured chain list if not already present. The `wallet_addEthereumChain` method is specified by [EIP-3085](https://eips.ethereum.org/EIPS/eip-3085). ``` try { await provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: '0xABCDEF', chainName: 'My Custom Chain', rpcUrls: ['...'] }] }) } catch(error) { ... } // Parameters // wallet_addEthereumChain accepts a single object parameter, // specified by the AddEthereumChainParameter TypeScript interface interface AddEthereumChainParameter { chainId: string; // A 0x-prefixed hexadecimal string chainName: string; nativeCurrency: { name: string; symbol: string; // 2-6 characters long decimals: 18; }; rpcUrls: string[]; blockExplorerUrls?: string[]; } ``` ### Switch Network This method is specified by [EIP-3326](https://eips.ethereum.org/EIPS/eip-3326). Chain Switching Apps can programmatically switch to another chain as long as it is of the same chain type. If an app is configured to use EVM chains, you cannot switch to a non-EVM chain and vice-versa. ``` try { await provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0xf00' }], }); } catch(error) { ... } interface SwitchEthereumChainParameter { chainId: string; // A 0x-prefixed hexadecimal string } ``` Network Switch Error If the error code (error.code) is 4902, then the requested chain has not been added, and you have to request to add it via `wallet_addEthereumChain`. ### Get Account Type ``` const accountType = await auth.provider.request({ method: "_arcana_getAccountType", }); console.log(accountType); ``` ### Watch Assets ``` async function watchAsset() { setRequest('eth_sendTransaction') const hash = await provider.request({ method: 'wallet_watchAsset', params: { type: 'ERC20', options: { address: '0xB983E01458529665007fF7E0CDdeCDB74B967Eb6', symbol: 'FOO', decimals: 18, image: 'https://foo.io/token-image.svg', }, }, }) console.log({ hash }) } ``` ### Sign Transaction ``` async function signTransaction() { const { sig } = await auth. provider.request({ method: 'eth_signTransaction', params: [ { from: "0xEB014f8c8B418Db6b45774c326A0E64C78914dC0", gasPrice: "20000000000", gas: "21000", to: '0x3535353535353535353535353535353535353535', value: "1000000000000000000", data: "some data" }, ], }) console.log({ sig }) } ``` ### Send Transactions ``` const auth = new AuthProvider( "xar_test_445007f942xxxxxxxxxxxxxxxxxx484cAfd2", // App client ID ) ``` ``` try { await auth.init() } catch (e) { // Handle exception case } ``` ``` async function sendTransaction() { setRequest('eth_sendTransaction') const hash = await auth.provider.request({ method: 'eth_sendTransaction', params: [{ from, gasPrice: 0, to: '0xE28F01Cf69f27Ee17e552bFDFB7ff301ca07e780', value: '0x0de0b6b3a7640000', },], }) console.log({ hash }) } ``` Send Transaction Approve/Reject Send Transaction ### Show Wallet Apps that use `alwaysVisible=false` when initializing the `AuthProvider` can use `showWallet` to display it in the app's context when required. ``` import { AuthProvider } from '@arcana/auth' try { const auth = new AuthProvider( "xar_test_445007f942xxxxxxxxxxxxxxxxxx484cAfd2", // App client ID { position: 'left', // default: right theme: 'light', // default: dark alwaysVisible: false, } ) await auth.init() await auth.showWallet() } catch (e) { // Handle exception case } ``` Arcana Wallet # MultiversX Wallet Ops Use `AuthProvider`, the standard EIP-1193 Ethereum provider offered by the Arcana Auth SDK, for issuing Web3 wallet operations via the Arcana wallet. ## Prerequisites - [Register](../../../setup/config-dApp-with-db-for-mvx/) the app and configure SDK usage [settings for social login](../../../setup/) providers, [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). - Install the [required SDK packages](../../sdk-installation/) as per the app type, [integrate the SDK](../../integrate/mvx/) and create `AuthProvider`. ## Supported Web3 Operations - `mvx_signMessage` - `mvx_signTransaction` - `mvx_signTransactions` - `getAccounts` - `getPublicKey` Other MultiversX wallet connect JSON RPC methods listed [here](https://docs.multiversx.com/integrators/walletconnect-json-rpc-methods/) are not supported at the moment. ### `getAccounts` ``` // Integrate App with the Auth SDK const { AuthProvider } = window.arcana.auth let provider let from = '' const auth = new AuthProvider('xar_dev_34-arcana-registered-client-id-xxxxx') provider = auth.provider ... //Initialize AuthProvider await auth.init() // Get Accounts try { const accounts = await provider.request({ method: 'getAccounts' }) from = accounts[0] } catch (e) { console.log({ e }) } // Returns an array of public keys // ["pub-key-1"] ``` ### `getPublicKey` ``` // Integrate App with the Auth SDK const { AuthProvider } = window.arcana.auth let provider let from = '' const auth = new AuthProvider('xar_dev_34-arcana-registered-client-id-xxxxx') provider = auth.provider ... //Initialize AuthProvider await auth.init() //Get Public Key await provider.request({ method: "getPublicKey", params: [from], }); // Returns public key // {pk: "some-pub-key"} ``` ### `SignMessage` ``` // Integrate App with the Auth SDK const { AuthProvider } = window.arcana.auth let provider let from = '' const auth = new AuthProvider('xar_dev_34-arcana-registered-client-id-xxxxx') provider = auth.provider ... //Initialize AuthProvider await auth.init() // Get Accounts try { const accounts = await provider.request({ method: 'getAccounts' }) from = accounts[0] } catch (e) { console.log({ e }) } // Onboard users via plug-n-play login or custom login UI // auth.connect() or auth.loginWithSocial try { const provider = await auth.connect() console.log({ provider }) } catch (error) { console.log({ error }) } ... // For authenticated users, add code for signing message const personalSign = await provider.request({ method: 'mvx_signMessage', params: { message: 'SignMessage to test MultiversX signmessage', address: from, }, }) // Returns signature object // {signature: "some-sig"} ``` ### `SignTransaction` ``` // Integrate App with the Auth SDK const { AuthProvider } = window.arcana.auth let provider let from = '' const auth = new AuthProvider('xar_dev_34-arcana-registered-client-id-xxxxx') provider = auth.provider ... //Initialize AuthProvider await auth.init() // Get Accounts try { const accounts = await provider.request({ method: 'getAccounts' }) from = accounts[0] } catch (e) { console.log({ e }) } // Onboard users via plug-n-play login or custom login UI // auth.connect() or auth.loginWithSocial try { const provider = await auth.connect() console.log({ provider }) } catch (error) { console.log({ error }) } ... // For authenticated users, add code for signing transaction const params = { transaction: { gasLimit: 100000, sender: from, receiver: 'erdXXXXXXXX-some-address-YYYYYYYYYY', value: '0.01', chainID: 'T', data: 'helloWorld-from MultiversX', version: 1, }, } const data = await provider.request({ method: 'mvx_signTransaction', params, }) // Returns signature object // {signature: "some-sig", options: 0, version: 1} ``` ### `SignTransactions` ``` // Integrate App with the Auth SDK const { AuthProvider } = window.arcana.auth let provider let from = '' const auth = new AuthProvider('xar_dev_34-arcana-registered-client-id-xxxxx') provider = auth.provider ... //Initialize AuthProvider await auth.init() // Get Accounts try { const accounts = await provider.request({ method: 'getAccounts' }) from = accounts[0] } catch (e) { console.log({ e }) } // Onboard users via plug-n-play login or custom login UI // auth.connect() or auth.loginWithSocial try { const provider = await auth.connect() console.log({ provider }) } catch (error) { console.log({ error }) } ... // For authenticated users, add code for signing transaction const transaction = { gasLimit: 100000, sender: from, receiver: "erdXXXXXXXX-some-address-YYYYYYYYYY", value: "0.001", chainID: "T", data: "helloWorld-from MultiversX", version: 1, }; const params = { // You can use multiple transactions, this sample just // repeats the same one. transactions: [transaction, transaction, transaction], }; const data = await provider.request({ method: 'mvx_signTransactions', params, }) //Returns Signature Object - see format below // // { // signatures: [ // {signature: "some-sig-1", options: 0, version: 1}, // {signature: "some-sig-2", options: 0, version: 1}, // {signature: "some-sig-3", options: 0, version: 1} // ] // } ``` # Near Wallet Ops The Arcana wallet supports [standard Ethereum JSON-RPC specification API](https://ethereum.org/en/developers/docs/apis/json-rpc/) via the `AuthProvider`. ## Prerequisites - [Register](../../../setup/config-dApp-with-db-for-near/) the Near app and configure SDK usage [settings for social login](../../../setup/) providers, [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). - Install the [required SDK packages](../../sdk-installation/) as per the app type, [integrate the SDK](../../integrate/near/) and create `AuthProvider`. ## Supported Web3 Operations - `getAccounts` - `near_signMessage` - `near_signAndSendTransaction` ### `getAccounts` ``` // Integrate App with the Auth SDK const { AuthProvider } = window.arcana.auth let provider let from = '' const auth = new AuthProvider('xar_dev_34-arcana-registered-client-id-xxxxx') provider = auth.provider //Initialize AuthProvider await auth.init() ... // User login add code via plug and play `connect` or custom login UI // auth.connect() or auth.loginWithSocial // Get User Account address post login try { const accounts = await provider.request({ method: 'getAccounts' }) from = accounts[0] } catch (e) { console.log({ e }) } ``` ### `SignMessage` ``` // Integrate App with the Auth SDK const { AuthProvider } = window.arcana.auth let provider let from = '' const auth = new AuthProvider('xar_dev_34-arcana-registered-client-id-xxxxx') provider = auth.provider //Initialize AuthProvider await auth.init() // Onboard users via plug-n-play login or custom login UI // auth.connect() or auth.loginWithSocial try { const provider = await auth.connect() console.log({ provider }) } catch (error) { console.log({ error }) } // Get User Account address try { const accounts = await provider.request({ method: 'getAccounts' }) from = accounts[0] } catch (e) { console.log({ e }) } // For authenticated users, add code for signing message import base58 from "bs58"; const message = base58.encode(Buffer.from("This is a test message for trying 'SignMessage'.")); const signedMessage = await auth.provider.request({ method: "near_signMessage", params: { message }, }); console.log(signedMessage); ``` ### `SignAndSendTransaction` ``` // Integrate App with the Auth SDK const { AuthProvider } = window.arcana.auth let provider let from = '' const auth = new AuthProvider('xar_dev_34-arcana-registered-client-id-xxxxx') provider = auth.provider ... //Initialize AuthProvider await auth.init() // Onboard users via plug-n-play login or custom login UI // auth.connect() or auth.loginWithSocial try { const provider = await auth.connect() console.log({ provider }) } catch (error) { console.log({ error }) } ... // Get Accounts try { const accounts = await provider.request({ method: 'getAccounts' }) from = accounts[0] } catch (e) { console.log({ e }) } // Get Receiver Account address // Read from app user interface // receiver = Buffer.to('input address') ... // For authenticated users, add code for signing transaction const transaction = { receiverId: receiver, actions: [ { transfer: { deposit: BigInt(1000), }, }, { transfer: { deposit: BigInt(1000), }, }, { transfer: { deposit: BigInt(1000), }, }, ], } const signedTransaction = await auth.provider.request({ method: "near_signAndSendTransaction", params: { transaction }, }); console.log(signedTransaction); ``` # Solana Wallet Ops Solana chain is a bit different from typical EVM chains in how it [supports Solana JSON-RPC calls](https://docs.solana.com/api/http) and Web3 wallet operations. ## Prerequisites - [Register](../../../setup/config-dApp-with-db-for-Solana/) the Solana app and configure SDK usage [settings for social login](../../../setup/) providers, [manage app chains](../../../setup/config-wallet-chains/) and [wallet user experience](../../../setup/config-wallet/). - Install the [required SDK packages](../../sdk-installation/) as per the app type, [integrate the SDK](../../integrate/solana/) and create `AuthProvider`. Make sure you also initialize the `Solana Provider`. ``` import { AuthProvider } from '@arcana/auth' ``` ``` const auth = new AuthProvider( "xar_test_445007f942xxxxxxxxxxxxxxxxxx484cAfd2", // App client ID { alwaysVisible: false, // default: true, wallet always visible connectOptions: { compact: true // default: false, regular plug-and-play login UI }, position: 'left', // default: right setWindowProvider: true, // default: false, window.ethereum not set theme: 'light', // default: dark }) ``` ``` try { await auth.init() } catch (e) { // Handle exception case } ``` Solana apps can use the `auth.provider` to make standard JSON RPC calls in the context of an authenticated user. ``` const provider = auth.provider; ``` Use the Solana provider for issuing Solana Web3 wallet operations in the context of an authenticated user. ``` const solanaP = auth.solana; ``` ## Supported Web3 Wallet Operations ### Get Public Key ``` import SolanaWeb3 from "@solana/web3.js"; const provider = auth.provider; const accounts = await auth.provider.request({ method: "getAccounts", params: [], }); const publicKey = new SolanaWeb3.PublicKey(accounts[0]) console.log(publicKey); ``` The `publicKey` is returned as a string: ["your-public-key-in-string-format"]. ## Supported JSON/RPC Functions - `signMessage` - `signTransaction` - `signAllTransactions` - `signAndSendTransaction` ### `SignMessage` ``` const message = `Sign below to authenticate with CryptoCorgis to avoid digital dognappers`; const encodedMessage = new TextEncoder().encode(message); // To get a proper signature, the second parameter in signMessage call // can be either "hex" or "utf8", depending on what kind of message we are signing. // For plaintext, use "utf8"; // For hex message, use "hex" try { const signature = await solanaP.signMessage(encodedMessage, "hex"); window.solanaSig = signature; console.log(signature); } catch (e) { console.error(e); } ``` #### Signature Format ``` { signature: Uint8Array // Encode it by using `bs58.encode(signature)` // to get the string format. See npm library: bs58 publicKey: BN // Use `new SolanaWeb3.PublicKey(publicKey)` // to get the 'BN' string format. See npm library: @solana/web3.js } ``` ### `SignTransaction` ``` try { const pk = new SolanaWeb3.PublicKey(auth.solana.publicKey) const connection = new SolanaWeb3.Connection( SolanaWeb3.clusterApiUrl("testnet") // can be "devnet", "testnet" or "mainnet-beta" ); const minRent = await connection.getMinimumBalanceForRentExemption(0); const blockhash = await connection.getLatestBlockhash().then((res) => res.blockhash); const payer = auth.solana const instructions = [ SolanaWeb3.SystemProgram.transfer({ fromPubkey: pk, toPubkey: pk, lamports: minRent // lamports is the minimum unit of solana, like wei is for Ethereum. 1 SOL = 10^9 Lamports }) ]; // Compiles the message to V0 format const messageV0 = new SolanaWeb3.TransactionMessage({ payerKey: pk, recentBlockhash: blockhash, instructions }).compileToV0Message(); const transaction = new SolanaWeb3.VersionedTransaction(messageV0); // sign your transaction with the required `Signers` const signature = await payer.signTransaction(transaction); } catch (e) { console.error(e); } ``` #### Signature Format ``` { signatures: [Uint8Array], message: { header: { numRequiredSignatures: 1, numReadonlySignedAccounts: 0, numReadonlyUnsignedAccounts: 1 }, staticAccountKeys: [ StaticAccountKey1, // In string format StaticAccountKey2 // In string format ], recentBlockhash: LatestBlockHashSubmittedWhileSigning, // In string format compiledInstructions: [ { programIdIndex: 1, accountKeyIndexes: [ 0, 0 ], data: Uint8Array // Data that was signed ], addressTableLookups: [] // Not sure what is this, will need to check, but we can pass this during signing } } ``` ### `SignAllTransactions` ``` try { const pk = new SolanaWeb3.PublicKey(auth.solana.publicKey); const connection = new SolanaWeb3.Connection( window.solanaWeb3.clusterApiUrl("testnet") ); const minRent = await connection.getMinimumBalanceForRentExemption(0); const blockhash = await connection.getLatestBlockhash().then((res) => res.blockhash); const payer = auth.solana; const instructions = [ SolanaWeb3.SystemProgram.transfer({ fromPubkey: pk, toPubkey: pk, lamports: minRent, }), ]; const messageV0 = new SolanaWeb3.TransactionMessage({ payerKey: pk, recentBlockhash: blockhash, instructions, }).compileToV0Message(); const transaction = new SolanaWeb3.VersionedTransaction(messageV0); // sign your transaction with the required `Signers` const signatures = await payer.signAllTransactions([ transaction, transaction, transaction, ]); // Should/can send multiple different transactions, // right now sending 1 transaction multiple times just as an example } catch (e) { console.error(e); } ``` The signature format here is same as above with a minor difference: ``` [Signature0, Signature1, Signature2, and so on] ``` ### `SignAndSendTransaction` ``` try { const pk = new SolanaWeb3.PublicKey(auth.solana.publicKey); const connection = new SolanaWeb3.Connection( SolanaWeb3.clusterApiUrl("testnet") ); const minRent = await connection.getMinimumBalanceForRentExemption(0); const blockhash = await connection.getLatestBlockhash().then((res) => res.blockhash); const payer = auth.solana; // Arcana Solana API const instructions = [ SolanaWeb3.SystemProgram.transfer({ fromPubkey: pk, toPubkey: pk, lamports: minRent, }), ]; const messageV0 = new SolanaWeb3.TransactionMessage({ payerKey: pk, recentBlockhash: blockhash, instructions, }).compileToV0Message(); const transaction = new SolanaWeb3.VersionedTransaction(messageV0); // sign your transaction with the required `Signers` const txHash = await payer.signAndSendTransaction(transaction); } catch (e) { console.error(e); } ``` #### Response Format ``` { publicKey: BN, signature: Uint8Array // This is the transaction hash itself // we can verify this in solana explorer, // need to convert it to string first using `bs58.encode(signature)` } ``` # Unity Web3 Wallet Operations Use `AuthProvider`, the standard EIP-1193 Ethereum provider offered by the Arcana Auth SDK, to call Web3 wallet operations in Unity apps. ## Supported Web3 Operations Call `Request` to make Web3 Wallet operation requests from within the app context. Provide the 'method' parameter for any supported Web3 wallet operations. Supported Wallet Operations The supported methods in the `Request` function may vary depending on the selected blockchain network, EVM chains, or non-EVM chains, such as Solana or MultiversX. See the [supported JSON/RPC Web3 operations](../evm/) for a list of chain-specific methods supported via the `Request` call of the Arcana Auth Unity SDK. ``` responseTextField.text = ""; if (parameters.text != null) { response = (await arcanaSDK.Request(new RequestParams { Method = method.text, Params = JsonConvert.DeserializeObject(parameters.text) })).ToString(); } else { response = (await arcanaSDK.Request(new RequestParams { Method = method.text, })).ToString(); } ``` # Reference # # Audit Reports [Auth Smart Contracts](https://github.com/arcana-network/audit-reports/blob/main/REP-final-20221228T082421Z.pdf) [ADKG](https://github.com/arcana-network/audit-reports/blob/main/REP-final-20230228T054948Z.pdf) # Audit Reports [Arcana Vault](https://github.com/arcana-network/audit-reports/blob/9b13233ce0fa4915c96c712bb49187864089f3df/Arcana%20Vault%20Final%20Report.pdf) [CA Wallet](https://github.com/arcana-network/audit-reports/blob/9b13233ce0fa4915c96c712bb49187864089f3df/Arcana%20Wallet%20Final%20Audit%20Report.pdf) # ADKG Asynchronous Distributed Key Generation (ADKG) is a cryptographic protocol that allows multiple parties to generate a public-private key pair cooperatively, without needing a trusted third party or synchronization. Each party creates a partial private key and shares it with the others. Together, they use these partial keys to derive the final private key used for securing blockchain transactions in Web3 apps. Asynchronous Distributed Key Generation (ADKG) *[Reference: ADKG Paper](https://eprint.iacr.org/2022/1389.pdf)* ADKG is ideal for geographically dispersed or poorly connected parties where traditional methods are impractical. The distributed trust model in ADKG also makes it more resistant to attacks compared to methods relying on a single central authority. ## ADKG for Web3 Keys Web3 blockchain transactions require user approval through cryptographic keys. The Arcana Auth SDK uses ADKG to securely generate key shares for Web3 users. It allows users to securely access and generate their keys on the client side, handling security and privacy concerns. Users can sign transactions with the non-custodial Arcana wallet. ADKG generates ECDSA keys on the [secp256k1](https://www.secg.org/sec2-v2.pdf) curve, compatible with all EVM chains. Future updates will support other curves, blockchains, and key regeneration. ## Why ADKG? Our ADKG implementation uses the [Practical Asynchronous Distributed Key Generation](https://eprint.iacr.org/2021/1591.pdf) protocol. It improves on the previous DKG by removing the need for a trusted dealer, reducing key exposure, and automating share regeneration. ADKG is resilient to attacks and works well in asynchronous networks. It ensures security by preventing any single node from accessing a user's key. ADKG Assumptions The ADKG protocol works under the assumption that in an asynchronous network of `n ≥ 3t + 1` nodes, where at most `t` nodes could be malicious. The protocol can achieve an expected communication cost of O(`κ`n(^3) ) and terminates in expected O(log n) rounds. Here `κ` is the security parameter. For example, if a collision-resistant hash function is used, in that case, `κ` denotes the size of the hash function's output. ## Implementation Notes ADKG requires a set of at least 4 connected nodes at a minimum for accommodating a maximum of 1 malicious node. At a very high level, the protocol requires each node to **independently generate secrets** and then share a part of that secret with the other nodes. Each node then **shares a proposed set of key shares** with other nodes. Asynchronous Binary Agreement (ABA) **voting** is done by the nodes for each proposed set. Only the accepted and agreed-upon set is used to derive the key shares and then those key shares are combined to **arrive at the final key pair**. None of the nodes have full access to the secret key. How does ADKG work? The ADKG protocol has four phases: 1. Asynchronous Complete Secret Sharing (ACSS) 1. Keyset Proposal Broadcast Phase 1. Asynchronous Binary Agreement (ABA) 1. Key Derivation Phase For more details on each of these ADKG phases, see [here](../../security/adkg/). # Aggregate login Aggregate Login in Arcana Auth SDK links users with the same email across social logins as one user. Different emails create separate developer accounts. For example, logging in with Google and Twitter using the same email counts as one account, while different emails create separate accounts. ``` graph LR A[[User]] -.-> B(Social Login Provider A) -.-> E{Email ID Same?} ==Yes==> F>User ID 1]; E{Email ID Same?} ==No==> G>New unique User ID]; A[[User]] -.-> M(Social Login Provider B) -.-> E{Email ID Same?}; A[[User]] -.-> C(Passwordless Login) -.-> E{Email ID Same?}; ``` Limited Auth Provider Support Aggregate login feature does not work for the following providers: - Cognito - Firebase - Steam - Telegram - Twitter # Decentralized Identifier (DID) [Decentralized identifiers (DIDs)](https://www.w3.org/TR/did-core/) let Web3 app users be identified without a central authority. A DID is a unique, privacy-preserving identifier built with blockchain technology, cryptography, and decentralized networks. It eliminates the need for centralized registries and identity providers, giving users full control. Arcana Auth SDK uses the DID protocol, Ethereum blockchain, and [elliptic curve cryptography](https://en.wikipedia.org/wiki/Elliptic-curve_cryptography) to create verifiable proofs for user authentication and authorization. ## DID Token Structure The DID token is encoded as a Base64 JSON string tuple representing \[proof, claim\]: - **Proof:** A digitally signed string that is used to prove the validity of a given claim. - **Claim:** Data representing the user's access assertion. ### `userDIDToken` The Arcana Auth SDK returns `userDIDToken` once an app user logs in successfully via the configured social login provider by using any of the supported methods of the `AuthProvider`: - Plug-and-play login `connect()` - Custom login UI methods such as `loginWithSocial()`, `loginWithLink()` (deprecated), `loginWithOTPStart`,`loginWithOTPComplete` and `loginWithBearer()` Developers can use `getUser()` method to access the user's DID token via the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) return value. ### Verify DID Token ``` import { ethers } from "ethers"; const userInfo = await auth.getUser(); const didToken = userInfo.userDIDToken; const data = JSON.parse(window.atob(didToken)); const [sig, claims] = data; const parsedClaims = JSON.parse(claims) const addr = ethers.verifyMessage(claims, sig); if (addr == publicKeyToAddress(parsedClaims.iss)) { // Verified } ``` ``` import { verify } from "@noble/ed25519" const userInfo = await auth.getUser(); const didToken = userInfo.userDIDToken; const data = JSON.parse(window.atob(didToken)); const [sig, claims] = data; const parsedClaims = JSON.parse(claims); const verified = verify(sig, toHex(claims), b58ToHex(parsedClaims.iss)); ``` # Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app. This token is generated upon successful authentication via any of the supported methods of the `AuthProvider`: - Plug-and-play login `connect()` - Custom login UI methods such as `loginWithSocial()`, `loginWithLink()` (deprecated), `loginWithOTPStart`,`loginWithOTPComplete` and `loginWithBearer()` After the user selects a social login provider and authenticates with the provider, the Arcana Auth SDK receives the JWT token from the selected provider. The Arcana Auth SDK verifies the user via this token first and then creates and returns a new Arcana JWT token to the app. The app must verify the token returned by the Arcana Auth SDK. ## Verify Arcana JWT Token The JWT token returned by the Arcana Auth SDK expires after 3 minutes. It is recommended that the app developer must first [verify the token returned by Arcana](../jwt-token-validation/) before generating an app-specific JWT token for further use within the app context. Developers can use `getUser()` method to access the JWT token returned by the Arcana Auth SDK via the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) return value. ``` /* Make sure 1. AuthProvider is created and initialized via .init() call 2. User is onboarded via plug and play login UI .connect() call or with custom login UI loginWithSocial, loginWithLink (deprecated), `loginWithOTPStart` and `loginWithOTPComplete`, loginWithBearer calls */ try { const userInfo = await auth.getUser(); const jwtToken = userInfo.loginToken; console.log("Arcana JWT Token: ", jwtToken); } catch (e) { console.log(e); } ``` ## App-specific JWT Token After verification of the JWT token returned by the Arcana Auth SDK, developers must create another app-specific JWT token, if required, and use the subsequent token in the app. For example, if the app developer needs to implement *Role Based Access Control (RBAC)* and authorize the authenticated user for some specific actions, they can first [verify the token returned by Arcana](../jwt-token-validation/). Upon verification, they can issue a new app-specific JWT that enables RBAC and authorization. Alternately, for RBAC, developers can use Sign-In with Ethereum ([SIWE](https://www.npmjs.com/package/siwe)) by signing a standard message format parameterized by scope, session details, and security mechanisms (for example, a nonce). SIWE allows users to log in to applications using their Ethereum wallet and ENS (Ethereum Name Service) profile. # Arcana Auth-Core SDK The Arcana Auth-Core SDK is a client-side tool for developers to assign Web3 keys to authenticated users for signing blockchain transactions. Use this SDK instead of the Arcana Auth SDK for key assignment or when building a completely whitelisted solution. When initializing Arcana Auth-Core SDK, the developer sets the redirect URL. The SDK performs OAuth2 login with the chosen provider and returns the login token from the provider. At the specified redirect URL, the developer uses this token to fetch the user's private key. Limited Feature SDK The Arcana Auth-Core SDK has limited capabilities as compared to the Arcana Auth-Core SDK: - No built-in plug-and-play login UI feature - No built-in Arcana wallet UI - No support for Global keys, only app-specific keys (default) are allowed. - No support for enhanced wallet security via MFA. # Arcana Auth SDK Arcana Auth SDK streamlines user onboarding in Web3 apps with an embedded, non-custodial wallet for secure blockchain transactions. Developers start by [registering the app](../../setup/config-auth/register-app/) and [configuring auth settings](../../setup/config-auth/) through the [Arcana Developer Dashboard](../dashboard/). Each registered app gets a unique **Client ID** essential for integrating with the Arcana Auth SDK. ## Download Multiple flavors of the Arcana Auth SDK are available for different types of Web3 apps such as web, mobile and gaming. See [Auth SDK installation section](../../auth/sdk-installation/) for details. ## Key Features **User Authentication** - Customize onboarding with Web2 [social login](../social-login/) and passwordless access. - Choose between built-in, [plug-and-play](../plug-and-play-auth/) or [custom login UI](../custom-login-ui/). - Secure, self-custodial keys without key management complexities. **Web3 Wallet Operations** - Developers can customize the blockchain transaction signing experience for users with [Arcana wallet visibility](../anwallet/walletvisibility/) settings. - Authenticated users can securely sign transactions for [supported Web3 apps and frameworks](../../web3-stack/apps/) - Supports Web3 wallet operations and standard Ethereum JSON-RPC calls, including: - Configure and switch networks and accounts. - Sign blockchain transactions. - Send and receive tokens and NFTs. - Manage NFTs and preview NFT details using the wallet. - Customize transaction signing with Arcana wallet visibility settings. - Supports [EVM and non-EVM blockchain networks](../../web3-stack/chains/). - Supports Web3 wallet operations and Ethereum JSON-RPC calls, including: - Network and account management. - Signing transactions. - Sending and receiving tokens and NFTs. - Managing and previewing NFTs. # Usage & Billing This guide explains the payment model for using [social login](../social-login/) feature offered by the Arcana Auth SDK in Web3 apps. ## Pricing Testnet usage is free. ### Mainnet Each developer account enjoys a promotional free usage tier. Beyond this free tier, usage costs apply to all apps registered with Arcana under a developer account and are invoiced together. For more details on the current billing rates and free tier limits contact [Arcana support](../../support/). ## Billing Metrics Arcana Auth SDK monitors app usage with the following metrics: - **Aggregate App Usage**: This metric tracks the 'Monthly Active Users (MAU)' across all apps registered with Arcana per developer account on the Mainnet. Total MAU data includes free and paid usage. Monthly Active Users (MAU) - **Per App Usage**: This metric monitors the 'Daily Active Users (DAU)' and 'Monthly Active Users (MAU)' for individual apps on the Testnet. Data is also available for Mainnet usage per app. Monthly Active Users (MAU) Testnet Usage is Free Billing applies only to Arcana Mainnet usage. ## Billing Setup Using the Arcana Developer Dashboard, developers can configure their Arcana account by providing essential information. Billing requires the following details: - Organization - Billing Address Details - Payment Method Adding Payment Method It is a mandatory requirement to enter and save a valid address in your developer account prior to providing payment method details through the Arcana Developer Dashboard. Once generated, developers can access their billing history and view the current outstanding invoice. Testnet and Free Tier (Mainnet) Usage Payment setup isn't needed for Testnet usage or for using the Mainnet's free tier. Web3 apps can integrate with Arcana Auth SDK for Testnet without it. However, after exhausting the free tier, setting up payment is essential for uninterrupted user onboarding on Arcana Mainnet. ## Billing Cycle Arcana Mainnet usage beyond the free tier is billed **monthly**. Invoices are generated on the last day of each month, summarizing the collective app usage and charges for all apps under a developer account. Access invoice and usage specifics through Arcana Developer Dashboard by clicking on the user icon on the top right and selecting **Invoices**. View Invoices ## Outstanding Dues Outstanding dues must be paid in full; partial payments are not accepted. Invoices factor in all promotional and free-tier MAU usage across registered apps for a developer account. Payment is due upon monthly invoice generation, with a notification sent to the developer. Payment is automatically deducted via the configured method. If payment fails, there's a 21-day grace period, with retry attempts every 7 days. During this period, registered apps function normally. After the grace period, if payment remains unsuccessful, the developer account is suspended, barring user access to registered apps. Inactivity and non-payment for 3 months **may** result in app deletion and account termination. ## Billing Notifications For billing notifications, refer to the bell icon on the top right of the Arcana Developer Dashboard screen. Billing Notifications The following billing notifications are displayed: | Event | Notification | Notes | | --- | --- | --- | | Billing | Add card details for processing the payment. | The first time a developer logins, this message is displayed in the notifications section. | | Billing | Invoice for the current month has been generated. | Once the free-tier is over, at the end of every billing cycle, the dues are computed and an invoice is created. Developer is notified of the same. | | Billing | Payment successfully processed for this month. | Once the free-tier is over, monthly invoices are raised and payment automatically deducted from the specified payment method. | | Billing | Payment has been declined. | This notification will be displayed if the specified payment method fails when the invoice dues are processed, or if there are any payment errors due to insufficient funds. | # Configuration Profiles A configuration profile stores the Arcana Auth SDK usage settings for social login and wallet experience. Each registered app has two profiles: - Testnet - Mainnet Use Arcana Auth SDK to view and update these profiles. By default, new apps use a Testnet profile. To create a Mainnet profile, you can either: - Copy the Testnet profile - Create a new Mainnet profile Each app gets one unique Client ID per profile, one for Testnet and one for Mainnet. When integrating a Web3 app with Arcana Auth SDK, specify the Testnet Client ID or Mainnet Client ID based on deployment. Note that wallet addresses will change when switching between Testnet and Mainnet profiles. # Custom Login UI Apps using the Arcana Auth SDK can onboard users via one of the two options: - Plug-and-play Login UI: A built-in, ready-to-use login UI for [plug-and-play authentication](../plug-and-play-auth/). - Custom Login UI: Build a custom login UI from scratch. This decision is made at the time of SDK integration. This choice is not governed by any settings made via the Arcana Developer Dashboard. After installing and integrating with the Arcana Auth SDK, create the `AuthProvider`, use `init` function to initialize the provider, create the necessary user interface hooks and call the `loginWithSocial` function with the desired social login provider to onboard users. For email-based onboarding, utilize the `loginWithOTP`(deprecated), `loginWithOTPStart` and `loginWithOTPComplete` functions, which sends users a verification link on the specified user email. Here is an example of [how to onboard users via 'Google' as the social login provider and a custom login UI](../../auth/onboard/vanilla/custom-ui/build-social/google-oauth/). See [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) for more details. # Custom Wallet UI Developers have two options to enable the embedded, non-custodial Arcana Web3 wallet functionality within the app's context: - You can use the built-in, ready-to-use Arcana wallet UI *(default)* - Alternatively, you have the choice to create a custom wallet user interface You must decide to implement the custom wallet UI **before** installing and integrating with the Arcana Auth SDK. At the time of registering the app through Arcana Developer Dashboard, enter the app name, default chain and then select *Wallet UI Mode* value as `Custom UI` instead of the `Arcana UI`. In this case, the onus of creating user interface for signing blockchain transaction, displaying the user's account information, Web3 assets such as tokens, NFTs, etc., lies with the developer. One time setting Custom Wallet UI option is selected at the time of registering the app and cannot be reverted later. See [how to enable custom wallet UI](../../auth/custom-wallet-ui/) during app registration before integrating with the Arcana Auth SDK. # Arcana Developer Dashboard The Arcana Developer Dashboard can be accessed at: It lets Web3 developers register apps with Arcana and set SDK preferences. The dashboard manages app settings and usage through the Gateway node. It provides insights on Arcana protocol usage, including monthly and daily active users (MAU) per app. [Learn more...](../../setup/config-dApp-with-db/) Developer Dashboard Register, Configure then Integrate! Before integrating any application with the Arcana Auth SDK, it must be [registered](../../setup/config-auth/register-app/) and [configured for user onboarding](../../setup/config-auth/) through the Arcana Developer Dashboard. # Gateway Node The gateway node is a vital part of the Arcana protocol. The Arcana Developer Dashboard interacts with the gateway for registering the apps and managing app configuration data, app usage data, and developer account billing, payment details. # Verify Arcana JWT Token Apps integrating with the Arcana Auth SDK receive a unique JWT token. This token is generated upon successful user authentication via these `AuthProvider` methods: - Plug-and-play login UI: `connect()` - Custom login UI: `loginWithSocial()`, `loginWithLink()`(deprecated), `loginWithOTPStart`, `loginWithOTPComplete`, and `loginWithBearer()` The Arcana JWT token is generated with an asymmetric key. What this means is that after a successful user login, the app developers must use the public key in order to verify the received token. Use the appropriate public key listed below to verify the token depending upon whether the app is deployed on the Arcana Testnet or Mainnet. ## Token Verification: Dev ``` -----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAES2oy0bmXvYh1dIVU017/WW17Wdet Clx9+8HxPvGHegrBaoZadbeKhfBSfQbxBcdzpDe+3EqUVwvwH3hMIoqa3A== -----END PUBLIC KEY----- ``` ## Token Verification: Testnet ``` -----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAETjlG1BIL2x0LwJH5iIxXXfJaokUb 5EyhK8/TCwlQbVPFy6N40kD4Bnbs4JRJOEssp5/YSgUnrR8JrB0QgC+NpA== -----END PUBLIC KEY----- ``` ## Token Verification: Mainnet ``` -----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE0UWoYfR6ii+6PTfWPDtY8jKLJtL1 8+Nu+qDkaMjFXVlWg6oVpHdBMBvsmia2aQsrjKrYHdmMz5bntsEAu+7QdA== -----END PUBLIC KEY----- ``` # Keyspace Types Arcana Auth SDK supports the following key types: App-specific keys are unique to each Web3 app using the Arcana Auth SDK. If a user logs into two different apps with the SDK, they'll have a unique wallet address in each app. In Web2, users often reuse passwords. Similarly, Web3 apps using Arcana Auth SDK can enable the same global wallet address across apps with the global keys option. While global keys streamline user experience, they pose a security risk. If one app is breached, a malicious actor could access the user’s digital assets across all apps using the same global keys. ``` flowchart LR subgraph D [ ] A1(((Developer))) end subgraph KT [Keyspace Configuration] direction LR A1--> B1(Dashboard Login) --> C1[App A Settings] -- Configure Keyspace --> D1[Global Keys] B1 -->C2[App B Settings] -- Configure Keyspace --> D2[App-Specific Keys] B1 -->Cz[App Z Settings] -- Configure Keyspace --> Dz[Global Keys] end classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class D1,Dz an-pink ``` ``` flowchart LR subgraph U [ ] A3(((User 1))) end subgraph ULZ [User 1 Logs in - App Z] direction LR A3 --> BZ(App Z Login) -- Authenticated --> CZ(Arcana Wallet in App Z) --> DZ[Wallet Address UA1] end subgraph ULB [User 1 Logs in - App B] direction LR A3 --> B33(App B Login) -- Authenticated --> C33(Arcana Wallet in App B) --> D33[Wallet Address UB1] end subgraph ULA [User 1 Logs in - App A] direction LR A3 --> B3(App A Login) -- Authenticated --> C3(Arcana Wallet in App A) --> D3[Wallet Address UA1] end classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class D3,DZ an-pink ``` ## Enabling Global Keys By default, apps use app-specific keys. Developers can switch to global keys via the Arcana Developer Dashboard. To enable global keys, they must request activation through an online form. Activation may take a few hours for verification. Meanwhile, developers can continue using app-specific keys. ## UX with Global Keys Switching to global keys in the Arcana Auth SDK changes the user experience with Arcana wallet. - If users previously had app-specific keys, they’ll see a new wallet address with global keys. - Blockchain transaction signing will also change. With app-specific keys, a personal sign message pops up within the same app. With global keys, it opens in a new browser tab where users can sign and then close the tab. Wallet behavior (No clickjacking fix) Wallet behavior (With clickjacking fix) ## Switching Keyspace Apps use app-specific keys by default. Developers can switch to global keys using the Arcana Developer Dashboard based on privacy, security, or usability needs. Note that Switching keyspace will change the user’s wallet address. ## Global Keys Limitations - Apps that are configured to use the custom wallet UI option instead of using the default, built-in, Arcana Auth SDK UI **cannot** use global keys. - Apps that are configured to use [Custom Auth](../authtype/custom-auth/) feature **cannot** use global keys. The reason for these restriction is to reduce a potential [security vulnerability](./#security). ## Security Arcana follows a strict validation process for enabling global keys. However, using global keys may introduce security risks. While global keys offer convenience by providing a consistent wallet address across apps, they also create a vulnerability. If one app turns malicious, the user's key could be exposed across all apps using global keys, leading to unauthorized access. # Multi-Factor Authentication Arcana Auth SDK enhances wallet security with multi-factor authentication (MFA). MFA adds an extra verification step when accessing the wallet from a new browser or device. It stores a local share of the private key on the user's device. If lost, users can recover it using security questions or a recovery pin during login from a new device or browser. Once recovered, this information is not needed again for the same device or browser. MFA improves security by requiring more than just an email or social identifier. Even if an attacker gains access, they cannot bypass MFA without the security questions or recovery pin. Additionally, MFA protects user keys even if the [ADKG subsystem](../adkg/) is compromised. ## Enabling MFA The MFA feature requires no SDK usage configuration from the developer. Users can choose to enable MFA for the Arcana wallet at the first login or later by entering security questions and a recovery PIN. MFA: Under the Hood ### Security Questions Users can select any 5 security questions from the provided options or create custom questions. These questions and answers together serve as a seed to generate a share of the user's private key. ### Recovery Pin Users must also create a 6-digit alphanumeric PIN. This PIN encrypts and stores one of the multiple verification factors used by MFA. It serves as a backup, stored securely with Arcana, in case the user changes devices or loses the locally stored encrypted component in their browser's cache. Cannot Disable MFA MFA, once enabled, cannot be disabled to ensure maximum security. ## User Experience with MFA Without MFA, users experience no change when logging into a Web3 app from different devices or browsers using Arcana Auth SDK. They can log in and access the Arcana wallet as usual. However, if their social provider account is compromised, their access to the wallet and keys is at risk. With MFA enabled, users face a different login process **only when they use a new device or browser**. They must either answer three security questions or enter a security PIN when logging into the Web3 app to access the Arcana wallet. # Non-EVM Chains Arcana Auth SDK supports EVM-compatible and non-EVM chains. Pre-configured blockchain networks are available. Users log into Web3 apps and can immediately use the Arcana wallet to sign transactions on the active chain. Non-EVM Chains When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain. ## Web3 Wallet Operations The [Web3 wallet operations and JSON/RPC functions](../../auth/web3-ops/evm/) supported by the `AuthProvider` obtained via the Arcana Auth SDK may vary for non-EVM chains. ### Solana - `signMessage` - `signTransaction` - `signAllTransactions` - `signAndSendTransaction` ### MultiversX - `mvx_signMessage` - `mvx_signTransaction` - `mvx_signTransactions` - `getAccounts` - `getPublicKey` ### Near - `getAccounts` - `near_signMessage` - `near_signAndSendTransaction` Adding Non-EVM chains When a non-EVM chain is selected for an app, developers and users **cannot add** other chain types (EVM or different non-EVM chains) in Arcana wallet. This is due to the lack of a uniform standard for wallet addresses across non-EVM chains, which means switching chain types may alter the wallet address. ## Keyspace User Experience Developers can customize wallet experiences by selecting the keyspace type in Arcana Developer Dashboard. With app-specific keys, users get unique keys for each app, no matter the chain type. With global keys, users have the same wallet address across apps on EVM-compatible chains. For non-EVM chains, global keys result in different wallet addresses due to different cryptographic algorithms. EVM chains use the secp256k1 curve, Solana uses the [ED 25519 curve](https://en.wikipedia.org/wiki/EdDSA#Ed25519) , and MultiversX uses BLS multi-signatures. Therefore, users will see different wallet addresses if an app uses an EVM chain and another uses a non-EVM chain or different non-EVM chains. # Plug & Play Auth Plug & Play Auth is the default login UI in Arcana Auth SDK. Web3 apps can use the [`connect`](https://authsdk-ref-guide.netlify.app/classes/authprovider#connect) method to show this built-in UI with the configured onboarding options from [Arcana Developer Dashboard](../dashboard/). Developers can use this ready-made UI instead of creating a [custom login UI](../custom-login-ui/). Plug & Play Login UI ``` flowchart LR subgraph A [Plug & Play vs. Custom Login UI] direction LR A1(((Developer))) -- 1.Register App --> B1(Dashboard Login) B1 --> C1[Get Client ID] --> E1[Initialize AuthProvider] A1 -- 2.Integrate App --> D1[Install Auth SDK] --> E1 --> O[Onboard Users] end classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class F1 an-pink ``` ``` flowchart LR subgraph B [Onboard Users] direction LR O[Onboard Users] -- Plug-and-Play Login UI--> F1[connect] O -- Custom Login UI --> P1{Provider Type} -- Social Providers --> G1[loginWithSocial] P1 -- IAM Provider Firebase --> H1[loginWithBearer] end classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class F1 an-pink ``` ## Compact Modal The built-in plug-and-play login UI includes a compact modal and a normal-sized modal. Choose the compact modal by setting `compact: true` in `connectOptions` when instantiating `AuthProvider`. For more details, see [`AuthProvider` constructor parameters](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams). ``` import { AuthProvider, CHAIN } from '@arcana/auth' interface ChainConfig { chainId: CHAIN rpcUrl?: string } const auth = new AuthProvider(`${clientId}`, { position: 'left', // default - right theme: 'light', // default - dark alwaysVisible: false, // default - true setWindowProvider: true, // default - false connectOptions: { compact: true // default - false }, chainConfig: { chainId: CHAIN.POLYGON_MAINNET, rpcUrl: '', }, }) await auth.init() ``` Plug & Play Login UI Types Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../an-did-token/#verify-did-token) and subsequently generate another token for app use. # Private Key A private key is a secret linked to the user's Arcana wallet. It is generated by the asynchronous distributed key generator ([ADKG](../adkg/)) component of the protocol used by the Arcana Auth SDK. [Only the user can access it](../../faq/faq-auth/#user-key-privacy). Users can export their private key securely via the Arcana wallet UI. The user is responsible for securing the exported key. # Arcana Session Types Session management settings allow Web3 app developers to decide if a user session persists after the browser window or tab is closed and reopened. Session cookies control how long an authenticated user session remains active without requiring the user to log in again. Arcana wallet supports two types of sessions: - Persistent - Non-Persistent Session Cookies In both these cases, the session cookies are immediately invalidated once the user logs out of the app. ## Persistent Session The authenticated session remains valid within a specified time, so users don't need to log in again after closing and reopening the browser. Use the 'Require Log-in After' setting to specify how long a session is persisted once the browser is closed. The 'Require Log-in After' setting does not impact any active user session. The user is not forcefully logged out after the time expires. It is only used to track session persistence in case the user closes the browser without explicitly logging out. Session cookies are used to manage session persistence. After the specified timeout, the cookies are deleted. A persistent session is convenient for app users but carries some risk since it automatically logs the user in when the app is reopened. Ensure the re-login time aligns with the app's security and risk management profile. Not supported for Global Keyspace Setting The persistent session type is enabled only for the default [app-specific keyspace](../keyspace-types/) setting. For security reasons, it is disabled for apps using global keyspace. Incognito/Private Browser Mode If the session cookies are disabled in incognito or private browsing mode, then there is no user session persistence when the browser is closed. The behavior is the same as the non-persistent mode. ## Non-Persistent Session If the browser is closed, the authenticated session is invalidated immediately. Users must log in again to continue using the app. By default, a newly registered app is configured to use a non-persistent session type. # Social Login Social Login allows users to sign in using popular Web2 identity providers like Google and Twitter or through passwordless authentication. Web3 apps require private keys to operate wallets, but managing them can be complex for new users, often leading to drop-offs during onboarding. By removing the need to set up and manage private keys, social login simplifies Web3 onboarding. The familiar Web2-style login makes the process seamless for new users. ## Non-Custodial Social Login Arcana Auth SDK offers social login without compromising privacy. Many Web3 authentication providers offer social login, but most rely on custodial wallets, meaning a third party can access users' keys and funds, compromising privacy and control. Arcana Auth SDK's social login provides a non-custodial, in-app wallet. It combines the ease of social login with full user privacy, security, and key ownership. ## Enabling Social Login The Arcana Auth SDK supports user onboarding via email, [social login providers](../../web3-stack/auth/), [third-party IAM providers](../../web3-stack/auth/) and [custom authentication](../authtype/custom-auth/) as well. Compare Wallet Types & Capabilities # Application Usage Metrics Arcana Developer Dashboard displays the aggregate value of **Monthly Active Users (MAU)** for the Arcana Mainnet. The aggregate value includes MAU for all the applications that are registered against a developer's Arcana account. The aggregate usage metrics are displayed in the *Manage Apps Screen*. The per-application metrics are displayed on the *Application Dashboard* screen. **Manage Apps Screen**: - Aggregate Monthly Active Users (Mainnet) - Number of free MAU (Mainnet) - Number of paid MAU (Mainnet) Per App Usage Metrics **Application Dashboard**: - Testnet: Daily MAU, Monthly MAU - Mainnet: Daily MAU, Monthly MAU Testnet/Mainnet Usage Metrics Mainnet Usage The number of logged-in users is tracked separately for the 'Testnet' and 'Mainnet' application profiles. Arcana Testnet usage is not billed. # Validator Nodes Validator nodes play a crucial role in ensuring the decentralization of the Arcana blockchain protocol components used in securely generating user's [private key](../private-key/) for signing blockchain transactions. These partner infrastructure nodes participate in the distributed key generation process([ADKG](../adkg/)), that generates key shares (not the key itself) for users. The private key is only created within the authenticated user's context in the app. At the launch of the Mainnet, some nodes in the DKG subsystem are owned and operated by Arcana, while the remaining nodes are owned and run by trusted partners. In the future, other third parties will be allowed to participate in the key generation protocol. For more information on the latest implementation of asynchronous distributed key generation (ADKG), consult the see [Arcana Technical Whitepaper](https://www.notion.so/Arcana-Technical-Docs-a1d7fd0d2970452586c693e4fee14d08). # Smart Contracts The Arcana [Chain Abstraction(CA)](../../ca/chain-abstraction/) and Web3 authentication protocols are implemented through a bunch of smart contracts. These upgradeable contracts enforce protocol rules, ensure user data privacy, security and work with the Arcana Gateway for enabling [unified balance](../../ca/unified-balance/) and [social-login](../../social-login/) for Web3 authentication and wallet access control. ## Chain Abstraction The Arcana chain abstraction feature is implemented through components built and deployed in the Cosmos ecosystem. In addition to those, it also implements smart contracts for Vault functionality on all supported chains. ## Web3 Authentication Arcana Auth feature related smart contracts are implemented on the Polygon Network. These define and manage the logic and state of Web3 authentication for app users without storing any user credentials. # Arcana Auth SDK: Deployed Contracts | Arcana Auth SDK Contract | Type/Category | Purpose | | --- | --- | --- | | `Arcana.sol` [V1 or V2] | Beacon Proxy/Core System | Main logic contract for Arcana Store operations primarily associated with managing user data privacy and access control. | | `Factory.sol` | UUPS Proxy/Core System | Smart contract generator per app that registers with Arcana | | `ArcanaBeacon.sol` | UUPS Proxy/Core System | Smart contract to manage the per app association between the latest `Arcana.sol` main logic contract and the app | | `BeaconProxy.sol` | Beacon Proxy/dApp | This is a per app smart contract that stores the data related to the program state. It interacts with `ArcanaBeacon.sol` smart contract to refer to the latest Arcana Auth SDK authentication core logic contract. | | `Forwarder.sol` | UUPS Proxy/Core System | Manages meta transactions for app users. Forwards Gateway proxy calls (on behalf of the app) to `Arcana.sol` main logic contract | | `NodeList.sol` | Core System | Keeps track of ADKG nodes and their epochs. | **`Arcana.sol`** The `Arcana.sol` contract is crucial for the Arcana Auth SDK protocol. It handles UI configuration for managing blockchain transaction signing experience. It’s an upgradable beacon proxy and shares metadata with other contracts via pass-through data mechanisms. **`Factory.sol`** When a new app registers with Arcana Auth SDK, the factory contract activates. This singleton UUPS proxy contract generates app-specific `BeaconProxy.sol` contracts and implements core system logic. **`BeaconProxy.sol`** During registration with Arcana Developer Dashboard, each app gets a BeaconProxy contract. The Arcana Auth SDK Factory.sol deploys it. The BeaconProxy always points to the latest `Arcana.sol` version, managed by `ArcanaBeacon.sol`. **`ArcanaBeacon.sol`** The Arcana Beacon contract points to the latest Arcana Auth SDK core logic, whether V1, V2, or Vn. It’s a UUPS proxy upgradable contract, ensuring the Arcana Auth SDK Protocol remains upgradeable. **`Forwarder.sol`** The UUPS proxy upgradable `Forwarder.sol` manages meta transactions, which are Ethereum transactions containing another transaction. Meta transactions allow external entities like the Arcana Gateway to pay gas fees, thus easing onboarding for new users. The Gateway uses them for Arcana Auth SDK related data and access. `Forwarder.sol` works with an ERC-2771 compatible contract to forward transactions from the Gateway to the core `Arcana.sol` contract. **`NodeList.sol`** `NodeList.sol` manages the Arcana Auth SDK protocol functionality related to the asynchronous distributed key generation (ADKG). It tracks public ADKG node information, epoch details, the buffer size for ‘pre-generated’ keys, and validator node whitelisting. ## Contract Flows The workflows below show how Arcana smart contracts implement the Arcana Auth SDK protocol: 1. Data access flow 1. New app registration flow - All app user operation-related calls made via the client-side Arcana Auth SDK are intercepted by the Arcana Gateway. - The Gateway executes the meta transactions with relevant data and signatures. - Forwarder forwards the transaction via the per-app `BeaconProxy.sol` smart contract. - The BeaconProxy requests the current Arcana core system contract, `Arcana.sol`, from the `ArcanaBeacon.sol` contract. - After receiving the address of the latest Arcana core system contract from the `ArcanaBeacon` contract, the BeaconProxy delegates the forwarded call to the Arcana system contract. - Arcana contract actually executes the transaction. - When a new app is registered at the Arcana Developer Dashboard, it interacts with the Arcana Gateway to initialize the program state of the app. - The `Factory.sol` smart contract is invoked to create a new `BeaconProxy.sol` contract that is solely associated with this newly registered app. Each app has its own BeaconProxy contract deployed. - The `BeaconProxy.sol` contract stores the per-app data related to the program state. - The BeaconProxy communicates with the `ArcanaBeacon` contract to obtain the address of the latest Arcana core system contract. This ensures that each app contract knows and utilizes the latest supported Arcana Auth SDK protocol. # Arcana Smart Contract Types Arcana uses different smart contracts to implement unified balance and social login features through its blockchain protocol. Some contracts are deployed by default, while others activate when apps register. The protocol uses an upgradable proxy contract pattern. ## Proxy Contract Patterns Multiple [upgradable proxy contract](https://docs.openzeppelin.com/contracts/3.x/api/proxy#UpgradeableProxy) patterns are available, including [diamond proxy](https://blog.logrocket.com/using-uups-proxy-pattern-upgrade-smart-contracts/#what-is-a-diamond-pattern), [transparent proxy](https://blog.logrocket.com/using-uups-proxy-pattern-upgrade-smart-contracts/#what-is-a-transparent-proxy-pattern), [beacon proxy](https://docs.openzeppelin.com/contracts/3.x/api/proxy#beacon), and [UUPS proxy](https://blog.logrocket.com/using-uups-proxy-pattern-upgrade-smart-contracts/#what-is-a-uups-proxy-pattern). Arcana Auth SDK uses the following proxy contract patterns: - UUPS proxy - Beacon proxy Proxy Contract Patterns ## Arcana Contract Types The smart contracts used to implement the logic for the Arcana Auth SDK fall into two categories: 1. **Core System Contracts:** These singleton contracts implement the core Arcana Auth SDK protocol. Not all of them store data (program state). 1. **dApp Contracts:** Deployed per app after registration with Arcana Developer Dashboard. Only registered apps can integrate with the Arcana Auth SDK. Arcana Contract Types # Overview Arcana wallet is an in-app, non-custodial wallet embedded in Web3 apps that use Arcana Auth SDK. No browser extension is needed. Authenticated users get instant, secure access to the wallet for blockchain transactions. Keys are generated locally via the asynchronous distributed key generation system, ensuring full control over key privacy without complex cryptography. ## Wallet Features - Check account balance - Sign (Approve/Reject) blockchain transactions - Speed up transactions - Add, modify, switch blockchain networks - Deploy smart contracts - Manage token assets (native and custom) - Check account balance - List token assets - Add custom tokens (ERC-20) - Send and receive tokens - Buy/Sell crypto - Manage NFTs - List NFT assets - View NFT details - Send NFTs (ERC-721, ERC-1155) - Add NFTs - Modify (edit, delete) NFT metadata - View account transaction activity (NFT, Token send transactions, contracts deployment, etc.) - View pending transactions in the activity tab - Use the standard Ethereum 1193 provider interface to call [JSON/RPC functions](https://ethereum.github.io/execution-apis/api-documentation/) and supported Web3 wallet operations for the network - Export private key - Enable [enhanced security via MFA](../../user-guides/mfa/mfa-ug/) - Logout **Not Supported** The Arcana wallet does not allow an app user to import any blockchain account created using a third-party wallet provider. ## Wallet Customization Arcana wallet offers great flexibility and customization options as per the app requirements. - **UX:** Developers can manage the users' blockchain signing experience by [customizing branding, theme](../../setup/config-dApp-with-db/#settings-overview), [wallet positioning](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) in the app, selecting the default active chain, [modifying pre-configured networks](../../user-guides/wallet-ui/use-wallet-ui/#addselect-a-network), and using [visibility](walletvisibility/) options. - **Custom Wallet UI:** Replace the built-in, default wallet UI with a [custom wallet UI](../custom-wallet-ui/). ## Supported Chains Arcana wallet comes pre-configured with a subset of the [supported blockchain networks](../../web3-stack/chains/). This pre-configured list can be updated with other supported networks [programmatically](../../auth/web3-ops/evm/#add-network) or via the [wallet UI](../../user-guides/wallet-ui/use-wallet-ui/). [Learn more...](../../user-guides/wallet-ui/) # Network Switching The Arcana wallet UI shows a subset of supported blockchain networks. Users can switch the active wallet network by clicking the dropdown next to the network icon in the UI. They can also add to the network list or edit the entries. Web3 app developers can programmatically modify the pre-configured network list and set a default network during app setup via Arcana Developer Dashboard. This is done using the `wallet_addEthereumChain` and `wallet_switchEthereumChain` JSON/RPC methods supported by the Arcana Auth SDK. The `wallet_switchEthereumChain` method switches the active chain only after the user approves the network switch transaction. Wallet Chain Edit Persistence The list of networks configured by the developer, either programmatically or via the dashboard, persists across user login sessions. User changes to blockchain networks through the Arcana wallet UI are stored locally and lost when the user logs out. Switching Blockchain Networks Switching chains in the wallet typically doesn’t change the wallet address when switching to another EVM-compatible chain. However, switching to a non-EVM-compatible blockchain supported by Arcana Auth SDK will assign a new set of keys and a different wallet address. # Transaction Types Blockchain transactions triggered through Arcana wallet require user review and approval or rejection. Users see a notification message in the app context for review. Depending on the transaction type, the message may be: - Personal Sign - Chain Switch - Send Transaction - Deploy Contract Each message appears in a minimized notification widget. Users can click the arrow button to expand and review the details. ## Personal Sign Personal Sign Message ## Chain Switch Switch Chain Transaction ## Send Transaction Send Transaction ## Deploy Contract Deploy Contract Sign Message # UI Modes The [Arcana wallet](../) can be customized by Web3 app developers through the Arcana Developer Dashboard. When registering the app via the dashboard, developers must choose one of the wallet UI modes: - Built-in Arcana wallet UI (default) - Custom wallet UI. To use a custom wallet UI, developers should select the UI mode as 'Custom UI' during app creation on the Arcana Developer Dashboard. This choice is final and cannot be changed later. AuthProvider: `appMode` and `alwaysVisible` flags Developers can control the wallet UI mode and when the wallet UI is displayed in the app context through the following customizations: 1. **UI Mode**: Choose between the Arcana wallet UI or a custom wallet UI. Set this in the dashboard's Wallet UI Mode when creating and registering a new app. There is also an [`appMode` flag](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) in the `AuthProvider` which can override this setting in the dashboard. If 'Custom UI' is selected via the dashboard then the `appMode` flag in `AuthProvider` is ignored. 1. **Always Visible**: Decide if the wallet is always visible in the app or only during a blockchain transaction. The [`alwaysVisible` flag](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) can be set to false (default is true) when creating a new `AuthProvider`. If using the Arcana wallet UI, this flag controls visibility. By default, the UI is always visible as a minimized widget. When set to `false`, the UI only appears during a blockchain transaction or when the developer calls the [`showWallet()`](https://authsdk-ref-guide.netlify.app/classes/authprovider#showWallet) method of the `AuthProvider`. The `alwaysVisible` flag is ignored if a custom UI is selected in the dashboard's Wallet UI Mode. # Wallet Visibility Web3 app developers can control Arcana wallet visibility by setting the `alwaysVisible` flag when instantiating the `AuthProvider` during app integration with the Arcana Auth SDK. By default, `alwaysVisible` is set to `true` and the wallet is displayed immediately after a user logs into the app that is integrated with the Arcana Auth SDK. As the wallet is always visible in the context of the app, an authenticated user has full access to all the Web3 wallet operations supported by the Arcana wallet. Wallet In-app Visibility: Enabled If `alwaysVisible` is set to `false`, then the Arcana wallet UI does not show up on the application window immediately after a user logs in. The Arcana wallet UI is displayed only when a blockchain transaction is triggered that requires the user's approval or if the app issues the `showWallet()` method. Wallet In-app Visibility: Disabled AuthProvider: `appMode` and `alwaysVisible` flags Developers can control the wallet UI mode and when the wallet UI is displayed in the app context through the following customizations: 1. **UI Mode**: Choose between the Arcana wallet UI or a custom wallet UI. Set this in the dashboard's Wallet UI Mode when creating and registering a new app. There is also an [`appMode` flag](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) in the `AuthProvider` which can override this setting in the dashboard. If 'Custom UI' is selected via the dashboard then the `appMode` flag in `AuthProvider` is ignored. 1. **Always Visible**: Decide if the wallet is always visible in the app or only during a blockchain transaction. The [`alwaysVisible` flag](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) can be set to false (default is true) when creating a new `AuthProvider`. If using the Arcana wallet UI, this flag controls visibility. By default, the UI is always visible as a minimized widget. When set to `false`, the UI only appears during a blockchain transaction or when the developer calls the [`showWallet()`](https://authsdk-ref-guide.netlify.app/classes/authprovider#showWallet) method of the `AuthProvider`. The `alwaysVisible` flag is ignored if a custom UI is selected in the dashboard's Wallet UI Mode. # Web3 Onboarding In Web3, decentralized systems use trustless protocols and cryptography for identity verification, which involves complex key management. This makes onboarding to Web3 apps harder for users as they require private keys for signing transactions. Managing these keys is challenging, with no central recovery if lost, unlike Web2's password recovery. The [Arcana Auth SDK](../authsdk/) simplifies Web3 onboarding by enabling secure Web3 access and blockchain transaction signing. Users can log into apps using familiar Web2 methods and have self-custody of their cryptographic keys. ## Authentication Options Web3 apps using the Arcana Auth SDK can authenticate users via any of these options: - [Social Login Providers](socialauth/) - [Custom Auth](custom-auth/) - [Passkey Auth](auth-passkeys/) User Key Security & Privacy The Arcana Auth SDK uses the asynchronous distributed key generation ([ADKG](../adkg/)) to securely assign key shares to authenticated users. The user's private key is generated from these key shares on the client side. For added security, users can enable multi-factor authentication ([MFA](../mfa/)). # Passkey Auth Passkey is a digital credential that binds a user account with a website or application. Passkeys use public key cryptography that reduces the threat from potential data breaches. They are safer than passwords as they reduce the attack surface. Since passkeys are uniquely generated for every account by the user device and work only on the registered websites and apps, they are less vulnerable to phishing. The Passkeys Auth feature in the Arcana Auth SDK lets Web3 apps to onboard users through a biometrics sensor (such as a fingerprint or facial recognition), a PIN, or a pattern supported by the OS or device where the app is running. ``` graph LR A[[User]]--Create Passkey--> D(Public/Private Key)--Store-->C>Browser/User Device]; classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class C,D an-pink ``` ## Security & Privacy Passkeys are based on [FIDO standards](https://en.wikipedia.org/wiki/FIDO_Alliance), they work on Android, Chrome, Microsoft Windows, Microsoft Edge, MacOS, iOS and Safari. Note that when logging in to an app via a passkey, there is no biometrics information or any sensitive information that is shared with the associated website for authentication. Also, passkeys by themselves do not allow tracking of users or devices across sites. Passkeys use public key cryptography. A public–private key pair is generated when a user creates a passkey for a site or application. This is generated on the user's device. Only the public key is stored by the site. Device based passkey managers protect passkeys from unauthorized access and use. Passkeys do not expire but they can be unlinked/deleted and new ones linked/created, if required. ## How do Passkeys Work? Passkeys are intended to be used through operating system infrastructure that allows passkey managers to create, backup, and make passkeys available to the applications running on that operating system. Each passkey is linked or bound to the app or website. Users aren't restricted to using the passkey only on the device where they're available. The passkey available on phones can be used when logging into a laptop, even if the passkey isn't synchronized to the laptop, as long as the phone is near the laptop and the user approves the sign-in on the phone. ``` graph LR L[[User on Device A]]--1.Choose Login with Passkeys Option-->M[App/Website] M --2.Passkey Challenge-->L L --3.Challenge Response--> M M -.-> V{Challenge Match}==Yes==>M--4.User Authenticated-->L ``` ## Passkey Usage Options Apps can enable passkey authentication for onboarding in two ways: - Use passkeys for **sign-up & login** - Offer passkeys as an **alternate login** method ### Sign-up & Login Apps that support only passkey auth can go all-in on this option. Users can sign up, create an account, and set up passkey login all in one go—no need for any other login method. ``` graph LR U[[User on Device/Browser]] --1a.App Sign-up/Register Passkey--> K>App/Website]; U --1b.Create Passkey--> PK(Public/Private Key)-->U; U --Store Public Key--> K U --2.Login with Passkey--> K --> L((User Authenticated)); classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class L an-pink ``` For subsequent app logins, the browser or operating system will prompt the user to select and use one of the passkeys linked with the app. To validate and ensure that the rightful owner uses a passkey, the operating system may ask users to unlock their device before supplying the passkey for authentication. ### Alternate Login Apps with multiple onboarding options only let users log in with passkeys after they’ve first used another login method and set up passkeys for future use. Users need to sign up and log in using a different method before they can enable passkeys for future logins. Keep in mind, passkeys can’t be used for the initial sign-up. ``` graph LR U[[User on Device/Browser]]--1.App Login (non-passkey)-->K>App/Website]; U--2.Create/Link Passkey-->PK(Public/Private Key)-->U; U--Store Public Key-->K U--3.Login with Passkey-->K-->L((User Authenticated)); classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class L an-pink ``` After setting up passkey for an account, on the subsequent log in attempt to the website or app, passkeys can be used. When signing in via passkeys, the browser or operating system will prompt the user to select one of the passkey associated with the app or website. To validate and ensure that the rightful owner uses a passkey, the operating system may ask users to unlock their device before supplying the passkeys list to choose from. ## Passkey Configuration 1. Log in to the Arcana Developer Dashboard and register the app to get a unique Client ID. Then configure [domain](#domain) setting in the dashboard. ``` graph TD DFLA{{ Developer }} --Login --> setup subgraph setup[Arcana Developer Dashboard] direction LR SP1[1.Register App] --> CLID((Unique ClientID)) SP2[2.Configure App] --> SP3[Edit/Save Passkey Usage Settings] end classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class CLID an-pink ``` 2. Install Arcana Auth SDK, integrate it with your app, and initialize `AuthProvide`r. Choose the passkey onboarding option that fits your needs: use `registerWithPasskey()` for [sign-up with passkey](./#sign-up-login) option or `linkPasskey()` for using passkey as an [alternate login](./#alternate-login). Then, log in users with `loginWithPasskeys()`. ``` graph TD DFLA{{ Developer }} --1.Install --> authsdk DFLA --2.ClientID -->AUTHP DFLA --3.Select Sign-up/Alternate Login Passkey Onboarding -->POP -->COA subgraph app[App] AUTHP[Create/Init AuthProvider] --> authsdk COA[B. Call loginWithPasskeys] --> authsdk POP[A. Call registerWithPasskey/linkPasskey] subgraph authsdk[Arcana Auth SDK] direction TB SDK1[AuthProvider Interface] end end linkStyle 1,2 stroke: deeppink; authsdk --Process Passkeys Login --> STD[Standard Passkey Validation via OS/Browser] authsdk --Fetch Key Shares --> BEP[Arcana Auth Protocol] <--> BEK[DKG] ``` 1. The Arcana Auth SDK uses the application details from the dashboard settings and `loginWithPasskeys` input data for Passkeys login processing. After verification, it gets the user's key shares from the Arcana backend and generates a user specific key locally in the app. This key lets users securely sign blockchain transactions. ``` graph LR BED[Arcana Developer Dashboard] --Passkey Usage Settings--> BEC{Gateway} BEC <--> BEA[Arcana Auth Protocol] <--> BEDKG[DKG] ``` ### Domain To enable passkey login for an app, as part of configuration settings, the developer must use the Arcana Auth SDK and specify the **Domain** of the relying party. The domain is typically a CNAME or vanity URL. Relying Party The relying party is the website or Web3 app that allows user to create passkeys or authenticate with passkeys. When a user enrolls a passkey, it associates with the relying party domain. If the domain name changes at any time, all of the passkeys associated with the old domain become invalid. # Custom Auth The custom Auth feature enables Web3 apps to use the Arcana Auth SDK for secure key assignment. Authenticate users with a Custom Auth service, issue JWT tokens, and send them to the SDK. The SDK verifies users, retrieves key shares, and generates the private key for blockchain transactions on the client side. Global Key Apps not supported! Custom Auth feature is supported only if the app is configured for [app-specific key type](../../keyspace-types/). ## Authentication Flow 1. Log in to the Arcana Developer Dashboard and register the app to get a unique Client ID. Then [configure Custom Auth settings](#custom-auth-settings) in the dashboard. ``` graph TD DFLA{{ Developer }} --Login --> setup subgraph setup[Arcana Developer Dashboard] direction LR SP1[1.Register App] --> CLID((Unique ClientID)) SP2[2.Configure App] --> SP3[Edit/Save Custom Auth Settings] end classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class CLID an-pink ``` 1. Add code in the app for using a Custom Auth service and obtains a JWT after user authentication. ``` graph LR IAP{{ Developer }} MMM(Custom Authentication Service) subgraph app[App] direction LR CL[Custom Login] end IAP --> CL --> MMM --->|JWT Token| CL linkStyle 2 stroke: deeppink; ``` 1. Next, install Arcana Auth SDK, integrate app with the SDK, initialize `AuthProvider` and then use the JWT obtained after the Custom Auth processing to call the `loginWithCustomProvider()` method. ``` graph TD DFLA{{ Developer }} --install --> authsdk DFLA --ClientID -->AUTHP DFLA --JWT Token -->COA subgraph app[App] AUTHP[Create/Init AuthProvider] --> authsdk COA[Call loginWithCustomOAuth] --> authsdk subgraph authsdk[Arcana Auth SDK] direction TB SDK1[AuthProvider Interface] end end linkStyle 1,2 stroke: deeppink; authsdk --Verify JWT Claims --> STD[Standard JWT/JWK Validation] authsdk --Fetch Key Shares --> BEP[Arcana Auth Protocol] <--> BEK[DKG] ``` 1. The Arcana Auth SDK checks the JWT using dashboard settings. After verification, it gets the user's key shares from the Arcana backend and generates the key locally in the app. This key lets users securely sign blockchain transactions. ``` graph LR BED[Arcana Auth Protocol] --Custom Auth Settings--> BEC{Gateway} BEC <--> BEA[Arcana Auth Protocol] <--> BEDKG[DKG] ``` ## Custom Auth Settings The following Custom Auth settings can be specified via the Arcana Developer Dashboard. ### JWKS Endpoint A JWKS Endpoint is a read-only URL exposed by the Custom Auth server or any other server that manages the cryptographic keys or JSON Web Keys (JWK) as per the [IETF RFC7517](https://datatracker.ietf.org/doc/html/rfc7517) and [IETF RFC7519](https://datatracker.ietf.org/doc/html/rfc7519) standards. JWKs are used to validate the integrity of a JWT and the encoded data by the Arcana Auth SDK. ### User Identifier String The 'User Identifier String' links a unique identifier with the user's key. Developers can choose the string from one of the options: - Sub: The user identifier string identifies the principal that is the subject of the JWT. - Email: JWT Token claim email identifier for the user - Custom: A custom string used for JWT Token claim. ### Issuer The issuer claim identifies the principal that issued the JWT. For example, it could be the app identifier or deployed app URL. *Example:* `Issuer: "https://myapp.example.com"` ### Audience The audience claim identifies the recipients that the JWT is intended for. *Example:* `Audience: "arcana-login-nnnnnn"` ### JWK Validation (Optional) Claims are pieces of information asserted about a subject or user. A JWT can contain a claim called name that asserts that the name of the user authenticating is "John Doe." JWT Validation entities specified by the developer via the Arcana Developer Dashboard are key, value pairs. These are used to validate the JWT provided by the developer to the Arcana Auth SDK via the `loginWithCustomProvider()` method for authenticated users. *Examples* `purpose: 'login'` `keyUse: 'arcana'` # Authentication Providers Apps integrating with the Arcana Auth SDK can use the built-in [plug-and-play login UI](../../plug-and-play-auth/) or a [custom login UI](../../custom-login-ui/) to onboard users through any of the supported authentication providers: - Social Providers - Custom IAM Providers ## Social Providers The Arcana Auth SDK supports popular Web2 [social login](../../social-login/) providers for onboarding users and verifying their identities. - Apple - Cognito - Discord - Firebase - GitHub - Google - Steam - Telegram - Twitch - Twitter ## Custom IAM Providers The following IAM providers are supported for user authentication: - Cognito - Firebase These third-party IAM providers may require separate configuration of the underlying user authentication mechanisms such as social logins, OpenID, etc. Passwordless Login Besides these providers, users can log into a Web3 app in a passwordless manner by verifying the OTP received over email. Passwordless login is enabled by default in all apps using the Arcana Auth SDK. # Allowances Allowances activate Arcana Network's Chain Abstraction feature. Allowances must be set up to enable a chain abstracted transaction that involves multiple source chains. With allowance setup, users can unlock the fragmented liquidity across multiple chains in their EOA. Effectively, this lets the user spend on any destination chain—even with insufficient balance on the destination chain. By approving allowances for chain abstraction on the source chains, users can: - Spend anywhere with funds from multiple chains. - Bypass bridging to enable liquidity on the destination chain. - Transact seamlessly across chains. - Setup once, use repeatedly. As part of allowance setup, users **permit Arcana Vault contracts on the source chains to collect the funds required** to execute the transaction seamlessly on the destination chain. Note that the allowance set up transaction itself requires gas fee. This gas fee is payable by the user. In some cases, Arcana may sponsor gas fee for the allowance setup. By default, the allowance limit for each supported chain is set to `unlimited`. This default setting ensure that all the supported tokens on the chain can be utilized as the unified balance available to spend. The protocol can collect the required funds according to the allowance limit and pay for the chain abstracted transactions on any destination chain. Developers can choose to modify the default allowance limits via the `setOnAllowanceHook`. ## How Allowances Work? Here is how the allowances enables chain abstracted transactions: 1. User approves the protocol to access funds from multiple source chains. 1. Protocol unifies user balance across these chains. 1. Unified funds get deposited into protocol vaults. 1. User can now transact on any destination chain using your combined balance. ## Allowance Setup Users have two allowance setup choices that differ by: - Which chains are included for chain abstraction allowance setup? - Who pays the gas fees for the allowance transaction? | Option | Chains included | ETH Balance Required | User Pays Gas Fee | Arcana Pays Gas Fee | | --- | --- | --- | --- | --- | | 1. | Ethereum Mainnet + Avalanche + L2 chains | Yes | `$1`-`$5` (as per current Ethereum Mainnet gas price) | Avalanche + L2 only | | 2. | Avalanche + L2 chains | No | Nothing | All gas sponsored | # Arcana CA Wagmi SDK Arcana CA Wagmi SDK enables unified balance in Web3 apps using the [Wagmi](https://wagmi.sh/) framework. The SDK offers a plug-and-play widget that display the unified balance for the app users and helps them transact on any chain. Web3 Wagmi app builders can integrate the Arcana's [Chain Abstraction](../chain-abstraction/) feature via the SDK and let users spend on any chain, as long as they have sufficient funds across chains to cover for the transaction amount and the required gas fee. Arcana CA Wagmi SDK Usage Overview # Arcana CA SDK The Arcana CA SDK is meant for Web3 builders and app developers. It unifies user balance in the wallet account spread across [chains](../../../web3-stack/ca_stack/#chains) and [tokens](../../../web3-stack/ca_stack/#tokens). Web3 app builders can integrate Arcana's [Chain Abstraction](../chain-abstraction/) feature via the SDK and let users spend on any chain, as long as they have sufficient funds across chains to cover for the transaction amount and the required gas fee. Arcana CA SDK Architecture Overview # Chain Abstraction Managing multiple chains, tokens, and accounts fragments wallet liquidity for Web3 users. Even with enough assets overall, funds scattered across chains make transacting difficult and require complex, time-consuming conversions. Chain abstraction lets users access a [unified balance](../unified-balance/) across all wallet-linked chains, enabling transactions anywhere. Instead of converting funds first, users specify a [clear intent](../intent/). The protocol collects funds from source chains, shows intent and fees for confirmation, then publishes the intent to solvers. Solvers compete to provide liquidity on the destination chain, and once available, users confirm the transaction. Settlement with solvers happens asynchronously using the collected funds. As part of setup, devs configure [allowances](../allowances/) per chain and token. Users approve or reject these allowances. For [supported tokens](../../../web3-stack/ca_stack/#tokens) on [source chains](../../../web3-stack/ca_stack/#chains), the protocol uses these allowances to deposit required funds for transactions on the destination chain. Arcana's Chain Abstraction ## Why Chain Abstraction? Chain abstraction enables unified balance to simplify and streamline Web3 transactions. It offers: - **Faster Intent Processing:** Enables quick and seamless transaction execution across chains. - **Unified Liquidity:** Provides a consolidated view of user assets across wallet-linked chains with no asset bridging. - **Simplified UX:** Removes multi-step hurdles for a seamless experience, making transactions easy for all users. - **Streamlined DX:** Developers can add unified balances to dApps with minimal changes and no smart contract updates for new chains. # Intent Explorer The [Arcana Intent Explorer](https://explorer.arcana.network/) is used to check the status or details of an [intent](../intent/). To view intent details in the Intent Explorer, you need the unique [intent identifier](./#intent-identifier). Each stage of chain abstracted transaction processing can be viewed in the Intent Explorer. All the intent details are populated once the intent is fulfilled and the transaction is complete. Intent Explorer ## Intent Identifier Each [intent](../intent/) is associated with a unique identifier. How you access this identifier depends on whether you’re using the Arcana CA Wallet or a third-party wallet in a Web3 app integrated with the Arcana CA SDK. ### Arcana CA Wallet When using the Arcana CA Wallet for issuing a chain abstracted transaction, you can obtain the intent identifier by clicking 'View Intent.' The 'View Intent' option becomes available in the transaction UI after a user authorizes a transaction that involves chain abstraction. The transaction is then published to [solvers](../solver/), who compete to provide liquidity on the destination chain as specified in the intent. Get Intent Identifier To find the intent identifier for past transactions: - Open the 'Activity' tab in the CA Wallet to view your transaction history. - Click the down arrow next to a transaction to expand its details. - In the details, click 'View Intent' to see the unique intent identifier for that transaction and other intent details. Activity Tab: Get Intent Identifier } ### Third-party Wallets Accessing the intent identifier for a chain-abstracted transaction issued through a third-party wallet depends on how the Web3 app is built and integrated with the Arcana chain abstraction SDK. The Arcana CA SDK provides methods and hooks that developers can use to: - Implement chain-abstracted transactions. - Show transaction progress, including the intent identifier, in the app’s UI. Developers can: - Add code to let users view intent details before authorizing a chain abstracted transaction. - Use SDK hooks to track events and [progress after the intent is published](https://ca-sdk-ref-guide.netlify.app/types/progressstep), retrieving the intent identifier once it’s created. - Offer options in the UI to display the intent identifier or a button to view details at different stages (for example, when liquidity is supplied or the intent is fulfilled). For Web3 apps using the Arcana CA Wagmi SDK, no extra code is needed. The 'View Intent' option is already built into the transaction UI. Users can click it to open the Intent Explorer and see the intent details and identifier. Previous Transactions Unlike the Arcana CA Wallet activity tab, the chain abstraction SDKs do not provide a mechanism to access the intent identifier for past transactions. If required for transparency or compliance, the developers can provision saving and tracking the intent identifiers for past transactions in the context of the Web3 app by listening to the event data through SDK hooks. In the [chain abstraction](../chain-abstraction/) context, an intent represents an objective to transact on a destination chain where user does not have sufficient funds available. An intent specifies what the user is willing to offer (tokens from various source chains) to cover the transaction amount, gas fees, solver fees, and the Arcana chain abstraction (CA) protocol service fee for receiving the desired liquidity on the destination chain. By signing the intent, user agrees to perform the following in one shot: - Allow the Arcana CA protocol to collect necessary assets available in the EOA across one or more source chains to pay for the transaction and the fees. - Enable the available [solvers](../solver/) in the ecosystem to provide the desired liquidity on the destination chain in the user's EOA. - Let the Arcana CA protocol settle deposited funds and applicable fees with the solvers at regular intervals. As part of the Arcana CA protocol setup, the user must complete a one-time set up of [allowances](../allowances/) on every source chain. This is required before an intent can be raised for a chain abstracted transaction. Allowances are used to specify the limits of funds that can be deposited per source chain in order to receive the required funds on the destination chain. Each intent specifies: - **Source Chains:** The blockchains where the user has funds/tokens. - **Destination Chain:** The blockchain where the transaction will occur (where the user lacks liquidity). - **Tokens and Amounts:** Specifies which tokens and how much from each source chain will be used. - **Fees:** Includes CA gas fee (for cross-chain operations), protocol fee (for the service), solver fee (for the liquidity provider), and any supplied gas. - **Total Amount:** The full cost, combining the transaction amount and all fees. The intent processing begins when the user signs an intent and authorizes a transaction. Once the intent is signed by the user and submitted to the protocol, each intent is assigned a unique identifier. For every chain abstracted transaction, users can click on the 'view intent' link to see the intent details or to note down the intent identifier for future references. [Learn more...](../intent-explorer/#arcana-ca-wallet) This intent identifier is used to track the intent status. Users can supply the intent identifier in the [Arcana Intent Explorer](https://explorer.arcana.network/%5D) to check the intent’s status or details later. Intent Details ## Stages Following are some of the key stages of intent processing: - Intent Accepted - User has agreed to chain abstracted transaction intent and accepted the associated fees - Intent Hash Signed - User has signed the intent hash - Intent Submitted - Intent for CA is submitted to the chain - Intent Collection - Funds associated with the intent are collected on the source chains - Intent Mined - CA protocol has mined the intent on the chain - Intent Deposits Confirmed - Deposit on source chains is confirmed - Intent Fulfilled - The liquidity is supplied on the destination chain by the solver In Arcana's chain abstraction protocol, a solver facilitate cross-chain transactions by supplying liquidity on the destination chain. After a user signs and authorizes an intent, the protocol ensures that the required funds are collected on the source chains via the user's EOA and publishes the request for funds as per the user's [intent](../intent/). Solvers listen for the published intent and compete with other solvers to instantly provides the required liquidity on the destination chain. In return for the liquidity provisioning services provided by the respective solvers, the CA protocol periodically settles funds periodically. While settling, it aggregates all the successful transactions made by the solver and pays through the funds collected on the source chains from the user's EOA, as agreed to in the intent. # Wagmi Plug & Play Widget Arcana CA Wagmi SDK provides a plug and play widget that displays the [Unified balance](../unified-balance/) associated with the user's wallet address. This widget is available only for the [Wagmi](https://wagmi.sh/) apps. Follow these steps to use this widget: 1. Install and integrate the app with the Arcana CA SDK. 1. Use `CAProvider` to enable the plug-and-play unified balance widget in the app. [Learn more...](../../../quick-start/ca-wagmi-quick-start/) Plug & Play Unified Balance Widget # Unified balance Unified balance shows all the liquidity in a user's EOA account across multiple chains in one view. It lets users transact seamlessly on any chain without needing bridges or pre-provisioning gas for token swaps. Chain abstraction handles all the complexity involved in a cross-chain transaction while enabling better UX through a single intent approval. For instance, let us take the case where a user intends to spend 18 USDC on Scroll and does not have any balance on Scroll. - Optimism: 0.1 ETH, O USDT, 0 USDC - Arbitrum: 0 ETH, 12 USDT, 0 USDC - Base: 0 ETH, 10 USDT, 0 USDC - Scroll: 0 ETH, 0 USDT, 0 USDC To spend 18 USDC on Scroll (destination chain) with the given liquidity fragmentation, it would typically require multiple clicks and steps for swapping or bridging different assets available on the source chains, so that user can convert the assets to the desired token balance on Scroll. Through chain abstraction and ability to swap cross-chain, users have the convenience to view the consolidated token balance across supported tokens and chains. This simplifies the process of sending 18 USDC on Optimism, as users can sign the intent without the need for bridging, swapping, or considering the optimal routes. The cross-chain swap enables users to: - Spend assets on any destination chain without prior liquidity. - Collate payable amount by combining multiple supported assets across source chains to address liquidity fragmentation. Single chain liquidity vs. Unified Balance with Chain Abstraction **Plug & Play Widget** Arcana CA Wagmi SDK provides a plug and play widget that displays the [Unified balance](./) associated with the user's wallet address. This widget is available only for the [Wagmi](https://wagmi.sh/) apps. Follow these steps to use this widget: 1. Install and integrate the app with the Arcana CA SDK. 1. Use `CAProvider` to enable the plug-and-play unified balance widget in the app. [Learn more...](../../../quick-start/ca-wagmi-quick-start/) Plug & Play Unified Balance Widget # Arcana Auth SDK ## Onboarding Users ______________________________________________________________________ Can app users onboard app only via social login or do they have the flexibility to use any third-party Web3 wallets to connect to an app integrated with the Arcana Auth SDK? Yes. Besides social login, Arcana Auth SDK allows Web3 app users to log in to a Web3 app via any supported third-party browser-based Web3 wallets. Apps using wallet connectors, [Wagmi](../../quick-start/wagmi-quick-start/), and [RainbowKit](../../quick-start/rainbowkit-quick-start/), [Web3-React](../../quick-start/web3-react-quick-start/), and [WalletConnect](../../quick-start/walletconnect-quick-start/) SDKs can enable Arcana wallet to sign blockchain transactions. Is social login via a Microsoft account or Hotmail supported? No. Arcana Auth SDK does not support passwordless login through a Hotmail account. Also users cannot log in using Microsoft accounts. Can a Web3 app use the Arcana Auth SDK only for onboarding users and disable the Arcana wallet feature altogether? There is no way to selectively turn off the Arcana wallet features. However, if the application **does not perform any blockchain transactions**, the wallet feature can be disabled by setting the [wallet visibility mode](../../concepts/anwallet/walletvisibility/) to `false` while integrating the app with the Arcana Auth SDK. In this case, the Arcana wallet will not be visible to the authenticated user as long as **no blockchain transaction is triggered**. If you need to completely disable the Arcana wallet feature in the app, you can request a private build of the Arcana wallet by [contacting Arcana](../../support/) with the use case details. Will the Arcana Network's distributed key generation algorithm be affected if a node with a key share becomes temporarily inaccessible? No. Arcana's [ADKG](../../concepts/adkg/) algorithm can still generate the key using the key shares from the other nodes that are accessible. The algorithm is designed to tolerate a certain number of nodes being inaccessible, depending on the total number of participating nodes. For more details, see [Arcana's Technical Whitepaper](https://www.notion.so/Arcana-Technical-Docs-a1d7fd0d2970452586c693e4fee14d08). Does the authenticated user see the same wallet address if they use different authentication providers to log into a Web3 app integrated with the Arcana wallet? Yes. This is made possible by the [aggregate login](../../concepts/aggregatelogin/) feature of the Arcana Auth SDK. *For this feature to work, the user* **must** *have the same email ID registered with the different authentication providers.* Arcana Auth SDK uses the email ID to uniquely identify the user even if the user uses different social login providers or the passwordless email option to log in to a Web3 app. It associates a single key for such a user which results in the user seeing the same wallet address. If the user has different email IDs associated with different social login providers then each login is treated as a unique, different user and the same user will see a different wallet address when logging into the same Web3 app. Does the authenticated user see the same wallet address across multiple Web3 applications that integrate with the Arcana Auth SDK? Arcana Auth SDK allows Web3 app developers to tailor the wallet address experience for their users. It provides two 'Keyspace' options at the time of application registration: - App-Specific Keys - Global Keys If a developer selects the **Global Keys** option, then the user gets assigned the same key across all applications that integrate with the Arcana Auth SDK and chooses the same **Global Keys** option. The same key means the wallet address of the user is the same across different Web3 apps that integrate with the Arcana Auth SDK. This is true across apps that use EVM-compatible chains. If two apps use global keys but one of them is on an EVM-compatible chain and the other is not, then the keys will be different across such apps. The Arcana's ADKG subsystem will assign the user different sets of keys for such apps resulting in different wallet addresses across such apps. For more details, see [app-specific vs. global keys](../../concepts/keyspace-types/) Does the **global keys** feature work across EVM-compatible and not EVM-compatible chains? **No**. The global keys feature enables an authenticated user to have the same wallet address across different Web3 apps in the Arcana ecosystem. However, an authenticated user will see \*\*different wallet addresses across two chains configured in a single Web3 app if one of them is EVM-compatible whereas the other is not. Also, in the case of two Web3 apps, one of which uses an EVM-compatible chain and the other that uses chains that are not EVM-compatible, the authenticated user's wallet address will be different for each app. Why is the Global Keyspace option not enabled if I select the 'Custom Wallet UI' option during app registration in the Arcana Developer Dashboard? If a Web3 app developer chooses the 'Custom Wallet UI' instead of the built-in Arcana wallet UI, during app registration via Arcana Developer Dashboard, only 'app-specific keys' are allowed. This is for [keyspace security](../../concepts/keyspace-types/#security). Global keys allow users to have the same private key across all the apps that integrate with the Arcana Auth SDK. With custom wallet UI, global keys are disallowed to mitigate the security risk of a malicious app hacking into user keys and gaining access to not just one but all such apps with 'Global Keys' enabled. Are incognito/private windows in browsers and 'third-party cookies blocked' option supported by the Arcana Auth SDK? Yes. The Arcana wallet supports Chrome browser `Incognito Window` as well as `Private Window` in the case of Safari browsers. Earlier, if third-party cookies were disabled, the built-in, plug-and-play login pop-up modal did not show up in some cases. These use cases are now addressed by the SDK. Developers can use the `canReconnect` and `reconnect` [functions of the `AuthProvider`](https://authsdk-ref-guide.netlify.app/classes/authprovider) to check before allowing users to reconnect whereby users do not need to re-login if they refresh the page or close the tab and re-open it again within a 30-minute window. Does Arcana Auth SDK return a JWT token to verify users post social login? Yes. See [Arcana JWT Token](../../concepts/authtype/) for details. How does the app access an authenticated user's information such as name, email, login token, the wallet address? Apps can use the [`getUser()`](https://authsdk-ref-guide.netlify.app/classes/authprovider#getUser) method to obtain the user's name, email, login token ([Arcana JWT Token](../../concepts/an-jwt-token/), [DID Token](../../concepts/an-did-token/)), wallet address, etc. See [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) for details. For Twitter, the `getUser()` function of the `AuthProvider` does not always return the user's email? You can create a Twitter account using your phone number without needing to provide an email address. If you do this, the getUser() function won't give you the user's email address. However, web3 app developers have the [option to configure settings on the Twitter developer dashboard](https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials#:~:text=Request%20a%20User's%20Email%20Address,email%20address%20access%20to%20function) to request users' email addresses. If they do this, Arcana Auth SDK can access and retrieve the user's email through Twitter, and it will be included in the result when you use the getUser() function. Does login via Passkey share any user or device information with the website or application? No. With [passkeys](../../concepts/authtype/auth-passkeys/), the user's biometric information, secrets, or private keys are never revealed to the website or the app where user is trying to sign in. User digital credentials do not leave the user's personal device. Also, the passkey protocols are carefully designed so that no information shared with sites can be used as a tracking vector. [See FIDO standard](https://fidoalliance.org/how-fido-works/), [Apple Passkeys security](https://support.apple.com/en-in/102195), [Microsoft Passkey Support](https://support.microsoft.com/en-us/account-billing/signing-in-with-a-passkey-09a49a86-ca47-406c-8acc-ed0e3c852c6d), [Google Passkey Security](https://developers.google.com/identity/passkeys/faq) for details. Is there any expiration limit on passkeys? No. If required, users can delete passkeys associated with a website or application and create new ones. Can users create accounts with passkeys on Arcana Auth SDK? Yes. Web3 apps using Arcana Auth SDK can use passkeys for signups and login or as an alternative login mechanism. Refer to [Passkey Support](../../concepts/authtype/auth-passkeys/) for details. Does the Arcana Auth SDK support role based access control (RBAC)? Yes. After the user authenticates through the chosen [social login](../../concepts/social-login/) provider, the Arcana Auth SDK receives the JWT token from the provider. It verifies the user with this token, and then creates and returns an Arcana JWT token to the app. If the app developer needs to implement *Role Based Access Control (RBAC)* and authorize the authenticated user for some specific actions, they can first [verify the JWT token returned by Arcana](../../concepts/jwt-token-validation/). Upon verification they can issue a new app-specific JWT that enables RBAC and authorization. Alternately, developers can use Sign-In with Ethereum ([SIWE](https://www.npmjs.com/package/siwe)) by signing a standard message format parameterized by scope, session details, and security mechanisms (e.g., a nonce). SIWE allows users to log in to applications using their Ethereum wallet and ENS (Ethereum Name Service) profile. ## Arcana wallet ______________________________________________________________________ How does the in-app Arcana wallet allow developers to manage UX for signing blockchain transactions? Apps can integrate with the Arcana Auth SDK to enable an embedded, non-custodial Web3 Arcana wallet for every authenticated app user. To integrate an app, developers must register and configure the app with Arcana, and then install the `auth` package and create a new `AuthProvider`. While instantiating the `AuthProvider` developers can manage the user experience for signing blockchain transactions through the input parameter `alwaysVisible`. This parameter controls whether the Arcana wallet UI is automatically displayed in the application's context right after a user authenticates or it shows up only when the app triggers a blockchain transaction that requires the user's approval. For details, see [Arcana wallet visibility modes](../../concepts/anwallet/walletvisibility/). Does the Arcana Auth SDK set `window.ethereum` value in the app's context? By default, Arcana wallet does not set the `window.ethereum` value in the app's context. To explicitly set this value, during the integration of the app with the Arcana wallet, when `AuthProvider` is instantiated, developers must specify the `setWindowParameter=true`. For details, see the [Arcana wallet Usage Guide](../../auth/auth-usage-guide/). How is the in-app Arcana wallet different from self-custodial wallets? Arcana wallet is a non-custodial wallet. Here is how it differs from the self-custodial wallets: | Self-custodial wallets | Arcana's non-custodial wallet | | --- | --- | | Users need to be responsible for and remember their passphrases. | Users are not required to remember any passphrase. | | Users need to manage keys themselves in case of self-custody wallets. | Arcana wallet offers a sweet spot, users don't have to manage keys as in the self-custody wallet and yet their keys can be generated in a distributed manner via the Arcana wallet, a non-custodial wallet. | | Users who are new to Web3 typically find self-custodial wallets very challenging to use. | Arcana wallet offers a really simple Web2-like onboarding experience for new Web3 users without sacrificing security and ownership. | ## User Key Privacy ______________________________________________________________________ If Arcana is storing nothing related to the user's private keys, how does Arcana provide the same wallet to a user when the user signs in for the second time? The Arcana Auth SDK maintains a UserID -> Public Key mapping, that is how the user is identified across successive login sessions and the correct wallet is assigned for the authenticated user. This mapping is stored in the DKG nodes. How does the Arcana Auth SDK ensure that the key shares are fetched by the correct user only? A user can log in only after the social login provider authenticates or if the user provides the OTP shared via email during passwordless onboarding. Providers share JWT/other identifiers with Arcana Auth SDK once the user authenticates. So unless the user themselves share their social ID / OTP, only an authenticated user will be allowed to access their key shares. The token (idToken) is verified with the DKG nodes before the key shares are sent back to the user. The token can be used only once per user login session. Can a malicious entity reconstruct the user's private key if they get all the requisite key shares? There are several safeguards against this and we are continuously evolving the ADKG protocol to make it more robust and fast. One of the methods is MFA. When the MFA feature is enabled, it further strengthens the security by using multiple factors to generate the private key besides the key shares. A local share is created for the user at the first login that lives on the user's device. This local key component stored on the user's device is required to get the actual private key. If a user changes the device, they are validated via PIN setup during MFA or security answers before the local share is re-created on the new device. Irrespective of whether MFA is enabled or not, the reconstruction of the private key happens only after ensuring that the user is: - authenticated through one of the configured social login providers, - verified by DKG before sharing the key shares. The verification token ID changes for every user session so a malicious entity cannot reuse it. Also, note that the same set of key shares is not returned for every user session by the DKG nodes. Only a random subset of shares is needed to construct the private key. In a future version of the ADKG protocol, the key shares will be periodically refreshed to safeguard against an eventuality if some of them are somehow stolen by a malicious user. # Arcana Developer Dashboard ## General ______________________________________________________________________ Is it mandatory to use the Arcana Developer Dashboard before integrating with the Arcana Auth SDK to enable social login? Yes. To integrate any app with the Arcana Auth SDK, it is not sufficient to simply download and install the SDK. A unique Client ID is also required. This is available once the app is registered using the Arcana Developer Dashboard. Note that the Client ID per app is different when using Testnet or Mainnet. When deploying the app on Testnet use the Client ID meant for Testnet and vice-versa. How do I delete the application configuration and start afresh? To delete an application from Arcana ecosystem, follow these instructions: - Log into the Arcana Developer Dashboard. - In the **Manage Apps** screen, select the card displayed there for the registered application you wish to delete. - Click the trash icon on the top right and delete the app entry. - The application registration will be canceled and the **Client ID** assigned to your application will no longer work. De-register & Delete App How do I migrate an application from using Arcana Testnet to Mainnet? To migrate an application from using the Arcana Testnet to Mainnet, follow these steps: 1. Use the Arcana Developer Dashboard, visit the 'Manage App' page, and select the application entry. By default, when you register any application, a 'Testnet' configuration profile is created for the application. Click on the app card to see the application configuration screen. 1. On the application configuration screen, switch the network from 'Testnet' to 'Mainnet' on the top right to create a 'Mainnet' configuration profile. You will be asked to approve the creation of the 'Mainnet' configuration profile. To begin with, you can use a copy of the 'Testnet' profile to generate the 'Mainnet' profile. Later, you can edit and manage it independently. Note that a new **Client ID** is assigned to the 'Mainnet' profile. 1. Use the 'Mainnet' profile **Client ID** and update it in the app integration code instead of the earlier value which corresponds to 'Testnet'. You will need to restart your application after this change. This is important to ensure that the app uses the 'Mainnet' configuration settings. Use appropriate **Client ID** To migrate an app from using Testnet to Mainnet, the developers must ensure that the new **Client ID** corresponding to the application's 'Mainnet' profile is used to initialize the `AuthProvider` while integrating the app with the Arcana Auth SDK. After that, the app must be restarted to switch over from using Arcana Testnet to the Mainnet. Can a developer run one instance of the app, say dev version on Testnet while publishing the release instance to use the Arcana Mainnet? Yes, developers can run two instances of the app simultaneously, one on the Arcana Testnet and the other on the Mainnet as each app instance is assigned a unique **Client ID**. Use the 'Mainnet' configuration profile **Client ID** in your app's integration code and instantiate the `AuthProvider`. Then deploy this app instance to use Arcana Mainnet. Similarly, use the 'Testnet' configuration profile **Client ID** in another copy (branch / different version of the code) of your app where Arcana Auth SDK is integrated and instantiate the `AuthProvider`. Then deploy this app instance to run it using the Arcana Testnet. How do I delete Mainnet configuration settings and run my application using Arcana Testnet only? Once you have enabled 'Mainnet' for an application, you cannot delete the 'Mainnet' configuration profile independently in the current release. You can [switch your application from 'Mainnet' to 'Testnet'](../../setup/config-dApp-with-db/#switch-profile) by using the dropdown button in the application configuration screen to edit or modify it. The only way to delete Mainnet settings is to deregister the app and delete the app entry altogether. This removes both Testnet and Mainnet configuration profiles. You will need to re-register the application. This will create a new **Client ID** and you will be required to specify this new Client ID when integrating your application with the Arcana Auth SDK. As a result, when you deploy your app and the users log in, they will see brand-new wallet addresses. If you wish to ensure that the user wallet address does not change, you must register your application and request for the [Shared Key Space](../../concepts/keyspace-types/) option at the very start. In that case, users will be allowed to use the same wallet address across all applications in the Arcana ecosystem and even if an application is de-registered and re-registered. ## Branding Settings Why do I see an error when uploading the logo file? Make sure the file is less than the 1 MB limit for a successful upload. How do I change the logo file that I uploaded earlier? Click on the 'x' icon next to the uploaded logo file. You will see a notification about the successful deletion of the file. Click on the upload icon and upload a new logo file. ## Social Auth Settings ______________________________________________________________________ Is it mandatory to specify all configurations in the Arcana Developer Dashboard *Configure* section? No. If no authentication provider is configured via the Arcana Developer Dashboard, the app users can log in through the default passwordless option that requires no configuration. Developers can use the `connect` method to bring up plug-and-play login UI or build a custom login UI. When using the custom login UI, call the `loginWithLink` method (deprecated), `loginWithOTPStart` and `loginWithOTPComplete` methods to onboard users. Besides the default passwordless login option, developers can choose to enable one or more authentication providers as the onboarding options for users. That requires configuring authentication providers through the Arcana Developer Dashboard. For details, check out [how to configure authentication providers](../../setup/). Can an application enable more than one authentication provider to onboard users? Yes. Developers can configure one or more authentication providers as additional onboarding options besides the default passwordless login option. Users can choose any one of the supported authentication mechanisms to onboard the app. ## Wallet Settings ______________________________________________________________________ Why do I need to specify Wallet Website Domain setting? This is an optional setting for additional security. If specified, the Arcana Auth SDK configuration subsystem uses this setting to restrict the Arcana wallet from loading anywhere else other than the application website domain that a developer specifies. for restricted domains, the [frame-ancestor Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/web/http/headers/content-security-policy#frame-ancestors) is used. Is there a way to control when, which position in the application window, and what kind of theme is used for displaying the Arcana wallet in the apps' context? **Wallet Display Controls** 1. **Visibility** The application developer can use the `alwaysVisible` parameter in the `AuthProvider` to control whether the Arcana wallet UI is automatically displayed once the user has authenticated (default) or it shows up only when a blockchain transaction is triggered that requires the user's approval. If `AuthProvider` is instantiated with `alwaysVisible = false` then the wallet UI will not be displayed by default in the app's context. However, when a blockchain transaction is triggered by the app, a transaction notification is displayed in the app's context, requesting the user's approval for the transaction. Once the user takes the appropriate action, the transaction notification will disappear. For more details, see [Arcana wallet visibility modes](../../concepts/anwallet/walletvisibility/). 1. **Position** The `position` parameter in the `AuthProvider` controls whether the wallet is displayed on the left or the right side of the Web3 app UI window. 1. **Light/Dark Theme** The `theme` parameter in the `AuthProvider` controls whether the wallet is displayed using the light theme or the dark theme. Developers can set the theme via the Arcana Developer Dashboard by using the 'Branding' tab on the LHS. Can any Web3 app user access the in-app Arcana wallet? No. The in-app Arcana wallet is accessible by the authenticated users only if the app is integrated with the Arcana Auth SDK. Web3 users cannot download and install the in-app wallet like other standalone, browser-based third-party wallets. ## Integrating Web3 Apps ______________________________________________________________________ How can I enable the [social login](../../concepts/social-login/) in a Web3 app? Web3 developers can simply download and integrate dApps with the Arcana Auth SDK. Login to the Arcana Developer Dashboard to configure Arcana Auth SDK usage settings before actually integrating the application. How can I access in-app Arcana wallet in the context of a Web3 applications? App users can access the in-app Arcana wallet in the context of a Web3 application only if the app developer has integrated it with the Arcana Auth SDK. Web3 app developers can enable the in-app Arcana wallet by: 1. [Registering the app](../../setup/config-auth/register-app/) and [configuring the app settings](../../setup/config-auth/) using the Arcana Developer Dashboard. 1. Download and install the [Arcana Auth SDK](https://www.npmjs.com/package/@arcana/auth) and then use the unique Client ID assigned to the registered app in the dashboard to [integrate the app](../../auth/integrate/vanilla-html-css-js/) with the Arcana Auth SDK. 1. Add code in the app to use the Arcana Auth SDK functions and [onboard users](../../auth/onboard/vanilla/use-plug-play-auth/). The authenticated users can instantly access the Arcana wallet in the app context and sign blockchain transactions. Developers can control the user experience for signing blockchain transactions with the appropriate [wallet visibility](../../concepts/anwallet/walletvisibility/) specification. The in-app wallet can be displayed for the authenticated users in the app context always or the app can be configured to display blockchain transaction request notifications for approval by the user only when a transaction is triggered. Developers can display the wallet as per the application logic using the `showWallet()` function. How can developers access the standard EIP-1193 provider from the `AuthProvider` object once the Arcana Auth SDK is integrated with the Web3 app? In the case of EVM chains, developers can access the EIP-1193 provider once an `AuthProvider` object is created and the `init` function is successful. See code snippets below for details: ``` // ethers const provider = new ethers.providers.Web3Provider(auth.provider) // web3js const provider = new Web3(auth.provider) ``` ## Application Frameworks ______________________________________________________________________ Does the Arcana Auth SDK support Web3 application frameworks such as React, Next.js, Vue? Yes. You can integrate the Arcana Auth SDK with any vanilla HTML/CSS/JS app or an app that uses React, Next.js, and Vue frameworks. [Learn more...](../../auth/integrate/vanilla-html-css-js/) ## Wallet Connectors ______________________________________________________________________ If an application uses wallet connector frameworks such as Wagmi, RainbowKit, WalletConnect or Web3-React, can the in-app Arcana wallet be plugged into those wallet connectors? Yes. - Applications using Wagmi, RainbowKit or WalletConnect must install and integrate with the `auth`, `auth-wagmi` packages. - Applications using Web3-React framework can install and integrate with the `auth`, `auth-web3-react` packages. As part of the integration, these applications can enable the Arcana wallet as one of the wallet choices for the app users in addition to the built-in wallets available in the wallet connect frameworks. For step-by-step integration instructions for these wallet connector frameworks, see how to [integrate Wagmi apps](../../auth/integrate/wagmi/), how to [integrate RainbowKit apps](../../auth/integrate/rainbow/), how to [integrate WalletConnect apps](../../auth/integrate/walletconnect/), and [how to integrate Web3-React apps](../../auth/integrate/web3-react/). ## User Onboarding ______________________________________________________________________ How do I enable the Web2-like social login experience in a Web3 app to onboard users? 1. Register the app with the Arcana Network. 1. Configure one or more authentication providers for onboarding app users by configuring the **Social Auth** settings using the Arcana Developer Dashboard. 1. Integrate the app with the Arcana Auth SDK and add code to onboard users. For example, see [how to onboard users via Google](../../auth/onboard/vanilla/custom-ui/build-social/google-oauth/). Is there a passwordless login option to onboard the users? The passwordless login option to onboard app users is enabled once the app registers through the Arcana Developer Dashboard and then integrates with the Arcana Auth SDK. Initialize the Arcana Auth SDK and use the `connect` method to bring up the built-in, [plug-and-play login UI](../../auth/onboard/vanilla/use-plug-play-auth/) that allows passwordless login. Alternatively, add custom login UI and call the Arcana Auth SDK methods for passwordless login. See [how to enable passwordless login](../../auth/onboard/vanilla/custom-ui/build-pwdless-auth/) for details. ## Deployment ______________________________________________________________________ Does each registered app have a single unique Client ID? No. Each app registered with the Arcana using the Arcana Developer Dashboard is assigned not one but two unique Client ID. One for the Testnet configuration profile and a different Client ID for the Mainnet configuration profile. What is the difference between Testnet and Mainnet? Arcana Testnet and Mainnet are two **different** blockchain networks. The features offered by the Arcana Auth SDK available on Testnet may be different from the ones available on the Mainnet. Following are the key differences between Arcana Testnet and Mainnet: - **Client ID**: To deploy the app on Testnet, the developer must specify the Client ID assigned to the Testnet configuration profile after app registration, when creating the `AuthProvider`. Similarly, for Mainnet deployment, the Client ID assigned to the Mainnet configuration profile should be used. - **Key/Wallet Address**: The authenticated user is assigned a unique key/wallet address for Testnet app deployment. The same user is assigned a different key/wallet address when this app is deployed on the Mainnet. - **Billing**: App usage is tracked for both the Arcana Testnet as well as the Mainnet. However, only Mainnet usage is billed. What is the difference in the in-app Arcana wallet behavior when an app is deployed on Testnet vs. the Mainnet? If a user logs into the app that is integrated with the Arcana Auth SDK and deployed on the Arcana Testnet, they will see a warning on the main 'Token Assets' tab of the built-in Arcana wallet UI. The warning indicates that the app is deployed on the Testnet. There is no such warning displayed in the Arcana wallet UI when the app is deployed on the Mainnet. How does a developer migrate an app deployed on the Arcana Testnet to Mainnet? See [how to migrate an app deployed on Testnet to Mainnet](../../deploy/migrate-testnet-mainnet/) for details. Are there any configuration changes that must be done when migrating an app deployed on Testnet to the Mainnet? Yes. Following are the configuration changes required for migrating app deployment from the Testnet to the Mainnet: **1. Create a Mainnet Configuration Profile**: To deploy the app on Mainnet, developers need to first create a Mainnet configuration profile by either copying the Testnet profile or creating a fresh one from scratch. **2. Redirect URI**: After creating the 'Mainnet' profile, developers **must** also update the social login provider 'Redirect URI' settings via the respective provider developer consoles or dashboards. Copy the 'Redirect URI' displayed for the 'Mainnet' profile and update this value in the social login provider's developer console. For e.g., for Google, update the Redirect URI in the Google Developer Console. [Learn more...](../../setup/config-social/google-oauth/) **3. Update Client ID**: The Client ID specified as the input parameter while integrating the app with the Arcana Auth SDK is the one assigned to the default Arcana Testnet profile. This works fine when the app is deployed on the Testnet. For deploying the app on the Mainnet, the developer must create the Mainnet configuration profile and carefully copy the newly assigned Mainnet Client ID. Use the Mainnet Client ID as the input parameter while integrating the app with the Arcana Auth SDK. This will ensure that the app gets deployed on the Mainnet and not on the Testnet. For details, see [how to migrate an app deployed on the Testnet to the Mainnet.](../../deploy/migrate-testnet-mainnet/) # Using MultiversX ## Configuration ______________________________________________________________________ Is MultiversX the only non-EVM chain supported by the Arcana Auth SDK? No. Refer to the [list of pre-configured, supported chains - EVM and non-EVM](../../web3-stack/chains/) for details. Can a developer choose to use some EVM-compatible chains along with MultiversX in an app? No. Either EVM-compatible chain type or MultiversX (non-EVM-compatible chain type) chains can be used at a time in an app. When a user logs into an app that is enabled for MultiversX the keys (wallet address) are different from the one assigned to the same user when EVM-compatible chain is selected or a different non-EVM chain is selected. ## Keys Why are the MultiversX keys different from EVM-compatible chains? MultiversX uses [BLS multi-signature](https://en.wikipedia.org/wiki/BLS_digital_signature) cryptographic keys. BLS is different from the [secp256k1](https://www.secg.org/sec2-v2.pdf) curve used for EVM-compatible chains. ## Shard Selection What is the impact of selecting the same shard in two different apps registered via the dashboard? MultiversX uses [adaptive state sharding](https://docs.multiversx.com/technology/adaptive-state-sharding/) for horizontal scaling. Shards allow it to process far more transactions through parallelization, improving transaction throughput and efficiency. If two apps are configured to use the same shard, then all the app interactions whether they are with the app contracts on the same shard or between the wallets of the users across these two apps will be faster. ## Seed Phrase When is the seed phrase displayed? When you log into a Web3 app for the first time that uses the MultiversX chain and integrates with the Arcana Auth SDK, the system displays a 24-word seed phrase. You can copy this seed phrase or save it as a PDF file using the "print as PDF" option. You must verify and save this seed phrase immediately, as it will not be shown again. After this initial display, you won't be able to access the seed phrase through the Arcana wallet interface in future logins. ## Export MVX Wallet How can a user export MVX wallet credentials from the app using the Arcana Auth SDK? When you first log into a Web3 app using the MultiversX chain and Arcana Auth SDK, copy and save the seed phrase securely. Use this seed phrase to access your MVX wallet via the MVX Portal or MVX Wallet app. [Learn more...](https://docs.multiversx.com/wallet/wallet-extension/#import-existing-wallet) # Using Near ## Configuration ______________________________________________________________________ Is Near the only non-EVM chain supported by the Arcana Auth SDK? No. Refer to the [list of pre-configured, supported chains - EVM and non-EVM](../../web3-stack/chains/) for details. Can a developer choose to use some EVM-compatible chains along with Near in an app? No. Either EVM-compatible chain type or Near (non-EVM-compatible chain type) chains can be used at a time in an app. When a user logs into an app that is enabled for Near chain, the keys (wallet address) are different from the ones assigned to the same user when an EVM-compatible chain is selected or a different non-EVM chain is selected. ## Keys Why are the Near keys different from EVM-compatible chains? TBD # Using Solana ## Configuration ______________________________________________________________________ Is Solana the only non-EVM chain supported by the Arcana Auth SDK? No. Refer to the [list of supported chains - EVM and non-EVM](../../web3-stack/chains/) for details. Can a developer choose to use some EVM-compatible chains along with Solana in an app? No. Either EVM-compatible chain type or Solana (non-EVM-compatible chain type) chains can be used at a time in an app. When a user logs into an app that is enabled for Solana the keys (wallet address) are different from the one assigned to the same user when EVM-compatible chain is selected. ## Keys Why are the Solana keys different from EVM-compatible chains? The cryptographic keys used by Solana are based on [ED 25519 curve](https://en.wikipedia.org/wiki/EdDSA#Ed25519). This is different from the [secp256k1](https://www.secg.org/sec2-v2.pdf) curve used for EVM-compatible chains. # Validator Onboarding Frequently asked questions regarding setting up [Arcana DKG validator nodes](../../concepts/validator-nodes/). ## General ______________________________________________________________________ What role do validators play in the Arcana Network? Validator nodes refer to partner infrastructure that participates in the distributed key generation protocol (DKG). This is used to assign unique keys to authenticated users and manage them in a decentralized manner. Validators play a key role in achieving the decentralization goal thereby making Arcana Network more secure and truly open. Where do I get the DKG binaries from? Refer to the [latest DKG release](https://github.com/arcana-network/adkg/releases) at GitHub. What is starting ceremony? It is mandatory for all nodes in the Arcana DKG subsystem to start at the same time for the protocol to function correctly. This is referred to as the starting ceremony aimed at synchronizing the start of DKG nodes. Node crashed at startup with 'tx fees exceed the configured cap' error DKG Node Start Error You will see this error if you are not using the latest DKG binary. After the node crash, before restarting, please make sure that there is no `dkg.sock` file and that you are using the [latest DKG release](https://github.com/arcana-network/adkg/releases) before issuing the `dkg start` command. See [restarting a node](../../validators/onboard-validators/#steps) section in the Arcana Auth Validator Onboarding Guide. After starting up, I see this. Is this an error? Current Node List Error This is not an error. Your validator node is waiting and polling for the other nodes to start up and join in the DKG protocol. How do I fix the polyfilling issues right after import statement when integrating React and Vite app with the Arcana CA SDK? To fix polyfilling issues, make sure `vite.config.ts` has the polyfilling options configured. ``` import { defineConfig, Plugin } from "vite"; import react from "@vitejs/plugin-react"; import { nodePolyfills, PolyfillOptions } from "vite-plugin-node-polyfills"; import tailwindcss from "@tailwindcss/vite"; const nodePolyfillsFix = (options?: PolyfillOptions | undefined): Plugin => { return { ...nodePolyfills(options), resolveId(source: string) { const m = /^vite-plugin-node-polyfills\/shims\/(buffer|global|process)$/.exec( source ); if (m) { return `node_modules/vite-plugin-node-polyfills/shims/${m[1]}/dist/index.cjs`; } }, }; }; // https://vite.dev/config/ export default defineConfig({ plugins: [ react(), tailwindcss(), nodePolyfillsFix({ include: ["buffer"], globals: { Buffer: true, global: true, process: true, }, }), ], define: { "process.env": {}, }, }); ``` Is there a refund if a chain abstracted transaction fails after funds have been pulled out of the source chains in the user's EOA? For chain abstracted transaction safety, follow these guidelines: 1. **Failed transactions?** *Don't panic* - you'll get your tokens back automatically in the next settlement cycle (usually within 15 minutes but it may take an hour in some cases). 1. **Before transacting:** Always check the transaction details including the gas fee requirements, before issuing a transaction. 1. **During transacting:** The status of the chain abstracted transaction is displayed in the app's context. Click on 'View Intent' details link and **save** the unique intent identifier associated with the transaction. You'll need the **intent identifier** if something goes wrong. 1. **Track your transaction:** Use the [Arcana Intent Explorer](https://explorer.arcana.network/) with your intent ID to monitor status. **Critical:** Keep your app/wallet open and logged in if you encounter a failed transaction—refunds require an active session and typically complete within 15 minutes. 1. **No refund after 1 hour:** The protocol auto-retries, but you must stay logged in. If you closed the app/wallet, reopen and log back in to enable refund processing. Did not get a refund? Contact Arcana team via the [support](../../../support/) channels and make sure you mention the **intent identifier** that failed to refund or your wallet address with date / time of the transaction. **Bottom line:** Your funds are protected - failed transactions always get refunded, either automatically or with the team's assistance. Viewing Refund To view the refund, the user must open or log into the app and access the wallet that was used to sign the intent and confirm the chain abstracted transaction. Why is liquidity fragmentation an issue and how does chain abstraction solve it? Liquidity fragmentation is an issue because it makes it difficult for users to spend their assets on any chain. Let us take a simple case of a user's wallet that contains 3 USDC on Arbitrum and 2 USDC on Optimism. If the user intends to send 4 USDC on Base, it is not possible to do so through a traditional wallet because there is liquidity fragmentation for USDC in the wallet across Arbitrum and Optimism. To be able to send USDC on Base, there are multiple complex steps for the user. First, there is no USDC on Base to be sent. The user cannot directly spend USDC on Base even though there are enough USDC tokens when put together on the other two chains in the same wallet account. To spend on Base, the user has to bridge tokens from one or more source chains. That is a complex, multi-step, multi-click, time-consuming process. It also needs non-trivial knowhow about secure bridging and getting the best token exchange deals. Next, the user is required to switch the network to Base and then send the tokens. [Chain Abstraction (CA)](../../../concepts/ca/chain-abstraction/) enables unified balance across source chains that can help the user spend 4 USDC on Base with a single click. The user is not required to manually convert the tokens on Optimism or Arbitrum to make this transaction on Base. With a unified balance, onboarding a new chain does not necessarily require the user to procure tokens on the new chain. The user can pledge or sign an intent to send tokens from any of the source chains to the destination chain. I'm a Web3 dApp developer. how can I enable unified balance for dApp users? Download and [install the appropriate CA SDK flavor](../../../ca/ca-sdk-installation/) as per the app type. - **Web3 apps**: Install the [Arcana CA SDK](https://www.npmjs.com/package/@arcana/ca-sdk). Check out the integration example in [codesandbox](https://codesandbox.io/p/github/arcana-network/ca-sdk-example/main) - Web3 apps using the **Wagmi library**: Install the [Arcana CA Wagmi SDK](https://www.npmjs.com/package/@arcana/ca-wagmi). Try the [codesandbox](https://codesandbox.io/p/github/arcana-network/ca-wagmi-example/main) integration example. Refer to the respective SDK quick start guide for integration details. I'm a Web3 wallet user, how can I enjoy unified balance with chain abstraction? Web3 wallet users can unify assets across chains and spend on any chain. To do this, they must log into a Web3 app that is integrated with the Arcana CA SDK and supports any third-party browser-based wallet. Alternatively, wallet users can [download](https://chromewebstore.google.com/detail/arcana-wallet/nieddmedbnibfkfokcionggafcmcgkpi) and install the Arcana Standalone CA wallet browser extension to try [unified balance](../../../concepts/ca/unified-balance/) in the context of some of the popular [Web3 apps](../../../web3-stack/ca_stack/#apps). Why do users need to pay gas fees to set up CA with Layer 1 chains? When setting up Arcana chain abstraction to include Layer 1 chains, users need ETH to pay gas fees for signing the token allowance transaction with the Arcana vault smart contract. The Arcana standalone CA wallet doesn't cover these Layer 1 chain gas fees. As a result, users who choose to include Layer 1 chains in their CA scope must pay these gas fees themselves to set up the CA allowance. What is a CA allowance and why are allowances needed? Allowance or 'Permit' in the blockchain context allows a third party, such as a smart contract, to perform transactions from a user's EOA for a specified amount — without accessing the user's private key. In Arcana chain abstraction, [allowances](../../../concepts/ca/allowances/) enable unified balance. This lets users spend on any destination chain when they have enough funds and gas fees on their source chains. Which ERC20 tokens does the unified balance feature support? Refer to the latest [supported token list](../../../web3-stack/ca_stack/#tokens). Which chains does the unified balance feature support? Arcana's chain abstraction and unified balance works for some select [chains](../../../web3-stack/ca_stack/#chains) and [tokens](../../../web3-stack/ca_stack/#tokens). We are working on adding support for more chains in the future. Does dApp integration with the Arcana CA SDK enable an in-app wallet like the Auth SDK? No there is no built-in in-app wallet offered by the Arcana SDKs. Web3 apps integrating with the Arcana CA SDK must use a third-party wallet for blockchain transactions. How does a dApp access unified balance for a user account? The dApp must download and integrate with the CA-SDK and use the EIP-1193 provider to access the unified balance in the context of an authenticated user. See [Arcana CA SDK Reference](https://ca-sdk-ref-guide.netlify.app/) and [the usage guide](../../../ca/ca-usage-guide/) for details. Does the Arcana CA SDK enable unified balance and chain abstracted transactions in a Web3 app built using Wagmi? For Web3 app built using Wagmi, integrate with the Arcana CA Wagmi SDK. How do I enable unified balance and chain abstracted `sendTransaction`, `bridge` and `transfer` functions in a Web3 app that uses the Wagmi library? To enable unified balance and chain abstraction in a Web3 app that uses the Wagmi library, integrate the app with the Arcana CA Wagmi SDK. This SDK replaces the Wagmi hooks: `useSendTransaction` and `useWriteContract`. Additionally, it provides hooks such as `useBalance`, `useBalanceModal` and `useCAFn` to enable unified balance plug-and-play popup modal and chain abstracted `bridge` and `transfer` functions. For details see [Arcana CA Wagmi SDK Quick Start Guide](../../../quick-start/ca-wagmi-quick-start/) and the [Arcana CA Wagmi SDK Reference](https://ca-wagmi-sdk-ref-guide.netlify.app/). Who is the target audience for the Arcana CA SDKs? Arcana CA SDKs help Web3 dApp developers handle fragmented blockchain assets, letting users spend on any chain. These SDKs can integrates with dApps to offer unified balances across chains and chain abstracted transactions. For a complete list of real life applications of unified balance, see [use cases](../../../ca/introduction/use-cases/) section. Who is the target audience for the standalone Arcana standalone CA wallet? The standalone Arcana standalone CA wallet is meant for wallet users that want to try unified balance in the context of some of the popular [Web3 apps](../../../web3-stack/ca_stack/#apps). It enables unified balance and solves liquidity fragmentation when using any of the supported [chains](../../../web3-stack/ca_stack/#chains) and [tokens](../../../web3-stack/ca_stack/#tokens) in the context of these supported [Web3 apps](../../../web3-stack/ca_stack/#apps). We will be adding support for newer Web3 apps soon. $100 limit The standalone Arcana standalone CA wallet has a $100 limit for transactions needing chain abstraction. Transfers on the same chain have no limit. Can you give me an example of liquidity fragmentation and how the CA SDK solves it? **Liquidity Fragmentation** Imagine a user with assets spread across chains: Arbitrum: 3 USDC Optimism: 4 USDC Base: 0 USDC Ethereum: 0.001 ETH If the user wants to send 5 USDC to Base, they can't because no single chain has enough funds. Liquidity fragmentation forces the user to make multiple transactions, complicating the process. **How unified balance through chain abstraction solves this?** With chain abstraction, users first set up allowances before issuing a multi-chain transaction intent. In this case, the user signs an intent to send 5 USDC to Base by pledging 3 USDC from Arbitrum and 2.2 USDC from Optimism (including gas and service fees). The intent specifies the amount to be deposited on source chains and the agreed amount received on the destination chain. Arcana's Chain Abstraction protocol collects the pledged tokens and gas fees based on the user's allowances. Once the intent is signed, Arcana processes the 5 USDC transaction on Base and deducts the gas fee from the pledged USDC. Can I request gas tokens using ERC20 through Arcana Chain Abstraction?? Yes, you can request gas tokens using ERC20 via Chain Abstraction. For example, if you have 13 USDC and 0 ETH on Optimism but need to make a 15 USDC transaction requiring 0.0000001 ETH for gas, you'll need an extra 2 USDC plus the gas fee. You can pledge or sign an intent to pay the additional USDC and gas fees using funds from other supported chains like Arbitrum or Base, assuming you have enough USDC to cover the deficit and fees. Once you sign the intent, Arcana CA SDK supplies the needed USDC and gas in a single transaction. Charges include the deficit amount, CA Gas Fees, protocol fees, and Solver fees. *Note: Fees are deducted from the main token requested, such as USDC. Arcana CA SDK supports ETH, USDC, and USDT.* Can a user review intent details before issuing a transaction that requires chain abstraction with two or more source chain tokens? Yes, user's can review the intent details before issuing a CA transaction via the Arcana CA Wallet. Before submitting a transaction, click 'View Intent' to see the intent details. Once the transaction is successful, there are options to view the intent details as well as the transaction details. To view the intent details at a later point in time, you need to save the intent identifier displayed in the details during the transaction, before closing the wallet screen. Use the Arcana Intent Explorer accessible at: and enter the intent ID to view details at a later time. View Intent Details Can I use `transfer` function to deposit chain abstracted unified balance funds to a smart contract and update the blockchain state? No. `transfer` does not support `data`. Use [`request` with `sendTransaction`](https://ca-sdk-ref-guide.netlify.app/#quick-start) to deposit funds to a smart contract and update the blockchain state. Sending 0.1 USDC from 0.3 USDC balance uses funds from other chains. Why isn't this a normal transaction since sufficient balance exists locally? The transaction uses chain abstraction because you need both sufficient tokens AND gas fees for a normal transaction. Even though 0.1 USDC < 0.3 USDC balance, the remaining 0.2 USDC may not cover the gas fees. When local funds can't cover transaction amount + gas fees, the system pulls from other chains' allowances to make up the difference, making it a chain-abstracted transaction instead of normal. # Overview **Arcana** offers **Arcana Auth SDK** that integrates with Web3 apps to enable user onboarding via [social login](../concepts/social-login/). It allows authenticated users to sign blockchain transactions through the in-app, embedded, non-custodial Arcana wallet. ## Get Started ``` flowchart LR subgraph Register [1.Register App] direction LR A0(((Step 1))) --> B0([Dashboard]) B0 --> C0[Register App] --> E0[Client ID] C0 -- Configure App --> D0[SDK Settings] end classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class E0 an-pink ``` ``` flowchart LR subgraph Integrate [2.Integrate SDK with App] direction LR A00(((Step 2))) --> F00[Install SDK] F00 -- Integrate App --> G00[Initialize SDK] E00[ClientID] --> G00 G00 --> H00(Call SDK Functions) end classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class E00 an-pink ``` ## Usage ``` flowchart LR subgraph Step1 [Arcana Auth SDK Usage] direction LR A1(((Start))) -- 1.Register App --> B1(Dashboard Login) B1 --> C1[Get Client ID] --> E1 A1 -- 2.Integrate App --> D1[Install Auth SDK] --> E1[Initialize AuthProvider] --> F1[Social Login Fns] E1 --> G1[Web3 Wallet Ops] end classDef an-pink stroke:#ff4e9f,stroke-width:0.25rem; class C1 an-pink ``` **Key Features** - Onboard users quickly, at scale, via popular [social login providers](../web3-stack/auth/). - Provide instant access to use the in-app, non-custodial Arcana wallet. - Easy to customize and integrate with various [Web3 app types](../auth/sdk-installation/). Current Version Arcana CA SDK: Use [**v1.0.1**](https://www.npmjs.com/package/@arcana/ca-sdk). Arcana Auth SDK: Use [**v1.0.12**](https://www.npmjs.com/package/@arcana/auth). Older versions may encounter potential breaking changes that require app reconfiguration, integration code updates, and redeployment.[Migrate](../migration/main-auth-v1.0.12-migration/) **Arcana Auth SDK v1.0.11 -> v1.0.12**. ## See Also - [Wallet User Guide](../user-guides/wallet-ui/) - [Dashboard User Guide](../setup/config-dApp-with-db/) - [Auth SDK](../concepts/authsdk/) # Arcana Auth SDK v0.2.x -> v0.3.0 Migration This guide is meant for developers who have already integrated apps with an older version of the Arcana Auth SDK and run them using Arcana Network Testnet. If you are new to Arcana Auth SDK, see Quick Start Guides to get started. When you migrate from an older version of the Arcana Auth SDK to v0.3.0, there are some breaking changes. These changes are mostly related to deploying an app on the Arcana Testnet and the use of Arcana Storage SDK (no longer supported). No breaking changes are expected in the Arcana Auth SDK usage related to user onboarding or blockchain transaction signing functions. Also, the Arcana wallet has a revamped, better look in this release. ## What has Changed? - This release **does not** contain Arcana Storage SDK. - Arcana Blockchain is no longer listed in the list of available blockchain networks in the Arcana wallet dropdown. - Now you can use the Arcana Auth SDK and the Arcana wallet on any supported EVM-compatible chain for user onboarding and signing of blockchain transactions. - The blockchain transaction activity is no longer available in the form of a tab in the main Arcana wallet. You can see the activity listed in the newly added combined notification screen in the Arcana wallet . ### Arcana Developer Dashboard - In this release there are some breaking changes in the registered application database schema. If you were already using an older version of the Arcana Auth SDK, you need to re-register and configure your application again using the latest Arcana Developer Dashboard. The **Client ID** assigned to you earlier will not work. You need to re-register and obtain a new one. Make sure you use the new **Client ID** while integrating with the Arcana Auth SDK . ### Arcana Auth SDK - In this release there is no usage change in the Arcana Auth SDK. - After re-registering your app, the dashboard will assign a new **Client ID**. You need to use the new Client ID during integration with the Arcana Auth SDK. ## How to Migrate to v0.3.0 1. You need to re-register your app using the Arcana Developer Dashboard. This is required to obtain a fresh **Client ID** and use that for integrating with the Arcana Auth SDK. The older **Client ID** will **NOT WORK** with the latest Arcana Auth SDK v0.3.0 release. Follow the instructions in the [Registration Guide](../../setup/config-auth/register-app/) to re-register and re-configure your app. 1. If you were using the Arcana Storage SDK, that is no longer supported. You need to stop using Storage SDK in your app for the time being until we begin supporting Storage SDK in a future release. 1. You need to [re-integrate your app with the Arcana Auth SDK](../../auth/integrate/vanilla-html-css-js/) by providing the new **Client ID** after re-registering and configuring your application using the developer dashboard. 1. If you had enabled the **Arcana Testnet** blockchain network in Web3 wallet operations, you will need to remove this network altogether as it no longer exists. Also, the Arcana Testnet Blockchain Explorer is no longer available. Arcana smart contracts are deployed on Polygon now. In this release, the Arcana wallet supports all EVM-compatible chains besides the default ones that show in the drop-down. See [Wallet User Guide](../../user-guides/wallet-ui/use-wallet-ui/). 1. The wallet activity tab on the wallet token asset tab is gone. A new 'notification' tab is available in the wallet. You can see the list of all activities in the [activity tab](../../user-guides/wallet-ui/use-wallet-ui/#transaction-activity). It lists send tokens, contract deployment, and contract interaction transactions performed by the wallet user. ## What's New? The new improved Arcana Auth SDK now supports NFT preview, NFT transactions, and management of NFT collections. A new combined notification screen displays blockchain transactions related to smart contracts, tokens as well as NFTs. For details, see [Arcana Auth SDK release notes](../../relnotes/rn-beta-auth-v0.3.0/). New to Arcana Network? Get started with the Arcana Auth SDK Quick Start Guides. Using an older version and want to migrate? Read on... ## What has Changed? If you are already using the SDK, there are no usage changes in this release. This new release includes support for Custom Auth and wallet UI features for off-ramping crypto to fiat. ## How to Migrate to v1.0.12? Install and upgrade to the latest Arcana Auth SDK v1.0.12. No integration code updates are required for the features in the previous release. If you plan on using the Passkeys, check out the section about [Passkeys](../../concepts/authtype/auth-passkeys/) and [how to onboard users via passkeys](../../auth/passkeys-auth/) in apps integrated with the Arcana Auth SDK. See how to set up user onboarding via [Telegram, Apple](../../setup/) in the setup section of the documentation. Then refer to the usage section for [how to install the SDK, integrate app and onboard users](../../auth/sdk-installation/) depending upon the app type. That's all! ## Previous Releases Are you using an older version of the Arcana Auth SDK? Refer to the [release notes archive](../../relnotes/archives/) and [Migration Guides](../archives/). Upgrade to the latest version. ## Questions? ______________________________________________________________________ Refer to the [Arcana Auth FAQ](../../faq/faq-gen/), [Troubleshooting Guide](../../troubleshooting/), and other developer resources. Can't find what you are looking for? Contact [Arcana Support](../../support/). # Arcana Auth SDK v0.3.0 -> v1.0.0 Migration This guide is meant for developers who have already integrated apps with an older version of the Arcana Auth SDK and run them using Arcana Network Testnet. If you are new to Arcana Network, see Arcana Auth SDK Quick Start Guides to get started. When you migrate from using the Arcana Auth SDK v0.3.0 to the v1.0.0 release, please note that there are a few breaking changes that require you to use Arcana Developer Dashboard and re-register, re-configure the app settings as per the Arcana Auth SDK configuration setting requirements, and obtain a new **Client ID**. Only then you can re-integrate the app successfully with the Arcana Auth SDK . ## What has Changed? The following section lists changes between Arcana Auth SDK v0.3.0 and v1.0.0. Use Latest Release If you are using Arcana Auth SDK v0.2.2 or older, please see [How to migrate to Arcana Auth SDK v0.3.0](../beta-auth-v0.3.0-migration/). ### Arcana Developer Dashboard Earlier, by default, each registered application was associated with a 'Testnet' configuration profile and an **Client ID**. Now you can have a 'Testnet' as well as a 'Mainnet' configuration profile associated with your registered application. Each profile has its unique **Client ID**. You can deploy an app on the Arcana Testnet and run another instance (a stable version) on the Arcana Mainnet. #### Mainnet Configuration Profile - By default, when any new application is registered and configured, a 'Testnet' profile is created. The new dashboard allows developers to also create a 'Mainnet' configuration profile for the app. Developers can create a Mainnet profile and switch to using the Arcana Mainnet or deploy two instances of their app, one for Testnet and the other for Mainnet. - To create the 'Mainnet' profile you can choose to copy the existing 'Testnet' profile or create a new 'Mainnet' configuration profile. Note that a unique, **new Client ID** is assigned to the 'Mainnet' profile whether it is copied or created afresh. - To deploy an app on the Arcana Mainnet, developers are required to perform two things: - First, use the dashboard to create a 'Mainnet' configuration profile for the app and obtain a **new Client ID**. - Second, the developers must also re-integrate their app and update the code where they instantiate the `AuthProvider` appropriately so that the 'Mainnet' **Client ID** is used and the `network` parameter is initialized as `mainnet` in the `AuthProvider` constructor. #### Keyspace in Mainnet Deployments - The 'Mainnet' configuration profile for the app has an additional setting meant for selecting the **Keyspace** type. Developers can choose between the default **App-specific Keys** or **Global Keys**. [Global Keyspace](../../concepts/keyspace-types/) enables a better user experience whereby the user is assigned the same wallet address across applications in the Arcana ecosystem in a secure manner. Enabling the global keys feature requires developer verification and whitelisting. For details, see ['How to Configure Keyspace'](../../setup/config-dApp-with-db/#configure-keyspace) section in the Dashboard User Guide. #### Usage Tracking - In this release, the Developer Dashboard tracks application usage data in terms of MAU, both for Arcana Testnet as well as Mainnet deployments. Billing is applicable only for Mainnet deployments and bills are generated at the end of the month for Arcana Mainnet usage. ### Arcana Auth SDK The Arcana Auth SDK v1.0.0 supports deploying apps on the Arcana Mainnet. As there are breaking changes in the App database schema, you need to re-register your apps using the Arcana Developer Dashboard and obtain a new **Client ID** before you can integrate the app with the Arcana Auth SDK . This is required irrespective of whether you chose to deploy your app on the Arcana Testnet or the Mainnet. To deploy an app on the Arcana Mainnet, you need to first login into the Arcana Developer dashboard, create a 'Mainnet' configuration profile for your app and choose the requisite 'Keyspace' type. In addition to creating the 'Mainnet' configuration profile, developers need to update the Arcana Auth SDK integration code for creating a new `AuthProvider` as follows: - Use the **Client ID** specified to the 'Mainnet' configuration profile in the dashboard - Set the `network` parameter in the `AuthProvider` constructor to 'mainnet' ## How to Migrate to v1.0.0? *Do not jump into installing, and upgrading the Arcana Auth SDK in your sources and running your app.* To successfully use the Arcana Auth SDK, you need to first **re-create your app configuration profile** using the Arcana Developer Dashboard and then integrate your app with the Arcana Auth SDK for onboarding users and enabling the Arcana wallet. If you wish to deploy your app on Arcana Testnet, follow steps 1 and 3. To deploy your app on Arcana Mainnet, follow all three steps: 1. **Reconfigure & Get Client ID**: If you are using v0.3.0, you would already have created a 'Testnet' configuration profile for your app. When you log into the dashboard, this profile will not show up by default. Due to breaking changes in the Arcana Auth SDK release v1.0.0, you will be required to re-register your app using the Arcana Developer Dashboard. When you re-register and create a new profile for the app, by default, it is assigned as a 'Testnet' configuration. This step is mandatory irrespective of whether you want to deploy your app on Arcana Testnet or Mainnet or both. 1. **Mainnet Configuration**: To deploy your app on the Arcana Mainnet, you must first create a 'Mainnet' configuration profile using the Arcana Developer Dashboard. See instructions [here](../../setup/config-dApp-with-db/#manage-configuration-profiles). Once you have the 'Mainnet' configuration profile ready, copy the new **Client ID** assigned to the 'Mainnet' configuration profile. This will be required during Arcana Auth SDK integration later. At the time of 'Mainnet' profile creation, you need to specify whether you would like to use the **App-specific Keys** (default) or use the **Global Keys** feature for your app. To enable the global keys feature, developers must submit a verification form and get approval. Wait to onboard users until you receive a response to your verification request. Otherwise, the wallet address assigned to your app users may change after the **Global Keys** feature takes effect. If you do not choose **Global Keys**, your 'Mainnet' profile is configured to use **App-specific** keys by default. What this means is that your app users will see different wallet addresses across different apps in the Arcana ecosystem. For details, see [Global Keys](../../concepts/keyspace-types/). Update Redirect URI for Mainnet You must update the OAuth redirect URI values for all the social providers configured for your 'Mainnet' profile. Use the respective social provider console to update callback URL values for Mainnet. Copy the new **redirect URI** value from the application's 'Mainnet' configuration settings dashboard page and add it to the list of redirect URIs setup in the OAuth configuration settings for your provider. You would have earlier added the redirect URI for the 'Testnet' configuration profile, now update the 'Mainnet' URI too. That's all. 1. **Install & Integrate**: Install and upgrade the Arcana Auth SDK to v1.0.0. Integrate the Arcana Auth SDK and create a new `AuthProvider` instance by specifying the **Client ID**. If you wish to deploy your app on the Arcana Testnet, provide the **Client ID** listed in the 'Testnet' configuration profile of your app in the dashboard. Also, you need to set the `network` parameter in the `AuthProvider` constructor to `testnet`. This is important because, by default, Arcana Auth SDK v1.0.0 has the `network` parameter set to using 'mainnet'. Similarly, if you want to deploy your app on the Arcana Mainnet, then use the **Client ID** assigned to the 'Mainnet' configuration profile of your app in the dashboard and set the `network` parameter to 'mainnet'. Refer to the examples below to see how to integrate and deploy your app on the Arcana Testnet and Mainnet after successfully registering and configuring the app. ### Example: Deploy on Testnet Register your app using the Arcana Developer Dashboard. By default, the 'Testnet' configuration profile is created. You can provide the social provider settings as per your user onboarding requirements. Save the **Client ID** assigned to your app displayed on the top right of the dashboard screen. This will be required during integration with the Arcana Auth SDK as shown below: ``` import {AuthProvider} from "@arcana/auth"; const provider = new AuthProvider( "xar_test_87f34a9c7879cd4b726ba36a99e164837d70143a", { // testnet Client ID // network: 'testnet', // optional chainConfig: { chainId: '80002', // selected chain in the wallet network dropdown UI rpcUrl: 'https://rpc.ankr.com/polygon_amoy', // RPC URL of the selected chain in the wallet network dropdown UI }, alwaysVisible: true, setWindowProvider: true, debug: true, position: 'right', theme: 'dark', }); ``` Once a user authenticates, the following wallet UI is displayed when the app is deployed on the Arcana Testnet. Testnet Wallet ### Example: Deploy on Mainnet Register your app using the Arcana Developer Dashboard. By default, the 'Testnet' configuration profile is created. Make sure you create a 'Mainnet' profile and save the **Client ID** assigned to your app for the 'Mainnet' configuration. It is displayed on the top right of the dashboard screen. To bring up your app on Arcana Mainnet, in your integration code, use the `Mainnet` **Client ID** and specify the `network` parameter as 'mainnet' while instantiating the `AuthProvider` as shown below: ``` import {AuthProvider} from "@arcana/auth"; const provider = new AuthProvider( "xar_live_d7c88d9b033d100e4200d21a5c4897b896e60063", { //mainnet Client ID // network: 'mainnet', // optional chainConfig: { chainId: '137', // selected chain in the wallet network dropdown UI rpcUrl: 'https://polygon-rpc.com/', // RPC URL of the selected chain in the wallet network dropdown UI }, alwaysVisible: true, setWindowProvider: true, debug: true, position: 'right', theme: 'dark', }); ``` Once a user authenticates, the following wallet UI is displayed when the app is deployed on the Arcana Mainnet. Mainnet Wallet ## What's New? Besides Testnet/Mainnet and Global Keyspace features, the Arcana Auth SDK v1.0.0 uses a new, improved asynchronous distributed key generation (ADKG) subsystem. In addition to the DKG nodes operated by Arcana, two nodes are run and managed by Comdex and LugaNodes. For more details, see [Arcana Auth SDK v1.0.0 release notes](../../relnotes/rn-main-auth-v1.0.0/) for details. # Arcana Auth SDK v1.0.0 -> v1.0.1 Migration This guide is meant for developers who have already integrated apps with Arcana Auth SDK v1.0.0 and run them using Arcana Testnet. If you are new to Arcana Network, see Arcana Auth SDK Quick Start Guides to get started. ## What has Changed? The following section lists changes between Arcana Auth SDK v1.0.0 and v1.0.1. ### Arcana Developer Dashboard No changes or updates in the dashboard usage. ### Arcana Auth SDK When you migrate from using the Arcana Auth SDK v1.0.0 to the v1.0.1 release, there is no breaking change or reconfiguration required. The default setting of the `network` parameter in the `AuthProvider` constructor has changed. Earlier it was set to 'mainnet' but now it is set to 'testnet' by default. ## How to Migrate to v1.0.1? 1. If you are deploying your app on the Arcana Testnet, make sure that the app integration code uses the **Client ID** specified in the 'Testnet' configuration profile in the app dashboard. You can set the `network` parameter in the `AuthProvider` constructor as 'testnet' but it is not essential since the default setting in the Arcana Auth SDK v1.0.1 is 'testnet'. 1. If you are deploying your app on the Arcana Mainnet, make sure that the app integration code uses the **Client ID** assigned to the 'Mainnet' configuration profile in the app dashboard. Also, you need to specify the `network` parameter in the `AuthProvider` constructor as 'mainnet' in order to deploy your app on the Arcana Mainnet. This is important because, by default, the Arcana Auth SDK uses 'testnet' as the default `network` value. 1. Upgrade your Arcana Auth SDK to v1.0.1 and you are good to go. ### Example: Deploy on Testnet If you have not already registered, only then register your app using the Arcana Developer Dashboard. By default, the 'Testnet' configuration profile is created. You can provide the social provider settings as per your user onboarding requirements. Save the **Client ID** assigned to your app displayed on the top right of the dashboard screen. This will be required during integration with the Arcana Auth SDK as shown below: ``` import {AuthProvider} from "@arcana/auth"; const provider = new AuthProvider( "xar_test_87f34a9c7879cd4b726ba36a99e164837d70143a", { // testnet Client ID // network: 'testnet', // optional chainConfig: { chainId: '80002', // selected chain in the wallet network dropdown UI rpcUrl: 'https://rpc.ankr.com/polygon_amoy', // RPC URL of the selected chain in the wallet network dropdown UI }, alwaysVisible: true, setWindowProvider: true, debug: true, position: 'right', theme: 'dark', }); ``` Once a user authenticates, the following wallet UI is displayed when the app is deployed on the Arcana Testnet. Testnet Wallet ### Example: Deploy on Mainnet If you have not already registered your app using theArcana Developer Dashboard , only then register it. By default, the 'Testnet' configuration profile is created and associated with a 'Testnet' **Client ID**. If you want to deploy on the Arcana Mainnet, then make sure you create a 'Mainnet' profile using the Arcana Developer Dashboard. Save the **Client ID** assigned to your app for the 'Mainnet' configuration. It is displayed on the top right of the dashboard screen when you select 'Mainnet' from the dropdown or when you click on the 'Mainnet' button displayed on the app card in the **Manage Apps** screen. In the app integration code, use the `Mainnet` **Client ID** and specify the `network` parameter as 'mainnet' while instantiating the `AuthProvider` as shown below: ``` import {AuthProvider} from "@arcana/auth"; const provider = new AuthProvider( "xar_live_d7c88d9b033d100e4200d21a5c4897b896e60063", { //mainnet Client ID // network: 'mainnet', // optional chainConfig: { chainId: '137', // selected chain in the wallet network dropdown UI rpcUrl: 'https://polygon-rpc.com/', // RPC URL of the selected chain in the wallet network dropdown UI }, alwaysVisible: true, setWindowProvider: true, debug: true, position: 'right', theme: 'dark', }); ``` Once a user authenticates, the following wallet UI is displayed when the app is deployed on the Arcana Mainnet. Mainnet Wallet ## What's New? This release has no new features. For more details about this release, see [Arcana Auth SDK v1.0.1 release notes](../../relnotes/rn-main-auth-v1.0.1/) for details. # Arcana Auth SDK v1.0.9 -> v1.0.10 Migration New to Arcana Network? Visit see Arcana Auth SDK Quick Start Guides to get started. Using an older version and want to migrate? Read on... ## What has Changed? In this release there are **no usage changes** from the previous version of the SDK. This new release includes support for Web3 gaming apps based on the Unity framework, support for MultiversX chain in the Arcana wallet, and minor bug fixes. ## How to Migrate to v1.0.10? Install the latest Arcana Auth SDK v1.0.10. No integration code updates are required for the features in the previous release. ### MultiversX Support If you wish to use this new release and add support for MultiversX in your app, there may be some changes related to the [configuration of MultiversX](../../setup/config-dApp-with-db-for-mvx/) as the default chain in the dashboard. Note that the [supported Web3 wallet operations for the MultiversX chain](../../auth/web3-ops/mvx/) are different from those for the EVM-compatible chains. See [MultiversX Quick Start Guide](../../quick-start/mvx-quick-start/) for more details. That's all! # Arcana Auth SDK v1.0.10 -> v1.0.11 Migration New to Arcana Network? Get started with the Arcana Auth SDK Quick Start Guides. Using an older version and want to migrate? Read on... ## What has Changed? In this release there are **no usage changes** from the previous version of the SDK. This new release includes support for Custom Auth and wallet UI features for off-ramping crypto to fiat. ## How to Migrate to v1.0.11? Install and upgrade to the latest Arcana Auth SDK v1.0.11. No integration code updates are required for the features in the previous release. If you plan on using the Custom Auth or wallet off-ramping feature, check out the following documentation updates: - What is [Custom Auth](../../concepts/authtype/custom-auth/)? - [How to configure](../../setup/config-custom-auth/) Custom Auth feature usage via the Arcana Developer Dashboard? - [How to integrate an app that uses custom user authentication](../../auth/custom-auth/) and enable Arcana Auth SDK and signing of blockchain transactions for authenticated users? - [How to buy/sell crypto](../../user-guides/wallet-ui/use-wallet-ui/#buysell-crypto) when using Arcana wallet? That's all! # Arcana Auth SDK v1.0.11 -> v1.0.12 Migration New to Arcana Network? Get started with the Arcana Auth SDK Quick Start Guides. Using an older version and want to migrate? Read on... ## What has Changed? If you are already using the SDK, there are no usage changes in this release. This new release includes support for Custom Auth and wallet UI features for off-ramping crypto to fiat. ## How to Migrate to v1.0.12? Install and upgrade to the latest Arcana Auth SDK v1.0.12. No integration code updates are required for the features in the previous release. If you plan on using the Passkeys, check out the section about [Passkeys](../../concepts/authtype/auth-passkeys/) and [how to onboard users via passkeys](../../auth/passkeys-auth/) in apps integrated with the Arcana Auth SDK. See how to set up user onboarding via [Telegram, Apple](../../setup/) in the setup section of the documentation. Then refer to the usage section for [how to install the SDK, integrate app and onboard users](../../auth/sdk-installation/) depending upon the app type. That's all! # Arcana Auth SDK v1.0.1 -> v1.0.2 Migration This guide is meant for developers who have already integrated apps with an older version of the Arcana Auth SDK and run them using Arcana Testnet. If you are new to Arcana Network, see Arcana Auth SDK Quick Start Guides to get started. When you migrate from using the Arcana Auth SDK v1.0.1 to the latest v1.0.2 release, there is no major update besides minor bug fixes and wallet UI updates. ## What has Changed? The following section lists changes between Arcana Auth SDK v1.0.1 and v1.0.2. ### Arcana Developer Dashboard **App Address** is now referred to as **Client ID** in the dashboard. The format of the unique identifier associated with all registered apps has changed. ### Arcana Auth SDK - Arcana wallet now supports fiat/on-ramp feature that allows users to buy cryptocurrency and tokens. - The wallet UI has a new minimized widget. - A bug in the previous release allowed users to log into a different app using the same tab where they had logged in without having to explicitly log in to a different app in the same tab. This is now fixed. For details, see the [release notes](../../relnotes/rn-main-auth-v1.0.2/). ## How to Migrate to v1.0.2? Upgrade the Arcana Auth SDK to the latest package v1.0.2. No other change is required. You **do not** need to re-register your apps via the dashboard. Developers can continue to use the old **App Address** obtained for using v1.0.0/v1.0.1 with the latest Arcana Auth SDK. However, if you re-register your app and get a new **Client ID**, you cannot use older versions of the Arcana Auth SDK and are required to migrate to the latest Arcana Auth SDK v1.0.2 or higher. Client ID Earlier, the documentation may have referred to the unique Arcana identifier assigned to each app after registration as **App Address**. In the latest release, we refer to it as **Client ID**. ## What's New? See [Arcana Auth SDK v1.0.2 release notes](../../relnotes/rn-main-auth-v1.0.2/) for details. # Arcana Auth SDK v1.0.2 -> v1.0.3 Migration This guide is meant for developers who have already integrated apps with an older version of the Arcana Auth SDK and run them using Arcana Testnet. If you are new to Arcana Network, see Arcana Auth SDK Quick Start Guides to get started. When you migrate from using the Arcana Auth SDK v1.0.2 to the latest v1.0.3 release, there is no breaking change. ## What has Changed? **No Usage Changes**. ## How to Migrate to v1.0.3? Upgrade the Arcana Auth SDK from v1.0.2 to v1.0.3 and re-run your Web3 app. ## What's New? See [Arcana Auth SDK v1.0.3 release notes](../../relnotes/rn-main-auth-v1.0.3/) for details. # Arcana Auth SDK v1.0.3 -> v1.0.4 Migration This guide is meant for developers who have already integrated apps with v1.0.3 of the Arcana Auth SDK and deploy them using Arcana Testnet or Mainnet. If you are new to Arcana Network, see Arcana Auth SDK Quick Start Guides to get started. ## Backward Compatibility The latest release of the Arcana Auth SDK does not cause any breaking changes for most of the Web3 apps that may have integrated with the earlier release v1.0.3 of the Arcana Auth SDK. Those apps should continue to work with no changes to the app code. Some changes are required in the Arcana Developer Dashboard settings to ensure smooth operation. If the app has explicitly specified a default chain via the `chainConfig` option in the `AuthProvider` then make sure the chain appears in the list of blockchains configured in the Arcana Developer Dashboard. If the chain does not show up, it can be manually added via the [chain management configuration settings](../../setup/config-wallet-chains/) in the dashboard. See the chain management section below for details. ### Same Wallet Address Apps using Arcana Auth SDK v1.0.3 or the latest v1.0.4 should see **no change** in the user wallet address. This is true for all types of apps and supported frameworks, irrespective of whether they are using the global or app-specific keys. Apps deployed earlier will continue to work on the Arcana Testnet and Mainnet. ## New Release: What has Changed? ### Wagmi or RainbowKit Apps Earlier, apps using `auth-wagmi` package v0.0.4 were **not** required to install the `auth` package v1.0.3 but this has changed in the current release. Now Wagmi / RainbowKit Apps need to install both the packages and then as part of integrating with the Arcana Auth SDK, first create `AuthProvider` using the Client ID. Then use the `AuthProvider` to create the `ArcanaConnector`. For details, see how to onboard users in Web3 apps using [Wagmi](../../auth/integrate/wagmi/) or [RainbowKit](../../auth/integrate/rainbow/) wallet connectors. ### Chain Management The latest release allows developers more flexibility as they can configure blockchains displayed in the Arcana wallet dropdown list and set one of them as the default chain by either using the Arcana Developer Dashboard or programmatically through `chainConfig` setting and JSON-RPC calls to add and switch chains. Earlier, developers could programmatically manage chains only via the add/switch chain functions and the default chain setting was done via the `chainConfig` option of the `AuthProvider`. Now this can also be managed using the dashboard. For details, see [how to configure chain settings for the wallet via the dashboard](../../setup/config-wallet-chains/). In the latest release v1.0.4, developers can use the Arcana Developer Dashboard to configure blockchains and specify a default chain. Later, in the app integration code, they can override the default chain programmatically using the `chainConfig` parameter. The default chain configuration setting in the Arcana Developer Dashboard can be overridden with the `chainConfig` option while instantiating the `AuthProvider` **only if** the default chain selected in the `chainConfig` option is present in the list of chains configured through the Arcana Developer Dashboard. If the selected chain is not part of the Arcana Developer Dashboard blockchain settings then the default chain configured in the Arcana Developer Dashboard setting takes precedence and is displayed in the wallet UI. The rest of the dashboard configured ones show in the dropdown list. Chain Configuration Example **Example I** Dashboard setting for App A: `Polygon, Ethereum, Shardeum, Arbitrum (default selection)` `chainConfig` option in the `AuthProvider`: `Shardeum` In this case, the Arcana wallet UI will display `Shardeum` as the default and other chains in the dropdown list as Polygon, Ethereum, and Arbitrum. **Example II** Dashboard setting for App A: `Polygon, Ethereum, Shardeum, Arbitrum (default selection)` `chainConfig` option in the `AuthProvider`: `Avalanche` In this case, the Arcana wallet UI will display `Arbitrum` as the default and other chains in the dropdown list as Polygon, Ethereum, and Shardeum. ### Transaction Summary View When a blockchain transaction is triggered either by the app programmatically or via a wallet user action, a transaction notification pops up in the wallet context displaying the transaction summary along with the option to approve or reject the request. Only when the user clicks 'v' icon on the top right, the notification details are displayed. Earlier, the notification details were displayed by default. ## How to Migrate to v1.0.4? We highly recommend that Web3 apps that are integrated with v1.0.3 releases of the Arcana Auth SDK migrate to the latest Arcana Auth SDK v1.0.4 release. For vanilla HTML/CSS/JS apps or React apps that do not use `window.ethereum` setting, no code changes are required. Just install and upgrade to the latest v1.0.4 release and redeploy the app. However, if the apps use `window.ethereum` browser setting or wallet connectors such as Wagmi or RainbowKit then migrating to the latest release may require some integration code changes. In the case of Wagmi or RainbowKit apps, it requires not only upgrading the `auth-wagmi` package but also installing an additional SDK package and some new code to use the SDK. ### Apps using `windows.ethereum` Previously, Web3 desktop apps could integrate with the Arcana Auth SDK and directly access the [standard EIP-1193 Ethereum provider](https://eips.ethereum.org/EIPS/eip-1193) via `window.ethereum` in the web browser. In the latest release of the Arcana Auth SDK, `window.ethereum` is not automatically set to the provider. To enable this feature, specify `setWindowProvider=true` when creating the `AuthProvider`. For details, see [Arcana Auth SDK Usage Guide](../../auth/auth-usage-guide/). ### Apps using `CHAIN` enum If you are upgrading any app that is using `CHAIN` enum in the `chainConfig` option of the `AuthProvider` to v1.0.4, then there is a breaking change. Update the integration code to **not** use the `CHAIN` enum as it is no longer supported. Instead, use the chain identifier of the chain that you are specifying in the `chainConfig` parameter. For example: ``` const auth = new AuthProvider('xar_test_87f34xxxxxxxxxxxxxxxxxxxxxxxxxxxß7d70143a', { network: "testnet", //defaults to 'testnet' position: "right", //defaults to right theme: "dark", //defaults to dark alwaysVisible: true, //defaults to true which is Full UI mode chainConfig: { chainId: "80002", //defaults to Ethereum rpcUrl: "https://rpc.ankr.com/polygon_amoy" //defaults to 'https://rpc.ankr.com/eth' } }); ``` ### Wagmi or RainbowKit Apps For Wagmi or RainbowKit Apps, see how to onboard users in Web3 apps using [Wagmi](../../auth/integrate/wagmi/) or [RainbowKit](../../auth/integrate/rainbow/) wallet connectors. ### Apps using `chainConfig` setting in `AuthProvider` Apps using the `chainConfig` setting to set the default chain in the Arcana wallet dropdown list must ensure that it is included in the list of configured blockchains in the Arcana Developer Dashboard. The `chainConfig` parameter in the `AuthProvider` setting will only work if the chain is part of the configured chains in the Arcana Developer Dashboard. Otherwise, the wallet user may see a different default chain according to the Arcana Developer Dashboard settings. To ensure the `chainConfig` setting takes effect, the specified chain can be manually added through the Arcana Developer Dashboard interface. For details, see the chain management section above and refer to the [list of supported chains for the wallet](../../web3-stack/chains/). ## What's New? See [Arcana Auth SDK v1.0.4 release notes](../../relnotes/rn-main-auth-v1.0.4/) for details. # Arcana Auth SDK v1.0.4 -> v1.0.5 Migration This guide is meant for developers who have already integrated apps with v1.0.4 of the Arcana Auth SDK and deploy them using Arcana Testnet or Mainnet. If you are new to Arcana Network, see Arcana Auth SDK Quick Start Guides to get started. ## Backward Compatibility The latest release of the Arcana Auth SDK does not cause any breaking changes for apps that have already integrated with v1.0.4 of the Arcana Auth SDK. Install the latest version and upgrade your app. ### Same Wallet Address Apps using Arcana Auth SDK v1.0.4 should see **no change** in the user wallet address irrespective of whether they continue to use the older version on upgrade to v1.0.5 release. This is true for all types of apps and supported frameworks, irrespective of whether they are using the global or app-specific keys. Apps deployed earlier will continue to work on the Arcana Testnet and Mainnet. ## New Release: What has Changed? The latest SDK release has **no usage changes** in the former features. New features have been added that allow user onboarding via Steam and Firebase. ## How to Migrate to v1.0.5? We highly recommend that Web3 apps that are integrated with v1.0.4 releases of the Arcana Auth SDK migrate to the latest Arcana Auth SDK v1.0.5 release. Install the latest Arcana Auth SDK v1.0.5 release and upgrade your app. No other integration code changes are required. Apps using older versions of the Arcana Auth SDK must refer to the [migration guides](../archives/) and upgrade to the latest release if they wish to enable Steam of Firebase user onboarding. ## What's New? See [Arcana Auth SDK v1.0.5 release notes](../../relnotes/rn-main-auth-v1.0.5/) for details. # Arcana Auth SDK v1.0.5 -> v1.0.6 Migration This guide is meant for developers who have already integrated apps with v1.0.5 of the Arcana Auth SDK and deploy them using Arcana Testnet or Mainnet. If you are new to Arcana Network, see Arcana Auth SDK Quick Start Guides to get started. ## Backward Compatibility The latest release of the Arcana Auth SDK does not cause any breaking changes for apps that have already integrated with v1.0.4 of the Arcana Auth SDK. Install the latest version and upgrade your app. ### Same Wallet Address Apps using Arcana Auth SDK v1.0.5 should see **no change** in the user wallet address irrespective of whether they continue to use the older version on the upgrade to the v1.0.6 release. This is true for all types of apps and supported frameworks, irrespective of whether they are using the global or app-specific keys. Apps deployed earlier will continue to work on the Arcana Testnet and Mainnet. ## New Release: What has Changed? The latest SDK release has **no usage changes** in the former features. New features have been added that allow user onboarding via Steam and Firebase. ## How to Migrate to v1.0.6? We highly recommend that Web3 apps that are integrated with v1.0.5 releases of the Arcana Auth SDK migrate to the latest Arcana Auth SDK v1.0.6 release. Install the latest Arcana Auth SDK v1.0.6 release and upgrade your app. No other integration code changes are required. Apps using older versions of the Arcana Auth SDK must refer to the [migration guides](../archives/) and upgrade to the latest release if they wish to enable Steam of Firebase user onboarding. ## What's New? See [Arcana Auth SDK v1.0.6 release notes](../../relnotes/rn-main-auth-v1.0.6/) for details. # Arcana Auth SDK v1.0.6 -> v1.0.7 Migration This guide is meant for developers who have already integrated apps with v1.0.6 of the Arcana Auth SDK and deploy them using Arcana Testnet or Mainnet. If you are new to Arcana Network, see Arcana Auth SDK Quick Start Guides to get started. ## Backward Compatibility The latest release of the Arcana Auth SDK does not cause any breaking changes for apps that have already integrated with v1.0.6 of the Arcana Auth SDK. Install the latest version and upgrade your app. ### Same Wallet Address Apps using Arcana Auth SDK v1.0.6 should see **no change** in the user wallet address irrespective of whether they continue to use the older version on the upgrade to the v1.0.7 release. This is true for all types of apps and supported frameworks, irrespective of whether they are using the global or app-specific keys. Apps deployed earlier will continue to work on the Arcana Testnet and Mainnet. ## New Release: What has Changed? Besides a few enhancements Arcana wallet UI and bug fixes, there are **no usage changes** in the latest release. ## How to Migrate to v1.0.7? We highly recommend that Web3 apps that are integrated with v1.0.6 releases of the Arcana Auth SDK migrate to the latest Arcana Auth SDK v1.0.7 release. Install the latest Arcana Auth SDK v1.0.7 release and upgrade your app. No other integration code changes are required. Apps using older versions of the Arcana Auth SDK must refer to the [migration guides](../archives/) and upgrade to the latest release if they wish to enable Steam of Firebase user onboarding. ## What's New? See [Arcana Auth SDK v1.0.7 release notes](../../relnotes/rn-main-auth-v1.0.7/) for details. # Arcana Auth SDK v1.0.7 -> v1.0.8 Migration This guide is meant for developers who have already integrated apps with v1.0.7 of the Arcana Auth SDK and deploy them using Arcana Testnet or Mainnet. If you are new to Arcana Network, see Arcana Auth SDK Quick Start Guides to get started. ## Backward Compatibility The latest release of the Arcana Auth SDK does not cause any breaking changes for apps that have already integrated with v1.0.7 of the Arcana Auth SDK. Install the latest version and upgrade your app. ### Same Wallet Address Apps using Arcana Auth SDK v1.0.7 should see **no change** in the user wallet address irrespective of whether they continue to use the older version on the upgrade to the v1.0.8 release. This is true for all types of apps and supported frameworks, irrespective of whether they are using the global or app-specific keys. Apps deployed earlier will continue to work on the Arcana Testnet and Mainnet. ## New Release: What has Changed? Arcana Auth SDK release has no major changes, a few enhancements and a bug fix for email validation. **Usage** has not changed in the latest release. For details, see [Arcana Auth SDK v1.0.8 release notes](../../relnotes/rn-main-auth-v1.0.8/). ## How to Migrate to v1.0.8? We highly recommend that Web3 apps that are integrated with v1.0.7 releases of the Arcana Auth SDK migrate to the latest Arcana Auth SDK v1.0.8 release. Install the latest Arcana Auth SDK v1.0.8 release and upgrade your app. No other integration code changes are required. Apps using older versions of the Arcana Auth SDK must refer to the [migration guides](../archives/) and upgrade to the latest release if they wish to enable Steam of Firebase user onboarding. ## What's New? See [Arcana Auth SDK v1.0.8 release notes](../../relnotes/rn-main-auth-v1.0.8/) for details. # Arcana Auth SDK v1.0.8 -> v1.0.9 Migration New to Arcana Network? see Arcana Auth SDK Quick Start Guides to get started. Using an older version and want to migrate? Read on... ## What has Changed? This is a major release of the Arcana Auth SDK since the last release. The updates include: - Arcana Auth SDK - Global Keys feature does not require setting up social logins via the social provider's console - Enhanced security to block clickjacking - New auth-core SDK allows greater customization flexibility with custom Wallet UI ### Global Keys Web3 apps using the **app-specific** keys (default) keyspace do not have to make any changes. If the app developer selects [global keys](../../concepts/keyspace-types/) while configuring the app via the Arcana Developer Dashboard, the social auth settings for enabling the social login providers are **no longer** required. For details, see [Arcana Auth SDK v1.0.9 release notes](../../relnotes/rn-main-auth-v1.0.9/). ## Backward Compatibility The latest release of the Arcana Auth SDK does not cause any breaking changes for apps integrated with v1.0.11 of the Arcana Auth SDK. Install the latest version and upgrade. Apps using older versions of the Arcana Auth SDK must refer to the [migration guides](../archives/) and upgrade to the latest release if they wish to enable Steam of Firebase user onboarding. ### Same Wallet Address Apps migrating to the Arcana Auth SDK v1.0.11 should see **no change** in the user wallet address, irrespective of whether they continue to use the older version or upgrade to this latest release. This is true for all types of apps and supported frameworks, irrespective of whether they are using the global or app-specific keys. Apps deployed earlier will continue to work on the Arcana Testnet and Mainnet. ## How to Migrate to v1.0.9? Install the latest Arcana Auth SDK v1.0.9 and upgrade your app with no changes to the integration code. That's all! # Migration Guide Archives Always use the latest [Arcana Auth SDK](https://www.npmjs.com/package/@arcana/auth). For those using an older version of the SDK, refer to the appropriate migration guide: [Auth SDK v1.0.11 -> v1.0.12](../main-auth-v1.0.12-migration/) [Auth SDK v1.0.10 -> v1.0.11](../main-auth-v1.0.11-migration/) [Auth SDK v1.0.9 -> v1.0.10](../main-auth-v1.0.10-migration/) [Auth SDK v1.0.8 -> v1.0.9](../main-auth-v1.0.9-migration/) [Auth SDK v1.0.7 -> v1.0.8](../main-auth-v1.0.8-migration/) [Auth SDK v1.0.6 -> v1.0.7](../main-auth-v1.0.7-migration/) [Auth SDK v1.0.5 -> v1.0.6](../main-auth-v1.0.6-migration/) [Auth SDK v1.0.4 -> v1.0.5](../main-auth-v1.0.5-migration/) [Auth SDK v1.0.3 -> v1.0.4](../main-auth-v1.0.4-migration/) [Auth SDK v1.0.2 -> v1.0.3](../main-auth-v1.0.3-migration/) [Auth SDK v1.0.1 -> v1.0.2](../main-auth-v1.0.2-migration/) [Auth SDK v1.0.0 -> v1.0.1](../main-auth-v1.0.1-migration/) [Auth SDK v0.3.0 -> v1.0.0](../main-auth-v1.0.0-migration/) [Auth SDK v0.2.x -> v0.3.0](../beta-auth-v0.3.0-migration/) # Get Started: Auth+CA Follow this guide to onboard users in a Web3 app via social login and enable chain abstracted transactions. It explains how *Web3 apps built using the [Wagmi](https://wagmi.sh/)* library can integrate with the Arcana SDKs for social login and chain abstraction. - Integrate with the Arcana Auth Wagmi SDK to enable user onboarding via [social login](../../concepts/social-login/) in Web3 apps. - Once authenticated, users can instantly access the in-app, built-in [Arcana wallet](../../concepts/anwallet/) to sign blockchain transactions. - Integrate with the Arcana CA Wagmi SDK and let users spend on any chain with unified balance. - The SDK implements Wagmi `useSendTransaction` and `useWriteContract` hooks so that the Web3 apps can seamlessly switch to using these same hooks from the Arcana CA Wagmi SDK for enabling chain abstracted transactions. - It offers additional hooks to enable unified balance: `useBalance`, `useBalanceModal`. - The `useCAFn` hook allows chain abstracted `bridge` and `transfer` functionality for [tokens](../../web3-stack/ca_stack/#tokens) on [supported chains](../../web3-stack/ca_stack/#chains). ## Prerequisites Before installing and integrating with the Arcana Auth Wagmi SDK, developers need to configure the authentication settings. - App must be [registered](../../setup/config-auth/register-app/) via the Arcana Developer Dashboard: - Optionally [configure auth settings](../../setup/config-auth/) such as [social login](../../concepts/social-login/), [wallet user experience](../../concepts/anwallet/), etc. ## 1. Install [Download](https://www.npmjs.com/package/@arcana/auth-wagmi) the Arcana Auth Wagmi SDK and install it as a dependency for Web3 app: **Wagmi 2.0** ``` npm install --save @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` npm install --save @arcana/auth-wagmi@2.0.0 @arcana/auth ``` **Wagmi 2.0** ``` yarn add @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` yarn add @arcana/auth-wagmi@2.0.0 @arcana/auth ``` [Download](https://www.npmjs.com/package/@arcana/ca-wagmi) the Arcana CA Wagmi SDK and install it as a dependency for Web3 app: ``` npm install --save @arcana/ca-sdk @arcana/ca-wagmi ``` ## 2. Integrate The Web3 app must add code to integrate the social login and chain abstraction features offered by the respective Arcana SDKs. ### Social Login To enable social login, you need to integrate with the Arcana Auth SDK and add code to create the `AuthProvider`. Use it to onboard Web3 app users via the configured Arcana Wagmi connector. Once authenticated, the users can automatically access the built-in, in-app Arcana wallet and sign blockchain transactions. #### AuthProvider ``` import { AuthProvider } from "@arcana/auth"; import { ArcanaConnector } from "@arcana/auth-wagmi" const auth = new AuthProvider('your-client-id'); const connector = new ArcanaConnector({ auth }); ``` ``` // // For apps using Wagmi versions v2.a.b and auth-wagmi v3.x.y // import { http, createConfig } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' import { coinbaseWallet, injected, walletConnect } from 'wagmi/connectors' import { AuthProvider } from '@arcana/auth' import { ArcanaConnector } from "@arcana/auth-wagmi" let auth: AuthProvider | null; if (!auth) { auth = new AuthProvider( "Your-app-Client-ID" ); } const connector = new ArcanaConnector({ auth }); export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ injected(), coinbaseWallet({ appName: 'Create Wagmi' }), walletConnect({ projectId: import.meta.env.VITE_WC_PROJECT_ID }), connector(), ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) declare module 'wagmi' { interface Register { config: typeof config } } ... ``` ``` // // For apps using Wagmi versions v1.x.y and auth-wagmi v2.a.b // import { configureChains, createConfig, WagmiConfig } from "wagmi"; import { publicProvider } from "wagmi/providers/public"; import { polygon, polygonAmoy } from "wagmi/chains"; import { useAccount, useConnect, useDisconnect, useBalance } from 'wagmi' import "../styles/globals.css"; import { AuthProvider } from '@arcana/auth' import { ArcanaConnector } from "@arcana/auth-wagmi" let auth: AuthProvider | null; if (!auth) { auth = new AuthProvider( "Your-app-Client-ID" ); } const { chains, provider, webSocketProvider } = configureChains( [mainnet, polygon, polygonAmoy], [publicProvider()], { targetQuorum: 1 } ); export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: auth, }, }); }; const { chains, publicClient } = configureChains( [polygon, polygonAmoy], [publicProvider()] ); export const wagmiEntity = createConfig({ autoConnect: true, connectors: [connector(chains)], publicClient, }); ... ``` #### Onboard Users ``` // // For apps using Wagmi versions v2.a.b and auth-wagmi v3.x.y // import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { Buffer } from 'buffer' import React from 'react' import ReactDOM from 'react-dom/client' import { WagmiProvider } from 'wagmi' import App from './App.tsx' import { config } from './wagmi.ts' import './index.css' globalThis.Buffer = Buffer const queryClient = new QueryClient() ReactDOM.createRoot(document.getElementById('root')!).render( , ) ``` ``` // // For apps using Wagmi versions v1.a.b and auth-wagmi v2.x.y // function App({ Component, pageProps }: AppProps) { return ( ); } ``` #### Sign Transactions Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../auth/web3-ops/evm/) in the authenticated user's context. **That's all!** The Auth-CA-Wagmi app is ready to onboard users and allow them to sign blockchain transactions. For details, see [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/). Next, you need to integrate the Web3 app with the Arcana CA Wagmi SDK to enable chain abstracted transactions via unified balance. ### Chain Abstraction To enable unified balance and chain abstracted transactions in a Web3 app using the Wagmi library, you need to integrate with the Arcana CA Wagmi SDK and create the `CAProvider`. Use it to configure the Wagmi connector. Make sure you import the following functions from the ca-wagmi and **not from the wagmi SDK**. - `useSendTransaction` - Chain abstracted Send Transaction - `useWriteContract` - Chain abstracted Write Contract The Arcana CA Wagmi SDK also provides the following additional hooks to enable unified balance and chain abstracted transactions: - `useBalance` - Unify the specified token balance across chains - USDC, USDT, ETH - `useBalances` - Unify the token balance across chains - USDC, USDT, ETH for all supported token types - `useBalanceModal` - Display a plug and play widget containing the unified balance - `useCAFn` - Allow chain abstracted token bridge and transfer functions - `useGetMyIntent` - Get a list of intents created for the user Refer to the following sample integration code and hook usage. Refer to the following sample integration code for usage details. ``` import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider } from 'wagmi' import { CA } from "@arcana/ca-sdk"; import { CAProvider } from '@arcana/ca-wagmi' import App from "./App.tsx"; import { config } from "./utils/config"; const ca = new CA(); const queryClient = new QueryClient() createRoot(document.getElementById("root")!).render( ); ``` ``` import "./App.css"; import { useAccount } from "wagmi"; import { Account } from "./account"; import { WalletOptions } from "./wallet-options"; function ConnectWallet() { const { isConnected } = useAccount(); if (isConnected) return ; return ; } function App() { return (
); } export default App; ``` ``` import { useAccount, useDisconnect, useEnsName, useSwitchChain, // useSendTransaction //DO NOT use from the wagmi SDK } from "wagmi"; import { useBalanceModal, useSendTransaction, //Note: Use from ca-wagmi SDK useWriteContract, useUnifiedBalance, } from "@arcana/ca-wagmi"; import { useState } from "react"; import Decimal from "decimal.js"; import { erc20Abi } from "viem"; export function Account() { const { sendTransaction } = useSendTransaction(); const [allLoading, setLoading] = useState(false); const { address } = useAccount(); const { disconnect } = useDisconnect(); const { data: ensName } = useEnsName({ address }); const { showModal, hideModal } = useBalanceModal(); const { loading, getAssetBalance } = useUnifiedBalance(); if (!loading) { console.log({ assetBalance: getAssetBalance("ETH") }); } const { switchChainAsync } = useSwitchChain(); const { writeContract } = useWriteContract(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); const form = e.currentTarget; try { const formData = new FormData(form); const toFV = formData.get("to"); const chainFV = formData.get("chain"); const assetFV = formData.get("asset"); const amountFV = formData.get("amount"); if (!toFV || !chainFV || !assetFV || !amountFV) { throw new Error("missing params"); } const to = toFV as `0x${string}`; const chain = Number(chainFV); const asset = assetFV as "usdc" | "usdt" | "eth"; await switchChainAsync({ chainId: chain }); let amount = new Decimal(amountFV as string); if (asset.toLowerCase() === "ETH".toLowerCase()) { amount = amount.mul(new Decimal(10).pow(18)); const value = BigInt(amount.toString()); sendTransaction( { to, value, }, { onSuccess(hash) { createSuccessToast(chain, hash); form.reset(); setLoading(false); console.log("success"); }, onSettled() { console.log("settled"); }, onError(error) { console.log({ error }); form.reset(); setLoading(false); }, } ); } else { const chainData = chainToCurrency[chain]; const s = chainData[asset === "usdc" ? 0 : 1]; if (!s) { throw new Error("asset not supported"); } writeContract( { address: s, abi: erc20Abi, functionName: "transfer", args: [to, BigInt(amount.mul(new Decimal(10).pow(6)).toString())], }, { onSuccess(hash) { createSuccessToast(chain, hash); form.reset(); setLoading(false); console.log("success"); }, onError(error) { form.reset(); setLoading(false); console.log({ error }); }, } ); } } catch (e) { form.reset(); console.log({ e }); setLoading(false); } }; return ( <> {loading ? (

Loading...

) : ( <>

{address && ensName ? `${ensName} (${address})` : address}

) ); } ``` ``` import { http, createConfig } from "wagmi"; import { mainnet, optimism, base, arbitrum, scroll, linea, polygon, } from "wagmi/chains"; import { injected } from "wagmi/connectors"; export const config = createConfig({ chains: [mainnet, optimism, arbitrum, base, scroll, linea, polygon], connectors: [injected()], transports: { [mainnet.id]: http(), [optimism.id]: http(), [arbitrum.id]: http(), [base.id]: http(), [scroll.id]: http(), [linea.id]: http(), [polygon.id]: http(), }, }); ``` ``` import * as React from "react"; import { Connector, useConnect } from "wagmi"; export function WalletOptions() { const { connectors, connect } = useConnect(); console.log({ connectors }); return ( <>

Wallets


{connectors .filter((c) => c.id !== "injected") .map((connector) => ( connect({ connector })}/> ))} ); } function WalletOption({ connector, onClick, }: { connector: Connector; onClick: () => void; }) { const [ready, setReady] = React.useState(false); React.useEffect(() => { (async () => { const provider = await connector.getProvider(); setReady(!!provider); })(); }, [connector]); return ( <>
); } ``` For details, see [Arcana CA Wagmi SDK Reference](https://ca-wagmi-sdk-ref-guide.netlify.app/). **Finished.** The Auth-CA-Wagmi app is all set to let users spend on any chain via unified balance and chain abstracted transactions. ## See Also [Sample Integration CodeSandbox](https://codesandbox.io/p/github/shaloo/sample-arcana-auth-ca-wagmi-sdks/sample-auth-ca-wagmi-integration) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) Arcana CA Wagmi SDK Quick Links - [Arcana CA Wagmi SDK Reference](https://ca-wagmi-sdk-ref-guide.netlify.app/) - [Release notes](../../relnotes/latest-ca-release-note/) - [Changelog](https://github.com/arcana-network/ca-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/ca-wagmi) # Get Started: Auth-Core Integrate Web3 apps with [Arcana Auth-Core SDK](../../concepts/auth-core-sdk/) and assign keys to authenticated users. Build custom login UI to onboard users. Add code for a custom, in-app wallet UI and allow authenticated users to sign blockchain transactions securely. Limited Auth Capabilities - **No** built-in [plug-and-play login UI](../../concepts/plug-and-play-auth/) feature - **No** built-in Arcana wallet UI - **No** support for [Global keys, only app-specific keys](../../concepts/keyspace-types/) (default) allowed. - **No** support for [enhanced wallet security](../../concepts/mfa/) via MFA. ## Prerequisites - App must be [registered](../../setup/config-auth/register-app/) via the Arcana Developer Dashboard: - Optionally [configure auth settings](../../setup/config-auth/) such as [social login](../../concepts/social-login/), [wallet user experience](../../concepts/anwallet/), etc. Wallet UI Mode Setting To use the Arcana Auth-Core SDK, developers must implement a [Custom Wallet UI](../../concepts/custom-wallet-ui/)custom wallet UI. The *Wallet UI Mode* Arcana Developer Dashboard configuration setting chosen by the developer during app registration **is ignored** for apps integrated with the Arcana Auth-Core SDK. Wallet UI Mode ## 1. Install SDK ``` npm install --save @arcana/auth-core ``` ``` yarn add @arcana/auth-core ``` ## 2. Integrate ``` const { AuthProvider, SocialLoginType, CURVE } = window.arcana.auth_core; // or import { AuthProvider, CURVE } from '@arcana/auth-core'; ``` ``` const clientId = "xar_test_d24f70cd300823953dfa2a7f5b7c7c113356b1ad"; // obtained after app registration via dashboard const auth = new AuthProvider({ curve: CURVE.ED25519, // defaults to CURVE.SECP256K1 appId: clientId, redirectUri: '' /* can be ignored for redirect flow if same as login page */ }); ``` ### Onboard Users #### Social Login ``` await auth.loginWithSocial(SocialLoginType.google); // Check if a user is logged in const loggedIn = auth.isLoggedIn(); // Get User Account Details const userInfo = auth.getUserInfo(); ... ``` Configure Social Login The login providers specified in [`SocialLoginType`](../../auth/auth-core-usage-guide/#exported-enums) parameter must be [configured](../../setup/config-auth/) via the dashboard. ### Sign Transactions Use `AuthProvider`, a standard Ethereum EIP-1193 provider, and allow authenticated users to sign blockchain transactions. Build a custom wallet UI and wire it to appropriate [Web3 wallet operations](../../auth/web3-ops/evm/) on [configured chains](../../setup/config-wallet-chains/). ``` import { AuthProvider, CURVE } from '@arcana/auth-core'; import { ethers } from 'ethers' const auth = await AuthProvider.init({ appId: `${clientId}`, /* obtained after registering the app with the Arcana Developer Dashboard */ curve: CURVE.ED25519, // defaults to CURVE.SECP256K1 redirectUri:'SPECIFY_URI' /* can be ignored for redirect flow if same as login page */ }); ... const login = async () => { const arcanaProvider = await auth.loginWithSocial(SocialLoginType.google); if (auth.isLoggedIn()) { const info = await auth.getUserInfo(); } }; ... googleLoginBtn.addEventListener('click', () => { login('google'); }); ¯ ... try { const provider = new ethers.providers.Web3Provider(arcanaProvider) await provider.getBlockNumber() //Or perform any other Web3 operation such as sign message, send transaction // 14983200 } catch (e) { // log error } ... ``` ## Advanced Usage UI Flow Mode When instantiating the `AuthProvider` you can configure it to use appropriate [UI flow](../../auth/auth-core-usage-guide/#flow-modes) such that the authenticated user is redirected to a different app page after login, if required. Passwordless Onboarding In addition to [social login](#social-login), onboard users via passwordless option. ``` const result = await auth.loginWithPasswordlessStart({ email: 'abc@example.com' }); ``` Then on the redirect page, **handle passwordless login** as follows: ``` await auth.handleRedirect(); ``` Onboarding via Cognito, Firebase Web3 apps integrating with Arcana Auth-Core SDK cannot use Cognito or Firebase for onboarding users. These providers are **not supported** in the current release. Contact our [Arcana support](../../support/) if you need this feature. Status and User Information **Check Login Status** ``` const loggedIn = auth.isLoggedIn(); /* boolean response */ ``` **Get User Info** After successful authentication, the [user information](../../auth/auth-core-usage-guide/#exported-types) is saved in memory. It gets copied in the current session storage before the *page unload* event. User information is fetched again to memory and removed from the session storage after a successful page reload. ``` const userInfo = auth.getUserInfo(); /* UserInfo: { loginType: 'google', userInfo: { id: 'abc@example.com', name: 'ABC DEF', email: '', picture: '' }, privateKey: '' } */ ``` **Get Public Key** ``` const publicKey = await auth.getPublicKey({ verifier: SocialLoginType.google, id: `abc@example.com`, }); ``` **Logout** ``` await auth.logout(); ``` ## See Also **'Auth-Core'** integration example: See `sample-auth-core` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) Arcana Auth-Core SDK Quick Links - [Arcana Auth-Core SDK Usage Guide](../../auth/auth-core-usage-guide/) - [Arcana Auth-Core SDK Reference](https://auth-core-sdk-ref-guide.netlify.app/) - [Changelog](https://github.com/arcana-network/auth-core/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-core) *Private, Limited Access* Integrate with the [Arcana CA SDK](../../concepts/ca/casdk/). Enable [unified-balance](../../concepts/ca/unified-balance/) in 'Web' apps. Let the app users spend anywhere with chain abstracted transactions. ## 1. Install ``` npm install --save @arcana/ca-sdk ``` ## 2. Integrate ``` import { CA } from '@arcana/ca-sdk' ``` ``` const provider = window.ethereum const ca = new CA(); //Set the EVM provider ca.setEVMProvider(provider); ``` ``` try { await ca.init() } catch (e) { // Handle exception case } ``` `ca.init()` Use `await` until the `init()` call is complete. Then call any other `CA` method listed in the [Arcana CA SDK Reference](https://ca-sdk-ref-guide.netlify.app/). ## 3. Unified Balance Get chain abstracted unified balance in the user's EOA. ``` //total chain abstracted unified balance across all chains/tokens const balances = await ca.getUnifiedBalances(); //total balance for a specific token across all chains const usdtBalance = await ca.getUnifiedBalance("usdt"); ``` ## 4. CA Transaction Web3 apps use the standard EIP-1193 provider to issue `request` call for transactions. To chain abstract these transactions, use `getEVMProviderWithCA`. It returns a CA enabled provider. Replace the standard provider with the CA enabled one. This enables chains abstraction for `eth_sendTransaction` operations via `request` call. ``` const providerWithCA = ca.getEVMProviderWithCA(); await providerWithCA.request({ method: "eth_sendTransaction", params: [ { to: "0xEa46Fb4b4Dc7755BA29D09Ef2a57C67bab383A2f", from: "0x7f521A827Ce5e93f0C6D773525c0282a21466f8d", value: "0x001", }, ], }); ``` ## 5. Advanced The SDK also provides functions to: - View user intents - Issue chain abstracted `bridge` and `transfer` functions [Learn more...](../../ca/integrate/web/#ca-transactions) **Finished.** The 'Web' app is all set to let users spend on any chain via unified balance and chain abstracted transactions. ## See Also Arcana CA SDK Quick Links - [Arcana CA SDK Reference](https://ca-sdk-ref-guide.netlify.app/) - [CA FAQ](../../faq/ca/faq/) - [Release notes](../../relnotes/latest-ca-release-note/) - [Changelog](https://github.com/arcana-network/ca-sdk/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/ca-sdk) [Try CA SDK Demo](https://sdk.arcana.network) # Get Started: Wagmi Apps Integrate Web3 [Wagmi](https://wagmi.sh/) apps with the [Arcana CA Wagmi SDK](../../concepts/ca/ca_wagmi/) to enable: - [Unified-balance](../../concepts/ca/unified-balance/) - [Chain abstracted](../../concepts/ca/chain-abstraction/) transactions Replace the `useSendTransaction` and `useWriteContract` hooks from the Wagmi library. Instead, use the ones provided by the SDK. They support chain abstracted transactions. Use the [plug-and-play UI modal](../../concepts/ca/unified-balance-wagmi-pnp/). It shows the unified balance in the Wagmi app context. ## 1. Install ``` npm install --save @arcana/ca-sdk @arcana/ca-wagmi ``` ## 2. Integrate ``` import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider } from 'wagmi' import { CA } from "@arcana/ca-sdk"; import { CAProvider } from '@arcana/ca-wagmi' import App from "./App.tsx"; import { config } from "./utils/config"; const ca = new CA(); const queryClient = new QueryClient() createRoot(document.getElementById("root")!).render( ); ``` See [Arcana CA Wagmi SDK Reference](https://ca-wagmi-sdk-ref-guide.netlify.app/) for details. ## 3. Unified Balance The `useBalanceModal` hook displays the unified balance plug and play widget. ``` import { useBalanceModal } from "@arcana/ca-wagmi" const { showModal, hideModal } = useBalanceModal() ``` ## 4. CA Transactions Import `useSendTransaction` and `useWriteContract` hooks from the ca-wagmi, **not from the wagmi SDK**, to enable chain abstracted transactions. ### `useSendTransaction` ``` import { useSendTransaction //Note: Use from ca-wagmi SDK } from "@arcana/ca-wagmi"; const { sendTransaction } = useSendTransaction(); ... sendTransaction( { to, value, }, { onSuccess(hash) { createSuccessToast(chain, hash); form.reset(); setLoading(false); console.log("success"); }, onSettled() { console.log("settled"); }, onError(error) { console.log({ error }); form.reset(); setLoading(false); }, } ); ... ``` ### `useWriteContract` ``` import { useWriteContract } from "@arcana/ca-wagmi"; const { writeContract } = useWriteContract(); ... writeContract( { address: s, abi: erc20Abi, functionName: "transfer", args: [to, BigInt(amount.mul(new Decimal(10).pow(6)).toString())], }, { onSuccess(hash) { createSuccessToast(chain, hash); form.reset(); setLoading(false); console.log("success"); }, onError(error) { form.reset(); setLoading(false); console.log({ error }); }, } ); ... ``` ## 5. Advanced The SDK also provides chain abstraction hooks to: - Get unified balance for a specific token - View user intents - Issue chain abstracted `bridge` and `transfer` functions [Learn more...](../../ca/integrate/wagmi/#arcana-hooks) **Finished.** The 'CA-Wagmi' app is all set to let users spend on any chain via unified balance and chain abstracted transactions. Refer to the following sample integration code for usage details. ``` import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider } from 'wagmi' import { CA } from "@arcana/ca-sdk"; import { CAProvider } from '@arcana/ca-wagmi' import App from "./App.tsx"; import { config } from "./utils/config"; const ca = new CA(); const queryClient = new QueryClient() createRoot(document.getElementById("root")!).render( ); ``` ``` import "./App.css"; import { useAccount } from "wagmi"; import { Account } from "./account"; import { WalletOptions } from "./wallet-options"; function ConnectWallet() { const { isConnected } = useAccount(); if (isConnected) return ; return ; } function App() { return (
); } export default App; ``` ``` import { useAccount, useDisconnect, useEnsName, useSwitchChain, // useSendTransaction //DO NOT use from the wagmi SDK } from "wagmi"; import { useBalanceModal, useSendTransaction, //Note: Use from ca-wagmi SDK useWriteContract, useUnifiedBalance, } from "@arcana/ca-wagmi"; import { useState } from "react"; import Decimal from "decimal.js"; import { erc20Abi } from "viem"; export function Account() { const { sendTransaction } = useSendTransaction(); const [allLoading, setLoading] = useState(false); const { address } = useAccount(); const { disconnect } = useDisconnect(); const { data: ensName } = useEnsName({ address }); const { showModal, hideModal } = useBalanceModal(); const { loading, getAssetBalance } = useUnifiedBalance(); if (!loading) { console.log({ assetBalance: getAssetBalance("ETH") }); } const { switchChainAsync } = useSwitchChain(); const { writeContract } = useWriteContract(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); const form = e.currentTarget; try { const formData = new FormData(form); const toFV = formData.get("to"); const chainFV = formData.get("chain"); const assetFV = formData.get("asset"); const amountFV = formData.get("amount"); if (!toFV || !chainFV || !assetFV || !amountFV) { throw new Error("missing params"); } const to = toFV as `0x${string}`; const chain = Number(chainFV); const asset = assetFV as "usdc" | "usdt" | "eth"; await switchChainAsync({ chainId: chain }); let amount = new Decimal(amountFV as string); if (asset.toLowerCase() === "ETH".toLowerCase()) { amount = amount.mul(new Decimal(10).pow(18)); const value = BigInt(amount.toString()); sendTransaction( { to, value, }, { onSuccess(hash) { createSuccessToast(chain, hash); form.reset(); setLoading(false); console.log("success"); }, onSettled() { console.log("settled"); }, onError(error) { console.log({ error }); form.reset(); setLoading(false); }, } ); } else { const chainData = chainToCurrency[chain]; const s = chainData[asset === "usdc" ? 0 : 1]; if (!s) { throw new Error("asset not supported"); } writeContract( { address: s, abi: erc20Abi, functionName: "transfer", args: [to, BigInt(amount.mul(new Decimal(10).pow(6)).toString())], }, { onSuccess(hash) { createSuccessToast(chain, hash); form.reset(); setLoading(false); console.log("success"); }, onError(error) { form.reset(); setLoading(false); console.log({ error }); }, } ); } } catch (e) { form.reset(); console.log({ e }); setLoading(false); } }; return ( <> {loading ? (

Loading...

) : ( <>

{address && ensName ? `${ensName} (${address})` : address}

) ); } ``` ``` import { http, createConfig } from "wagmi"; import { mainnet, optimism, base, arbitrum, scroll, linea, polygon, } from "wagmi/chains"; import { injected } from "wagmi/connectors"; export const config = createConfig({ chains: [mainnet, optimism, arbitrum, base, scroll, linea, polygon], connectors: [injected()], transports: { [mainnet.id]: http(), [optimism.id]: http(), [arbitrum.id]: http(), [base.id]: http(), [scroll.id]: http(), [linea.id]: http(), [polygon.id]: http(), }, }); ``` ``` import * as React from "react"; import { Connector, useConnect } from "wagmi"; export function WalletOptions() { const { connectors, connect } = useConnect(); console.log({ connectors }); return ( <>

Wallets


{connectors .filter((c) => c.id !== "injected") .map((connector) => ( connect({ connector })}/> ))} ); } function WalletOption({ connector, onClick, }: { connector: Connector; onClick: () => void; }) { const [ready, setReady] = React.useState(false); React.useEffect(() => { (async () => { const provider = await connector.getProvider(); setReady(!!provider); })(); }, [connector]); return ( <>
); } ``` `useCAFn`: Chain Abstracted Bridge and Transfer ## See Also Arcana CA Wagmi SDK Quick Links - [Arcana CA Wagmi SDK Reference](https://ca-wagmi-sdk-ref-guide.netlify.app/) - [Release notes](../../relnotes/latest-ca-release-note/) - [Changelog](https://github.com/arcana-network/ca-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/ca-wagmi) [Try CA Wagmi SDK CodeSandbox](https://codesandbox.io/p/github/shaloo/sample-arcana-auth-ca-wagmi-sdks/sample-auth-ca-wagmi-integration) # Get Started: Flutter Apps Integrate 'Flutter' apps with Arcana Auth Flutter SDK and onboard users via [social login](../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../concepts/anwallet/). ## Prerequisites - App must be [registered](../../setup/config-auth/register-app/) via the Arcana Developer Dashboard: - Optionally [configure auth settings](../../setup/config-auth/) such as [social login](../../concepts/social-login/), [wallet user experience](../../concepts/anwallet/), etc. Flutter Version We support Flutter [v3.15.0](https://flutter-ko.dev/development/tools/sdk/releases) or higher ## 2. Install The Arcana Auth Flutter SDK is a [Flutter plugin](https://docs.flutter.dev/packages-and-plugins/developing-packages). It is available for download at 'Pub.dev' as the [`arcana_auth_flutter`](https://pub.dev/packages/arcana_auth_flutter) package. Add the following line to the dependencies section in your app's `pubspec.yaml` file: pubspec.yaml ``` dependencies: flutter: # Required for every Flutter project sdk: flutter # Required for every Flutter project flutter_localizations: # Required to enable localization sdk: flutter # Required to enable localization arcana_auth_flutter: ^0.0.6 ``` ## 2. Integrate ``` import 'package:arcana_sdk/arcana_sdk.dart'; final auth = AuthProvider(clientId:"xar_xxxx_..."); auth.init(context: context); ``` ### Onboard Users ``` auth.loginWithSocial("google").then((_) => { // On login Success }).catchError(...); ``` ### Sign Transactions The `AuthProvider` supports the JSON-RPC requests for the following Web3 operations in Flutter apps: ``` auth.request(method: "...", params: [...]).then(() => ...); ``` ``` auth.sendTransaction({ to: "", value: "" }).then((hash) => ...); ``` **That's all!** The 'Flutter' app is ready to onboard users and allow them to sign blockchain transactions. ## 4. Advanced Usage Flutter SDK Usage **Social Login** ``` auth.loginWithSocial("google").then((_) => { // On login Success }).catchError(...); ``` **OTP Login** ``` auth.loginWithOTP("${email_id}").then((_) => { // On login Success }).catchError(...); ``` **Logout** ``` auth.logout().then((_) => { // On logout }); ``` **Get User Address** ``` auth.getAccount().then((account) => ...); ``` **Get User Details** ``` auth.getUserInfo().then((UserInfo info) => ...); ``` **Show/Hide Wallet UI** ``` auth.showWallet(); ``` ``` auth.hideWallet(); ``` **Check Wallet Visibility** ``` var isVisible = auth.isVisible(); ``` **Clear Cache** ``` auth.clearCache(); ``` Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## See also **'Flutter'** integration example: See `sample-auth-flutter` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) Arcana Auth Flutter SDK Quick Links - [Release notes](../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-flutter/releases) - [Download SDK](https://pub.dev/packages/arcana_auth_flutter) [Try Demo App](https://demo.arcana.network) # Get Started: MultiversX Apps Integrate 'MultiversX' apps with Arcana Auth SDK and onboard users via [social login](../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../concepts/anwallet/). MultiversX chains are pre-configured and instantly accessible to authenticated users via the Arcana wallet. ## Prerequisites - Register the MultiversX app as instructed in the [MultiversX Configuration Guide](../../setup/config-dApp-with-db-for-mvx/). Get a unique Client ID and use it for app integration. - Configure social login providers to onboard users and customize the user experience for blockchain signing via the wallet settings. ## 1. Install ``` npm install --save @arcana/auth ``` ``` yarn add @arcana/auth ``` ## 2. Integrate ``` import { AuthProvider } from '@arcana/auth' ``` ``` const auth = new AuthProvider( "xar_test_445007f942xxxxxxxxxxxxxxxxxx484cAfd2", // App client ID { alwaysVisible: false, // default: true, wallet always visible connectOptions: { compact: true // default: false, regular plug-and-play login UI }, position: 'left', // default: right setWindowProvider: true, // default: false, window.ethereum not set theme: 'light', // default: dark }) ``` ``` try { await auth.init() } catch (e) { // Handle exception case } ``` Initialize First! The app must use `await` until the `init()` call is complete, before invoking any of the other Arcana Auth SDK functions listed in [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/). ### Onboard Users ``` await auth.connect(); ``` Plug-and-Play Login UI ### Sign Transactions ``` // For authenticated users, add code for signing message const personalSign = await provider.request({ method: 'mvx_signMessage', params: { message: 'SignMessage to test MultiversX signmessage', address: from, }, }) // Returns signature object // {signature: "some-sig"} ``` For the MultiversX chain, the following methods are supported: - `mvx_signMessage` - `mvx_signTransaction` - `mvx_signTransactions` - `getAccounts` - `getPublicKey` Refer to [other supported Web3 wallet operations](../../auth/web3-ops/mvx/) for details. **That's all!** The 'MultiversX' app is ready to onboard users and allow them to sign blockchain transactions. ## 3. Advanced Usage `AuthProvider` Optional Parameters Besides Client ID input parameter, you can optionally customize these settings in the `AuthProvider` constructor: ______________________________________________________________________ **`position`:** wallet position within the app context - `left`|`right` **`theme`:** wallet theme - `light`|`dark` **`connectOptions`:** [compact mode](../../concepts/plug-and-play-auth/#compact-modal) for the built-in plug-and-play login UI - `true`|`false` ``` connectOptions: { compact: true // default - false }, ``` ______________________________________________________________________ See [`AuthProvider` constructor parameters](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) for details. Wallet Customization Manage the user experience for signing blockchain transactions by configuring SDK usage. Specify the [theme, branding](../../setup/config-dApp-with-db/#settings-overview) settings of the in-app built-in Arcana wallet UI. Use [wallet visibility](../../concepts/anwallet/walletvisibility/) and decide when to display the wallet UI in the app. Configure [keyspace](../../concepts/keyspace-types/) and enable the user experience of having the same wallet address across multiple apps integrated with the Arcana Auth SDK. You can also replace the built-in wallet UI with a [custom wallet UI](../../setup/config-custom-wallet-ui/). Custom Login UI You can onboard users through a [custom login UI](../../concepts/custom-login-ui/) instead of the [built-in plug-and-play](../../concepts/plug-and-play-auth/) one. See [how to use custom login UI](../../auth/onboard/vanilla/custom-ui/) and onboard users in a 'MultiversX' app. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## See Also **'MultiversX'** integration example: See `'`sample-auth-multiversx`'` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) [Try Demo App](https://demo.arcana.network) # Get Started: Near Apps Integrate 'Near' apps with Arcana Auth SDK and onboard users via [social login](../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../concepts/anwallet/). Near chains are pre-configured and instantly accessible to authenticated users via the Arcana wallet. ## Prerequisites - Register the Near app as instructed in the [Near Configuration Guide](../../setup/config-dApp-with-db-for-near/). Get a unique Client ID and use it for app integration. - Configure social login providers to onboard users and customize the user experience for blockchain signing via the wallet settings. ## 1. Install ``` npm install --save @arcana/auth ``` ``` yarn add @arcana/auth ``` ## 2. Integrate ``` import { AuthProvider } from '@arcana/auth' ``` ``` const auth = new AuthProvider( "xar_test_445007f942xxxxxxxxxxxxxxxxxx484cAfd2", // App client ID { alwaysVisible: false, // default: true, wallet always visible connectOptions: { compact: true // default: false, regular plug-and-play login UI }, position: 'left', // default: right setWindowProvider: true, // default: false, window.ethereum not set theme: 'light', // default: dark }) ``` ``` try { await auth.init() } catch (e) { // Handle exception case } ``` Initialize First! The app must use `await` until the `init()` call is complete, before invoking any of the other Arcana Auth SDK functions listed in [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/). ### Onboard Users ``` await auth.connect(); ``` Plug-and-Play Login UI ### Sign Transactions ``` // For authenticated users, add code for signing message import base58 from "bs58"; const message = base58.encode(Buffer.from("This is a test message for trying 'SignMessage'.")); const signedMessage = await auth.provider.request({ method: "near_signMessage", params: { message }, }); console.log(signedMessage); ``` For the Near chain, the following methods are supported: - `getAccounts` - `near_signMessage` - `near_signAndSendTransaction` Refer to [other supported Web3 wallet operations](../../auth/web3-ops/near/) for details. **That's all!** The 'Near' app is ready to onboard users and allow them to sign blockchain transactions. ## 3. Advanced Usage `AuthProvider` Optional Parameters Besides Client ID input parameter, you can optionally customize these settings in the `AuthProvider` constructor: ______________________________________________________________________ **`position`:** wallet position within the app context - `left`|`right` **`theme`:** wallet theme - `light`|`dark` **`connectOptions`:** [compact mode](../../concepts/plug-and-play-auth/#compact-modal) for the built-in plug-and-play login UI - `true`|`false` ``` connectOptions: { compact: true // default - false }, ``` ______________________________________________________________________ See [`AuthProvider` constructor parameters](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) for details. Wallet Customization Manage the user experience for signing blockchain transactions by configuring SDK usage. Specify the [theme, branding](../../setup/config-dApp-with-db/#settings-overview) settings of the in-app built-in Arcana wallet UI. Use [wallet visibility](../../concepts/anwallet/walletvisibility/) and decide when to display the wallet UI in the app. Configure [keyspace](../../concepts/keyspace-types/) and enable the user experience of having the same wallet address across multiple apps integrated with the Arcana Auth SDK. You can also replace the built-in wallet UI with a [custom wallet UI](../../setup/config-custom-wallet-ui/). Custom Login UI You can onboard users through a [custom login UI](../../concepts/custom-login-ui/) instead of the [built-in plug-and-play](../../concepts/plug-and-play-auth/) one. See [how to use custom login UI](../../auth/onboard/vanilla/custom-ui/) and onboard users in a 'Near' app. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## See Also **'Near'** integration example: See `'`sample-auth-near`'` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) [Try Demo App](https://demo.arcana.network) # Get Started: RainbowKit Apps [RainbowKit](https://www.rainbowkit.com/) is a React Hooks library for Ethereum for connecting Web3 apps to multiple wallets and chains. Integrate ['RainbowKit' apps](ttps://www.rainbowkit.com/) with Arcana Auth SDK and onboard users via [social login](../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../concepts/anwallet/). ## Prerequisites - App must be [registered](../../setup/config-auth/register-app/) via the Arcana Developer Dashboard: - Optionally [configure auth settings](../../setup/config-auth/) such as [social login](../../concepts/social-login/), [wallet user experience](../../concepts/anwallet/), etc. RainbowKit Version We support Web3 apps using RainbowKit [v1.3.0](https://github.com/rainbow-me/rainbowkit/releases/tag/%40rainbow-me%2Frainbowkit%401.3.0) or higher. ## 1. Install SDKs **Wagmi 2.0** ``` npm install --save @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` npm install --save @arcana/auth-wagmi@2.0.0 @arcana/auth ``` **Wagmi 2.0** ``` yarn add @arcana/auth-wagmi@3.0.0 @arcana/auth@1.0.12 ``` **Wagmi 1.0** ``` yarn add @arcana/auth-wagmi@2.0.0 @arcana/auth ``` ## 2. Integrate ``` // Set up Arcana Auth import { AuthProvider } from "@arcana/auth"; let auth = null; export const getAuthProvider = () => { if (!auth) { auth = new AuthProvider( "xar_live_d7c88d9b033d100e4200d21a5c4897b896e60063" ); } return auth; }; ``` ``` // // For apps using Wagmi versions v2.a.b and auth-wagmi v3.x.y // import { http, createConfig } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' import { coinbaseWallet, injected, walletConnect } from 'wagmi/connectors' import { AuthProvider } from '@arcana/auth' import { ArcanaConnector } from "@arcana/auth-wagmi" let auth: AuthProvider | null; if (!auth) { auth = new AuthProvider( "Your-app-Client-ID" ); } const connector = new ArcanaConnector({ auth }); export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ injected(), coinbaseWallet({ appName: 'Create Wagmi' }), walletConnect({ projectId: import.meta.env.VITE_WC_PROJECT_ID }), connector(), ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) declare module 'wagmi' { interface Register { config: typeof config } } ... ``` ``` // // For apps using Wagmi versions v1.x.y and auth-wagmi v2.a.b // import { configureChains, createConfig, WagmiConfig } from "wagmi"; import { publicProvider } from "wagmi/providers/public"; import { polygon, polygonAmoy } from "wagmi/chains"; import { useAccount, useConnect, useDisconnect, useBalance } from 'wagmi' import "../styles/globals.css"; import { AuthProvider } from '@arcana/auth' import { ArcanaConnector } from "@arcana/auth-wagmi" let auth: AuthProvider | null; if (!auth) { auth = new AuthProvider( "Your-app-Client-ID" ); } const { chains, provider, webSocketProvider } = configureChains( [mainnet, polygon, polygonAmoy], [publicProvider()], { targetQuorum: 1 } ); export const connector = (chains: Chain[]) => { return new ArcanaConnector({ chains, options: { auth: auth, }, }); }; const { chains, publicClient } = configureChains( [polygon, polygonAmoy], [publicProvider()] ); export const wagmiEntity = createConfig({ autoConnect: true, connectors: [connector(chains)], publicClient, }); ... ``` ### Onboard Users ``` //This example uses Arcana Rainbow connector and MetaMask import { connectorsForWallets } from "@rainbow-me/rainbowkit"; import { metaMaskWallet } from "@rainbow-me/rainbowkit/wallets"; import { getAuthProvider } from "./getArcanaAuth"; import { ArcanaConnector } from "@arcana/auth-wagmi"; import { sequenceLogo } from "./logo"; export const ArcanaRainbowConnector = ({ chains }) => { return { id: "arcana-auth", name: "Login with Email/Social", iconUrl: sequenceLogo, iconBackground: "#101010", createConnector: () => { const connector = new ArcanaConnector({ chains, options: { auth: getAuthProvider() } }); return { connector }; } }; }; const connectors = (chains) => connectorsForWallets([ { groupName: "Recommended", wallets: [ArcanaRainbowConnector({ chains }), metaMaskWallet({ chains })] } ]); export { connectors }; ``` ``` // Note: // This sample code is for // wagmi versions 1.x.x and auth-wagmi 2.0.0 import { configureChains, createConfig, WagmiConfig } from "wagmi"; import { polygon, mainnet, optimism, arbitrum } from "wagmi/chains"; import { publicProvider } from "wagmi/providers/public"; import { RainbowKitProvider } from "@rainbow-me/rainbowkit"; import { connectors } from "./wallet"; import { useAccount, useConnect } from 'wagmi' import { Connect } from "./Connect"; const { chains, publicClient } = configureChains( [mainnet, polygon, optimism, arbitrum], [publicProvider()] ); const wagmiEntity = createConfig({ connectors: connectors(chains), autoConnect: true, publicClient, }); ... ``` ``` // Note: // This sample code is for // wagmi versions <1.x.x and auth-wagmi <2.0.0 import "../styles/globals.css"; import "@rainbow-me/rainbowkit/styles.css"; import { configureChains, createClient, WagmiConfig } from "wagmi"; import { polygon, mainnet } from "wagmi/chains"; import { publicProvider } from "wagmi/providers/public"; import { RainbowKitProvider } from "@rainbow-me/rainbowkit"; import { connectors } from "../utils/wallet"; const { chains, provider } = configureChains( [mainnet, polygon], [publicProvider()] ); const wagmiEntity = createClient({ connectors: connectors(chains), autoConnect: true, provider, }); ... ``` Use `WagmiConfig` and `RainbowKitProvider` components in the app to enable social login through the configured providers in the RainbowKit app. ``` // Pass wagmi client configured with ArcanaRainbowKitConnector to the RainbowKit Context Provider export default function App({ Component, pageProps }) { return ( ); } ``` ``` // Pass wagmi client configured with ArcanaRainbowKitConnector to the RainbowKit Context Provider export default function App({ Component, pageProps }) { return ( ); } ``` ### Sign Transactions Use `AuthProvider`, the EIP-1193 provider offered by the SDK, to call supported JSON/RPC functions and [Web3 wallet operations](../../auth/web3-ops/evm/) in the authenticated user's context. **That's all!** The 'RainbowKit' app is ready to onboard users and allow them to sign blockchain transactions. ## 3. Advanced Usage `AuthProvider` Optional Parameters Besides Client ID input parameter, you can optionally customize these settings in the `AuthProvider` constructor: ______________________________________________________________________ **`position`:** wallet position within the app context - `left`|`right` **`theme`:** wallet theme - `light`|`dark` **`connectOptions`:** [compact mode](../../concepts/plug-and-play-auth/#compact-modal) for the built-in plug-and-play login UI - `true`|`false` ``` connectOptions: { compact: true // default - false }, ``` ______________________________________________________________________ See [`AuthProvider` constructor parameters](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) for details. Wallet Customization Manage the user experience for signing blockchain transactions by configuring SDK usage. Specify the [theme, branding](../../setup/config-dApp-with-db/#settings-overview) settings of the in-app built-in Arcana wallet UI. Use [wallet visibility](../../concepts/anwallet/walletvisibility/) and decide when to display the wallet UI in the app. Configure [keyspace](../../concepts/keyspace-types/) and enable the user experience of having the same wallet address across multiple apps integrated with the Arcana Auth SDK. You can also replace the built-in wallet UI with a [custom wallet UI](../../setup/config-custom-wallet-ui/). Custom Login UI You can onboard users through a [custom login UI](../../concepts/custom-login-ui/) instead of the [built-in plug-and-play](../../concepts/plug-and-play-auth/) one. See [how to use custom login UI](../../auth/onboard/rainbow/rainbow-custom-ui/) and onboard users in a 'RainbowKit' app. Arcana JWT Token Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../concepts/jwt-token-validation/) and subsequently generate another token for app use if required. In the future, the Arcana JWT Token will be deprecated. Use `userDIDToken` to verify user. Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../concepts/an-jwt-token/). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object. Developers can use this token to [verify the user](../../concepts/an-did-token/#verify-did-token) and subsequently generate another token for app use. ## See Also **'RainbowKit'** integration example: See `sample-auth-rainbowkit`,`sample-auth-rainbow-viem` submodule in [SDK Example GitHub repository.](https://github.com/arcana-network/auth-examples) Arcana Auth SDK Quick Links - [Arcana Auth SDK Reference](https://authsdk-ref-guide.netlify.app/) - [Release notes](../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth) Arcana Auth Wagmi SDK Quick Links - [Arcana Auth Wagmi SDK Reference Guide](https://wagmi-authsdk-ref-guide.netlify.app/) - [Release notes](../../relnotes/latest-auth-release-note/) - [Changelog](https://github.com/arcana-network/auth-wagmi/releases) - [Download SDK](https://www.npmjs.com/package/@arcana/auth-wagmi) [Try Demo App](https://demo.arcana.network) # Get Started: React-Native Apps Integrate 'React-Native' apps with Arcana Auth React-Native SDK and onboard users via [social login](../../concepts/social-login/). Enable users to sign blockchain transactions with the in-app [Arcana wallet](../../concepts/anwallet/). ## Prerequisites - App must be [registered](../../setup/config-auth/register-app/) via the Arcana Developer Dashboard: - Optionally [configure auth settings](../../setup/config-auth/) such as [social login](../../concepts/social-login/), [wallet user experience](../../concepts/anwallet/), etc. React-Native Version We support React-Native [v0.71.8](https://reactnative.dev/versions) or higher ## 1. Install ``` npm i @arcana/auth-react-native (cd ios && pod install) ``` Auto-Linking You are **not required** to manually link this module, as it supports React Native auto-linking. ## 2. Integrate ``` import React, { useState } from "react"; import { Button, View } from "react-native"; import Auth from "@arcana/auth-react-native"; export default function App() { const authRef = React.useRef(null); return ( ); } ``` ### Onboard Users ``` // For logging in const loginWithGoogle = () => { if(authRef !== null){ authRef.current.loginWithSocial('google').then(() => { // logged in }).catch(err => { // already logged in // or error during login }) } } ``` ### Sign Transactions ``` // For sending transaction const sendTransaction = async data => { if(authRef !== null){ return await authRef.current.sendTransaction(data); } }; // For getting current account balance const getBalance = async () => { if(authRef !== null){ return await authRef.current.getBalance(); } }; ``` ``` // EIP 1193 request method const request = async (method, params) => { if(authRef !== null){ return await authRef.current.request({ method, params }); } }; ``` ## 3. Advanced Usage `AuthProvider` Optional Parameters Besides Client ID input parameter, you can optionally customize these settings in the `AuthProvider` constructor: ______________________________________________________________________ **`position`:** wallet position within the app context - `left`|`right` **`theme`:** wallet theme - `light`|`dark` **`connectOptions`:** [compact mode](../../concepts/plug-and-play-auth/#compact-modal) for the built-in plug-and-play login UI - `true`|`false` ``` connectOptions: { compact: true // default - false }, ``` ______________________________________________________________________ See [`AuthProvider` constructor parameters](https://authsdk-ref-guide.netlify.app/interfaces/constructorparams) for details. React-Native SDK Usage **Google Login** ``` // For logging in const loginWithGoogle = () => { if(authRef !== null){ authRef.current.loginWithSocial('google').then(() => { // logged in }).catch(err => { // already logged in // or error during login }) } } ``` **Logout** Add code to provide user log out option via the `logout` method or let authenticated users log out using the wallet UI logout option in the 'User Profile' tab. ``` // Logout User from session const logout = () => { if(authRef !== null){ authRef.current.logout().then(() => { // on logout }); } }; ``` **Show/Hide Wallet** Once the user logs into the app, they can instantly access the Arcana wallet. Developers can choose to show and hide the wallet as required by the app. ``` // For showing wallet const showWallet = () => { if(authRef !== null){ authRef.current.showWallet(); } } // For hiding wallet const hideWallet = () => { if(authRef !== null){ authRef.current.hideWallet(); } } ``` ``` // For getting logged in user info const getUserInfo = async () => { if(authRef !== null){ return authRef.current.getUserInfo(); } }; ``` ``` // For getting current account const getAccount = async () => { if(authRef !== null){ return await authRef.current.getAccount(); } }; ``` ``` return (