react-native-credentials-manager 0.2.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/LICENSE +20 -0
- package/README.md +258 -0
- package/android/build.gradle +116 -0
- package/android/generated/RCTAppDependencyProvider.h +25 -0
- package/android/generated/RCTAppDependencyProvider.mm +55 -0
- package/android/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/android/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/android/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/android/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/android/generated/ReactAppDependencyProvider.podspec +34 -0
- package/android/generated/java/com/credentialsmanager/NativeCredentialsManagerSpec.java +47 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNCredentialsManagerSpec-generated.cpp +44 -0
- package/android/generated/jni/RNCredentialsManagerSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNCredentialsManagerSpec/RNCredentialsManagerSpecJSI-generated.cpp +43 -0
- package/android/generated/jni/react/renderer/components/RNCredentialsManagerSpec/RNCredentialsManagerSpecJSI.h +136 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/credentialsmanager/CredentialsManagerModule.kt +212 -0
- package/android/src/main/java/com/credentialsmanager/CredentialsManagerPackage.kt +35 -0
- package/ios/CredentialsManager.h +6 -0
- package/ios/CredentialsManager.mm +18 -0
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/ios/generated/RNCredentialsManagerSpec/RNCredentialsManagerSpec-generated.mm +58 -0
- package/ios/generated/RNCredentialsManagerSpec/RNCredentialsManagerSpec.h +93 -0
- package/ios/generated/RNCredentialsManagerSpecJSI-generated.cpp +43 -0
- package/ios/generated/RNCredentialsManagerSpecJSI.h +136 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/lib/commonjs/NativeCredentialsManager.js +9 -0
- package/lib/commonjs/NativeCredentialsManager.js.map +1 -0
- package/lib/commonjs/index.js +26 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/j.js +9 -0
- package/lib/commonjs/j.js.map +1 -0
- package/lib/module/NativeCredentialsManager.js +5 -0
- package/lib/module/NativeCredentialsManager.js.map +1 -0
- package/lib/module/index.js +19 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/j.js +5 -0
- package/lib/module/j.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeCredentialsManager.d.ts +23 -0
- package/lib/typescript/commonjs/src/NativeCredentialsManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeCredentialsManager.d.ts +23 -0
- package/lib/typescript/module/src/NativeCredentialsManager.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +8 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +228 -0
- package/react-native-credentials-manager.podspec +42 -0
- package/react-native.config.js +12 -0
- package/src/NativeCredentialsManager.ts +32 -0
- package/src/index.tsx +28 -0
- package/src/j.js +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Benjamin
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# react-native-credentials-manager
|
|
2
|
+
|
|
3
|
+
A React Native library that implements the [Credential Manager API](https://developer.android.com/training/sign-in/credential-manager) for Android. This library allows you to manage passwords and passkeys in your React Native applications.
|
|
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.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- ✨ Passkey Authentication
|
|
10
|
+
- 🔐 Password Credential Management
|
|
11
|
+
- 📱 Google Signing (coming soon)
|
|
12
|
+
- 🤖 [iOS Authentication Services](https://developer.apple.com/documentation/authenticationservices?language=objc) (coming soon)
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install react-native-credentials-manager
|
|
18
|
+
|
|
19
|
+
# or if you prefer yarn
|
|
20
|
+
|
|
21
|
+
yarn add react-native-credentials-manager
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Requirements
|
|
25
|
+
|
|
26
|
+
- React Native >= 0.71.0
|
|
27
|
+
- New Architecture enabled
|
|
28
|
+
|
|
29
|
+
## Android Setup
|
|
30
|
+
|
|
31
|
+
For complete setup instructions, see the [official Credential Manager documentation](https://developer.android.com/identity/sign-in/credential-manager#add-support-dal).
|
|
32
|
+
|
|
33
|
+
1. Add support for Digital Asset Links
|
|
34
|
+
|
|
35
|
+
To enable passkey support, you need to associate your Android app with your website by creating and hosting a Digital Asset Links JSON file.
|
|
36
|
+
|
|
37
|
+
Create a file named `assetlinks.json` with the following content:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
[
|
|
41
|
+
{
|
|
42
|
+
"relation": [
|
|
43
|
+
"delegate_permission/common.handle_all_urls",
|
|
44
|
+
"delegate_permission/common.get_login_creds"
|
|
45
|
+
],
|
|
46
|
+
"target": {
|
|
47
|
+
"namespace": "android_app",
|
|
48
|
+
"package_name": "your.package.name",
|
|
49
|
+
"sha256_cert_fingerprints": [
|
|
50
|
+
"YOUR_APP_SIGNING_CERTIFICATE_SHA256_FINGERPRINT"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Host this file at:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
https://your-domain.com/.well-known/assetlinks.json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Important requirements:
|
|
64
|
+
|
|
65
|
+
- The MIME type must be `application/json`
|
|
66
|
+
- If you have a `robots.txt`, ensure it allows access to `/.well-known/assetlinks.json`:
|
|
67
|
+
```
|
|
68
|
+
User-agent: \*
|
|
69
|
+
Allow: /.well-known/
|
|
70
|
+
```
|
|
71
|
+
- The domain must be fully-qualified
|
|
72
|
+
- Don't include trailing slashes or paths in the domain
|
|
73
|
+
- Subdomains are not automatically included in the association
|
|
74
|
+
|
|
75
|
+
### ProGuard Rules
|
|
76
|
+
|
|
77
|
+
If you're using ProGuard, add these rules to your `android/app/proguard-rules.pro`:
|
|
78
|
+
|
|
79
|
+
```pro
|
|
80
|
+
-if class androidx.credentials.CredentialManager
|
|
81
|
+
-keep class androidx.credentials.playservices.** {
|
|
82
|
+
*;
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
|
|
88
|
+
### High-Level Authentication Flow
|
|
89
|
+
|
|
90
|
+
The library provides three primary functions for managing user authentication:
|
|
91
|
+
|
|
92
|
+
1. **signUpWithPasskeys**: Registers a new user using passkeys.
|
|
93
|
+
2. **signUpWithPassword**: Registers a new user using a traditional username and password.
|
|
94
|
+
3. **signInWithSavedCredentials**: Authenticates a user using previously saved credentials.
|
|
95
|
+
|
|
96
|
+
### 1. Sign Up with Passkeys
|
|
97
|
+
|
|
98
|
+
**Function**: `signUpWithPasskeys(requestJson)`
|
|
99
|
+
|
|
100
|
+
**Description**: Registers a new user using passkeys, enhancing security and user experience.
|
|
101
|
+
|
|
102
|
+
**Backend Requirements**:
|
|
103
|
+
|
|
104
|
+
- **Challenge Generation**: Your backend must generate a unique, base64-encoded challenge to prevent replay attacks.
|
|
105
|
+
- **User Information**: Provide user details such as a unique identifier, username, and display name.
|
|
106
|
+
|
|
107
|
+
**When to Use**: Opt for passkey registration to offer users a passwordless and secure authentication method.
|
|
108
|
+
|
|
109
|
+
**Example**:
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { signUpWithPasskeys } from 'react-native-credentials-manager';
|
|
113
|
+
|
|
114
|
+
// From your backend
|
|
115
|
+
const requestJson = {
|
|
116
|
+
challenge: 'base64EncodedChallengeFromBackend',
|
|
117
|
+
rp: {
|
|
118
|
+
name: 'Your App Name',
|
|
119
|
+
id: 'your-domain.com',
|
|
120
|
+
},
|
|
121
|
+
user: {
|
|
122
|
+
id: 'base64EncodedUserIdFromBackend',
|
|
123
|
+
name: 'username',
|
|
124
|
+
displayName: 'User Display Name',
|
|
125
|
+
},
|
|
126
|
+
pubKeyCredParams: [
|
|
127
|
+
{
|
|
128
|
+
type: 'public-key',
|
|
129
|
+
alg: -7, // ES256
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
authenticatorSelection: {
|
|
133
|
+
authenticatorAttachment: 'platform',
|
|
134
|
+
requireResidentKey: true,
|
|
135
|
+
residentKey: 'required',
|
|
136
|
+
userVerification: 'required',
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
const response = await signUpWithPasskeys(requestJson);
|
|
142
|
+
console.log('Passkey registration successful:', response);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
console.error('Passkey registration failed:', error);
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Parameters**:
|
|
149
|
+
|
|
150
|
+
| Parameter | Type | Description |
|
|
151
|
+
| ------------------------------------------------ | --------- | ---------------------------------------------------------------------------------------------- |
|
|
152
|
+
| `challenge` | `string` | A base64-encoded challenge provided by your server to prevent replay attacks. |
|
|
153
|
+
| `rp` | `object` | Information about your app (Relying Party). |
|
|
154
|
+
| `rp.name` | `string` | The name of your app. |
|
|
155
|
+
| `rp.id` | `string` | The domain of your app. |
|
|
156
|
+
| `user` | `object` | Information about the user registering. |
|
|
157
|
+
| `user.id` | `string` | A base64-encoded unique identifier for the user. |
|
|
158
|
+
| `user.name` | `string` | The username of the user. |
|
|
159
|
+
| `user.displayName` | `string` | The display name of the user. |
|
|
160
|
+
| `pubKeyCredParams` | `array` | An array of objects indicating acceptable public key algorithms. |
|
|
161
|
+
| `authenticatorSelection` | `object` | Criteria for selecting the appropriate authenticator. |
|
|
162
|
+
| `authenticatorSelection.authenticatorAttachment` | `string` | Indicates the desired authenticator attachment modality (`"platform"` or `"cross-platform"`). |
|
|
163
|
+
| `authenticatorSelection.requireResidentKey` | `boolean` | Indicates whether resident keys are required. |
|
|
164
|
+
| `authenticatorSelection.residentKey` | `string` | Specifies the resident key requirement (`"required"`, `"preferred"`, or `"discouraged"`). |
|
|
165
|
+
| `authenticatorSelection.userVerification` | `string` | Specifies the user verification requirement (`"required"`, `"preferred"`, or `"discouraged"`). |
|
|
166
|
+
|
|
167
|
+
**Note**: Parameters such as `challenge`, `user.id`, and other user-specific information should be securely generated and provided by your backend server.
|
|
168
|
+
|
|
169
|
+
### 2. Sign Up with Password
|
|
170
|
+
|
|
171
|
+
**Function**: `signUpWithPassword(credentials)`
|
|
172
|
+
|
|
173
|
+
**Description**: Registers a new user using a traditional username and password combination.
|
|
174
|
+
|
|
175
|
+
**Backend Requirements**:
|
|
176
|
+
|
|
177
|
+
- **User Registration**: Your backend should handle the storage and management of user credentials securely.
|
|
178
|
+
|
|
179
|
+
**When to Use**: Use this method when you want to support traditional password-based authentication.
|
|
180
|
+
|
|
181
|
+
**Example**:
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
import { signUpWithPassword } from 'react-native-credentials-manager';
|
|
185
|
+
|
|
186
|
+
const credentials = {
|
|
187
|
+
username: 'user@example.com',
|
|
188
|
+
password: 'securePassword123!',
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
try {
|
|
192
|
+
await signUpWithPassword(credentials);
|
|
193
|
+
console.log('User registered successfully with password.');
|
|
194
|
+
} catch (error) {
|
|
195
|
+
console.error('Password registration failed:', error);
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Sign In with Saved Credentials
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
import { signInWithSavedCredentials } from 'react-native-credentials-manager';
|
|
203
|
+
|
|
204
|
+
// From your backend
|
|
205
|
+
const signinRequestJson = {
|
|
206
|
+
challenge: 'base64EncodedChallenge',
|
|
207
|
+
timeout: 1800000,
|
|
208
|
+
userVerification: 'required',
|
|
209
|
+
rpId: 'your-domain.com',
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
try {
|
|
213
|
+
const credential = await signInWithSavedCredentials(signinRequestJson);
|
|
214
|
+
|
|
215
|
+
if (credential.type === 'passkey') {
|
|
216
|
+
console.log('Passkey:', credential.authenticationResponseJson);
|
|
217
|
+
} else if (credential.type === 'password') {
|
|
218
|
+
console.log('Password credentials:', {
|
|
219
|
+
username: credential.username,
|
|
220
|
+
password: credential.password,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
} catch (error) {
|
|
224
|
+
console.error('Sign in failed:', error);
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Documentation
|
|
229
|
+
|
|
230
|
+
For more detailed information about the underlying APIs, refer to:
|
|
231
|
+
|
|
232
|
+
- [Android Credential Manager Overview](https://developer.android.com/identity/sign-in/credential-manager)
|
|
233
|
+
- [Android Credential Manager API Reference](https://developer.android.com/reference/androidx/credentials/package-summary)
|
|
234
|
+
- [WebAuthn Developer Guide](https://webauthn.guide)
|
|
235
|
+
- [Passkeys Overview](https://developers.google.com/identity/passkeys)
|
|
236
|
+
|
|
237
|
+
## Roadmap
|
|
238
|
+
|
|
239
|
+
- Old Architecture Support
|
|
240
|
+
- iOS Support using [Authentication Services](https://developer.apple.com/documentation/authenticationservices?language=objc)
|
|
241
|
+
- Additional Authentication Methods
|
|
242
|
+
- Comprehensive Documentation
|
|
243
|
+
|
|
244
|
+
## Contributing
|
|
245
|
+
|
|
246
|
+
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
247
|
+
|
|
248
|
+
## License
|
|
249
|
+
|
|
250
|
+
MIT
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
```
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['CredentialsManager_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
13
|
+
// noinspection DifferentKotlinGradleVersion
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def isNewArchitectureEnabled() {
|
|
20
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
apply plugin: "com.android.library"
|
|
24
|
+
apply plugin: "kotlin-android"
|
|
25
|
+
|
|
26
|
+
if (isNewArchitectureEnabled()) {
|
|
27
|
+
apply plugin: "com.facebook.react"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
def getExtOrIntegerDefault(name) {
|
|
31
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["CredentialsManager_" + name]).toInteger()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
def supportsNamespace() {
|
|
35
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
36
|
+
def major = parsed[0].toInteger()
|
|
37
|
+
def minor = parsed[1].toInteger()
|
|
38
|
+
|
|
39
|
+
// Namespace support was added in 7.3.0
|
|
40
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
android {
|
|
44
|
+
if (supportsNamespace()) {
|
|
45
|
+
namespace "com.credentialsmanager"
|
|
46
|
+
|
|
47
|
+
sourceSets {
|
|
48
|
+
main {
|
|
49
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
55
|
+
|
|
56
|
+
defaultConfig {
|
|
57
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
58
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
59
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
buildFeatures {
|
|
64
|
+
buildConfig true
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
buildTypes {
|
|
68
|
+
release {
|
|
69
|
+
minifyEnabled false
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
lintOptions {
|
|
74
|
+
disable "GradleCompatible"
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
compileOptions {
|
|
78
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
79
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
sourceSets {
|
|
83
|
+
main {
|
|
84
|
+
if (isNewArchitectureEnabled()) {
|
|
85
|
+
java.srcDirs += [
|
|
86
|
+
"generated/java",
|
|
87
|
+
"generated/jni"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
repositories {
|
|
95
|
+
mavenCentral()
|
|
96
|
+
google()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
100
|
+
|
|
101
|
+
dependencies {
|
|
102
|
+
implementation "com.facebook.react:react-android"
|
|
103
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
104
|
+
implementation "androidx.credentials:credentials:1.5.0-rc01"
|
|
105
|
+
implementation "androidx.credentials:credentials-play-services-auth:1.5.0-rc01"
|
|
106
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
|
|
107
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (isNewArchitectureEnabled()) {
|
|
111
|
+
react {
|
|
112
|
+
jsRootDir = file("../src/")
|
|
113
|
+
libraryName = "CredentialsManager"
|
|
114
|
+
codegenJavaPackageName = "com.credentialsmanager"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
|
@@ -0,0 +1,47 @@
|
|
|
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: GenerateModuleJavaSpec.js
|
|
9
|
+
*
|
|
10
|
+
* @nolint
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
package com.credentialsmanager;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.Promise;
|
|
17
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
19
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
20
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
21
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
22
|
+
import javax.annotation.Nonnull;
|
|
23
|
+
|
|
24
|
+
public abstract class NativeCredentialsManagerSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
25
|
+
public static final String NAME = "CredentialsManager";
|
|
26
|
+
|
|
27
|
+
public NativeCredentialsManagerSpec(ReactApplicationContext reactContext) {
|
|
28
|
+
super(reactContext);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Override
|
|
32
|
+
public @Nonnull String getName() {
|
|
33
|
+
return NAME;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@ReactMethod
|
|
37
|
+
@DoNotStrip
|
|
38
|
+
public abstract void signUpWithPasskeys(ReadableMap requestJson, boolean preferImmediatelyAvailableCredentials, Promise promise);
|
|
39
|
+
|
|
40
|
+
@ReactMethod
|
|
41
|
+
@DoNotStrip
|
|
42
|
+
public abstract void signUpWithPassword(ReadableMap credObject);
|
|
43
|
+
|
|
44
|
+
@ReactMethod
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
public abstract void signInWithSavedCredentials(ReadableMap requestJson, Promise promise);
|
|
47
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNCredentialsManagerSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_RNCredentialsManagerSpec
|
|
13
|
+
OBJECT
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_RNCredentialsManagerSpec PUBLIC . react/renderer/components/RNCredentialsManagerSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_RNCredentialsManagerSpec
|
|
21
|
+
fbjni
|
|
22
|
+
jsi
|
|
23
|
+
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
+
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
+
reactnative
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_options(
|
|
29
|
+
react_codegen_RNCredentialsManagerSpec
|
|
30
|
+
PRIVATE
|
|
31
|
+
-DLOG_TAG=\"ReactNative\"
|
|
32
|
+
-fexceptions
|
|
33
|
+
-frtti
|
|
34
|
+
-std=c++20
|
|
35
|
+
-Wall
|
|
36
|
+
)
|