@oxyhq/services 5.16.24 → 5.16.26
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/core/mixins/OxyServices.user.js +14 -4
- package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +280 -84
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +7 -6
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +4 -3
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionSocket.js +349 -328
- package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +13 -6
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.user.js +14 -4
- package/lib/module/core/mixins/OxyServices.user.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +280 -84
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +7 -6
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +4 -3
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/useSessionSocket.js +349 -328
- package/lib/module/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js +13 -6
- package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.user.d.ts +2 -2
- package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +15 -2
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionSocket.d.ts.map +1 -1
- package/lib/typescript/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/mixins/OxyServices.user.ts +14 -4
- package/src/ui/context/OxyContext.tsx +310 -86
- package/src/ui/hooks/mutations/useAccountMutations.ts +8 -6
- package/src/ui/hooks/queries/useAccountQueries.ts +4 -2
- package/src/ui/hooks/useSessionSocket.ts +153 -155
- package/src/ui/screens/PrivacySettingsScreen.tsx +12 -6
|
@@ -148,11 +148,16 @@ function OxyServicesUserMixin(Base) {
|
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
150
|
* Get privacy settings for a user
|
|
151
|
-
* @param userId - The user ID (defaults to current user)
|
|
151
|
+
* @param userId - The user ID (MongoDB ObjectId, defaults to current user)
|
|
152
152
|
*/
|
|
153
153
|
async getPrivacySettings(userId) {
|
|
154
154
|
try {
|
|
155
|
-
|
|
155
|
+
// Use getCurrentUserId() which returns MongoDB ObjectId from JWT token
|
|
156
|
+
// Never use getCurrentUser().id as it may be set to publicKey
|
|
157
|
+
const id = userId || this.getCurrentUserId();
|
|
158
|
+
if (!id) {
|
|
159
|
+
throw new Error('User ID is required');
|
|
160
|
+
}
|
|
156
161
|
return await this.makeRequest('GET', `/api/privacy/${id}/privacy`, undefined, {
|
|
157
162
|
cache: true,
|
|
158
163
|
cacheTTL: 2 * 60 * 1000 // 2 minutes cache
|
|
@@ -165,11 +170,16 @@ function OxyServicesUserMixin(Base) {
|
|
|
165
170
|
/**
|
|
166
171
|
* Update privacy settings
|
|
167
172
|
* @param settings - Partial privacy settings object
|
|
168
|
-
* @param userId - The user ID (defaults to current user)
|
|
173
|
+
* @param userId - The user ID (MongoDB ObjectId, defaults to current user)
|
|
169
174
|
*/
|
|
170
175
|
async updatePrivacySettings(settings, userId) {
|
|
171
176
|
try {
|
|
172
|
-
|
|
177
|
+
// Use getCurrentUserId() which returns MongoDB ObjectId from JWT token
|
|
178
|
+
// Never use getCurrentUser().id as it may be set to publicKey
|
|
179
|
+
const id = userId || this.getCurrentUserId();
|
|
180
|
+
if (!id) {
|
|
181
|
+
throw new Error('User ID is required');
|
|
182
|
+
}
|
|
173
183
|
return await this.makeRequest('PATCH', `/api/privacy/${id}/privacy`, settings, {
|
|
174
184
|
cache: false
|
|
175
185
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_apiUtils","require","OxyServicesUserMixin","Base","constructor","args","getProfileByUsername","username","makeRequest","undefined","cache","cacheTTL","error","handleError","searchProfiles","query","pagination","params","searchParams","buildSearchParams","paramsObj","Object","fromEntries","entries","response","isSearchProfilesResponse","payload","Array","isArray","data","typedResponse","paginationInfo","total","length","limit","offset","hasMore","fallbackLimit","fallbackPagination","Error","getProfileRecommendations","withAuthRetry","getUserById","userId","getCurrentUser","updateProfile","updates","errorAny","errorMessage","message","String","status","isAuthError","includes","hasValidToken","getPrivacySettings","id","updatePrivacySettings","settings","requestAccountVerification","reason","evidence","downloadAccountData","format","result","getClient","request","method","url","deleteAccount","password","confirmText","followUser","unfollowUser","getFollowStatus","getUserFollowers","buildPaginationParams","followers","getUserFollowing","following","getNotifications","getUnreadCount","res","count","createNotification","markNotificationAsRead","notificationId","markAllNotificationsAsRead","deleteNotification"],"sourceRoot":"../../../../src","sources":["core/mixins/OxyServices.user.ts"],"mappings":";;;;;;AAKA,IAAAA,SAAA,GAAAC,OAAA;AALA;AACA;AACA;;AAKO,SAASC,oBAAoBA,CAAmCC,IAAO,EAAE;EAC9E,OAAO,cAAcA,IAAI,CAAC;IACxBC,WAAWA,CAAC,GAAGC,IAAW,EAAE;MAC1B,KAAK,CAAC,GAAIA,IAAc,CAAC;IAC3B;IACA;AACJ;AACA;IACI,MAAMC,oBAAoBA,CAACC,QAAgB,EAAiB;MAC1D,IAAI;QACF,OAA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AAK,EAAE;QACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;MAC/B;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_apiUtils","require","OxyServicesUserMixin","Base","constructor","args","getProfileByUsername","username","makeRequest","undefined","cache","cacheTTL","error","handleError","searchProfiles","query","pagination","params","searchParams","buildSearchParams","paramsObj","Object","fromEntries","entries","response","isSearchProfilesResponse","payload","Array","isArray","data","typedResponse","paginationInfo","total","length","limit","offset","hasMore","fallbackLimit","fallbackPagination","Error","getProfileRecommendations","withAuthRetry","getUserById","userId","getCurrentUser","updateProfile","updates","errorAny","errorMessage","message","String","status","isAuthError","includes","hasValidToken","getPrivacySettings","id","getCurrentUserId","updatePrivacySettings","settings","requestAccountVerification","reason","evidence","downloadAccountData","format","result","getClient","request","method","url","deleteAccount","password","confirmText","followUser","unfollowUser","getFollowStatus","getUserFollowers","buildPaginationParams","followers","getUserFollowing","following","getNotifications","getUnreadCount","res","count","createNotification","markNotificationAsRead","notificationId","markAllNotificationsAsRead","deleteNotification"],"sourceRoot":"../../../../src","sources":["core/mixins/OxyServices.user.ts"],"mappings":";;;;;;AAKA,IAAAA,SAAA,GAAAC,OAAA;AALA;AACA;AACA;;AAKO,SAASC,oBAAoBA,CAAmCC,IAAO,EAAE;EAC9E,OAAO,cAAcA,IAAI,CAAC;IACxBC,WAAWA,CAAC,GAAGC,IAAW,EAAE;MAC1B,KAAK,CAAC,GAAIA,IAAc,CAAC;IAC3B;IACA;AACJ;AACA;IACI,MAAMC,oBAAoBA,CAACC,QAAgB,EAAiB;MAC1D,IAAI;QACF,OAAO,MAAM,IAAI,CAACC,WAAW,CAAO,KAAK,EAAE,0BAA0BD,QAAQ,EAAE,EAAEE,SAAS,EAAE;UAC1FC,KAAK,EAAE,IAAI;UACXC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,CAAE;QAC3B,CAAC,CAAC;MACJ,CAAC,CAAC,OAAOC,KAAK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AACH","ignoreList":[]}
|
|
@@ -107,7 +107,11 @@ const OxyProvider = ({
|
|
|
107
107
|
const setAuthState = _authStore.useAuthStore.setState;
|
|
108
108
|
const logger = (0, _react.useCallback)((message, err) => {
|
|
109
109
|
if (__DEV__) {
|
|
110
|
-
|
|
110
|
+
if (err !== undefined) {
|
|
111
|
+
console.warn(`[OxyContext] ${message}`, err);
|
|
112
|
+
} else {
|
|
113
|
+
console.warn(`[OxyContext] ${message}`);
|
|
114
|
+
}
|
|
111
115
|
}
|
|
112
116
|
}, []);
|
|
113
117
|
const storageKeys = (0, _react.useMemo)(() => (0, _storageHelpers.getStorageKeys)(storageKeyPrefix), [storageKeyPrefix]);
|
|
@@ -288,15 +292,45 @@ const OxyProvider = ({
|
|
|
288
292
|
oxyServices.clearCache();
|
|
289
293
|
}, [queryClient, storage, clearSessionState, logger, oxyServices]);
|
|
290
294
|
|
|
295
|
+
// Transfer code management functions (must be defined before deleteIdentityAndClearAccount)
|
|
296
|
+
const getAllPendingTransfers = (0, _react.useCallback)(() => {
|
|
297
|
+
const pending = [];
|
|
298
|
+
transferCodesRef.current.forEach((data, transferId) => {
|
|
299
|
+
if (data.state === 'pending') {
|
|
300
|
+
pending.push({
|
|
301
|
+
transferId,
|
|
302
|
+
data
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
return pending;
|
|
307
|
+
}, []);
|
|
308
|
+
const getActiveTransferId = (0, _react.useCallback)(() => {
|
|
309
|
+
return activeTransferIdRef.current;
|
|
310
|
+
}, []);
|
|
311
|
+
|
|
291
312
|
// Delete identity and clear all account data
|
|
292
313
|
// In accounts app, deleting identity means losing the account completely
|
|
293
314
|
const deleteIdentityAndClearAccount = (0, _react.useCallback)(async (skipBackup = false, force = false, userConfirmed = false) => {
|
|
315
|
+
// CRITICAL: Check for active transfers before deletion (unless force is true)
|
|
316
|
+
// This prevents accidental identity loss during transfer
|
|
317
|
+
if (!force) {
|
|
318
|
+
const pendingTransfers = getAllPendingTransfers();
|
|
319
|
+
if (pendingTransfers.length > 0) {
|
|
320
|
+
const activeTransferId = getActiveTransferId();
|
|
321
|
+
const hasActiveTransfer = activeTransferId && pendingTransfers.some(t => t.transferId === activeTransferId);
|
|
322
|
+
if (hasActiveTransfer) {
|
|
323
|
+
throw new Error('Cannot delete identity: An active identity transfer is in progress. ' + 'Please wait for the transfer to complete or cancel it first. ' + 'If you proceed, you may lose access to your identity permanently.');
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
294
328
|
// First, clear all account data
|
|
295
329
|
await clearAllAccountData();
|
|
296
330
|
|
|
297
331
|
// Then delete the identity keys
|
|
298
332
|
await _crypto.KeyManager.deleteIdentity(skipBackup, force, userConfirmed);
|
|
299
|
-
}, [clearAllAccountData]);
|
|
333
|
+
}, [clearAllAccountData, getAllPendingTransfers, getActiveTransferId]);
|
|
300
334
|
|
|
301
335
|
// Network reconnect sync - TanStack Query automatically retries mutations on reconnect
|
|
302
336
|
// We only need to sync identity if it's not synced
|
|
@@ -304,6 +338,8 @@ const OxyProvider = ({
|
|
|
304
338
|
if (!storage) return;
|
|
305
339
|
let wasOffline = false;
|
|
306
340
|
let checkTimeout = null;
|
|
341
|
+
let lastReconnectionLog = 0;
|
|
342
|
+
const RECONNECTION_LOG_DEBOUNCE_MS = 5000; // 5 seconds
|
|
307
343
|
|
|
308
344
|
// Circuit breaker and exponential backoff state
|
|
309
345
|
const stateRef = {
|
|
@@ -340,41 +376,47 @@ const OxyProvider = ({
|
|
|
340
376
|
|
|
341
377
|
// If we were offline and now we're online, sync identity if needed
|
|
342
378
|
if (wasOffline) {
|
|
343
|
-
|
|
379
|
+
const now = Date.now();
|
|
380
|
+
const timeSinceLastLog = now - lastReconnectionLog;
|
|
381
|
+
if (timeSinceLastLog >= RECONNECTION_LOG_DEBOUNCE_MS) {
|
|
382
|
+
logger('Network reconnected, checking identity sync...');
|
|
383
|
+
lastReconnectionLog = now;
|
|
344
384
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
385
|
+
// Sync identity first (if not synced)
|
|
386
|
+
try {
|
|
387
|
+
const hasIdentityValue = await hasIdentity();
|
|
388
|
+
if (hasIdentityValue) {
|
|
389
|
+
// Check sync status directly - sync if not explicitly 'true'
|
|
390
|
+
// undefined = not synced yet, 'false' = explicitly not synced, 'true' = synced
|
|
391
|
+
const syncStatus = await storage.getItem('oxy_identity_synced');
|
|
392
|
+
if (syncStatus !== 'true') {
|
|
393
|
+
await syncIdentity();
|
|
394
|
+
}
|
|
354
395
|
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
396
|
+
} catch (syncError) {
|
|
397
|
+
// Skip sync silently if username is required (expected when offline onboarding)
|
|
398
|
+
if (syncError?.code === 'USERNAME_REQUIRED' || syncError?.message === 'USERNAME_REQUIRED') {
|
|
399
|
+
if (__DEV__) {
|
|
400
|
+
_loggerUtils.logger.debug('Sync skipped - username required', {
|
|
401
|
+
component: 'OxyContext',
|
|
402
|
+
method: 'checkNetworkAndSync'
|
|
403
|
+
}, syncError);
|
|
404
|
+
}
|
|
405
|
+
// Don't log or show error - username will be set later
|
|
406
|
+
} else if (!(0, _errorHandlers.isTimeoutOrNetworkError)(syncError)) {
|
|
407
|
+
// Only log unexpected errors - timeouts/network issues are expected when offline
|
|
408
|
+
logger('Error syncing identity on reconnect', syncError);
|
|
409
|
+
} else if (__DEV__) {
|
|
410
|
+
_loggerUtils.logger.debug('Identity sync timeout (expected when offline)', {
|
|
361
411
|
component: 'OxyContext',
|
|
362
412
|
method: 'checkNetworkAndSync'
|
|
363
413
|
}, syncError);
|
|
364
414
|
}
|
|
365
|
-
// Don't log or show error - username will be set later
|
|
366
|
-
} else if (!(0, _errorHandlers.isTimeoutOrNetworkError)(syncError)) {
|
|
367
|
-
// Only log unexpected errors - timeouts/network issues are expected when offline
|
|
368
|
-
logger('Error syncing identity on reconnect', syncError);
|
|
369
|
-
} else if (__DEV__) {
|
|
370
|
-
_loggerUtils.logger.debug('Identity sync timeout (expected when offline)', {
|
|
371
|
-
component: 'OxyContext',
|
|
372
|
-
method: 'checkNetworkAndSync'
|
|
373
|
-
}, syncError);
|
|
374
415
|
}
|
|
375
416
|
}
|
|
376
417
|
|
|
377
418
|
// TanStack Query will automatically retry pending mutations
|
|
419
|
+
// Reset flag immediately after processing (whether logged or not)
|
|
378
420
|
wasOffline = false;
|
|
379
421
|
}
|
|
380
422
|
} catch (error) {
|
|
@@ -517,18 +559,92 @@ const OxyProvider = ({
|
|
|
517
559
|
// The JWT token's userId field contains the MongoDB ObjectId
|
|
518
560
|
const userId = oxyServices.getCurrentUserId() || user?.id;
|
|
519
561
|
|
|
520
|
-
//
|
|
521
|
-
|
|
562
|
+
// Transfer code storage interface
|
|
563
|
+
|
|
564
|
+
// Store transfer codes in memory for verification (also persisted to storage)
|
|
565
|
+
// Map: transferId -> TransferCodeData
|
|
522
566
|
const transferCodesRef = (0, _react.useRef)(new Map());
|
|
567
|
+
const activeTransferIdRef = (0, _react.useRef)(null);
|
|
568
|
+
const TRANSFER_CODES_STORAGE_KEY = `${storageKeyPrefix}_transfer_codes`;
|
|
569
|
+
const ACTIVE_TRANSFER_STORAGE_KEY = `${storageKeyPrefix}_active_transfer_id`;
|
|
570
|
+
|
|
571
|
+
// Load transfer codes from storage on startup
|
|
572
|
+
(0, _react.useEffect)(() => {
|
|
573
|
+
if (!storage || !isStorageReady) return;
|
|
574
|
+
const loadTransferCodes = async () => {
|
|
575
|
+
try {
|
|
576
|
+
// Load transfer codes
|
|
577
|
+
const storedCodes = await storage.getItem(TRANSFER_CODES_STORAGE_KEY);
|
|
578
|
+
if (storedCodes) {
|
|
579
|
+
const parsed = JSON.parse(storedCodes);
|
|
580
|
+
const now = Date.now();
|
|
581
|
+
const fifteenMinutes = 15 * 60 * 1000;
|
|
582
|
+
|
|
583
|
+
// Only restore non-expired pending transfers
|
|
584
|
+
Object.entries(parsed).forEach(([transferId, data]) => {
|
|
585
|
+
if (data.state === 'pending' && now - data.timestamp < fifteenMinutes) {
|
|
586
|
+
transferCodesRef.current.set(transferId, data);
|
|
587
|
+
if (__DEV__) {
|
|
588
|
+
logger('Restored pending transfer from storage', {
|
|
589
|
+
transferId
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// Load active transfer ID
|
|
597
|
+
const activeTransferId = await storage.getItem(ACTIVE_TRANSFER_STORAGE_KEY);
|
|
598
|
+
if (activeTransferId) {
|
|
599
|
+
// Verify it's still valid
|
|
600
|
+
const transferData = transferCodesRef.current.get(activeTransferId);
|
|
601
|
+
if (transferData && transferData.state === 'pending') {
|
|
602
|
+
activeTransferIdRef.current = activeTransferId;
|
|
603
|
+
if (__DEV__) {
|
|
604
|
+
logger('Restored active transfer ID from storage', {
|
|
605
|
+
transferId: activeTransferId
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
} else {
|
|
609
|
+
// Clear invalid active transfer
|
|
610
|
+
await storage.removeItem(ACTIVE_TRANSFER_STORAGE_KEY);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
} catch (error) {
|
|
614
|
+
if (__DEV__) {
|
|
615
|
+
logger('Failed to load transfer codes from storage', error);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
loadTransferCodes();
|
|
620
|
+
}, [storage, isStorageReady, logger, storageKeyPrefix]);
|
|
621
|
+
|
|
622
|
+
// Persist transfer codes to storage whenever they change
|
|
623
|
+
const persistTransferCodes = (0, _react.useCallback)(async () => {
|
|
624
|
+
if (!storage) return;
|
|
625
|
+
try {
|
|
626
|
+
const codesToStore = {};
|
|
627
|
+
transferCodesRef.current.forEach((value, key) => {
|
|
628
|
+
codesToStore[key] = value;
|
|
629
|
+
});
|
|
630
|
+
await storage.setItem(TRANSFER_CODES_STORAGE_KEY, JSON.stringify(codesToStore));
|
|
631
|
+
} catch (error) {
|
|
632
|
+
if (__DEV__) {
|
|
633
|
+
logger('Failed to persist transfer codes', error);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}, [storage, logger]);
|
|
523
637
|
|
|
524
638
|
// Cleanup old transfer codes (older than 15 minutes)
|
|
525
639
|
(0, _react.useEffect)(() => {
|
|
526
|
-
const cleanup = setInterval(() => {
|
|
640
|
+
const cleanup = setInterval(async () => {
|
|
527
641
|
const now = Date.now();
|
|
528
642
|
const fifteenMinutes = 15 * 60 * 1000;
|
|
643
|
+
let needsPersist = false;
|
|
529
644
|
transferCodesRef.current.forEach((value, key) => {
|
|
530
645
|
if (now - value.timestamp > fifteenMinutes) {
|
|
531
646
|
transferCodesRef.current.delete(key);
|
|
647
|
+
needsPersist = true;
|
|
532
648
|
if (__DEV__) {
|
|
533
649
|
logger('Cleaned up expired transfer code', {
|
|
534
650
|
transferId: key
|
|
@@ -536,19 +652,49 @@ const OxyProvider = ({
|
|
|
536
652
|
}
|
|
537
653
|
}
|
|
538
654
|
});
|
|
655
|
+
|
|
656
|
+
// Clear active transfer if it was deleted
|
|
657
|
+
if (activeTransferIdRef.current && !transferCodesRef.current.has(activeTransferIdRef.current)) {
|
|
658
|
+
activeTransferIdRef.current = null;
|
|
659
|
+
if (storage) {
|
|
660
|
+
try {
|
|
661
|
+
await storage.removeItem(ACTIVE_TRANSFER_STORAGE_KEY);
|
|
662
|
+
} catch (error) {
|
|
663
|
+
// Ignore storage errors
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (needsPersist) {
|
|
668
|
+
await persistTransferCodes();
|
|
669
|
+
}
|
|
539
670
|
}, 60000); // Check every minute
|
|
540
671
|
|
|
541
672
|
return () => clearInterval(cleanup);
|
|
542
|
-
}, [logger]);
|
|
673
|
+
}, [logger, persistTransferCodes, storage]);
|
|
543
674
|
|
|
544
675
|
// Transfer code management functions
|
|
545
|
-
const storeTransferCode = (0, _react.useCallback)((transferId, code, sourceDeviceId, publicKey) => {
|
|
546
|
-
|
|
676
|
+
const storeTransferCode = (0, _react.useCallback)(async (transferId, code, sourceDeviceId, publicKey) => {
|
|
677
|
+
const transferData = {
|
|
547
678
|
code,
|
|
548
679
|
sourceDeviceId,
|
|
549
680
|
publicKey,
|
|
550
|
-
timestamp: Date.now()
|
|
551
|
-
|
|
681
|
+
timestamp: Date.now(),
|
|
682
|
+
state: 'pending'
|
|
683
|
+
};
|
|
684
|
+
transferCodesRef.current.set(transferId, transferData);
|
|
685
|
+
activeTransferIdRef.current = transferId;
|
|
686
|
+
|
|
687
|
+
// Persist to storage
|
|
688
|
+
await persistTransferCodes();
|
|
689
|
+
if (storage) {
|
|
690
|
+
try {
|
|
691
|
+
await storage.setItem(ACTIVE_TRANSFER_STORAGE_KEY, transferId);
|
|
692
|
+
} catch (error) {
|
|
693
|
+
if (__DEV__) {
|
|
694
|
+
logger('Failed to persist active transfer ID', error);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
552
698
|
if (__DEV__) {
|
|
553
699
|
logger('Stored transfer code', {
|
|
554
700
|
transferId,
|
|
@@ -556,18 +702,57 @@ const OxyProvider = ({
|
|
|
556
702
|
publicKey: publicKey.substring(0, 16) + '...'
|
|
557
703
|
});
|
|
558
704
|
}
|
|
559
|
-
}, [logger]);
|
|
705
|
+
}, [logger, persistTransferCodes, storage]);
|
|
560
706
|
const getTransferCode = (0, _react.useCallback)(transferId => {
|
|
561
707
|
return transferCodesRef.current.get(transferId) || null;
|
|
562
708
|
}, []);
|
|
563
|
-
const
|
|
709
|
+
const updateTransferState = (0, _react.useCallback)(async (transferId, state) => {
|
|
710
|
+
const transferData = transferCodesRef.current.get(transferId);
|
|
711
|
+
if (transferData) {
|
|
712
|
+
transferData.state = state;
|
|
713
|
+
transferCodesRef.current.set(transferId, transferData);
|
|
714
|
+
|
|
715
|
+
// Clear active transfer if completed or failed
|
|
716
|
+
if (state === 'completed' || state === 'failed') {
|
|
717
|
+
if (activeTransferIdRef.current === transferId) {
|
|
718
|
+
activeTransferIdRef.current = null;
|
|
719
|
+
if (storage) {
|
|
720
|
+
try {
|
|
721
|
+
await storage.removeItem(ACTIVE_TRANSFER_STORAGE_KEY);
|
|
722
|
+
} catch (error) {
|
|
723
|
+
// Ignore storage errors
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
await persistTransferCodes();
|
|
729
|
+
if (__DEV__) {
|
|
730
|
+
logger('Updated transfer state', {
|
|
731
|
+
transferId,
|
|
732
|
+
state
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}, [logger, persistTransferCodes, storage]);
|
|
737
|
+
const clearTransferCode = (0, _react.useCallback)(async transferId => {
|
|
564
738
|
transferCodesRef.current.delete(transferId);
|
|
739
|
+
if (activeTransferIdRef.current === transferId) {
|
|
740
|
+
activeTransferIdRef.current = null;
|
|
741
|
+
if (storage) {
|
|
742
|
+
try {
|
|
743
|
+
await storage.removeItem(ACTIVE_TRANSFER_STORAGE_KEY);
|
|
744
|
+
} catch (error) {
|
|
745
|
+
// Ignore storage errors
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
await persistTransferCodes();
|
|
565
750
|
if (__DEV__) {
|
|
566
751
|
logger('Cleared transfer code', {
|
|
567
752
|
transferId
|
|
568
753
|
});
|
|
569
754
|
}
|
|
570
|
-
}, [logger]);
|
|
755
|
+
}, [logger, persistTransferCodes, storage]);
|
|
571
756
|
const refreshSessionsWithUser = (0, _react.useCallback)(() => refreshSessions(userId), [refreshSessions, userId]);
|
|
572
757
|
const handleSessionRemoved = (0, _react.useCallback)(sessionId => {
|
|
573
758
|
trackRemovedSession(sessionId);
|
|
@@ -577,14 +762,6 @@ const OxyProvider = ({
|
|
|
577
762
|
logout().catch(remoteError => logger('Failed to process remote sign out', remoteError));
|
|
578
763
|
}, [logger, logout]);
|
|
579
764
|
const handleIdentityTransferComplete = (0, _react.useCallback)(async data => {
|
|
580
|
-
if (__DEV__) {
|
|
581
|
-
console.log('[OxyContext] handleIdentityTransferComplete called', {
|
|
582
|
-
transferId: data.transferId,
|
|
583
|
-
sourceDeviceId: data.sourceDeviceId,
|
|
584
|
-
currentDeviceId,
|
|
585
|
-
hasActiveSession: activeSessionId !== null
|
|
586
|
-
});
|
|
587
|
-
}
|
|
588
765
|
try {
|
|
589
766
|
logger('Received identity transfer complete notification', {
|
|
590
767
|
transferId: data.transferId,
|
|
@@ -593,29 +770,14 @@ const OxyProvider = ({
|
|
|
593
770
|
hasActiveSession: activeSessionId !== null,
|
|
594
771
|
publicKey: data.publicKey.substring(0, 16) + '...'
|
|
595
772
|
});
|
|
596
|
-
|
|
597
|
-
// Get stored transfer code for verification
|
|
598
773
|
const storedTransfer = getTransferCode(data.transferId);
|
|
599
774
|
if (!storedTransfer) {
|
|
600
|
-
if (__DEV__) {
|
|
601
|
-
console.warn('[OxyContext] Transfer code not found for transferId', {
|
|
602
|
-
transferId: data.transferId
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
775
|
logger('Transfer code not found for transferId', {
|
|
606
776
|
transferId: data.transferId
|
|
607
777
|
});
|
|
608
778
|
_sonner.toast.error('Transfer verification failed: Code not found. Identity will not be deleted.');
|
|
609
779
|
return;
|
|
610
780
|
}
|
|
611
|
-
if (__DEV__) {
|
|
612
|
-
console.log('[OxyContext] Found stored transfer code', {
|
|
613
|
-
transferId: data.transferId,
|
|
614
|
-
storedSourceDeviceId: storedTransfer.sourceDeviceId,
|
|
615
|
-
receivedSourceDeviceId: data.sourceDeviceId,
|
|
616
|
-
currentDeviceId
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
781
|
|
|
620
782
|
// Verify publicKey matches first (most important check)
|
|
621
783
|
const publicKeyMatches = data.publicKey === storedTransfer.publicKey;
|
|
@@ -672,13 +834,6 @@ const OxyProvider = ({
|
|
|
672
834
|
// Don't block - publicKey match is sufficient, code mismatch might be due to user error
|
|
673
835
|
// Log warning but proceed
|
|
674
836
|
}
|
|
675
|
-
} else {
|
|
676
|
-
// If transfer code is not provided, log info but proceed
|
|
677
|
-
if (__DEV__) {
|
|
678
|
-
logger('Transfer code not provided in completion notification, but publicKey matches - proceeding', {
|
|
679
|
-
transferId: data.transferId
|
|
680
|
-
});
|
|
681
|
-
}
|
|
682
837
|
}
|
|
683
838
|
|
|
684
839
|
// Check if transfer is too old (safety timeout - 10 minutes)
|
|
@@ -695,13 +850,37 @@ const OxyProvider = ({
|
|
|
695
850
|
return;
|
|
696
851
|
}
|
|
697
852
|
|
|
698
|
-
//
|
|
699
|
-
|
|
700
|
-
|
|
853
|
+
// CRITICAL: Verify target device has identity before deleting on source device
|
|
854
|
+
// This ensures we never lose the identity
|
|
855
|
+
try {
|
|
856
|
+
logger('Verifying target device has identity before deletion', {
|
|
701
857
|
transferId: data.transferId,
|
|
702
|
-
|
|
703
|
-
|
|
858
|
+
publicKey: data.publicKey.substring(0, 16) + '...'
|
|
859
|
+
});
|
|
860
|
+
|
|
861
|
+
// Verify target device has active session with matching public key
|
|
862
|
+
const verifyResponse = await oxyServices.makeRequest('GET', `/api/identity/verify-transfer?publicKey=${encodeURIComponent(data.publicKey)}`, undefined, {
|
|
863
|
+
cache: false
|
|
864
|
+
});
|
|
865
|
+
if (!verifyResponse.verified || !verifyResponse.hasActiveSession) {
|
|
866
|
+
logger('Target device verification failed - identity will not be deleted', {
|
|
867
|
+
transferId: data.transferId,
|
|
868
|
+
verified: verifyResponse.verified,
|
|
869
|
+
hasActiveSession: verifyResponse.hasActiveSession
|
|
870
|
+
});
|
|
871
|
+
await updateTransferState(data.transferId, 'failed');
|
|
872
|
+
_sonner.toast.error('Transfer verification failed: Target device does not have active session. Identity will not be deleted.');
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
logger('Target device verification passed', {
|
|
876
|
+
transferId: data.transferId
|
|
704
877
|
});
|
|
878
|
+
} catch (verifyError) {
|
|
879
|
+
// If verification fails, don't delete identity - it's safer to keep it
|
|
880
|
+
logger('Failed to verify target device - identity will not be deleted', verifyError);
|
|
881
|
+
await updateTransferState(data.transferId, 'failed');
|
|
882
|
+
_sonner.toast.error('Transfer verification failed: Could not verify target device. Identity will not be deleted.');
|
|
883
|
+
return;
|
|
705
884
|
}
|
|
706
885
|
logger('All transfer verifications passed, deleting identity from source device', {
|
|
707
886
|
transferId: data.transferId,
|
|
@@ -709,29 +888,43 @@ const OxyProvider = ({
|
|
|
709
888
|
publicKey: data.publicKey.substring(0, 16) + '...'
|
|
710
889
|
});
|
|
711
890
|
try {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
891
|
+
// Verify identity still exists before deletion (safety check)
|
|
892
|
+
const identityStillExists = await _crypto.KeyManager.hasIdentity();
|
|
893
|
+
if (!identityStillExists) {
|
|
894
|
+
logger('Identity already deleted - skipping deletion', {
|
|
895
|
+
transferId: data.transferId
|
|
896
|
+
});
|
|
897
|
+
await updateTransferState(data.transferId, 'completed');
|
|
898
|
+
await clearTransferCode(data.transferId);
|
|
899
|
+
return;
|
|
715
900
|
}
|
|
901
|
+
await deleteIdentityAndClearAccount(false, false, true);
|
|
716
902
|
|
|
717
|
-
//
|
|
718
|
-
|
|
903
|
+
// Verify identity was actually deleted
|
|
904
|
+
const identityDeleted = !(await _crypto.KeyManager.hasIdentity());
|
|
905
|
+
if (!identityDeleted) {
|
|
906
|
+
logger('Identity deletion failed - identity still exists', {
|
|
907
|
+
transferId: data.transferId
|
|
908
|
+
});
|
|
909
|
+
await updateTransferState(data.transferId, 'failed');
|
|
910
|
+
throw new Error('Identity deletion failed - identity still exists');
|
|
911
|
+
}
|
|
912
|
+
await updateTransferState(data.transferId, 'completed');
|
|
913
|
+
await clearTransferCode(data.transferId);
|
|
719
914
|
logger('Identity successfully deleted and transfer code cleared', {
|
|
720
915
|
transferId: data.transferId
|
|
721
916
|
});
|
|
722
917
|
_sonner.toast.success('Identity successfully transferred and removed from this device');
|
|
723
918
|
} catch (deleteError) {
|
|
724
|
-
if (__DEV__) {
|
|
725
|
-
console.error('[OxyContext] Error deleting identity', deleteError);
|
|
726
|
-
}
|
|
727
919
|
logger('Error during identity deletion', deleteError);
|
|
728
|
-
|
|
920
|
+
await updateTransferState(data.transferId, 'failed');
|
|
921
|
+
throw deleteError;
|
|
729
922
|
}
|
|
730
923
|
} catch (error) {
|
|
731
924
|
logger('Failed to delete identity after transfer', error);
|
|
732
925
|
_sonner.toast.error(error?.message || 'Failed to remove identity from this device. Please try again manually from Security Settings.');
|
|
733
926
|
}
|
|
734
|
-
}, [deleteIdentityAndClearAccount, logger, getTransferCode, clearTransferCode, currentDeviceId, activeSessionId]);
|
|
927
|
+
}, [deleteIdentityAndClearAccount, logger, getTransferCode, clearTransferCode, updateTransferState, currentDeviceId, activeSessionId, oxyServices]);
|
|
735
928
|
(0, _useSessionSocket.useSessionSocket)({
|
|
736
929
|
userId,
|
|
737
930
|
activeSessionId,
|
|
@@ -811,6 +1004,9 @@ const OxyProvider = ({
|
|
|
811
1004
|
storeTransferCode,
|
|
812
1005
|
getTransferCode,
|
|
813
1006
|
clearTransferCode,
|
|
1007
|
+
getAllPendingTransfers,
|
|
1008
|
+
getActiveTransferId,
|
|
1009
|
+
updateTransferState,
|
|
814
1010
|
identitySyncState: {
|
|
815
1011
|
isSynced: isIdentitySyncedStore ?? true,
|
|
816
1012
|
isSyncing: isSyncing ?? false
|
|
@@ -830,7 +1026,7 @@ const OxyProvider = ({
|
|
|
830
1026
|
useFollow: useFollowHook,
|
|
831
1027
|
showBottomSheet: showBottomSheetForContext,
|
|
832
1028
|
openAvatarPicker
|
|
833
|
-
}), [activeSessionId, currentDeviceId, createIdentity, importIdentity, signIn, hasIdentity, getPublicKey, isIdentitySynced, syncIdentity, deleteIdentityAndClearAccount, storeTransferCode, getTransferCode, clearTransferCode, isIdentitySyncedStore, isSyncing, currentLanguage, currentLanguageMetadata, currentLanguageName, currentNativeLanguageName, error, getDeviceSessions, isAuthenticated, isLoading, logout, logoutAll, logoutAllDeviceSessions, oxyServices, refreshSessionsWithUser, sessions, setLanguage, switchSessionForContext, tokenReady, isStorageReady, updateDeviceName, clearAllAccountData, useFollowHook, user, showBottomSheetForContext, openAvatarPicker]);
|
|
1029
|
+
}), [activeSessionId, currentDeviceId, createIdentity, importIdentity, signIn, hasIdentity, getPublicKey, isIdentitySynced, syncIdentity, deleteIdentityAndClearAccount, storeTransferCode, getTransferCode, clearTransferCode, getAllPendingTransfers, getActiveTransferId, updateTransferState, isIdentitySyncedStore, isSyncing, currentLanguage, currentLanguageMetadata, currentLanguageName, currentNativeLanguageName, error, getDeviceSessions, isAuthenticated, isLoading, logout, logoutAll, logoutAllDeviceSessions, oxyServices, refreshSessionsWithUser, sessions, setLanguage, switchSessionForContext, tokenReady, isStorageReady, updateDeviceName, clearAllAccountData, useFollowHook, user, showBottomSheetForContext, openAvatarPicker]);
|
|
834
1030
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(OxyContext.Provider, {
|
|
835
1031
|
value: contextValue,
|
|
836
1032
|
children: children
|