@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.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/mixins/OxyServices.auth.js +9 -6
- package/dist/cjs/package.json +9 -1
- package/dist/cjs/server/workloadIdentity.client.js +11 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/mixins/OxyServices.auth.js +9 -6
- package/dist/esm/package.json +9 -1
- package/dist/esm/server/workloadIdentity.client.js +7 -0
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/mixins/OxyServices.auth.d.ts +7 -4
- package/dist/types/server/workloadIdentity.client.d.ts +4 -0
- package/package.json +2 -2
- package/src/mixins/OxyServices.auth.ts +9 -6
- package/src/server/__tests__/workloadIdentity.client.test.ts +16 -0
- package/src/server/workloadIdentity.client.ts +12 -0
|
@@ -299,10 +299,13 @@ function OxyServicesAuthMixin(Base) {
|
|
|
299
299
|
/**
|
|
300
300
|
* Whether this process can prove what it is (ADR 0026).
|
|
301
301
|
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
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('
|
|
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('
|
|
344
|
+
const { requestWorkloadServiceToken } = await Promise.resolve().then(() => __importStar(require('#workload-identity')));
|
|
342
345
|
const seeded = entry ?? {
|
|
343
346
|
token: '',
|
|
344
347
|
expiresAt: 0,
|
package/dist/cjs/package.json
CHANGED
|
@@ -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
|
+
}
|