@oxy.so/core 7.8.1 → 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.
@@ -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
@@ -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
@@ -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.1",
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",
@@ -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,