├── .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 | 
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 |
301 | );
302 |
303 | const unloggedInView = (
304 |
305 |
306 |
313 | Use Account Abstraction:
314 |
315 |
316 |
317 |
318 |
319 |
320 | );
321 |
322 | return (
323 |
324 | {loggedIn ? loggedInView : unloggedInView}
325 |
326 | Console:
327 |
328 | {console}
329 |
330 |
331 |
332 | );
333 | }
334 |
335 | const styles = StyleSheet.create({
336 | container: {
337 | flex: 1,
338 | backgroundColor: "#fff",
339 | alignItems: "center",
340 | justifyContent: "center",
341 | paddingTop: 50,
342 | paddingBottom: 30,
343 | },
344 | consoleArea: {
345 | margin: 20,
346 | alignItems: "center",
347 | justifyContent: "center",
348 | flex: 1,
349 | },
350 | console: {
351 | flex: 1,
352 | backgroundColor: "#CCCCCC",
353 | color: "#ffffff",
354 | padding: 10,
355 | width: Dimensions.get("window").width - 60,
356 | },
357 | consoleText: {
358 | padding: 10,
359 | },
360 | buttonArea: {
361 | flex: 2,
362 | alignItems: "center",
363 | justifyContent: "space-around",
364 | paddingBottom: 30,
365 | },
366 | buttonAreaLogin: {
367 | flex: 2,
368 | alignItems: "center",
369 | justifyContent: "center",
370 | paddingBottom: 30,
371 | },
372 | inputEmail: {
373 | height: 40,
374 | width: 300,
375 | borderColor: "gray",
376 | borderWidth: 1,
377 | padding: 10,
378 | borderRadius: 5,
379 | marginBottom: 20,
380 | },
381 | });
382 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Android/IntelliJ
6 | #
7 | build/
8 | .idea
9 | .gradle
10 | local.properties
11 | *.iml
12 | *.hprof
13 | .cxx/
14 |
15 | # Bundle artifacts
16 | *.jsbundle
17 |
--------------------------------------------------------------------------------
/demo/rn-expo-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 | def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
6 |
7 | /**
8 | * This is the configuration block to customize your React Native Android app.
9 | * By default you don't need to apply any configuration, just uncomment the lines you need.
10 | */
11 | react {
12 | entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
13 | reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
14 | hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
15 | codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
16 |
17 | // Use Expo CLI to bundle the app, this ensures the Metro config
18 | // works correctly with Expo projects.
19 | cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
20 | bundleCommand = "export:embed"
21 |
22 | /* Folders */
23 | // The root of your project, i.e. where "package.json" lives. Default is '..'
24 | // root = file("../")
25 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native
26 | // reactNativeDir = file("../node_modules/react-native")
27 | // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
28 | // codegenDir = file("../node_modules/@react-native/codegen")
29 |
30 | /* Variants */
31 | // The list of variants to that are debuggable. For those we're going to
32 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
33 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
34 | // debuggableVariants = ["liteDebug", "prodDebug"]
35 |
36 | /* Bundling */
37 | // A list containing the node command and its flags. Default is just 'node'.
38 | // nodeExecutableAndArgs = ["node"]
39 |
40 | //
41 | // The path to the CLI configuration file. Default is empty.
42 | // bundleConfig = file(../rn-cli.config.js)
43 | //
44 | // The name of the generated asset file containing your JS bundle
45 | // bundleAssetName = "MyApplication.android.bundle"
46 | //
47 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
48 | // entryFile = file("../js/MyApplication.android.js")
49 | //
50 | // A list of extra flags to pass to the 'bundle' commands.
51 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
52 | // extraPackagerArgs = []
53 |
54 | /* Hermes Commands */
55 | // The hermes compiler command to run. By default it is 'hermesc'
56 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
57 | //
58 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
59 | // hermesFlags = ["-O", "-output-source-map"]
60 | }
61 |
62 | /**
63 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
64 | */
65 | def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean()
66 |
67 | /**
68 | * The preferred build flavor of JavaScriptCore (JSC)
69 | *
70 | * For example, to use the international variant, you can use:
71 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
72 | *
73 | * The international variant includes ICU i18n library and necessary data
74 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
75 | * give correct results when using with locales other than en-US. Note that
76 | * this variant is about 6MiB larger per architecture than default.
77 | */
78 | def jscFlavor = 'org.webkit:android-jsc:+'
79 |
80 | android {
81 | ndkVersion rootProject.ext.ndkVersion
82 |
83 | buildToolsVersion rootProject.ext.buildToolsVersion
84 | compileSdk rootProject.ext.compileSdkVersion
85 |
86 | namespace 'com.web3authexpoexample'
87 | defaultConfig {
88 | applicationId 'com.web3authexpoexample'
89 | minSdkVersion rootProject.ext.minSdkVersion
90 | targetSdkVersion rootProject.ext.targetSdkVersion
91 | versionCode 1
92 | versionName "1.0.0"
93 | }
94 | signingConfigs {
95 | debug {
96 | storeFile file('debug.keystore')
97 | storePassword 'android'
98 | keyAlias 'androiddebugkey'
99 | keyPassword 'android'
100 | }
101 | }
102 | buildTypes {
103 | debug {
104 | signingConfig signingConfigs.debug
105 | }
106 | release {
107 | // Caution! In production, you need to generate your own keystore file.
108 | // see https://reactnative.dev/docs/signed-apk-android.
109 | signingConfig signingConfigs.debug
110 | shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false)
111 | minifyEnabled enableProguardInReleaseBuilds
112 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
113 | }
114 | }
115 | packagingOptions {
116 | jniLibs {
117 | useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)
118 | }
119 | }
120 | }
121 |
122 | // Apply static values from `gradle.properties` to the `android.packagingOptions`
123 | // Accepts values in comma delimited lists, example:
124 | // android.packagingOptions.pickFirsts=/LICENSE,**/picasa.ini
125 | ["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop ->
126 | // Split option: 'foo,bar' -> ['foo', 'bar']
127 | def options = (findProperty("android.packagingOptions.$prop") ?: "").split(",");
128 | // Trim all elements in place.
129 | for (i in 0.. 0) {
134 | println "android.packagingOptions.$prop += $options ($options.length)"
135 | // Ex: android.packagingOptions.pickFirsts += '**/SCCS/**'
136 | options.each {
137 | android.packagingOptions[prop] += it
138 | }
139 | }
140 | }
141 |
142 | dependencies {
143 | // The version of react-native is set by the React Native Gradle Plugin
144 | implementation("com.facebook.react:react-android")
145 |
146 | def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
147 | def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
148 | def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
149 |
150 | if (isGifEnabled) {
151 | // For animated gif support
152 | implementation("com.facebook.fresco:animated-gif:${reactAndroidLibs.versions.fresco.get()}")
153 | }
154 |
155 | if (isWebpEnabled) {
156 | // For webp support
157 | implementation("com.facebook.fresco:webpsupport:${reactAndroidLibs.versions.fresco.get()}")
158 | if (isWebpAnimatedEnabled) {
159 | // Animated webp support
160 | implementation("com.facebook.fresco:animated-webp:${reactAndroidLibs.versions.fresco.get()}")
161 | }
162 | }
163 |
164 | if (hermesEnabled.toBoolean()) {
165 | implementation("com.facebook.react:hermes-android")
166 | } else {
167 | implementation jscFlavor
168 | }
169 | }
170 |
171 | apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
172 | applyNativeModulesAppBuildGradle(project)
173 |
--------------------------------------------------------------------------------
/demo/rn-expo-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 | # react-native-reanimated
11 | -keep class com.swmansion.reanimated.** { *; }
12 | -keep class com.facebook.react.turbomodule.** { *; }
13 |
14 | # Add any project specific keep options here:
15 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/java/com/web3authexpoexample/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.web3authexpoexample
2 |
3 | import android.os.Build
4 | import android.os.Bundle
5 |
6 | import com.facebook.react.ReactActivity
7 | import com.facebook.react.ReactActivityDelegate
8 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
9 | import com.facebook.react.defaults.DefaultReactActivityDelegate
10 |
11 | import expo.modules.ReactActivityDelegateWrapper
12 |
13 | class MainActivity : ReactActivity() {
14 | override fun onCreate(savedInstanceState: Bundle?) {
15 | // Set the theme to AppTheme BEFORE onCreate to support
16 | // coloring the background, status bar, and navigation bar.
17 | // This is required for expo-splash-screen.
18 | setTheme(R.style.AppTheme);
19 | super.onCreate(null)
20 | }
21 |
22 | /**
23 | * Returns the name of the main component registered from JavaScript. This is used to schedule
24 | * rendering of the component.
25 | */
26 | override fun getMainComponentName(): String = "main"
27 |
28 | /**
29 | * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
30 | * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
31 | */
32 | override fun createReactActivityDelegate(): ReactActivityDelegate {
33 | return ReactActivityDelegateWrapper(
34 | this,
35 | BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
36 | object : DefaultReactActivityDelegate(
37 | this,
38 | mainComponentName,
39 | fabricEnabled
40 | ){})
41 | }
42 |
43 | /**
44 | * Align the back button behavior with Android S
45 | * where moving root activities to background instead of finishing activities.
46 | * @see onBackPressed
47 | */
48 | override fun invokeDefaultOnBackPressed() {
49 | if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
50 | if (!moveTaskToBack(false)) {
51 | // For non-root activities, use the default implementation to finish them.
52 | super.invokeDefaultOnBackPressed()
53 | }
54 | return
55 | }
56 |
57 | // Use the default back button implementation on Android S
58 | // because it's doing more than [Activity.moveTaskToBack] in fact.
59 | super.invokeDefaultOnBackPressed()
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/java/com/web3authexpoexample/MainApplication.kt:
--------------------------------------------------------------------------------
1 | package com.web3authexpoexample
2 |
3 | import android.app.Application
4 | import android.content.res.Configuration
5 |
6 | import com.facebook.react.PackageList
7 | import com.facebook.react.ReactApplication
8 | import com.facebook.react.ReactNativeHost
9 | import com.facebook.react.ReactPackage
10 | import com.facebook.react.ReactHost
11 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
12 | import com.facebook.react.defaults.DefaultReactNativeHost
13 | import com.facebook.soloader.SoLoader
14 |
15 | import expo.modules.ApplicationLifecycleDispatcher
16 | import expo.modules.ReactNativeHostWrapper
17 |
18 | class MainApplication : Application(), ReactApplication {
19 |
20 | override val reactNativeHost: ReactNativeHost = ReactNativeHostWrapper(
21 | this,
22 | object : DefaultReactNativeHost(this) {
23 | override fun getPackages(): List {
24 | // Packages that cannot be autolinked yet can be added manually here, for example:
25 | // packages.add(new MyReactNativePackage());
26 | return PackageList(this).packages
27 | }
28 |
29 | override fun getJSMainModuleName(): String = ".expo/.virtual-metro-entry"
30 |
31 | override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
32 |
33 | override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
34 | override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
35 | }
36 | )
37 |
38 | override val reactHost: ReactHost
39 | get() = ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost)
40 |
41 | override fun onCreate() {
42 | super.onCreate()
43 | SoLoader.init(this, false)
44 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
45 | // If you opted-in for the New Architecture, we load the native entry point for this app.
46 | load()
47 | }
48 | ApplicationLifecycleDispatcher.onApplicationCreate(this)
49 | }
50 |
51 | override fun onConfigurationChanged(newConfig: Configuration) {
52 | super.onConfigurationChanged(newConfig)
53 | ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig)
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/drawable-hdpi/splashscreen_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/drawable-hdpi/splashscreen_image.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/drawable-mdpi/splashscreen_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/drawable-mdpi/splashscreen_image.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png
--------------------------------------------------------------------------------
/demo/rn-expo-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-expo-example/android/app/src/main/res/drawable/splashscreen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/values-night/colors.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 | #ffffff
3 | #ffffff
4 | #023c69
5 | #ffffff
6 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | web3authexpoexample
3 | contain
4 | false
5 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
14 |
17 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
6 | minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '23')
7 | compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
8 | targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
9 | kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.23'
10 |
11 | ndkVersion = "26.1.10909125"
12 | }
13 | repositories {
14 | google()
15 | mavenCentral()
16 | }
17 | dependencies {
18 | classpath('com.android.tools.build:gradle')
19 | classpath('com.facebook.react:react-native-gradle-plugin')
20 | classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
21 | }
22 | }
23 |
24 | apply plugin: "com.facebook.react.rootproject"
25 |
26 | allprojects {
27 | repositories {
28 | maven {
29 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
30 | url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
31 | }
32 | maven {
33 | // Android JSC is installed from npm
34 | url(new File(['node', '--print', "require.resolve('jsc-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), '../dist'))
35 | }
36 |
37 | google()
38 | mavenCentral()
39 | maven { url 'https://www.jitpack.io' }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/demo/rn-expo-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 |
25 | # Automatically convert third-party libraries to use AndroidX
26 | android.enableJetifier=true
27 |
28 | # Use this property to specify which architecture you want to build.
29 | # You can also override it from the CLI using
30 | # ./gradlew -PreactNativeArchitectures=x86_64
31 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
32 |
33 | # Use this property to enable support to the new architecture.
34 | # This will allow you to use TurboModules and the Fabric render in
35 | # your application. You should enable this flag either if you want
36 | # to write custom TurboModules/Fabric components OR use libraries that
37 | # are providing them.
38 | newArchEnabled=false
39 |
40 | # Use this property to enable or disable the Hermes JS engine.
41 | # If set to false, you will be using JSC instead.
42 | hermesEnabled=true
43 |
44 | # Enable GIF support in React Native images (~200 B increase)
45 | expo.gif.enabled=true
46 | # Enable webp support in React Native images (~85 KB increase)
47 | expo.webp.enabled=true
48 | # Enable animated webp support (~3.4 MB increase)
49 | # Disabled by default because iOS doesn't support animated webp
50 | expo.webp.animated=false
51 |
52 | # Enable network inspector
53 | EX_DEV_CLIENT_NETWORK_INSPECTOR=true
54 |
55 | # Use legacy packaging to compress native libraries in the resulting APK.
56 | expo.useLegacyPackaging=false
57 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/demo/rn-expo-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-expo-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-expo-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-expo-example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'web3authexpoexample'
2 |
3 | dependencyResolutionManagement {
4 | versionCatalogs {
5 | reactAndroidLibs {
6 | from(files(new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../gradle/libs.versions.toml")))
7 | }
8 | }
9 | }
10 |
11 | apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle");
12 | useExpoModules()
13 |
14 | apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
15 | applyNativeModulesSettingsGradle(settings)
16 |
17 | include ':app'
18 | includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile())
19 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "web3authexpoexample",
4 | "slug": "web3authexpoexample",
5 | "scheme": "web3authexpoexample",
6 | "version": "1.0.0",
7 | "orientation": "portrait",
8 | "icon": "./assets/icon.png",
9 | "userInterfaceStyle": "light",
10 | "splash": {
11 | "image": "./assets/splash.png",
12 | "resizeMode": "contain",
13 | "backgroundColor": "#ffffff"
14 | },
15 | "ios": {
16 | "supportsTablet": true,
17 | "bundleIdentifier": "com.web3authexpoexample"
18 | },
19 | "android": {
20 | "adaptiveIcon": {
21 | "foregroundImage": "./assets/adaptive-icon.png",
22 | "backgroundColor": "#ffffff"
23 | },
24 | "package": "com.web3authexpoexample"
25 | },
26 | "web": {
27 | "favicon": "./assets/favicon.png"
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/assets/adaptive-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/assets/adaptive-icon.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/assets/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/assets/favicon.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/assets/icon.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/assets/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/assets/splash.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = function(api) {
2 | api.cache(true);
3 | return {
4 | presets: ['babel-preset-expo'],
5 | };
6 | };
7 |
--------------------------------------------------------------------------------
/demo/rn-expo-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-expo-example/ios/.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 | project.xcworkspace
24 | .xcode.env.local
25 |
26 | # Bundle artifacts
27 | *.jsbundle
28 |
29 | # CocoaPods
30 | /Pods/
31 |
--------------------------------------------------------------------------------
/demo/rn-expo-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-expo-example/ios/Podfile:
--------------------------------------------------------------------------------
1 | require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
2 | require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
3 |
4 | require 'json'
5 | podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
6 |
7 | ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0'
8 | ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR']
9 |
10 | platform :ios, podfile_properties['ios.deploymentTarget'] || '13.4'
11 | install! 'cocoapods',
12 | :deterministic_uuids => false
13 |
14 | prepare_react_native_project!
15 |
16 | target 'web3authexpoexample' do
17 | use_expo_modules!
18 | config = use_native_modules!
19 |
20 | use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
21 | use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
22 |
23 | use_react_native!(
24 | :path => config[:reactNativePath],
25 | :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
26 | # An absolute path to your application root.
27 | :app_path => "#{Pod::Config.instance.installation_root}/..",
28 | # Temporarily disable privacy file aggregation by default, until React
29 | # Native 0.74.2 is released with fixes.
30 | :privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] == 'true',
31 | )
32 |
33 | post_install do |installer|
34 | react_native_post_install(
35 | installer,
36 | config[:reactNativePath],
37 | :mac_catalyst_enabled => false,
38 | :ccache_enabled => podfile_properties['apple.ccacheEnabled'] == 'true',
39 | )
40 |
41 | # This is necessary for Xcode 14, because it signs resource bundles by default
42 | # when building for devices.
43 | installer.target_installation_results.pod_target_installation_results
44 | .each do |pod_name, target_installation_result|
45 | target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
46 | resource_bundle_target.build_configurations.each do |config|
47 | config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
48 | end
49 | end
50 | end
51 | end
52 |
53 | post_integrate do |installer|
54 | begin
55 | expo_patch_react_imports!(installer)
56 | rescue => e
57 | Pod::UI.warn e
58 | end
59 | end
60 | end
61 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/Podfile.properties.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo.jsEngine": "hermes",
3 | "EX_DEV_CLIENT_NETWORK_INSPECTOR": "true"
4 | }
5 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/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-expo-example/ios/web3authexpoexample.xcodeproj/xcshareddata/xcschemes/web3authexpoexample.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-expo-example/ios/web3authexpoexample.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import
4 |
5 | @interface AppDelegate : EXAppDelegateWrapper
6 |
7 | @end
8 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/AppDelegate.mm:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 |
3 | #import
4 | #import
5 |
6 | @implementation AppDelegate
7 |
8 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
9 | {
10 | self.moduleName = @"main";
11 |
12 | // You can add your custom initial props in the dictionary below.
13 | // They will be passed down to the ViewController used by React Native.
14 | self.initialProps = @{};
15 |
16 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
17 | }
18 |
19 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
20 | {
21 | return [self bundleURL];
22 | }
23 |
24 | - (NSURL *)bundleURL
25 | {
26 | #if DEBUG
27 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"];
28 | #else
29 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
30 | #endif
31 | }
32 |
33 | // Linking API
34 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options {
35 | return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
36 | }
37 |
38 | // Universal Links
39 | - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler {
40 | BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
41 | return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result;
42 | }
43 |
44 | // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
45 | - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
46 | {
47 | return [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
48 | }
49 |
50 | // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
51 | - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
52 | {
53 | return [super application:application didFailToRegisterForRemoteNotificationsWithError:error];
54 | }
55 |
56 | // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
57 | - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
58 | {
59 | return [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
60 | }
61 |
62 | @end
63 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/ios/web3authexpoexample/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "filename": "App-Icon-1024x1024@1x.png",
5 | "idiom": "universal",
6 | "platform": "ios",
7 | "size": "1024x1024"
8 | }
9 | ],
10 | "info": {
11 | "version": 1,
12 | "author": "expo"
13 | }
14 | }
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "expo"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/Images.xcassets/SplashScreen.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "idiom": "universal",
5 | "filename": "image.png",
6 | "scale": "1x"
7 | },
8 | {
9 | "idiom": "universal",
10 | "scale": "2x"
11 | },
12 | {
13 | "idiom": "universal",
14 | "scale": "3x"
15 | }
16 | ],
17 | "info": {
18 | "version": 1,
19 | "author": "expo"
20 | }
21 | }
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/Images.xcassets/SplashScreen.imageset/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/ios/web3authexpoexample/Images.xcassets/SplashScreen.imageset/image.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/Images.xcassets/SplashScreenBackground.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "idiom": "universal",
5 | "filename": "image.png",
6 | "scale": "1x"
7 | },
8 | {
9 | "idiom": "universal",
10 | "scale": "2x"
11 | },
12 | {
13 | "idiom": "universal",
14 | "scale": "3x"
15 | }
16 | ],
17 | "info": {
18 | "version": 1,
19 | "author": "expo"
20 | }
21 | }
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/Images.xcassets/SplashScreenBackground.imageset/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Web3Auth/web3auth-react-native-sdk/00d3afedc071d490952200a955e63b45573bfd34/demo/rn-expo-example/ios/web3authexpoexample/Images.xcassets/SplashScreenBackground.imageset/image.png
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CADisableMinimumFrameDurationOnPhone
6 |
7 | CFBundleDevelopmentRegion
8 | $(DEVELOPMENT_LANGUAGE)
9 | CFBundleDisplayName
10 | web3authexpoexample
11 | CFBundleExecutable
12 | $(EXECUTABLE_NAME)
13 | CFBundleIdentifier
14 | $(PRODUCT_BUNDLE_IDENTIFIER)
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | $(PRODUCT_NAME)
19 | CFBundlePackageType
20 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
21 | CFBundleShortVersionString
22 | 1.0.0
23 | CFBundleSignature
24 | ????
25 | CFBundleURLTypes
26 |
27 |
28 | CFBundleURLSchemes
29 |
30 | com.web3authexpoexample
31 |
32 |
33 |
34 | CFBundleVersion
35 | 1
36 | LSRequiresIPhoneOS
37 |
38 | NSAppTransportSecurity
39 |
40 | NSAllowsArbitraryLoads
41 |
42 | NSAllowsLocalNetworking
43 |
44 |
45 | UILaunchStoryboardName
46 | SplashScreen
47 | UIRequiredDeviceCapabilities
48 |
49 | arm64
50 |
51 | UIRequiresFullScreen
52 |
53 | UIStatusBarStyle
54 | UIStatusBarStyleDefault
55 | UISupportedInterfaceOrientations
56 |
57 | UIInterfaceOrientationPortrait
58 | UIInterfaceOrientationPortraitUpsideDown
59 |
60 | UISupportedInterfaceOrientations~ipad
61 |
62 | UIInterfaceOrientationPortrait
63 | UIInterfaceOrientationPortraitUpsideDown
64 | UIInterfaceOrientationLandscapeLeft
65 | UIInterfaceOrientationLandscapeRight
66 |
67 | UIUserInterfaceStyle
68 | Light
69 | UIViewControllerBasedStatusBarAppearance
70 |
71 |
72 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/SplashScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/Supporting/Expo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | EXUpdatesCheckOnLaunch
6 | ALWAYS
7 | EXUpdatesEnabled
8 |
9 | EXUpdatesLaunchWaitMs
10 | 0
11 |
12 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/main.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char * argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/noop-file.swift:
--------------------------------------------------------------------------------
1 | //
2 | // @generated
3 | // A blank Swift file must be created for native modules with Swift files to work correctly.
4 | //
5 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/web3authexpoexample-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/ios/web3authexpoexample/web3authexpoexample.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/metro.config.js:
--------------------------------------------------------------------------------
1 | // Learn more https://docs.expo.io/guides/customizing-metro
2 | const { getDefaultConfig } = require("expo/metro-config");
3 |
4 | /** @type {import('expo/metro-config').MetroConfig} */
5 | const config = getDefaultConfig(__dirname);
6 |
7 | config.resolver.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 | buffer: require.resolve("buffer")
18 | };
19 |
20 | config.transformer.getTransformOptions = () => ({
21 | transform: {
22 | experimentalImportSupport: false,
23 | inlineRequires: true
24 | }
25 | });
26 |
27 | module.exports = config;
28 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "web3authexpoexample",
3 | "version": "1.0.0",
4 | "main": "expo/AppEntry.js",
5 | "scripts": {
6 | "start": "expo start",
7 | "android": "expo run:android",
8 | "ios": "expo run:ios",
9 | "web": "expo start --web"
10 | },
11 | "dependencies": {
12 | "@ethersproject/shims": "^5.7.0",
13 | "@expo/metro-runtime": "^3.2.1",
14 | "@web3auth/account-abstraction-provider": "^9.3.1",
15 | "@web3auth/ethereum-provider": "^9.3.0",
16 | "@web3auth/react-native-sdk": "file:../../web3auth-react-native-sdk-8.0.0.tgz",
17 | "ethers": "^6.13.4",
18 | "expo": "~51.0.10",
19 | "expo-constants": "^16.0.2",
20 | "expo-linking": "^6.3.1",
21 | "expo-router": "^3.5.15",
22 | "expo-secure-store": "^13.0.1",
23 | "expo-status-bar": "~1.12.1",
24 | "expo-web-browser": "^13.0.3",
25 | "react": "18.2.0",
26 | "react-native": "0.74.1",
27 | "react-native-mmkv-storage": "^0.11.2",
28 | "react-native-quick-crypto": "^0.7.5"
29 | },
30 | "devDependencies": {
31 | "@babel/core": "^7.20.0",
32 | "@types/react": "^18.3.3",
33 | "buffer": "^6.0.3",
34 | "crypto-browserify": "^3.12.0",
35 | "empty-module": "^0.0.2",
36 | "process": "^0.11.10",
37 | "readable-stream": "^4.5.2",
38 | "typescript": "^5.4.5"
39 | },
40 | "private": true
41 | }
42 |
--------------------------------------------------------------------------------
/demo/rn-expo-example/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {},
3 | "extends": "expo/tsconfig.base"
4 | }
5 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@web3auth/react-native-sdk",
3 | "version": "8.1.0",
4 | "description": "Web3Auth SDK that supports Bare (Standalone) and Expo React Native apps.",
5 | "sideEffects": false,
6 | "main": "dist/lib.cjs/index.js",
7 | "module": "dist/lib.esm/index.js",
8 | "source": "src/index.ts",
9 | "types": "dist/types/index.d.ts",
10 | "files": [
11 | "dist"
12 | ],
13 | "scripts": {
14 | "release": "torus-scripts release",
15 | "start": "torus-scripts start",
16 | "build": "torus-scripts build",
17 | "lint:ts": "eslint --fix 'src/**/*.ts'",
18 | "prepack": "npm run build",
19 | "prepare": "husky"
20 | },
21 | "repository": {
22 | "type": "git",
23 | "url": "git+https://github.com/web3auth/web3auth-react-native-sdk.git"
24 | },
25 | "author": "Web3Auth",
26 | "license": "ISC",
27 | "bugs": {
28 | "url": "https://github.com/web3auth/web3auth-react-native-sdk/issues"
29 | },
30 | "homepage": "https://github.com/web3auth/web3auth-react-native-sdk#readme",
31 | "keywords": [
32 | "expo",
33 | "react-native",
34 | "torus",
35 | "web3",
36 | "web3auth"
37 | ],
38 | "dependencies": {
39 | "@toruslabs/constants": "^14.0.0",
40 | "@toruslabs/http-helpers": "^7.0.0",
41 | "@toruslabs/session-manager": "^3.1.0",
42 | "@web3auth/auth": "^9.4.1",
43 | "buffer": "^6.0.3",
44 | "lodash.clonedeep": "^4.5.0",
45 | "lodash.merge": "^4.6.2",
46 | "loglevel": "^1.9.2",
47 | "react-native-url-polyfill": "^2.0.0",
48 | "urijs": "^1.19.11"
49 | },
50 | "peerDependencies": {
51 | "@babel/runtime": "^7.x",
52 | "react-native": "*"
53 | },
54 | "devDependencies": {
55 | "@babel/runtime": "^7.26.0",
56 | "@toruslabs/config": "^2.2.0",
57 | "@toruslabs/eslint-config-typescript": "3.3.4",
58 | "@toruslabs/torus-scripts": "^6.1.5",
59 | "@types/lodash.clonedeep": "^4.5.9",
60 | "@types/lodash.merge": "^4.6.9",
61 | "@types/node": "^22",
62 | "@types/react-native": "^0.72.8",
63 | "@types/urijs": "^1.19.25",
64 | "@web3auth/base": "^9.3.0",
65 | "eslint": "^8.53.0",
66 | "husky": "^9.1.6",
67 | "lint-staged": "^15.2.10",
68 | "prettier": "^3.3.3",
69 | "react-native": "~0.75.3",
70 | "rimraf": "^6.0.1",
71 | "typescript": "^5.6.3"
72 | },
73 | "engines": {
74 | "node": ">=18.x",
75 | "npm": ">=9.x"
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/constants.ts:
--------------------------------------------------------------------------------
1 | export const CHAIN_NAMESPACES = {
2 | EIP155: "eip155",
3 | SOLANA: "solana",
4 | CASPER: "casper",
5 | XRPL: "xrpl",
6 | OTHER: "other",
7 | } as const;
8 |
--------------------------------------------------------------------------------
/src/errors.ts:
--------------------------------------------------------------------------------
1 | export interface IWeb3authRNError extends Error {
2 | code: number;
3 | message: string;
4 | toString(): string;
5 | }
6 |
7 | export type ErrorCodes = {
8 | [key: number]: string;
9 | };
10 |
11 | export abstract class Web3authRNError extends Error implements IWeb3authRNError {
12 | code: number;
13 |
14 | message: string;
15 |
16 | public constructor(code: number, message?: string) {
17 | // takes care of stack and proto
18 | super(message);
19 |
20 | this.code = code;
21 | this.message = message || "";
22 | this.name = "Web3authRNError";
23 | }
24 |
25 | toJSON(): IWeb3authRNError {
26 | return {
27 | name: this.name,
28 | code: this.code,
29 | message: this.message,
30 | };
31 | }
32 |
33 | toString(): string {
34 | return JSON.stringify(this.toJSON());
35 | }
36 | }
37 | export class InitializationError extends Web3authRNError {
38 | protected static messages: ErrorCodes = {
39 | 5000: "Custom",
40 | 5001: "Invalid constructor params",
41 | 5002: "SDK not initialized. please call init first",
42 | };
43 |
44 | public constructor(code: number, message?: string) {
45 | // takes care of stack and proto
46 | super(code, message);
47 |
48 | // Set name explicitly as minification can mangle class names
49 | this.name = "InitializationError";
50 | }
51 |
52 | public static fromCode(code: number, extraMessage = ""): Web3authRNError {
53 | return new InitializationError(code, `${InitializationError.messages[code]}, ${extraMessage}`);
54 | }
55 |
56 | public static invalidParams(extraMessage = ""): Web3authRNError {
57 | return InitializationError.fromCode(5001, extraMessage);
58 | }
59 |
60 | public static notInitialized(extraMessage = ""): Web3authRNError {
61 | return InitializationError.fromCode(5002, extraMessage);
62 | }
63 | }
64 |
65 | /**
66 | * login errors
67 | */
68 |
69 | export class LoginError extends Web3authRNError {
70 | protected static messages: ErrorCodes = {
71 | 5000: "Custom",
72 | 5111: "Invalid login params",
73 | 5112: "User not logged in.",
74 | 5113: "login popup has been closed by the user",
75 | 5114: "Login failed",
76 | 5115: "Popup was blocked. Please call this function as soon as user clicks button or use redirect mode",
77 | 5116: "MFA already enabled",
78 | 5117: "MFA not yet enabled. Please call `enableMFA` first",
79 | 5118: "useCoreKitKey flag is enabled but coreKitKey is not available",
80 | };
81 |
82 | public constructor(code: number, message?: string) {
83 | // takes care of stack and proto
84 | super(code, message);
85 |
86 | // Set name explicitly as minification can mangle class names
87 | this.name = "LoginError";
88 | }
89 |
90 | public static fromCode(code: number, extraMessage = ""): Web3authRNError {
91 | return new LoginError(code, `${LoginError.messages[code]}, ${extraMessage}`);
92 | }
93 |
94 | public static invalidLoginParams(extraMessage = ""): Web3authRNError {
95 | return LoginError.fromCode(5111, extraMessage);
96 | }
97 |
98 | public static userNotLoggedIn(extraMessage = ""): Web3authRNError {
99 | return LoginError.fromCode(5112, extraMessage);
100 | }
101 |
102 | public static popupClosed(extraMessage = ""): Web3authRNError {
103 | return LoginError.fromCode(5113, extraMessage);
104 | }
105 |
106 | public static loginFailed(extraMessage = ""): Web3authRNError {
107 | return LoginError.fromCode(5114, extraMessage);
108 | }
109 |
110 | public static popupBlocked(extraMessage = ""): Web3authRNError {
111 | return LoginError.fromCode(5115, extraMessage);
112 | }
113 |
114 | public static mfaAlreadyEnabled(extraMessage = ""): Web3authRNError {
115 | return LoginError.fromCode(5116, extraMessage);
116 | }
117 |
118 | public static mfaNotEnabled(extraMessage = ""): Web3authRNError {
119 | return LoginError.fromCode(5117, extraMessage);
120 | }
121 |
122 | public static coreKitKeyNotFound(extraMessage = ""): Web3authRNError {
123 | return LoginError.fromCode(5118, extraMessage);
124 | }
125 | }
126 |
127 | export class RequestError extends Web3authRNError {
128 | protected static messages: ErrorCodes = {
129 | 5000: "Custom",
130 | };
131 |
132 | public constructor(code: number, message?: string) {
133 | // takes care of stack and proto
134 | super(code, message);
135 |
136 | // Set name explicitly as minification can mangle class names
137 | this.name = "RequestError";
138 | }
139 |
140 | public static fromCode(code: number, extraMessage = ""): Web3authRNError {
141 | return new RequestError(code, `${RequestError.messages[code]}, ${extraMessage}`);
142 | }
143 | }
144 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./types/interface";
2 | export * from "./types/IWebBrowser";
3 | export { default } from "./Web3Auth";
4 |
--------------------------------------------------------------------------------
/src/session/KeyStore.ts:
--------------------------------------------------------------------------------
1 | import { EncryptedStorage } from "../types/IEncryptedStorage";
2 | import { SecureStore } from "../types/IExpoSecureStore";
3 |
4 | export default class KeyStore {
5 | storage: SecureStore | EncryptedStorage;
6 |
7 | constructor(storage: SecureStore | EncryptedStorage) {
8 | this.storage = storage;
9 | }
10 |
11 | async get(key: string) {
12 | if ("getItemAsync" in this.storage) {
13 | return (this.storage as SecureStore).getItemAsync(key, {});
14 | }
15 | return (this.storage as EncryptedStorage).getItem(key);
16 | }
17 |
18 | async set(key: string, value: string) {
19 | if ("setItemAsync" in this.storage) {
20 | return (this.storage as SecureStore).setItemAsync(key, value, {});
21 | }
22 | return (this.storage as EncryptedStorage).setItem(key, value);
23 | }
24 |
25 | async remove(key: string) {
26 | if ("deleteItemAsync" in this.storage) {
27 | return (this.storage as SecureStore).deleteItemAsync(key, {});
28 | }
29 | return (this.storage as EncryptedStorage).removeItem(key);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/types/IEncryptedStorage.ts:
--------------------------------------------------------------------------------
1 | export type StorageErrorCallback = (error?: Error) => void;
2 | export type StorageValueCallback = (error?: Error, value?: string) => void;
3 |
4 | export type EncryptedStorage = {
5 | /**
6 | * Writes data to the disk, using SharedPreferences or KeyChain, depending on the platform.
7 | * @param {string} key - A string that will be associated to the value for later retrieval.
8 | * @param {string} value - The data to store.
9 | */
10 | setItem(key: string, value: string): Promise;
11 |
12 | /**
13 | * Writes data to the disk, using SharedPreferences or KeyChain, depending on the platform.
14 | * @param {string} key - A string that will be associated to the value for later retrieval.
15 | * @param {string} value - The data to store.
16 | * @param {Function} cb - The function to call when the operation completes.
17 | */
18 | setItem(key: string, value: string, cb: StorageErrorCallback): void;
19 |
20 | /**
21 | * Retrieves data from the disk, using SharedPreferences or KeyChain, depending on the platform and returns it as the specified type.
22 | * @param {string} key - A string that is associated to a value.
23 | */
24 | getItem(key: string): Promise;
25 |
26 | /**
27 | * Retrieves data from the disk, using SharedPreferences or KeyChain, depending on the platform and returns it as the specified type.
28 | * @param {string} key - A string that is associated to a value.
29 | * @param {Function} cb - The function to call when the operation completes.
30 | */
31 | getItem(key: string, cb: StorageValueCallback): void;
32 |
33 | /**
34 | * Deletes data from the disk, using SharedPreferences or KeyChain, depending on the platform.
35 | * @param {string} key - A string that is associated to a value.
36 | */
37 | removeItem(key: string): Promise;
38 |
39 | /**
40 | * Deletes data from the disk, using SharedPreferences or KeyChain, depending on the platform.
41 | * @param {string} key - A string that is associated to a value.
42 | * @param {Function} cb - The function to call when the operation completes.
43 | */
44 | removeItem(key: string, cb: StorageErrorCallback): void;
45 |
46 | /**
47 | * Clears all data from disk, using SharedPreferences or KeyChain, depending on the platform.
48 | */
49 | clear(): Promise;
50 |
51 | /**
52 | * Clears all data from disk, using SharedPreferences or KeyChain, depending on the platform.
53 | * @param {Function} cb - The function to call when the operation completes.
54 | */
55 | clear(cb: StorageErrorCallback): void;
56 | }
--------------------------------------------------------------------------------
/src/types/IExpoSecureStore.ts:
--------------------------------------------------------------------------------
1 | export const ExpoSecureStore: any = {};
2 | export type KeychainAccessibilityConstant = number;
3 |
4 | // @needsAudit
5 | /**
6 | * The data in the keychain item cannot be accessed after a restart until the device has been
7 | * unlocked once by the user. This may be useful if you need to access the item when the phone
8 | * is locked.
9 | */
10 | export const AFTER_FIRST_UNLOCK: KeychainAccessibilityConstant = ExpoSecureStore.AFTER_FIRST_UNLOCK;
11 |
12 | // @needsAudit
13 | /**
14 | * Similar to `AFTER_FIRST_UNLOCK`, except the entry is not migrated to a new device when restoring
15 | * from a backup.
16 | */
17 | export const AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY: KeychainAccessibilityConstant = ExpoSecureStore.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY;
18 |
19 | // @needsAudit
20 | /**
21 | * The data in the keychain item can always be accessed regardless of whether the device is locked.
22 | * This is the least secure option.
23 | */
24 | export const ALWAYS: KeychainAccessibilityConstant = ExpoSecureStore.ALWAYS;
25 |
26 | // @needsAudit
27 | /**
28 | * Similar to `WHEN_UNLOCKED_THIS_DEVICE_ONLY`, except the user must have set a passcode in order to
29 | * store an entry. If the user removes their passcode, the entry will be deleted.
30 | */
31 | export const WHEN_PASSCODE_SET_THIS_DEVICE_ONLY: KeychainAccessibilityConstant = ExpoSecureStore.WHEN_PASSCODE_SET_THIS_DEVICE_ONLY;
32 |
33 | // @needsAudit
34 | /**
35 | * Similar to `ALWAYS`, except the entry is not migrated to a new device when restoring from a backup.
36 | */
37 | export const ALWAYS_THIS_DEVICE_ONLY: KeychainAccessibilityConstant = ExpoSecureStore.ALWAYS_THIS_DEVICE_ONLY;
38 |
39 | // @needsAudit
40 | /**
41 | * The data in the keychain item can be accessed only while the device is unlocked by the user.
42 | */
43 | export const WHEN_UNLOCKED: KeychainAccessibilityConstant = ExpoSecureStore.WHEN_UNLOCKED;
44 |
45 | // @needsAudit
46 | /**
47 | * Similar to `WHEN_UNLOCKED`, except the entry is not migrated to a new device when restoring from
48 | * a backup.
49 | */
50 | export const WHEN_UNLOCKED_THIS_DEVICE_ONLY: KeychainAccessibilityConstant = ExpoSecureStore.WHEN_UNLOCKED_THIS_DEVICE_ONLY;
51 |
52 |
53 | export type SecureStoreOptions = {
54 | /**
55 | * - iOS: The item's service, equivalent to `kSecAttrService`
56 | * - Android: Equivalent of the public/private key pair `Alias`
57 | * > If the item is set with the `keychainService` option, it will be required to later fetch the value.
58 | */
59 | keychainService?: string;
60 | /**
61 | * Option responsible for enabling the usage of the user authentication methods available on the device while
62 | * accessing data stored in SecureStore.
63 | * - iOS: Equivalent to `kSecAccessControlBiometryCurrentSet`
64 | * - Android: Equivalent to `setUserAuthenticationRequired(true)` (requires API 23).
65 | * Complete functionality is unlocked only with a freshly generated key - this would not work in tandem with the `keychainService`
66 | * value used for the others non-authenticated operations.
67 | */
68 | requireAuthentication?: boolean;
69 | /**
70 | * Custom message displayed to the user while `requireAuthentication` option is turned on.
71 | */
72 | authenticationPrompt?: string;
73 | /**
74 | * Specifies when the stored entry is accessible, using iOS's `kSecAttrAccessible` property.
75 | * @see Apple's documentation on [keychain item accessibility](https://developer.apple.com/library/content/documentation/Security/Conceptual/keychainServConcepts/02concepts/concepts.html#//apple_ref/doc/uid/TP30000897-CH204-SW18).
76 | * @default SecureStore.WHEN_UNLOCKED
77 | * @platform ios
78 | */
79 | keychainAccessible?: KeychainAccessibilityConstant;
80 | };
81 |
82 | export declare type SecureStore = {
83 | /**
84 | * Fetch the stored value associated with the provided key.
85 | *
86 | * @param key The key that was used to store the associated value.
87 | * @param options An [`SecureStoreOptions`](#securestoreoptions) object.
88 | *
89 | * @return A promise that resolves to the previously stored value, or `null` if there is no entry
90 | * for the given key. The promise will reject if an error occurred while retrieving the value.
91 | */
92 |
93 | getItemAsync(key: string, options: SecureStoreOptions): Promise;
94 |
95 | /**
96 | * Store a key–value pair.
97 | *
98 | * @param key The key to associate with the stored value. Keys may contain alphanumeric characters
99 | * `.`, `-`, and `_`.
100 | * @param value The value to store. Size limit is 2048 bytes.
101 | * @param options An [`SecureStoreOptions`](#securestoreoptions) object.
102 | *
103 | * @return A promise that will reject if value cannot be stored on the device.
104 | */
105 | setItemAsync(key: string, value: string, options: SecureStoreOptions): Promise;
106 |
107 | /**
108 | * Delete the value associated with the provided key.
109 | *
110 | * @param key The key that was used to store the associated value.
111 | * @param options An [`SecureStoreOptions`](#securestoreoptions) object.
112 | *
113 | * @return A promise that will reject if the value couldn't be deleted.
114 | */
115 | deleteItemAsync(key: string, options: SecureStoreOptions): Promise;
116 | }
--------------------------------------------------------------------------------
/src/types/interface.ts:
--------------------------------------------------------------------------------
1 | import {
2 | type LoginParams,
3 | type AuthOptions,
4 | type AuthSessionData,
5 | type WhiteLabelData,
6 | BUILD_ENV,
7 | LANGUAGES,
8 | LOGIN_PROVIDER,
9 | SUPPORTED_KEY_CURVES,
10 | MFA_FACTOR,
11 | MFA_LEVELS,
12 | WEB3AUTH_NETWORK,
13 | THEME_MODES,
14 | } from "@web3auth/auth";
15 | import type { IBaseProvider, IProvider } from "@web3auth/base";
16 |
17 | type SdkSpecificInitParams = {
18 | enableLogging?: boolean;
19 | useCoreKitKey?: boolean;
20 | walletSdkURL?: string;
21 | /**
22 | * Private key provider for your chain namespace
23 | */
24 | privateKeyProvider: IBaseProvider;
25 | /**
26 | * Account abstraction provider for your chain namespace
27 | */
28 | accountAbstractionProvider?: IBaseProvider;
29 | };
30 |
31 | export type SdkInitParams = Omit &
32 | Required>;
33 |
34 | export type SdkLoginParams = Omit;
35 |
36 | // export type SdkLogoutParams = Partial & Partial;
37 |
38 | export type {
39 | LOGIN_PROVIDER_TYPE,
40 | WEB3AUTH_NETWORK_TYPE,
41 | SUPPORTED_KEY_CURVES_TYPE,
42 | MfaLevelType,
43 | LoginParams,
44 | AuthUserInfo,
45 | CUSTOM_LOGIN_PROVIDER_TYPE,
46 | ExtraLoginOptions,
47 | WhiteLabelData,
48 | TypeOfLogin,
49 | BUILD_ENV_TYPE,
50 | LANGUAGE_TYPE,
51 | MFA_FACTOR_TYPE,
52 | MFA_SETTINGS,
53 | MfaSettings,
54 | SocialMfaModParams,
55 | THEME_MODE_TYPE,
56 | AuthSessionData,
57 | } from "@web3auth/auth";
58 |
59 | export type State = AuthSessionData;
60 |
61 | export interface IWeb3Auth {
62 | provider: IProvider | null;
63 | connected: boolean;
64 | init: () => Promise;
65 | login: (params: SdkLoginParams) => Promise;
66 | logout: () => Promise;
67 | userInfo: () => State["userInfo"];
68 | enableMFA: () => Promise;
69 | launchWalletServices: (chainConfig: ChainConfig, path?: string) => Promise;
70 | request(chainConfig: ChainConfig, method: string, params: unknown[], path?: string): Promise;
71 | }
72 |
73 | export type WalletLoginParams = {
74 | loginId: string;
75 | sessionId: string;
76 | request?: {
77 | method: string;
78 | params: unknown[];
79 | };
80 | platform: string;
81 | };
82 |
83 | export enum ChainNamespace {
84 | EIP155 = "eip155",
85 | SOLANA = "solana",
86 | }
87 |
88 | export type ChainConfig = {
89 | chainNamespace: ChainNamespace;
90 | decimals?: number;
91 | blockExplorerUrl?: String;
92 | chainId: String;
93 | displayName?: String;
94 | logo?: String;
95 | rpcTarget: String;
96 | ticker?: String;
97 | tickerName?: String;
98 | };
99 |
100 | export interface WhitelistResponse {
101 | urls: string[];
102 | signed_urls: Record;
103 | }
104 |
105 | export interface ProjectConfigResponse {
106 | whitelabel?: WhiteLabelData;
107 | sms_otp_enabled: boolean;
108 | wallet_connect_enabled: boolean;
109 | wallet_connect_project_id?: string;
110 | whitelist?: WhitelistResponse;
111 | key_export_enabled?: boolean;
112 | }
113 |
114 | export { BUILD_ENV, WEB3AUTH_NETWORK, LANGUAGES, LOGIN_PROVIDER, SUPPORTED_KEY_CURVES, MFA_FACTOR, MFA_LEVELS, THEME_MODES };
115 |
--------------------------------------------------------------------------------
/src/utils.ts:
--------------------------------------------------------------------------------
1 | import { SIGNER_MAP } from "@toruslabs/constants";
2 | import { get } from "@toruslabs/http-helpers";
3 | import { safeatob, WEB3AUTH_NETWORK, WEB3AUTH_NETWORK_TYPE } from "@web3auth/auth";
4 | import log from "loglevel";
5 | import { URL, URLSearchParams } from "react-native-url-polyfill";
6 |
7 | import { ProjectConfigResponse } from "./index";
8 |
9 | export function constructURL(params: { baseURL: string; query?: Record; hash?: Record }): string {
10 | const { baseURL, query, hash } = params;
11 |
12 | const url = new URL(baseURL);
13 | if (query) {
14 | Object.keys(query).forEach((key) => {
15 | url.searchParams.append(key, query[key] as string);
16 | });
17 | }
18 | if (hash) {
19 | const h = new URL(constructURL({ baseURL, query: hash })).searchParams.toString();
20 | url.hash = h;
21 | }
22 | return url.toString();
23 | }
24 |
25 | export type HashQueryParamResult = {
26 | sessionId?: string;
27 | sessionNamespace?: string;
28 | error?: string;
29 | state?: string;
30 | // Used only for request method
31 | success?: string;
32 | result?: string;
33 | };
34 |
35 | export function getHashQueryParams(url: string): HashQueryParamResult {
36 | const result: HashQueryParamResult = {};
37 | const urlObj = new URL(url);
38 |
39 | const queryUrlParams = new URLSearchParams(urlObj.search.slice(1));
40 | queryUrlParams.forEach((value: string, key: string) => {
41 | if (key !== "b64Params") {
42 | result[key as keyof HashQueryParamResult] = value;
43 | }
44 | });
45 | const queryResult = queryUrlParams.get("b64Params");
46 | if (queryResult) {
47 | try {
48 | const queryParams = JSON.parse(safeatob(queryResult));
49 | Object.keys(queryParams).forEach((key: string) => {
50 | result[key as keyof HashQueryParamResult] = queryParams[key];
51 | });
52 | } catch (error) {
53 | log.error(error);
54 | }
55 | }
56 |
57 | const hashUrlParams = new URLSearchParams(urlObj.hash.substring(1));
58 | hashUrlParams.forEach((value: string, key: string) => {
59 | if (key !== "b64Params") {
60 | result[key as keyof HashQueryParamResult] = value;
61 | }
62 | });
63 |
64 | const hashResult = hashUrlParams.get("b64Params");
65 | if (hashResult) {
66 | try {
67 | const hashParams = JSON.parse(safeatob(hashResult));
68 | Object.keys(hashParams).forEach((key: string) => {
69 | result[key as keyof HashQueryParamResult] = hashParams[key];
70 | });
71 | } catch (error) {
72 | log.error(error);
73 | }
74 | }
75 |
76 | return result;
77 | }
78 |
79 | export const signerHost = (web3AuthNetwork?: WEB3AUTH_NETWORK_TYPE): string => {
80 | return SIGNER_MAP[web3AuthNetwork ?? WEB3AUTH_NETWORK.SAPPHIRE_MAINNET];
81 | };
82 |
83 | export const fetchProjectConfig = async (clientId: string, web3AuthNetwork: WEB3AUTH_NETWORK_TYPE): Promise => {
84 | try {
85 | const url = new URL(`${signerHost(web3AuthNetwork)}/api/configuration`);
86 | url.searchParams.append("project_id", clientId);
87 | url.searchParams.append("network", web3AuthNetwork);
88 | url.searchParams.append("whitelist", "true");
89 | //log.debug("Fetching project configuration from URL:", url.href);
90 | const res = await get(url.href);
91 | //log.debug(`[Web3Auth] config response: ${JSON.stringify(res)}`);
92 | return res;
93 | } catch (e) {
94 | throw new Error(`Failed to fetch project config: ${(e as Error).message}`);
95 | }
96 | };
97 |
--------------------------------------------------------------------------------
/torus.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | ...require("@toruslabs/config/torus.config"),
3 | umd: false,
4 | };
5 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@toruslabs/config/tsconfig.default.json",
3 | "compilerOptions": {
4 | "moduleResolution": "Node16",
5 | "module": "Node16"
6 | },
7 | "include": ["src"],
8 | "exclude": ["node_modules", "dist"]
9 | }
10 |
--------------------------------------------------------------------------------