├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .npmignore ├── .prettierignore ├── .prettierrc.yaml ├── .vscode ├── launch.json └── settings.json ├── LICENSE ├── README.md ├── demo ├── rn-bare-example │ ├── .bundle │ │ └── config │ ├── .gitignore │ ├── .watchmanconfig │ ├── App.tsx │ ├── Gemfile │ ├── README.md │ ├── __tests__ │ │ └── App.test.tsx │ ├── android │ │ ├── app │ │ │ ├── build.gradle │ │ │ ├── debug.keystore │ │ │ ├── proguard-rules.pro │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ └── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── web3authrnexample │ │ │ │ │ ├── MainActivity.kt │ │ │ │ │ └── MainApplication.kt │ │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── rn_edit_text_material.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle │ ├── app.json │ ├── babel.config.js │ ├── globals.js │ ├── index.js │ ├── ios │ │ ├── .xcode.env │ │ ├── Podfile │ │ ├── Podfile.lock │ │ ├── web3authrnexample.xcodeproj │ │ │ ├── project.pbxproj │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── web3authrnexample.xcscheme │ │ ├── web3authrnexample.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ ├── web3authrnexample │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.mm │ │ │ ├── Images.xcassets │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ ├── Info.plist │ │ │ ├── LaunchScreen.storyboard │ │ │ ├── PrivacyInfo.xcprivacy │ │ │ └── main.m │ │ └── web3authrnexampleTests │ │ │ ├── Info.plist │ │ │ └── web3authrnexampleTests.m │ ├── jest.config.js │ ├── metro.config.js │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json └── rn-expo-example │ ├── .gitignore │ ├── App.tsx │ ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── web3authexpoexample │ │ │ │ ├── MainActivity.kt │ │ │ │ └── MainApplication.kt │ │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ └── splashscreen_image.png │ │ │ ├── drawable-mdpi │ │ │ └── splashscreen_image.png │ │ │ ├── drawable-xhdpi │ │ │ └── splashscreen_image.png │ │ │ ├── drawable-xxhdpi │ │ │ └── splashscreen_image.png │ │ │ ├── drawable-xxxhdpi │ │ │ └── splashscreen_image.png │ │ │ ├── drawable │ │ │ ├── rn_edit_text_material.xml │ │ │ └── splashscreen.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── values-night │ │ │ └── colors.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle │ ├── app.json │ ├── assets │ ├── adaptive-icon.png │ ├── favicon.png │ ├── icon.png │ └── splash.png │ ├── babel.config.js │ ├── globals.js │ ├── ios │ ├── .gitignore │ ├── .xcode.env │ ├── Podfile │ ├── Podfile.lock │ ├── Podfile.properties.json │ ├── PrivacyInfo.xcprivacy │ ├── web3authexpoexample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── web3authexpoexample.xcscheme │ ├── web3authexpoexample.xcworkspace │ │ └── contents.xcworkspacedata │ └── web3authexpoexample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── App-Icon-1024x1024@1x.png │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── SplashScreen.imageset │ │ │ ├── Contents.json │ │ │ └── image.png │ │ └── SplashScreenBackground.imageset │ │ │ ├── Contents.json │ │ │ └── image.png │ │ ├── Info.plist │ │ ├── SplashScreen.storyboard │ │ ├── Supporting │ │ └── Expo.plist │ │ ├── main.m │ │ ├── noop-file.swift │ │ ├── web3authexpoexample-Bridging-Header.h │ │ └── web3authexpoexample.entitlements │ ├── metro.config.js │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── package-lock.json ├── package.json ├── src ├── Web3Auth.ts ├── constants.ts ├── errors.ts ├── index.ts ├── session │ └── KeyStore.ts ├── types │ ├── IEncryptedStorage.ts │ ├── IExpoSecureStore.ts │ ├── IWebBrowser.ts │ └── interface.ts └── utils.ts ├── torus.config.js └── tsconfig.json /.eslintignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | #production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | examples/ 23 | types/ 24 | dist/ -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | require("@rushstack/eslint-patch/modern-module-resolution"); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ["@toruslabs/eslint-config-typescript"], 6 | parser: "@typescript-eslint/parser", 7 | ignorePatterns: ["*.config.js", "demo/*", ".eslintrc.js"], 8 | parserOptions: { 9 | sourceType: "module", 10 | ecmaVersion: 2022, 11 | project: "./tsconfig.json", 12 | }, 13 | rules: { 14 | camelcase: 0, 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.toptal.com/developers/gitignore/api/android,androidstudio,xcode,reactnative,node,yarn 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=android,androidstudio,xcode,reactnative,node,yarn 4 | 5 | ### Android ### 6 | # Built application files 7 | *.apk 8 | *.aar 9 | *.ap_ 10 | *.aab 11 | 12 | # Files for the ART/Dalvik VM 13 | *.dex 14 | 15 | # Java class files 16 | *.class 17 | 18 | # Generated files 19 | bin/ 20 | gen/ 21 | out/ 22 | # Uncomment the following line in case you need and you don't have the release build type files in your app 23 | # release/ 24 | 25 | # Gradle files 26 | .gradle/ 27 | build/ 28 | 29 | # Local configuration file (sdk path, etc) 30 | local.properties 31 | 32 | # Proguard folder generated by Eclipse 33 | proguard/ 34 | 35 | # Log Files 36 | *.log 37 | 38 | # Android Studio Navigation editor temp files 39 | .navigation/ 40 | 41 | # Android Studio captures folder 42 | captures/ 43 | 44 | # IntelliJ 45 | *.iml 46 | .idea/workspace.xml 47 | .idea/tasks.xml 48 | .idea/gradle.xml 49 | .idea/assetWizardSettings.xml 50 | .idea/dictionaries 51 | .idea/libraries 52 | .idea/jarRepositories.xml 53 | # Android Studio 3 in .gitignore file. 54 | .idea/caches 55 | .idea/modules.xml 56 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 57 | .idea/navEditor.xml 58 | 59 | # Keystore files 60 | # Uncomment the following lines if you do not want to check your keystore files in. 61 | #*.jks 62 | #*.keystore 63 | 64 | # External native build folder generated in Android Studio 2.2 and later 65 | .externalNativeBuild 66 | .cxx/ 67 | 68 | # Google Services (e.g. APIs or Firebase) 69 | # google-services.json 70 | 71 | # Freeline 72 | freeline.py 73 | freeline/ 74 | freeline_project_description.json 75 | 76 | # fastlane 77 | fastlane/report.xml 78 | fastlane/Preview.html 79 | fastlane/screenshots 80 | fastlane/test_output 81 | fastlane/readme.md 82 | 83 | # Version control 84 | vcs.xml 85 | 86 | # lint 87 | lint/intermediates/ 88 | lint/generated/ 89 | lint/outputs/ 90 | lint/tmp/ 91 | # lint/reports/ 92 | 93 | # Android Profiling 94 | *.hprof 95 | 96 | ### Android Patch ### 97 | gen-external-apklibs 98 | output.json 99 | 100 | # Replacement of .externalNativeBuild directories introduced 101 | # with Android Studio 3.5. 102 | 103 | ### Node ### 104 | # Logs 105 | logs 106 | npm-debug.log* 107 | yarn-debug.log* 108 | yarn-error.log* 109 | lerna-debug.log* 110 | .pnpm-debug.log* 111 | 112 | # Diagnostic reports (https://nodejs.org/api/report.html) 113 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 114 | 115 | # Runtime data 116 | pids 117 | *.pid 118 | *.seed 119 | *.pid.lock 120 | 121 | # Directory for instrumented libs generated by jscoverage/JSCover 122 | lib-cov 123 | 124 | # Coverage directory used by tools like istanbul 125 | coverage 126 | *.lcov 127 | 128 | # nyc test coverage 129 | .nyc_output 130 | 131 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 132 | .grunt 133 | 134 | # Bower dependency directory (https://bower.io/) 135 | bower_components 136 | 137 | # node-waf configuration 138 | .lock-wscript 139 | 140 | # Compiled binary addons (https://nodejs.org/api/addons.html) 141 | build/Release 142 | 143 | # Dependency directories 144 | node_modules/ 145 | jspm_packages/ 146 | 147 | # Snowpack dependency directory (https://snowpack.dev/) 148 | web_modules/ 149 | 150 | # TypeScript cache 151 | *.tsbuildinfo 152 | 153 | # Optional npm cache directory 154 | .npm 155 | 156 | # Optional eslint cache 157 | .eslintcache 158 | 159 | # Microbundle cache 160 | .rpt2_cache/ 161 | .rts2_cache_cjs/ 162 | .rts2_cache_es/ 163 | .rts2_cache_umd/ 164 | 165 | # Optional REPL history 166 | .node_repl_history 167 | 168 | # Output of 'npm pack' 169 | *.tgz 170 | 171 | # Yarn Integrity file 172 | .yarn-integrity 173 | 174 | # dotenv environment variables file 175 | .env 176 | .env.test 177 | .env.production 178 | 179 | # parcel-bundler cache (https://parceljs.org/) 180 | .cache 181 | .parcel-cache 182 | 183 | # Next.js build output 184 | .next 185 | out 186 | 187 | # Nuxt.js build / generate output 188 | .nuxt 189 | dist 190 | 191 | # Gatsby files 192 | .cache/ 193 | # Comment in the public line in if your project uses Gatsby and not Next.js 194 | # https://nextjs.org/blog/next-9-1#public-directory-support 195 | # public 196 | 197 | # vuepress build output 198 | .vuepress/dist 199 | 200 | # Serverless directories 201 | .serverless/ 202 | 203 | # FuseBox cache 204 | .fusebox/ 205 | 206 | # DynamoDB Local files 207 | .dynamodb/ 208 | 209 | # TernJS port file 210 | .tern-port 211 | 212 | # Stores VSCode versions used for testing VSCode extensions 213 | .vscode-test 214 | 215 | # yarn v2 216 | .yarn/cache 217 | .yarn/unplugged 218 | .yarn/build-state.yml 219 | .yarn/install-state.gz 220 | .pnp.* 221 | 222 | ### Node Patch ### 223 | # Serverless Webpack directories 224 | .webpack/ 225 | 226 | # Optional stylelint cache 227 | .stylelintcache 228 | 229 | # SvelteKit build / generate output 230 | .svelte-kit 231 | 232 | ### ReactNative ### 233 | # React Native Stack Base 234 | 235 | .expo 236 | __generated__ 237 | 238 | ### ReactNative.Android Stack ### 239 | # Built application files 240 | 241 | # Files for the ART/Dalvik VM 242 | 243 | # Java class files 244 | 245 | # Generated files 246 | # Uncomment the following line in case you need and you don't have the release build type files in your app 247 | # release/ 248 | 249 | # Gradle files 250 | 251 | # Local configuration file (sdk path, etc) 252 | 253 | # Proguard folder generated by Eclipse 254 | 255 | # Log Files 256 | 257 | # Android Studio Navigation editor temp files 258 | 259 | # Android Studio captures folder 260 | 261 | # IntelliJ 262 | # Android Studio 3 in .gitignore file. 263 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 264 | 265 | # Keystore files 266 | # Uncomment the following lines if you do not want to check your keystore files in. 267 | 268 | # External native build folder generated in Android Studio 2.2 and later 269 | 270 | # Google Services (e.g. APIs or Firebase) 271 | # google-services.json 272 | 273 | # Freeline 274 | 275 | # fastlane 276 | 277 | # Version control 278 | 279 | # lint 280 | # lint/reports/ 281 | 282 | # Android Profiling 283 | 284 | ### ReactNative.Buck Stack ### 285 | buck-out/ 286 | .buckconfig.local 287 | .buckd/ 288 | .buckversion 289 | .fakebuckversion 290 | 291 | ### ReactNative.Gradle Stack ### 292 | .gradle 293 | 294 | # Ignore Gradle GUI config 295 | gradle-app.setting 296 | 297 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 298 | !gradle-wrapper.jar 299 | 300 | # Cache of project 301 | .gradletasknamecache 302 | 303 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 304 | # gradle/wrapper/gradle-wrapper.properties 305 | 306 | ### ReactNative.Linux Stack ### 307 | *~ 308 | 309 | # temporary files which can be created if a process still has a handle open of a deleted file 310 | .fuse_hidden* 311 | 312 | # KDE directory preferences 313 | .directory 314 | 315 | # Linux trash folder which might appear on any partition or disk 316 | .Trash-* 317 | 318 | # .nfs files are created when an open file is removed but is still being accessed 319 | .nfs* 320 | 321 | ### ReactNative.Node Stack ### 322 | # Logs 323 | 324 | # Diagnostic reports (https://nodejs.org/api/report.html) 325 | 326 | # Runtime data 327 | 328 | # Directory for instrumented libs generated by jscoverage/JSCover 329 | 330 | # Coverage directory used by tools like istanbul 331 | 332 | # nyc test coverage 333 | 334 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 335 | 336 | # Bower dependency directory (https://bower.io/) 337 | 338 | # node-waf configuration 339 | 340 | # Compiled binary addons (https://nodejs.org/api/addons.html) 341 | 342 | # Dependency directories 343 | 344 | # Snowpack dependency directory (https://snowpack.dev/) 345 | 346 | # TypeScript cache 347 | 348 | # Optional npm cache directory 349 | 350 | # Optional eslint cache 351 | 352 | # Microbundle cache 353 | 354 | # Optional REPL history 355 | 356 | # Output of 'npm pack' 357 | 358 | # Yarn Integrity file 359 | 360 | # dotenv environment variables file 361 | 362 | # parcel-bundler cache (https://parceljs.org/) 363 | 364 | # Next.js build output 365 | 366 | # Nuxt.js build / generate output 367 | 368 | # Gatsby files 369 | # Comment in the public line in if your project uses Gatsby and not Next.js 370 | # https://nextjs.org/blog/next-9-1#public-directory-support 371 | # public 372 | 373 | # vuepress build output 374 | 375 | # Serverless directories 376 | 377 | # FuseBox cache 378 | 379 | # DynamoDB Local files 380 | 381 | # TernJS port file 382 | 383 | # Stores VSCode versions used for testing VSCode extensions 384 | 385 | # yarn v2 386 | 387 | ### ReactNative.Xcode Stack ### 388 | # Xcode 389 | # 390 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 391 | 392 | ## User settings 393 | xcuserdata/ 394 | 395 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 396 | *.xcscmblueprint 397 | *.xccheckout 398 | 399 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 400 | DerivedData/ 401 | *.moved-aside 402 | *.pbxuser 403 | !default.pbxuser 404 | *.mode1v3 405 | !default.mode1v3 406 | *.mode2v3 407 | !default.mode2v3 408 | *.perspectivev3 409 | !default.perspectivev3 410 | 411 | ## Gcc Patch 412 | /*.gcno 413 | 414 | ### ReactNative.macOS Stack ### 415 | # General 416 | .DS_Store 417 | .AppleDouble 418 | .LSOverride 419 | 420 | # Icon must end with two \r 421 | Icon 422 | 423 | 424 | # Thumbnails 425 | ._* 426 | 427 | # Files that might appear in the root of a volume 428 | .DocumentRevisions-V100 429 | .fseventsd 430 | .Spotlight-V100 431 | .TemporaryItems 432 | .Trashes 433 | .VolumeIcon.icns 434 | .com.apple.timemachine.donotpresent 435 | 436 | # Directories potentially created on remote AFP share 437 | .AppleDB 438 | .AppleDesktop 439 | Network Trash Folder 440 | Temporary Items 441 | .apdisk 442 | 443 | ### Xcode ### 444 | # Xcode 445 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 446 | 447 | 448 | 449 | 450 | 451 | ### Xcode Patch ### 452 | *.xcodeproj/* 453 | !*.xcodeproj/project.pbxproj 454 | !*.xcodeproj/xcshareddata/ 455 | !*.xcworkspace/contents.xcworkspacedata 456 | **/xcshareddata/WorkspaceSettings.xcsettings 457 | 458 | ### yarn ### 459 | # https://yarnpkg.com/advanced/qa#which-files-should-be-gitignored 460 | 461 | .yarn/* 462 | !.yarn/releases 463 | !.yarn/plugins 464 | !.yarn/sdks 465 | !.yarn/versions 466 | 467 | # if you are NOT using Zero-installs, then: 468 | # comment the following lines 469 | !.yarn/cache 470 | 471 | # and uncomment the following lines 472 | # .pnp.* 473 | 474 | ### AndroidStudio ### 475 | # Covers files to be ignored for android development using Android Studio. 476 | 477 | # Built application files 478 | 479 | # Files for the ART/Dalvik VM 480 | 481 | # Java class files 482 | 483 | # Generated files 484 | 485 | # Gradle files 486 | 487 | # Signing files 488 | .signing/ 489 | 490 | # Local configuration file (sdk path, etc) 491 | 492 | # Proguard folder generated by Eclipse 493 | 494 | # Log Files 495 | 496 | # Android Studio 497 | /*/build/ 498 | /*/local.properties 499 | /*/out 500 | /*/*/build 501 | /*/*/production 502 | *.ipr 503 | *.swp 504 | 505 | # Keystore files 506 | *.jks 507 | *.keystore 508 | 509 | # Google Services (e.g. APIs or Firebase) 510 | # google-services.json 511 | 512 | # Android Patch 513 | 514 | # External native build folder generated in Android Studio 2.2 and later 515 | 516 | # NDK 517 | obj/ 518 | 519 | # IntelliJ IDEA 520 | *.iws 521 | /out/ 522 | 523 | # User-specific configurations 524 | .idea/caches/ 525 | .idea/libraries/ 526 | .idea/shelf/ 527 | .idea/.name 528 | .idea/compiler.xml 529 | .idea/copyright/profiles_settings.xml 530 | .idea/encodings.xml 531 | .idea/misc.xml 532 | .idea/scopes/scope_settings.xml 533 | .idea/vcs.xml 534 | .idea/jsLibraryMappings.xml 535 | .idea/datasources.xml 536 | .idea/dataSources.ids 537 | .idea/sqlDataSources.xml 538 | .idea/dynamic.xml 539 | .idea/uiDesigner.xml 540 | 541 | # OS-specific files 542 | .DS_Store? 543 | ehthumbs.db 544 | Thumbs.db 545 | 546 | # Legacy Eclipse project files 547 | .classpath 548 | .project 549 | .cproject 550 | .settings/ 551 | 552 | # Mobile Tools for Java (J2ME) 553 | .mtj.tmp/ 554 | 555 | # Package Files # 556 | *.war 557 | *.ear 558 | 559 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) 560 | hs_err_pid* 561 | 562 | ## Plugin-specific files: 563 | 564 | # mpeltonen/sbt-idea plugin 565 | .idea_modules/ 566 | 567 | # JIRA plugin 568 | atlassian-ide-plugin.xml 569 | 570 | # Mongo Explorer plugin 571 | .idea/mongoSettings.xml 572 | 573 | # Crashlytics plugin (for Android Studio and IntelliJ) 574 | com_crashlytics_export_strings.xml 575 | crashlytics.properties 576 | crashlytics-build.properties 577 | fabric.properties 578 | 579 | ### AndroidStudio Patch ### 580 | 581 | !/gradle/wrapper/gradle-wrapper.jar 582 | 583 | # End of https://www.toptal.com/developers/gitignore/api/android,androidstudio,xcode,reactnative,node,yarn 584 | 585 | /.yalc/ 586 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.toptal.com/developers/gitignore/api/android,androidstudio,xcode,reactnative,node,yarn 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=android,androidstudio,xcode,reactnative,node,yarn 4 | 5 | ### Android ### 6 | # Built application files 7 | *.apk 8 | *.aar 9 | *.ap_ 10 | *.aab 11 | 12 | # Files for the ART/Dalvik VM 13 | *.dex 14 | 15 | # Java class files 16 | *.class 17 | 18 | # Generated files 19 | bin/ 20 | gen/ 21 | out/ 22 | # Uncomment the following line in case you need and you don't have the release build type files in your app 23 | # release/ 24 | 25 | # Gradle files 26 | .gradle/ 27 | build/ 28 | 29 | # Local configuration file (sdk path, etc) 30 | local.properties 31 | 32 | # Proguard folder generated by Eclipse 33 | proguard/ 34 | 35 | # Log Files 36 | *.log 37 | 38 | # Android Studio Navigation editor temp files 39 | .navigation/ 40 | 41 | # Android Studio captures folder 42 | captures/ 43 | 44 | # IntelliJ 45 | *.iml 46 | .idea/workspace.xml 47 | .idea/tasks.xml 48 | .idea/gradle.xml 49 | .idea/assetWizardSettings.xml 50 | .idea/dictionaries 51 | .idea/libraries 52 | .idea/jarRepositories.xml 53 | # Android Studio 3 in .gitignore file. 54 | .idea/caches 55 | .idea/modules.xml 56 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 57 | .idea/navEditor.xml 58 | 59 | # Keystore files 60 | # Uncomment the following lines if you do not want to check your keystore files in. 61 | #*.jks 62 | #*.keystore 63 | 64 | # External native build folder generated in Android Studio 2.2 and later 65 | .externalNativeBuild 66 | .cxx/ 67 | 68 | # Google Services (e.g. APIs or Firebase) 69 | # google-services.json 70 | 71 | # Freeline 72 | freeline.py 73 | freeline/ 74 | freeline_project_description.json 75 | 76 | # fastlane 77 | fastlane/report.xml 78 | fastlane/Preview.html 79 | fastlane/screenshots 80 | fastlane/test_output 81 | fastlane/readme.md 82 | 83 | # Version control 84 | vcs.xml 85 | 86 | # lint 87 | lint/intermediates/ 88 | lint/generated/ 89 | lint/outputs/ 90 | lint/tmp/ 91 | # lint/reports/ 92 | 93 | # Android Profiling 94 | *.hprof 95 | 96 | ### Android Patch ### 97 | gen-external-apklibs 98 | output.json 99 | 100 | # Replacement of .externalNativeBuild directories introduced 101 | # with Android Studio 3.5. 102 | 103 | ### Node ### 104 | # Logs 105 | logs 106 | npm-debug.log* 107 | yarn-debug.log* 108 | yarn-error.log* 109 | lerna-debug.log* 110 | .pnpm-debug.log* 111 | 112 | # Diagnostic reports (https://nodejs.org/api/report.html) 113 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 114 | 115 | # Runtime data 116 | pids 117 | *.pid 118 | *.seed 119 | *.pid.lock 120 | 121 | # Directory for instrumented libs generated by jscoverage/JSCover 122 | lib-cov 123 | 124 | # Coverage directory used by tools like istanbul 125 | coverage 126 | *.lcov 127 | 128 | # nyc test coverage 129 | .nyc_output 130 | 131 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 132 | .grunt 133 | 134 | # Bower dependency directory (https://bower.io/) 135 | bower_components 136 | 137 | # node-waf configuration 138 | .lock-wscript 139 | 140 | # Compiled binary addons (https://nodejs.org/api/addons.html) 141 | build/Release 142 | 143 | # Dependency directories 144 | node_modules/ 145 | jspm_packages/ 146 | 147 | # Snowpack dependency directory (https://snowpack.dev/) 148 | web_modules/ 149 | 150 | # TypeScript cache 151 | *.tsbuildinfo 152 | 153 | # Optional npm cache directory 154 | .npm 155 | 156 | # Optional eslint cache 157 | .eslintcache 158 | 159 | # Microbundle cache 160 | .rpt2_cache/ 161 | .rts2_cache_cjs/ 162 | .rts2_cache_es/ 163 | .rts2_cache_umd/ 164 | 165 | # Optional REPL history 166 | .node_repl_history 167 | 168 | # Output of 'npm pack' 169 | *.tgz 170 | 171 | # Yarn Integrity file 172 | .yarn-integrity 173 | 174 | # dotenv environment variables file 175 | .env 176 | .env.test 177 | .env.production 178 | 179 | # parcel-bundler cache (https://parceljs.org/) 180 | .cache 181 | .parcel-cache 182 | 183 | # Next.js build output 184 | .next 185 | out 186 | 187 | # Nuxt.js build / generate output 188 | .nuxt 189 | 190 | # Gatsby files 191 | .cache/ 192 | # Comment in the public line in if your project uses Gatsby and not Next.js 193 | # https://nextjs.org/blog/next-9-1#public-directory-support 194 | # public 195 | 196 | # vuepress build output 197 | .vuepress/dist 198 | 199 | # Serverless directories 200 | .serverless/ 201 | 202 | # FuseBox cache 203 | .fusebox/ 204 | 205 | # DynamoDB Local files 206 | .dynamodb/ 207 | 208 | # TernJS port file 209 | .tern-port 210 | 211 | # Stores VSCode versions used for testing VSCode extensions 212 | .vscode-test 213 | 214 | # yarn v2 215 | .yarn/cache 216 | .yarn/unplugged 217 | .yarn/build-state.yml 218 | .yarn/install-state.gz 219 | .pnp.* 220 | 221 | ### Node Patch ### 222 | # Serverless Webpack directories 223 | .webpack/ 224 | 225 | # Optional stylelint cache 226 | .stylelintcache 227 | 228 | # SvelteKit build / generate output 229 | .svelte-kit 230 | 231 | ### ReactNative ### 232 | # React Native Stack Base 233 | 234 | .expo 235 | __generated__ 236 | 237 | ### ReactNative.Android Stack ### 238 | # Built application files 239 | 240 | # Files for the ART/Dalvik VM 241 | 242 | # Java class files 243 | 244 | # Generated files 245 | # Uncomment the following line in case you need and you don't have the release build type files in your app 246 | # release/ 247 | 248 | # Gradle files 249 | 250 | # Local configuration file (sdk path, etc) 251 | 252 | # Proguard folder generated by Eclipse 253 | 254 | # Log Files 255 | 256 | # Android Studio Navigation editor temp files 257 | 258 | # Android Studio captures folder 259 | 260 | # IntelliJ 261 | # Android Studio 3 in .gitignore file. 262 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 263 | 264 | # Keystore files 265 | # Uncomment the following lines if you do not want to check your keystore files in. 266 | 267 | # External native build folder generated in Android Studio 2.2 and later 268 | 269 | # Google Services (e.g. APIs or Firebase) 270 | # google-services.json 271 | 272 | # Freeline 273 | 274 | # fastlane 275 | 276 | # Version control 277 | 278 | # lint 279 | # lint/reports/ 280 | 281 | # Android Profiling 282 | 283 | ### ReactNative.Buck Stack ### 284 | buck-out/ 285 | .buckconfig.local 286 | .buckd/ 287 | .buckversion 288 | .fakebuckversion 289 | 290 | ### ReactNative.Gradle Stack ### 291 | .gradle 292 | 293 | # Ignore Gradle GUI config 294 | gradle-app.setting 295 | 296 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 297 | !gradle-wrapper.jar 298 | 299 | # Cache of project 300 | .gradletasknamecache 301 | 302 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 303 | # gradle/wrapper/gradle-wrapper.properties 304 | 305 | ### ReactNative.Linux Stack ### 306 | *~ 307 | 308 | # temporary files which can be created if a process still has a handle open of a deleted file 309 | .fuse_hidden* 310 | 311 | # KDE directory preferences 312 | .directory 313 | 314 | # Linux trash folder which might appear on any partition or disk 315 | .Trash-* 316 | 317 | # .nfs files are created when an open file is removed but is still being accessed 318 | .nfs* 319 | 320 | ### ReactNative.Node Stack ### 321 | # Logs 322 | 323 | # Diagnostic reports (https://nodejs.org/api/report.html) 324 | 325 | # Runtime data 326 | 327 | # Directory for instrumented libs generated by jscoverage/JSCover 328 | 329 | # Coverage directory used by tools like istanbul 330 | 331 | # nyc test coverage 332 | 333 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 334 | 335 | # Bower dependency directory (https://bower.io/) 336 | 337 | # node-waf configuration 338 | 339 | # Compiled binary addons (https://nodejs.org/api/addons.html) 340 | 341 | # Dependency directories 342 | 343 | # Snowpack dependency directory (https://snowpack.dev/) 344 | 345 | # TypeScript cache 346 | 347 | # Optional npm cache directory 348 | 349 | # Optional eslint cache 350 | 351 | # Microbundle cache 352 | 353 | # Optional REPL history 354 | 355 | # Output of 'npm pack' 356 | 357 | # Yarn Integrity file 358 | 359 | # dotenv environment variables file 360 | 361 | # parcel-bundler cache (https://parceljs.org/) 362 | 363 | # Next.js build output 364 | 365 | # Nuxt.js build / generate output 366 | 367 | # Gatsby files 368 | # Comment in the public line in if your project uses Gatsby and not Next.js 369 | # https://nextjs.org/blog/next-9-1#public-directory-support 370 | # public 371 | 372 | # vuepress build output 373 | 374 | # Serverless directories 375 | 376 | # FuseBox cache 377 | 378 | # DynamoDB Local files 379 | 380 | # TernJS port file 381 | 382 | # Stores VSCode versions used for testing VSCode extensions 383 | 384 | # yarn v2 385 | 386 | ### ReactNative.Xcode Stack ### 387 | # Xcode 388 | # 389 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 390 | 391 | ## User settings 392 | xcuserdata/ 393 | 394 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 395 | *.xcscmblueprint 396 | *.xccheckout 397 | 398 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 399 | DerivedData/ 400 | *.moved-aside 401 | *.pbxuser 402 | !default.pbxuser 403 | *.mode1v3 404 | !default.mode1v3 405 | *.mode2v3 406 | !default.mode2v3 407 | *.perspectivev3 408 | !default.perspectivev3 409 | 410 | ## Gcc Patch 411 | /*.gcno 412 | 413 | ### ReactNative.macOS Stack ### 414 | # General 415 | .DS_Store 416 | .AppleDouble 417 | .LSOverride 418 | 419 | # Icon must end with two \r 420 | Icon 421 | 422 | 423 | # Thumbnails 424 | ._* 425 | 426 | # Files that might appear in the root of a volume 427 | .DocumentRevisions-V100 428 | .fseventsd 429 | .Spotlight-V100 430 | .TemporaryItems 431 | .Trashes 432 | .VolumeIcon.icns 433 | .com.apple.timemachine.donotpresent 434 | 435 | # Directories potentially created on remote AFP share 436 | .AppleDB 437 | .AppleDesktop 438 | Network Trash Folder 439 | Temporary Items 440 | .apdisk 441 | 442 | ### Xcode ### 443 | # Xcode 444 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 445 | 446 | 447 | 448 | 449 | 450 | ### Xcode Patch ### 451 | *.xcodeproj/* 452 | !*.xcodeproj/project.pbxproj 453 | !*.xcodeproj/xcshareddata/ 454 | !*.xcworkspace/contents.xcworkspacedata 455 | **/xcshareddata/WorkspaceSettings.xcsettings 456 | 457 | ### yarn ### 458 | # https://yarnpkg.com/advanced/qa#which-files-should-be-gitignored 459 | 460 | .yarn/* 461 | !.yarn/releases 462 | !.yarn/plugins 463 | !.yarn/sdks 464 | !.yarn/versions 465 | 466 | # if you are NOT using Zero-installs, then: 467 | # comment the following lines 468 | !.yarn/cache 469 | 470 | # and uncomment the following lines 471 | # .pnp.* 472 | 473 | ### AndroidStudio ### 474 | # Covers files to be ignored for android development using Android Studio. 475 | 476 | # Built application files 477 | 478 | # Files for the ART/Dalvik VM 479 | 480 | # Java class files 481 | 482 | # Generated files 483 | 484 | # Gradle files 485 | 486 | # Signing files 487 | .signing/ 488 | 489 | # Local configuration file (sdk path, etc) 490 | 491 | # Proguard folder generated by Eclipse 492 | 493 | # Log Files 494 | 495 | # Android Studio 496 | /*/build/ 497 | /*/local.properties 498 | /*/out 499 | /*/*/build 500 | /*/*/production 501 | *.ipr 502 | *.swp 503 | 504 | # Keystore files 505 | *.jks 506 | *.keystore 507 | 508 | # Google Services (e.g. APIs or Firebase) 509 | # google-services.json 510 | 511 | # Android Patch 512 | 513 | # External native build folder generated in Android Studio 2.2 and later 514 | 515 | # NDK 516 | obj/ 517 | 518 | # IntelliJ IDEA 519 | *.iws 520 | /out/ 521 | 522 | # User-specific configurations 523 | .idea/caches/ 524 | .idea/libraries/ 525 | .idea/shelf/ 526 | .idea/.name 527 | .idea/compiler.xml 528 | .idea/copyright/profiles_settings.xml 529 | .idea/encodings.xml 530 | .idea/misc.xml 531 | .idea/scopes/scope_settings.xml 532 | .idea/vcs.xml 533 | .idea/jsLibraryMappings.xml 534 | .idea/datasources.xml 535 | .idea/dataSources.ids 536 | .idea/sqlDataSources.xml 537 | .idea/dynamic.xml 538 | .idea/uiDesigner.xml 539 | 540 | # OS-specific files 541 | .DS_Store? 542 | ehthumbs.db 543 | Thumbs.db 544 | 545 | # Legacy Eclipse project files 546 | .classpath 547 | .project 548 | .cproject 549 | .settings/ 550 | 551 | # Mobile Tools for Java (J2ME) 552 | .mtj.tmp/ 553 | 554 | # Package Files # 555 | *.war 556 | *.ear 557 | 558 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) 559 | hs_err_pid* 560 | 561 | ## Plugin-specific files: 562 | 563 | # mpeltonen/sbt-idea plugin 564 | .idea_modules/ 565 | 566 | # JIRA plugin 567 | atlassian-ide-plugin.xml 568 | 569 | # Mongo Explorer plugin 570 | .idea/mongoSettings.xml 571 | 572 | # Crashlytics plugin (for Android Studio and IntelliJ) 573 | com_crashlytics_export_strings.xml 574 | crashlytics.properties 575 | crashlytics-build.properties 576 | fabric.properties 577 | 578 | ### AndroidStudio Patch ### 579 | 580 | !/gradle/wrapper/gradle-wrapper.jar 581 | 582 | # End of https://www.toptal.com/developers/gitignore/api/android,androidstudio,xcode,reactnative,node,yarn 583 | 584 | 585 | 586 | /node_modules 587 | 588 | / 589 | 590 | /.yalc/ -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | #production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /.prettierrc.yaml: -------------------------------------------------------------------------------- 1 | # .prettierrc or .prettierrc.yaml 2 | printWidth: 150 3 | singleQuote: false 4 | semi: true 5 | trailingComma: es5 -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Attach to Hermes application - Experimental", 5 | "request": "attach", 6 | "type": "reactnativedirect", 7 | "cwd": "${workspaceFolder}" 8 | }, 9 | { 10 | "name": "Debug Android Hermes - Experimental", 11 | "request": "launch", 12 | "type": "reactnativedirect", 13 | "cwd": "${workspaceFolder}/rn-bare-example", 14 | "platform": "android" 15 | }, 16 | { 17 | "name": "Debug iOS Hermes - Experimental", 18 | "request": "launch", 19 | "type": "reactnativedirect", 20 | "cwd": "${workspaceFolder}/rn-bare-example", 21 | "platform": "ios" 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "editor.formatOnType": true, 4 | "eslint.alwaysShowStatus": true, 5 | "eslint.debug": false, 6 | "eslint.format.enable": true, 7 | "eslint.lintTask.enable": true, 8 | "editor.codeActionsOnSave": { 9 | "source.fixAll": "explicit" 10 | }, 11 | "eslint.workingDirectories": [ 12 | { 13 | "directory": "example", 14 | "changeProcessCWD": true 15 | }, 16 | { 17 | "directory": ".", 18 | "changeProcessCWD": true 19 | }, 20 | { 21 | "directory": "example_general", 22 | "changeProcessCWD": true 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Web3Auth React Native SDK 2 | 3 | Web3Auth is where passwordless auth meets non-custodial key infrastructure for Web3 apps and wallets. By aggregating OAuth (Google, Twitter, Discord) logins, different wallets and innovative Multi Party Computation (MPC) - Web3Auth provides a seamless login experience to every user on your application. 4 | 5 | ## 📖 Documentation 6 | 7 | Checkout the official [Web3Auth Documentation](https://web3auth.io/docs) and [SDK Reference](https://web3auth.io/docs/sdk/pnp/react-native) to get started! 8 | 9 | ## 💡 Features 10 | - Plug and Play, OAuth based Web3 Authentication Service 11 | - Fully decentralized, non-custodial key infrastructure 12 | - End to end Whitelabelable solution 13 | - Threshold Cryptography based Key Reconstruction 14 | - Multi Factor Authentication Setup & Recovery (Includes password, backup phrase, device factor editing/deletion etc) 15 | - Support for WebAuthn & Passwordless Login 16 | - Support for connecting to multiple wallets 17 | - DApp Active Session Management 18 | 19 | ...and a lot more 20 | 21 | ## ⏪ Requirements 22 | 23 | - For iOS, only iOS 12+ supported since we requires ASWebAuthenticationSession. 24 | 25 | - For Android, Custom Tab support is required. 26 | 27 | ## Selecting your Workflow 28 | 29 | In React Native, you have the choice to use one of the following workflows: 30 | 31 | - **Bare Workflow**: Your React Native app is entirely built on your own machine. You can customize your app with Swift/Kotlin native modules. 32 | - **Expo Managed Workflow**: Your React Native Expo app is built on your Expo's cloud, so you don't have control over the native modules used in the app. 33 | 34 | ## ⚡ Installation 35 | 36 | ```sh 37 | npm install @web3auth/react-native-sdk 38 | ``` 39 | 40 | ## 🌟 Configuration 41 | 42 | ### Configure your Web3Auth project 43 | 44 | Hop on to the [Web3Auth Dashboard](https://dashboard.web3auth.io/) and create a new project. Use the Client ID of the project to start your integration. 45 | 46 | ![Web3Auth Dashboard](https://web3auth.io/docs/assets/images/project_plug_n_play-89c39ec42ad993107bb2485b1ce64b89.png) 47 | 48 | - Add `{YOUR_APP_PACKAGE_NAME}://auth` to **Whitelist URLs**. 49 | 50 | - Copy the Project ID for usage later. 51 | 52 | ### Expo Managed Workflow 53 | 54 | When using our SDK with a Expo-based React Native app (aka managed workflow, you have to install the `expo-web-browser` package as a `WebBrowser` implementation.) 55 | 56 | ```sh 57 | expo install expo-web-browser 58 | ``` 59 | 60 | To allow the SDK to work with exported Expo Android apps, you need to place a designated scheme into `app.json`, like below: 61 | 62 | ```js 63 | { 64 | "expo": { 65 | "scheme": "web3authexposample" 66 | } 67 | } 68 | ``` 69 | 70 | ### Bare workflow Configuration 71 | 72 | When using our SDK with a bare workflow React Native app, you have to install a `WebBrowser` implementation made by us. 73 | 74 | ```sh 75 | npm install --save @toruslabs/react-native-web-browser 76 | ``` 77 | 78 | #### Android 79 | 80 | - The `scheme` parameter in the `redirectUrl` is specificable, and has to be added into the `AndroidManifest.xml`. 81 | 82 | ```xml 83 | 84 | ``` 85 | 86 | #### iOS 87 | 88 | - The `scheme` parameter in the `redirectUrl` is specificable here as well, however, it does not need to be added as a iOS Custom URL Scheme. You may add the `scheme` to your iOS `Info.plist`, but it is not required. 89 | 90 | #### Register the URL scheme you intended to use for redirection 91 | 92 | - In the Web3Auth Developer Dashboard, add the URL scheme you intended to use for redirection to the **Whitelist URLs** section. 93 | 94 | For example, the scheme mentioned is `web3authrnexample` and the `redirectUrl` mentioned is `${scheme}://openlogin`, we will whitelist: 95 | 96 | ``` 97 | web3authrnexample://openlogin 98 | ``` 99 | 100 | ## 💥 Initialization & Usage 101 | 102 | In your sign-in activity', create an `Web3Auth` instance with your Web3Auth project's configurations and 103 | configure it like this: 104 | 105 | ### Expo Managed Workflow 106 | 107 | ```js 108 | import * as WebBrowser from 'expo-web-browser'; 109 | import Web3Auth, { LOGIN_PROVIDER, OPENLOGIN_NETWORK } from "@web3auth/react-native-sdk"; 110 | 111 | const web3auth = new Web3Auth(WebBrowser, { 112 | clientId, 113 | network: OPENLOGIN_NETWORK.TESTNET, // or other networks 114 | }); 115 | const info = await web3auth.login({ 116 | loginProvider: LOGIN_PROVIDER.GOOGLE, 117 | redirectUrl: resolvedRedirectUrl, 118 | mfaLevel: 'mandatory', // optional 119 | curve: 'secp256k1', // optional 120 | }); 121 | ``` 122 | 123 | ### Bare Workflow 124 | 125 | ```js 126 | import * as WebBrowser from '@toruslabs/react-native-web-browser'; 127 | import Web3Auth, { LOGIN_PROVIDER, OPENLOGIN_NETWORK } from "@web3auth/react-native-sdk"; 128 | 129 | const web3auth = new Web3Auth(WebBrowser, { 130 | clientId, 131 | network: OPENLOGIN_NETWORK.TESTNET, // or other networks 132 | }); 133 | const info = await web3auth.login({ 134 | loginProvider: LOGIN_PROVIDER.GOOGLE, 135 | redirectUrl: resolvedRedirectUrl, 136 | mfaLevel: 'mandatory', // optional 137 | curve: 'secp256k1', // optional 138 | }); 139 | ``` 140 | 141 | ## 🩹 Examples 142 | 143 | Checkout the examples for your preferred blockchain and platform in our [examples](https://web3auth.io/docs/examples) 144 | 145 | ## 🌐 Demo 146 | 147 | Checkout the [Web3Auth Demo](https://demo-app.web3auth.io/) to see how Web3Auth can be used in an application. 148 | 149 | Further checkout the [example folder](https://github.com/Web3Auth/web3auth-react-native-sdk/tree/master/example) within this repository, which contains a sample app. 150 | 151 | ## 💬 Troubleshooting and Support 152 | 153 | - Have a look at our [Community Portal](https://community.web3auth.io/) to see if anyone has any questions or issues you might be having. Feel free to reate new topics and we'll help you out as soon as possible. 154 | - Checkout our [Troubleshooting Documentation Page](https://web3auth.io/docs/troubleshooting) to know the common issues and solutions. 155 | - For Priority Support, please have a look at our [Pricing Page](https://web3auth.io/pricing.html) for the plan that suits your needs. 156 | -------------------------------------------------------------------------------- /demo/rn-bare-example/.bundle/config: -------------------------------------------------------------------------------- 1 | BUNDLE_PATH: "vendor/bundle" 2 | BUNDLE_FORCE_RUBY_PLATFORM: 1 3 | -------------------------------------------------------------------------------- /demo/rn-bare-example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | **/.xcode.env.local 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | *.hprof 33 | .cxx/ 34 | *.keystore 35 | !debug.keystore 36 | 37 | # node.js 38 | # 39 | node_modules/ 40 | npm-debug.log 41 | yarn-error.log 42 | 43 | # fastlane 44 | # 45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 46 | # screenshots whenever they are needed. 47 | # For more information about the recommended setup visit: 48 | # https://docs.fastlane.tools/best-practices/source-control/ 49 | 50 | **/fastlane/report.xml 51 | **/fastlane/Preview.html 52 | **/fastlane/screenshots 53 | **/fastlane/test_output 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | # Ruby / CocoaPods 59 | **/Pods/ 60 | /vendor/bundle/ 61 | 62 | # Temporary files created by Metro to check the health of the file watcher 63 | .metro-health-check* 64 | 65 | # testing 66 | /coverage 67 | 68 | # Yarn 69 | .yarn/* 70 | !.yarn/patches 71 | !.yarn/plugins 72 | !.yarn/releases 73 | !.yarn/sdks 74 | !.yarn/versions 75 | -------------------------------------------------------------------------------- /demo/rn-bare-example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /demo/rn-bare-example/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version 4 | ruby ">= 2.6.10" 5 | 6 | # Cocoapods 1.15 introduced a bug which break the build. We will remove the upper 7 | # bound in the template on Cocoapods with next React Native release. 8 | gem 'cocoapods', '>= 1.13', '< 1.15' 9 | gem 'activesupport', '>= 6.1.7.5', '< 7.1.0' 10 | -------------------------------------------------------------------------------- /demo/rn-bare-example/README.md: -------------------------------------------------------------------------------- 1 | This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli). 2 | 3 | # Getting Started 4 | 5 | >**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding. 6 | 7 | ## Step 1: Start the Metro Server 8 | 9 | First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native. 10 | 11 | To start Metro, run the following command from the _root_ of your React Native project: 12 | 13 | ```bash 14 | # using npm 15 | npm start 16 | 17 | # OR using Yarn 18 | yarn start 19 | ``` 20 | 21 | ## Step 2: Start your Application 22 | 23 | Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app: 24 | 25 | ### For Android 26 | 27 | ```bash 28 | # using npm 29 | npm run android 30 | 31 | # OR using Yarn 32 | yarn android 33 | ``` 34 | 35 | ### For iOS 36 | 37 | ```bash 38 | # using npm 39 | npm run ios 40 | 41 | # OR using Yarn 42 | yarn ios 43 | ``` 44 | 45 | If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly. 46 | 47 | This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively. 48 | 49 | ## Step 3: Modifying your App 50 | 51 | Now that you have successfully run the app, let's modify it. 52 | 53 | 1. Open `App.tsx` in your text editor of choice and edit some lines. 54 | 2. For **Android**: Press the R key twice or select **"Reload"** from the **Developer Menu** (Ctrl + M (on Window and Linux) or Cmd ⌘ + M (on macOS)) to see your changes! 55 | 56 | For **iOS**: Hit Cmd ⌘ + R in your iOS Simulator to reload the app and see your changes! 57 | 58 | ## Congratulations! :tada: 59 | 60 | You've successfully run and modified your React Native App. :partying_face: 61 | 62 | ### Now what? 63 | 64 | - If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps). 65 | - If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started). 66 | 67 | # Troubleshooting 68 | 69 | If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page. 70 | 71 | # Learn More 72 | 73 | To learn more about React Native, take a look at the following resources: 74 | 75 | - [React Native Website](https://reactnative.dev) - learn more about React Native. 76 | - [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment. 77 | - [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**. 78 | - [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts. 79 | - [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native. 80 | -------------------------------------------------------------------------------- /demo/rn-bare-example/__tests__/App.test.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: import explicitly to use the types shipped with jest. 10 | import {it} from '@jest/globals'; 11 | 12 | // Note: test renderer must be required after react-native. 13 | import renderer from 'react-test-renderer'; 14 | 15 | it('renders correctly', () => { 16 | renderer.create(); 17 | }); 18 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | apply plugin: "org.jetbrains.kotlin.android" 3 | apply plugin: "com.facebook.react" 4 | 5 | /** 6 | * This is the configuration block to customize your React Native Android app. 7 | * By default you don't need to apply any configuration, just uncomment the lines you need. 8 | */ 9 | react { 10 | /* Folders */ 11 | // The root of your project, i.e. where "package.json" lives. Default is '..' 12 | // root = file("../") 13 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native 14 | // reactNativeDir = file("../node_modules/react-native") 15 | // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen 16 | // codegenDir = file("../node_modules/@react-native/codegen") 17 | // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js 18 | // cliFile = file("../node_modules/react-native/cli.js") 19 | 20 | /* Variants */ 21 | // The list of variants to that are debuggable. For those we're going to 22 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'. 23 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. 24 | // debuggableVariants = ["liteDebug", "prodDebug"] 25 | 26 | /* Bundling */ 27 | // A list containing the node command and its flags. Default is just 'node'. 28 | // nodeExecutableAndArgs = ["node"] 29 | // 30 | // The command to run when bundling. By default is 'bundle' 31 | // bundleCommand = "ram-bundle" 32 | // 33 | // The path to the CLI configuration file. Default is empty. 34 | // bundleConfig = file(../rn-cli.config.js) 35 | // 36 | // The name of the generated asset file containing your JS bundle 37 | // bundleAssetName = "MyApplication.android.bundle" 38 | // 39 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' 40 | // entryFile = file("../js/MyApplication.android.js") 41 | // 42 | // A list of extra flags to pass to the 'bundle' commands. 43 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle 44 | // extraPackagerArgs = [] 45 | 46 | /* Hermes Commands */ 47 | // The hermes compiler command to run. By default it is 'hermesc' 48 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" 49 | // 50 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" 51 | // hermesFlags = ["-O", "-output-source-map"] 52 | } 53 | 54 | /** 55 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode. 56 | */ 57 | def enableProguardInReleaseBuilds = false 58 | 59 | /** 60 | * The preferred build flavor of JavaScriptCore (JSC) 61 | * 62 | * For example, to use the international variant, you can use: 63 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 64 | * 65 | * The international variant includes ICU i18n library and necessary data 66 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 67 | * give correct results when using with locales other than en-US. Note that 68 | * this variant is about 6MiB larger per architecture than default. 69 | */ 70 | def jscFlavor = 'org.webkit:android-jsc:+' 71 | 72 | android { 73 | ndkVersion rootProject.ext.ndkVersion 74 | buildToolsVersion rootProject.ext.buildToolsVersion 75 | compileSdk rootProject.ext.compileSdkVersion 76 | 77 | namespace "com.web3authrnexample" 78 | defaultConfig { 79 | applicationId "com.web3authrnexample" 80 | minSdkVersion rootProject.ext.minSdkVersion 81 | targetSdkVersion rootProject.ext.targetSdkVersion 82 | versionCode 1 83 | versionName "1.0" 84 | } 85 | signingConfigs { 86 | debug { 87 | storeFile file('debug.keystore') 88 | storePassword 'android' 89 | keyAlias 'androiddebugkey' 90 | keyPassword 'android' 91 | } 92 | } 93 | buildTypes { 94 | debug { 95 | signingConfig signingConfigs.debug 96 | } 97 | release { 98 | // Caution! In production, you need to generate your own keystore file. 99 | // see https://reactnative.dev/docs/signed-apk-android. 100 | signingConfig signingConfigs.debug 101 | minifyEnabled enableProguardInReleaseBuilds 102 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 103 | } 104 | } 105 | } 106 | 107 | dependencies { 108 | // The version of react-native is set by the React Native Gradle Plugin 109 | implementation("com.facebook.react:react-android") 110 | 111 | if (hermesEnabled.toBoolean()) { 112 | implementation("com.facebook.react:hermes-android") 113 | } else { 114 | implementation jscFlavor 115 | } 116 | } 117 | 118 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 119 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-bare-example/android/app/debug.keystore -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/java/com/web3authrnexample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.web3authrnexample 2 | 3 | import com.facebook.react.ReactActivity 4 | import com.facebook.react.ReactActivityDelegate 5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled 6 | import com.facebook.react.defaults.DefaultReactActivityDelegate 7 | 8 | class MainActivity : ReactActivity() { 9 | 10 | /** 11 | * Returns the name of the main component registered from JavaScript. This is used to schedule 12 | * rendering of the component. 13 | */ 14 | override fun getMainComponentName(): String = "web3authrnexample" 15 | 16 | /** 17 | * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] 18 | * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] 19 | */ 20 | override fun createReactActivityDelegate(): ReactActivityDelegate = 21 | DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) 22 | } 23 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/java/com/web3authrnexample/MainApplication.kt: -------------------------------------------------------------------------------- 1 | package com.web3authrnexample 2 | 3 | import android.app.Application 4 | import com.facebook.react.PackageList 5 | import com.facebook.react.ReactApplication 6 | import com.facebook.react.ReactHost 7 | import com.facebook.react.ReactNativeHost 8 | import com.facebook.react.ReactPackage 9 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load 10 | import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost 11 | import com.facebook.react.defaults.DefaultReactNativeHost 12 | import com.facebook.soloader.SoLoader 13 | 14 | class MainApplication : Application(), ReactApplication { 15 | 16 | override val reactNativeHost: ReactNativeHost = 17 | object : DefaultReactNativeHost(this) { 18 | override fun getPackages(): List = 19 | PackageList(this).packages.apply { 20 | // Packages that cannot be autolinked yet can be added manually here, for example: 21 | // add(MyReactNativePackage()) 22 | } 23 | 24 | override fun getJSMainModuleName(): String = "index" 25 | 26 | override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG 27 | 28 | override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED 29 | override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED 30 | } 31 | 32 | override val reactHost: ReactHost 33 | get() = getDefaultReactHost(applicationContext, reactNativeHost) 34 | 35 | override fun onCreate() { 36 | super.onCreate() 37 | SoLoader.init(this, false) 38 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { 39 | // If you opted-in for the New Architecture, we load the native entry point for this app. 40 | load() 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/drawable/rn_edit_text_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 24 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-bare-example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-bare-example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-bare-example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-bare-example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-bare-example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-bare-example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-bare-example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-bare-example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-bare-example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-bare-example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | web3authrnexample 3 | 4 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | buildToolsVersion = "34.0.0" 4 | minSdkVersion = 23 5 | compileSdkVersion = 34 6 | targetSdkVersion = 34 7 | ndkVersion = "26.1.10909125" 8 | kotlinVersion = "1.9.22" 9 | } 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle") 16 | classpath("com.facebook.react:react-native-gradle-plugin") 17 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") 18 | } 19 | } 20 | 21 | apply plugin: "com.facebook.react.rootproject" 22 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m 13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Use this property to specify which architecture you want to build. 28 | # You can also override it from the CLI using 29 | # ./gradlew -PreactNativeArchitectures=x86_64 30 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 31 | 32 | # Use this property to enable support to the new architecture. 33 | # This will allow you to use TurboModules and the Fabric render in 34 | # your application. You should enable this flag either if you want 35 | # to write custom TurboModules/Fabric components OR use libraries that 36 | # are providing them. 37 | newArchEnabled=false 38 | 39 | # Use this property to enable or disable the Hermes JS engine. 40 | # If set to false, you will be using JSC instead. 41 | hermesEnabled=true 42 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-bare-example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /demo/rn-bare-example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC2039,SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC2039,SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" 250 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /demo/rn-bare-example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'web3authrnexample' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | includeBuild('../node_modules/@react-native/gradle-plugin') 5 | -------------------------------------------------------------------------------- /demo/rn-bare-example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web3authrnexample", 3 | "displayName": "web3authrnexample" 4 | } 5 | -------------------------------------------------------------------------------- /demo/rn-bare-example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:@react-native/babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /demo/rn-bare-example/globals.js: -------------------------------------------------------------------------------- 1 | global.Buffer = require("buffer").Buffer; 2 | 3 | import { install } from "react-native-quick-crypto"; 4 | 5 | install(); 6 | 7 | // Needed so that 'stream-http' chooses the right default protocol. 8 | global.location = { 9 | protocol: "file:", 10 | }; 11 | 12 | global.process.version = "v16.0.0"; 13 | if (!global.process.version) { 14 | global.process = require("process"); 15 | console.log({ process: global.process }); 16 | } 17 | 18 | process.browser = true; -------------------------------------------------------------------------------- /demo/rn-bare-example/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from "react-native"; 2 | import "./globals"; 3 | import App from "./App"; 4 | import { name as appName } from "./app.json"; 5 | AppRegistry.registerComponent(appName, () => App); 6 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/.xcode.env: -------------------------------------------------------------------------------- 1 | # This `.xcode.env` file is versioned and is used to source the environment 2 | # used when running script phases inside Xcode. 3 | # To customize your local environment, you can create an `.xcode.env.local` 4 | # file that is not versioned. 5 | 6 | # NODE_BINARY variable contains the PATH to the node executable. 7 | # 8 | # Customize the NODE_BINARY variable here. 9 | # For example, to use nvm with brew, add the following line 10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use 11 | export NODE_BINARY=$(command -v node) 12 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Resolve react_native_pods.rb with node to allow for hoisting 2 | require Pod::Executable.execute_command('node', ['-p', 3 | 'require.resolve( 4 | "react-native/scripts/react_native_pods.rb", 5 | {paths: [process.argv[1]]}, 6 | )', __dir__]).strip 7 | 8 | platform :ios, min_ios_version_supported 9 | prepare_react_native_project! 10 | 11 | linkage = ENV['USE_FRAMEWORKS'] 12 | if linkage != nil 13 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green 14 | use_frameworks! :linkage => linkage.to_sym 15 | end 16 | 17 | target 'web3authrnexample' do 18 | config = use_native_modules! 19 | 20 | use_react_native!( 21 | :path => config[:reactNativePath], 22 | # An absolute path to your application root. 23 | :app_path => "#{Pod::Config.instance.installation_root}/.." 24 | ) 25 | 26 | target 'web3authrnexampleTests' do 27 | inherit! :complete 28 | # Pods for testing 29 | end 30 | 31 | post_install do |installer| 32 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 33 | react_native_post_install( 34 | installer, 35 | config[:reactNativePath], 36 | :mac_catalyst_enabled => false, 37 | # :ccache_enabled => true 38 | ) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/web3authrnexample.xcodeproj/xcshareddata/xcschemes/web3authrnexample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/web3authrnexample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/web3authrnexample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : RCTAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/web3authrnexample/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | 5 | @implementation AppDelegate 6 | 7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 8 | { 9 | self.moduleName = @"web3authrnexample"; 10 | // You can add your custom initial props in the dictionary below. 11 | // They will be passed down to the ViewController used by React Native. 12 | self.initialProps = @{}; 13 | 14 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 15 | } 16 | 17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 18 | { 19 | return [self bundleURL]; 20 | } 21 | 22 | - (NSURL *)bundleURL 23 | { 24 | #if DEBUG 25 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; 26 | #else 27 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 28 | #endif 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/web3authrnexample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "scale" : "1x", 46 | "size" : "1024x1024" 47 | } 48 | ], 49 | "info" : { 50 | "author" : "xcode", 51 | "version" : 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/web3authrnexample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/web3authrnexample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | web3authrnexample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(CURRENT_PROJECT_VERSION) 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | 30 | NSAllowsArbitraryLoads 31 | 32 | NSAllowsLocalNetworking 33 | 34 | 35 | NSLocationWhenInUseUsageDescription 36 | 37 | UILaunchStoryboardName 38 | LaunchScreen 39 | UIRequiredDeviceCapabilities 40 | 41 | arm64 42 | 43 | UISupportedInterfaceOrientations 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | UIViewControllerBasedStatusBarAppearance 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/web3authrnexample/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/web3authrnexample/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyAccessedAPITypes 6 | 7 | 8 | NSPrivacyAccessedAPIType 9 | NSPrivacyAccessedAPICategoryFileTimestamp 10 | NSPrivacyAccessedAPITypeReasons 11 | 12 | C617.1 13 | 14 | 15 | 16 | NSPrivacyAccessedAPIType 17 | NSPrivacyAccessedAPICategoryUserDefaults 18 | NSPrivacyAccessedAPITypeReasons 19 | 20 | CA92.1 21 | 22 | 23 | 24 | NSPrivacyAccessedAPIType 25 | NSPrivacyAccessedAPICategorySystemBootTime 26 | NSPrivacyAccessedAPITypeReasons 27 | 28 | 35F9.1 29 | 30 | 31 | 32 | NSPrivacyCollectedDataTypes 33 | 34 | NSPrivacyTracking 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/web3authrnexample/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/web3authrnexampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /demo/rn-bare-example/ios/web3authrnexampleTests/web3authrnexampleTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface web3authrnexampleTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation web3authrnexampleTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction( 38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 39 | if (level >= RCTLogLevelError) { 40 | redboxError = message; 41 | } 42 | }); 43 | #endif 44 | 45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 48 | 49 | foundElement = [self findSubviewInView:vc.view 50 | matching:^BOOL(UIView *view) { 51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 52 | return YES; 53 | } 54 | return NO; 55 | }]; 56 | } 57 | 58 | #ifdef DEBUG 59 | RCTSetLogFunction(RCTDefaultLogFunction); 60 | #endif 61 | 62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /demo/rn-bare-example/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'react-native', 3 | }; 4 | -------------------------------------------------------------------------------- /demo/rn-bare-example/metro.config.js: -------------------------------------------------------------------------------- 1 | const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); 2 | 3 | const defaultConfig = getDefaultConfig(__dirname); 4 | 5 | const config = { 6 | resolver: { 7 | extraNodeModules: { 8 | assert: require.resolve("empty-module"), // assert can be polyfilled here if needed 9 | http: require.resolve("empty-module"), // stream-http can be polyfilled here if needed 10 | https: require.resolve("empty-module"), // https-browserify can be polyfilled here if needed 11 | os: require.resolve("empty-module"), // os-browserify can be polyfilled here if needed 12 | url: require.resolve("empty-module"), // url can be polyfilled here if needed 13 | zlib: require.resolve("empty-module"), // browserify-zlib can be polyfilled here if needed 14 | path: require.resolve("empty-module"), 15 | crypto: require.resolve("crypto-browserify"), 16 | stream: require.resolve("readable-stream"), 17 | }, 18 | sourceExts: [...defaultConfig.resolver.sourceExts, 'svg'], 19 | }, 20 | }; 21 | 22 | module.exports = mergeConfig(defaultConfig, config); 23 | -------------------------------------------------------------------------------- /demo/rn-bare-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web3authrnexample", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios", 8 | "lint": "eslint .", 9 | "start": "react-native start", 10 | "test": "jest" 11 | }, 12 | "dependencies": { 13 | "@ethersproject/shims": "^5.7.0", 14 | "@toruslabs/react-native-web-browser": "^1.1.0", 15 | "@web3auth/account-abstraction-provider": "^9.3.1", 16 | "@web3auth/ethereum-provider": "^9.0.2", 17 | "@web3auth/react-native-sdk": "file:../../web3auth-react-native-sdk-8.0.0.tgz", 18 | "ethers": "^6.13.2", 19 | "react": "18.2.0", 20 | "react-native": "0.74.2", 21 | "react-native-encrypted-storage": "^4.0.3", 22 | "react-native-mmkv-storage": "^0.11.2", 23 | "react-native-quick-crypto": "^0.7.5" 24 | }, 25 | "devDependencies": { 26 | "@babel/core": "^7.20.0", 27 | "@babel/preset-env": "^7.20.0", 28 | "@babel/runtime": "^7.20.0", 29 | "@react-native/babel-preset": "0.74.84", 30 | "@react-native/eslint-config": "0.74.84", 31 | "@react-native/metro-config": "0.74.84", 32 | "@react-native/typescript-config": "0.74.84", 33 | "@types/react": "^18.2.6", 34 | "@types/react-test-renderer": "^18.0.0", 35 | "babel-jest": "^29.6.3", 36 | "buffer": "^6.0.3", 37 | "crypto-browserify": "^3.12.0", 38 | "empty-module": "^0.0.2", 39 | "eslint": "^8.19.0", 40 | "jest": "^29.6.3", 41 | "prettier": "2.8.8", 42 | "process": "^0.11.10", 43 | "react-test-renderer": "18.2.0", 44 | "readable-stream": "^4.5.2", 45 | "typescript": "5.0.4" 46 | }, 47 | "engines": { 48 | "node": ">=18" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /demo/rn-bare-example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@react-native/typescript-config/tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /demo/rn-expo-example/.gitignore: -------------------------------------------------------------------------------- 1 | # Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files 2 | 3 | # dependencies 4 | node_modules/ 5 | 6 | # Expo 7 | .expo/ 8 | dist/ 9 | web-build/ 10 | 11 | # Native 12 | *.orig.* 13 | *.jks 14 | *.p8 15 | *.p12 16 | *.key 17 | *.mobileprovision 18 | 19 | # Metro 20 | .metro-health-check* 21 | 22 | # debug 23 | npm-debug.* 24 | yarn-debug.* 25 | yarn-error.* 26 | 27 | # macOS 28 | .DS_Store 29 | *.pem 30 | 31 | # local env files 32 | .env*.local 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | -------------------------------------------------------------------------------- /demo/rn-expo-example/App.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from "react"; 2 | import { Button, Dimensions, ScrollView, StyleSheet, Text, View, TextInput, Switch } from "react-native"; 3 | import Constants, { AppOwnership } from "expo-constants"; 4 | import * as Linking from "expo-linking"; 5 | import "@ethersproject/shims"; 6 | import "./globals"; 7 | // IMP START - Quick Start 8 | import * as WebBrowser from "expo-web-browser"; 9 | import * as SecureStore from "expo-secure-store"; 10 | import Web3Auth, { WEB3AUTH_NETWORK, LOGIN_PROVIDER, ChainNamespace } from "@web3auth/react-native-sdk"; 11 | import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider"; 12 | import { MMKVLoader, useMMKVStorage } from "react-native-mmkv-storage"; 13 | // IMP END - Quick Start 14 | import { ethers } from "ethers"; 15 | import { 16 | AccountAbstractionProvider, 17 | BiconomySmartAccount, 18 | ISmartAccount, 19 | KernelSmartAccount, 20 | SafeSmartAccount, 21 | TrustSmartAccount, 22 | } from "@web3auth/account-abstraction-provider"; 23 | 24 | // IMP START - Whitelist bundle ID 25 | const redirectUrl = 26 | //@ts-ignore 27 | Constants.appOwnership == AppOwnership.Expo || Constants.appOwnership == AppOwnership.Guest 28 | ? Linking.createURL("web3auth", {}) 29 | : Linking.createURL("web3auth", { scheme: "web3authexpoexample" }); 30 | // IMP END - Whitelist bundle ID 31 | 32 | // IMP START - Dashboard Registration 33 | const clientId = "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ"; // get from https://dashboard.web3auth.io 34 | // IMP END - Dashboard Registration 35 | 36 | // IMP START - SDK Initialization 37 | const chainConfig = { 38 | chainNamespace: ChainNamespace.EIP155, 39 | chainId: "0xaa36a7", 40 | rpcTarget: "https://rpc.ankr.com/eth_sepolia", 41 | // Avoid using public rpcTarget in production. 42 | // Use services like Infura, Quicknode etc 43 | displayName: "Ethereum Sepolia Testnet", 44 | blockExplorerUrl: "https://sepolia.etherscan.io", 45 | ticker: "ETH", 46 | tickerName: "Ethereum", 47 | decimals: 18, 48 | logo: "https://cryptologos.cc/logos/ethereum-eth-logo.png", 49 | }; 50 | 51 | const privateKeyProvider = new EthereumPrivateKeyProvider({ 52 | config: { 53 | chainConfig, 54 | }, 55 | }); 56 | 57 | const PIMLICO_API_KEY = "YOUR_PIMLICO_API_KEY"; 58 | 59 | export const getDefaultBundlerUrl = (chainId: string): string => { 60 | return `https://api.pimlico.io/v2/${Number(chainId)}/rpc?apikey=${PIMLICO_API_KEY}`; 61 | }; 62 | 63 | export type SmartAccountType = "safe" | "kernel" | "biconomy" | "trust"; 64 | 65 | export type AccountAbstractionConfig = { 66 | bundlerUrl?: string; 67 | paymasterUrl?: string; 68 | smartAccountType?: SmartAccountType; 69 | }; 70 | 71 | const AAConfig: AccountAbstractionConfig = { 72 | // bundlerUrl: "https://bundler.safe.global", 73 | // paymasterUrl: "https://paymaster.safe.global", 74 | smartAccountType: "safe", 75 | }; 76 | 77 | const storage = new MMKVLoader().initialize(); 78 | // IMP END - SDK Initialization 79 | 80 | export default function App() { 81 | const [web3auth, setWeb3auth] = useState(null); 82 | const [loggedIn, setLoggedIn] = useState(false); 83 | const [provider, setProvider] = useState(null); 84 | const [console, setConsole] = useState(""); 85 | const [email, setEmail] = useState(""); 86 | const [useAccountAbstraction, setUseAccountAbstraction] = useMMKVStorage("useAccountAbstraction", storage, false); 87 | 88 | const toggleAccountAbstraction = () => { 89 | setUseAccountAbstraction((prevState) => !prevState); 90 | }; 91 | 92 | useEffect(() => { 93 | const init = async () => { 94 | // setup aa provider 95 | let aaProvider: AccountAbstractionProvider | undefined; 96 | if (useAccountAbstraction) { 97 | const { bundlerUrl, paymasterUrl, smartAccountType } = AAConfig; 98 | 99 | let smartAccountInit: ISmartAccount; 100 | switch (smartAccountType) { 101 | case "biconomy": 102 | smartAccountInit = new BiconomySmartAccount(); 103 | break; 104 | case "kernel": 105 | smartAccountInit = new KernelSmartAccount(); 106 | break; 107 | case "trust": 108 | smartAccountInit = new TrustSmartAccount(); 109 | break; 110 | // case "light": 111 | // smartAccountInit = new LightSmartAccount(); 112 | // break; 113 | // case "simple": 114 | // smartAccountInit = new SimpleSmartAccount(); 115 | // break; 116 | case "safe": 117 | default: 118 | smartAccountInit = new SafeSmartAccount(); 119 | break; 120 | } 121 | 122 | aaProvider = new AccountAbstractionProvider({ 123 | config: { 124 | chainConfig, 125 | bundlerConfig: { 126 | url: bundlerUrl ?? getDefaultBundlerUrl(chainConfig.chainId), 127 | }, 128 | paymasterConfig: paymasterUrl 129 | ? { 130 | url: paymasterUrl, 131 | } 132 | : undefined, 133 | smartAccountInit, 134 | }, 135 | }); 136 | } 137 | 138 | const web3auth = new Web3Auth(WebBrowser, SecureStore, { 139 | clientId, 140 | privateKeyProvider, 141 | accountAbstractionProvider: aaProvider, 142 | // IMP START - Whitelist bundle ID 143 | redirectUrl, 144 | // IMP END - Whitelist bundle ID 145 | network: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, // or other networks 146 | }); 147 | setWeb3auth(web3auth); 148 | // IMP START - SDK Initialization 149 | await web3auth.init(); 150 | // IMP END - SDK Initialization 151 | 152 | if (web3auth.connected) { 153 | setProvider(web3auth.provider); 154 | setLoggedIn(true); 155 | } 156 | }; 157 | init(); 158 | }, [useAccountAbstraction]); 159 | 160 | const login = async () => { 161 | try { 162 | if (!web3auth?.ready) { 163 | setConsole("Web3auth not initialized"); 164 | return; 165 | } 166 | if (!email) { 167 | setConsole("Enter email first"); 168 | return; 169 | } 170 | 171 | setConsole("Logging in"); 172 | // IMP START - Login 173 | await web3auth.login({ 174 | loginProvider: LOGIN_PROVIDER.EMAIL_PASSWORDLESS, 175 | extraLoginOptions: { 176 | login_hint: email, 177 | }, 178 | }); 179 | // IMP END - Login 180 | 181 | if (web3auth.connected) { 182 | setProvider(web3auth.provider); 183 | uiConsole("Logged In"); 184 | setLoggedIn(true); 185 | } 186 | } catch (e: any) { 187 | setConsole(e.message); 188 | } 189 | }; 190 | 191 | const logout = async () => { 192 | if (!web3auth?.ready) { 193 | setConsole("Web3auth not initialized"); 194 | return; 195 | } 196 | 197 | setConsole("Logging out"); 198 | // IMP START - Logout 199 | await web3auth.logout(); 200 | // IMP END - Logout 201 | 202 | if (!web3auth.connected) { 203 | setProvider(null); 204 | uiConsole("Logged out"); 205 | setLoggedIn(false); 206 | } 207 | }; 208 | 209 | // IMP START - Blockchain Calls 210 | const getAccounts = async () => { 211 | if (!provider) { 212 | uiConsole("provider not set"); 213 | return; 214 | } 215 | setConsole("Getting account"); 216 | // For ethers v5 217 | // const ethersProvider = new ethers.providers.Web3Provider(this.provider); 218 | const ethersProvider = new ethers.BrowserProvider(provider!); 219 | 220 | // For ethers v5 221 | // const signer = ethersProvider.getSigner(); 222 | const signer = await ethersProvider.getSigner(); 223 | 224 | // Get user's Ethereum public address 225 | const address = signer.getAddress(); 226 | uiConsole(address); 227 | }; 228 | 229 | const getBalance = async () => { 230 | if (!provider) { 231 | uiConsole("provider not set"); 232 | return; 233 | } 234 | setConsole("Fetching balance"); 235 | // For ethers v5 236 | // const ethersProvider = new ethers.providers.Web3Provider(this.provider); 237 | const ethersProvider = new ethers.BrowserProvider(provider!); 238 | 239 | // For ethers v5 240 | // const signer = ethersProvider.getSigner(); 241 | const signer = await ethersProvider.getSigner(); 242 | 243 | // Get user's Ethereum public address 244 | const address = signer.getAddress(); 245 | 246 | // Get user's balance in ether 247 | // For ethers v5 248 | // const balance = ethers.utils.formatEther( 249 | // await ethersProvider.getBalance(address) // Balance is in wei 250 | // ); 251 | const balance = ethers.formatEther( 252 | await ethersProvider.getBalance(address) // Balance is in wei 253 | ); 254 | uiConsole(balance); 255 | }; 256 | 257 | const signMessage = async () => { 258 | if (!provider) { 259 | uiConsole("provider not set"); 260 | return; 261 | } 262 | setConsole("Signing message"); 263 | // For ethers v5 264 | // const ethersProvider = new ethers.providers.Web3Provider(this.provider); 265 | const ethersProvider = new ethers.BrowserProvider(provider!); 266 | 267 | // For ethers v5 268 | // const signer = ethersProvider.getSigner(); 269 | const signer = await ethersProvider.getSigner(); 270 | const originalMessage = "YOUR_MESSAGE"; 271 | 272 | // Sign the message 273 | const signedMessage = await signer.signMessage(originalMessage); 274 | uiConsole(signedMessage); 275 | }; 276 | // IMP END - Blockchain Calls 277 | 278 | const launchWalletServices = async () => { 279 | if (!web3auth) { 280 | setConsole("Web3auth not initialized"); 281 | return; 282 | } 283 | 284 | setConsole("Launch Wallet Services"); 285 | await web3auth.launchWalletServices(chainConfig); 286 | }; 287 | 288 | const uiConsole = (...args: unknown[]) => { 289 | setConsole(JSON.stringify(args || {}, null, 2) + "\n\n\n\n" + console); 290 | }; 291 | 292 | const loggedInView = ( 293 | 294 |