react-native-credentials-manager 0.5.3 → 0.6.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.
Files changed (36) hide show
  1. package/README.md +192 -1
  2. package/android/build.gradle +6 -5
  3. package/android/generated/java/com/credentialsmanager/NativeCredentialsManagerSpec.java +5 -1
  4. package/android/generated/jni/RNCredentialsManagerSpec-generated.cpp +7 -1
  5. package/android/generated/jni/react/renderer/components/RNCredentialsManagerSpec/RNCredentialsManagerSpecJSI-generated.cpp +8 -2
  6. package/android/generated/jni/react/renderer/components/RNCredentialsManagerSpec/RNCredentialsManagerSpecJSI.h +151 -3
  7. package/android/src/main/java/com/credentialsmanager/handlers/CredentialHandler.kt +35 -21
  8. package/android/src/newarch/java/com/credentialsmanager/CredentialsManagerModule.kt +28 -1
  9. package/android/src/oldarch/java/com/credentialsmanager/CredentialsManagerModule.kt +30 -1
  10. package/ios/CredentialsManager.h +8 -2
  11. package/ios/CredentialsManager.mm +396 -4
  12. package/ios/generated/RNCredentialsManagerSpec/RNCredentialsManagerSpec-generated.mm +14 -1
  13. package/ios/generated/RNCredentialsManagerSpec/RNCredentialsManagerSpec.h +38 -1
  14. package/ios/generated/RNCredentialsManagerSpecJSI-generated.cpp +8 -2
  15. package/ios/generated/RNCredentialsManagerSpecJSI.h +151 -3
  16. package/lib/commonjs/NativeCredentialsManager.js +6 -0
  17. package/lib/commonjs/NativeCredentialsManager.js.map +1 -1
  18. package/lib/commonjs/index.js +50 -3
  19. package/lib/commonjs/index.js.map +1 -1
  20. package/lib/module/NativeCredentialsManager.js +13 -0
  21. package/lib/module/NativeCredentialsManager.js.map +1 -1
  22. package/lib/module/index.js +49 -3
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/typescript/commonjs/src/NativeCredentialsManager.d.ts +49 -7
  25. package/lib/typescript/commonjs/src/NativeCredentialsManager.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/src/index.d.ts +10 -4
  27. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  28. package/lib/typescript/module/src/NativeCredentialsManager.d.ts +49 -7
  29. package/lib/typescript/module/src/NativeCredentialsManager.d.ts.map +1 -1
  30. package/lib/typescript/module/src/index.d.ts +10 -4
  31. package/lib/typescript/module/src/index.d.ts.map +1 -1
  32. package/package.json +1 -1
  33. package/react-native-credentials-manager.podspec +4 -1
  34. package/react-native.config.js +0 -1
  35. package/src/NativeCredentialsManager.ts +67 -8
  36. package/src/index.tsx +82 -5
@@ -16,6 +16,145 @@ namespace facebook::react {
16
16
 
17
17
 
18
18
 
19
+ #pragma mark - NativeCredentialsManagerAppleCredential
20
+
21
+ template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
22
+ struct NativeCredentialsManagerAppleCredential {
23
+ P0 type;
24
+ P1 id;
25
+ P2 idToken;
26
+ P3 displayName;
27
+ P4 familyName;
28
+ P5 givenName;
29
+ P6 email;
30
+ bool operator==(const NativeCredentialsManagerAppleCredential &other) const {
31
+ return type == other.type && id == other.id && idToken == other.idToken && displayName == other.displayName && familyName == other.familyName && givenName == other.givenName && email == other.email;
32
+ }
33
+ };
34
+
35
+ template <typename T>
36
+ struct NativeCredentialsManagerAppleCredentialBridging {
37
+ static T types;
38
+
39
+ static T fromJs(
40
+ jsi::Runtime &rt,
41
+ const jsi::Object &value,
42
+ const std::shared_ptr<CallInvoker> &jsInvoker) {
43
+ T result{
44
+ bridging::fromJs<decltype(types.type)>(rt, value.getProperty(rt, "type"), jsInvoker),
45
+ bridging::fromJs<decltype(types.id)>(rt, value.getProperty(rt, "id"), jsInvoker),
46
+ bridging::fromJs<decltype(types.idToken)>(rt, value.getProperty(rt, "idToken"), jsInvoker),
47
+ bridging::fromJs<decltype(types.displayName)>(rt, value.getProperty(rt, "displayName"), jsInvoker),
48
+ bridging::fromJs<decltype(types.familyName)>(rt, value.getProperty(rt, "familyName"), jsInvoker),
49
+ bridging::fromJs<decltype(types.givenName)>(rt, value.getProperty(rt, "givenName"), jsInvoker),
50
+ bridging::fromJs<decltype(types.email)>(rt, value.getProperty(rt, "email"), jsInvoker)};
51
+ return result;
52
+ }
53
+
54
+ #ifdef DEBUG
55
+ static jsi::String typeToJs(jsi::Runtime &rt, decltype(types.type) value) {
56
+ return bridging::toJs(rt, value);
57
+ }
58
+
59
+ static jsi::String idToJs(jsi::Runtime &rt, decltype(types.id) value) {
60
+ return bridging::toJs(rt, value);
61
+ }
62
+
63
+ static jsi::String idTokenToJs(jsi::Runtime &rt, decltype(types.idToken) value) {
64
+ return bridging::toJs(rt, value);
65
+ }
66
+
67
+ static jsi::String displayNameToJs(jsi::Runtime &rt, decltype(types.displayName) value) {
68
+ return bridging::toJs(rt, value);
69
+ }
70
+
71
+ static jsi::String familyNameToJs(jsi::Runtime &rt, decltype(types.familyName) value) {
72
+ return bridging::toJs(rt, value);
73
+ }
74
+
75
+ static jsi::String givenNameToJs(jsi::Runtime &rt, decltype(types.givenName) value) {
76
+ return bridging::toJs(rt, value);
77
+ }
78
+
79
+ static jsi::String emailToJs(jsi::Runtime &rt, decltype(types.email) value) {
80
+ return bridging::toJs(rt, value);
81
+ }
82
+ #endif
83
+
84
+ static jsi::Object toJs(
85
+ jsi::Runtime &rt,
86
+ const T &value,
87
+ const std::shared_ptr<CallInvoker> &jsInvoker) {
88
+ auto result = facebook::jsi::Object(rt);
89
+ result.setProperty(rt, "type", bridging::toJs(rt, value.type, jsInvoker));
90
+ result.setProperty(rt, "id", bridging::toJs(rt, value.id, jsInvoker));
91
+ result.setProperty(rt, "idToken", bridging::toJs(rt, value.idToken, jsInvoker));
92
+ if (value.displayName) {
93
+ result.setProperty(rt, "displayName", bridging::toJs(rt, value.displayName.value(), jsInvoker));
94
+ }
95
+ if (value.familyName) {
96
+ result.setProperty(rt, "familyName", bridging::toJs(rt, value.familyName.value(), jsInvoker));
97
+ }
98
+ if (value.givenName) {
99
+ result.setProperty(rt, "givenName", bridging::toJs(rt, value.givenName.value(), jsInvoker));
100
+ }
101
+ if (value.email) {
102
+ result.setProperty(rt, "email", bridging::toJs(rt, value.email.value(), jsInvoker));
103
+ }
104
+ return result;
105
+ }
106
+ };
107
+
108
+
109
+
110
+ #pragma mark - NativeCredentialsManagerAppleSignInParams
111
+
112
+ template <typename P0, typename P1>
113
+ struct NativeCredentialsManagerAppleSignInParams {
114
+ P0 nonce;
115
+ P1 requestedScopes;
116
+ bool operator==(const NativeCredentialsManagerAppleSignInParams &other) const {
117
+ return nonce == other.nonce && requestedScopes == other.requestedScopes;
118
+ }
119
+ };
120
+
121
+ template <typename T>
122
+ struct NativeCredentialsManagerAppleSignInParamsBridging {
123
+ static T types;
124
+
125
+ static T fromJs(
126
+ jsi::Runtime &rt,
127
+ const jsi::Object &value,
128
+ const std::shared_ptr<CallInvoker> &jsInvoker) {
129
+ T result{
130
+ bridging::fromJs<decltype(types.nonce)>(rt, value.getProperty(rt, "nonce"), jsInvoker),
131
+ bridging::fromJs<decltype(types.requestedScopes)>(rt, value.getProperty(rt, "requestedScopes"), jsInvoker)};
132
+ return result;
133
+ }
134
+
135
+ #ifdef DEBUG
136
+ static jsi::String nonceToJs(jsi::Runtime &rt, decltype(types.nonce) value) {
137
+ return bridging::toJs(rt, value);
138
+ }
139
+
140
+ static jsi::Array requestedScopesToJs(jsi::Runtime &rt, decltype(types.requestedScopes) value) {
141
+ return bridging::toJs(rt, value);
142
+ }
143
+ #endif
144
+
145
+ static jsi::Object toJs(
146
+ jsi::Runtime &rt,
147
+ const T &value,
148
+ const std::shared_ptr<CallInvoker> &jsInvoker) {
149
+ auto result = facebook::jsi::Object(rt);
150
+ result.setProperty(rt, "nonce", bridging::toJs(rt, value.nonce, jsInvoker));
151
+ result.setProperty(rt, "requestedScopes", bridging::toJs(rt, value.requestedScopes, jsInvoker));
152
+ return result;
153
+ }
154
+ };
155
+
156
+
157
+
19
158
  #pragma mark - NativeCredentialsManagerCredObject
20
159
 
21
160
  template <typename P0, typename P1>
@@ -223,9 +362,10 @@ protected:
223
362
 
224
363
  public:
225
364
  virtual jsi::Value signUpWithPasskeys(jsi::Runtime &rt, jsi::Object requestJson, bool preferImmediatelyAvailableCredentials) = 0;
226
- virtual void signUpWithPassword(jsi::Runtime &rt, jsi::Object credObject) = 0;
365
+ virtual jsi::Value signUpWithPassword(jsi::Runtime &rt, jsi::Object credObject) = 0;
227
366
  virtual jsi::Value signIn(jsi::Runtime &rt, jsi::Array options, jsi::Object params) = 0;
228
367
  virtual jsi::Value signUpWithGoogle(jsi::Runtime &rt, jsi::Object params) = 0;
368
+ virtual jsi::Value signUpWithApple(jsi::Runtime &rt, jsi::Object params) = 0;
229
369
  virtual jsi::Value signOut(jsi::Runtime &rt) = 0;
230
370
 
231
371
  };
@@ -265,12 +405,12 @@ private:
265
405
  return bridging::callFromJs<jsi::Value>(
266
406
  rt, &T::signUpWithPasskeys, jsInvoker_, instance_, std::move(requestJson), std::move(preferImmediatelyAvailableCredentials));
267
407
  }
268
- void signUpWithPassword(jsi::Runtime &rt, jsi::Object credObject) override {
408
+ jsi::Value signUpWithPassword(jsi::Runtime &rt, jsi::Object credObject) override {
269
409
  static_assert(
270
410
  bridging::getParameterCount(&T::signUpWithPassword) == 2,
271
411
  "Expected signUpWithPassword(...) to have 2 parameters");
272
412
 
273
- return bridging::callFromJs<void>(
413
+ return bridging::callFromJs<jsi::Value>(
274
414
  rt, &T::signUpWithPassword, jsInvoker_, instance_, std::move(credObject));
275
415
  }
276
416
  jsi::Value signIn(jsi::Runtime &rt, jsi::Array options, jsi::Object params) override {
@@ -289,6 +429,14 @@ private:
289
429
  return bridging::callFromJs<jsi::Value>(
290
430
  rt, &T::signUpWithGoogle, jsInvoker_, instance_, std::move(params));
291
431
  }
432
+ jsi::Value signUpWithApple(jsi::Runtime &rt, jsi::Object params) override {
433
+ static_assert(
434
+ bridging::getParameterCount(&T::signUpWithApple) == 2,
435
+ "Expected signUpWithApple(...) to have 2 parameters");
436
+
437
+ return bridging::callFromJs<jsi::Value>(
438
+ rt, &T::signUpWithApple, jsInvoker_, instance_, std::move(params));
439
+ }
292
440
  jsi::Value signOut(jsi::Runtime &rt) override {
293
441
  static_assert(
294
442
  bridging::getParameterCount(&T::signOut) == 1,
@@ -5,5 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _reactNative = require("react-native");
8
+ // Password authentication types
9
+ // Passkey authentication types
10
+ // Google Sign In types
11
+ // Apple Sign In types
12
+ // Combined credential type
13
+ // Native module interface
8
14
  var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('CredentialsManager');
9
15
  //# sourceMappingURL=NativeCredentialsManager.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeCredentialsManager.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GA4DpCC,gCAAmB,CAACC,YAAY,CAAO,oBAAoB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeCredentialsManager.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAQA;AAYA;AAMA;AAkBA;AAgBA;AAOA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAoDeC,gCAAmB,CAACC,YAAY,CAAO,oBAAoB,CAAC","ignoreList":[]}
@@ -5,10 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.signIn = signIn;
7
7
  exports.signOut = signOut;
8
+ exports.signUpWithApple = signUpWithApple;
8
9
  exports.signUpWithGoogle = signUpWithGoogle;
9
10
  exports.signUpWithPasskeys = signUpWithPasskeys;
10
11
  exports.signUpWithPassword = signUpWithPassword;
11
12
  var _NativeCredentialsManager = _interopRequireDefault(require("./NativeCredentialsManager.js"));
13
+ var _reactNative = require("react-native");
12
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
15
  function signUpWithPasskeys(requestJson, preferImmediatelyAvailableCredentials = false) {
14
16
  return _NativeCredentialsManager.default.signUpWithPasskeys(requestJson, preferImmediatelyAvailableCredentials);
@@ -17,29 +19,74 @@ function signUpWithPassword({
17
19
  username,
18
20
  password
19
21
  }) {
20
- _NativeCredentialsManager.default.signUpWithPassword({
22
+ if (_reactNative.Platform.OS === 'ios') {
23
+ // iOS only supports AutoFill passwords through Apple's Authentication Services
24
+ // Manual password storage is not supported
25
+ return Promise.reject(new Error('Manual password storage is not supported on iOS. Use AutoFill passwords through signIn method instead.'));
26
+ }
27
+ return _NativeCredentialsManager.default.signUpWithPassword({
21
28
  password,
22
29
  username
23
30
  });
24
31
  }
25
32
  function signIn(options, params) {
26
- return _NativeCredentialsManager.default.signIn(options, {
33
+ // Transform options for iOS compatibility
34
+ const processedOptions = options.map(option => {
35
+ if (option === 'google-signin' && _reactNative.Platform.OS === 'ios') {
36
+ // Automatically replace google-signin with apple-signin on iOS
37
+ return 'apple-signin';
38
+ }
39
+ return option;
40
+ });
41
+
42
+ // Prepare parameters for both platforms
43
+ const signInParams = {
27
44
  ...params,
28
45
  googleSignIn: {
29
46
  serverClientId: params?.googleSignIn?.serverClientId ?? '',
30
47
  nonce: params?.googleSignIn?.nonce ?? '',
31
48
  autoSelectEnabled: params?.googleSignIn?.autoSelectEnabled ?? true
32
49
  }
33
- });
50
+ };
51
+
52
+ // If we have Apple Sign In option on iOS, add Apple params
53
+ if (_reactNative.Platform.OS === 'ios' && processedOptions.includes('apple-signin')) {
54
+ signInParams.appleSignIn = {
55
+ nonce: params?.appleSignIn?.nonce || params?.googleSignIn?.nonce || '',
56
+ requestedScopes: params?.appleSignIn?.requestedScopes || ['fullName', 'email']
57
+ };
58
+ }
59
+ return _NativeCredentialsManager.default.signIn(processedOptions, signInParams);
34
60
  }
35
61
  function signUpWithGoogle(params) {
62
+ if (_reactNative.Platform.OS === 'ios') {
63
+ // On iOS, automatically use Apple Sign In instead of Google Sign In
64
+ // This provides seamless cross-platform compatibility
65
+ return signUpWithApple({
66
+ nonce: params.nonce,
67
+ requestedScopes: ['fullName', 'email']
68
+ });
69
+ }
36
70
  return _NativeCredentialsManager.default.signUpWithGoogle({
37
71
  ...params,
38
72
  nonce: params.nonce ?? '',
39
73
  autoSelectEnabled: params.autoSelectEnabled ?? true
40
74
  });
41
75
  }
76
+ function signUpWithApple(params = {}) {
77
+ if (_reactNative.Platform.OS !== 'ios') {
78
+ return Promise.reject(new Error('Apple Sign In is only available on iOS. Use signUpWithGoogle on Android.'));
79
+ }
80
+
81
+ // Call the native signUpWithApple method directly - uses Apple's Authentication Services
82
+ return _NativeCredentialsManager.default.signUpWithApple({
83
+ nonce: params.nonce || '',
84
+ requestedScopes: params.requestedScopes || ['fullName', 'email']
85
+ });
86
+ }
42
87
  function signOut() {
43
88
  return _NativeCredentialsManager.default.signOut();
44
89
  }
90
+
91
+ // Export types
45
92
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_NativeCredentialsManager","_interopRequireDefault","require","e","__esModule","default","signUpWithPasskeys","requestJson","preferImmediatelyAvailableCredentials","CredentialsManager","signUpWithPassword","username","password","signIn","options","params","googleSignIn","serverClientId","nonce","autoSelectEnabled","signUpWithGoogle","signOut"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAarD,SAASG,kBAAkBA,CAChCC,WAAmB,EACnBC,qCAA8C,GAAG,KAAK,EACrC;EACjB,OAAOC,iCAAkB,CAACH,kBAAkB,CAC1CC,WAAW,EACXC,qCACF,CAAC;AACH;AAEO,SAASE,kBAAkBA,CAAC;EACjCC,QAAQ;EACRC;AAIF,CAAC,EAAE;EACDH,iCAAkB,CAACC,kBAAkB,CAAC;IAAEE,QAAQ;IAAED;EAAS,CAAC,CAAC;AAC/D;AAEO,SAASE,MAAMA,CACpBC,OAAuB,EACvBC,MAGC,EACoB;EACrB,OAAON,iCAAkB,CAACI,MAAM,CAACC,OAAO,EAAE;IACxC,GAAGC,MAAM;IACTC,YAAY,EAAE;MACZC,cAAc,EAAEF,MAAM,EAAEC,YAAY,EAAEC,cAAc,IAAI,EAAE;MAC1DC,KAAK,EAAEH,MAAM,EAAEC,YAAY,EAAEE,KAAK,IAAI,EAAE;MACxCC,iBAAiB,EAAEJ,MAAM,EAAEC,YAAY,EAAEG,iBAAiB,IAAI;IAChE;EACF,CAAC,CAAC;AACJ;AAEO,SAASC,gBAAgBA,CAC9BL,MAA0B,EACC;EAC3B,OAAON,iCAAkB,CAACW,gBAAgB,CAAC;IACzC,GAAGL,MAAM;IACTG,KAAK,EAAEH,MAAM,CAACG,KAAK,IAAI,EAAE;IACzBC,iBAAiB,EAAEJ,MAAM,CAACI,iBAAiB,IAAI;EACjD,CAAC,CAAC;AACJ;AAEO,SAASE,OAAOA,CAAA,EAAkB;EACvC,OAAOZ,iCAAkB,CAACY,OAAO,CAAC,CAAC;AACrC","ignoreList":[]}
1
+ {"version":3,"names":["_NativeCredentialsManager","_interopRequireDefault","require","_reactNative","e","__esModule","default","signUpWithPasskeys","requestJson","preferImmediatelyAvailableCredentials","CredentialsManager","signUpWithPassword","username","password","Platform","OS","Promise","reject","Error","signIn","options","params","processedOptions","map","option","signInParams","googleSignIn","serverClientId","nonce","autoSelectEnabled","includes","appleSignIn","requestedScopes","signUpWithGoogle","signUpWithApple","signOut"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAOA,IAAAC,YAAA,GAAAD,OAAA;AAAwC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IA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,IAAIP,MAAM,EAAEK,YAAY,EAAEE,KAAK,IAAI,EAAE;MACtEI,eAAe,EAAEX,MAAM,EAAEU,WAAW,EAAEC,eAAe,IAAI,CACvD,UAAU,EACV,OAAO;IAEX,CAAC;EACH;EAEA,OAAOtB,iCAAkB,CAACS,MAAM,CAACG,gBAAgB,EAAEG,YAAY,CAAC;AAClE;AAEO,SAASQ,gBAAgBA,CAC9BZ,MAA0B,EACmB;EAC7C,IAAIP,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB;IACA;IACA,OAAOmB,eAAe,CAAC;MACrBN,KAAK,EAAEP,MAAM,CAACO,KAAK;MACnBI,eAAe,EAAE,CAAC,UAAU,EAAE,OAAO;IACvC,CAAC,CAAC;EACJ;EAEA,OAAOtB,iCAAkB,CAACuB,gBAAgB,CAAC;IACzC,GAAGZ,MAAM;IACTO,KAAK,EAAEP,MAAM,CAACO,KAAK,IAAI,EAAE;IACzBC,iBAAiB,EAAER,MAAM,CAACQ,iBAAiB,IAAI;EACjD,CAAC,CAAC;AACJ;AAEO,SAASK,eAAeA,CAC7Bb,MAAyB,GAAG,CAAC,CAAC,EACJ;EAC1B,IAAIP,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,OAAOC,OAAO,CAACC,MAAM,CACnB,IAAIC,KAAK,CACP,0EACF,CACF,CAAC;EACH;;EAEA;EACA,OAAOR,iCAAkB,CAACwB,eAAe,CAAC;IACxCN,KAAK,EAAEP,MAAM,CAACO,KAAK,IAAI,EAAE;IACzBI,eAAe,EAAEX,MAAM,CAACW,eAAe,IAAI,CAAC,UAAU,EAAE,OAAO;EACjE,CAAC,CAAC;AACJ;AAEO,SAASG,OAAOA,CAAA,EAAkB;EACvC,OAAOzB,iCAAkB,CAACyB,OAAO,CAAC,CAAC;AACrC;;AAEA","ignoreList":[]}
@@ -1,5 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  import { TurboModuleRegistry } from 'react-native';
4
+
5
+ // Password authentication types
6
+
7
+ // Passkey authentication types
8
+
9
+ // Google Sign In types
10
+
11
+ // Apple Sign In types
12
+
13
+ // Combined credential type
14
+
15
+ // Native module interface
16
+
4
17
  export default TurboModuleRegistry.getEnforcing('CredentialsManager');
5
18
  //# sourceMappingURL=NativeCredentialsManager.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeCredentialsManager.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AA4DlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,oBAAoB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeCredentialsManager.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;;AAQlD;;AAYA;;AAMA;;AAkBA;;AAgBA;;AAOA;;AAoDA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,oBAAoB,CAAC","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import CredentialsManager from "./NativeCredentialsManager.js";
4
+ import { Platform } from 'react-native';
4
5
  export function signUpWithPasskeys(requestJson, preferImmediatelyAvailableCredentials = false) {
5
6
  return CredentialsManager.signUpWithPasskeys(requestJson, preferImmediatelyAvailableCredentials);
6
7
  }
@@ -8,29 +9,74 @@ export function signUpWithPassword({
8
9
  username,
9
10
  password
10
11
  }) {
11
- CredentialsManager.signUpWithPassword({
12
+ if (Platform.OS === 'ios') {
13
+ // iOS only supports AutoFill passwords through Apple's Authentication Services
14
+ // Manual password storage is not supported
15
+ return Promise.reject(new Error('Manual password storage is not supported on iOS. Use AutoFill passwords through signIn method instead.'));
16
+ }
17
+ return CredentialsManager.signUpWithPassword({
12
18
  password,
13
19
  username
14
20
  });
15
21
  }
16
22
  export function signIn(options, params) {
17
- return CredentialsManager.signIn(options, {
23
+ // Transform options for iOS compatibility
24
+ const processedOptions = options.map(option => {
25
+ if (option === 'google-signin' && Platform.OS === 'ios') {
26
+ // Automatically replace google-signin with apple-signin on iOS
27
+ return 'apple-signin';
28
+ }
29
+ return option;
30
+ });
31
+
32
+ // Prepare parameters for both platforms
33
+ const signInParams = {
18
34
  ...params,
19
35
  googleSignIn: {
20
36
  serverClientId: params?.googleSignIn?.serverClientId ?? '',
21
37
  nonce: params?.googleSignIn?.nonce ?? '',
22
38
  autoSelectEnabled: params?.googleSignIn?.autoSelectEnabled ?? true
23
39
  }
24
- });
40
+ };
41
+
42
+ // If we have Apple Sign In option on iOS, add Apple params
43
+ if (Platform.OS === 'ios' && processedOptions.includes('apple-signin')) {
44
+ signInParams.appleSignIn = {
45
+ nonce: params?.appleSignIn?.nonce || params?.googleSignIn?.nonce || '',
46
+ requestedScopes: params?.appleSignIn?.requestedScopes || ['fullName', 'email']
47
+ };
48
+ }
49
+ return CredentialsManager.signIn(processedOptions, signInParams);
25
50
  }
26
51
  export function signUpWithGoogle(params) {
52
+ if (Platform.OS === 'ios') {
53
+ // On iOS, automatically use Apple Sign In instead of Google Sign In
54
+ // This provides seamless cross-platform compatibility
55
+ return signUpWithApple({
56
+ nonce: params.nonce,
57
+ requestedScopes: ['fullName', 'email']
58
+ });
59
+ }
27
60
  return CredentialsManager.signUpWithGoogle({
28
61
  ...params,
29
62
  nonce: params.nonce ?? '',
30
63
  autoSelectEnabled: params.autoSelectEnabled ?? true
31
64
  });
32
65
  }
66
+ export function signUpWithApple(params = {}) {
67
+ if (Platform.OS !== 'ios') {
68
+ return Promise.reject(new Error('Apple Sign In is only available on iOS. Use signUpWithGoogle on Android.'));
69
+ }
70
+
71
+ // Call the native signUpWithApple method directly - uses Apple's Authentication Services
72
+ return CredentialsManager.signUpWithApple({
73
+ nonce: params.nonce || '',
74
+ requestedScopes: params.requestedScopes || ['fullName', 'email']
75
+ });
76
+ }
33
77
  export function signOut() {
34
78
  return CredentialsManager.signOut();
35
79
  }
80
+
81
+ // Export types
36
82
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CredentialsManager","signUpWithPasskeys","requestJson","preferImmediatelyAvailableCredentials","signUpWithPassword","username","password","signIn","options","params","googleSignIn","serverClientId","nonce","autoSelectEnabled","signUpWithGoogle","signOut"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,kBAAkB,MAAM,+BAA4B;AAa3D,OAAO,SAASC,kBAAkBA,CAChCC,WAAmB,EACnBC,qCAA8C,GAAG,KAAK,EACrC;EACjB,OAAOH,kBAAkB,CAACC,kBAAkB,CAC1CC,WAAW,EACXC,qCACF,CAAC;AACH;AAEA,OAAO,SAASC,kBAAkBA,CAAC;EACjCC,QAAQ;EACRC;AAIF,CAAC,EAAE;EACDN,kBAAkB,CAACI,kBAAkB,CAAC;IAAEE,QAAQ;IAAED;EAAS,CAAC,CAAC;AAC/D;AAEA,OAAO,SAASE,MAAMA,CACpBC,OAAuB,EACvBC,MAGC,EACoB;EACrB,OAAOT,kBAAkB,CAACO,MAAM,CAACC,OAAO,EAAE;IACxC,GAAGC,MAAM;IACTC,YAAY,EAAE;MACZC,cAAc,EAAEF,MAAM,EAAEC,YAAY,EAAEC,cAAc,IAAI,EAAE;MAC1DC,KAAK,EAAEH,MAAM,EAAEC,YAAY,EAAEE,KAAK,IAAI,EAAE;MACxCC,iBAAiB,EAAEJ,MAAM,EAAEC,YAAY,EAAEG,iBAAiB,IAAI;IAChE;EACF,CAAC,CAAC;AACJ;AAEA,OAAO,SAASC,gBAAgBA,CAC9BL,MAA0B,EACC;EAC3B,OAAOT,kBAAkB,CAACc,gBAAgB,CAAC;IACzC,GAAGL,MAAM;IACTG,KAAK,EAAEH,MAAM,CAACG,KAAK,IAAI,EAAE;IACzBC,iBAAiB,EAAEJ,MAAM,CAACI,iBAAiB,IAAI;EACjD,CAAC,CAAC;AACJ;AAEA,OAAO,SAASE,OAAOA,CAAA,EAAkB;EACvC,OAAOf,kBAAkB,CAACe,OAAO,CAAC,CAAC;AACrC","ignoreList":[]}
1
+ {"version":3,"names":["CredentialsManager","Platform","signUpWithPasskeys","requestJson","preferImmediatelyAvailableCredentials","signUpWithPassword","username","password","OS","Promise","reject","Error","signIn","options","params","processedOptions","map","option","signInParams","googleSignIn","serverClientId","nonce","autoSelectEnabled","includes","appleSignIn","requestedScopes","signUpWithGoogle","signUpWithApple","signOut"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,kBAAkB,MAAM,+BAA4B;AAO3D,SAASC,QAAQ,QAAQ,cAAc;AAavC,OAAO,SAASC,kBAAkBA,CAChCC,WAAmB,EACnBC,qCAA8C,GAAG,KAAK,EACrC;EACjB,OAAOJ,kBAAkB,CAACE,kBAAkB,CAC1CC,WAAW,EACXC,qCACF,CAAC;AACH;AAEA,OAAO,SAASC,kBAAkBA,CAAC;EACjCC,QAAQ;EACRC;AAIF,CAAC,EAAmB;EAClB,IAAIN,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;IACzB;IACA;IACA,OAAOC,OAAO,CAACC,MAAM,CACnB,IAAIC,KAAK,CACP,wGACF,CACF,CAAC;EACH;EACA,OAAOX,kBAAkB,CAACK,kBAAkB,CAAC;IAAEE,QAAQ;IAAED;EAAS,CAAC,CAAC;AACtE;AAEA,OAAO,SAASM,MAAMA,CACpBC,OAAuB,EACvBC,MAIC,EACoB;EACrB;EACA,MAAMC,gBAAgB,GAAGF,OAAO,CAACG,GAAG,CAAEC,MAAM,IAAK;IAC/C,IAAIA,MAAM,KAAK,eAAe,IAAIhB,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;MACvD;MACA,OAAO,cAAc;IACvB;IACA,OAAOS,MAAM;EACf,CAAC,CAAC;;EAEF;EACA,MAAMC,YAAiB,GAAG;IACxB,GAAGJ,MAAM;IACTK,YAAY,EAAE;MACZC,cAAc,EAAEN,MAAM,EAAEK,YAAY,EAAEC,cAAc,IAAI,EAAE;MAC1DC,KAAK,EAAEP,MAAM,EAAEK,YAAY,EAAEE,KAAK,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;IACzBI,eAAe,EAAEX,MAAM,CAACW,eAAe,IAAI,CAAC,UAAU,EAAE,OAAO;EACjE,CAAC,CAAC;AACJ;AAEA,OAAO,SAASG,OAAOA,CAAA,EAAkB;EACvC,OAAO5B,kBAAkB,CAAC4B,OAAO,CAAC,CAAC;AACrC;;AAEA","ignoreList":[]}
@@ -1,9 +1,14 @@
1
1
  import type { TurboModule } from 'react-native';
2
- export type SignInOption = 'passkeys' | 'password' | 'google-signin';
2
+ export type SignInOption = 'passkeys' | 'password' | 'google-signin' | 'apple-signin';
3
3
  type CredObject = {
4
4
  username: string;
5
5
  password: string;
6
6
  };
7
+ type PasswordCredential = {
8
+ type: 'password';
9
+ username: string;
10
+ password: string;
11
+ };
7
12
  type PasskeyCredential = {
8
13
  type: 'passkey';
9
14
  authenticationResponseJson: string;
@@ -23,20 +28,57 @@ export type GoogleCredential = {
23
28
  profilePicture?: string;
24
29
  phoneNumber?: string;
25
30
  };
26
- type PasswordCredential = {
27
- type: 'password';
28
- username: string;
29
- password: string;
31
+ type AppleSignInParams = {
32
+ nonce: string;
33
+ requestedScopes: string[];
34
+ };
35
+ export type AppleCredential = {
36
+ type: 'apple-signin';
37
+ id: string;
38
+ idToken: string;
39
+ displayName?: string;
40
+ familyName?: string;
41
+ givenName?: string;
42
+ email?: string;
30
43
  };
31
- export type Credential = PasskeyCredential | PasswordCredential | GoogleCredential;
44
+ export type Credential = PasskeyCredential | PasswordCredential | GoogleCredential | AppleCredential;
32
45
  export interface Spec extends TurboModule {
46
+ /**
47
+ * Sign up with passkeys (supported on both Android and iOS)
48
+ * @param requestJson WebAuthn request object
49
+ * @param preferImmediatelyAvailableCredentials Android-specific parameter, ignored on iOS
50
+ */
33
51
  signUpWithPasskeys(requestJson: Object, preferImmediatelyAvailableCredentials: boolean): Promise<Object>;
34
- signUpWithPassword(credObject: CredObject): void;
52
+ /**
53
+ * Sign up with password (Android only - not supported on iOS)
54
+ * iOS will reject with UNSUPPORTED_OPERATION error
55
+ */
56
+ signUpWithPassword(credObject: CredObject): Promise<Object>;
57
+ /**
58
+ * Sign in with various methods
59
+ * - 'passkeys': Supported on both platforms
60
+ * - 'password': Supported on both platforms (uses AutoFill)
61
+ * - 'google-signin': Android only
62
+ * - 'apple-signin': iOS only (not available on Android)
63
+ */
35
64
  signIn(options: SignInOption[], params: {
36
65
  passkeys?: Object;
37
66
  googleSignIn?: GoogleSignInParams;
67
+ appleSignIn?: AppleSignInParams;
38
68
  }): Promise<Credential>;
69
+ /**
70
+ * Sign up with Google (Android-specific implementation)
71
+ */
39
72
  signUpWithGoogle(params: GoogleSignInParams): Promise<GoogleCredential>;
73
+ /**
74
+ * Sign up with Apple (iOS-specific implementation)
75
+ * Will reject with UNSUPPORTED_OPERATION on Android
76
+ */
77
+ signUpWithApple(params: AppleSignInParams): Promise<AppleCredential>;
78
+ /**
79
+ * Sign out (behavior varies by platform)
80
+ * On iOS, this is a no-op as AuthenticationServices doesn't provide a sign-out method
81
+ */
40
82
  signOut(): Promise<null>;
41
83
  }
42
84
  declare const _default: Spec;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeCredentialsManager.d.ts","sourceRoot":"","sources":["../../../../src/NativeCredentialsManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,eAAe,CAAC;AAErE,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,SAAS,CAAC;IAChB,0BAA0B,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,CAAC;AAErB,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,kBAAkB,CAChB,WAAW,EAAE,MAAM,EACnB,qCAAqC,EAAE,OAAO,GAC7C,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAEjD,MAAM,CACJ,OAAO,EAAE,YAAY,EAAE,EACvB,MAAM,EAAE;QACN,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,kBAAkB,CAAC;KACnC,GACA,OAAO,CAAC,UAAU,CAAC,CAAC;IACvB,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACxE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;;AAED,wBAA4E"}
1
+ {"version":3,"file":"NativeCredentialsManager.d.ts","sourceRoot":"","sources":["../../../../src/NativeCredentialsManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,MAAM,YAAY,GACpB,UAAU,GACV,UAAU,GACV,eAAe,GACf,cAA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gB,GAChB,eAAe,CAAC;AAGpB,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC;;;;OAIG;IACH,kBAAkB,CAChB,WAAW,EAAE,MAAM,EACnB,qCAAqC,EAAE,OAAO,GAC7C,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnB;;;OAGG;IACH,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5D;;;;;;OAMG;IACH,MAAM,CACJ,OAAO,EAAE,YAAY,EAAE,EACvB,MAAM,EAAE;QACN,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,kBAAkB,CAAC;QAClC,WAAW,CAAC,EAAE,iBAAiB,CAAC;KACjC,GACA,OAAO,CAAC,UAAU,CAAC,CAAC;IAEvB;;OAEG;IACH,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAExE;;;OAGG;IACH,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAErE;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;;AAED,wBAA4E"}
@@ -1,19 +1,25 @@
1
- import type { Credential, GoogleCredential, SignInOption } from './NativeCredentialsManager';
1
+ import type { Credential, GoogleCredential, AppleCredential, SignInOption } from './NativeCredentialsManager';
2
2
  type GoogleSignInParams = {
3
3
  nonce?: string;
4
4
  serverClientId: string;
5
5
  autoSelectEnabled?: boolean;
6
6
  };
7
+ type AppleSignInParams = {
8
+ nonce?: string;
9
+ requestedScopes?: ('fullName' | 'email')[];
10
+ };
7
11
  export declare function signUpWithPasskeys(requestJson: Object, preferImmediatelyAvailableCredentials?: boolean): Promise<Object>;
8
12
  export declare function signUpWithPassword({ username, password, }: {
9
13
  username: string;
10
14
  password: string;
11
- }): void;
15
+ }): Promise<Object>;
12
16
  export declare function signIn(options: SignInOption[], params: {
13
17
  passkeys?: Object;
14
18
  googleSignIn?: GoogleSignInParams;
19
+ appleSignIn?: AppleSignInParams;
15
20
  }): Promise<Credential>;
16
- export declare function signUpWithGoogle(params: GoogleSignInParams): Promise<GoogleCredential>;
21
+ export declare function signUpWithGoogle(params: GoogleSignInParams): Promise<GoogleCredential | AppleCredential>;
22
+ export declare function signUpWithApple(params?: AppleSignInParams): Promise<AppleCredential>;
17
23
  export declare function signOut(): Promise<null>;
18
- export {};
24
+ export type { Credential, GoogleCredential, AppleCredential, SignInOption, GoogleSignInParams, AppleSignInParams, };
19
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,4BAA4B,CAAC;AAEpC,KAAK,kBAAkB,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,qCAAqC,GAAE,OAAe,GACrD,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,QAEA;AAED,wBAAgB,MAAM,CACpB,OAAO,EAAE,YAAY,EAAE,EACvB,MAAM,EAAE;IACN,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,GACA,OAAO,CAAC,UAAU,CAAC,CASrB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAM3B;AAED,wBAAgB,OAAO,IAA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YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,GAClB,CAAC"}
@@ -1,9 +1,14 @@
1
1
  import type { TurboModule } from 'react-native';
2
- export type SignInOption = 'passkeys' | 'password' | 'google-signin';
2
+ export type SignInOption = 'passkeys' | 'password' | 'google-signin' | 'apple-signin';
3
3
  type CredObject = {
4
4
  username: string;
5
5
  password: string;
6
6
  };
7
+ type PasswordCredential = {
8
+ type: 'password';
9
+ username: string;
10
+ password: string;
11
+ };
7
12
  type PasskeyCredential = {
8
13
  type: 'passkey';
9
14
  authenticationResponseJson: string;
@@ -23,20 +28,57 @@ export type GoogleCredential = {
23
28
  profilePicture?: string;
24
29
  phoneNumber?: string;
25
30
  };
26
- type PasswordCredential = {
27
- type: 'password';
28
- username: string;
29
- password: string;
31
+ type AppleSignInParams = {
32
+ nonce: string;
33
+ requestedScopes: string[];
34
+ };
35
+ export type AppleCredential = {
36
+ type: 'apple-signin';
37
+ id: string;
38
+ idToken: string;
39
+ displayName?: string;
40
+ familyName?: string;
41
+ givenName?: string;
42
+ email?: string;
30
43
  };
31
- export type Credential = PasskeyCredential | PasswordCredential | GoogleCredential;
44
+ export type Credential = PasskeyCredential | PasswordCredential | GoogleCredential | AppleCredential;
32
45
  export interface Spec extends TurboModule {
46
+ /**
47
+ * Sign up with passkeys (supported on both Android and iOS)
48
+ * @param requestJson WebAuthn request object
49
+ * @param preferImmediatelyAvailableCredentials Android-specific parameter, ignored on iOS
50
+ */
33
51
  signUpWithPasskeys(requestJson: Object, preferImmediatelyAvailableCredentials: boolean): Promise<Object>;
34
- signUpWithPassword(credObject: CredObject): void;
52
+ /**
53
+ * Sign up with password (Android only - not supported on iOS)
54
+ * iOS will reject with UNSUPPORTED_OPERATION error
55
+ */
56
+ signUpWithPassword(credObject: CredObject): Promise<Object>;
57
+ /**
58
+ * Sign in with various methods
59
+ * - 'passkeys': Supported on both platforms
60
+ * - 'password': Supported on both platforms (uses AutoFill)
61
+ * - 'google-signin': Android only
62
+ * - 'apple-signin': iOS only (not available on Android)
63
+ */
35
64
  signIn(options: SignInOption[], params: {
36
65
  passkeys?: Object;
37
66
  googleSignIn?: GoogleSignInParams;
67
+ appleSignIn?: AppleSignInParams;
38
68
  }): Promise<Credential>;
69
+ /**
70
+ * Sign up with Google (Android-specific implementation)
71
+ */
39
72
  signUpWithGoogle(params: GoogleSignInParams): Promise<GoogleCredential>;
73
+ /**
74
+ * Sign up with Apple (iOS-specific implementation)
75
+ * Will reject with UNSUPPORTED_OPERATION on Android
76
+ */
77
+ signUpWithApple(params: AppleSignInParams): Promise<AppleCredential>;
78
+ /**
79
+ * Sign out (behavior varies by platform)
80
+ * On iOS, this is a no-op as AuthenticationServices doesn't provide a sign-out method
81
+ */
40
82
  signOut(): Promise<null>;
41
83
  }
42
84
  declare const _default: Spec;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeCredentialsManager.d.ts","sourceRoot":"","sources":["../../../../src/NativeCredentialsManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,eAAe,CAAC;AAErE,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,SAAS,CAAC;IAChB,0BAA0B,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,CAAC;AAErB,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,kBAAkB,CAChB,WAAW,EAAE,MAAM,EACnB,qCAAqC,EAAE,OAAO,GAC7C,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAEjD,MAAM,CACJ,OAAO,EAAE,YAAY,EAAE,EACvB,MAAM,EAAE;QACN,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,kBAAkB,CAAC;KACnC,GACA,OAAO,CAAC,UAAU,CAAC,CAAC;IACvB,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACxE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;;AAED,wBAA4E"}
1
+ {"version":3,"file":"NativeCredentialsManager.d.ts","sourceRoot":"","sources":["../../../../src/NativeCredentialsManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,MAAM,YAAY,GACpB,UAAU,GACV,UAAU,GACV,eAAe,GACf,cAAc,CAAC;AAGnB,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA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