react-native-nitro-auth 0.5.3 → 0.5.5

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 (59) hide show
  1. package/README.md +60 -30
  2. package/android/build.gradle +2 -5
  3. package/android/src/main/cpp/JniOnLoad.cpp +3 -1
  4. package/android/src/main/cpp/PlatformAuth+Android.cpp +95 -29
  5. package/android/src/main/java/com/auth/AuthAdapter.kt +124 -126
  6. package/android/src/main/java/com/auth/NitroAuthModule.kt +8 -1
  7. package/cpp/AuthCache.cpp +0 -44
  8. package/cpp/AuthCache.hpp +0 -7
  9. package/cpp/HybridAuth.cpp +20 -2
  10. package/cpp/HybridAuth.hpp +1 -0
  11. package/ios/AuthAdapter.swift +64 -28
  12. package/lib/commonjs/Auth.web.js +96 -43
  13. package/lib/commonjs/Auth.web.js.map +1 -1
  14. package/lib/commonjs/index.js +23 -1
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/commonjs/service.js +33 -8
  17. package/lib/commonjs/service.js.map +1 -1
  18. package/lib/commonjs/use-auth.js +51 -54
  19. package/lib/commonjs/use-auth.js.map +1 -1
  20. package/lib/commonjs/utils/auth-error.js +37 -0
  21. package/lib/commonjs/utils/auth-error.js.map +1 -0
  22. package/lib/module/Auth.web.js +96 -43
  23. package/lib/module/Auth.web.js.map +1 -1
  24. package/lib/module/index.js +1 -0
  25. package/lib/module/index.js.map +1 -1
  26. package/lib/module/service.js +33 -8
  27. package/lib/module/service.js.map +1 -1
  28. package/lib/module/use-auth.js +51 -54
  29. package/lib/module/use-auth.js.map +1 -1
  30. package/lib/module/utils/auth-error.js +30 -0
  31. package/lib/module/utils/auth-error.js.map +1 -0
  32. package/lib/typescript/commonjs/Auth.web.d.ts +7 -0
  33. package/lib/typescript/commonjs/Auth.web.d.ts.map +1 -1
  34. package/lib/typescript/commonjs/index.d.ts +1 -0
  35. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  36. package/lib/typescript/commonjs/service.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/use-auth.d.ts +2 -1
  38. package/lib/typescript/commonjs/use-auth.d.ts.map +1 -1
  39. package/lib/typescript/commonjs/utils/auth-error.d.ts +16 -0
  40. package/lib/typescript/commonjs/utils/auth-error.d.ts.map +1 -0
  41. package/lib/typescript/module/Auth.web.d.ts +7 -0
  42. package/lib/typescript/module/Auth.web.d.ts.map +1 -1
  43. package/lib/typescript/module/index.d.ts +1 -0
  44. package/lib/typescript/module/index.d.ts.map +1 -1
  45. package/lib/typescript/module/service.d.ts.map +1 -1
  46. package/lib/typescript/module/use-auth.d.ts +2 -1
  47. package/lib/typescript/module/use-auth.d.ts.map +1 -1
  48. package/lib/typescript/module/utils/auth-error.d.ts +16 -0
  49. package/lib/typescript/module/utils/auth-error.d.ts.map +1 -0
  50. package/nitrogen/generated/android/NitroAuthOnLoad.cpp +22 -17
  51. package/nitrogen/generated/android/NitroAuthOnLoad.hpp +13 -4
  52. package/package.json +7 -7
  53. package/react-native-nitro-auth.podspec +1 -1
  54. package/src/Auth.web.ts +124 -50
  55. package/src/index.ts +1 -0
  56. package/src/service.ts +34 -8
  57. package/src/use-auth.ts +81 -114
  58. package/src/utils/auth-error.ts +49 -0
  59. package/ios/KeychainStore.swift +0 -43
@@ -1,43 +0,0 @@
1
- import Foundation
2
- import Security
3
-
4
- enum KeychainStore {
5
- private static let service = "react-native-nitro-auth"
6
-
7
- static func set(_ value: String, for key: String) {
8
- guard let data = value.data(using: .utf8) else { return }
9
- let baseQuery: [String: Any] = [
10
- kSecClass as String: kSecClassGenericPassword,
11
- kSecAttrService as String: service,
12
- kSecAttrAccount as String: key
13
- ]
14
- SecItemDelete(baseQuery as CFDictionary)
15
- var attributes = baseQuery
16
- attributes[kSecValueData as String] = data
17
- attributes[kSecAttrAccessible as String] = kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
18
- SecItemAdd(attributes as CFDictionary, nil)
19
- }
20
-
21
- static func get(_ key: String) -> String? {
22
- let query: [String: Any] = [
23
- kSecClass as String: kSecClassGenericPassword,
24
- kSecAttrService as String: service,
25
- kSecAttrAccount as String: key,
26
- kSecReturnData as String: kCFBooleanTrue as Any,
27
- kSecMatchLimit as String: kSecMatchLimitOne
28
- ]
29
- var item: CFTypeRef?
30
- let status = SecItemCopyMatching(query as CFDictionary, &item)
31
- guard status == errSecSuccess, let data = item as? Data else { return nil }
32
- return String(data: data, encoding: .utf8)
33
- }
34
-
35
- static func remove(_ key: String) {
36
- let query: [String: Any] = [
37
- kSecClass as String: kSecClassGenericPassword,
38
- kSecAttrService as String: service,
39
- kSecAttrAccount as String: key
40
- ]
41
- SecItemDelete(query as CFDictionary)
42
- }
43
- }