@account-kit/react-native-signer 4.1.8-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/.github/actions/setup/action.yml +27 -0
  2. package/.github/workflows/ci.yml +157 -0
  3. package/.npmrc +1 -0
  4. package/.turbo/turbo-prepare.log +21 -0
  5. package/.watchmanconfig +1 -0
  6. package/README.md +37 -0
  7. package/account-kit-react-native-signer.podspec +41 -0
  8. package/android/build.gradle +132 -0
  9. package/android/generated/java/com/accountkit/reactnativesigner/NativeTEKStamperSpec.java +55 -0
  10. package/android/generated/jni/CMakeLists.txt +36 -0
  11. package/android/generated/jni/NativeTEKStamperSpec-generated.cpp +56 -0
  12. package/android/generated/jni/NativeTEKStamperSpec.h +31 -0
  13. package/android/generated/jni/react/renderer/components/NativeTEKStamperSpec/ComponentDescriptors.cpp +22 -0
  14. package/android/generated/jni/react/renderer/components/NativeTEKStamperSpec/ComponentDescriptors.h +24 -0
  15. package/android/generated/jni/react/renderer/components/NativeTEKStamperSpec/EventEmitters.cpp +16 -0
  16. package/android/generated/jni/react/renderer/components/NativeTEKStamperSpec/EventEmitters.h +17 -0
  17. package/android/generated/jni/react/renderer/components/NativeTEKStamperSpec/NativeTEKStamperSpecJSI-generated.cpp +54 -0
  18. package/android/generated/jni/react/renderer/components/NativeTEKStamperSpec/NativeTEKStamperSpecJSI.h +150 -0
  19. package/android/generated/jni/react/renderer/components/NativeTEKStamperSpec/Props.cpp +19 -0
  20. package/android/generated/jni/react/renderer/components/NativeTEKStamperSpec/Props.h +18 -0
  21. package/android/generated/jni/react/renderer/components/NativeTEKStamperSpec/ShadowNodes.cpp +17 -0
  22. package/android/generated/jni/react/renderer/components/NativeTEKStamperSpec/ShadowNodes.h +23 -0
  23. package/android/generated/jni/react/renderer/components/NativeTEKStamperSpec/States.cpp +16 -0
  24. package/android/generated/jni/react/renderer/components/NativeTEKStamperSpec/States.h +19 -0
  25. package/android/gradle.properties +5 -0
  26. package/android/src/main/AndroidManifest.xml +3 -0
  27. package/android/src/main/java/com/accountkit/reactnativesigner/KeyExtensions.kt +77 -0
  28. package/android/src/main/java/com/accountkit/reactnativesigner/NativeTEKStamperModule.kt +234 -0
  29. package/android/src/main/java/com/accountkit/reactnativesigner/ReactNativeSignerPackage.kt +33 -0
  30. package/android/src/main/java/com/accountkit/reactnativesigner/TEKManager.kt +88 -0
  31. package/babel.config.js +5 -0
  32. package/example/.bundle/config +2 -0
  33. package/example/.watchmanconfig +1 -0
  34. package/example/Gemfile +9 -0
  35. package/example/README.md +79 -0
  36. package/example/android/app/build.gradle +133 -0
  37. package/example/android/app/debug.keystore +0 -0
  38. package/example/android/app/proguard-rules.pro +10 -0
  39. package/example/android/app/src/debug/AndroidManifest.xml +9 -0
  40. package/example/android/app/src/main/AndroidManifest.xml +17 -0
  41. package/example/android/app/src/main/java/accountkit/reactnativesigner/example/MainActivity.kt +27 -0
  42. package/example/android/app/src/main/java/accountkit/reactnativesigner/example/MainApplication.kt +48 -0
  43. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  44. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  45. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  46. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  47. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  48. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  49. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  50. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  51. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  52. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  53. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  54. package/example/android/app/src/main/res/values/strings.xml +3 -0
  55. package/example/android/app/src/main/res/values/styles.xml +9 -0
  56. package/example/android/build.gradle +21 -0
  57. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  58. package/example/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  59. package/example/android/gradle.properties +41 -0
  60. package/example/android/gradlew +252 -0
  61. package/example/android/gradlew.bat +94 -0
  62. package/example/android/settings.gradle +6 -0
  63. package/example/app.json +4 -0
  64. package/example/babel.config.js +12 -0
  65. package/example/index.js +6 -0
  66. package/example/ios/.xcode.env +11 -0
  67. package/example/ios/File.swift +6 -0
  68. package/example/ios/Podfile +47 -0
  69. package/example/ios/ReactNativeSignerExample/AppDelegate.h +6 -0
  70. package/example/ios/ReactNativeSignerExample/AppDelegate.mm +31 -0
  71. package/example/ios/ReactNativeSignerExample/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  72. package/example/ios/ReactNativeSignerExample/Images.xcassets/Contents.json +6 -0
  73. package/example/ios/ReactNativeSignerExample/Info.plist +52 -0
  74. package/example/ios/ReactNativeSignerExample/LaunchScreen.storyboard +47 -0
  75. package/example/ios/ReactNativeSignerExample/PrivacyInfo.xcprivacy +37 -0
  76. package/example/ios/ReactNativeSignerExample/main.m +10 -0
  77. package/example/ios/ReactNativeSignerExample-Bridging-Header.h +3 -0
  78. package/example/ios/ReactNativeSignerExample.xcodeproj/project.pbxproj +690 -0
  79. package/example/ios/ReactNativeSignerExample.xcodeproj/xcshareddata/xcschemes/ReactNativeSignerExample.xcscheme +98 -0
  80. package/example/ios/ReactNativeSignerExampleTests/Info.plist +24 -0
  81. package/example/ios/ReactNativeSignerExampleTests/ReactNativeSignerExampleTests.m +66 -0
  82. package/example/jest.config.js +3 -0
  83. package/example/metro.config.js +22 -0
  84. package/example/package.json +56 -0
  85. package/example/react-native.config.js +15 -0
  86. package/example/redirect-server/index.ts +19 -0
  87. package/example/src/App.tsx +30 -0
  88. package/example/src/screens/Home.tsx +149 -0
  89. package/example/turbo.json +38 -0
  90. package/ios/ReactNativeSigner.h +12 -0
  91. package/ios/ReactNativeSigner.mm +21 -0
  92. package/ios/generated/NativeTEKStamperSpec/ComponentDescriptors.cpp +22 -0
  93. package/ios/generated/NativeTEKStamperSpec/ComponentDescriptors.h +24 -0
  94. package/ios/generated/NativeTEKStamperSpec/EventEmitters.cpp +16 -0
  95. package/ios/generated/NativeTEKStamperSpec/EventEmitters.h +17 -0
  96. package/ios/generated/NativeTEKStamperSpec/NativeTEKStamperSpec-generated.mm +67 -0
  97. package/ios/generated/NativeTEKStamperSpec/NativeTEKStamperSpec.h +68 -0
  98. package/ios/generated/NativeTEKStamperSpec/Props.cpp +19 -0
  99. package/ios/generated/NativeTEKStamperSpec/Props.h +18 -0
  100. package/ios/generated/NativeTEKStamperSpec/RCTComponentViewHelpers.h +18 -0
  101. package/ios/generated/NativeTEKStamperSpec/ShadowNodes.cpp +17 -0
  102. package/ios/generated/NativeTEKStamperSpec/ShadowNodes.h +23 -0
  103. package/ios/generated/NativeTEKStamperSpec/States.cpp +16 -0
  104. package/ios/generated/NativeTEKStamperSpec/States.h +19 -0
  105. package/ios/generated/NativeTEKStamperSpecJSI-generated.cpp +54 -0
  106. package/ios/generated/NativeTEKStamperSpecJSI.h +150 -0
  107. package/lib/commonjs/NativeTEKStamper.js +9 -0
  108. package/lib/commonjs/NativeTEKStamper.js.map +1 -0
  109. package/lib/commonjs/client.js +103 -0
  110. package/lib/commonjs/client.js.map +1 -0
  111. package/lib/commonjs/index.js +13 -0
  112. package/lib/commonjs/index.js.map +1 -0
  113. package/lib/commonjs/signer.js +39 -0
  114. package/lib/commonjs/signer.js.map +1 -0
  115. package/lib/commonjs/utils/mmkv-localstorage-polyfill.js +38 -0
  116. package/lib/commonjs/utils/mmkv-localstorage-polyfill.js.map +1 -0
  117. package/lib/module/NativeTEKStamper.js +5 -0
  118. package/lib/module/NativeTEKStamper.js.map +1 -0
  119. package/lib/module/client.js +96 -0
  120. package/lib/module/client.js.map +1 -0
  121. package/lib/module/index.js +5 -0
  122. package/lib/module/index.js.map +1 -0
  123. package/lib/module/signer.js +33 -0
  124. package/lib/module/signer.js.map +1 -0
  125. package/lib/module/utils/mmkv-localstorage-polyfill.js +38 -0
  126. package/lib/module/utils/mmkv-localstorage-polyfill.js.map +1 -0
  127. package/lib/typescript/commonjs/package.json +1 -0
  128. package/lib/typescript/commonjs/src/NativeTEKStamper.d.ts +34 -0
  129. package/lib/typescript/commonjs/src/NativeTEKStamper.d.ts.map +1 -0
  130. package/lib/typescript/commonjs/src/client.d.ts +107 -0
  131. package/lib/typescript/commonjs/src/client.d.ts.map +1 -0
  132. package/lib/typescript/commonjs/src/index.d.ts +2 -0
  133. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/src/signer.d.ts +185 -0
  135. package/lib/typescript/commonjs/src/signer.d.ts.map +1 -0
  136. package/lib/typescript/commonjs/src/utils/mmkv-localstorage-polyfill.d.ts +2 -0
  137. package/lib/typescript/commonjs/src/utils/mmkv-localstorage-polyfill.d.ts.map +1 -0
  138. package/lib/typescript/module/package.json +1 -0
  139. package/lib/typescript/module/src/NativeTEKStamper.d.ts +34 -0
  140. package/lib/typescript/module/src/NativeTEKStamper.d.ts.map +1 -0
  141. package/lib/typescript/module/src/client.d.ts +107 -0
  142. package/lib/typescript/module/src/client.d.ts.map +1 -0
  143. package/lib/typescript/module/src/index.d.ts +2 -0
  144. package/lib/typescript/module/src/index.d.ts.map +1 -0
  145. package/lib/typescript/module/src/signer.d.ts +185 -0
  146. package/lib/typescript/module/src/signer.d.ts.map +1 -0
  147. package/lib/typescript/module/src/utils/mmkv-localstorage-polyfill.d.ts +2 -0
  148. package/lib/typescript/module/src/utils/mmkv-localstorage-polyfill.d.ts.map +1 -0
  149. package/package.json +153 -0
  150. package/react-native.config.js +11 -0
  151. package/src/NativeTEKStamper.ts +42 -0
  152. package/src/client.ts +128 -0
  153. package/src/index.tsx +2 -0
  154. package/src/signer.ts +39 -0
  155. package/src/utils/mmkv-localstorage-polyfill.ts +41 -0
  156. package/tsconfig.build.json +4 -0
  157. package/tsconfig.json +30 -0
  158. package/turbo.json +9 -0
@@ -0,0 +1,98 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ LastUpgradeVersion = "1210"
4
+ version = "1.3">
5
+ <BuildAction
6
+ parallelizeBuildables = "YES"
7
+ buildImplicitDependencies = "YES">
8
+
9
+ <PreActions>
10
+ <ExecutionAction
11
+ ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
12
+ <ActionContent
13
+ title = "Invoke Codegen"
14
+ scriptText = "cd &quot;$WORKSPACE_PATH/../../../&quot; &amp;&amp; npx bob build --target codegen&#10;">
15
+ </ActionContent>
16
+ </ExecutionAction>
17
+ </PreActions>
18
+ <BuildActionEntries>
19
+ <BuildActionEntry
20
+ buildForTesting = "YES"
21
+ buildForRunning = "YES"
22
+ buildForProfiling = "YES"
23
+ buildForArchiving = "YES"
24
+ buildForAnalyzing = "YES">
25
+ <BuildableReference
26
+ BuildableIdentifier = "primary"
27
+ BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
28
+ BuildableName = "ReactNativeSignerExample.app"
29
+ BlueprintName = "ReactNativeSignerExample"
30
+ ReferencedContainer = "container:ReactNativeSignerExample.xcodeproj">
31
+ </BuildableReference>
32
+ </BuildActionEntry>
33
+ </BuildActionEntries>
34
+ </BuildAction>
35
+ <TestAction
36
+ buildConfiguration = "Debug"
37
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
38
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
39
+ shouldUseLaunchSchemeArgsEnv = "YES">
40
+ <Testables>
41
+ <TestableReference
42
+ skipped = "NO">
43
+ <BuildableReference
44
+ BuildableIdentifier = "primary"
45
+ BlueprintIdentifier = "00E356ED1AD99517003FC87E"
46
+ BuildableName = "ReactNativeSignerExampleTests.xctest"
47
+ BlueprintName = "ReactNativeSignerExampleTests"
48
+ ReferencedContainer = "container:ReactNativeSignerExample.xcodeproj">
49
+ </BuildableReference>
50
+ </TestableReference>
51
+ </Testables>
52
+ </TestAction>
53
+ <LaunchAction
54
+ buildConfiguration = "Debug"
55
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57
+ launchStyle = "0"
58
+ useCustomWorkingDirectory = "NO"
59
+ ignoresPersistentStateOnLaunch = "NO"
60
+ debugDocumentVersioning = "YES"
61
+ debugServiceExtension = "internal"
62
+ allowLocationSimulation = "YES">
63
+ <BuildableProductRunnable
64
+ runnableDebuggingMode = "0">
65
+ <BuildableReference
66
+ BuildableIdentifier = "primary"
67
+ BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
68
+ BuildableName = "ReactNativeSignerExample.app"
69
+ BlueprintName = "ReactNativeSignerExample"
70
+ ReferencedContainer = "container:ReactNativeSignerExample.xcodeproj">
71
+ </BuildableReference>
72
+ </BuildableProductRunnable>
73
+ </LaunchAction>
74
+ <ProfileAction
75
+ buildConfiguration = "Release"
76
+ shouldUseLaunchSchemeArgsEnv = "YES"
77
+ savedToolIdentifier = ""
78
+ useCustomWorkingDirectory = "NO"
79
+ debugDocumentVersioning = "YES">
80
+ <BuildableProductRunnable
81
+ runnableDebuggingMode = "0">
82
+ <BuildableReference
83
+ BuildableIdentifier = "primary"
84
+ BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
85
+ BuildableName = "ReactNativeSignerExample.app"
86
+ BlueprintName = "ReactNativeSignerExample"
87
+ ReferencedContainer = "container:ReactNativeSignerExample.xcodeproj">
88
+ </BuildableReference>
89
+ </BuildableProductRunnable>
90
+ </ProfileAction>
91
+ <AnalyzeAction
92
+ buildConfiguration = "Debug">
93
+ </AnalyzeAction>
94
+ <ArchiveAction
95
+ buildConfiguration = "Release"
96
+ revealArchiveInOrganizer = "YES">
97
+ </ArchiveAction>
98
+ </Scheme>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>en</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>BNDL</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleSignature</key>
20
+ <string>????</string>
21
+ <key>CFBundleVersion</key>
22
+ <string>1</string>
23
+ </dict>
24
+ </plist>
@@ -0,0 +1,66 @@
1
+ #import <UIKit/UIKit.h>
2
+ #import <XCTest/XCTest.h>
3
+
4
+ #import <React/RCTLog.h>
5
+ #import <React/RCTRootView.h>
6
+
7
+ #define TIMEOUT_SECONDS 600
8
+ #define TEXT_TO_LOOK_FOR @"Welcome to React"
9
+
10
+ @interface ReactNativeSignerExampleTests : XCTestCase
11
+
12
+ @end
13
+
14
+ @implementation ReactNativeSignerExampleTests
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
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ preset: "react-native",
3
+ };
@@ -0,0 +1,22 @@
1
+ const path = require("path");
2
+ const { getDefaultConfig } = require("@react-native/metro-config");
3
+ const { getConfig } = require("react-native-builder-bob/metro-config");
4
+ const pkg = require("../package.json");
5
+
6
+ const root = path.resolve(__dirname, "..");
7
+ // handles the hoisted modules
8
+ const repoRoot = path.resolve(__dirname, "../../..");
9
+
10
+ /**
11
+ * Metro configuration
12
+ * https://facebook.github.io/metro/docs/configuration
13
+ *
14
+ */
15
+ module.exports = {
16
+ ...getConfig(getDefaultConfig(__dirname), {
17
+ root,
18
+ pkg,
19
+ project: __dirname,
20
+ }),
21
+ watchFolders: [root, repoRoot],
22
+ };
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@account-kit/react-native-signer-example",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "scripts": {
6
+ "android": "react-native run-android && yarn start:redirect-server",
7
+ "ios": "react-native run-ios",
8
+ "start": "react-native start",
9
+ "start:redirect-server": "tsx ./redirect-server/index.ts",
10
+ "build:android": "react-native build-android --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"",
11
+ "build:ios": "react-native build-ios --scheme ReactNativeSignerExample --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\""
12
+ },
13
+ "dependencies": {
14
+ "@account-kit/signer": "^4.3.0",
15
+ "@react-navigation/native": "7.0.3",
16
+ "@react-navigation/native-stack": "7.1.0",
17
+ "dotenv": "^16.4.5",
18
+ "express": "^4.21.1",
19
+ "react": "18.3.1",
20
+ "react-native": "0.76.1",
21
+ "react-native-config": "1.5.3",
22
+ "react-native-gesture-handler": "2.21.2",
23
+ "react-native-mmkv": "3.1.0",
24
+ "react-native-safe-area-context": "4.14.0",
25
+ "react-native-screens": "4.2.0",
26
+ "util": "^0.12.5",
27
+ "viem": "^2.21.41",
28
+ "zustand": "^5.0.1"
29
+ },
30
+ "peerDependencies": {
31
+ "@types/react": "18.3.1",
32
+ "react": "18.3.1",
33
+ "react-native": "0.76.1"
34
+ },
35
+ "devDependencies": {
36
+ "@babel/core": "^7.25.2",
37
+ "@babel/preset-env": "^7.25.3",
38
+ "@babel/runtime": "^7.25.0",
39
+ "@react-native-community/cli": "15.0.0",
40
+ "@react-native-community/cli-platform-android": "15.0.0",
41
+ "@react-native-community/cli-platform-ios": "15.0.0",
42
+ "@react-native/babel-preset": "0.76.1",
43
+ "@react-native/metro-config": "0.76.1",
44
+ "@react-native/typescript-config": "0.76.1",
45
+ "react-native-builder-bob": "^0.30.3",
46
+ "tsx": "^4.19.2"
47
+ },
48
+ "engines": {
49
+ "node": ">=18"
50
+ },
51
+ "workspaces": {
52
+ "nohoist": [
53
+ "**"
54
+ ]
55
+ }
56
+ }
@@ -0,0 +1,15 @@
1
+ const path = require("path");
2
+ const pkg = require("../package.json");
3
+
4
+ module.exports = {
5
+ project: {
6
+ ios: {
7
+ automaticPodsInstallation: true,
8
+ },
9
+ },
10
+ dependencies: {
11
+ [pkg.name]: {
12
+ root: path.join(__dirname, ".."),
13
+ },
14
+ },
15
+ };
@@ -0,0 +1,19 @@
1
+ import express from "express";
2
+ import dotenv from "dotenv";
3
+
4
+ dotenv.config();
5
+
6
+ const app = express();
7
+ const port = process.env.PORT || 5500;
8
+ const appScheme = process.env.APP_SCHEME || "rn-signer-demo";
9
+
10
+ app.get("/", (req, res) => {
11
+ const bundle = req.query.bundle;
12
+ const orgId = req.query.orgId;
13
+
14
+ res.redirect(`${appScheme}://home?bundle=${bundle}&orgId=${orgId}`);
15
+ });
16
+
17
+ app.listen(port, () => {
18
+ console.log(`Server is running on port ${port}`);
19
+ });
@@ -0,0 +1,30 @@
1
+ /* eslint-disable import/extensions */
2
+ import { createStaticNavigation } from "@react-navigation/native";
3
+ import { createNativeStackNavigator } from "@react-navigation/native-stack";
4
+ import { SafeAreaProvider } from "react-native-safe-area-context";
5
+
6
+ import HomeScreen from "./screens/Home";
7
+
8
+ const linking = {
9
+ enabled: "auto" as const /* Automatically generate paths for all screens */,
10
+ prefixes: ["rn-signer-demo://"],
11
+ };
12
+
13
+ const RootStack = createNativeStackNavigator({
14
+ initialRouteName: "Home",
15
+ screens: {
16
+ Home: {
17
+ screen: HomeScreen,
18
+ linking: { path: "home" },
19
+ },
20
+ },
21
+ });
22
+
23
+ export default function App() {
24
+ const Navigation = createStaticNavigation(RootStack);
25
+ return (
26
+ <SafeAreaProvider>
27
+ <Navigation linking={linking} />
28
+ </SafeAreaProvider>
29
+ );
30
+ }
@@ -0,0 +1,149 @@
1
+ /* eslint-disable import/extensions */
2
+ import { RNAlchemySigner } from "@account-kit/react-native-signer";
3
+ import type { User } from "@account-kit/signer";
4
+ import { useEffect, useState } from "react";
5
+ import {
6
+ View,
7
+ Text,
8
+ TextInput,
9
+ StyleSheet,
10
+ Linking,
11
+ TouchableOpacity,
12
+ } from "react-native";
13
+ import Config from "react-native-config";
14
+
15
+ export default function HomeScreen() {
16
+ const [email, setEmail] = useState<string>("");
17
+ const [user, setUser] = useState<User | null>(null);
18
+ const signer = new RNAlchemySigner({
19
+ client: { connection: { apiKey: Config.API_KEY! } },
20
+ });
21
+
22
+ const handleUserAuth = ({ bundle }: { bundle: string }) => {
23
+ signer
24
+ .authenticate({
25
+ bundle,
26
+ type: "email",
27
+ })
28
+ .then(setUser)
29
+ .catch(console.error);
30
+ };
31
+
32
+ const handleIncomingURL = (event: { url: string }) => {
33
+ const regex = /[?&]([^=#]+)=([^&#]*)/g;
34
+
35
+ let params: Record<string, string> = {};
36
+ let match: RegExpExecArray | null;
37
+
38
+ while ((match = regex.exec(event.url))) {
39
+ if (match[1] && match[2]) {
40
+ params[match[1]] = match[2];
41
+ }
42
+ }
43
+
44
+ if (!params.bundle || !params.orgId) {
45
+ return;
46
+ }
47
+
48
+ handleUserAuth({
49
+ bundle: params.bundle ?? "",
50
+ });
51
+ };
52
+
53
+ useEffect(() => {
54
+ // get the user if already logged in
55
+ signer.getAuthDetails().then(setUser);
56
+ }, []);
57
+
58
+ // Add listener for incoming links
59
+ useEffect(() => {
60
+ const subscription = Linking.addEventListener("url", handleIncomingURL);
61
+
62
+ return () => subscription.remove();
63
+ }, []);
64
+
65
+ return (
66
+ <View style={styles.container}>
67
+ {!user ? (
68
+ <>
69
+ <TextInput
70
+ style={styles.textInput}
71
+ placeholderTextColor="gray"
72
+ placeholder="enter your email"
73
+ onChangeText={setEmail}
74
+ value={email}
75
+ />
76
+ <TouchableOpacity
77
+ style={styles.button}
78
+ onPress={() => {
79
+ signer
80
+ .authenticate({ email, type: "email" })
81
+ .catch(console.error);
82
+ }}
83
+ >
84
+ <Text style={styles.buttonText}>Sign in</Text>
85
+ </TouchableOpacity>
86
+ </>
87
+ ) : (
88
+ <>
89
+ <Text style={styles.userText}>
90
+ Currently logged in as: {user.email}
91
+ </Text>
92
+ <Text style={styles.userText}>OrgId: {user.orgId}</Text>
93
+ <Text style={styles.userText}>Address: {user.address}</Text>
94
+
95
+ <TouchableOpacity
96
+ style={styles.button}
97
+ onPress={() => signer.disconnect().then(() => setUser(null))}
98
+ >
99
+ <Text style={styles.buttonText}>Sign out</Text>
100
+ </TouchableOpacity>
101
+ </>
102
+ )}
103
+ </View>
104
+ );
105
+ }
106
+
107
+ const styles = StyleSheet.create({
108
+ container: {
109
+ flex: 1,
110
+ alignItems: "center",
111
+ justifyContent: "center",
112
+ backgroundColor: "#FFFFF",
113
+ paddingHorizontal: 20,
114
+ },
115
+ textInput: {
116
+ width: "100%",
117
+ height: 40,
118
+ borderColor: "gray",
119
+ borderWidth: 1,
120
+ paddingHorizontal: 10,
121
+ backgroundColor: "rgba(0,0,0,0.05)",
122
+ marginTop: 20,
123
+ marginBottom: 10,
124
+ },
125
+ box: {
126
+ width: 60,
127
+ height: 60,
128
+ marginVertical: 20,
129
+ },
130
+ button: {
131
+ width: 200,
132
+ padding: 10,
133
+ height: 50,
134
+ backgroundColor: "rgb(147, 197, 253)",
135
+ borderRadius: 5,
136
+ alignItems: "center",
137
+ justifyContent: "center",
138
+ marginTop: 20,
139
+ },
140
+ buttonText: {
141
+ color: "white",
142
+ fontWeight: "bold",
143
+ textAlign: "center",
144
+ },
145
+ userText: {
146
+ marginBottom: 10,
147
+ fontSize: 18,
148
+ },
149
+ });
@@ -0,0 +1,38 @@
1
+ {
2
+ "extends": ["//"],
3
+ "tasks": {
4
+ "build:android": {
5
+ "dependsOn": ["^build"],
6
+ "env": ["ANDROID_HOME", "ORG_GRADLE_PROJECT_newArchEnabled"],
7
+ "inputs": [
8
+ "package.json",
9
+ "android",
10
+ "!android/build",
11
+ "src/*.ts",
12
+ "src/*.tsx",
13
+ "example/package.json",
14
+ "example/android",
15
+ "!example/android/.gradle",
16
+ "!example/android/build",
17
+ "!example/android/app/build"
18
+ ],
19
+ "outputs": []
20
+ },
21
+ "build:ios": {
22
+ "dependsOn": ["^build"],
23
+ "env": ["RCT_NEW_ARCH_ENABLED"],
24
+ "inputs": [
25
+ "package.json",
26
+ "*.podspec",
27
+ "ios",
28
+ "src/*.ts",
29
+ "src/*.tsx",
30
+ "example/package.json",
31
+ "example/ios",
32
+ "!example/ios/build",
33
+ "!example/ios/Pods"
34
+ ],
35
+ "outputs": []
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,12 @@
1
+
2
+ #ifdef RCT_NEW_ARCH_ENABLED
3
+ #import "RNReactNativeSignerSpec.h"
4
+
5
+ @interface ReactNativeSigner : NSObject <NativeReactNativeSignerSpec>
6
+ #else
7
+ #import <React/RCTBridgeModule.h>
8
+
9
+ @interface ReactNativeSigner : NSObject <RCTBridgeModule>
10
+ #endif
11
+
12
+ @end
@@ -0,0 +1,21 @@
1
+ #import "ReactNativeSigner.h"
2
+
3
+ @implementation ReactNativeSigner
4
+ RCT_EXPORT_MODULE()
5
+
6
+ // Don't compile this code when we build for the old architecture.
7
+ #ifdef RCT_NEW_ARCH_ENABLED
8
+ - (NSNumber *)multiply:(double)a b:(double)b {
9
+ NSNumber *result = @(a * b);
10
+
11
+ return result;
12
+ }
13
+
14
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
15
+ (const facebook::react::ObjCTurboModule::InitParams &)params
16
+ {
17
+ return std::make_shared<facebook::react::NativeReactNativeSignerSpecJSI>(params);
18
+ }
19
+ #endif
20
+
21
+ @end
@@ -0,0 +1,22 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorCpp.js
9
+ */
10
+
11
+ #include "ComponentDescriptors.h"
12
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
13
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ void NativeTEKStamperSpec_registerComponentDescriptorsFromCodegen(
18
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
19
+
20
+ }
21
+
22
+ } // namespace facebook::react
@@ -0,0 +1,24 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include "ShadowNodes.h"
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
16
+
17
+ namespace facebook::react {
18
+
19
+
20
+
21
+ void NativeTEKStamperSpec_registerComponentDescriptorsFromCodegen(
22
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
23
+
24
+ } // namespace facebook::react
@@ -0,0 +1,16 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterCpp.js
9
+ */
10
+
11
+ #include "EventEmitters.h"
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewEventEmitter.h>
13
+
14
+
15
+ namespace facebook::react {
16
+
17
+ } // namespace facebook::react