@hxa-rn/rnaa 8.1.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 +21 -0
- package/README.md +159 -0
- package/harmony/rnaa/LICENSE +21 -0
- package/harmony/rnaa/NOTICE +33 -0
- package/harmony/rnaa/OAT.xml +38 -0
- package/harmony/rnaa/build-profile.json5 +19 -0
- package/harmony/rnaa/hvigorfile.ts +2 -0
- package/harmony/rnaa/index.ets +1 -0
- package/harmony/rnaa/oh-package.json5 +14 -0
- package/harmony/rnaa/src/main/cpp/CMakeLists.txt +15 -0
- package/harmony/rnaa/src/main/cpp/RNAppAuthPackage.h +13 -0
- package/harmony/rnaa/src/main/cpp/generated/RNOH/generated/BaseRnaaPackage.h +72 -0
- package/harmony/rnaa/src/main/cpp/generated/RNOH/generated/turbo_modules/RNAppAuth.cpp +22 -0
- package/harmony/rnaa/src/main/cpp/generated/RNOH/generated/turbo_modules/RNAppAuth.h +16 -0
- package/harmony/rnaa/src/main/ets/DateUtil.ets +28 -0
- package/harmony/rnaa/src/main/ets/OAuthHttpClient.ets +293 -0
- package/harmony/rnaa/src/main/ets/OAuthProtocol.ets +293 -0
- package/harmony/rnaa/src/main/ets/PKCE.ets +105 -0
- package/harmony/rnaa/src/main/ets/RNAppAuthTurboModule.ets +713 -0
- package/harmony/rnaa/src/main/ets/RNAppAuthTurboModulesFactory.ets +18 -0
- package/harmony/rnaa/src/main/ets/Types.ets +98 -0
- package/harmony/rnaa/src/main/ets/generated/index.ets +5 -0
- package/harmony/rnaa/src/main/ets/generated/ts.ts +5 -0
- package/harmony/rnaa/src/main/ets/generated/turboModules/RNAppAuth.ts +38 -0
- package/harmony/rnaa/src/main/ets/generated/turboModules/ts.ts +5 -0
- package/harmony/rnaa/src/main/module.json5 +16 -0
- package/harmony/rnaa/src/main/resources/base/element/string.json +8 -0
- package/harmony/rnaa/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/rnaa/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/rnaa.har +0 -0
- package/package.json +69 -0
- package/src/index.d.ts +202 -0
- package/src/index.js +596 -0
- package/src/specs/v1/.gitkeep +1 -0
- package/src/specs/v1/NativeRNAppAuth.ts +138 -0
- package/src/specs/v2/.gitkeep +1 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Spec for the RNAppAuth TurboModule (HarmonyOS / RN for OpenHarmony).
|
|
6
|
+
*
|
|
7
|
+
* Migrated from the legacy NativeModule (NativeModules.RNAppAuth, old arch).
|
|
8
|
+
* The Harmony TurboModule keeps Android argument ordering, minus
|
|
9
|
+
* browser-specific params (androidAllowCustomBrowsers/androidTrustedWebActivity)
|
|
10
|
+
* and iOS-specific params (additionalHeaders/iosCustomBrowser/iosPrefersEphemeralSession).
|
|
11
|
+
* warmAndPrefetchChrome is accepted but treated as no-op on Harmony.
|
|
12
|
+
*
|
|
13
|
+
* handleRedirect is an internal method (not in index.d.ts): it is bridged by
|
|
14
|
+
* the JS layer's 'url' DeviceEventEmitter listener to complete a pending
|
|
15
|
+
* authorize/logout flow after the system browser redirects back.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export interface ServiceConfiguration {
|
|
19
|
+
authorizationEndpoint?: string;
|
|
20
|
+
tokenEndpoint?: string;
|
|
21
|
+
revocationEndpoint?: string;
|
|
22
|
+
registrationEndpoint?: string;
|
|
23
|
+
endSessionEndpoint?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface CustomHeaders {
|
|
27
|
+
token?: { [key: string]: string };
|
|
28
|
+
authorize?: { [key: string]: string };
|
|
29
|
+
register?: { [key: string]: string };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface RegistrationResponse {
|
|
33
|
+
clientId: string;
|
|
34
|
+
additionalParameters?: { [name: string]: string };
|
|
35
|
+
clientIdIssuedAt?: string;
|
|
36
|
+
clientSecret?: string;
|
|
37
|
+
clientSecretExpiresAt?: string;
|
|
38
|
+
registrationAccessToken?: string;
|
|
39
|
+
registrationClientUri?: string;
|
|
40
|
+
tokenEndpointAuthMethod?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface AuthorizeResult {
|
|
44
|
+
accessToken: string;
|
|
45
|
+
accessTokenExpirationDate: string;
|
|
46
|
+
authorizeAdditionalParameters?: { [name: string]: string };
|
|
47
|
+
tokenAdditionalParameters?: { [name: string]: string };
|
|
48
|
+
idToken: string;
|
|
49
|
+
refreshToken: string;
|
|
50
|
+
tokenType: string;
|
|
51
|
+
scopes: string[];
|
|
52
|
+
authorizationCode: string;
|
|
53
|
+
codeVerifier?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface RefreshResult {
|
|
57
|
+
accessToken: string;
|
|
58
|
+
accessTokenExpirationDate: string;
|
|
59
|
+
additionalParameters?: { [name: string]: string };
|
|
60
|
+
idToken: string;
|
|
61
|
+
refreshToken: string | null;
|
|
62
|
+
tokenType: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface EndSessionResult {
|
|
66
|
+
idTokenHint: string;
|
|
67
|
+
postLogoutRedirectUri: string;
|
|
68
|
+
state: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface Spec extends TurboModule {
|
|
72
|
+
prefetchConfiguration(
|
|
73
|
+
warmAndPrefetchChrome: boolean,
|
|
74
|
+
issuer: string,
|
|
75
|
+
redirectUrl: string,
|
|
76
|
+
clientId: string,
|
|
77
|
+
scopes: string[],
|
|
78
|
+
serviceConfiguration: ServiceConfiguration,
|
|
79
|
+
dangerouslyAllowInsecureHttpRequests: boolean,
|
|
80
|
+
customHeaders: CustomHeaders,
|
|
81
|
+
connectionTimeoutMillis: number
|
|
82
|
+
): Promise<void>;
|
|
83
|
+
register(
|
|
84
|
+
issuer: string,
|
|
85
|
+
redirectUrls: string[],
|
|
86
|
+
responseTypes: string[],
|
|
87
|
+
grantTypes: string[],
|
|
88
|
+
subjectType: string,
|
|
89
|
+
tokenEndpointAuthMethod: string,
|
|
90
|
+
additionalParameters: Object,
|
|
91
|
+
serviceConfiguration: ServiceConfiguration,
|
|
92
|
+
connectionTimeoutMillis: number,
|
|
93
|
+
dangerouslyAllowInsecureHttpRequests: boolean,
|
|
94
|
+
customHeaders: CustomHeaders
|
|
95
|
+
): Promise<RegistrationResponse>;
|
|
96
|
+
authorize(
|
|
97
|
+
issuer: string,
|
|
98
|
+
redirectUrl: string,
|
|
99
|
+
clientId: string,
|
|
100
|
+
clientSecret: string,
|
|
101
|
+
scopes: string[],
|
|
102
|
+
additionalParameters: Object,
|
|
103
|
+
serviceConfiguration: ServiceConfiguration,
|
|
104
|
+
skipCodeExchange: boolean,
|
|
105
|
+
connectionTimeoutMillis: number,
|
|
106
|
+
useNonce: boolean,
|
|
107
|
+
usePKCE: boolean,
|
|
108
|
+
clientAuthMethod: string,
|
|
109
|
+
dangerouslyAllowInsecureHttpRequests: boolean,
|
|
110
|
+
customHeaders: CustomHeaders
|
|
111
|
+
): Promise<AuthorizeResult>;
|
|
112
|
+
refresh(
|
|
113
|
+
issuer: string,
|
|
114
|
+
redirectUrl: string,
|
|
115
|
+
clientId: string,
|
|
116
|
+
clientSecret: string,
|
|
117
|
+
refreshToken: string,
|
|
118
|
+
scopes: string[],
|
|
119
|
+
additionalParameters: Object,
|
|
120
|
+
serviceConfiguration: ServiceConfiguration,
|
|
121
|
+
connectionTimeoutMillis: number,
|
|
122
|
+
clientAuthMethod: string,
|
|
123
|
+
dangerouslyAllowInsecureHttpRequests: boolean,
|
|
124
|
+
customHeaders: CustomHeaders
|
|
125
|
+
): Promise<RefreshResult>;
|
|
126
|
+
logout(
|
|
127
|
+
issuer: string,
|
|
128
|
+
idTokenHint: string,
|
|
129
|
+
postLogoutRedirectUri: string,
|
|
130
|
+
serviceConfiguration: ServiceConfiguration,
|
|
131
|
+
additionalParameters: Object,
|
|
132
|
+
dangerouslyAllowInsecureHttpRequests: boolean
|
|
133
|
+
): Promise<EndSessionResult>;
|
|
134
|
+
handleRedirect(url: string): Promise<boolean>;
|
|
135
|
+
cancelPendingFlow(): Promise<boolean>;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('RNAppAuth');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# This file ensures the directory is tracked by Git
|