@oxyhq/services 5.17.8 → 5.17.9
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/lib/commonjs/crypto/index.js +0 -23
- package/lib/commonjs/crypto/index.js.map +1 -1
- package/lib/commonjs/index.js +0 -15
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/Icon.js.map +1 -1
- package/lib/commonjs/ui/components/IconButton/utils.js.map +1 -1
- package/lib/commonjs/ui/components/TextField/Adornment/utils.js.map +1 -1
- package/lib/commonjs/ui/components/TextField/helpers.js.map +1 -1
- package/lib/commonjs/ui/components/TouchableRipple/utils.js.map +1 -1
- package/lib/commonjs/ui/components/Typography/AnimatedText.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +23 -15
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +63 -111
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/screens/OxyAuthScreen.js +0 -1
- package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/authStore.js +52 -15
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/commonjs/ui/utils/avatarUtils.js +2 -32
- package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
- package/lib/module/crypto/index.js +4 -6
- package/lib/module/crypto/index.js.map +1 -1
- package/lib/module/index.js +6 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/Icon.js.map +1 -1
- package/lib/module/ui/components/IconButton/utils.js.map +1 -1
- package/lib/module/ui/components/TextField/Adornment/utils.js.map +1 -1
- package/lib/module/ui/components/TextField/helpers.js.map +1 -1
- package/lib/module/ui/components/TouchableRipple/utils.js.map +1 -1
- package/lib/module/ui/components/Typography/AnimatedText.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +23 -15
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +63 -111
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/screens/OxyAuthScreen.js +0 -1
- package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/module/ui/stores/authStore.js +52 -15
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/utils/avatarUtils.js +2 -32
- package/lib/module/ui/utils/avatarUtils.js.map +1 -1
- package/lib/typescript/crypto/index.d.ts +2 -5
- package/lib/typescript/crypto/index.d.ts.map +1 -1
- package/lib/typescript/crypto/types.d.ts +2 -2
- package/lib/typescript/index.d.ts +4 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/IconButton/utils.d.ts +1 -1
- package/lib/typescript/ui/components/TextField/Adornment/utils.d.ts +1 -1
- package/lib/typescript/ui/components/TextField/Adornment/utils.d.ts.map +1 -1
- package/lib/typescript/ui/components/TextField/helpers.d.ts +6 -6
- package/lib/typescript/ui/components/types.d.ts +0 -4
- package/lib/typescript/ui/components/types.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContextBase.d.ts +2 -2
- package/lib/typescript/ui/context/OxyContextBase.d.ts.map +1 -1
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts +9 -5
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/ui/stores/authStore.d.ts +27 -4
- package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/ui/utils/avatarUtils.d.ts +0 -2
- package/lib/typescript/ui/utils/avatarUtils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/crypto/index.ts +3 -11
- package/src/crypto/types.ts +2 -2
- package/src/index.ts +6 -11
- package/src/ui/components/Icon.tsx +1 -1
- package/src/ui/components/IconButton/utils.ts +1 -1
- package/src/ui/components/TextField/Adornment/utils.ts +2 -2
- package/src/ui/components/TextField/helpers.tsx +8 -8
- package/src/ui/components/TouchableRipple/utils.ts +2 -2
- package/src/ui/components/Typography/AnimatedText.tsx +2 -2
- package/src/ui/components/types.tsx +0 -6
- package/src/ui/context/OxyContext.tsx +23 -14
- package/src/ui/context/OxyContextBase.tsx +4 -4
- package/src/ui/context/hooks/useAuthOperations.ts +83 -134
- package/src/ui/screens/OxyAuthScreen.tsx +1 -1
- package/src/ui/stores/authStore.ts +57 -18
- package/src/ui/utils/avatarUtils.ts +4 -36
- package/lib/commonjs/crypto/keyManager.js +0 -356
- package/lib/commonjs/crypto/keyManager.js.map +0 -1
- package/lib/commonjs/crypto/signatureService.js +0 -269
- package/lib/commonjs/crypto/signatureService.js.map +0 -1
- package/lib/module/crypto/keyManager.js +0 -353
- package/lib/module/crypto/keyManager.js.map +0 -1
- package/lib/module/crypto/signatureService.js +0 -266
- package/lib/module/crypto/signatureService.js.map +0 -1
- package/lib/typescript/crypto/keyManager.d.ts +0 -80
- package/lib/typescript/crypto/keyManager.d.ts.map +0 -1
- package/lib/typescript/crypto/signatureService.d.ts +0 -77
- package/lib/typescript/crypto/signatureService.d.ts.map +0 -1
- package/src/crypto/keyManager.ts +0 -379
- package/src/crypto/signatureService.ts +0 -301
|
@@ -27,11 +27,9 @@ export declare function refreshAvatarInStore(sessionId: string, avatarFileId: st
|
|
|
27
27
|
* @param oxyServices - OxyServices instance
|
|
28
28
|
* @param activeSessionId - Active session ID
|
|
29
29
|
* @param queryClient - TanStack Query client
|
|
30
|
-
* @param syncIdentity - Optional sync identity function for handling auth errors
|
|
31
30
|
* @returns Promise that resolves with updated user data
|
|
32
31
|
*/
|
|
33
32
|
export declare function updateProfileWithAvatar(updates: Partial<User>, oxyServices: OxyServices, activeSessionId: string | null, queryClient: QueryClient, options?: {
|
|
34
|
-
syncIdentity?: () => Promise<User>;
|
|
35
33
|
deviceId?: string;
|
|
36
34
|
}): Promise<User>;
|
|
37
35
|
//# sourceMappingURL=avatarUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatarUtils.d.ts","sourceRoot":"","sources":["../../../../src/ui/utils/avatarUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,WAAW,EAAE,WAAW,EACxB,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED
|
|
1
|
+
{"version":3,"file":"avatarUtils.d.ts","sourceRoot":"","sources":["../../../../src/ui/utils/avatarUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,WAAW,EAAE,WAAW,EACxB,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EACtB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9B,OAAO,CAAC,IAAI,CAAC,CAyCf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/services",
|
|
3
|
-
"version": "5.17.
|
|
3
|
+
"version": "5.17.9",
|
|
4
4
|
"description": "Reusable OxyHQ module to handle authentication, user management, karma system, device-based session management and more 🚀",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"sonner": "^2.0.4",
|
|
112
112
|
"sonner-native": "^0.20.0",
|
|
113
113
|
"zod": "^3.25.64",
|
|
114
|
-
"zustand": "^5.0.
|
|
114
|
+
"zustand": "^5.0.9"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@biomejs/biome": "^1.9.4",
|
package/src/crypto/index.ts
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Oxy Crypto Module
|
|
3
3
|
*
|
|
4
|
-
* Provides
|
|
5
|
-
*
|
|
4
|
+
* Provides type definitions and polyfills for crypto operations.
|
|
5
|
+
* Identity management (KeyManager, SignatureService) belongs ONLY in the Accounts app.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
// Import polyfills first - this ensures Buffer is available for crypto libraries
|
|
9
9
|
import './polyfill';
|
|
10
10
|
|
|
11
|
-
export
|
|
12
|
-
export {
|
|
13
|
-
SignatureService,
|
|
14
|
-
type SignedMessage,
|
|
15
|
-
type AuthChallenge
|
|
16
|
-
} from './signatureService';
|
|
11
|
+
// Only export types - actual identity operations are in Accounts app
|
|
17
12
|
export { type BackupData } from './types';
|
|
18
13
|
|
|
19
|
-
// Re-export for convenience
|
|
20
|
-
export { KeyManager as default } from './keyManager';
|
|
21
|
-
|
|
22
14
|
|
package/src/crypto/types.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cryptographic types for
|
|
2
|
+
* Cryptographic types for authentication and backup
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Encrypted backup data structure
|
|
7
|
-
* Used for identity backup files
|
|
7
|
+
* Used for identity backup files
|
|
8
8
|
*/
|
|
9
9
|
export interface BackupData {
|
|
10
10
|
/** Base64-encoded encrypted private key */
|
package/src/index.ts
CHANGED
|
@@ -4,26 +4,21 @@
|
|
|
4
4
|
* This exports everything but uses environment detection to avoid crashes.
|
|
5
5
|
* - Frontend: Full UI + Core functionality
|
|
6
6
|
* - Backend: Core functionality only (UI components are no-ops)
|
|
7
|
+
*
|
|
8
|
+
* NOTE: Identity management (KeyManager, SignatureService) belongs ONLY in the Accounts app.
|
|
9
|
+
* Services SDK handles tokens/sessions, NOT identity.
|
|
7
10
|
*/
|
|
8
11
|
|
|
9
12
|
// IMPORTANT: Import crypto module first to ensure polyfills are loaded
|
|
10
13
|
// before any other code that might use Buffer or other polyfilled APIs
|
|
11
14
|
import './crypto/polyfill';
|
|
12
15
|
|
|
13
|
-
// Crypto/Identity exports (must be before core to ensure polyfills are available)
|
|
14
|
-
export {
|
|
15
|
-
KeyManager,
|
|
16
|
-
SignatureService
|
|
17
|
-
} from './crypto';
|
|
18
|
-
|
|
19
16
|
// Core exports
|
|
20
17
|
export { OxyServices, OxyAuthenticationError, OxyAuthenticationTimeoutError } from './core';
|
|
21
18
|
export { OXY_CLOUD_URL, oxyClient } from './core';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
AuthChallenge
|
|
26
|
-
} from './crypto';
|
|
19
|
+
|
|
20
|
+
// Type exports from crypto (types only - no identity implementation)
|
|
21
|
+
export type { BackupData } from './crypto';
|
|
27
22
|
|
|
28
23
|
// React context
|
|
29
24
|
export { useOxy } from './ui/context/OxyContext';
|
|
@@ -125,7 +125,7 @@ const Icon = ({
|
|
|
125
125
|
? source.source
|
|
126
126
|
: source;
|
|
127
127
|
const iconColor =
|
|
128
|
-
color || (theme.isV3 ? theme.colors.onSurface : (theme.colors.text || theme.colors.onSurface));
|
|
128
|
+
color || (theme.isV3 ? theme.colors.onSurface : ((theme.colors as any).text || theme.colors.onSurface));
|
|
129
129
|
|
|
130
130
|
if (isImageSource(s)) {
|
|
131
131
|
return (
|
|
@@ -33,7 +33,7 @@ export function getTextColor({ theme, disabled }: BaseProps) {
|
|
|
33
33
|
return theme.colors.onSurfaceVariant;
|
|
34
34
|
}
|
|
35
35
|
// For non-V3 themes, apply opacity to text color
|
|
36
|
-
const textColor = theme?.colors?.onSurface || theme?.colors?.text || '#000000';
|
|
36
|
+
const textColor = theme?.colors?.onSurface || (theme?.colors as any)?.text || '#000000';
|
|
37
37
|
const opacity = theme.dark ? 0.7 : 0.54;
|
|
38
38
|
return hexToRgba(textColor, opacity);
|
|
39
39
|
}
|
|
@@ -55,7 +55,7 @@ export function getIconColor({
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
if (!theme.isV3) {
|
|
58
|
-
return theme.colors.text || theme.colors.onSurface;
|
|
58
|
+
return (theme.colors as any).text || theme.colors.onSurface;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
if (disabled) {
|
|
@@ -329,10 +329,10 @@ const getInputTextColor = ({
|
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
if (disabled) {
|
|
332
|
-
return color(theme.colors.text || theme.colors.onSurface).alpha(0.54).rgb().string();
|
|
332
|
+
return color((theme.colors as any).text || theme.colors.onSurface).alpha(0.54).rgb().string();
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
-
return theme.colors.text || theme.colors.onSurface;
|
|
335
|
+
return (theme.colors as any).text || theme.colors.onSurface;
|
|
336
336
|
};
|
|
337
337
|
|
|
338
338
|
const getActiveColor = ({
|
|
@@ -364,7 +364,7 @@ const getActiveColor = ({
|
|
|
364
364
|
return theme.colors.onSurfaceDisabled;
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
return color(theme.colors.text || theme.colors.onSurface).alpha(0.54).rgb().string();
|
|
367
|
+
return color((theme.colors as any).text || theme.colors.onSurface).alpha(0.54).rgb().string();
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
return theme.colors.primary;
|
|
@@ -380,10 +380,10 @@ const getPlaceholderColor = ({ theme, disabled }: BaseProps) => {
|
|
|
380
380
|
}
|
|
381
381
|
|
|
382
382
|
if (disabled) {
|
|
383
|
-
return theme.colors.disabled || theme.colors.onSurfaceDisabled;
|
|
383
|
+
return (theme.colors as any).disabled || theme.colors.onSurfaceDisabled;
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
return theme.colors.placeholder || theme.colors.onSurfaceVariant;
|
|
386
|
+
return (theme.colors as any).placeholder || theme.colors.onSurfaceVariant;
|
|
387
387
|
};
|
|
388
388
|
|
|
389
389
|
const getSelectionColor = ({
|
|
@@ -443,7 +443,7 @@ const getFlatUnderlineColor = ({
|
|
|
443
443
|
return 'transparent';
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
return theme.colors.disabled || theme.colors.onSurfaceVariant;
|
|
446
|
+
return (theme.colors as any).disabled || theme.colors.onSurfaceVariant;
|
|
447
447
|
};
|
|
448
448
|
|
|
449
449
|
const getOutlinedOutlineInputColor = ({
|
|
@@ -472,9 +472,9 @@ const getOutlinedOutlineInputColor = ({
|
|
|
472
472
|
if (isTransparent) {
|
|
473
473
|
return customOutlineColor;
|
|
474
474
|
}
|
|
475
|
-
return theme.colors.disabled || theme.colors.onSurfaceDisabled;
|
|
475
|
+
return (theme.colors as any).disabled || theme.colors.onSurfaceDisabled;
|
|
476
476
|
}
|
|
477
|
-
return theme.colors.placeholder || theme.colors.onSurfaceVariant;
|
|
477
|
+
return (theme.colors as any).placeholder || theme.colors.onSurfaceVariant;
|
|
478
478
|
};
|
|
479
479
|
|
|
480
480
|
export const getFlatInputColors = ({
|
|
@@ -40,9 +40,9 @@ const getRippleColor = ({
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
if (theme.dark) {
|
|
43
|
-
return colorUtil(theme.colors.onSurface || theme.colors.text || '#000000').alpha(0.32).rgb().string();
|
|
43
|
+
return colorUtil(theme.colors.onSurface || (theme.colors as any).text || '#000000').alpha(0.32).rgb().string();
|
|
44
44
|
}
|
|
45
|
-
return colorUtil(theme.colors.text || theme.colors.onSurface || '#000000').alpha(0.2).rgb().string();
|
|
45
|
+
return colorUtil((theme.colors as any).text || theme.colors.onSurface || '#000000').alpha(0.2).rgb().string();
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
export const getTouchableRippleColors = ({
|
|
@@ -72,10 +72,10 @@ const AnimatedText = forwardRef<Text & HTMLElement, Props<never>>(
|
|
|
72
72
|
/>
|
|
73
73
|
);
|
|
74
74
|
} else {
|
|
75
|
-
const font = !theme.isV3 ? (theme.fonts.regular || theme.fonts.default) : theme.fonts.bodyMedium;
|
|
75
|
+
const font = !theme.isV3 ? ((theme.fonts as any).regular || theme.fonts.default) : theme.fonts.bodyMedium;
|
|
76
76
|
const textStyle = {
|
|
77
77
|
...font,
|
|
78
|
-
color: theme.isV3 ? theme.colors.onSurface : (theme.colors.text || theme.colors.onSurface),
|
|
78
|
+
color: theme.isV3 ? theme.colors.onSurface : ((theme.colors as any).text || theme.colors.onSurface),
|
|
79
79
|
};
|
|
80
80
|
return (
|
|
81
81
|
<Animated.Text
|
|
@@ -55,10 +55,6 @@ export type InternalTheme = {
|
|
|
55
55
|
level4: string;
|
|
56
56
|
level5: string;
|
|
57
57
|
};
|
|
58
|
-
// Legacy properties for backward compatibility
|
|
59
|
-
text?: string;
|
|
60
|
-
disabled?: string;
|
|
61
|
-
placeholder?: string;
|
|
62
58
|
};
|
|
63
59
|
fonts: {
|
|
64
60
|
displayLarge: any;
|
|
@@ -77,8 +73,6 @@ export type InternalTheme = {
|
|
|
77
73
|
bodyMedium: any;
|
|
78
74
|
bodySmall: any;
|
|
79
75
|
default: any;
|
|
80
|
-
// Legacy property for backward compatibility
|
|
81
|
-
regular?: any;
|
|
82
76
|
};
|
|
83
77
|
};
|
|
84
78
|
|
|
@@ -98,16 +98,20 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
98
98
|
|
|
99
99
|
const {
|
|
100
100
|
isAuthenticated,
|
|
101
|
+
isOnline,
|
|
101
102
|
isLoading,
|
|
102
103
|
error,
|
|
104
|
+
setOnline,
|
|
103
105
|
loginSuccess,
|
|
104
106
|
loginFailure,
|
|
105
107
|
logoutStore,
|
|
106
108
|
} = useAuthStore(
|
|
107
109
|
useShallow((state: AuthState) => ({
|
|
108
110
|
isAuthenticated: state.isAuthenticated,
|
|
111
|
+
isOnline: state.isOnline,
|
|
109
112
|
isLoading: state.isLoading,
|
|
110
113
|
error: state.error,
|
|
114
|
+
setOnline: state.setOnline,
|
|
111
115
|
loginSuccess: state.loginSuccess,
|
|
112
116
|
loginFailure: state.loginFailure,
|
|
113
117
|
logoutStore: state.logout,
|
|
@@ -132,9 +136,6 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
132
136
|
|
|
133
137
|
const { storage, isReady: isStorageReady } = useStorage({ onError, logger });
|
|
134
138
|
|
|
135
|
-
// Offline queuing is now handled by TanStack Query mutations
|
|
136
|
-
// No need for custom offline queue
|
|
137
|
-
|
|
138
139
|
const {
|
|
139
140
|
currentLanguage,
|
|
140
141
|
metadata: currentLanguageMetadata,
|
|
@@ -196,7 +197,7 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
196
197
|
const user = userData ?? null;
|
|
197
198
|
|
|
198
199
|
const {
|
|
199
|
-
|
|
200
|
+
completeSignIn,
|
|
200
201
|
logout,
|
|
201
202
|
logoutAll,
|
|
202
203
|
} = useAuthOperations({
|
|
@@ -219,8 +220,7 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
219
220
|
logger,
|
|
220
221
|
});
|
|
221
222
|
|
|
222
|
-
// Clear all
|
|
223
|
-
// In accounts app, identity = account, so losing identity means losing everything
|
|
223
|
+
// Clear all cached data and storage on logout
|
|
224
224
|
const clearAllAccountData = useCallback(async (): Promise<void> => {
|
|
225
225
|
// Clear TanStack Query cache (in-memory)
|
|
226
226
|
queryClient.clear();
|
|
@@ -244,8 +244,9 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
244
244
|
oxyServices.clearCache();
|
|
245
245
|
}, [queryClient, storage, clearSessionState, logger, oxyServices]);
|
|
246
246
|
|
|
247
|
-
// Network
|
|
248
|
-
//
|
|
247
|
+
// Network state monitoring - updates authStore.isOnline
|
|
248
|
+
// When offline: isAuthenticated becomes false automatically
|
|
249
|
+
// When reconnect: isOnline set to true, allowing re-authentication
|
|
249
250
|
useEffect(() => {
|
|
250
251
|
if (!storage) return;
|
|
251
252
|
|
|
@@ -268,14 +269,22 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
268
269
|
|
|
269
270
|
// If we were offline and now we're online
|
|
270
271
|
if (wasOffline) {
|
|
271
|
-
logger('Network reconnected');
|
|
272
|
+
logger('Network reconnected - setting online state');
|
|
273
|
+
setOnline(true);
|
|
272
274
|
// TanStack Query will automatically retry pending mutations
|
|
275
|
+
// Session management will handle token refresh if needed
|
|
273
276
|
wasOffline = false;
|
|
277
|
+
} else {
|
|
278
|
+
// We're online and were already online
|
|
279
|
+
setOnline(true);
|
|
274
280
|
}
|
|
275
281
|
} catch (error) {
|
|
276
282
|
// Network check failed - we're offline
|
|
277
|
-
if (!wasOffline
|
|
278
|
-
|
|
283
|
+
if (!wasOffline) {
|
|
284
|
+
if (__DEV__) {
|
|
285
|
+
logger('Network appears offline - suspending authentication');
|
|
286
|
+
}
|
|
287
|
+
setOnline(false); // This will set isAuthenticated to false
|
|
279
288
|
}
|
|
280
289
|
wasOffline = true;
|
|
281
290
|
} finally {
|
|
@@ -291,7 +300,7 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
291
300
|
clearTimeout(checkTimeout);
|
|
292
301
|
}
|
|
293
302
|
};
|
|
294
|
-
}, [oxyServices, storage, logger]);
|
|
303
|
+
}, [oxyServices, storage, logger, setOnline]);
|
|
295
304
|
|
|
296
305
|
const { getDeviceSessions, logoutAllDeviceSessions, updateDeviceName } = useDeviceManagement({
|
|
297
306
|
oxyServices,
|
|
@@ -503,7 +512,7 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
503
512
|
currentLanguageMetadata,
|
|
504
513
|
currentLanguageName,
|
|
505
514
|
currentNativeLanguageName,
|
|
506
|
-
|
|
515
|
+
completeSignIn,
|
|
507
516
|
logout,
|
|
508
517
|
logoutAll,
|
|
509
518
|
switchSession: switchSessionForContext,
|
|
@@ -522,7 +531,7 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
522
531
|
}), [
|
|
523
532
|
activeSessionId,
|
|
524
533
|
currentDeviceId,
|
|
525
|
-
|
|
534
|
+
completeSignIn,
|
|
526
535
|
currentLanguage,
|
|
527
536
|
currentLanguageMetadata,
|
|
528
537
|
currentLanguageName,
|
|
@@ -2,11 +2,10 @@ import { createContext, useContext } from 'react';
|
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import type { OxyServices } from '../../core';
|
|
4
4
|
import type { User, ApiError } from '../../models/interfaces';
|
|
5
|
-
import type { ClientSession } from '../../models/session';
|
|
5
|
+
import type { ClientSession, SessionLoginResponse } from '../../models/session';
|
|
6
6
|
import type { UseFollowHook } from '../hooks/useFollow.types';
|
|
7
7
|
import type { useLanguageManagement } from '../hooks/useLanguageManagement';
|
|
8
8
|
import type { RouteName } from '../navigation/routes';
|
|
9
|
-
import type { BackupData } from '../../crypto';
|
|
10
9
|
|
|
11
10
|
export interface OxyContextState {
|
|
12
11
|
user: User | null;
|
|
@@ -24,8 +23,9 @@ export interface OxyContextState {
|
|
|
24
23
|
currentNativeLanguageName: string;
|
|
25
24
|
|
|
26
25
|
// Authentication (Services SDK only handles tokens/sessions, NOT identity)
|
|
27
|
-
// Identity management (
|
|
28
|
-
|
|
26
|
+
// Identity management (KeyManager, SignatureService, challenge signing) belongs ONLY in Accounts app
|
|
27
|
+
// completeSignIn accepts already-verified session data from Accounts app
|
|
28
|
+
completeSignIn: (sessionResponse: SessionLoginResponse) => Promise<User>;
|
|
29
29
|
|
|
30
30
|
// Session management
|
|
31
31
|
logout: (targetSessionId?: string) => Promise<void>;
|