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.
- package/README.md +362 -190
- package/android/src/main/java/com/auth/AuthAdapter.kt +55 -169
- package/android/src/main/java/com/auth/NitroAuthPackage.kt +1 -1
- package/app.plugin.js +2 -9
- package/cpp/AuthCache.cpp +12 -102
- package/cpp/HybridAuth.cpp +37 -61
- package/cpp/HybridAuth.hpp +2 -4
- package/ios/AuthAdapter.swift +21 -25
- package/lib/commonjs/Auth.web.js +433 -164
- package/lib/commonjs/Auth.web.js.map +1 -1
- package/lib/commonjs/index.js +0 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +0 -12
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/js-storage-adapter.js +2 -0
- package/lib/commonjs/js-storage-adapter.js.map +1 -0
- package/lib/commonjs/service.js +7 -84
- package/lib/commonjs/service.js.map +1 -1
- package/lib/commonjs/service.web.js +1 -5
- package/lib/commonjs/service.web.js.map +1 -1
- package/lib/commonjs/ui/social-button.js +44 -29
- package/lib/commonjs/ui/social-button.js.map +1 -1
- package/lib/commonjs/ui/social-button.web.js +44 -29
- package/lib/commonjs/ui/social-button.web.js.map +1 -1
- package/lib/commonjs/use-auth.js +8 -2
- package/lib/commonjs/use-auth.js.map +1 -1
- package/lib/commonjs/utils/logger.js +12 -4
- package/lib/commonjs/utils/logger.js.map +1 -1
- package/lib/module/Auth.web.js +433 -164
- package/lib/module/Auth.web.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +0 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/js-storage-adapter.js +2 -0
- package/lib/module/js-storage-adapter.js.map +1 -0
- package/lib/module/service.js +7 -84
- package/lib/module/service.js.map +1 -1
- package/lib/module/service.web.js +1 -5
- package/lib/module/service.web.js.map +1 -1
- package/lib/module/ui/social-button.js +44 -29
- package/lib/module/ui/social-button.js.map +1 -1
- package/lib/module/ui/social-button.web.js +44 -29
- package/lib/module/ui/social-button.web.js.map +1 -1
- package/lib/module/use-auth.js +8 -2
- package/lib/module/use-auth.js.map +1 -1
- package/lib/module/utils/logger.js +12 -4
- package/lib/module/utils/logger.js.map +1 -1
- package/lib/typescript/commonjs/Auth.nitro.d.ts +3 -3
- package/lib/typescript/commonjs/Auth.nitro.d.ts.map +1 -1
- package/lib/typescript/commonjs/Auth.web.d.ts +18 -6
- package/lib/typescript/commonjs/Auth.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -2
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +0 -1
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/js-storage-adapter.d.ts +6 -0
- package/lib/typescript/commonjs/js-storage-adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/service.d.ts +1 -8
- package/lib/typescript/commonjs/service.d.ts.map +1 -1
- package/lib/typescript/commonjs/service.web.d.ts +1 -8
- package/lib/typescript/commonjs/service.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/social-button.d.ts +6 -6
- package/lib/typescript/commonjs/ui/social-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/social-button.web.d.ts +6 -6
- package/lib/typescript/commonjs/ui/social-button.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/use-auth.d.ts +4 -4
- package/lib/typescript/commonjs/use-auth.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/logger.d.ts +4 -4
- package/lib/typescript/commonjs/utils/logger.d.ts.map +1 -1
- package/lib/typescript/module/Auth.nitro.d.ts +3 -3
- package/lib/typescript/module/Auth.nitro.d.ts.map +1 -1
- package/lib/typescript/module/Auth.web.d.ts +18 -6
- package/lib/typescript/module/Auth.web.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -2
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +0 -1
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/js-storage-adapter.d.ts +6 -0
- package/lib/typescript/module/js-storage-adapter.d.ts.map +1 -0
- package/lib/typescript/module/service.d.ts +1 -8
- package/lib/typescript/module/service.d.ts.map +1 -1
- package/lib/typescript/module/service.web.d.ts +1 -8
- package/lib/typescript/module/service.web.d.ts.map +1 -1
- package/lib/typescript/module/ui/social-button.d.ts +6 -6
- package/lib/typescript/module/ui/social-button.d.ts.map +1 -1
- package/lib/typescript/module/ui/social-button.web.d.ts +6 -6
- package/lib/typescript/module/ui/social-button.web.d.ts.map +1 -1
- package/lib/typescript/module/use-auth.d.ts +4 -4
- package/lib/typescript/module/use-auth.d.ts.map +1 -1
- package/lib/typescript/module/utils/logger.d.ts +4 -4
- package/lib/typescript/module/utils/logger.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroAuth+autolinking.cmake +0 -1
- package/nitrogen/generated/shared/c++/AuthTokens.hpp +5 -1
- package/nitrogen/generated/shared/c++/AuthUser.hpp +5 -1
- package/nitrogen/generated/shared/c++/HybridAuthSpec.cpp +0 -1
- package/nitrogen/generated/shared/c++/HybridAuthSpec.hpp +0 -5
- package/package.json +11 -8
- package/src/Auth.nitro.ts +4 -3
- package/src/Auth.web.ts +582 -202
- package/src/global.d.ts +0 -1
- package/src/index.ts +1 -2
- package/src/index.web.ts +0 -1
- package/src/js-storage-adapter.ts +5 -0
- package/src/service.ts +11 -104
- package/src/service.web.ts +0 -7
- package/src/ui/social-button.tsx +66 -43
- package/src/ui/social-button.web.tsx +67 -44
- package/src/use-auth.ts +18 -6
- package/src/utils/logger.ts +12 -4
- package/lib/commonjs/AuthStorage.nitro.js +0 -6
- package/lib/commonjs/AuthStorage.nitro.js.map +0 -1
- package/lib/module/AuthStorage.nitro.js +0 -4
- package/lib/module/AuthStorage.nitro.js.map +0 -1
- package/lib/typescript/commonjs/AuthStorage.nitro.d.ts +0 -26
- package/lib/typescript/commonjs/AuthStorage.nitro.d.ts.map +0 -1
- package/lib/typescript/module/AuthStorage.nitro.d.ts +0 -26
- package/lib/typescript/module/AuthStorage.nitro.d.ts.map +0 -1
- package/nitrogen/generated/shared/c++/HybridAuthStorageAdapterSpec.cpp +0 -23
- package/nitrogen/generated/shared/c++/HybridAuthStorageAdapterSpec.hpp +0 -65
- 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
|
package/src/AuthStorage.nitro.ts
DELETED
|
@@ -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
|
-
}
|