react-native-credentials-manager 0.2.0 → 0.3.0
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.
- package/README.md +3 -3
- package/android/build.gradle +19 -9
- package/android/src/main/java/com/credentialsmanager/CredentialsManagerModuleImpl.kt +7 -0
- package/android/src/main/java/com/credentialsmanager/CredentialsManagerPackage.kt +6 -5
- package/android/src/main/java/com/credentialsmanager/handlers/CredentialHandler.kt +91 -0
- package/android/src/main/java/com/credentialsmanager/handlers/ErrorHandler.kt +36 -0
- package/android/src/newarch/java/com/credentialsmanager/CredentialsManagerModule.kt +71 -0
- package/android/src/oldarch/java/com/credentialsmanager/CredentialsManagerModule.kt +77 -0
- package/package.json +2 -2
- package/react-native.config.js +1 -0
- package/android/generated/RCTAppDependencyProvider.h +0 -25
- package/android/generated/RCTAppDependencyProvider.mm +0 -55
- package/android/generated/RCTModulesConformingToProtocolsProvider.h +0 -18
- package/android/generated/RCTModulesConformingToProtocolsProvider.mm +0 -33
- package/android/generated/RCTThirdPartyComponentsProvider.h +0 -16
- package/android/generated/RCTThirdPartyComponentsProvider.mm +0 -23
- package/android/generated/ReactAppDependencyProvider.podspec +0 -34
- package/android/src/main/java/com/credentialsmanager/CredentialsManagerModule.kt +0 -212
- package/ios/generated/RCTAppDependencyProvider.h +0 -25
- package/ios/generated/RCTAppDependencyProvider.mm +0 -55
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +0 -18
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +0 -33
- package/ios/generated/RCTThirdPartyComponentsProvider.h +0 -16
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +0 -23
- package/ios/generated/ReactAppDependencyProvider.podspec +0 -34
- package/lib/commonjs/j.js +0 -9
- package/lib/commonjs/j.js.map +0 -1
- package/lib/module/j.js +0 -5
- package/lib/module/j.js.map +0 -1
- package/src/j.js +0 -33
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# react-native-credentials-manager
|
|
2
2
|
|
|
3
|
-
A React Native library that implements the [Credential Manager API](https://developer.android.com/
|
|
3
|
+
A React Native library that implements the [Credential Manager API](https://developer.android.com/identity/sign-in/credential-manager) for Android. This library allows you to manage passwords and passkeys in your React Native applications.
|
|
4
4
|
|
|
5
|
-
> ⚠️ **Note**: This library is actively under development. iOS support using Authentication Services is coming soon. Support for the old React Native architecture is also in progress. Google Sign-In integration with Credential Manager will be added shortly.
|
|
5
|
+
> ⚠️ **Note**: This library is actively under development. iOS support using Authentication Services is coming soon. ~~Support for the old React Native architecture is also in progress.~~ Supports old architecture now. Google Sign-In integration with Credential Manager will be added shortly.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -236,7 +236,7 @@ For more detailed information about the underlying APIs, refer to:
|
|
|
236
236
|
|
|
237
237
|
## Roadmap
|
|
238
238
|
|
|
239
|
-
- Old Architecture Support
|
|
239
|
+
- ~~Old Architecture Support~~ ✅
|
|
240
240
|
- iOS Support using [Authentication Services](https://developer.apple.com/documentation/authenticationservices?language=objc)
|
|
241
241
|
- Additional Authentication Methods
|
|
242
242
|
- Comprehensive Documentation
|
package/android/build.gradle
CHANGED
|
@@ -79,16 +79,26 @@ android {
|
|
|
79
79
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
sourceSets {
|
|
83
|
+
main {
|
|
84
|
+
if (isNewArchitectureEnabled()) {
|
|
85
|
+
java.srcDirs += ['src/newarch',"generated/java",]
|
|
86
|
+
} else {
|
|
87
|
+
java.srcDirs += ['src/oldarch']
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
|
|
92
|
+
// sourceSets {
|
|
93
|
+
// main {
|
|
94
|
+
// if (isNewArchitectureEnabled()) {
|
|
95
|
+
// java.srcDirs += [
|
|
96
|
+
// "generated/java",
|
|
97
|
+
// "generated/jni"
|
|
98
|
+
// ]
|
|
99
|
+
// }
|
|
100
|
+
// }
|
|
101
|
+
// }
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
repositories {
|
|
@@ -12,7 +12,7 @@ class CredentialsManagerPackage : BaseReactPackage() {
|
|
|
12
12
|
name: String,
|
|
13
13
|
reactContext: ReactApplicationContext,
|
|
14
14
|
): NativeModule? =
|
|
15
|
-
if (name ==
|
|
15
|
+
if (name == CredentialsManagerModuleImpl.NAME) {
|
|
16
16
|
CredentialsManagerModule(reactContext)
|
|
17
17
|
} else {
|
|
18
18
|
null
|
|
@@ -21,14 +21,15 @@ class CredentialsManagerPackage : BaseReactPackage() {
|
|
|
21
21
|
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider =
|
|
22
22
|
ReactModuleInfoProvider {
|
|
23
23
|
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
24
|
-
|
|
24
|
+
val isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
25
|
+
moduleInfos[CredentialsManagerModuleImpl.NAME] =
|
|
25
26
|
ReactModuleInfo(
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
CredentialsManagerModuleImpl.NAME,
|
|
28
|
+
CredentialsManagerModuleImpl.NAME,
|
|
28
29
|
false, // canOverrideExistingModule
|
|
29
30
|
false, // needsEagerInit
|
|
30
31
|
false, // isCxxModule
|
|
31
|
-
|
|
32
|
+
isTurboModule, // isTurboModule
|
|
32
33
|
)
|
|
33
34
|
moduleInfos
|
|
34
35
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
package com.credentialsmanager.handlers
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import androidx.credentials.CreatePasswordRequest
|
|
5
|
+
import androidx.credentials.CreatePublicKeyCredentialRequest
|
|
6
|
+
import androidx.credentials.CreatePublicKeyCredentialResponse
|
|
7
|
+
import androidx.credentials.CredentialManager
|
|
8
|
+
import androidx.credentials.GetCredentialRequest
|
|
9
|
+
import androidx.credentials.GetPasswordOption
|
|
10
|
+
import androidx.credentials.GetPublicKeyCredentialOption
|
|
11
|
+
import androidx.credentials.PasswordCredential
|
|
12
|
+
import androidx.credentials.PublicKeyCredential
|
|
13
|
+
import com.facebook.react.bridge.Arguments
|
|
14
|
+
import com.facebook.react.bridge.ReadableMap
|
|
15
|
+
import org.json.JSONObject
|
|
16
|
+
|
|
17
|
+
class CredentialHandler(
|
|
18
|
+
private val context: Context,
|
|
19
|
+
) {
|
|
20
|
+
private val credentialManager = CredentialManager.create(context)
|
|
21
|
+
|
|
22
|
+
suspend fun createPasskey(
|
|
23
|
+
jsonString: String,
|
|
24
|
+
preferImmediatelyAvailableCredentials: Boolean,
|
|
25
|
+
): ReadableMap? {
|
|
26
|
+
val request =
|
|
27
|
+
CreatePublicKeyCredentialRequest(
|
|
28
|
+
requestJson = jsonString,
|
|
29
|
+
preferImmediatelyAvailableCredentials = preferImmediatelyAvailableCredentials,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
val response =
|
|
33
|
+
credentialManager.createCredential(
|
|
34
|
+
context,
|
|
35
|
+
request,
|
|
36
|
+
) as CreatePublicKeyCredentialResponse
|
|
37
|
+
|
|
38
|
+
return response.data.getString("androidx.credentials.BUNDLE_KEY_REGISTRATION_RESPONSE_JSON")?.let { json ->
|
|
39
|
+
val jsonObject = Arguments.createMap()
|
|
40
|
+
val parsedObject = JSONObject(json)
|
|
41
|
+
|
|
42
|
+
parsedObject.keys().forEach { key ->
|
|
43
|
+
jsonObject.putString(key, parsedObject.getString(key))
|
|
44
|
+
}
|
|
45
|
+
jsonObject
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
suspend fun createPassword(
|
|
50
|
+
username: String,
|
|
51
|
+
password: String,
|
|
52
|
+
) {
|
|
53
|
+
val createPasswordRequest = CreatePasswordRequest(id = username, password = password)
|
|
54
|
+
credentialManager.createCredential(context, createPasswordRequest)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
suspend fun getSavedCredentials(jsonString: String): ReadableMap? {
|
|
58
|
+
val getPublicKeyCredentialOption = GetPublicKeyCredentialOption(jsonString, null)
|
|
59
|
+
val getPasswordOption = GetPasswordOption()
|
|
60
|
+
|
|
61
|
+
val result =
|
|
62
|
+
credentialManager.getCredential(
|
|
63
|
+
context,
|
|
64
|
+
GetCredentialRequest(
|
|
65
|
+
listOf(
|
|
66
|
+
getPublicKeyCredentialOption,
|
|
67
|
+
getPasswordOption,
|
|
68
|
+
),
|
|
69
|
+
),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
return when (result.credential) {
|
|
73
|
+
is PublicKeyCredential -> {
|
|
74
|
+
val cred = result.credential as PublicKeyCredential
|
|
75
|
+
Arguments.createMap().apply {
|
|
76
|
+
putString("type", "passkey")
|
|
77
|
+
putString("authenticationResponseJson", cred.authenticationResponseJson)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
is PasswordCredential -> {
|
|
81
|
+
val cred = result.credential as PasswordCredential
|
|
82
|
+
Arguments.createMap().apply {
|
|
83
|
+
putString("type", "password")
|
|
84
|
+
putString("username", cred.id)
|
|
85
|
+
putString("password", cred.password)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else -> null
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
package com.credentialsmanager.handlers
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import androidx.credentials.exceptions.CreateCredentialCancellationException
|
|
5
|
+
import androidx.credentials.exceptions.CreateCredentialCustomException
|
|
6
|
+
import androidx.credentials.exceptions.CreateCredentialException
|
|
7
|
+
import androidx.credentials.exceptions.CreateCredentialInterruptedException
|
|
8
|
+
import androidx.credentials.exceptions.CreateCredentialProviderConfigurationException
|
|
9
|
+
import androidx.credentials.exceptions.CreateCredentialUnknownException
|
|
10
|
+
import androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialDomException
|
|
11
|
+
|
|
12
|
+
object ErrorHandler {
|
|
13
|
+
fun handleCredentialError(e: CreateCredentialException) {
|
|
14
|
+
when (e) {
|
|
15
|
+
is CreatePublicKeyCredentialDomException -> {
|
|
16
|
+
Log.d("CredentialManager", "passkey DOM errors")
|
|
17
|
+
}
|
|
18
|
+
is CreateCredentialCancellationException -> {
|
|
19
|
+
Log.d("CredentialManager", "User cancelled")
|
|
20
|
+
}
|
|
21
|
+
is CreateCredentialInterruptedException -> {
|
|
22
|
+
Log.d("CredentialManager", "Retry process")
|
|
23
|
+
}
|
|
24
|
+
is CreateCredentialProviderConfigurationException -> {
|
|
25
|
+
Log.d("CredentialManager", "Missing provider configuration")
|
|
26
|
+
}
|
|
27
|
+
is CreateCredentialUnknownException -> {
|
|
28
|
+
Log.d("CredentialManager", "Unknown error")
|
|
29
|
+
}
|
|
30
|
+
is CreateCredentialCustomException -> {
|
|
31
|
+
Log.d("CredentialManager", "Custom credential error")
|
|
32
|
+
}
|
|
33
|
+
else -> Log.w("CredentialManager", "Unexpected exception type ${e::class.java.name}")
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
package com.credentialsmanager
|
|
2
|
+
import androidx.credentials.CredentialManager
|
|
3
|
+
import androidx.credentials.exceptions.CreateCredentialException
|
|
4
|
+
import com.credentialsmanager.handlers.CredentialHandler
|
|
5
|
+
import com.credentialsmanager.handlers.ErrorHandler
|
|
6
|
+
import com.facebook.react.bridge.Promise
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
+
import com.facebook.react.bridge.ReadableMap
|
|
9
|
+
import kotlinx.coroutines.CoroutineScope
|
|
10
|
+
import kotlinx.coroutines.Dispatchers
|
|
11
|
+
import kotlinx.coroutines.launch
|
|
12
|
+
|
|
13
|
+
class CredentialsManagerModule(
|
|
14
|
+
reactContext: ReactApplicationContext,
|
|
15
|
+
) : NativeCredentialsManagerSpec(reactContext) {
|
|
16
|
+
private val coroutineScope = CoroutineScope(Dispatchers.IO)
|
|
17
|
+
val credentialManager = CredentialManager.create(getReactApplicationContext())
|
|
18
|
+
private val credentialHandler = CredentialHandler(reactContext)
|
|
19
|
+
|
|
20
|
+
private var implementation: CredentialsManagerModuleImpl = CredentialsManagerModuleImpl()
|
|
21
|
+
|
|
22
|
+
override fun getName(): String = CredentialsManagerModuleImpl.NAME
|
|
23
|
+
|
|
24
|
+
override fun signUpWithPasskeys(
|
|
25
|
+
requestJson: ReadableMap,
|
|
26
|
+
preferImmediatelyAvailableCredentials: Boolean,
|
|
27
|
+
promise: Promise,
|
|
28
|
+
) {
|
|
29
|
+
val jsonString = requestJson.toString()
|
|
30
|
+
|
|
31
|
+
coroutineScope.launch {
|
|
32
|
+
try {
|
|
33
|
+
val response =
|
|
34
|
+
credentialHandler.createPasskey(
|
|
35
|
+
jsonString,
|
|
36
|
+
preferImmediatelyAvailableCredentials,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
response?.let {
|
|
40
|
+
promise.resolve(it)
|
|
41
|
+
} ?: promise.reject("ERROR", "No response received")
|
|
42
|
+
} catch (e: CreateCredentialException) {
|
|
43
|
+
ErrorHandler.handleCredentialError(e)
|
|
44
|
+
promise.reject("ERROR", e.message.toString())
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
override fun signUpWithPassword(credObject: ReadableMap) {
|
|
50
|
+
val username = credObject.getString("username") ?: ""
|
|
51
|
+
val password = credObject.getString("password") ?: ""
|
|
52
|
+
coroutineScope.launch {
|
|
53
|
+
try {
|
|
54
|
+
credentialHandler.createPassword(username, password)
|
|
55
|
+
} catch (e: CreateCredentialException) {
|
|
56
|
+
ErrorHandler.handleCredentialError(e)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override fun signInWithSavedCredentials(
|
|
62
|
+
requestJson: ReadableMap,
|
|
63
|
+
promise: Promise,
|
|
64
|
+
) {
|
|
65
|
+
val jsonString = requestJson.toString()
|
|
66
|
+
coroutineScope.launch {
|
|
67
|
+
val data = credentialHandler.getSavedCredentials(jsonString)
|
|
68
|
+
promise.resolve(data)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
package com.credentialsmanager
|
|
2
|
+
import androidx.credentials.CredentialManager
|
|
3
|
+
import androidx.credentials.exceptions.CreateCredentialException
|
|
4
|
+
import com.credentialsmanager.handlers.CredentialHandler
|
|
5
|
+
import com.credentialsmanager.handlers.ErrorHandler
|
|
6
|
+
import com.facebook.react.bridge.Promise
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
9
|
+
import com.facebook.react.bridge.ReadableMap
|
|
10
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
11
|
+
import kotlinx.coroutines.CoroutineScope
|
|
12
|
+
import kotlinx.coroutines.Dispatchers
|
|
13
|
+
import kotlinx.coroutines.launch
|
|
14
|
+
|
|
15
|
+
@ReactModule(name = CredentialsManagerModuleImpl.NAME)
|
|
16
|
+
class CredentialsManagerModule(
|
|
17
|
+
reactContext: ReactApplicationContext,
|
|
18
|
+
) : ReactContextBaseJavaModule(reactContext) {
|
|
19
|
+
private val coroutineScope = CoroutineScope(Dispatchers.IO)
|
|
20
|
+
val credentialManager = CredentialManager.create(getReactApplicationContext())
|
|
21
|
+
private val credentialHandler = CredentialHandler(reactContext)
|
|
22
|
+
|
|
23
|
+
private var implementation: CredentialsManagerModuleImpl = CredentialsManagerModuleImpl()
|
|
24
|
+
|
|
25
|
+
override fun getName(): String = CredentialsManagerModuleImpl.NAME
|
|
26
|
+
|
|
27
|
+
@ReactMethod
|
|
28
|
+
fun signUpWithPasskeys(
|
|
29
|
+
requestJson: ReadableMap,
|
|
30
|
+
preferImmediatelyAvailableCredentials: Boolean,
|
|
31
|
+
promise: Promise,
|
|
32
|
+
) {
|
|
33
|
+
val jsonString = requestJson.toString()
|
|
34
|
+
|
|
35
|
+
coroutineScope.launch {
|
|
36
|
+
try {
|
|
37
|
+
val response =
|
|
38
|
+
credentialHandler.createPasskey(
|
|
39
|
+
jsonString,
|
|
40
|
+
preferImmediatelyAvailableCredentials,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
response?.let {
|
|
44
|
+
promise.resolve(it)
|
|
45
|
+
} ?: promise.reject("ERROR", "No response received")
|
|
46
|
+
} catch (e: CreateCredentialException) {
|
|
47
|
+
ErrorHandler.handleCredentialError(e)
|
|
48
|
+
promise.reject("ERROR", e.message.toString())
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@ReactMethod
|
|
54
|
+
fun signUpWithPassword(credObject: ReadableMap) {
|
|
55
|
+
val username = credObject.getString("username") ?: ""
|
|
56
|
+
val password = credObject.getString("password") ?: ""
|
|
57
|
+
coroutineScope.launch {
|
|
58
|
+
try {
|
|
59
|
+
credentialHandler.createPassword(username, password)
|
|
60
|
+
} catch (e: CreateCredentialException) {
|
|
61
|
+
ErrorHandler.handleCredentialError(e)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@ReactMethod
|
|
67
|
+
fun signInWithSavedCredentials(
|
|
68
|
+
requestJson: ReadableMap,
|
|
69
|
+
promise: Promise,
|
|
70
|
+
) {
|
|
71
|
+
val jsonString = requestJson.toString()
|
|
72
|
+
coroutineScope.launch {
|
|
73
|
+
val data = credentialHandler.getSavedCredentials(jsonString)
|
|
74
|
+
promise.resolve(data)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-credentials-manager",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A React Native library that implements the Credential Manager API for Android. This library allows you to manage passwords and passkeys in your React Native applications.",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"prettier": "^3.0.3",
|
|
82
82
|
"react": "18.3.1",
|
|
83
83
|
"react-native": "0.77.0",
|
|
84
|
-
"react-native-builder-bob": "^0.
|
|
84
|
+
"react-native-builder-bob": "^0.36.0",
|
|
85
85
|
"release-it": "^17.10.0",
|
|
86
86
|
"turbo": "^1.10.7",
|
|
87
87
|
"typescript": "^5.2.2"
|
package/react-native.config.js
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
#import <Foundation/Foundation.h>
|
|
10
|
-
|
|
11
|
-
#if __has_include(<React-RCTAppDelegate/RCTDependencyProvider.h>)
|
|
12
|
-
#import <React-RCTAppDelegate/RCTDependencyProvider.h>
|
|
13
|
-
#elif __has_include(<React_RCTAppDelegate/RCTDependencyProvider.h>)
|
|
14
|
-
#import <React_RCTAppDelegate/RCTDependencyProvider.h>
|
|
15
|
-
#else
|
|
16
|
-
#import "RCTDependencyProvider.h"
|
|
17
|
-
#endif
|
|
18
|
-
|
|
19
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
20
|
-
|
|
21
|
-
@interface RCTAppDependencyProvider : NSObject <RCTDependencyProvider>
|
|
22
|
-
|
|
23
|
-
@end
|
|
24
|
-
|
|
25
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#import "RCTAppDependencyProvider.h"
|
|
9
|
-
#import <ReactCodegen/RCTModulesConformingToProtocolsProvider.h>
|
|
10
|
-
#import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
|
|
11
|
-
|
|
12
|
-
@implementation RCTAppDependencyProvider {
|
|
13
|
-
NSArray<NSString *> * _URLRequestHandlerClassNames;
|
|
14
|
-
NSArray<NSString *> * _imageDataDecoderClassNames;
|
|
15
|
-
NSArray<NSString *> * _imageURLLoaderClassNames;
|
|
16
|
-
NSDictionary<NSString *,Class<RCTComponentViewProtocol>> * _thirdPartyFabricComponents;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
- (nonnull NSArray<NSString *> *)URLRequestHandlerClassNames {
|
|
20
|
-
static dispatch_once_t requestUrlToken;
|
|
21
|
-
dispatch_once(&requestUrlToken, ^{
|
|
22
|
-
self->_URLRequestHandlerClassNames = RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
return _URLRequestHandlerClassNames;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
- (nonnull NSArray<NSString *> *)imageDataDecoderClassNames {
|
|
29
|
-
static dispatch_once_t dataDecoderToken;
|
|
30
|
-
dispatch_once(&dataDecoderToken, ^{
|
|
31
|
-
_imageDataDecoderClassNames = RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return _imageDataDecoderClassNames;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
- (nonnull NSArray<NSString *> *)imageURLLoaderClassNames {
|
|
38
|
-
static dispatch_once_t urlLoaderToken;
|
|
39
|
-
dispatch_once(&urlLoaderToken, ^{
|
|
40
|
-
_imageURLLoaderClassNames = RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return _imageURLLoaderClassNames;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
- (nonnull NSDictionary<NSString *,Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents {
|
|
47
|
-
static dispatch_once_t nativeComponentsToken;
|
|
48
|
-
dispatch_once(&nativeComponentsToken, ^{
|
|
49
|
-
_thirdPartyFabricComponents = RCTThirdPartyComponentsProvider.thirdPartyFabricComponents;
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
return _thirdPartyFabricComponents;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
@end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#import <Foundation/Foundation.h>
|
|
9
|
-
|
|
10
|
-
@interface RCTModulesConformingToProtocolsProvider: NSObject
|
|
11
|
-
|
|
12
|
-
+(NSArray<NSString *> *)imageURLLoaderClassNames;
|
|
13
|
-
|
|
14
|
-
+(NSArray<NSString *> *)imageDataDecoderClassNames;
|
|
15
|
-
|
|
16
|
-
+(NSArray<NSString *> *)URLRequestHandlerClassNames;
|
|
17
|
-
|
|
18
|
-
@end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#import "RCTModulesConformingToProtocolsProvider.h"
|
|
9
|
-
|
|
10
|
-
@implementation RCTModulesConformingToProtocolsProvider
|
|
11
|
-
|
|
12
|
-
+(NSArray<NSString *> *)imageURLLoaderClassNames
|
|
13
|
-
{
|
|
14
|
-
return @[
|
|
15
|
-
|
|
16
|
-
];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
+(NSArray<NSString *> *)imageDataDecoderClassNames
|
|
20
|
-
{
|
|
21
|
-
return @[
|
|
22
|
-
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
+(NSArray<NSString *> *)URLRequestHandlerClassNames
|
|
27
|
-
{
|
|
28
|
-
return @[
|
|
29
|
-
|
|
30
|
-
];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#import <Foundation/Foundation.h>
|
|
9
|
-
|
|
10
|
-
@protocol RCTComponentViewProtocol;
|
|
11
|
-
|
|
12
|
-
@interface RCTThirdPartyComponentsProvider: NSObject
|
|
13
|
-
|
|
14
|
-
+ (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents;
|
|
15
|
-
|
|
16
|
-
@end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
#import <Foundation/Foundation.h>
|
|
10
|
-
|
|
11
|
-
#import "RCTThirdPartyComponentsProvider.h"
|
|
12
|
-
#import <React/RCTComponentViewProtocol.h>
|
|
13
|
-
|
|
14
|
-
@implementation RCTThirdPartyComponentsProvider
|
|
15
|
-
|
|
16
|
-
+ (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
|
|
17
|
-
{
|
|
18
|
-
return @{
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
#
|
|
3
|
-
# This source code is licensed under the MIT license found in the
|
|
4
|
-
# LICENSE file in the root directory of this source tree.
|
|
5
|
-
|
|
6
|
-
version = "0.77.0"
|
|
7
|
-
source = { :git => 'https://github.com/facebook/react-native.git' }
|
|
8
|
-
if version == '1000.0.0'
|
|
9
|
-
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
|
10
|
-
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
|
|
11
|
-
else
|
|
12
|
-
source[:tag] = "v#{version}"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
Pod::Spec.new do |s|
|
|
16
|
-
s.name = "ReactAppDependencyProvider"
|
|
17
|
-
s.version = version
|
|
18
|
-
s.summary = "The third party dependency provider for the app"
|
|
19
|
-
s.homepage = "https://reactnative.dev/"
|
|
20
|
-
s.documentation_url = "https://reactnative.dev/"
|
|
21
|
-
s.license = "MIT"
|
|
22
|
-
s.author = "Meta Platforms, Inc. and its affiliates"
|
|
23
|
-
s.platforms = min_supported_versions
|
|
24
|
-
s.source = source
|
|
25
|
-
s.source_files = "**/RCTAppDependencyProvider.{h,mm}"
|
|
26
|
-
|
|
27
|
-
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
-
s.pod_target_xcconfig = {
|
|
29
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
|
30
|
-
"DEFINES_MODULE" => "YES"
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
s.dependency "ReactCodegen"
|
|
34
|
-
end
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
package com.credentialsmanager
|
|
2
|
-
|
|
3
|
-
import android.util.Log
|
|
4
|
-
import androidx.credentials.CreatePasswordRequest
|
|
5
|
-
import androidx.credentials.CreatePublicKeyCredentialRequest
|
|
6
|
-
import androidx.credentials.CreatePublicKeyCredentialResponse
|
|
7
|
-
import androidx.credentials.CredentialManager
|
|
8
|
-
import androidx.credentials.CustomCredential
|
|
9
|
-
import androidx.credentials.GetCredentialRequest
|
|
10
|
-
import androidx.credentials.GetPasswordOption
|
|
11
|
-
import androidx.credentials.GetPublicKeyCredentialOption
|
|
12
|
-
import androidx.credentials.PasswordCredential
|
|
13
|
-
import androidx.credentials.PublicKeyCredential
|
|
14
|
-
import androidx.credentials.exceptions.CreateCredentialCancellationException
|
|
15
|
-
import androidx.credentials.exceptions.CreateCredentialCustomException
|
|
16
|
-
import androidx.credentials.exceptions.CreateCredentialException
|
|
17
|
-
import androidx.credentials.exceptions.CreateCredentialInterruptedException
|
|
18
|
-
import androidx.credentials.exceptions.CreateCredentialProviderConfigurationException
|
|
19
|
-
import androidx.credentials.exceptions.CreateCredentialUnknownException
|
|
20
|
-
import androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialDomException
|
|
21
|
-
import com.facebook.react.bridge.Arguments
|
|
22
|
-
import com.facebook.react.bridge.Promise
|
|
23
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
24
|
-
import com.facebook.react.bridge.ReadableMap
|
|
25
|
-
import com.facebook.react.module.annotations.ReactModule
|
|
26
|
-
import kotlinx.coroutines.CoroutineScope
|
|
27
|
-
import kotlinx.coroutines.Dispatchers
|
|
28
|
-
import kotlinx.coroutines.launch
|
|
29
|
-
import org.json.JSONObject
|
|
30
|
-
|
|
31
|
-
@ReactModule(name = CredentialsManagerModule.NAME)
|
|
32
|
-
class CredentialsManagerModule(
|
|
33
|
-
reactContext: ReactApplicationContext,
|
|
34
|
-
) : NativeCredentialsManagerSpec(reactContext) {
|
|
35
|
-
private val coroutineScope = CoroutineScope(Dispatchers.IO)
|
|
36
|
-
val credentialManager = CredentialManager.create(getReactApplicationContext())
|
|
37
|
-
|
|
38
|
-
override fun getName(): String = NAME
|
|
39
|
-
|
|
40
|
-
override fun signUpWithPasskeys(
|
|
41
|
-
requestJson: ReadableMap,
|
|
42
|
-
preferImmediatelyAvailableCredentials: Boolean,
|
|
43
|
-
promise: Promise,
|
|
44
|
-
) {
|
|
45
|
-
val jsonString = requestJson.toString()
|
|
46
|
-
|
|
47
|
-
val request =
|
|
48
|
-
CreatePublicKeyCredentialRequest(
|
|
49
|
-
requestJson = jsonString,
|
|
50
|
-
preferImmediatelyAvailableCredentials = preferImmediatelyAvailableCredentials,
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
coroutineScope.launch {
|
|
54
|
-
try {
|
|
55
|
-
val response =
|
|
56
|
-
credentialManager.createCredential(
|
|
57
|
-
getReactApplicationContext(),
|
|
58
|
-
request,
|
|
59
|
-
) as CreatePublicKeyCredentialResponse
|
|
60
|
-
|
|
61
|
-
response?.let {
|
|
62
|
-
val dataBundle = it.data
|
|
63
|
-
val responseJson = dataBundle.getString("androidx.credentials.BUNDLE_KEY_REGISTRATION_RESPONSE_JSON")
|
|
64
|
-
responseJson?.let { json ->
|
|
65
|
-
|
|
66
|
-
val jsonObject = Arguments.createMap()
|
|
67
|
-
val parsedObject = JSONObject(json)
|
|
68
|
-
|
|
69
|
-
parsedObject.keys().forEach { key ->
|
|
70
|
-
jsonObject.putString(key, parsedObject.getString(key))
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
Log.d("CredentialManager", "Passkey creation result: $jsonObject")
|
|
74
|
-
promise.resolve(jsonObject)
|
|
75
|
-
} ?: run {
|
|
76
|
-
promise.reject("ERROR", "Response JSON is null")
|
|
77
|
-
}
|
|
78
|
-
} ?: run {
|
|
79
|
-
promise.reject("ERROR", "No response received")
|
|
80
|
-
}
|
|
81
|
-
} catch (e: CreateCredentialException) {
|
|
82
|
-
handleFailure(e)
|
|
83
|
-
promise.reject("ERROR", e.message.toString())
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
override fun signUpWithPassword(credObject: ReadableMap) {
|
|
89
|
-
val username = credObject.getString("username") ?: ""
|
|
90
|
-
val password = credObject.getString("password") ?: ""
|
|
91
|
-
coroutineScope.launch {
|
|
92
|
-
createPassword(username, password)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
override fun signInWithSavedCredentials(
|
|
97
|
-
requestJson: ReadableMap,
|
|
98
|
-
promise: Promise,
|
|
99
|
-
) {
|
|
100
|
-
val jsonString = requestJson.toString()
|
|
101
|
-
coroutineScope.launch {
|
|
102
|
-
val data = getSavedCredentials(jsonString)
|
|
103
|
-
promise.resolve(data)
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
private suspend fun getSavedCredentials(jsonString: String): ReadableMap? {
|
|
108
|
-
val getPublicKeyCredentialOption =
|
|
109
|
-
GetPublicKeyCredentialOption(jsonString, null)
|
|
110
|
-
|
|
111
|
-
val getPasswordOption = GetPasswordOption()
|
|
112
|
-
|
|
113
|
-
val result =
|
|
114
|
-
try {
|
|
115
|
-
credentialManager.getCredential(
|
|
116
|
-
getReactApplicationContext(),
|
|
117
|
-
GetCredentialRequest(
|
|
118
|
-
listOf(
|
|
119
|
-
getPublicKeyCredentialOption,
|
|
120
|
-
getPasswordOption,
|
|
121
|
-
),
|
|
122
|
-
),
|
|
123
|
-
)
|
|
124
|
-
} catch (e: Exception) {
|
|
125
|
-
Log.e("CredentialManager", "getCredential failed with exception: " + e.message.toString())
|
|
126
|
-
|
|
127
|
-
return null
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
val resultMap = Arguments.createMap()
|
|
131
|
-
when (result.credential) {
|
|
132
|
-
is PublicKeyCredential -> {
|
|
133
|
-
val cred = result.credential as PublicKeyCredential
|
|
134
|
-
resultMap.putString("type", "passkey")
|
|
135
|
-
resultMap.putString("authenticationResponseJson", cred.authenticationResponseJson)
|
|
136
|
-
Log.d("CredentialManager", "Passkey: ${cred.authenticationResponseJson}")
|
|
137
|
-
}
|
|
138
|
-
is PasswordCredential -> {
|
|
139
|
-
val cred = result.credential as PasswordCredential
|
|
140
|
-
resultMap.putString("type", "password")
|
|
141
|
-
resultMap.putString("username", cred.id)
|
|
142
|
-
resultMap.putString("password", cred.password)
|
|
143
|
-
Log.d("CredentialManager", "Got Password - User:${cred.id} Password: ${cred.password}")
|
|
144
|
-
}
|
|
145
|
-
is CustomCredential -> {
|
|
146
|
-
return null
|
|
147
|
-
}
|
|
148
|
-
else -> return null
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return resultMap
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
private suspend fun createPassword(
|
|
155
|
-
username: String,
|
|
156
|
-
password: String,
|
|
157
|
-
) {
|
|
158
|
-
val createPasswordRequest =
|
|
159
|
-
CreatePasswordRequest(id = username, password = password)
|
|
160
|
-
|
|
161
|
-
try {
|
|
162
|
-
val result =
|
|
163
|
-
credentialManager.createCredential(
|
|
164
|
-
getReactApplicationContext(),
|
|
165
|
-
createPasswordRequest,
|
|
166
|
-
)
|
|
167
|
-
} catch (e: CreateCredentialException) {
|
|
168
|
-
handleFailure(e)
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
private fun handleFailure(e: CreateCredentialException) {
|
|
173
|
-
when (e) {
|
|
174
|
-
is CreatePublicKeyCredentialDomException -> {
|
|
175
|
-
// Handle the passkey DOM errors thrown according to the
|
|
176
|
-
// WebAuthn spec.
|
|
177
|
-
Log.d("CredentialManager", "passkey DOM errors")
|
|
178
|
-
// handlePasskeyError(e.domError)
|
|
179
|
-
}
|
|
180
|
-
is CreateCredentialCancellationException -> {
|
|
181
|
-
// The user intentionally canceled the operation and chose not
|
|
182
|
-
// to register the credential.
|
|
183
|
-
Log.d("CredentialManager", "User cancelled")
|
|
184
|
-
}
|
|
185
|
-
is CreateCredentialInterruptedException -> {
|
|
186
|
-
// Retry-able error. Consider retrying the call.
|
|
187
|
-
Log.d("CredentialManager", "Retry process")
|
|
188
|
-
}
|
|
189
|
-
is CreateCredentialProviderConfigurationException -> {
|
|
190
|
-
// Your app is missing the provider configuration dependency.
|
|
191
|
-
// Most likely, you're missing the
|
|
192
|
-
// "credentials-play-services-auth" module.
|
|
193
|
-
}
|
|
194
|
-
is CreateCredentialUnknownException -> {
|
|
195
|
-
Log.d("CredentialManager", "Unknown error")
|
|
196
|
-
}
|
|
197
|
-
is CreateCredentialCustomException -> {
|
|
198
|
-
// You have encountered an error from a 3rd-party SDK. If you
|
|
199
|
-
// make the API call with a request object that's a subclass of
|
|
200
|
-
// CreateCustomCredentialRequest using a 3rd-party SDK, then you
|
|
201
|
-
// should check for any custom exception type constants within
|
|
202
|
-
// that SDK to match with e.type. Otherwise, drop or log the
|
|
203
|
-
// exception.
|
|
204
|
-
}
|
|
205
|
-
else -> Log.w("CredentialManager", "Unexpected exception type ${e::class.java.name}")
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
companion object {
|
|
210
|
-
const val NAME = "CredentialsManager"
|
|
211
|
-
}
|
|
212
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
#import <Foundation/Foundation.h>
|
|
10
|
-
|
|
11
|
-
#if __has_include(<React-RCTAppDelegate/RCTDependencyProvider.h>)
|
|
12
|
-
#import <React-RCTAppDelegate/RCTDependencyProvider.h>
|
|
13
|
-
#elif __has_include(<React_RCTAppDelegate/RCTDependencyProvider.h>)
|
|
14
|
-
#import <React_RCTAppDelegate/RCTDependencyProvider.h>
|
|
15
|
-
#else
|
|
16
|
-
#import "RCTDependencyProvider.h"
|
|
17
|
-
#endif
|
|
18
|
-
|
|
19
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
20
|
-
|
|
21
|
-
@interface RCTAppDependencyProvider : NSObject <RCTDependencyProvider>
|
|
22
|
-
|
|
23
|
-
@end
|
|
24
|
-
|
|
25
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#import "RCTAppDependencyProvider.h"
|
|
9
|
-
#import <ReactCodegen/RCTModulesConformingToProtocolsProvider.h>
|
|
10
|
-
#import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
|
|
11
|
-
|
|
12
|
-
@implementation RCTAppDependencyProvider {
|
|
13
|
-
NSArray<NSString *> * _URLRequestHandlerClassNames;
|
|
14
|
-
NSArray<NSString *> * _imageDataDecoderClassNames;
|
|
15
|
-
NSArray<NSString *> * _imageURLLoaderClassNames;
|
|
16
|
-
NSDictionary<NSString *,Class<RCTComponentViewProtocol>> * _thirdPartyFabricComponents;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
- (nonnull NSArray<NSString *> *)URLRequestHandlerClassNames {
|
|
20
|
-
static dispatch_once_t requestUrlToken;
|
|
21
|
-
dispatch_once(&requestUrlToken, ^{
|
|
22
|
-
self->_URLRequestHandlerClassNames = RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
return _URLRequestHandlerClassNames;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
- (nonnull NSArray<NSString *> *)imageDataDecoderClassNames {
|
|
29
|
-
static dispatch_once_t dataDecoderToken;
|
|
30
|
-
dispatch_once(&dataDecoderToken, ^{
|
|
31
|
-
_imageDataDecoderClassNames = RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return _imageDataDecoderClassNames;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
- (nonnull NSArray<NSString *> *)imageURLLoaderClassNames {
|
|
38
|
-
static dispatch_once_t urlLoaderToken;
|
|
39
|
-
dispatch_once(&urlLoaderToken, ^{
|
|
40
|
-
_imageURLLoaderClassNames = RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return _imageURLLoaderClassNames;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
- (nonnull NSDictionary<NSString *,Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents {
|
|
47
|
-
static dispatch_once_t nativeComponentsToken;
|
|
48
|
-
dispatch_once(&nativeComponentsToken, ^{
|
|
49
|
-
_thirdPartyFabricComponents = RCTThirdPartyComponentsProvider.thirdPartyFabricComponents;
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
return _thirdPartyFabricComponents;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
@end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#import <Foundation/Foundation.h>
|
|
9
|
-
|
|
10
|
-
@interface RCTModulesConformingToProtocolsProvider: NSObject
|
|
11
|
-
|
|
12
|
-
+(NSArray<NSString *> *)imageURLLoaderClassNames;
|
|
13
|
-
|
|
14
|
-
+(NSArray<NSString *> *)imageDataDecoderClassNames;
|
|
15
|
-
|
|
16
|
-
+(NSArray<NSString *> *)URLRequestHandlerClassNames;
|
|
17
|
-
|
|
18
|
-
@end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#import "RCTModulesConformingToProtocolsProvider.h"
|
|
9
|
-
|
|
10
|
-
@implementation RCTModulesConformingToProtocolsProvider
|
|
11
|
-
|
|
12
|
-
+(NSArray<NSString *> *)imageURLLoaderClassNames
|
|
13
|
-
{
|
|
14
|
-
return @[
|
|
15
|
-
|
|
16
|
-
];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
+(NSArray<NSString *> *)imageDataDecoderClassNames
|
|
20
|
-
{
|
|
21
|
-
return @[
|
|
22
|
-
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
+(NSArray<NSString *> *)URLRequestHandlerClassNames
|
|
27
|
-
{
|
|
28
|
-
return @[
|
|
29
|
-
|
|
30
|
-
];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#import <Foundation/Foundation.h>
|
|
9
|
-
|
|
10
|
-
@protocol RCTComponentViewProtocol;
|
|
11
|
-
|
|
12
|
-
@interface RCTThirdPartyComponentsProvider: NSObject
|
|
13
|
-
|
|
14
|
-
+ (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents;
|
|
15
|
-
|
|
16
|
-
@end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
#import <Foundation/Foundation.h>
|
|
10
|
-
|
|
11
|
-
#import "RCTThirdPartyComponentsProvider.h"
|
|
12
|
-
#import <React/RCTComponentViewProtocol.h>
|
|
13
|
-
|
|
14
|
-
@implementation RCTThirdPartyComponentsProvider
|
|
15
|
-
|
|
16
|
-
+ (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
|
|
17
|
-
{
|
|
18
|
-
return @{
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
#
|
|
3
|
-
# This source code is licensed under the MIT license found in the
|
|
4
|
-
# LICENSE file in the root directory of this source tree.
|
|
5
|
-
|
|
6
|
-
version = "0.77.0"
|
|
7
|
-
source = { :git => 'https://github.com/facebook/react-native.git' }
|
|
8
|
-
if version == '1000.0.0'
|
|
9
|
-
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
|
10
|
-
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
|
|
11
|
-
else
|
|
12
|
-
source[:tag] = "v#{version}"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
Pod::Spec.new do |s|
|
|
16
|
-
s.name = "ReactAppDependencyProvider"
|
|
17
|
-
s.version = version
|
|
18
|
-
s.summary = "The third party dependency provider for the app"
|
|
19
|
-
s.homepage = "https://reactnative.dev/"
|
|
20
|
-
s.documentation_url = "https://reactnative.dev/"
|
|
21
|
-
s.license = "MIT"
|
|
22
|
-
s.author = "Meta Platforms, Inc. and its affiliates"
|
|
23
|
-
s.platforms = min_supported_versions
|
|
24
|
-
s.source = source
|
|
25
|
-
s.source_files = "**/RCTAppDependencyProvider.{h,mm}"
|
|
26
|
-
|
|
27
|
-
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
-
s.pod_target_xcconfig = {
|
|
29
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
|
30
|
-
"DEFINES_MODULE" => "YES"
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
s.dependency "ReactCodegen"
|
|
34
|
-
end
|
package/lib/commonjs/j.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('CredentialsManager');
|
|
9
|
-
//# sourceMappingURL=j.js.map
|
package/lib/commonjs/j.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["j.js"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GA8BpCC,gCAAmB,CAACC,YAAY,CAAO,oBAAoB,CAAC","ignoreList":[]}
|
package/lib/module/j.js
DELETED
package/lib/module/j.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["j.js"],"mappings":";;AAEA,SAASA,mBAAmB,QAAQ,cAAc;AA8BlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,oBAAoB,CAAC","ignoreList":[]}
|
package/src/j.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import type { TurboModule } from 'react-native';
|
|
3
|
-
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
-
|
|
5
|
-
type CredObject = {
|
|
6
|
-
username: string,
|
|
7
|
-
password: string,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
type PasskeyCredential = {
|
|
11
|
-
type: 'passkey',
|
|
12
|
-
authenticationResponseJson: string,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type PasswordCredential = {
|
|
16
|
-
type: 'password',
|
|
17
|
-
username: string,
|
|
18
|
-
password: string,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type Credential = PasskeyCredential | PasswordCredential;
|
|
22
|
-
|
|
23
|
-
export interface Spec extends TurboModule {
|
|
24
|
-
signUpWithPasskeys(
|
|
25
|
-
requestJson: Object,
|
|
26
|
-
preferImmediatelyAvailableCredentials: boolean
|
|
27
|
-
): Promise<Object>;
|
|
28
|
-
signUpWithPassword(credObject: CredObject): void;
|
|
29
|
-
|
|
30
|
-
signInWithSavedCredentials(requestJson: Object): Promise<Credential>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default TurboModuleRegistry.getEnforcing<Spec>('CredentialsManager');
|