react-native-nitro-auth 0.5.1 → 0.5.3

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 (121) hide show
  1. package/README.md +362 -190
  2. package/android/src/main/java/com/auth/AuthAdapter.kt +55 -169
  3. package/android/src/main/java/com/auth/NitroAuthPackage.kt +1 -1
  4. package/app.plugin.js +2 -9
  5. package/cpp/AuthCache.cpp +12 -102
  6. package/cpp/HybridAuth.cpp +37 -61
  7. package/cpp/HybridAuth.hpp +2 -4
  8. package/ios/AuthAdapter.swift +21 -25
  9. package/lib/commonjs/Auth.web.js +433 -164
  10. package/lib/commonjs/Auth.web.js.map +1 -1
  11. package/lib/commonjs/index.js +0 -12
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/index.web.js +0 -12
  14. package/lib/commonjs/index.web.js.map +1 -1
  15. package/lib/commonjs/js-storage-adapter.js +2 -0
  16. package/lib/commonjs/js-storage-adapter.js.map +1 -0
  17. package/lib/commonjs/service.js +7 -84
  18. package/lib/commonjs/service.js.map +1 -1
  19. package/lib/commonjs/service.web.js +1 -5
  20. package/lib/commonjs/service.web.js.map +1 -1
  21. package/lib/commonjs/ui/social-button.js +44 -29
  22. package/lib/commonjs/ui/social-button.js.map +1 -1
  23. package/lib/commonjs/ui/social-button.web.js +44 -29
  24. package/lib/commonjs/ui/social-button.web.js.map +1 -1
  25. package/lib/commonjs/use-auth.js +8 -2
  26. package/lib/commonjs/use-auth.js.map +1 -1
  27. package/lib/commonjs/utils/logger.js +12 -4
  28. package/lib/commonjs/utils/logger.js.map +1 -1
  29. package/lib/module/Auth.web.js +433 -164
  30. package/lib/module/Auth.web.js.map +1 -1
  31. package/lib/module/index.js +0 -1
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/module/index.web.js +0 -1
  34. package/lib/module/index.web.js.map +1 -1
  35. package/lib/module/js-storage-adapter.js +2 -0
  36. package/lib/module/js-storage-adapter.js.map +1 -0
  37. package/lib/module/service.js +7 -84
  38. package/lib/module/service.js.map +1 -1
  39. package/lib/module/service.web.js +1 -5
  40. package/lib/module/service.web.js.map +1 -1
  41. package/lib/module/ui/social-button.js +44 -29
  42. package/lib/module/ui/social-button.js.map +1 -1
  43. package/lib/module/ui/social-button.web.js +44 -29
  44. package/lib/module/ui/social-button.web.js.map +1 -1
  45. package/lib/module/use-auth.js +8 -2
  46. package/lib/module/use-auth.js.map +1 -1
  47. package/lib/module/utils/logger.js +12 -4
  48. package/lib/module/utils/logger.js.map +1 -1
  49. package/lib/typescript/commonjs/Auth.nitro.d.ts +3 -3
  50. package/lib/typescript/commonjs/Auth.nitro.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/Auth.web.d.ts +18 -6
  52. package/lib/typescript/commonjs/Auth.web.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/index.d.ts +1 -2
  54. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  55. package/lib/typescript/commonjs/index.web.d.ts +0 -1
  56. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  57. package/lib/typescript/commonjs/js-storage-adapter.d.ts +6 -0
  58. package/lib/typescript/commonjs/js-storage-adapter.d.ts.map +1 -0
  59. package/lib/typescript/commonjs/service.d.ts +1 -8
  60. package/lib/typescript/commonjs/service.d.ts.map +1 -1
  61. package/lib/typescript/commonjs/service.web.d.ts +1 -8
  62. package/lib/typescript/commonjs/service.web.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/ui/social-button.d.ts +6 -6
  64. package/lib/typescript/commonjs/ui/social-button.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/ui/social-button.web.d.ts +6 -6
  66. package/lib/typescript/commonjs/ui/social-button.web.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/use-auth.d.ts +4 -4
  68. package/lib/typescript/commonjs/use-auth.d.ts.map +1 -1
  69. package/lib/typescript/commonjs/utils/logger.d.ts +4 -4
  70. package/lib/typescript/commonjs/utils/logger.d.ts.map +1 -1
  71. package/lib/typescript/module/Auth.nitro.d.ts +3 -3
  72. package/lib/typescript/module/Auth.nitro.d.ts.map +1 -1
  73. package/lib/typescript/module/Auth.web.d.ts +18 -6
  74. package/lib/typescript/module/Auth.web.d.ts.map +1 -1
  75. package/lib/typescript/module/index.d.ts +1 -2
  76. package/lib/typescript/module/index.d.ts.map +1 -1
  77. package/lib/typescript/module/index.web.d.ts +0 -1
  78. package/lib/typescript/module/index.web.d.ts.map +1 -1
  79. package/lib/typescript/module/js-storage-adapter.d.ts +6 -0
  80. package/lib/typescript/module/js-storage-adapter.d.ts.map +1 -0
  81. package/lib/typescript/module/service.d.ts +1 -8
  82. package/lib/typescript/module/service.d.ts.map +1 -1
  83. package/lib/typescript/module/service.web.d.ts +1 -8
  84. package/lib/typescript/module/service.web.d.ts.map +1 -1
  85. package/lib/typescript/module/ui/social-button.d.ts +6 -6
  86. package/lib/typescript/module/ui/social-button.d.ts.map +1 -1
  87. package/lib/typescript/module/ui/social-button.web.d.ts +6 -6
  88. package/lib/typescript/module/ui/social-button.web.d.ts.map +1 -1
  89. package/lib/typescript/module/use-auth.d.ts +4 -4
  90. package/lib/typescript/module/use-auth.d.ts.map +1 -1
  91. package/lib/typescript/module/utils/logger.d.ts +4 -4
  92. package/lib/typescript/module/utils/logger.d.ts.map +1 -1
  93. package/nitrogen/generated/android/NitroAuth+autolinking.cmake +0 -1
  94. package/nitrogen/generated/shared/c++/AuthTokens.hpp +5 -1
  95. package/nitrogen/generated/shared/c++/AuthUser.hpp +5 -1
  96. package/nitrogen/generated/shared/c++/HybridAuthSpec.cpp +0 -1
  97. package/nitrogen/generated/shared/c++/HybridAuthSpec.hpp +0 -5
  98. package/package.json +11 -8
  99. package/src/Auth.nitro.ts +4 -3
  100. package/src/Auth.web.ts +582 -202
  101. package/src/global.d.ts +0 -1
  102. package/src/index.ts +1 -2
  103. package/src/index.web.ts +0 -1
  104. package/src/js-storage-adapter.ts +5 -0
  105. package/src/service.ts +11 -104
  106. package/src/service.web.ts +0 -7
  107. package/src/ui/social-button.tsx +66 -43
  108. package/src/ui/social-button.web.tsx +67 -44
  109. package/src/use-auth.ts +18 -6
  110. package/src/utils/logger.ts +12 -4
  111. package/lib/commonjs/AuthStorage.nitro.js +0 -6
  112. package/lib/commonjs/AuthStorage.nitro.js.map +0 -1
  113. package/lib/module/AuthStorage.nitro.js +0 -4
  114. package/lib/module/AuthStorage.nitro.js.map +0 -1
  115. package/lib/typescript/commonjs/AuthStorage.nitro.d.ts +0 -26
  116. package/lib/typescript/commonjs/AuthStorage.nitro.d.ts.map +0 -1
  117. package/lib/typescript/module/AuthStorage.nitro.d.ts +0 -26
  118. package/lib/typescript/module/AuthStorage.nitro.d.ts.map +0 -1
  119. package/nitrogen/generated/shared/c++/HybridAuthStorageAdapterSpec.cpp +0 -23
  120. package/nitrogen/generated/shared/c++/HybridAuthStorageAdapterSpec.hpp +0 -65
  121. package/src/AuthStorage.nitro.ts +0 -26
@@ -1,26 +0,0 @@
1
- import type { HybridObject } from "react-native-nitro-modules";
2
- /**
3
- * Custom storage adapter for persisting auth state.
4
- *
5
- * On native platforms, this must be a native HybridObject (Swift/Kotlin).
6
- * For JS-based storage (AsyncStorage, MMKV), use the JS wrapper approach
7
- * documented in the README.
8
- */
9
- export interface AuthStorageAdapter extends HybridObject<{
10
- ios: "c++";
11
- android: "c++";
12
- }> {
13
- /**
14
- * Called to save a value to the custom storage.
15
- */
16
- save(key: string, value: string): void;
17
- /**
18
- * Called to load a value from the custom storage.
19
- */
20
- load(key: string): string | undefined;
21
- /**
22
- * Called to remove a value from the custom storage.
23
- */
24
- remove(key: string): void;
25
- }
26
- //# sourceMappingURL=AuthStorage.nitro.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuthStorage.nitro.d.ts","sourceRoot":"","sources":["../../../src/AuthStorage.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY,CAAC;IACvD,GAAG,EAAE,KAAK,CAAC;IACX,OAAO,EAAE,KAAK,CAAC;CAChB,CAAC;IACA;;OAEG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC;;OAEG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B"}
@@ -1,26 +0,0 @@
1
- import type { HybridObject } from "react-native-nitro-modules";
2
- /**
3
- * Custom storage adapter for persisting auth state.
4
- *
5
- * On native platforms, this must be a native HybridObject (Swift/Kotlin).
6
- * For JS-based storage (AsyncStorage, MMKV), use the JS wrapper approach
7
- * documented in the README.
8
- */
9
- export interface AuthStorageAdapter extends HybridObject<{
10
- ios: "c++";
11
- android: "c++";
12
- }> {
13
- /**
14
- * Called to save a value to the custom storage.
15
- */
16
- save(key: string, value: string): void;
17
- /**
18
- * Called to load a value from the custom storage.
19
- */
20
- load(key: string): string | undefined;
21
- /**
22
- * Called to remove a value from the custom storage.
23
- */
24
- remove(key: string): void;
25
- }
26
- //# sourceMappingURL=AuthStorage.nitro.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuthStorage.nitro.d.ts","sourceRoot":"","sources":["../../../src/AuthStorage.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY,CAAC;IACvD,GAAG,EAAE,KAAK,CAAC;IACX,OAAO,EAAE,KAAK,CAAC;CAChB,CAAC;IACA;;OAEG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC;;OAEG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B"}
@@ -1,23 +0,0 @@
1
- ///
2
- /// HybridAuthStorageAdapterSpec.cpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © Marc Rousavy @ Margelo
6
- ///
7
-
8
- #include "HybridAuthStorageAdapterSpec.hpp"
9
-
10
- namespace margelo::nitro::NitroAuth {
11
-
12
- void HybridAuthStorageAdapterSpec::loadHybridMethods() {
13
- // load base methods/properties
14
- HybridObject::loadHybridMethods();
15
- // load custom methods/properties
16
- registerHybrids(this, [](Prototype& prototype) {
17
- prototype.registerHybridMethod("save", &HybridAuthStorageAdapterSpec::save);
18
- prototype.registerHybridMethod("load", &HybridAuthStorageAdapterSpec::load);
19
- prototype.registerHybridMethod("remove", &HybridAuthStorageAdapterSpec::remove);
20
- });
21
- }
22
-
23
- } // namespace margelo::nitro::NitroAuth
@@ -1,65 +0,0 @@
1
- ///
2
- /// HybridAuthStorageAdapterSpec.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © Marc Rousavy @ Margelo
6
- ///
7
-
8
- #pragma once
9
-
10
- #if __has_include(<NitroModules/HybridObject.hpp>)
11
- #include <NitroModules/HybridObject.hpp>
12
- #else
13
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
- #endif
15
-
16
-
17
-
18
- #include <string>
19
- #include <optional>
20
-
21
- namespace margelo::nitro::NitroAuth {
22
-
23
- using namespace margelo::nitro;
24
-
25
- /**
26
- * An abstract base class for `AuthStorageAdapter`
27
- * Inherit this class to create instances of `HybridAuthStorageAdapterSpec` in C++.
28
- * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
29
- * @example
30
- * ```cpp
31
- * class HybridAuthStorageAdapter: public HybridAuthStorageAdapterSpec {
32
- * public:
33
- * HybridAuthStorageAdapter(...): HybridObject(TAG) { ... }
34
- * // ...
35
- * };
36
- * ```
37
- */
38
- class HybridAuthStorageAdapterSpec: public virtual HybridObject {
39
- public:
40
- // Constructor
41
- explicit HybridAuthStorageAdapterSpec(): HybridObject(TAG) { }
42
-
43
- // Destructor
44
- ~HybridAuthStorageAdapterSpec() override = default;
45
-
46
- public:
47
- // Properties
48
-
49
-
50
- public:
51
- // Methods
52
- virtual void save(const std::string& key, const std::string& value) = 0;
53
- virtual std::optional<std::string> load(const std::string& key) = 0;
54
- virtual void remove(const std::string& key) = 0;
55
-
56
- protected:
57
- // Hybrid Setup
58
- void loadHybridMethods() override;
59
-
60
- protected:
61
- // Tag for logging
62
- static constexpr auto TAG = "AuthStorageAdapter";
63
- };
64
-
65
- } // namespace margelo::nitro::NitroAuth
@@ -1,26 +0,0 @@
1
- import type { HybridObject } from "react-native-nitro-modules";
2
-
3
- /**
4
- * Custom storage adapter for persisting auth state.
5
- *
6
- * On native platforms, this must be a native HybridObject (Swift/Kotlin).
7
- * For JS-based storage (AsyncStorage, MMKV), use the JS wrapper approach
8
- * documented in the README.
9
- */
10
- export interface AuthStorageAdapter extends HybridObject<{
11
- ios: "c++";
12
- android: "c++";
13
- }> {
14
- /**
15
- * Called to save a value to the custom storage.
16
- */
17
- save(key: string, value: string): void;
18
- /**
19
- * Called to load a value from the custom storage.
20
- */
21
- load(key: string): string | undefined;
22
- /**
23
- * Called to remove a value from the custom storage.
24
- */
25
- remove(key: string): void;
26
- }