@multiplatform.one/keycloak 0.7.15 → 0.7.16

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 (155) hide show
  1. package/package.json +26 -26
  2. package/routes/index.d.ts +22 -0
  3. package/routes/index.js +22 -0
  4. package/src/Authenticated.tsx +27 -17
  5. package/src/authConfig.ts +3 -9
  6. package/src/hooks/index.ts +0 -3
  7. package/src/hooks/useTokensFromQuery/index.ts +1 -0
  8. package/src/hooks/useTokensFromState.ts +1 -1
  9. package/src/index.ts +3 -0
  10. package/src/{@types/coreJsPure.d.ts → keycloak/context.ts} +6 -11
  11. package/{lib/@types/expoKeycloakAuth.d.d.mts → src/keycloak/index.ts} +4 -7
  12. package/src/keycloak/keycloak.native.ts +148 -0
  13. package/src/keycloak/keycloak.ts +175 -0
  14. package/src/provider/AfterAuth.tsx +63 -0
  15. package/src/provider/{keycloakProvider.native.tsx → AuthProvider/AuthProvider.native.tsx} +8 -16
  16. package/src/provider/{keycloakProvider.tsx → AuthProvider/AuthProvider.tsx} +81 -94
  17. package/{lib/@types/expoKeycloakAuth.d.d.ts → src/provider/AuthProvider/index.ts} +4 -7
  18. package/src/provider/KeycloakProvider.tsx +53 -0
  19. package/src/{hooks/useCurrentRouteName/index.native.ts → provider/index.ts} +6 -11
  20. package/src/routes.ts +163 -0
  21. package/src/session/index.ts +22 -0
  22. package/src/session/session.native.ts +31 -0
  23. package/src/session/session.ts +68 -0
  24. package/src/{state/index.ts → state.ts} +5 -4
  25. package/src/{util.ts → token.ts} +25 -11
  26. package/src/types.ts +4 -1
  27. package/lib/@types/coreJsPure.d.d.mts +0 -2
  28. package/lib/@types/coreJsPure.d.d.ts +0 -2
  29. package/lib/@types/coreJsPure.d.js +0 -1
  30. package/lib/@types/coreJsPure.d.mjs +0 -0
  31. package/lib/@types/expoKeycloakAuth.d.js +0 -1
  32. package/lib/@types/expoKeycloakAuth.d.mjs +0 -0
  33. package/lib/Authenticated.d.mts +0 -33
  34. package/lib/Authenticated.d.ts +0 -33
  35. package/lib/Authenticated.js +0 -19
  36. package/lib/Authenticated.mjs +0 -20
  37. package/lib/authConfig.d.mts +0 -14
  38. package/lib/authConfig.d.ts +0 -14
  39. package/lib/authConfig.js +0 -8
  40. package/lib/authConfig.mjs +0 -9
  41. package/lib/chunk-2GUOEPFY.mjs +0 -0
  42. package/lib/chunk-3ZPHNEJL.js +0 -11
  43. package/lib/chunk-64PPU7Q3.mjs +0 -13
  44. package/lib/chunk-6NDWOV55.js +0 -1
  45. package/lib/chunk-7MTPH6XK.mjs +0 -26
  46. package/lib/chunk-A7UBOIAL.js +0 -13
  47. package/lib/chunk-AD6VPMID.mjs +0 -20
  48. package/lib/chunk-AUUZ6BI7.js +0 -78
  49. package/lib/chunk-AYKQVWMR.mjs +0 -0
  50. package/lib/chunk-BVB33X7V.mjs +0 -265
  51. package/lib/chunk-C2FNSVJO.js +0 -17
  52. package/lib/chunk-J4CCMILN.mjs +0 -41
  53. package/lib/chunk-K33RKJZX.js +0 -443
  54. package/lib/chunk-KLLABHIC.js +0 -13
  55. package/lib/chunk-L5HMOY4M.mjs +0 -18
  56. package/lib/chunk-MZ6E62HK.js +0 -33
  57. package/lib/chunk-NWRANDZ6.js +0 -98
  58. package/lib/chunk-NXTVYIBR.mjs +0 -11
  59. package/lib/chunk-OYWAYMFN.js +0 -17
  60. package/lib/chunk-RPUOO7AV.mjs +0 -10
  61. package/lib/chunk-RYM7KERK.mjs +0 -52
  62. package/lib/chunk-UBVYEZI3.js +0 -1
  63. package/lib/chunk-UHTKOFS6.mjs +0 -84
  64. package/lib/chunk-UL6L5ONI.js +0 -460
  65. package/lib/chunk-UOKDJT5L.mjs +0 -16
  66. package/lib/chunk-W5DJLFTQ.js +0 -56
  67. package/lib/chunk-WT5W6BSZ.js +0 -161
  68. package/lib/chunk-XEO3YXBM.js +0 -22
  69. package/lib/chunk-XO4W2SMN.mjs +0 -50
  70. package/lib/chunk-XVPWAAZ4.mjs +0 -76
  71. package/lib/chunk-Y4XMF3R6.mjs +0 -13
  72. package/lib/chunk-YGNNHTFE.js +0 -12
  73. package/lib/hooks/index.d.mts +0 -9
  74. package/lib/hooks/index.d.ts +0 -9
  75. package/lib/hooks/index.js +0 -23
  76. package/lib/hooks/index.mjs +0 -34
  77. package/lib/hooks/useAuthConfig.d.mts +0 -6
  78. package/lib/hooks/useAuthConfig.d.ts +0 -6
  79. package/lib/hooks/useAuthConfig.js +0 -8
  80. package/lib/hooks/useAuthConfig.mjs +0 -8
  81. package/lib/hooks/useCurrentRouteName/index.d.mts +0 -3
  82. package/lib/hooks/useCurrentRouteName/index.d.ts +0 -3
  83. package/lib/hooks/useCurrentRouteName/index.js +0 -7
  84. package/lib/hooks/useCurrentRouteName/index.mjs +0 -7
  85. package/lib/hooks/useCurrentRouteName/index.native.d.mts +0 -3
  86. package/lib/hooks/useCurrentRouteName/index.native.d.ts +0 -3
  87. package/lib/hooks/useCurrentRouteName/index.native.js +0 -14
  88. package/lib/hooks/useCurrentRouteName/index.native.mjs +0 -14
  89. package/lib/hooks/useKeycloak/index.d.mts +0 -46
  90. package/lib/hooks/useKeycloak/index.d.ts +0 -46
  91. package/lib/hooks/useKeycloak/index.js +0 -11
  92. package/lib/hooks/useKeycloak/index.mjs +0 -12
  93. package/lib/hooks/useKeycloak/useKeycloak.d.mts +0 -2
  94. package/lib/hooks/useKeycloak/useKeycloak.d.ts +0 -2
  95. package/lib/hooks/useKeycloak/useKeycloak.js +0 -10
  96. package/lib/hooks/useKeycloak/useKeycloak.mjs +0 -11
  97. package/lib/hooks/useKeycloak/useKeycloak.native.d.mts +0 -20
  98. package/lib/hooks/useKeycloak/useKeycloak.native.d.ts +0 -20
  99. package/lib/hooks/useKeycloak/useKeycloak.native.js +0 -80
  100. package/lib/hooks/useKeycloak/useKeycloak.native.mjs +0 -69
  101. package/lib/hooks/useLogin.d.mts +0 -3
  102. package/lib/hooks/useLogin.d.ts +0 -3
  103. package/lib/hooks/useLogin.js +0 -11
  104. package/lib/hooks/useLogin.mjs +0 -11
  105. package/lib/hooks/useTokensFromQuery/index.d.mts +0 -3
  106. package/lib/hooks/useTokensFromQuery/index.d.ts +0 -3
  107. package/lib/hooks/useTokensFromQuery/index.js +0 -7
  108. package/lib/hooks/useTokensFromQuery/index.mjs +0 -7
  109. package/lib/hooks/useTokensFromQuery/index.native.d.mts +0 -3
  110. package/lib/hooks/useTokensFromQuery/index.native.d.ts +0 -3
  111. package/lib/hooks/useTokensFromQuery/index.native.js +0 -10
  112. package/lib/hooks/useTokensFromQuery/index.native.mjs +0 -7
  113. package/lib/hooks/useTokensFromState.d.mts +0 -3
  114. package/lib/hooks/useTokensFromState.d.ts +0 -3
  115. package/lib/hooks/useTokensFromState.js +0 -9
  116. package/lib/hooks/useTokensFromState.mjs +0 -9
  117. package/lib/index.d.mts +0 -13
  118. package/lib/index.d.ts +0 -13
  119. package/lib/index.js +0 -34
  120. package/lib/index.mjs +0 -56
  121. package/lib/provider/afterAuth.d.mts +0 -29
  122. package/lib/provider/afterAuth.d.ts +0 -29
  123. package/lib/provider/afterAuth.js +0 -18
  124. package/lib/provider/afterAuth.mjs +0 -18
  125. package/lib/provider/index.d.mts +0 -39
  126. package/lib/provider/index.d.ts +0 -39
  127. package/lib/provider/index.js +0 -22
  128. package/lib/provider/index.mjs +0 -25
  129. package/lib/provider/keycloakProvider.d.mts +0 -42
  130. package/lib/provider/keycloakProvider.d.ts +0 -42
  131. package/lib/provider/keycloakProvider.js +0 -20
  132. package/lib/provider/keycloakProvider.mjs +0 -21
  133. package/lib/provider/keycloakProvider.native.d.mts +0 -29
  134. package/lib/provider/keycloakProvider.native.d.ts +0 -29
  135. package/lib/provider/keycloakProvider.native.js +0 -87
  136. package/lib/provider/keycloakProvider.native.mjs +0 -30
  137. package/lib/state/index.d.mts +0 -11
  138. package/lib/state/index.d.ts +0 -11
  139. package/lib/state/index.js +0 -7
  140. package/lib/state/index.mjs +0 -7
  141. package/lib/types.d.mts +0 -17
  142. package/lib/types.d.ts +0 -17
  143. package/lib/types.js +0 -8
  144. package/lib/types.mjs +0 -7
  145. package/lib/util.d.mts +0 -4
  146. package/lib/util.d.ts +0 -4
  147. package/lib/util.js +0 -8
  148. package/lib/util.mjs +0 -9
  149. package/src/hooks/useCurrentRouteName/index.ts +0 -34
  150. package/src/hooks/useKeycloak/index.ts +0 -47
  151. package/src/hooks/useKeycloak/useKeycloak.native.ts +0 -95
  152. package/src/hooks/useKeycloak/useKeycloak.ts +0 -106
  153. package/src/hooks/useLogin.ts +0 -47
  154. package/src/provider/afterAuth.tsx +0 -65
  155. package/src/provider/index.tsx +0 -117
@@ -1,25 +0,0 @@
1
- import {
2
- AuthProvider
3
- } from "../chunk-XVPWAAZ4.mjs";
4
- import {
5
- KeycloakProvider,
6
- defaultKeycloakInitOptions
7
- } from "../chunk-BVB33X7V.mjs";
8
- import "../chunk-XO4W2SMN.mjs";
9
- import "../chunk-AYKQVWMR.mjs";
10
- import "../chunk-2GUOEPFY.mjs";
11
- import "../chunk-NXTVYIBR.mjs";
12
- import "../chunk-J4CCMILN.mjs";
13
- import "../chunk-L5HMOY4M.mjs";
14
- import "../chunk-UHTKOFS6.mjs";
15
- import "../chunk-Y4XMF3R6.mjs";
16
- import "../chunk-UOKDJT5L.mjs";
17
- import "../chunk-AD6VPMID.mjs";
18
- import "../chunk-64PPU7Q3.mjs";
19
- import "../chunk-7MTPH6XK.mjs";
20
- import "../chunk-RPUOO7AV.mjs";
21
- export {
22
- AuthProvider,
23
- KeycloakProvider,
24
- defaultKeycloakInitOptions
25
- };
@@ -1,42 +0,0 @@
1
- import React__default, { ReactNode, ComponentType } from 'react';
2
- import { AuthClientEvent, AuthClientError, AuthClientTokens } from '@bitspur/react-keycloak-core';
3
- import { KeycloakConfig, KeycloakInitOptions } from '@bitspur/keycloak-js';
4
-
5
- /**
6
- * File: /src/provider/keycloakProvider.tsx
7
- * Project: @multiplatform.one/keycloak
8
- * File Created: 22-06-2023 10:07:56
9
- * Author: Clay Risser
10
- * -----
11
- * BitSpur (c) Copyright 2021 - 2023
12
- *
13
- * Licensed under the Apache License, Version 2.0 (the "License");
14
- * you may not use this file except in compliance with the License.
15
- * You may obtain a copy of the License at
16
- *
17
- * http://www.apache.org/licenses/LICENSE-2.0
18
- *
19
- * Unless required by applicable law or agreed to in writing, software
20
- * distributed under the License is distributed on an "AS IS" BASIS,
21
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- * See the License for the specific language governing permissions and
23
- * limitations under the License.
24
- */
25
-
26
- interface KeycloakProviderProps {
27
- children: ReactNode;
28
- cookies?: unknown;
29
- keycloakConfig: KeycloakConfig;
30
- keycloakInitOptions?: KeycloakInitOptions;
31
- loadingComponent?: ComponentType;
32
- onEvent?: (eventType: AuthClientEvent, error?: AuthClientError) => void;
33
- onTokens?: (tokens: AuthClientTokens) => void;
34
- }
35
- declare function KeycloakProvider({ children, cookies, keycloakConfig, keycloakInitOptions, loadingComponent, onEvent, onTokens, }: KeycloakProviderProps): React__default.JSX.Element;
36
- declare const defaultKeycloakInitOptions: KeycloakInitOptions;
37
- interface MessageSchema {
38
- type: string;
39
- payload?: string;
40
- }
41
-
42
- export { KeycloakProvider, type KeycloakProviderProps, type MessageSchema, defaultKeycloakInitOptions };
@@ -1,42 +0,0 @@
1
- import React__default, { ReactNode, ComponentType } from 'react';
2
- import { AuthClientEvent, AuthClientError, AuthClientTokens } from '@bitspur/react-keycloak-core';
3
- import { KeycloakConfig, KeycloakInitOptions } from '@bitspur/keycloak-js';
4
-
5
- /**
6
- * File: /src/provider/keycloakProvider.tsx
7
- * Project: @multiplatform.one/keycloak
8
- * File Created: 22-06-2023 10:07:56
9
- * Author: Clay Risser
10
- * -----
11
- * BitSpur (c) Copyright 2021 - 2023
12
- *
13
- * Licensed under the Apache License, Version 2.0 (the "License");
14
- * you may not use this file except in compliance with the License.
15
- * You may obtain a copy of the License at
16
- *
17
- * http://www.apache.org/licenses/LICENSE-2.0
18
- *
19
- * Unless required by applicable law or agreed to in writing, software
20
- * distributed under the License is distributed on an "AS IS" BASIS,
21
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- * See the License for the specific language governing permissions and
23
- * limitations under the License.
24
- */
25
-
26
- interface KeycloakProviderProps {
27
- children: ReactNode;
28
- cookies?: unknown;
29
- keycloakConfig: KeycloakConfig;
30
- keycloakInitOptions?: KeycloakInitOptions;
31
- loadingComponent?: ComponentType;
32
- onEvent?: (eventType: AuthClientEvent, error?: AuthClientError) => void;
33
- onTokens?: (tokens: AuthClientTokens) => void;
34
- }
35
- declare function KeycloakProvider({ children, cookies, keycloakConfig, keycloakInitOptions, loadingComponent, onEvent, onTokens, }: KeycloakProviderProps): React__default.JSX.Element;
36
- declare const defaultKeycloakInitOptions: KeycloakInitOptions;
37
- interface MessageSchema {
38
- type: string;
39
- payload?: string;
40
- }
41
-
42
- export { KeycloakProvider, type KeycloakProviderProps, type MessageSchema, defaultKeycloakInitOptions };
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- var _chunkK33RKJZXjs = require("../chunk-K33RKJZX.js");
6
- require("../chunk-W5DJLFTQ.js");
7
- require("../chunk-UBVYEZI3.js");
8
- require("../chunk-6NDWOV55.js");
9
- require("../chunk-KLLABHIC.js");
10
- require("../chunk-MZ6E62HK.js");
11
- require("../chunk-OYWAYMFN.js");
12
- require("../chunk-UL6L5ONI.js");
13
- require("../chunk-3ZPHNEJL.js");
14
- require("../chunk-YGNNHTFE.js");
15
- require("../chunk-C2FNSVJO.js");
16
- require("../chunk-A7UBOIAL.js");
17
- require("../chunk-NWRANDZ6.js");
18
- require("../chunk-XEO3YXBM.js");
19
- exports.KeycloakProvider = _chunkK33RKJZXjs.KeycloakProvider;
20
- exports.defaultKeycloakInitOptions = _chunkK33RKJZXjs.defaultKeycloakInitOptions;
@@ -1,21 +0,0 @@
1
- import {
2
- KeycloakProvider,
3
- defaultKeycloakInitOptions
4
- } from "../chunk-BVB33X7V.mjs";
5
- import "../chunk-XO4W2SMN.mjs";
6
- import "../chunk-AYKQVWMR.mjs";
7
- import "../chunk-2GUOEPFY.mjs";
8
- import "../chunk-NXTVYIBR.mjs";
9
- import "../chunk-J4CCMILN.mjs";
10
- import "../chunk-L5HMOY4M.mjs";
11
- import "../chunk-UHTKOFS6.mjs";
12
- import "../chunk-Y4XMF3R6.mjs";
13
- import "../chunk-UOKDJT5L.mjs";
14
- import "../chunk-AD6VPMID.mjs";
15
- import "../chunk-64PPU7Q3.mjs";
16
- import "../chunk-7MTPH6XK.mjs";
17
- import "../chunk-RPUOO7AV.mjs";
18
- export {
19
- KeycloakProvider,
20
- defaultKeycloakInitOptions
21
- };
@@ -1,29 +0,0 @@
1
- import { FC } from 'react';
2
- import { KeycloakProviderProps } from './keycloakProvider.mjs';
3
- import '@bitspur/react-keycloak-core';
4
- import '@bitspur/keycloak-js';
5
-
6
- /**
7
- * File: /src/provider/keycloakProvider.native.tsx
8
- * Project: @multiplatform.one/keycloak
9
- * File Created: 22-06-2023 10:07:56
10
- * Author: Clay Risser
11
- * -----
12
- * BitSpur (c) Copyright 2021 - 2023
13
- *
14
- * Licensed under the Apache License, Version 2.0 (the "License");
15
- * you may not use this file except in compliance with the License.
16
- * You may obtain a copy of the License at
17
- *
18
- * http://www.apache.org/licenses/LICENSE-2.0
19
- *
20
- * Unless required by applicable law or agreed to in writing, software
21
- * distributed under the License is distributed on an "AS IS" BASIS,
22
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
- * See the License for the specific language governing permissions and
24
- * limitations under the License.
25
- */
26
-
27
- declare const KeycloakProvider: FC<KeycloakProviderProps>;
28
-
29
- export { KeycloakProvider };
@@ -1,29 +0,0 @@
1
- import { FC } from 'react';
2
- import { KeycloakProviderProps } from './keycloakProvider.js';
3
- import '@bitspur/react-keycloak-core';
4
- import '@bitspur/keycloak-js';
5
-
6
- /**
7
- * File: /src/provider/keycloakProvider.native.tsx
8
- * Project: @multiplatform.one/keycloak
9
- * File Created: 22-06-2023 10:07:56
10
- * Author: Clay Risser
11
- * -----
12
- * BitSpur (c) Copyright 2021 - 2023
13
- *
14
- * Licensed under the Apache License, Version 2.0 (the "License");
15
- * you may not use this file except in compliance with the License.
16
- * You may obtain a copy of the License at
17
- *
18
- * http://www.apache.org/licenses/LICENSE-2.0
19
- *
20
- * Unless required by applicable law or agreed to in writing, software
21
- * distributed under the License is distributed on an "AS IS" BASIS,
22
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
- * See the License for the specific language governing permissions and
24
- * limitations under the License.
25
- */
26
-
27
- declare const KeycloakProvider: FC<KeycloakProviderProps>;
28
-
29
- export { KeycloakProvider };
@@ -1,87 +0,0 @@
1
- "use strict";
2
- function _define_property(obj, key, value) {
3
- if (key in obj) {
4
- Object.defineProperty(obj, key, {
5
- value: value,
6
- enumerable: true,
7
- configurable: true,
8
- writable: true
9
- });
10
- } else {
11
- obj[key] = value;
12
- }
13
- return obj;
14
- }
15
- function _object_spread(target) {
16
- for(var i = 1; i < arguments.length; i++){
17
- var source = arguments[i] != null ? arguments[i] : {};
18
- var ownKeys = Object.keys(source);
19
- if (typeof Object.getOwnPropertySymbols === "function") {
20
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
21
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
22
- }));
23
- }
24
- ownKeys.forEach(function(key) {
25
- _define_property(target, key, source[key]);
26
- });
27
- }
28
- return target;
29
- }
30
- function ownKeys(object, enumerableOnly) {
31
- var keys = Object.keys(object);
32
- if (Object.getOwnPropertySymbols) {
33
- var symbols = Object.getOwnPropertySymbols(object);
34
- if (enumerableOnly) {
35
- symbols = symbols.filter(function(sym) {
36
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
37
- });
38
- }
39
- keys.push.apply(keys, symbols);
40
- }
41
- return keys;
42
- }
43
- function _object_spread_props(target, source) {
44
- source = source != null ? source : {};
45
- if (Object.getOwnPropertyDescriptors) {
46
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
47
- } else {
48
- ownKeys(Object(source)).forEach(function(key) {
49
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
50
- });
51
- }
52
- return target;
53
- }
54
- Object.defineProperty(exports, "__esModule", {
55
- value: true
56
- });
57
- function _interopRequireDefault(obj) {
58
- return obj && obj.__esModule ? obj : {
59
- default: obj
60
- };
61
- }
62
- var _chunkW5DJLFTQjs = require("../chunk-W5DJLFTQ.js");
63
- require("../chunk-UBVYEZI3.js");
64
- require("../chunk-6NDWOV55.js");
65
- require("../chunk-KLLABHIC.js");
66
- require("../chunk-MZ6E62HK.js");
67
- require("../chunk-OYWAYMFN.js");
68
- require("../chunk-UL6L5ONI.js");
69
- require("../chunk-3ZPHNEJL.js");
70
- require("../chunk-YGNNHTFE.js");
71
- require("../chunk-C2FNSVJO.js");
72
- require("../chunk-A7UBOIAL.js");
73
- require("../chunk-NWRANDZ6.js");
74
- require("../chunk-XEO3YXBM.js");
75
- // src/provider/keycloakProvider.native.tsx
76
- var _react = require("react");
77
- var _react2 = _interopRequireDefault(_react);
78
- var _expokeycloakauth = require("expo-keycloak-auth");
79
- var KeycloakProvider = function(param) {
80
- var children = param.children, keycloakConfig = param.keycloakConfig;
81
- var clonedKeycloakConfig = _object_spread_props(_object_spread({}, keycloakConfig), {
82
- url: keycloakConfig.url
83
- });
84
- delete keycloakConfig.baseUrl;
85
- return /* @__PURE__ */ _react2.default.createElement(_expokeycloakauth.KeycloakProvider, _object_spread({}, clonedKeycloakConfig), /* @__PURE__ */ _react2.default.createElement(_chunkW5DJLFTQjs.AfterAuth, null, children));
86
- };
87
- exports.KeycloakProvider = KeycloakProvider;
@@ -1,30 +0,0 @@
1
- import {
2
- AfterAuth
3
- } from "../chunk-XO4W2SMN.mjs";
4
- import "../chunk-AYKQVWMR.mjs";
5
- import "../chunk-2GUOEPFY.mjs";
6
- import "../chunk-NXTVYIBR.mjs";
7
- import "../chunk-J4CCMILN.mjs";
8
- import "../chunk-L5HMOY4M.mjs";
9
- import "../chunk-UHTKOFS6.mjs";
10
- import "../chunk-Y4XMF3R6.mjs";
11
- import "../chunk-UOKDJT5L.mjs";
12
- import "../chunk-AD6VPMID.mjs";
13
- import "../chunk-64PPU7Q3.mjs";
14
- import "../chunk-7MTPH6XK.mjs";
15
- import "../chunk-RPUOO7AV.mjs";
16
-
17
- // src/provider/keycloakProvider.native.tsx
18
- import React from "react";
19
- import { KeycloakProvider as ExpoKeycloakProvider } from "expo-keycloak-auth";
20
- var KeycloakProvider = ({ children, keycloakConfig }) => {
21
- const clonedKeycloakConfig = {
22
- ...keycloakConfig,
23
- url: keycloakConfig.url
24
- };
25
- delete keycloakConfig.baseUrl;
26
- return /* @__PURE__ */ React.createElement(ExpoKeycloakProvider, { ...clonedKeycloakConfig }, /* @__PURE__ */ React.createElement(AfterAuth, null, children));
27
- };
28
- export {
29
- KeycloakProvider
30
- };
@@ -1,11 +0,0 @@
1
- declare function useAuthState(): {
2
- idToken: string;
3
- refreshToken: string;
4
- token: string;
5
- } & {
6
- setIdToken: (value: string) => void;
7
- setRefreshToken: (value: string) => void;
8
- setToken: (value: string) => void;
9
- } & Record<string, Function>;
10
-
11
- export { useAuthState };
@@ -1,11 +0,0 @@
1
- declare function useAuthState(): {
2
- idToken: string;
3
- refreshToken: string;
4
- token: string;
5
- } & {
6
- setIdToken: (value: string) => void;
7
- setRefreshToken: (value: string) => void;
8
- setToken: (value: string) => void;
9
- } & Record<string, Function>;
10
-
11
- export { useAuthState };
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- var _chunkC2FNSVJOjs = require("../chunk-C2FNSVJO.js");
6
- require("../chunk-XEO3YXBM.js");
7
- exports.useAuthState = _chunkC2FNSVJOjs.useAuthState;
@@ -1,7 +0,0 @@
1
- import {
2
- useAuthState
3
- } from "../chunk-AD6VPMID.mjs";
4
- import "../chunk-RPUOO7AV.mjs";
5
- export {
6
- useAuthState
7
- };
package/lib/types.d.mts DELETED
@@ -1,17 +0,0 @@
1
- declare global {
2
- interface Window {
3
- ReactNativeWebView: {
4
- postMessage: (body: string) => unknown;
5
- };
6
- webkit: {
7
- messageHandlers: {
8
- [key: string]: {
9
- postMessage: (body: string) => unknown;
10
- };
11
- };
12
- };
13
- }
14
- }
15
- declare const _default: null;
16
-
17
- export { _default as default };
package/lib/types.d.ts DELETED
@@ -1,17 +0,0 @@
1
- declare global {
2
- interface Window {
3
- ReactNativeWebView: {
4
- postMessage: (body: string) => unknown;
5
- };
6
- webkit: {
7
- messageHandlers: {
8
- [key: string]: {
9
- postMessage: (body: string) => unknown;
10
- };
11
- };
12
- };
13
- }
14
- }
15
- declare const _default: null;
16
-
17
- export { _default as default };
package/lib/types.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- require("./chunk-XEO3YXBM.js");
6
- // src/types.ts
7
- var types_default = null;
8
- exports.default = types_default;
package/lib/types.mjs DELETED
@@ -1,7 +0,0 @@
1
- import "./chunk-RPUOO7AV.mjs";
2
-
3
- // src/types.ts
4
- var types_default = null;
5
- export {
6
- types_default as default
7
- };
package/lib/util.d.mts DELETED
@@ -1,4 +0,0 @@
1
- declare function validToken(token: string | boolean, refreshToken?: string | boolean): string | boolean;
2
- declare function isTokenValid(token: string): boolean;
3
-
4
- export { isTokenValid, validToken };
package/lib/util.d.ts DELETED
@@ -1,4 +0,0 @@
1
- declare function validToken(token: string | boolean, refreshToken?: string | boolean): string | boolean;
2
- declare function isTokenValid(token: string): boolean;
3
-
4
- export { isTokenValid, validToken };
package/lib/util.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- var _chunkNWRANDZ6js = require("./chunk-NWRANDZ6.js");
6
- require("./chunk-XEO3YXBM.js");
7
- exports.isTokenValid = _chunkNWRANDZ6js.isTokenValid;
8
- exports.validToken = _chunkNWRANDZ6js.validToken;
package/lib/util.mjs DELETED
@@ -1,9 +0,0 @@
1
- import {
2
- isTokenValid,
3
- validToken
4
- } from "./chunk-7MTPH6XK.mjs";
5
- import "./chunk-RPUOO7AV.mjs";
6
- export {
7
- isTokenValid,
8
- validToken
9
- };
@@ -1,34 +0,0 @@
1
- /*
2
- * File: /src/hooks/useCurrentRouteName/index.ts
3
- * Project: @multiplatform.one/keycloak
4
- * File Created: 22-06-2023 10:07:56
5
- * Author: Clay Risser
6
- * -----
7
- * BitSpur (c) Copyright 2021 - 2023
8
- *
9
- * Licensed under the Apache License, Version 2.0 (the "License");
10
- * you may not use this file except in compliance with the License.
11
- * You may obtain a copy of the License at
12
- *
13
- * http://www.apache.org/licenses/LICENSE-2.0
14
- *
15
- * Unless required by applicable law or agreed to in writing, software
16
- * distributed under the License is distributed on an "AS IS" BASIS,
17
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- * See the License for the specific language governing permissions and
19
- * limitations under the License.
20
- */
21
-
22
- import { MultiPlatform } from 'multiplatform.one';
23
- import { useRoute } from '@react-navigation/native';
24
- import { useRouter } from 'next/router';
25
-
26
- export function useCurrentRouteName() {
27
- if (MultiPlatform.isStorybook) return null;
28
- if (MultiPlatform.isNext) {
29
- const router = useRouter();
30
- return router.route;
31
- }
32
- const route = useRoute();
33
- return route.name;
34
- }
@@ -1,47 +0,0 @@
1
- /*
2
- * File: /src/hooks/useKeycloak/index.ts
3
- * Project: @multiplatform.one/keycloak
4
- * File Created: 22-06-2023 10:07:56
5
- * Author: Clay Risser
6
- * -----
7
- * BitSpur (c) Copyright 2021 - 2023
8
- *
9
- * Licensed under the Apache License, Version 2.0 (the "License");
10
- * you may not use this file except in compliance with the License.
11
- * You may obtain a copy of the License at
12
- *
13
- * http://www.apache.org/licenses/LICENSE-2.0
14
- *
15
- * Unless required by applicable law or agreed to in writing, software
16
- * distributed under the License is distributed on an "AS IS" BASIS,
17
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- * See the License for the specific language governing permissions and
19
- * limitations under the License.
20
- */
21
-
22
- import type { KeycloakResourceAccess, KeycloakRoles, KeycloakTokenParsed } from '@bitspur/keycloak-js';
23
- export * from './useKeycloak';
24
-
25
- export interface IKeycloak {
26
- authenticated?: boolean;
27
- idToken?: string;
28
- realmAccess?: KeycloakRoles;
29
- refreshToken?: string;
30
- refreshTokenParsed?: KeycloakTokenParsed;
31
- resourceAccess?: KeycloakResourceAccess;
32
- subject?: string;
33
- token?: string;
34
- tokenParsed?: ITokenParsed;
35
- email?: string;
36
- username?: string;
37
- login: () => Promise<unknown>;
38
- logout: () => Promise<unknown>;
39
- }
40
-
41
- export interface ITokenParsed extends KeycloakTokenParsed {
42
- 'allowed-origins'?: string[];
43
- email_verified?: boolean;
44
- preferred_username?: string;
45
- scope?: string;
46
- sid?: string;
47
- }
@@ -1,95 +0,0 @@
1
- /*
2
- * File: /src/hooks/useKeycloak/useKeycloak.native.ts
3
- * Project: @multiplatform.one/keycloak
4
- * File Created: 22-06-2023 10:07:56
5
- * Author: Clay Risser
6
- * -----
7
- * BitSpur (c) Copyright 2021 - 2023
8
- *
9
- * Licensed under the Apache License, Version 2.0 (the "License");
10
- * you may not use this file except in compliance with the License.
11
- * You may obtain a copy of the License at
12
- *
13
- * http://www.apache.org/licenses/LICENSE-2.0
14
- *
15
- * Unless required by applicable law or agreed to in writing, software
16
- * distributed under the License is distributed on an "AS IS" BASIS,
17
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- * See the License for the specific language governing permissions and
19
- * limitations under the License.
20
- */
21
-
22
- import atob from 'core-js-pure/stable/atob';
23
- import escape from 'core-js-pure/stable/escape';
24
- import type { AuthRequestPromptOptions, AuthSessionResult } from 'expo-auth-session';
25
- import type { IKeycloak } from './index';
26
- import type { KeycloakResourceAccess, KeycloakRoles, KeycloakTokenParsed } from '@bitspur/keycloak-js';
27
- import { MultiPlatform } from 'multiplatform.one';
28
- import { useKeycloak as useExpoKeycloak } from 'expo-keycloak-auth';
29
-
30
- export function useKeycloak() {
31
- if (MultiPlatform.isStorybook) return { authenticated: true } as IKeycloak;
32
- const { ready, login, isLoggedIn, token, logout, refreshToken } = useExpoKeycloak();
33
- const keycloak = new ExpoKeycloak(ready, isLoggedIn, login, logout, token || undefined, refreshToken || undefined);
34
- return keycloak as IKeycloak;
35
- }
36
-
37
- export class ExpoKeycloak implements IKeycloak {
38
- authenticated?: boolean;
39
-
40
- tokenParsed?: KeycloakTokenParsed;
41
-
42
- refreshTokenParsed?: KeycloakTokenParsed;
43
-
44
- subject?: string;
45
-
46
- realmAccess?: KeycloakRoles;
47
-
48
- resourceAccess?: KeycloakResourceAccess;
49
-
50
- login: () => Promise<unknown>;
51
-
52
- constructor(
53
- ready: boolean,
54
- isLoggedIn: boolean | undefined,
55
- login: (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult | undefined>,
56
- public logout: () => Promise<unknown>,
57
- public token?: string,
58
- public refreshToken?: string,
59
- ) {
60
- if (ready) this.authenticated = isLoggedIn;
61
- if (this.authenticated) {
62
- if (this.token) this.tokenParsed = decodeToken(this.token);
63
- if (this.refreshToken) {
64
- this.refreshTokenParsed = decodeToken(this.refreshToken);
65
- }
66
- if (this.tokenParsed) {
67
- this.subject = this.tokenParsed.sub;
68
- this.realmAccess = this.tokenParsed.realm_access;
69
- this.resourceAccess = this.tokenParsed.resource_access;
70
- }
71
- }
72
- this.login = () => login();
73
- }
74
- }
75
-
76
- function decodeToken(str: string) {
77
- str = str.split('.')[1];
78
- str = str.replace(/-/g, '+');
79
- str = str.replace(/_/g, '/');
80
- switch (str.length % 4) {
81
- case 0:
82
- break;
83
- case 2:
84
- str += '==';
85
- break;
86
- case 3:
87
- str += '=';
88
- break;
89
- default:
90
- throw 'Invalid token';
91
- }
92
- str = decodeURIComponent(escape(atob(str)));
93
- str = JSON.parse(str);
94
- return str as unknown as KeycloakTokenParsed;
95
- }