@oxy.so/core 7.8.0 → 7.9.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 (73) hide show
  1. package/dist/cjs/i18n/locales/ar-SA.js +0 -2
  2. package/dist/cjs/i18n/locales/bn-BD.js +0 -2
  3. package/dist/cjs/i18n/locales/ca-ES.js +0 -2
  4. package/dist/cjs/i18n/locales/de-DE.js +0 -2
  5. package/dist/cjs/i18n/locales/en-US.js +0 -2
  6. package/dist/cjs/i18n/locales/es-ES.js +0 -2
  7. package/dist/cjs/i18n/locales/fr-FR.js +0 -2
  8. package/dist/cjs/i18n/locales/hi-IN.js +0 -2
  9. package/dist/cjs/i18n/locales/id-ID.js +0 -2
  10. package/dist/cjs/i18n/locales/it-IT.js +0 -2
  11. package/dist/cjs/i18n/locales/ja-JP.js +0 -2
  12. package/dist/cjs/i18n/locales/ko-KR.js +0 -2
  13. package/dist/cjs/i18n/locales/pt-PT.js +0 -2
  14. package/dist/cjs/i18n/locales/ru-RU.js +0 -2
  15. package/dist/cjs/i18n/locales/tr-TR.js +0 -2
  16. package/dist/cjs/i18n/locales/zh-CN.js +0 -2
  17. package/dist/cjs/session/deviceComparisonCode.js +21 -0
  18. package/dist/cjs/session/index.js +3 -1
  19. package/dist/esm/i18n/locales/ar-SA.js +0 -2
  20. package/dist/esm/i18n/locales/bn-BD.js +0 -2
  21. package/dist/esm/i18n/locales/ca-ES.js +0 -2
  22. package/dist/esm/i18n/locales/de-DE.js +0 -2
  23. package/dist/esm/i18n/locales/en-US.js +0 -2
  24. package/dist/esm/i18n/locales/es-ES.js +0 -2
  25. package/dist/esm/i18n/locales/fr-FR.js +0 -2
  26. package/dist/esm/i18n/locales/hi-IN.js +0 -2
  27. package/dist/esm/i18n/locales/id-ID.js +0 -2
  28. package/dist/esm/i18n/locales/it-IT.js +0 -2
  29. package/dist/esm/i18n/locales/ja-JP.js +0 -2
  30. package/dist/esm/i18n/locales/ko-KR.js +0 -2
  31. package/dist/esm/i18n/locales/pt-PT.js +0 -2
  32. package/dist/esm/i18n/locales/ru-RU.js +0 -2
  33. package/dist/esm/i18n/locales/tr-TR.js +0 -2
  34. package/dist/esm/i18n/locales/zh-CN.js +0 -2
  35. package/dist/esm/session/deviceComparisonCode.js +18 -0
  36. package/dist/esm/session/index.js +1 -0
  37. package/dist/types/i18n/locales/ar-SA.d.ts +0 -2
  38. package/dist/types/i18n/locales/bn-BD.d.ts +0 -2
  39. package/dist/types/i18n/locales/ca-ES.d.ts +0 -2
  40. package/dist/types/i18n/locales/de-DE.d.ts +0 -2
  41. package/dist/types/i18n/locales/en-US.d.ts +0 -2
  42. package/dist/types/i18n/locales/es-ES.d.ts +0 -2
  43. package/dist/types/i18n/locales/fr-FR.d.ts +0 -2
  44. package/dist/types/i18n/locales/hi-IN.d.ts +0 -2
  45. package/dist/types/i18n/locales/id-ID.d.ts +0 -2
  46. package/dist/types/i18n/locales/it-IT.d.ts +0 -2
  47. package/dist/types/i18n/locales/ja-JP.d.ts +0 -2
  48. package/dist/types/i18n/locales/ko-KR.d.ts +0 -2
  49. package/dist/types/i18n/locales/pt-PT.d.ts +0 -2
  50. package/dist/types/i18n/locales/ru-RU.d.ts +0 -2
  51. package/dist/types/i18n/locales/tr-TR.d.ts +0 -2
  52. package/dist/types/i18n/locales/zh-CN.d.ts +0 -2
  53. package/dist/types/session/deviceComparisonCode.d.ts +1 -0
  54. package/dist/types/session/index.d.ts +1 -0
  55. package/package.json +1 -1
  56. package/src/i18n/locales/ar-SA.ts +0 -2
  57. package/src/i18n/locales/bn-BD.ts +0 -2
  58. package/src/i18n/locales/ca-ES.ts +0 -2
  59. package/src/i18n/locales/de-DE.ts +0 -2
  60. package/src/i18n/locales/en-US.ts +0 -2
  61. package/src/i18n/locales/es-ES.ts +0 -2
  62. package/src/i18n/locales/fr-FR.ts +0 -2
  63. package/src/i18n/locales/hi-IN.ts +0 -2
  64. package/src/i18n/locales/id-ID.ts +0 -2
  65. package/src/i18n/locales/it-IT.ts +0 -2
  66. package/src/i18n/locales/ja-JP.ts +0 -2
  67. package/src/i18n/locales/ko-KR.ts +0 -2
  68. package/src/i18n/locales/pt-PT.ts +0 -2
  69. package/src/i18n/locales/ru-RU.ts +0 -2
  70. package/src/i18n/locales/tr-TR.ts +0 -2
  71. package/src/i18n/locales/zh-CN.ts +0 -2
  72. package/src/session/deviceComparisonCode.ts +19 -0
  73. package/src/session/index.ts +1 -0
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: 'عرض رمز جديد',
22
22
  },
23
23
  device: {
24
- title: 'سجّل الدخول بهاتفك',
25
- caption: 'امسح الرمز بكاميرا هاتفك',
26
24
  codeHint: 'تأكد من أن هاتفك يعرض هذا الرمز',
27
25
  },
28
26
  errors: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: 'নতুন কোড দেখান',
22
22
  },
23
23
  device: {
24
- title: 'আপনার ফোন দিয়ে সাইন ইন করুন',
25
- caption: 'আপনার ফোনের ক্যামেরা দিয়ে স্ক্যান করুন',
26
24
  codeHint: 'দেখে নিন আপনার ফোনে এই কোডটিই দেখাচ্ছে',
27
25
  },
28
26
  errors: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: 'Mostra un codi nou',
22
22
  },
23
23
  device: {
24
- title: 'Inicia la sessió amb el mòbil',
25
- caption: 'Escaneja amb la càmera del mòbil',
26
24
  codeHint: 'Comprova que el mòbil mostra aquest codi',
27
25
  },
28
26
  errors: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: 'Neuen Code anzeigen',
22
22
  },
23
23
  device: {
24
- title: 'Mit dem Smartphone anmelden',
25
- caption: 'Mit der Kamera deines Smartphones scannen',
26
24
  codeHint: 'Prüfe, ob dein Smartphone diesen Code anzeigt',
27
25
  },
28
26
  errors: {
@@ -172,8 +172,6 @@ const dict = {
172
172
  renew: 'Show a new code',
173
173
  },
174
174
  device: {
175
- title: 'Sign in with your phone',
176
- caption: "Scan with your phone's camera",
177
175
  codeHint: 'Check that your phone shows this code',
178
176
  },
179
177
  terms: {
@@ -172,8 +172,6 @@ const dict = {
172
172
  renew: 'Mostrar un código nuevo',
173
173
  },
174
174
  device: {
175
- title: 'Inicia sesión con tu móvil',
176
- caption: 'Escanea con la cámara de tu móvil',
177
175
  codeHint: 'Comprueba que tu móvil muestra este código',
178
176
  },
179
177
  terms: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: 'Afficher un nouveau code',
22
22
  },
23
23
  device: {
24
- title: 'Connectez-vous avec votre téléphone',
25
- caption: "Scannez avec l'appareil photo de votre téléphone",
26
24
  codeHint: 'Vérifiez que votre téléphone affiche ce code',
27
25
  },
28
26
  errors: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: 'नया कोड दिखाएं',
22
22
  },
23
23
  device: {
24
- title: 'अपने फ़ोन से साइन इन करें',
25
- caption: 'अपने फ़ोन के कैमरे से स्कैन करें',
26
24
  codeHint: 'जाँचें कि आपके फ़ोन पर यही कोड दिख रहा है',
27
25
  },
28
26
  errors: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: 'Tampilkan kode baru',
22
22
  },
23
23
  device: {
24
- title: 'Masuk dengan ponsel Anda',
25
- caption: 'Pindai dengan kamera ponsel Anda',
26
24
  codeHint: 'Pastikan ponsel Anda menampilkan kode ini',
27
25
  },
28
26
  errors: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: 'Mostra un nuovo codice',
22
22
  },
23
23
  device: {
24
- title: 'Accedi con il telefono',
25
- caption: 'Inquadra con la fotocamera del telefono',
26
24
  codeHint: 'Controlla che il telefono mostri questo codice',
27
25
  },
28
26
  errors: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: '新しいコードを表示',
22
22
  },
23
23
  device: {
24
- title: 'スマートフォンでサインイン',
25
- caption: 'スマートフォンのカメラでスキャン',
26
24
  codeHint: 'スマートフォンに同じコードが表示されていることを確認してください',
27
25
  },
28
26
  errors: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: '새 코드 표시',
22
22
  },
23
23
  device: {
24
- title: '휴대폰으로 로그인',
25
- caption: '휴대폰 카메라로 스캔하세요',
26
24
  codeHint: '휴대폰에 이 코드가 표시되는지 확인하세요',
27
25
  },
28
26
  errors: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: 'Mostrar um código novo',
22
22
  },
23
23
  device: {
24
- title: 'Inicie sessão com o telemóvel',
25
- caption: 'Leia com a câmara do telemóvel',
26
24
  codeHint: 'Confirme que o telemóvel mostra este código',
27
25
  },
28
26
  errors: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: 'Показать новый код',
22
22
  },
23
23
  device: {
24
- title: 'Войдите с телефона',
25
- caption: 'Отсканируйте камерой телефона',
26
24
  codeHint: 'Убедитесь, что на телефоне тот же код',
27
25
  },
28
26
  errors: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: 'Yeni kod göster',
22
22
  },
23
23
  device: {
24
- title: 'Telefonunla giriş yap',
25
- caption: 'Telefonunun kamerasıyla tara',
26
24
  codeHint: 'Telefonunda bu kodun göründüğünü kontrol et',
27
25
  },
28
26
  errors: {
@@ -21,8 +21,6 @@ const dict = {
21
21
  renew: '显示新的二维码',
22
22
  },
23
23
  device: {
24
- title: '用手机登录',
25
- caption: '用手机相机扫描',
26
24
  codeHint: '请确认手机上显示的是这个代码',
27
25
  },
28
26
  errors: {
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deviceComparisonCode = deviceComparisonCode;
4
+ /**
5
+ * The code a person compares between a device with no keyboard (a TV, a photo
6
+ * frame) and the phone approving its sign-in: `CE7F-B31F`.
7
+ *
8
+ * The device's QR carries the request's full `authorizeCode` (16 random bytes,
9
+ * hex), and that alone is what approves. Its first eight characters are
10
+ * enough to tell "the request on this screen" from any other: the server draws
11
+ * the code at random, so a look-alike request would take about four billion
12
+ * rate-limited attempts, while thirty-two characters were too many for anyone
13
+ * to compare. Both sides (`OxyDeviceSignIn` on the device and the approval
14
+ * page on the phone) derive it here, so they always print the same thing.
15
+ */
16
+ const COMPARISON_LENGTH = 8;
17
+ const GROUP_LENGTH = 4;
18
+ function deviceComparisonCode(authorizeCode) {
19
+ const head = authorizeCode.slice(0, COMPARISON_LENGTH).toUpperCase();
20
+ return `${head.slice(0, GROUP_LENGTH)}-${head.slice(GROUP_LENGTH)}`;
21
+ }
@@ -8,7 +8,7 @@
8
8
  * the API with a token it already has never needs it.
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.runColdBoot = exports.runSessionColdBoot = exports.TOKEN_REFRESH_LEAD_MS = exports.startTokenRefreshScheduler = exports.installAuthRefreshHandler = exports.createAuthRefreshHandler = exports.refreshDeviceSecretArm = exports.refreshPersistedSession = exports.establishIdentitySession = exports.resolveIdentityPin = exports.IDENTITY_PIN_STORAGE_KEY = exports.identityPinMatches = exports.createMemoryIdentityPinStore = exports.createNativeIdentityPinStore = exports.createWebIdentityPinStore = exports.readLocalDeviceCredential = exports.publishProvenDeviceCredential = exports.normalizeSharedDeviceSessionRead = exports.decideSharedDevicePublish = exports.decideSharedDeviceJoin = exports.createSharedMirroringAuthStateStore = exports.AUTH_STATE_STORAGE_KEY = exports.createMemoryAuthStateStore = exports.createNativeAuthStateStore = exports.createWebAuthStateStore = exports.createAccountDialogController = exports.AccountDialogController = exports.resolveAccountDelegationAccess = exports.canSwitchIntoAccount = exports.isSwitchTargetAccount = exports.showsPrincipalHeaders = exports.buildSwitcherRows = exports.resolveDeviceContext = exports.resolveActiveContext = exports.projectDevicePrincipals = exports.directoryHandle = exports.directoryDisplayName = exports.canActivateContext = exports.accountIdsOf = exports.activeUserOf = exports.activeSessionIdOf = exports.deviceStateToClientSessions = exports.createSessionClient = exports.createSessionClientHost = exports.SessionClient = exports.DeviceManager = void 0;
11
+ exports.runColdBoot = exports.runSessionColdBoot = exports.TOKEN_REFRESH_LEAD_MS = exports.startTokenRefreshScheduler = exports.installAuthRefreshHandler = exports.createAuthRefreshHandler = exports.refreshDeviceSecretArm = exports.refreshPersistedSession = exports.establishIdentitySession = exports.resolveIdentityPin = exports.IDENTITY_PIN_STORAGE_KEY = exports.identityPinMatches = exports.createMemoryIdentityPinStore = exports.createNativeIdentityPinStore = exports.createWebIdentityPinStore = exports.readLocalDeviceCredential = exports.publishProvenDeviceCredential = exports.normalizeSharedDeviceSessionRead = exports.decideSharedDevicePublish = exports.decideSharedDeviceJoin = exports.createSharedMirroringAuthStateStore = exports.AUTH_STATE_STORAGE_KEY = exports.createMemoryAuthStateStore = exports.createNativeAuthStateStore = exports.createWebAuthStateStore = exports.createAccountDialogController = exports.AccountDialogController = exports.resolveAccountDelegationAccess = exports.canSwitchIntoAccount = exports.isSwitchTargetAccount = exports.deviceComparisonCode = exports.showsPrincipalHeaders = exports.buildSwitcherRows = exports.resolveDeviceContext = exports.resolveActiveContext = exports.projectDevicePrincipals = exports.directoryHandle = exports.directoryDisplayName = exports.canActivateContext = exports.accountIdsOf = exports.activeUserOf = exports.activeSessionIdOf = exports.deviceStateToClientSessions = exports.createSessionClient = exports.createSessionClientHost = exports.SessionClient = exports.DeviceManager = void 0;
12
12
  // Session code reaches the identity key (identity-bound sessions), so the
13
13
  // crypto shim goes first — see `../crypto/polyfill`.
14
14
  require("../crypto/polyfill");
@@ -59,6 +59,8 @@ Object.defineProperty(exports, "resolveDeviceContext", { enumerable: true, get:
59
59
  var deviceSwitcherRows_1 = require("./deviceSwitcherRows");
60
60
  Object.defineProperty(exports, "buildSwitcherRows", { enumerable: true, get: function () { return deviceSwitcherRows_1.buildSwitcherRows; } });
61
61
  Object.defineProperty(exports, "showsPrincipalHeaders", { enumerable: true, get: function () { return deviceSwitcherRows_1.showsPrincipalHeaders; } });
62
+ var deviceComparisonCode_1 = require("./deviceComparisonCode");
63
+ Object.defineProperty(exports, "deviceComparisonCode", { enumerable: true, get: function () { return deviceComparisonCode_1.deviceComparisonCode; } });
62
64
  // The switch-target predicates over the account GRAPH — a list of accounts to
63
65
  // manage, not the device's list of identities to become (that is the directory
64
66
  // above). `isSwitchTargetAccount` is the structural half ("is this kind
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'عرض رمز جديد',
20
20
  },
21
21
  device: {
22
- title: 'سجّل الدخول بهاتفك',
23
- caption: 'امسح الرمز بكاميرا هاتفك',
24
22
  codeHint: 'تأكد من أن هاتفك يعرض هذا الرمز',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'নতুন কোড দেখান',
20
20
  },
21
21
  device: {
22
- title: 'আপনার ফোন দিয়ে সাইন ইন করুন',
23
- caption: 'আপনার ফোনের ক্যামেরা দিয়ে স্ক্যান করুন',
24
22
  codeHint: 'দেখে নিন আপনার ফোনে এই কোডটিই দেখাচ্ছে',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Mostra un codi nou',
20
20
  },
21
21
  device: {
22
- title: 'Inicia la sessió amb el mòbil',
23
- caption: 'Escaneja amb la càmera del mòbil',
24
22
  codeHint: 'Comprova que el mòbil mostra aquest codi',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Neuen Code anzeigen',
20
20
  },
21
21
  device: {
22
- title: 'Mit dem Smartphone anmelden',
23
- caption: 'Mit der Kamera deines Smartphones scannen',
24
22
  codeHint: 'Prüfe, ob dein Smartphone diesen Code anzeigt',
25
23
  },
26
24
  errors: {
@@ -170,8 +170,6 @@ const dict = {
170
170
  renew: 'Show a new code',
171
171
  },
172
172
  device: {
173
- title: 'Sign in with your phone',
174
- caption: "Scan with your phone's camera",
175
173
  codeHint: 'Check that your phone shows this code',
176
174
  },
177
175
  terms: {
@@ -170,8 +170,6 @@ const dict = {
170
170
  renew: 'Mostrar un código nuevo',
171
171
  },
172
172
  device: {
173
- title: 'Inicia sesión con tu móvil',
174
- caption: 'Escanea con la cámara de tu móvil',
175
173
  codeHint: 'Comprueba que tu móvil muestra este código',
176
174
  },
177
175
  terms: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Afficher un nouveau code',
20
20
  },
21
21
  device: {
22
- title: 'Connectez-vous avec votre téléphone',
23
- caption: "Scannez avec l'appareil photo de votre téléphone",
24
22
  codeHint: 'Vérifiez que votre téléphone affiche ce code',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'नया कोड दिखाएं',
20
20
  },
21
21
  device: {
22
- title: 'अपने फ़ोन से साइन इन करें',
23
- caption: 'अपने फ़ोन के कैमरे से स्कैन करें',
24
22
  codeHint: 'जाँचें कि आपके फ़ोन पर यही कोड दिख रहा है',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Tampilkan kode baru',
20
20
  },
21
21
  device: {
22
- title: 'Masuk dengan ponsel Anda',
23
- caption: 'Pindai dengan kamera ponsel Anda',
24
22
  codeHint: 'Pastikan ponsel Anda menampilkan kode ini',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Mostra un nuovo codice',
20
20
  },
21
21
  device: {
22
- title: 'Accedi con il telefono',
23
- caption: 'Inquadra con la fotocamera del telefono',
24
22
  codeHint: 'Controlla che il telefono mostri questo codice',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: '新しいコードを表示',
20
20
  },
21
21
  device: {
22
- title: 'スマートフォンでサインイン',
23
- caption: 'スマートフォンのカメラでスキャン',
24
22
  codeHint: 'スマートフォンに同じコードが表示されていることを確認してください',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: '새 코드 표시',
20
20
  },
21
21
  device: {
22
- title: '휴대폰으로 로그인',
23
- caption: '휴대폰 카메라로 스캔하세요',
24
22
  codeHint: '휴대폰에 이 코드가 표시되는지 확인하세요',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Mostrar um código novo',
20
20
  },
21
21
  device: {
22
- title: 'Inicie sessão com o telemóvel',
23
- caption: 'Leia com a câmara do telemóvel',
24
22
  codeHint: 'Confirme que o telemóvel mostra este código',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Показать новый код',
20
20
  },
21
21
  device: {
22
- title: 'Войдите с телефона',
23
- caption: 'Отсканируйте камерой телефона',
24
22
  codeHint: 'Убедитесь, что на телефоне тот же код',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Yeni kod göster',
20
20
  },
21
21
  device: {
22
- title: 'Telefonunla giriş yap',
23
- caption: 'Telefonunun kamerasıyla tara',
24
22
  codeHint: 'Telefonunda bu kodun göründüğünü kontrol et',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: '显示新的二维码',
20
20
  },
21
21
  device: {
22
- title: '用手机登录',
23
- caption: '用手机相机扫描',
24
22
  codeHint: '请确认手机上显示的是这个代码',
25
23
  },
26
24
  errors: {
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The code a person compares between a device with no keyboard (a TV, a photo
3
+ * frame) and the phone approving its sign-in: `CE7F-B31F`.
4
+ *
5
+ * The device's QR carries the request's full `authorizeCode` (16 random bytes,
6
+ * hex), and that alone is what approves. Its first eight characters are
7
+ * enough to tell "the request on this screen" from any other: the server draws
8
+ * the code at random, so a look-alike request would take about four billion
9
+ * rate-limited attempts, while thirty-two characters were too many for anyone
10
+ * to compare. Both sides (`OxyDeviceSignIn` on the device and the approval
11
+ * page on the phone) derive it here, so they always print the same thing.
12
+ */
13
+ const COMPARISON_LENGTH = 8;
14
+ const GROUP_LENGTH = 4;
15
+ export function deviceComparisonCode(authorizeCode) {
16
+ const head = authorizeCode.slice(0, COMPARISON_LENGTH).toUpperCase();
17
+ return `${head.slice(0, GROUP_LENGTH)}-${head.slice(GROUP_LENGTH)}`;
18
+ }
@@ -40,6 +40,7 @@ export { canActivateContext, directoryDisplayName, directoryHandle, projectDevic
40
40
  // auth.oxy.so chooser so the two cannot drift, the same reason the flat
41
41
  // projection lived here before it.
42
42
  export { buildSwitcherRows, showsPrincipalHeaders } from './deviceSwitcherRows.js';
43
+ export { deviceComparisonCode } from './deviceComparisonCode.js';
43
44
  // The switch-target predicates over the account GRAPH — a list of accounts to
44
45
  // manage, not the device's list of identities to become (that is the directory
45
46
  // above). `isSwitchTargetAccount` is the structural half ("is this kind
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -170,8 +170,6 @@ declare const dict: {
170
170
  renew: string;
171
171
  };
172
172
  device: {
173
- title: string;
174
- caption: string;
175
173
  codeHint: string;
176
174
  };
177
175
  terms: {
@@ -170,8 +170,6 @@ declare const dict: {
170
170
  renew: string;
171
171
  };
172
172
  device: {
173
- title: string;
174
- caption: string;
175
173
  codeHint: string;
176
174
  };
177
175
  terms: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -19,8 +19,6 @@ declare const dict: {
19
19
  renew: string;
20
20
  };
21
21
  device: {
22
- title: string;
23
- caption: string;
24
22
  codeHint: string;
25
23
  };
26
24
  errors: {
@@ -0,0 +1 @@
1
+ export declare function deviceComparisonCode(authorizeCode: string): string;
@@ -18,6 +18,7 @@ export { deviceStateToClientSessions, activeSessionIdOf, activeUserOf, accountId
18
18
  export { canActivateContext, directoryDisplayName, directoryHandle, projectDevicePrincipals, resolveActiveContext, resolveDeviceContext, } from './deviceDirectory';
19
19
  export type { DeviceContext, DeviceContextActor, DeviceContextSubject, DevicePrincipalGroup, } from './deviceDirectory';
20
20
  export { buildSwitcherRows, showsPrincipalHeaders } from './deviceSwitcherRows';
21
+ export { deviceComparisonCode } from './deviceComparisonCode';
21
22
  export type { ResolveAvatarUrl, SwitcherContextRow, SwitcherPrincipalRow, } from './deviceSwitcherRows';
22
23
  export { isSwitchTargetAccount, canSwitchIntoAccount, } from './accountSwitchTargets';
23
24
  export { resolveAccountDelegationAccess } from './accountDelegationAccess';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/core",
3
- "version": "7.8.0",
3
+ "version": "7.9.0",
4
4
  "description": "OxyHQ SDK Foundation — API client, authentication, cryptographic identity, and shared utilities",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'عرض رمز جديد',
20
20
  },
21
21
  device: {
22
- title: 'سجّل الدخول بهاتفك',
23
- caption: 'امسح الرمز بكاميرا هاتفك',
24
22
  codeHint: 'تأكد من أن هاتفك يعرض هذا الرمز',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'নতুন কোড দেখান',
20
20
  },
21
21
  device: {
22
- title: 'আপনার ফোন দিয়ে সাইন ইন করুন',
23
- caption: 'আপনার ফোনের ক্যামেরা দিয়ে স্ক্যান করুন',
24
22
  codeHint: 'দেখে নিন আপনার ফোনে এই কোডটিই দেখাচ্ছে',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Mostra un codi nou',
20
20
  },
21
21
  device: {
22
- title: 'Inicia la sessió amb el mòbil',
23
- caption: 'Escaneja amb la càmera del mòbil',
24
22
  codeHint: 'Comprova que el mòbil mostra aquest codi',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Neuen Code anzeigen',
20
20
  },
21
21
  device: {
22
- title: 'Mit dem Smartphone anmelden',
23
- caption: 'Mit der Kamera deines Smartphones scannen',
24
22
  codeHint: 'Prüfe, ob dein Smartphone diesen Code anzeigt',
25
23
  },
26
24
  errors: {
@@ -191,8 +191,6 @@ const dict = {
191
191
  renew: 'Show a new code',
192
192
  },
193
193
  device: {
194
- title: 'Sign in with your phone',
195
- caption: "Scan with your phone's camera",
196
194
  codeHint: 'Check that your phone shows this code',
197
195
  },
198
196
  terms: {
@@ -192,8 +192,6 @@ const dict = {
192
192
  renew: 'Mostrar un código nuevo',
193
193
  },
194
194
  device: {
195
- title: 'Inicia sesión con tu móvil',
196
- caption: 'Escanea con la cámara de tu móvil',
197
195
  codeHint: 'Comprueba que tu móvil muestra este código',
198
196
  },
199
197
  terms: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Afficher un nouveau code',
20
20
  },
21
21
  device: {
22
- title: 'Connectez-vous avec votre téléphone',
23
- caption: "Scannez avec l'appareil photo de votre téléphone",
24
22
  codeHint: 'Vérifiez que votre téléphone affiche ce code',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'नया कोड दिखाएं',
20
20
  },
21
21
  device: {
22
- title: 'अपने फ़ोन से साइन इन करें',
23
- caption: 'अपने फ़ोन के कैमरे से स्कैन करें',
24
22
  codeHint: 'जाँचें कि आपके फ़ोन पर यही कोड दिख रहा है',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Tampilkan kode baru',
20
20
  },
21
21
  device: {
22
- title: 'Masuk dengan ponsel Anda',
23
- caption: 'Pindai dengan kamera ponsel Anda',
24
22
  codeHint: 'Pastikan ponsel Anda menampilkan kode ini',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Mostra un nuovo codice',
20
20
  },
21
21
  device: {
22
- title: 'Accedi con il telefono',
23
- caption: 'Inquadra con la fotocamera del telefono',
24
22
  codeHint: 'Controlla che il telefono mostri questo codice',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: '新しいコードを表示',
20
20
  },
21
21
  device: {
22
- title: 'スマートフォンでサインイン',
23
- caption: 'スマートフォンのカメラでスキャン',
24
22
  codeHint: 'スマートフォンに同じコードが表示されていることを確認してください',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: '새 코드 표시',
20
20
  },
21
21
  device: {
22
- title: '휴대폰으로 로그인',
23
- caption: '휴대폰 카메라로 스캔하세요',
24
22
  codeHint: '휴대폰에 이 코드가 표시되는지 확인하세요',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Mostrar um código novo',
20
20
  },
21
21
  device: {
22
- title: 'Inicie sessão com o telemóvel',
23
- caption: 'Leia com a câmara do telemóvel',
24
22
  codeHint: 'Confirme que o telemóvel mostra este código',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Показать новый код',
20
20
  },
21
21
  device: {
22
- title: 'Войдите с телефона',
23
- caption: 'Отсканируйте камерой телефона',
24
22
  codeHint: 'Убедитесь, что на телефоне тот же код',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: 'Yeni kod göster',
20
20
  },
21
21
  device: {
22
- title: 'Telefonunla giriş yap',
23
- caption: 'Telefonunun kamerasıyla tara',
24
22
  codeHint: 'Telefonunda bu kodun göründüğünü kontrol et',
25
23
  },
26
24
  errors: {
@@ -19,8 +19,6 @@ const dict = {
19
19
  renew: '显示新的二维码',
20
20
  },
21
21
  device: {
22
- title: '用手机登录',
23
- caption: '用手机相机扫描',
24
22
  codeHint: '请确认手机上显示的是这个代码',
25
23
  },
26
24
  errors: {
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The code a person compares between a device with no keyboard (a TV, a photo
3
+ * frame) and the phone approving its sign-in: `CE7F-B31F`.
4
+ *
5
+ * The device's QR carries the request's full `authorizeCode` (16 random bytes,
6
+ * hex), and that alone is what approves. Its first eight characters are
7
+ * enough to tell "the request on this screen" from any other: the server draws
8
+ * the code at random, so a look-alike request would take about four billion
9
+ * rate-limited attempts, while thirty-two characters were too many for anyone
10
+ * to compare. Both sides (`OxyDeviceSignIn` on the device and the approval
11
+ * page on the phone) derive it here, so they always print the same thing.
12
+ */
13
+ const COMPARISON_LENGTH = 8;
14
+ const GROUP_LENGTH = 4;
15
+
16
+ export function deviceComparisonCode(authorizeCode: string): string {
17
+ const head = authorizeCode.slice(0, COMPARISON_LENGTH).toUpperCase();
18
+ return `${head.slice(0, GROUP_LENGTH)}-${head.slice(GROUP_LENGTH)}`;
19
+ }
@@ -75,6 +75,7 @@ export type {
75
75
  // auth.oxy.so chooser so the two cannot drift, the same reason the flat
76
76
  // projection lived here before it.
77
77
  export { buildSwitcherRows, showsPrincipalHeaders } from './deviceSwitcherRows';
78
+ export { deviceComparisonCode } from './deviceComparisonCode';
78
79
  export type {
79
80
  ResolveAvatarUrl,
80
81
  SwitcherContextRow,