@oxy.so/core 1.7.1 → 1.7.4

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.
@@ -299,10 +299,13 @@ function OxyServicesAuthMixin(Base) {
299
299
  /**
300
300
  * Whether this process can prove what it is (ADR 0026).
301
301
  *
302
- * The check and the module that performs it are loaded LAZILY and only on a
303
- * Node host. `@oxy.so/core`'s root barrel reaches React Native and Expo, and
304
- * `server/workloadIdentity` imports `node:crypto` — a static import here
305
- * would pull it into every mobile bundle for a path a phone can never take.
302
+ * `#workload-identity` (package.json `imports`) selects a client
303
+ * implementation for native and browser bundlers, and the signer only for
304
+ * Node hosts. The runtime Node guard avoids calling attestation on clients;
305
+ * the module boundary keeps node:crypto out of their bundle graphs (a guard
306
+ * alone cannot). It is a package import, not a self-reference to an export
307
+ * subpath: a self-reference only resolves where `@oxy.so/core` is reachable
308
+ * through `node_modules`, which bundlers inside this workspace are not.
306
309
  *
307
310
  * @internal
308
311
  */
@@ -310,7 +313,7 @@ function OxyServicesAuthMixin(Base) {
310
313
  if (typeof process === 'undefined' || !process.versions?.node)
311
314
  return false;
312
315
  try {
313
- const { canAttestWorkloadIdentity } = await Promise.resolve().then(() => __importStar(require('../server/workloadIdentity')));
316
+ const { canAttestWorkloadIdentity } = await Promise.resolve().then(() => __importStar(require('#workload-identity')));
314
317
  return canAttestWorkloadIdentity();
315
318
  }
316
319
  catch {
@@ -338,7 +341,7 @@ function OxyServicesAuthMixin(Base) {
338
341
  return entry.token;
339
342
  if (entry?.pending)
340
343
  return entry.pending;
341
- const { requestWorkloadServiceToken } = await Promise.resolve().then(() => __importStar(require('../server/workloadIdentity')));
344
+ const { requestWorkloadServiceToken } = await Promise.resolve().then(() => __importStar(require('#workload-identity')));
342
345
  const seeded = entry ?? {
343
346
  token: '',
344
347
  expiresAt: 0,
@@ -1,3 +1,11 @@
1
1
  {
2
- "type": "commonjs"
2
+ "type": "commonjs",
3
+ "imports": {
4
+ "#workload-identity": {
5
+ "react-native": "./server/workloadIdentity.client.js",
6
+ "browser": "./server/workloadIdentity.client.js",
7
+ "node": "./server/workloadIdentity.js",
8
+ "default": "./server/workloadIdentity.client.js"
9
+ }
10
+ }
3
11
  }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.canAttestWorkloadIdentity = canAttestWorkloadIdentity;
4
+ exports.requestWorkloadServiceToken = requestWorkloadServiceToken;
5
+ /** Workload attestation belongs to a Node host, never a browser or device. */
6
+ function canAttestWorkloadIdentity() {
7
+ return false;
8
+ }
9
+ async function requestWorkloadServiceToken(_options) {
10
+ throw new Error('Workload identity is only available on a Node host');
11
+ }