@oxyhq/core 5.5.0 → 7.0.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.
Files changed (196) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/HttpService.js +7 -4
  3. package/dist/cjs/OxyServices.base.js +7 -102
  4. package/dist/cjs/boot/coldBootV2.js +350 -0
  5. package/dist/cjs/boot/deviceBootReturn.js +152 -0
  6. package/dist/cjs/crypto/keyManager.js +95 -0
  7. package/dist/cjs/i18n/locales/en-US.json +13 -1
  8. package/dist/cjs/i18n/locales/es-ES.json +13 -1
  9. package/dist/cjs/i18n/locales/locales/en-US.json +13 -1
  10. package/dist/cjs/i18n/locales/locales/es-ES.json +13 -1
  11. package/dist/cjs/index.js +54 -45
  12. package/dist/cjs/mixins/OxyServices.accounts.js +13 -26
  13. package/dist/cjs/mixins/OxyServices.auth.js +66 -201
  14. package/dist/cjs/mixins/OxyServices.deviceBoot.js +119 -0
  15. package/dist/cjs/mixins/index.js +8 -17
  16. package/dist/cjs/server/index.js +2 -2
  17. package/dist/cjs/session/SessionClient.js +40 -1
  18. package/dist/cjs/session/authStateStore.js +284 -0
  19. package/dist/cjs/session/refresh.js +264 -0
  20. package/dist/cjs/shared/utils/debugUtils.js +3 -3
  21. package/dist/cjs/utils/accountUtils.js +1 -55
  22. package/dist/cjs/utils/authWebUrl.js +10 -39
  23. package/dist/cjs/utils/coldBoot.js +10 -8
  24. package/dist/cjs/utils/platform.js +19 -0
  25. package/dist/cjs/utils/registrableApex.js +49 -0
  26. package/dist/cjs/utils/ssoBounce.js +15 -362
  27. package/dist/cjs/utils/validationUtils.js +57 -0
  28. package/dist/esm/.tsbuildinfo +1 -1
  29. package/dist/esm/HttpService.js +7 -4
  30. package/dist/esm/OxyServices.base.js +7 -102
  31. package/dist/esm/boot/coldBootV2.js +344 -0
  32. package/dist/esm/boot/deviceBootReturn.js +146 -0
  33. package/dist/esm/crypto/keyManager.js +95 -0
  34. package/dist/esm/i18n/locales/en-US.json +13 -1
  35. package/dist/esm/i18n/locales/es-ES.json +13 -1
  36. package/dist/esm/i18n/locales/locales/en-US.json +13 -1
  37. package/dist/esm/i18n/locales/locales/es-ES.json +13 -1
  38. package/dist/esm/index.js +34 -17
  39. package/dist/esm/mixins/OxyServices.accounts.js +13 -26
  40. package/dist/esm/mixins/OxyServices.auth.js +66 -201
  41. package/dist/esm/mixins/OxyServices.deviceBoot.js +116 -0
  42. package/dist/esm/mixins/index.js +8 -17
  43. package/dist/esm/server/index.js +1 -1
  44. package/dist/esm/session/SessionClient.js +40 -1
  45. package/dist/esm/session/authStateStore.js +278 -0
  46. package/dist/esm/session/refresh.js +257 -0
  47. package/dist/esm/shared/utils/debugUtils.js +3 -3
  48. package/dist/esm/utils/accountUtils.js +0 -53
  49. package/dist/esm/utils/authWebUrl.js +9 -37
  50. package/dist/esm/utils/coldBoot.js +10 -8
  51. package/dist/esm/utils/platform.js +18 -0
  52. package/dist/esm/utils/registrableApex.js +46 -0
  53. package/dist/esm/utils/ssoBounce.js +14 -345
  54. package/dist/esm/utils/validationUtils.js +56 -0
  55. package/dist/types/.tsbuildinfo +1 -1
  56. package/dist/types/HttpService.d.ts +14 -1
  57. package/dist/types/OxyServices.base.d.ts +0 -52
  58. package/dist/types/OxyServices.d.ts +0 -25
  59. package/dist/types/boot/coldBootV2.d.ts +76 -0
  60. package/dist/types/boot/deviceBootReturn.d.ts +83 -0
  61. package/dist/types/crypto/keyManager.d.ts +21 -0
  62. package/dist/types/index.d.ts +14 -21
  63. package/dist/types/mixins/OxyServices.accounts.d.ts +24 -29
  64. package/dist/types/mixins/OxyServices.analytics.d.ts +0 -2
  65. package/dist/types/mixins/OxyServices.appData.d.ts +0 -2
  66. package/dist/types/mixins/OxyServices.assets.d.ts +0 -2
  67. package/dist/types/mixins/OxyServices.auth.d.ts +35 -77
  68. package/dist/types/mixins/OxyServices.civic.d.ts +0 -2
  69. package/dist/types/mixins/OxyServices.connectedApps.d.ts +0 -2
  70. package/dist/types/mixins/OxyServices.contacts.d.ts +0 -2
  71. package/dist/types/mixins/OxyServices.deviceBoot.d.ts +110 -0
  72. package/dist/types/mixins/OxyServices.devices.d.ts +0 -2
  73. package/dist/types/mixins/OxyServices.features.d.ts +0 -2
  74. package/dist/types/mixins/OxyServices.identity.d.ts +0 -2
  75. package/dist/types/mixins/OxyServices.language.d.ts +0 -2
  76. package/dist/types/mixins/OxyServices.links.d.ts +0 -2
  77. package/dist/types/mixins/OxyServices.location.d.ts +0 -2
  78. package/dist/types/mixins/OxyServices.nodes.d.ts +0 -2
  79. package/dist/types/mixins/OxyServices.payment.d.ts +0 -2
  80. package/dist/types/mixins/OxyServices.privacy.d.ts +0 -2
  81. package/dist/types/mixins/OxyServices.reputation.d.ts +0 -2
  82. package/dist/types/mixins/OxyServices.security.d.ts +0 -2
  83. package/dist/types/mixins/OxyServices.topics.d.ts +0 -2
  84. package/dist/types/mixins/OxyServices.user.d.ts +0 -2
  85. package/dist/types/mixins/OxyServices.utility.d.ts +0 -2
  86. package/dist/types/mixins/index.d.ts +5 -9
  87. package/dist/types/models/interfaces.d.ts +0 -67
  88. package/dist/types/models/session.d.ts +4 -5
  89. package/dist/types/server/index.d.ts +1 -1
  90. package/dist/types/session/SessionClient.d.ts +26 -1
  91. package/dist/types/session/authStateStore.d.ts +119 -0
  92. package/dist/types/session/refresh.d.ts +93 -0
  93. package/dist/types/shared/utils/debugUtils.d.ts +3 -3
  94. package/dist/types/utils/accountUtils.d.ts +2 -17
  95. package/dist/types/utils/authWebUrl.d.ts +9 -35
  96. package/dist/types/utils/coldBoot.d.ts +17 -14
  97. package/dist/types/utils/platform.d.ts +14 -0
  98. package/dist/types/utils/registrableApex.d.ts +31 -0
  99. package/dist/types/utils/ssoBounce.d.ts +14 -280
  100. package/dist/types/utils/validationUtils.d.ts +15 -0
  101. package/package.json +2 -2
  102. package/src/HttpService.ts +20 -4
  103. package/src/OxyServices.base.ts +7 -112
  104. package/src/OxyServices.ts +0 -38
  105. package/src/boot/__tests__/coldBootV2.test.ts +317 -0
  106. package/src/boot/__tests__/deviceBootReturn.test.ts +158 -0
  107. package/src/boot/coldBootV2.ts +426 -0
  108. package/src/boot/deviceBootReturn.ts +195 -0
  109. package/src/crypto/__tests__/sharedDeviceToken.test.ts +24 -0
  110. package/src/crypto/keyManager.ts +101 -0
  111. package/src/i18n/locales/en-US.json +13 -1
  112. package/src/i18n/locales/es-ES.json +13 -1
  113. package/src/index.ts +75 -65
  114. package/src/mixins/OxyServices.accounts.ts +27 -39
  115. package/src/mixins/OxyServices.auth.ts +78 -253
  116. package/src/mixins/OxyServices.deviceBoot.ts +146 -0
  117. package/src/mixins/__tests__/OxyServices.deviceBoot.test.ts +107 -0
  118. package/src/mixins/__tests__/accounts.test.ts +17 -44
  119. package/src/mixins/__tests__/passwordSignIn.test.ts +91 -0
  120. package/src/mixins/index.ts +10 -23
  121. package/src/models/interfaces.ts +0 -79
  122. package/src/models/session.ts +4 -5
  123. package/src/server/index.ts +1 -1
  124. package/src/session/SessionClient.ts +53 -2
  125. package/src/session/__tests__/SessionClient.additive.test.ts +92 -0
  126. package/src/session/__tests__/SessionClient.rest.test.ts +25 -0
  127. package/src/session/__tests__/SessionClient.state.test.ts +18 -5
  128. package/src/session/__tests__/authStateStore.test.ts +209 -0
  129. package/src/session/__tests__/refresh.test.ts +256 -0
  130. package/src/session/authStateStore.ts +335 -0
  131. package/src/session/refresh.ts +334 -0
  132. package/src/shared/utils/debugUtils.ts +3 -3
  133. package/src/utils/__tests__/authWebUrl.test.ts +5 -40
  134. package/src/utils/__tests__/registrableApex.test.ts +62 -0
  135. package/src/utils/__tests__/validationUtils.test.ts +30 -0
  136. package/src/utils/accountUtils.ts +2 -65
  137. package/src/utils/authWebUrl.ts +9 -39
  138. package/src/utils/coldBoot.ts +17 -14
  139. package/src/utils/platform.ts +21 -0
  140. package/src/utils/registrableApex.ts +45 -0
  141. package/src/utils/ssoBounce.ts +14 -393
  142. package/src/utils/validationUtils.ts +62 -0
  143. package/dist/cjs/AuthManager.js +0 -1110
  144. package/dist/cjs/AuthManagerTypes.js +0 -13
  145. package/dist/cjs/CrossDomainAuth.js +0 -206
  146. package/dist/cjs/mixins/OxyServices.fedcm.js +0 -823
  147. package/dist/cjs/mixins/OxyServices.redirect.js +0 -95
  148. package/dist/cjs/mixins/OxyServices.silent.js +0 -204
  149. package/dist/cjs/mixins/OxyServices.sso.js +0 -208
  150. package/dist/cjs/utils/fapiAutoDetect.js +0 -99
  151. package/dist/cjs/utils/ssoEstablish.js +0 -110
  152. package/dist/cjs/utils/ssoReturn.js +0 -275
  153. package/dist/esm/AuthManager.js +0 -1105
  154. package/dist/esm/AuthManagerTypes.js +0 -12
  155. package/dist/esm/CrossDomainAuth.js +0 -201
  156. package/dist/esm/mixins/OxyServices.fedcm.js +0 -821
  157. package/dist/esm/mixins/OxyServices.redirect.js +0 -92
  158. package/dist/esm/mixins/OxyServices.silent.js +0 -202
  159. package/dist/esm/mixins/OxyServices.sso.js +0 -204
  160. package/dist/esm/utils/fapiAutoDetect.js +0 -95
  161. package/dist/esm/utils/ssoEstablish.js +0 -107
  162. package/dist/esm/utils/ssoReturn.js +0 -271
  163. package/dist/types/AuthManager.d.ts +0 -380
  164. package/dist/types/AuthManagerTypes.d.ts +0 -81
  165. package/dist/types/CrossDomainAuth.d.ts +0 -164
  166. package/dist/types/mixins/OxyServices.fedcm.d.ts +0 -331
  167. package/dist/types/mixins/OxyServices.redirect.d.ts +0 -92
  168. package/dist/types/mixins/OxyServices.silent.d.ts +0 -132
  169. package/dist/types/mixins/OxyServices.sso.d.ts +0 -138
  170. package/dist/types/utils/fapiAutoDetect.d.ts +0 -56
  171. package/dist/types/utils/ssoEstablish.d.ts +0 -85
  172. package/dist/types/utils/ssoReturn.d.ts +0 -156
  173. package/src/AuthManager.ts +0 -1269
  174. package/src/AuthManagerTypes.ts +0 -86
  175. package/src/CrossDomainAuth.ts +0 -243
  176. package/src/__tests__/authManager.cookiePath.test.ts +0 -390
  177. package/src/__tests__/authManager.security.test.ts +0 -377
  178. package/src/__tests__/crossDomainAuth.test.ts +0 -116
  179. package/src/__tests__/establishDeviceRefreshSlot.test.ts +0 -221
  180. package/src/mixins/OxyServices.fedcm.ts +0 -1026
  181. package/src/mixins/OxyServices.redirect.ts +0 -122
  182. package/src/mixins/OxyServices.silent.ts +0 -272
  183. package/src/mixins/OxyServices.sso.ts +0 -261
  184. package/src/mixins/__tests__/constructorAuthWebUrl.test.ts +0 -85
  185. package/src/mixins/__tests__/fedcm.test.ts +0 -667
  186. package/src/mixins/__tests__/sessionBaseUrl.test.ts +0 -61
  187. package/src/mixins/__tests__/silent.test.ts +0 -102
  188. package/src/mixins/__tests__/sso.test.ts +0 -228
  189. package/src/utils/__tests__/consumeSsoReturn.test.ts +0 -816
  190. package/src/utils/__tests__/fapiAutoDetect.test.ts +0 -183
  191. package/src/utils/__tests__/ssoBounce.test.ts +0 -219
  192. package/src/utils/__tests__/ssoEstablish.test.ts +0 -204
  193. package/src/utils/__tests__/ssoReturn.test.ts +0 -276
  194. package/src/utils/fapiAutoDetect.ts +0 -91
  195. package/src/utils/ssoEstablish.ts +0 -174
  196. package/src/utils/ssoReturn.ts +0 -389
@@ -53,6 +53,11 @@ const STORAGE_KEYS = {
53
53
  SHARED_PUBLIC_KEY: 'oxy_shared_identity_public_key',
54
54
  SHARED_SESSION_TOKEN: 'oxy_shared_session_token',
55
55
  SHARED_SESSION_ID: 'oxy_shared_session_id',
56
+ // Opaque device-attribution token, shared across all Oxy apps on one device
57
+ // so they all resolve to a SINGLE server-side DeviceSession (device-first
58
+ // session model). Add-only: it never carries session state, only attributes
59
+ // a newly-credentialed session to the shared device set.
60
+ SHARED_DEVICE_TOKEN: 'oxy_shared_device_token',
56
61
  };
57
62
  /**
58
63
  * iOS Keychain Access Group for sharing identities across Oxy apps
@@ -540,6 +545,96 @@ export class KeyManager {
540
545
  return false;
541
546
  }
542
547
  }
548
+ /**
549
+ * Store the opaque device-attribution token in the SHARED keychain so every
550
+ * Oxy app on this device reads the SAME token and therefore resolves to one
551
+ * server-side DeviceSession.
552
+ *
553
+ * Mirrors the shared-session storage options exactly (iOS keychain access
554
+ * group `group.so.oxy.shared`; Android shared secure store). Native-only —
555
+ * a no-op on web (the shared keychain does not exist there; web persists its
556
+ * deviceToken in the per-origin {@link AuthStateStore} instead).
557
+ */
558
+ static async setSharedDeviceToken(deviceToken) {
559
+ if (isWebPlatform()) {
560
+ return; // Not supported on web
561
+ }
562
+ try {
563
+ const store = await initSecureStore();
564
+ if (isIOS()) {
565
+ const opts = {
566
+ keychainAccessible: store.WHEN_UNLOCKED,
567
+ keychainAccessGroup: IOS_KEYCHAIN_GROUP,
568
+ };
569
+ await store.setItemAsync(STORAGE_KEYS.SHARED_DEVICE_TOKEN, deviceToken, opts);
570
+ }
571
+ else if (isAndroid()) {
572
+ await store.setItemAsync(STORAGE_KEYS.SHARED_DEVICE_TOKEN, deviceToken);
573
+ }
574
+ if (isDev()) {
575
+ logger.debug('Shared device token stored successfully', { component: 'KeyManager' });
576
+ }
577
+ }
578
+ catch (error) {
579
+ if (isDev()) {
580
+ logger.error('Failed to store shared device token', error, { component: 'KeyManager' });
581
+ }
582
+ throw error;
583
+ }
584
+ }
585
+ /**
586
+ * Read the shared device-attribution token, or `null` when none is set (or
587
+ * on web). Mirrors {@link getSharedSession}'s keychain-access-group read.
588
+ */
589
+ static async getSharedDeviceToken() {
590
+ if (isWebPlatform()) {
591
+ return null;
592
+ }
593
+ try {
594
+ const store = await initSecureStore();
595
+ if (isIOS()) {
596
+ const opts = { keychainAccessGroup: IOS_KEYCHAIN_GROUP };
597
+ return await store.getItemAsync(STORAGE_KEYS.SHARED_DEVICE_TOKEN, opts);
598
+ }
599
+ if (isAndroid()) {
600
+ return await store.getItemAsync(STORAGE_KEYS.SHARED_DEVICE_TOKEN);
601
+ }
602
+ return null;
603
+ }
604
+ catch (error) {
605
+ if (isDev()) {
606
+ logger.warn('Failed to get shared device token', { component: 'KeyManager' }, error);
607
+ }
608
+ return null;
609
+ }
610
+ }
611
+ /**
612
+ * Delete the shared device-attribution token (device signout-all). Best-effort:
613
+ * a keychain failure is logged, not thrown, so it cannot block a sign-out.
614
+ */
615
+ static async clearSharedDeviceToken() {
616
+ if (isWebPlatform()) {
617
+ return;
618
+ }
619
+ try {
620
+ const store = await initSecureStore();
621
+ if (isIOS()) {
622
+ const opts = { keychainAccessGroup: IOS_KEYCHAIN_GROUP };
623
+ await store.deleteItemAsync(STORAGE_KEYS.SHARED_DEVICE_TOKEN, opts);
624
+ }
625
+ else if (isAndroid()) {
626
+ await store.deleteItemAsync(STORAGE_KEYS.SHARED_DEVICE_TOKEN);
627
+ }
628
+ if (isDev()) {
629
+ logger.debug('Shared device token cleared successfully', { component: 'KeyManager' });
630
+ }
631
+ }
632
+ catch (error) {
633
+ if (isDev()) {
634
+ logger.error('Failed to clear shared device token', error, { component: 'KeyManager' });
635
+ }
636
+ }
637
+ }
543
638
  // ==================== END SHARED IDENTITY METHODS ====================
544
639
  /**
545
640
  * Atomically persist a key pair to secure storage with verification + backup.
@@ -2,6 +2,13 @@
2
2
  "signin": {
3
3
  "title": "Sign In",
4
4
  "subtitle": "Sign in to continue your journey",
5
+ "chooser": {
6
+ "title": "Choose an account",
7
+ "subtitle": "Continue as an account below, or use another.",
8
+ "signedIn": "Signed in",
9
+ "useAnother": "Use another account",
10
+ "continueAs": "Continue as {{name}}"
11
+ },
5
12
  "addAccountTitle": "Add Another Account",
6
13
  "addAccountSubtitle": "Sign in with another account",
7
14
  "username": {
@@ -602,6 +609,7 @@
602
609
  "editProfile": {
603
610
  "title": "Edit Profile",
604
611
  "subtitle": "Manage your profile and preferences",
612
+ "notSet": "Not set",
605
613
  "sections": {
606
614
  "profilePicture": "Profile Picture",
607
615
  "basicInfo": "Basic Information",
@@ -610,6 +618,9 @@
610
618
  "security": "Security"
611
619
  },
612
620
  "items": {
621
+ "avatar": {
622
+ "subtitle": "Update your profile photo"
623
+ },
613
624
  "displayName": {
614
625
  "title": "Display Name",
615
626
  "subtitle": "This is how your name will appear to others",
@@ -617,7 +628,8 @@
617
628
  "firstName": "First Name",
618
629
  "firstNamePlaceholder": "Enter first name",
619
630
  "lastName": "Last Name",
620
- "lastNamePlaceholder": "Enter last name (optional)"
631
+ "lastNamePlaceholder": "Enter last name (optional)",
632
+ "invalidChars": "Use letters and spaces only"
621
633
  },
622
634
  "username": {
623
635
  "title": "Username",
@@ -2,6 +2,13 @@
2
2
  "signin": {
3
3
  "title": "Iniciar sesión",
4
4
  "subtitle": "Inicia sesión para continuar",
5
+ "chooser": {
6
+ "title": "Elige una cuenta",
7
+ "subtitle": "Continúa con una de tus cuentas o usa otra.",
8
+ "signedIn": "Sesión activa",
9
+ "useAnother": "Usar otra cuenta",
10
+ "continueAs": "Continuar como {{name}}"
11
+ },
5
12
  "addAccountTitle": "Agregar otra cuenta",
6
13
  "addAccountSubtitle": "Inicia sesión con otra cuenta",
7
14
  "username": {
@@ -152,6 +159,7 @@
152
159
  "editProfile": {
153
160
  "title": "Editar perfil",
154
161
  "subtitle": "Gestiona tu perfil y preferencias",
162
+ "notSet": "Sin definir",
155
163
  "sections": {
156
164
  "profilePicture": "Foto de perfil",
157
165
  "basicInfo": "Información básica",
@@ -160,6 +168,9 @@
160
168
  "security": "Seguridad"
161
169
  },
162
170
  "items": {
171
+ "avatar": {
172
+ "subtitle": "Actualiza tu foto de perfil"
173
+ },
163
174
  "displayName": {
164
175
  "title": "Nombre para mostrar",
165
176
  "subtitle": "Así aparecerá tu nombre para los demás",
@@ -167,7 +178,8 @@
167
178
  "firstName": "Nombre",
168
179
  "firstNamePlaceholder": "Introduce tu nombre",
169
180
  "lastName": "Apellido",
170
- "lastNamePlaceholder": "Introduce tu apellido (opcional)"
181
+ "lastNamePlaceholder": "Introduce tu apellido (opcional)",
182
+ "invalidChars": "Usa solo letras y espacios"
171
183
  },
172
184
  "username": {
173
185
  "title": "Usuario",
@@ -2,6 +2,13 @@
2
2
  "signin": {
3
3
  "title": "Sign In",
4
4
  "subtitle": "Sign in to continue your journey",
5
+ "chooser": {
6
+ "title": "Choose an account",
7
+ "subtitle": "Continue as an account below, or use another.",
8
+ "signedIn": "Signed in",
9
+ "useAnother": "Use another account",
10
+ "continueAs": "Continue as {{name}}"
11
+ },
5
12
  "addAccountTitle": "Add Another Account",
6
13
  "addAccountSubtitle": "Sign in with another account",
7
14
  "username": {
@@ -602,6 +609,7 @@
602
609
  "editProfile": {
603
610
  "title": "Edit Profile",
604
611
  "subtitle": "Manage your profile and preferences",
612
+ "notSet": "Not set",
605
613
  "sections": {
606
614
  "profilePicture": "Profile Picture",
607
615
  "basicInfo": "Basic Information",
@@ -610,6 +618,9 @@
610
618
  "security": "Security"
611
619
  },
612
620
  "items": {
621
+ "avatar": {
622
+ "subtitle": "Update your profile photo"
623
+ },
613
624
  "displayName": {
614
625
  "title": "Display Name",
615
626
  "subtitle": "This is how your name will appear to others",
@@ -617,7 +628,8 @@
617
628
  "firstName": "First Name",
618
629
  "firstNamePlaceholder": "Enter first name",
619
630
  "lastName": "Last Name",
620
- "lastNamePlaceholder": "Enter last name (optional)"
631
+ "lastNamePlaceholder": "Enter last name (optional)",
632
+ "invalidChars": "Use letters and spaces only"
621
633
  },
622
634
  "username": {
623
635
  "title": "Username",
@@ -2,6 +2,13 @@
2
2
  "signin": {
3
3
  "title": "Iniciar sesión",
4
4
  "subtitle": "Inicia sesión para continuar",
5
+ "chooser": {
6
+ "title": "Elige una cuenta",
7
+ "subtitle": "Continúa con una de tus cuentas o usa otra.",
8
+ "signedIn": "Sesión activa",
9
+ "useAnother": "Usar otra cuenta",
10
+ "continueAs": "Continuar como {{name}}"
11
+ },
5
12
  "addAccountTitle": "Agregar otra cuenta",
6
13
  "addAccountSubtitle": "Inicia sesión con otra cuenta",
7
14
  "username": {
@@ -152,6 +159,7 @@
152
159
  "editProfile": {
153
160
  "title": "Editar perfil",
154
161
  "subtitle": "Gestiona tu perfil y preferencias",
162
+ "notSet": "Sin definir",
155
163
  "sections": {
156
164
  "profilePicture": "Foto de perfil",
157
165
  "basicInfo": "Información básica",
@@ -160,6 +168,9 @@
160
168
  "security": "Seguridad"
161
169
  },
162
170
  "items": {
171
+ "avatar": {
172
+ "subtitle": "Actualiza tu foto de perfil"
173
+ },
163
174
  "displayName": {
164
175
  "title": "Nombre para mostrar",
165
176
  "subtitle": "Así aparecerá tu nombre para los demás",
@@ -167,7 +178,8 @@
167
178
  "firstName": "Nombre",
168
179
  "firstNamePlaceholder": "Introduce tu nombre",
169
180
  "lastName": "Apellido",
170
- "lastNamePlaceholder": "Introduce tu apellido (opcional)"
181
+ "lastNamePlaceholder": "Introduce tu apellido (opcional)",
182
+ "invalidChars": "Usa solo letras y espacios"
171
183
  },
172
184
  "username": {
173
185
  "title": "Usuario",
package/dist/esm/index.js CHANGED
@@ -26,8 +26,6 @@ export { OXY_CLOUD_URL, oxyClient } from './OxyServices.js';
26
26
  // ---------------------------------------------------------------------------
27
27
  // Authentication
28
28
  // ---------------------------------------------------------------------------
29
- export { AuthManager, createAuthManager } from './AuthManager.js';
30
- export { CrossDomainAuth, createCrossDomainAuth } from './CrossDomainAuth.js';
31
29
  export { ServiceCredentialMismatchError } from './mixins/OxyServices.auth.js';
32
30
  export { OxyAppDataIdentifierError } from './mixins/OxyServices.appData.js';
33
31
  // ---------------------------------------------------------------------------
@@ -80,7 +78,7 @@ export { SUPPORTED_LANGUAGES, getLanguageMetadata, getLanguageName, getNativeLan
80
78
  // ---------------------------------------------------------------------------
81
79
  // Platform detection
82
80
  // ---------------------------------------------------------------------------
83
- export { getPlatformOS, setPlatformOS, isWeb, isNative, isIOS, isAndroid, } from './utils/platform.js';
81
+ export { getPlatformOS, setPlatformOS, isWeb, isNative, isIOS, isAndroid, isWebBrowser, } from './utils/platform.js';
84
82
  // ---------------------------------------------------------------------------
85
83
  // Colour / theme utilities
86
84
  // ---------------------------------------------------------------------------
@@ -105,7 +103,7 @@ export { retryAsync } from './utils/asyncUtils.js';
105
103
  // ---------------------------------------------------------------------------
106
104
  // Validation
107
105
  // ---------------------------------------------------------------------------
108
- export { EMAIL_REGEX, USERNAME_REGEX, PASSWORD_REGEX, isValidEmail, isValidUsername, isValidPassword, isRequiredString, isRequiredNumber, isRequiredBoolean, isValidArray, isValidObject, isValidUUID, isValidURL, isValidDate, isValidFileSize, isValidFileType, sanitizeString, sanitizeHTML, isValidObjectId, validateAndSanitizeUserInput, } from './utils/validationUtils.js';
106
+ export { EMAIL_REGEX, USERNAME_REGEX, PASSWORD_REGEX, isValidEmail, isValidUsername, isValidPassword, isValidDisplayName, isRequiredString, isRequiredNumber, isRequiredBoolean, isValidArray, isValidObject, isValidUUID, isValidURL, isValidDate, isValidFileSize, isValidFileType, sanitizeString, sanitizeHTML, isValidObjectId, validateAndSanitizeUserInput, } from './utils/validationUtils.js';
109
107
  // ---------------------------------------------------------------------------
110
108
  // Logging
111
109
  // ---------------------------------------------------------------------------
@@ -117,19 +115,24 @@ export { updateAvatarVisibility } from './utils/avatarUtils.js';
117
115
  // ---------------------------------------------------------------------------
118
116
  // Accounts
119
117
  // ---------------------------------------------------------------------------
120
- export { buildAccountsArray, createQuickAccount, getAccountDisplayName, getAccountFallbackHandle, formatPublicKeyHandle, mergeAccountsFromRefreshAll, getAccountColor, } from './utils/accountUtils.js';
121
- // ---------------------------------------------------------------------------
122
- // Cross-domain SSO infrastructure
123
- // ---------------------------------------------------------------------------
124
- export { autoDetectAuthWebUrl, registrableApex } from './utils/fapiAutoDetect.js';
125
- // Central cross-domain SSO (opaque single-use code bounce via auth.oxy.so)
126
- export { CENTRAL_AUTH_URL, CENTRAL_IDP_APEX, resolveCentralAuthUrl } from './utils/authWebUrl.js';
127
- export { parseSsoReturnFragment, consumeSsoReturn } from './utils/ssoReturn.js';
128
- export { generateSsoState } from './mixins/OxyServices.sso.js';
129
- // Post-claim durable-session establish hop (web device-flow / QR sign-in).
130
- export { establishIdpSessionAfterClaim } from './utils/ssoEstablish.js';
131
- // SSO bounceper-origin sessionStorage keys, bounce URL builder, predicates
132
- export { SSO_CALLBACK_PATH, SSO_GUARD_TTL_MS, ssoStateKey, ssoGuardKey, ssoDestKey, ssoNoSessionKey, ssoAttemptedKey, ssoPriorSessionKey, ssoSignedOutKey, ssoOutcomeKey, ssoCallbackBootstrapKey, ssoNavigate, getSsoCallbackBootstrapScript, buildSsoBounceUrl, isCentralIdPOrigin, guardActive, silentRestoreSuppressed, allowSsoBounce, } from './utils/ssoBounce.js';
118
+ export { buildAccountsArray, createQuickAccount, getAccountDisplayName, getAccountFallbackHandle, formatPublicKeyHandle, getAccountColor, } from './utils/accountUtils.js';
119
+ // ---------------------------------------------------------------------------
120
+ // Registrable-domain + central-IdP-apex helpers.
121
+ //
122
+ // The client SSO-bounce / silent-iframe / FedCM machinery was removed in the
123
+ // device-first cutover (wave 2, ecosystem-wide bump complete). `registrableApex`
124
+ // (eTLD+1) and `CENTRAL_IDP_APEX` are still genuinely used: `registrableApex`
125
+ // via the `@oxyhq/core/server` re-export consumed by
126
+ // `packages/api/src/utils/sameSite.ts` for same-site origin checks, and
127
+ // `CENTRAL_IDP_APEX` by `server/cors.ts`'s `createOxyCors` (auto-allows
128
+ // `*.oxy.so`). `SSO_CALLBACK_PATH` has no remaining importer outside this
129
+ // module as of wave 2 kept exported for now rather than removed here (an
130
+ // export deletion is a logic change, out of scope for a comment sweep); flag
131
+ // for a follow-up dead-export cleanup pass.
132
+ // ---------------------------------------------------------------------------
133
+ export { registrableApex } from './utils/registrableApex.js';
134
+ export { CENTRAL_IDP_APEX } from './utils/authWebUrl.js';
135
+ export { SSO_CALLBACK_PATH } from './utils/ssoBounce.js';
133
136
  export { runColdBoot } from './utils/coldBoot.js';
134
137
  // ---------------------------------------------------------------------------
135
138
  // Session sync (device-scoped multi-account session client)
@@ -143,6 +146,20 @@ export { SessionClient } from './session/SessionClient.js';
143
146
  export { createSessionClientHost } from './session/sessionClientHost.js';
144
147
  export { createSessionClient } from './session/createSessionClient.js';
145
148
  export { deviceStateToClientSessions, activeSessionIdOf, activeUserOf, accountIdsOf, } from './session/projectSessionState.js';
149
+ // ---------------------------------------------------------------------------
150
+ // Device-first session machinery (auth centralization, wave 1) — additive.
151
+ // Persisted auth-state store, the unified refresh handler + scheduler, the
152
+ // cold-boot v2 runner, and the device-boot return-fragment consumer. Built ON
153
+ // the existing `runColdBoot` primitive + `SessionClient`; the legacy
154
+ // FedCM/SSO/CrossDomainAuth surface is untouched (cutover happens in F4).
155
+ // ---------------------------------------------------------------------------
156
+ export { createWebAuthStateStore, createNativeAuthStateStore, createMemoryAuthStateStore, AUTH_STATE_STORAGE_KEY, DEVICE_TOKEN_STORAGE_KEY, } from './session/authStateStore.js';
157
+ export { refreshPersistedSession, createAuthRefreshHandler, installAuthRefreshHandler, startTokenRefreshScheduler, TOKEN_REFRESH_LEAD_MS, } from './session/refresh.js';
158
+ export { runSessionColdBoot, createBrowserColdBootDom, isSameApex, BOOT_ATTEMPTED_KEY, } from './boot/coldBootV2.js';
159
+ export { consumeDeviceBootReturn, parseDeviceBootFragment, hashHasBootFragment, BOOT_FRAGMENT_PARAM, BOOT_STATE_SESSION_KEY, } from './boot/deviceBootReturn.js';
160
+ // The web-session result contract (`WebSessionResult`) is owned by
161
+ // `@oxyhq/contracts` — import it directly from there; `@oxyhq/core` does not
162
+ // re-export contract types.
146
163
  // API response contracts (request/response Zod schemas + inferred types) live in
147
164
  // `@oxyhq/contracts` — the single source of truth shared by the backend and every
148
165
  // client SDK. Import them directly from `@oxyhq/contracts`; `@oxyhq/core` does NOT
@@ -49,24 +49,18 @@ export function OxyServicesAccountsMixin(Base) {
49
49
  * target, directly or inherited — else 403; 404 if missing/archived; 403 if
50
50
  * the target is a personal account), then mints a REAL session for the
51
51
  * target account and returns it in the canonical login / `claimSessionByToken`
52
- * shape (`{ sessionId, deviceId, expiresAt, accessToken, user, authuser }`).
52
+ * shape (`{ sessionId, deviceId, expiresAt, accessToken, user }`).
53
53
  *
54
54
  * Unlike the removed `X-Acting-As` delegation header, the returned session
55
55
  * IS the new identity: this plants `accessToken` as the active token —
56
56
  * exactly like `claimSessionByToken` / `verifyChallenge` — so every
57
57
  * subsequent request authenticates as the target account.
58
58
  *
59
- * Joining the device multi-account set (so the switch survives a reload and
60
- * propagates cross-domain via `/auth/refresh-all`) requires a SECOND call, to
61
- * `POST /auth/session`, made here after the token is planted. The switch route
62
- * lives at `/accounts/*`, OUTSIDE the `oxy_rt_<authuser>` cookie's `Path=/auth`
63
- * scope, so the server never sees the device's existing slots from it and
64
- * would clobber slot 0 (destroying the operator's own session). `/auth/session`
65
- * runs where those cookies ARE visible, so the server allocates a NEW slot that
66
- * coexists with the operator's and returns its `authuser`. This step is
67
- * web-only (native multi-account uses stored sessions, not cookies) and
68
- * best-effort — a failure leaves the in-session switch intact; the switched
69
- * account simply won't survive a reload until the cookie is next established.
59
+ * A single call is all that's needed: the server registers the switched
60
+ * session into the operator's `DeviceSession` set directly, inheriting the
61
+ * operator's central `deviceId` so the switch survives a reload and syncs
62
+ * cross-domain via the same device-first session model as a normal login —
63
+ * there is no separate client-side cookie/slot step to make it stick.
70
64
  *
71
65
  * After planting, the SDK's identity-scoped GET cache is fully cleared so
72
66
  * every cached read re-fetches as the new account. (The consuming
@@ -76,29 +70,22 @@ export function OxyServicesAccountsMixin(Base) {
76
70
  * same-user silent refreshes, so the sweep here is explicit.)
77
71
  *
78
72
  * @param accountId - The target account's Mongo `_id`.
79
- * @returns The minted session (planted) plus the device `authuser` slot.
73
+ * @returns The minted session, already planted as the active session.
80
74
  */
81
75
  async switchToAccount(accountId) {
82
76
  try {
83
77
  const res = await this.makeRequest('POST', `/accounts/${encodeURIComponent(accountId)}/switch`, undefined, { cache: false });
84
78
  // Plant the freshly minted session as the ACTIVE session, mirroring
85
79
  // `claimSessionByToken` / `verifyChallenge`: the response body carries
86
- // the first access token. The device refresh cookie is established below.
80
+ // the first access token.
87
81
  if (res?.accessToken) {
88
82
  this.setTokens(res.accessToken);
89
83
  }
90
- // Register the switched session in the device's multi-account set by
91
- // establishing its first-party refresh cookie. This MUST be a separate
92
- // call to `POST /auth/session` (the shared `establishDeviceRefreshSlot`
93
- // primitive): the switch route is at `/accounts/*`, outside the
94
- // `oxy_rt_<authuser>` cookie's `Path=/auth` scope, so it can never read
95
- // the device's existing slots and would overwrite slot 0 (destroying the
96
- // operator's own session). `/auth/session` runs where the cookies ARE
97
- // visible, so the server allocates a NEW slot that coexists with the
98
- // operator's and returns its `authuser`. Web-only; best-effort (the helper
99
- // re-plants the rotated access token and returns `null` on native/failure).
100
- const establishedAuthuser = await this.establishDeviceRefreshSlot();
101
- const authuser = establishedAuthuser ?? res.authuser;
84
+ // The switch route now registers the switched session in the device's
85
+ // server-side DeviceSession set directly (device-first), so there is no
86
+ // client-side refresh-cookie slot to establish the `authuser` comes
87
+ // from the switch response (optional-chained to match `res?.accessToken`).
88
+ const authuser = res?.authuser;
102
89
  // Identity changed → drop the entire GET response cache so no entry
103
90
  // personalised for the previous identity is reused. Cache keys are
104
91
  // identity-scoped, so a different identity could not READ the old