@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.
@@ -259,10 +259,13 @@ export function OxyServicesAuthMixin(Base) {
259
259
  /**
260
260
  * Whether this process can prove what it is (ADR 0026).
261
261
  *
262
- * The check and the module that performs it are loaded LAZILY and only on a
263
- * Node host. `@oxy.so/core`'s root barrel reaches React Native and Expo, and
264
- * `server/workloadIdentity` imports `node:crypto` — a static import here
265
- * would pull it into every mobile bundle for a path a phone can never take.
262
+ * `#workload-identity` (package.json `imports`) selects a client
263
+ * implementation for native and browser bundlers, and the signer only for
264
+ * Node hosts. The runtime Node guard avoids calling attestation on clients;
265
+ * the module boundary keeps node:crypto out of their bundle graphs (a guard
266
+ * alone cannot). It is a package import, not a self-reference to an export
267
+ * subpath: a self-reference only resolves where `@oxy.so/core` is reachable
268
+ * through `node_modules`, which bundlers inside this workspace are not.
266
269
  *
267
270
  * @internal
268
271
  */
@@ -270,7 +273,7 @@ export function OxyServicesAuthMixin(Base) {
270
273
  if (typeof process === 'undefined' || !process.versions?.node)
271
274
  return false;
272
275
  try {
273
- const { canAttestWorkloadIdentity } = await import('../server/workloadIdentity.js');
276
+ const { canAttestWorkloadIdentity } = await import('#workload-identity');
274
277
  return canAttestWorkloadIdentity();
275
278
  }
276
279
  catch {
@@ -298,7 +301,7 @@ export function OxyServicesAuthMixin(Base) {
298
301
  return entry.token;
299
302
  if (entry?.pending)
300
303
  return entry.pending;
301
- const { requestWorkloadServiceToken } = await import('../server/workloadIdentity.js');
304
+ const { requestWorkloadServiceToken } = await import('#workload-identity');
302
305
  const seeded = entry ?? {
303
306
  token: '',
304
307
  expiresAt: 0,
@@ -1,3 +1,11 @@
1
1
  {
2
- "type": "module"
2
+ "type": "module",
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,7 @@
1
+ /** Workload attestation belongs to a Node host, never a browser or device. */
2
+ export function canAttestWorkloadIdentity() {
3
+ return false;
4
+ }
5
+ export async function requestWorkloadServiceToken(_options) {
6
+ throw new Error('Workload identity is only available on a Node host');
7
+ }