### Install Wepin Compose Multiplatform Login Library Source: https://docs.wepin.io/en/widget-integration This guide explains how to install the Wepin Compose Multiplatform Login Library. It covers the necessary steps to add the library to your Compose Multiplatform project. ```bash implementation("io.wepin:wepin-compose-login:") ``` -------------------------------- ### Install Wepin React Native Widget SDK Source: https://docs.wepin.io/en/widget-integration This guide explains how to install the Wepin React Native Widget SDK. It covers the necessary commands to add the SDK to your React Native project. ```bash npm install @wepin/react-native-widget-sdk # or yarn add @wepin/react-native-widget-sdk ``` -------------------------------- ### Install Wepin React Native Provider Source: https://docs.wepin.io/en/widget-integration This guide explains how to install the Wepin React Native Provider. It covers the commands needed to integrate the provider into your React Native project. ```bash npm install @wepin/react-native-provider # or yarn add @wepin/react-native-provider ``` -------------------------------- ### Initialize Wepin SDK for Client Side Rendering (CSR) Source: https://docs.wepin.io/en/widget-integration/web-javascript-sdk/widget/installation This code demonstrates how to dynamically import and initialize the Wepin SDK in a Client Side Rendering (CSR) environment to avoid issues in Server Side Rendering (SSR) setups. It ensures the package is loaded only on the client. ```javascript const initWepin = async () => { const { WepinSDK } = await import('@wepin/sdk-js'); const wepinSDK = new WepinSDK({ appKey: '', appId: '', }); await wepinSDK.init({ defaultLanguage: 'ko', }); } ``` -------------------------------- ### Install Wepin React Native Login Library Source: https://docs.wepin.io/en/widget-integration This guide explains how to install the Wepin React Native Login Library. It covers the prerequisites and commands needed to add the library to your React Native project. ```bash npm install @wepin/react-native-login-sdk # or yarn add @wepin/react-native-login-sdk ``` -------------------------------- ### View Dependencies in package.json Source: https://docs.wepin.io/en/deprecated/web-javascript-sdk/sdk/installation Demonstrates the structure of a `package.json` file after successfully installing the Wepin Widget SDK using npm. The SDK is listed under the 'dependencies' section, indicating it's a required package for the project. ```json { "name": "wepin-widget-test-app", "version": "1.0.0", "description": "Wepin Widge Test App" "main": "app.js", "author": "honggildong@test.wepin.io", "dependencies": { "@wepin/widget-sdk": "^1.0.0" } } ``` -------------------------------- ### Import WepinLogin SDK in Swift Source: https://docs.wepin.io/en/widget-integration/ios-swift-sdk/login-library/installation Import the WepinLogin module into your Swift project files to start using its authentication functionalities. This line should be placed at the top of your Swift files. ```swift import WepinLogin ``` -------------------------------- ### Install Wepin React Native PIN Pad SDK Source: https://docs.wepin.io/en/widget-integration This guide explains how to install the Wepin React Native PIN Pad SDK. It provides instructions for adding the SDK to your React Native project for secure PIN entry. ```bash npm install @wepin/react-native-pin-pad-sdk # or yarn add @wepin/react-native-pin-pad-sdk ``` -------------------------------- ### Initialize Wepin SDK in JavaScript Source: https://docs.wepin.io/en/widget-integration/web-javascript-sdk/widget/installation Initialize the Wepin SDK instance after installation using your application's App ID and App Key. This code snippet demonstrates the basic initialization process in a JavaScript environment. ```javascript // 1. Import the package import { WepinSDK } from '@wepin/sdk-js' // 2. Initialization const wepinSdk = new WepinSDK({ appId: 'your-wepin-app-id', appKey: 'your-wepin-api-key', }) ``` -------------------------------- ### Initialize Wepin Widget SDK (npm) Source: https://docs.wepin.io/en/deprecated/web-javascript-sdk/sdk/installation Initializes the Wepin widget after installation via npm. This JavaScript code imports the SDK, defines App ID and App Key, and calls the `Wepin.init` function to set up the widget. Ensure the SDK is imported before initialization. ```javascript // 1. import SDK import '@wepin/widget-sdk' const testAppKey = 'ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313' // Test App Key const testAppId = 'app_id_eg12sf3491azgs520' // Test App ID // 2. Initialize const Wepin = window.Wepin const wepin = await Wepin.init( testAppId, testAppKey ) ``` -------------------------------- ### Import WepinWidget in Swift Project Source: https://docs.wepin.io/en/widget-integration/ios-swift-sdk/widget-library/installation Import the WepinWidget module into your Swift source files to start using its functionalities. This is a prerequisite for accessing the SDK's features. ```swift import WepinWidget ``` -------------------------------- ### Initialization and Widget Setup Source: https://docs.wepin.io/en/deprecated/react-native-sdk/init Instructions for importing the Wepin SDK, getting an instance, and setting up the Wepin WidgetView component in your React Native application. ```APIDOC ## Initialization and Widget Setup ### Description Import the Wepin SDK, obtain an instance, and integrate the `` component into your main application component. ### Import SDK ```javascript import Wepin from '@wepin/react-native-sdk' const wepin = Wepin.getInstance() ``` ### WidgetView Component Add the `` component to your main application component. ```javascript function App(): JSX.Element { .... return ( ... ) } ``` ``` -------------------------------- ### Install Peer Dependencies Source: https://docs.wepin.io/en/widget-integration/react-native-sdk/login-library/installation Installs the necessary peer dependencies, specifically 'react-native-device-info', and runs 'pod install' for iOS. This ensures all required libraries are available for the Wepin Login package. ```bash npm install react-native-device-info # for ios cd ios pod install ``` ```bash yarn add react-native-device-info # for ios cd ios pod install ``` -------------------------------- ### Install Wepin Widget SDK with npm Source: https://docs.wepin.io/en/deprecated/web-javascript-sdk/sdk/installation Installs the Wepin Widget Javascript SDK as an npm package. This method is suitable for web environments only and cannot be used in hybrid apps. The installation adds the SDK to your project's dependencies. ```shell npm install @wepin/widget-sdk ``` -------------------------------- ### Install WepinLogin using CocoaPods Source: https://docs.wepin.io/en/widget-integration/ios-swift-sdk/login-library/installation Add the WepinLogin library to your project by including this line in your Podfile. This is the standard method for integrating the SDK. ```sh pod 'WepinLogin' ``` -------------------------------- ### Install Wepin SDK with npm or yarn Source: https://docs.wepin.io/en/widget-integration/web-javascript-sdk/widget/installation Install the Wepin SDK as an npm package. This package is intended for web environments only and has limitations in hybrid mobile applications. It requires Node.js and a package manager. ```bash npm install @wepin/sdk-js ``` ```bash yarn add @wepin/sdk-js ``` -------------------------------- ### Initialize WepinPin Instance (JavaScript) Source: https://docs.wepin.io/en/widget-integration/web-javascript-sdk/pin-pad-library/installation Initialize the WepinPin instance after installation using your Wepin app key. This step enables the functionality of WepinPin for your application. It is designed for Client Side Rendering (CSR) environments. ```javascript // 1. Import the package import { WepinPin } from '@wepin/pin-js' // 2. Initialization const wepinPin = new WepinPin({ appKey: 'your-wepin-app-key', }) ``` -------------------------------- ### Install Wepin PIN JS SDK with npm/yarn Source: https://docs.wepin.io/en/widget-integration/web-javascript-sdk/pin-pad-library/installation Install the Wepin PIN JS SDK using either npm or yarn package managers. This SDK is essential for integrating Wepin's PIN functionality into your web application. ```bash npm install @wepin/pin-js ``` ```bash yarn add @wepin/pin-js ``` -------------------------------- ### Add JitPack Repository to Project Gradle Source: https://docs.wepin.io/en/widget-integration/android-java-and-kotlin-sdk/login-library/installation Configure your project-level build.gradle file to include the JitPack repository, which hosts the WepinLoginLibrary. This step is crucial for Gradle to locate and download the library dependency. ```kotlin dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() maven("https://jitpack.io") // <= Add JitPack Repository } } ``` -------------------------------- ### Add Wepin Flutter SDK via Flutter Pub Command Source: https://docs.wepin.io/en/deprecated/flutter-sdk/installation Installs the `wepin_flutter` package using the `flutter pub add` command. This is the recommended way to add the dependency to your project. ```sh flutter pub add wepin_flutter ``` -------------------------------- ### Wepin SDK Sign Up with Email and Password Source: https://docs.wepin.io/en/widget-integration/android-java-and-kotlin-sdk/pin-pad-library/method Provides an example of signing up a new user with an email address and password using the Wepin SDK. Includes basic error handling for `WepinError`. ```kotlin wepinSDK.login.signUpWithEmailAndPassword( email = 'example@example.com', password = 'password123' ).thenAccept { signUpResult -> Log.d("WepinSDK", "Sign up success! User Information: $user") }.exceptionally { error -> if (error is WepinError) { } } ``` -------------------------------- ### Wepin Login Example (JavaScript) Source: https://docs.wepin.io/en/widget-integration/web-javascript-sdk/login-library/methods Demonstrates how to initialize the Wepin Login module, log in with a Google OAuth provider, and retrieve user information. It also shows how to handle different user login statuses, such as requiring a PIN or registration. ```javascript const wepinLogin = WepinLogin({ appId: 'appId', appKey: 'appKey' }) const res = await wepinLogin.loginWithOauthProvider({ provider: 'google' }) const userInfo = await wepinLogin.loginWepin(res) const userStatus = userInfo.userStatus if(userStatus.loginStatus === 'pinRequired'||userStatus.loginStatus === 'registerRequired') { // wepin register } ``` -------------------------------- ### Wepin SDK Authentication Example (Kotlin) Source: https://docs.wepin.io/en/widget-integration/compose-multiplatform-sdk/widget/methods This example demonstrates how to initialize the WepinLogin instance and perform various login operations using OAuth providers, email/password, access tokens, and ID tokens. It also shows how to obtain a signature for login. ```kotlin coroutineScope.launch { //WepinLogin instance generate val wepinLogin: WepinLogin = WepinLogin( WepinLoginOptions( context = context, appId = appId, appKey = appKey ) ) //WepinLogin initialization wepinLogin.init() { //Log in using an OAuth Provider val response = wepinLogin.loginWithOauthProvider( LoginOauth2Params( provider = "google", clientId = "your-google-client-id" ) ) //Get the sign val sign = wepinLogin.getSignForLogin( privateKeyHex = "private key", message = response.token ) var loginResult: LoginResult? = null if (response.provider == "naver" || response.provider = "discord") { //Log in using an Access Token loginResult = wepinLogin.loginWithAccessToken( LoginOauthAccessTokenRequest( provider = response.provider, token = response.token, sign = sign ) ) } else { //Log in using an ID Token loginResult = wepinLogin.loginWithIdToken( LoginOauthIdTokenRequest( idToken = response.token, sign = sign ) ) } } or { //Log in using email and password val loginResult = wepinLogin.loginWithEmailAndPassword( LoginWithEmailParams( email = "abc@defg.kr", password = "abcdefg$" ) ) } //Wepin Login val userInfo = wepinLogin.loginWepin(loginResult) } ``` -------------------------------- ### Setup Camera Permission for iOS React Native Source: https://docs.wepin.io/en/deprecated/react-native-sdk/installation Configures camera permission for React Native projects using CocoaPods, especially for versions below 0.72. This involves adding a script to the Podfile to set up permissions, including camera access. ```ruby require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' require_relative '../node_modules/react-native-permissions/scripts/setup' ``` -------------------------------- ### Modify Podfile for Camera Permissions (iOS) Source: https://docs.wepin.io/en/deprecated/react-native-sdk/installation Updates the `Podfile` to include setup scripts for `react-native-permissions`, specifically enabling camera access which is required for QR code scanning functionality. This snippet shows the integration for React Native versions 0.72 and above. ```ruby def node_require(script) # Resolve script with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', "require.resolve( '#{script}', {paths: [process.argv[1]]}, )", __dir__]).strip end node_require('react-native/scripts/react_native_pods.rb') node_require('react-native-permissions/scripts/setup.rb') ``` -------------------------------- ### Initialize Wepin SDK with Unity Source: https://docs.wepin.io/en/deprecated/unity-sdk/init This snippet demonstrates how to initialize the Wepin SDK in a Unity project. It covers importing necessary namespaces, creating a Wepin instance, and calling the Initialize method with authentication credentials and widget attributes. The isInitialized method can be used to confirm successful setup. ```csharp using WepinSDK.Wepin; using WepinSDK.Types; Wepin _wepin = Wepin.Instance; _wepin.Initialize("app_id_eg12sf3491azgs520", "ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313", new Attributes() { defaultLanguage = "ko", defaultCurrency = "krw" }); if(_wepin.isInitialized()) { // Success to initialize wepin } ``` -------------------------------- ### init() Source: https://docs.wepin.io/en/widget-integration/web-javascript-sdk/provider/kaia-provider Initializes the Wepin Provider, optionally setting default language and currency for the widget. ```APIDOC ## init Initializes the Wepin Provider. ### Method `await wepinProvider.init(attributes?)` ### Parameters * `attributes` (object) - Optional * `defaultLanguage` (string) - The language to be displayed on the widget (default: 'ko'). Currently, only 'ko', 'en', and 'ja' are supported. * `defaultCurrency` (string) - The currency to be displayed on the widget (default: 'KRW'). Currently, only 'KRW', 'USD', and 'JPY' are supported. ### Return value * `Promise` ### Example ```javascript await wepinProvider.init({ defaultLanguage: 'en', defaultCurrency: 'USD', }); ``` ``` -------------------------------- ### Initialize Wepin Compose Multiplatform Login Library Source: https://docs.wepin.io/en/widget-integration This guide explains how to initialize the Wepin Compose Multiplatform Login Library. It provides instructions for setting up the login SDK within a Compose Multiplatform application. ```kotlin WepinLoginSdk.initialize() ``` -------------------------------- ### Import WepinPin Module in Swift Source: https://docs.wepin.io/en/widget-integration/ios-swift-sdk/pin-pad-library/installation Once installed and configured, import the WepinPin module into your Swift project to start using its functionalities. ```swift import WepinPin ``` -------------------------------- ### Wepin Initialization Example (Java) Source: https://docs.wepin.io/en/deprecated/android-java-and-kotlin-sdk/init Provides a comprehensive example of initializing the Wepin widget, including creating an instance, defining widget attributes, setting up WepinOptions, and conditionally initializing if not already done. This demonstrates the complete workflow. ```java Wepin wepin = Wepin.getInstance(MainActivity.this); WidgetAttributes attributes = new WidgetAttributes("hide", "ko", "KRW"); WepinOptions wepinOptions = new WepinOptions( "app_id_eg12sf3491azgs520", "ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313", attributes ); if(!wepin.isInitialized()) { wepin.initialize(widgetOptions); } ``` -------------------------------- ### Install Peer Dependencies for Wepin Provider RN (npm/yarn) Source: https://docs.wepin.io/en/widget-integration/react-native-sdk/provider/installation Install necessary peer dependencies, specifically 'react-native-device-info', and then run 'pod install' for iOS. This ensures that the Wepin Provider RN package has all its required components. ```bash npm install react-native-device-info # for ios cd ios pod install ``` ```bash npm install react-native-device-info # for ios cd ios pod install ``` -------------------------------- ### Sign Up with Email and Password using Swift Source: https://docs.wepin.io/en/widget-integration/ios-swift-sdk/widget-library/methods Registers a new user account using an email address and password. Requires email and password parameters. Returns user information upon successful signup. Catches and displays any errors encountered during the process. ```swift do { let email = "EMAIL-ADDRESS" let password = "PASSWORD" let params = WepinLoginWithEmailParams(email: email, password: password) wepinLoginRes = try await wepin!.login.signUpWithEmailAndPassword(params: params) self.tvResult.text = String("Successed: (wepinLoginRes)") } catch (let error){ self.tvResult.text = String("Faild: (error)") } ``` -------------------------------- ### Initialize Wepin iOS Login Library Source: https://docs.wepin.io/en/widget-integration/ios-swift-sdk/login-library/init Demonstrates the initialization process for the Wepin iOS Login Library. This involves creating WepinLoginParams with App ID and App Key, instantiating WepinLogin, and calling the initialize method. Error handling is included for the asynchronous initialization call. ```swift let initParam = WepinLoginParams(appId: appId, appKey: appKey) WepinLogin wepin = new WepinLogin(initParam) await wepin!.initialize() let appKey: String = "Wepin-App-Key" let appId: String = "Wepin-App-ID" var wepin: WepinLogin? = nil let initParam = WepinLoginParams(appId: appId, appKey: appKey) wepin = WepinLogin(initParam) // Call initialize function do{ let res = try await wepin!.initialize() self.tvResult.text = String("Successed: " + String(res!)) } catch (let error){ self.tvResult.text = String("Faild: \(error)") } ``` -------------------------------- ### Install Wepin Login RN via npm Source: https://docs.wepin.io/en/widget-integration/react-native-sdk/login-library/installation Installs the Wepin Login React Native package using npm. This is the primary method for adding the package to your project. ```bash npm install @wepin/login-rn ``` -------------------------------- ### Login with Email and Password Example (Dart) Source: https://docs.wepin.io/en/widget-integration/flutter-sdk/login-library/methods Demonstrates how to log in a user using their email and password and subsequently check their Wepin login status. This method returns user information and status, which can be used to determine if further registration steps are needed. ```dart final userInfo = await wepinLogin.loginWithEmailAndPassword( email: "abc@abc.com", password: "user_password" ); final userStatus = userInfo.userStatus; if (userStatus.loginStatus == 'pinRequired' || userStatus.loginStatus == 'registerRequired') { // Wepin register } ``` -------------------------------- ### Install Wepin Login RN via yarn Source: https://docs.wepin.io/en/widget-integration/react-native-sdk/login-library/installation Installs the Wepin Login React Native package using yarn. This is an alternative package manager for adding the package to your project. ```bash yarn add @wepin/login-rn ``` -------------------------------- ### Flutter SDK Guides Source: https://docs.wepin.io/en/widget-integration Guides for integrating Wepin SDKs into Flutter applications, covering Login Library, PIN Pad Library, and Widget. ```APIDOC ## Flutter SDK Integration This section covers the integration of Wepin SDKs within Flutter applications. ### Initialization Guides on how to initialize the Wepin Flutter Login Library, PIN Pad Library, and Widget SDK. - **Login Library Initialization**: `/en/widget-integration/flutter-sdk/login-library/initialization.md` - **PIN Pad Library Initialization**: `/en/widget-integration/flutter-sdk/pin-pad-library/init.md` - **Widget SDK Initialization**: `/en/widget-integration/flutter-sdk/widget/initialization.md` ### Installation Guides on installing the necessary Wepin SDK packages for Flutter. - **Widget SDK Installation**: `/en/widget-integration/flutter-sdk/widget/installation.md` - **PIN Pad Library Installation**: `/en/widget-integration/flutter-sdk/pin-pad-library/installation.md` ### Methods Documentation for the methods available in the Wepin Flutter SDKs. - **Login Library Methods**: `/en/widget-integration/flutter-sdk/login-library/methods.md` - **PIN Pad Library Methods**: `/en/widget-integration/flutter-sdk/pin-pad-library/method.md` - **Widget SDK Methods**: `/en/widget-integration/flutter-sdk/widget/method.md` ### Other Guides - **PIN Pad Library Overview**: `/en/widget-integration/flutter-sdk/pin-pad-library.md` - **Widget Overview**: `/en/widget-integration/flutter-sdk/widget.md` - **Final Review**: `/en/widget-integration/flutter-sdk/widget/final-review.md` ``` -------------------------------- ### Create and Initialize WepinLogin Instance Source: https://docs.wepin.io/en/widget-integration/compose-multiplatform-sdk/login-library/initialization Instantiate the WepinLogin class with your application's context, appId, and appKey. After instantiation, call the init() method to complete the SDK setup. Ensure your app information is registered in the Wepin Workspace prior to this step. ```kotlin private val wepinLogin: WepinLogin = WepinLogin( WepinLoginOptions( context = context, //Android: Context, ios: UIViewController appId = appId, appKey = appKey ) ) wepinLogin.init() ``` -------------------------------- ### Install Wepin React Native SDK with npm or yarn Source: https://docs.wepin.io/en/deprecated/react-native-sdk/installation Installs the core Wepin React Native SDK package. This is the primary step for integrating Wepin into your React Native application. ```npm npm install @wepin/react-native-sdk ``` ```yarn yarn add @wepin/react-native-sdk ``` -------------------------------- ### Install WepinWidget using CocoaPods Source: https://docs.wepin.io/en/widget-integration/ios-swift-sdk/widget-library/installation Add the WepinWidget dependency to your project's Podfile. This is the standard method for integrating the SDK via CocoaPods. ```ruby pod 'WepinWidget' ``` -------------------------------- ### Install Wepin Provider RN Package (npm/yarn) Source: https://docs.wepin.io/en/widget-integration/react-native-sdk/provider/installation Install the Wepin Provider RN package using either npm or yarn. This is the primary step to integrate Wepin's authentication services into your React Native application. ```bash npm install @wepin/provider-rn ``` ```bash yarn add @wepin/provider-rn ``` -------------------------------- ### Wepin SDK Initialization Source: https://docs.wepin.io/en/deprecated/unity-sdk/init This section details how to initialize the Wepin widget Unity SDK. It covers creating a Wepin instance, calling the Initialize method with the necessary credentials and attributes, and checking if the initialization was successful. ```APIDOC ## Initialization ### Description Initializes the Wepin widget Unity SDK. ### Method `Initialize` ### Endpoint N/A (Method call within Unity script) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp Wepin _wepin = Wepin.Instance; _wepin.Initialize("app_id_eg12sf3491azgs520", "ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313", new Attributes() { defaultLanguage = "ko", defaultCurrency = "krw" }); ``` ### Parameters for Initialize Method * **`appId`** (String) - Required - App ID assigned during registration. * **`appKey`** (String) - Required - App Key assigned during registration. * **`attributes`** (WepinSDK.Types.Attributes) - Required - Properties of the Wepin Widget: * **`defaultLanguage`** (String) - Optional - The language to be displayed on the widget. Default is `ko`. Supported languages: `en`, `ko`. * **`defaultCurrency`** (String) - Optional - The currency to be displayed on the widget. Default is `KRW`. Supported currencies: `USD`, `KRW`. ## `isInitialized` ### Description Checks if the Wepin instance has been initialized successfully. ### Method `isInitialized` ### Endpoint N/A (Method call within Unity script) ### Parameters None ### Request Example ```csharp if(_wepin.isInitialized()) { // Success to initialize wepin } ``` ### Response #### Success Response (Boolean) * **`result`** (boolean) - `true` if Wepin SDK is already initialized, otherwise `false`. #### Response Example `true` or `false` ``` -------------------------------- ### Install Wepin iOS SDK via CocoaPods Source: https://docs.wepin.io/en/deprecated/ios-swift-sdk/installation This code snippet demonstrates how to add the Wepin iOS SDK to your project using CocoaPods. Ensure you have CocoaPods installed and configured in your project. This is the primary method for integrating the SDK. ```ruby pod 'wepin' ``` -------------------------------- ### Install rn-nodeify for Provider Feature Source: https://docs.wepin.io/en/deprecated/react-native-sdk/installation Installs the `rn-nodeify` package as a development dependency, which is required for the provider feature in React Native environments from SDK version 0.0.7-alpha onwards. This package helps polyfill Node.js core modules. ```npm npm install --save-dev rn-nodeify ``` ```yarn yarn add --dev rn-nodeify ``` -------------------------------- ### init Method Source: https://docs.wepin.io/en/widget-integration/web-javascript-sdk/provider/ethereum-provider Initialize the Wepin Provider with optional language and currency settings. ```APIDOC ## init Initializes the Wepin Provider with optional attributes. ### Method ```javascript await wepinProvider.init(attributes?) ``` ### Parameters #### Path Parameters * `attributes` (object) - Optional * `defaultLanguage` (string) - The language for the widget. Supported: `'ko'`, `'en'`, `'ja'`. (Default: `'ko'`) * `defaultCurrency` (string) - The currency for the widget. Supported: `'KRW'`, `'USD'`, `'JPY'`. (Default: `'KRW'`) ### Return value * `Promise` ### Request Example ```javascript await wepinProvider.init({ defaultLanguage: 'ko', defaultCurrency: 'KRW', }); ``` ``` -------------------------------- ### Wepin Login Methods (Kotlin) Source: https://docs.wepin.io/en/widget-integration/android-java-and-kotlin-sdk/widget-library/methods Provides examples for various Wepin login authentication methods, including OAuth provider login, email/password sign-up and login, and ID token/access token-based login. It also shows how to get the current user and log out. Ensure the Wepin Login SDK version matches the Wepin Widget SDK version. ```kotlin // Login with OAuth Provider wepinSDK.login.loginWithOauthProvider("google", "your-client-id") .thenCompose { authResult -> // Login using ID Token wepinSDK.login.loginWithIdToken(authResult.idToken) }.thenCompose { idTokenResult -> // Login to Wepin wepinSDK.login.loginWepin(idTokenResult) }.thenAccept { user -> Log.d("WepinSDK", "Login success! User Information: $user") }.exceptionally { e -> Log.e("WepinSDK", "Login fail: ${e.message}", e) null } // Sign up with email and password wepinSDK.login.signUpWithEmailAndPassword( email = 'example@example.com', password = 'password123' ).thenAccept { signUpResult -> Log.d("WepinSDK", "Sign up success! User Information: $user") }.exceptionally { error -> if (error is WepinError) { } } // Get current logged in user information var currentUser = wepinSDK.login.getCurrentWepinUser() .thenAccept { user -> Log.d("WepinSDK", "Current user: $user") }.exceptionally { e -> Log.e("WepinSDK", "getCurrentWepinUser fail", e) null } // logout wepinSDK.login.logout() .thenAccept { result -> Log.d("WepinSDK", "Logout result: $result") }.exceptionally { e -> Log.e("WepinSDK", "Logout fail", e) null } ``` -------------------------------- ### Compose Multiplatform SDK Guides Source: https://docs.wepin.io/en/widget-integration Guides for integrating Wepin SDK into Compose Multiplatform applications, focusing on the Login Library. ```APIDOC ## Compose Multiplatform SDK Integration This section covers the integration of Wepin SDKs within Compose Multiplatform applications. ### Login Library Guides on logging in using Wepin with OAuth tokens or email in Compose Multiplatform. - **Login Library Overview**: `/en/widget-integration/compose-multiplatform-sdk/login-library.md` - **Login Library Installation**: `/en/widget-integration/compose-multiplatform-sdk/login-library/installation.md` - **Login Library Initialization**: `/en/widget-integration/compose-multiplatform-sdk/login-library/initialization.md` - **Login Library Methods**: `/en/widget-integration/compose-multiplatform-sdk/login-library/methods.md` ``` -------------------------------- ### Install Wepin SDK Peer Dependencies Source: https://docs.wepin.io/en/deprecated/react-native-sdk/installation Installs necessary peer dependencies for the Wepin React Native SDK to function correctly. These include libraries for device information, in-app browser, web view, encrypted storage, permissions, and clipboard access. For iOS, it also includes the `pod install` command. ```npm npm install react-native-device-info npm install react-native-inappbrowser-reborn npm install react-native-webview npm install react-native-encrypted-storage npm install react-native-permissions npm install @react-native-clipboard/clipboard # for ios cd ios pod install ``` ```yarn yarn add react-native-device-info yarn add react-native-inappbrowser-reborn yarn add react-native-webview yarn add react-native-encrypted-storage yarn add react-native-permissions yarn add @react-native-clipboard/clipboard # for ios cd ios pod install ``` -------------------------------- ### Configure rn-nodeify in package.json Source: https://docs.wepin.io/en/deprecated/react-native-sdk/installation Adds the `rn-nodeify` command to the `postinstall` script in the `package.json` file. This ensures that Node.js core modules are automatically polyfilled after installation, enabling the provider feature. ```json { "scripts": { ... "postinstall": "rn-nodeify --install fs,crypto,https,http,stream,path,zlib,assert --hack", ... } } ``` -------------------------------- ### Add Wepin Widget SDK via Script Tag Source: https://docs.wepin.io/en/deprecated/web-javascript-sdk/sdk/installation Integrates the Wepin Widget Javascript SDK into an HTML page using a script tag. This method makes the Wepin object available globally in the `window` object, allowing for initialization after the script loads. The `defer` and `async` attributes are recommended for optimal loading. ```html Connect WEPIN<title> <!-- 1. Add Script --> <script src="https://cdn.jsdelivr.net/npm/@wepin/widget-sdk@1.0.0/dist/wepin-widget-sdk.min.js" defer async></script> </head> <script> const testAppKey = 'ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313' // Test App Key const testAppId = 'app_id_eg12sf3491azgs520' // Test App ID // 2. Initialize const wepin = await Wepin.init( testAppId, testAppKey ) </script> ``` -------------------------------- ### OAuth Provider Login and Wepin Login Example (Dart) Source: https://docs.wepin.io/en/widget-integration/flutter-sdk/login-library/methods Illustrates a complete login flow starting with OAuth authentication (e.g., Google, Naver) and proceeding to log the user into Wepin. It covers obtaining necessary signatures and tokens for different providers and handling the user's Wepin status. ```dart final wepinLogin = WepinLogin(appId: 'appId', appKey: 'appKey'); await wepinLogin.init(); final res = await wepinLogin.loginWithOauthProvider( provider: "google", clientId: "your-google-client-id" ); final sign = wepinLogin?.getSignForLogin(privateKey: privateKey, message: res!.token); LoginResult? resLogin; if(provider == 'naver' || provider == 'discord') { resLogin = await wepinLogin.loginWithAccessToken(provider: provider, accessToken: res!.token, sign: sign)); } else { resLogin = await wepinLogin.loginWithIdToken(idToken: res!.token, sign: sign)); } final userInfo = await wepinLogin.loginWepin(resLogin); final userStatus = userInfo.userStatus; if (userStatus.loginStatus == 'pinRequired' || userStatus.loginStatus == 'registerRequired') { // Wepin register } ``` -------------------------------- ### Initialize WepinLogin Instance (JavaScript) Source: https://docs.wepin.io/en/widget-integration/web-javascript-sdk/login-library/installation Initialize the WepinLogin instance after installation by providing your unique 'appId' and 'appKey'. This step is essential for enabling WepinLogin functionalities within your application. ```javascript // 1. Import the package import { WepinLogin } from '@wepin/login-js' // 2. Initialization const wepinLogin = new WepinLogin({ appId: 'your-wepin-app-id', appKey: 'your-wepin-api-key', }) ``` -------------------------------- ### Install Solana Wallet Adapter (npm/yarn) Source: https://docs.wepin.io/en/widget-integration/web-javascript-sdk/wallet-adapter/solana-wallet-adapter Install the Wepin Solana Wallet Adapter package using either npm or yarn package managers. This is the first step to integrating Wepin's Solana wallet functionality. ```bash npm install @wepin/solana-wallet-adapter ``` ```bash yarn add @wepin/solana-wallet-adapter ``` -------------------------------- ### Add Wepin Flutter PIN Pad Dependency via CLI Source: https://docs.wepin.io/en/widget-integration/flutter-sdk/pin-pad-library/installation Installs the Wepin Flutter PIN Pad library using the Flutter package manager command line interface. This is a quick way to add the dependency to your project. ```bash flutter pub add wepin_flutter_pin_pad ``` -------------------------------- ### Install Wepin Flutter Widget SDK Source: https://docs.wepin.io/en/widget-integration/flutter-sdk/widget/installation Installs the Wepin Flutter Widget SDK. This can be done using the 'flutter pub add' command or by manually adding the dependency to the 'pubspec.yaml' file. Ensure you are using a compatible Flutter version. ```bash $ flutter pub add wepin_flutter_widget_sdk ``` ```yaml dependencies: wepin_flutter_widget_sdk: ^0.0.1 ``` -------------------------------- ### Wepin Provider Initialization Source: https://docs.wepin.io/en/widget-integration/web-javascript-sdk/provider/solana-provider Instantiate the WepinProvider with your application's credentials. ```APIDOC ## Initialization Instantiate the WepinProvider using your `appId` and `appKey`. ### Request Body - **appId** (string) - Required - Your Wepin application ID. - **appKey** (string) - Required - Your Wepin application key. ### Request Example ```javascript import { WepinProvider } from '@wepin/provider-js'; const wepinProvider = new WepinProvider({ appId: 'your-wepin-app-id', appKey: 'your-wepin-api-key', }); ``` ``` -------------------------------- ### Add Wepin PIN Pad SDK Dependency to Gradle (Kotlin DSL) Source: https://docs.wepin.io/en/widget-integration/android-java-and-kotlin-sdk/pin-pad-library/installation This snippet demonstrates how to include the Wepin PIN Pad SDK as a dependency in your app's build.gradle file using Kotlin DSL. Replace 'vX.X.X' with the desired release version of the SDK. This makes the SDK's functionality available in your application. ```kotlin dependencies { // ... implementation("com.github.WepinWallet:wepin-android-sdk-pin-v1:vX.X.X") } ``` -------------------------------- ### Add Network and Internet Permissions Source: https://docs.wepin.io/en/widget-integration/android-java-and-kotlin-sdk/login-library/installation Declare necessary network permissions in your AndroidManifest.xml file. These permissions allow the WepinLoginLibrary to access network resources for authentication and communication. ```xml <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> ```