@oxy.so/core 4.5.0-oxy-one.1 → 4.5.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.
- package/README.md +1 -1
- package/dist/cjs/HttpService.js +63 -19
- package/dist/cjs/api/accounts.js +10 -3
- package/dist/cjs/api/agency.js +3 -1
- package/dist/cjs/api/apps.js +15 -4
- package/dist/cjs/api/assets.js +39 -11
- package/dist/cjs/api/auth.js +28 -8
- package/dist/cjs/api/billing.js +24 -7
- package/dist/cjs/api/civic.js +14 -4
- package/dist/cjs/api/follows.js +9 -2
- package/dist/cjs/api/identity.js +31 -9
- package/dist/cjs/api/nodes.js +3 -1
- package/dist/cjs/api/privacy.js +8 -2
- package/dist/cjs/api/session.js +15 -4
- package/dist/cjs/api/store.js +15 -5
- package/dist/cjs/api/topics.js +10 -3
- package/dist/cjs/api/users.js +16 -4
- package/dist/cjs/boot/sessionColdBoot.js +40 -13
- package/dist/cjs/constants/version.js +6 -6
- package/dist/cjs/crypto/identityMarker.js +3 -1
- package/dist/cjs/crypto/identityProof.js +6 -1
- package/dist/cjs/crypto/keyManager.js +87 -32
- package/dist/cjs/crypto/recoveryPhrase.js +2 -2
- package/dist/cjs/crypto/signatureService.js +3 -4
- package/dist/cjs/i18n/index.js +16 -3
- package/dist/cjs/i18n/locales/ar-SA.js +366 -366
- package/dist/cjs/i18n/locales/ca-ES.js +366 -366
- package/dist/cjs/i18n/locales/de-DE.js +366 -366
- package/dist/cjs/i18n/locales/en-US.js +1994 -1994
- package/dist/cjs/i18n/locales/es-ES.js +1994 -1994
- package/dist/cjs/i18n/locales/fr-FR.js +366 -366
- package/dist/cjs/i18n/locales/it-IT.js +366 -366
- package/dist/cjs/i18n/locales/ja-JP.js +366 -366
- package/dist/cjs/i18n/locales/ko-KR.js +366 -366
- package/dist/cjs/i18n/locales/pt-PT.js +366 -366
- package/dist/cjs/i18n/locales/zh-CN.js +366 -366
- package/dist/cjs/inference/OxyInferenceClient.js +12 -18
- package/dist/cjs/models/interfaces.js +11 -11
- package/dist/cjs/server/OxyServer.js +86 -28
- package/dist/cjs/server/agentAccount.js +6 -2
- package/dist/cjs/server/aliaMachineCredential.js +39 -14
- package/dist/cjs/server/auth.js +5 -4
- package/dist/cjs/server/capabilityTicket.js +5 -5
- package/dist/cjs/server/index.js +2 -1
- package/dist/cjs/server/liveCapabilityTicket.js +4 -1
- package/dist/cjs/server/middleware.js +61 -42
- package/dist/cjs/server/namespaces.js +28 -7
- package/dist/cjs/server/requesterAssertion.js +36 -30
- package/dist/cjs/server/serviceTokenLifetime.js +7 -4
- package/dist/cjs/server/traffic.js +53 -14
- package/dist/cjs/server/trafficNodeHttp.js +33 -8
- package/dist/cjs/server/workloadIdentity.client.js +4 -0
- package/dist/cjs/server/workloadIdentity.js +28 -1
- package/dist/cjs/session/SessionClient.js +54 -17
- package/dist/cjs/session/accountDelegationAccess.js +4 -6
- package/dist/cjs/session/accountDialogController.js +1 -1
- package/dist/cjs/session/authStateStore.js +18 -9
- package/dist/cjs/session/identityPin.js +6 -2
- package/dist/cjs/session/refresh.js +81 -23
- package/dist/cjs/session/sharedDeviceCredential.js +28 -15
- package/dist/cjs/shared/utils/errorUtils.js +1 -1
- package/dist/cjs/shared/utils/networkUtils.js +1 -1
- package/dist/cjs/shared/utils/themeUtils.js +1 -1
- package/dist/cjs/utils/accountCacheSweep.js +3 -1
- package/dist/cjs/utils/accountUtils.js +1 -3
- package/dist/cjs/utils/asyncUtils.js +1 -1
- package/dist/cjs/utils/authHelpers.js +2 -1
- package/dist/cjs/utils/avatarUtils.js +4 -2
- package/dist/cjs/utils/cache.js +1 -1
- package/dist/cjs/utils/cacheKey.js +3 -1
- package/dist/cjs/utils/deviceManager.js +4 -4
- package/dist/cjs/utils/errorUtils.js +6 -4
- package/dist/cjs/utils/languageUtils.js +404 -57
- package/dist/cjs/utils/profileLinks.js +1 -3
- package/dist/cjs/utils/requestUtils.js +7 -1
- package/dist/cjs/utils/userIdentity.js +1 -1
- package/dist/cjs/utils/validationUtils.js +5 -6
- package/dist/esm/HttpService.js +64 -20
- package/dist/esm/api/accounts.js +11 -4
- package/dist/esm/api/agency.js +3 -1
- package/dist/esm/api/apps.js +15 -4
- package/dist/esm/api/assets.js +39 -11
- package/dist/esm/api/auth.js +28 -8
- package/dist/esm/api/billing.js +25 -8
- package/dist/esm/api/civic.js +14 -4
- package/dist/esm/api/follows.js +9 -2
- package/dist/esm/api/identity.js +31 -9
- package/dist/esm/api/nodes.js +3 -1
- package/dist/esm/api/privacy.js +8 -2
- package/dist/esm/api/session.js +15 -4
- package/dist/esm/api/store.js +15 -5
- package/dist/esm/api/topics.js +10 -3
- package/dist/esm/api/users.js +16 -4
- package/dist/esm/boot/sessionColdBoot.js +41 -14
- package/dist/esm/constants/version.js +6 -6
- package/dist/esm/crypto/identityMarker.js +3 -1
- package/dist/esm/crypto/identityProof.js +6 -1
- package/dist/esm/crypto/internal.js +1 -1
- package/dist/esm/crypto/keyManager.js +87 -32
- package/dist/esm/crypto/recoveryPhrase.js +2 -2
- package/dist/esm/crypto/signatureService.js +3 -4
- package/dist/esm/i18n/index.js +16 -3
- package/dist/esm/i18n/locales/ar-SA.js +366 -366
- package/dist/esm/i18n/locales/ca-ES.js +366 -366
- package/dist/esm/i18n/locales/de-DE.js +366 -366
- package/dist/esm/i18n/locales/en-US.js +1994 -1994
- package/dist/esm/i18n/locales/es-ES.js +1994 -1994
- package/dist/esm/i18n/locales/fr-FR.js +366 -366
- package/dist/esm/i18n/locales/it-IT.js +366 -366
- package/dist/esm/i18n/locales/ja-JP.js +366 -366
- package/dist/esm/i18n/locales/ko-KR.js +366 -366
- package/dist/esm/i18n/locales/pt-PT.js +366 -366
- package/dist/esm/i18n/locales/zh-CN.js +366 -366
- package/dist/esm/index.js +1 -1
- package/dist/esm/inference/OxyInferenceClient.js +13 -19
- package/dist/esm/models/interfaces.js +11 -11
- package/dist/esm/server/OxyServer.js +87 -29
- package/dist/esm/server/agentAccount.js +6 -2
- package/dist/esm/server/aliaMachineCredential.js +39 -14
- package/dist/esm/server/auth.js +6 -5
- package/dist/esm/server/capabilityTicket.js +6 -6
- package/dist/esm/server/index.js +5 -5
- package/dist/esm/server/liveCapabilityTicket.js +6 -3
- package/dist/esm/server/middleware.js +62 -43
- package/dist/esm/server/namespaces.js +31 -10
- package/dist/esm/server/requesterAssertion.js +36 -30
- package/dist/esm/server/serviceTokenLifetime.js +7 -4
- package/dist/esm/server/traffic.js +55 -16
- package/dist/esm/server/trafficNodeHttp.js +34 -9
- package/dist/esm/server/userInvalidation.js +1 -1
- package/dist/esm/server/workloadIdentity.client.js +3 -0
- package/dist/esm/server/workloadIdentity.js +27 -1
- package/dist/esm/session/SessionClient.js +54 -17
- package/dist/esm/session/accountDelegationAccess.js +5 -7
- package/dist/esm/session/accountDialogController.js +1 -1
- package/dist/esm/session/authStateStore.js +18 -9
- package/dist/esm/session/identityPin.js +6 -2
- package/dist/esm/session/refresh.js +82 -24
- package/dist/esm/session/sharedDeviceCredential.js +28 -15
- package/dist/esm/shared/utils/errorUtils.js +1 -1
- package/dist/esm/shared/utils/networkUtils.js +1 -1
- package/dist/esm/shared/utils/themeUtils.js +1 -1
- package/dist/esm/utils/accountCacheSweep.js +3 -1
- package/dist/esm/utils/accountUtils.js +1 -3
- package/dist/esm/utils/asyncUtils.js +1 -1
- package/dist/esm/utils/authHelpers.js +2 -1
- package/dist/esm/utils/avatarUtils.js +4 -2
- package/dist/esm/utils/cache.js +1 -1
- package/dist/esm/utils/cacheKey.js +3 -1
- package/dist/esm/utils/deviceManager.js +4 -4
- package/dist/esm/utils/errorUtils.js +6 -4
- package/dist/esm/utils/languageUtils.js +404 -57
- package/dist/esm/utils/profileLinks.js +1 -3
- package/dist/esm/utils/requestUtils.js +7 -1
- package/dist/esm/utils/userIdentity.js +1 -1
- package/dist/esm/utils/validationUtils.js +5 -6
- package/dist/types/HttpService.d.ts +1 -1
- package/dist/types/api/accounts.d.ts +1 -1
- package/dist/types/api/apps.d.ts +4 -4
- package/dist/types/crypto/internal.d.ts +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/server/index.d.ts +6 -6
- package/dist/types/server/workloadIdentity.client.d.ts +5 -1
- package/dist/types/server/workloadIdentity.d.ts +26 -0
- package/dist/types/session/accountDelegationAccess.d.ts +1 -1
- package/dist/types/session/index.d.ts +1 -1
- package/dist/types/utils/userIdentity.d.ts +1 -1
- package/dist/types/utils/validationUtils.d.ts +4 -5
- package/package.json +2 -3
- package/src/HttpService.ts +183 -53
- package/src/OxyServices.errors.ts +7 -3
- package/src/OxyServices.ts +6 -2
- package/src/api/accounts.ts +76 -26
- package/src/api/agency.ts +24 -9
- package/src/api/appData.ts +12 -2
- package/src/api/apps.ts +81 -31
- package/src/api/assets.ts +113 -43
- package/src/api/auth.ts +145 -77
- package/src/api/billing.ts +112 -65
- package/src/api/civic.ts +61 -19
- package/src/api/contacts.ts +4 -1
- package/src/api/devices.ts +54 -21
- package/src/api/follows.ts +88 -31
- package/src/api/identity.ts +101 -33
- package/src/api/linkedAccounts.ts +26 -8
- package/src/api/nodes.ts +18 -6
- package/src/api/notifications.ts +26 -6
- package/src/api/privacy.ts +42 -8
- package/src/api/reputation.ts +18 -7
- package/src/api/session.ts +23 -5
- package/src/api/store.ts +81 -31
- package/src/api/topics.ts +18 -6
- package/src/api/users.ts +98 -35
- package/src/boot/sessionColdBoot.ts +60 -19
- package/src/civic/payloads.ts +1 -4
- package/src/client/context.ts +6 -1
- package/src/constants/version.ts +7 -6
- package/src/crypto/aead.ts +1 -5
- package/src/crypto/ecdh.ts +1 -4
- package/src/crypto/identityDerivations.ts +5 -1
- package/src/crypto/identityMarker.ts +3 -1
- package/src/crypto/identityProof.ts +6 -1
- package/src/crypto/index.ts +11 -11
- package/src/crypto/internal.ts +6 -1
- package/src/crypto/keyManager.ts +348 -98
- package/src/crypto/recoveryPhrase.ts +14 -9
- package/src/crypto/registrationPow.ts +1 -1
- package/src/crypto/signatureService.ts +14 -6
- package/src/i18n/accountCategoryLabels.ts +1 -4
- package/src/i18n/accountRoleLabels.ts +1 -4
- package/src/i18n/index.ts +25 -7
- package/src/i18n/locales/ar-SA.ts +375 -366
- package/src/i18n/locales/ca-ES.ts +382 -366
- package/src/i18n/locales/de-DE.ts +387 -366
- package/src/i18n/locales/en-US.ts +2034 -1994
- package/src/i18n/locales/es-ES.ts +2043 -1994
- package/src/i18n/locales/fr-FR.ts +387 -366
- package/src/i18n/locales/it-IT.ts +380 -366
- package/src/i18n/locales/ja-JP.ts +380 -366
- package/src/i18n/locales/ko-KR.ts +377 -366
- package/src/i18n/locales/pt-PT.ts +383 -366
- package/src/i18n/locales/zh-CN.ts +373 -366
- package/src/i18n/trustTierLabels.ts +1 -4
- package/src/index.ts +371 -349
- package/src/inference/OxyInferenceClient.ts +784 -780
- package/src/models/interfaces.ts +30 -27
- package/src/server/OxyServer.ts +227 -68
- package/src/server/agentAccount.ts +8 -2
- package/src/server/aliaMachineCredential.ts +57 -16
- package/src/server/auth.ts +9 -5
- package/src/server/capabilityTicket.ts +30 -21
- package/src/server/index.ts +29 -6
- package/src/server/liveCapabilityTicket.ts +31 -9
- package/src/server/middleware.ts +212 -121
- package/src/server/namespaces.ts +247 -94
- package/src/server/rateLimit.ts +2 -4
- package/src/server/requesterAssertion.ts +93 -54
- package/src/server/serviceTokenLifetime.ts +9 -4
- package/src/server/traffic.ts +117 -23
- package/src/server/trafficNodeHttp.ts +61 -14
- package/src/server/userInvalidation.ts +1 -4
- package/src/server/workloadIdentity.client.ts +12 -1
- package/src/server/workloadIdentity.ts +52 -5
- package/src/session/SessionClient.ts +170 -49
- package/src/session/accountDelegationAccess.ts +24 -31
- package/src/session/accountDialogController.ts +59 -14
- package/src/session/accountSwitchTargets.ts +10 -15
- package/src/session/authStateStore.ts +121 -81
- package/src/session/deviceDirectory.ts +1 -3
- package/src/session/identityPin.ts +10 -11
- package/src/session/identitySession.ts +3 -1
- package/src/session/index.ts +87 -82
- package/src/session/refresh.ts +138 -44
- package/src/session/sessionClientHost.ts +1 -3
- package/src/session/sharedDeviceCredential.ts +35 -14
- package/src/session/socketLoader.ts +9 -2
- package/src/shared/utils/errorUtils.ts +5 -2
- package/src/shared/utils/networkUtils.ts +5 -8
- package/src/shared/utils/themeUtils.ts +2 -6
- package/src/types/buffer.d.ts +66 -21
- package/src/types/expo-secure-store.d.ts +5 -1
- package/src/utils/accountCacheSweep.ts +4 -5
- package/src/utils/accountUtils.ts +107 -108
- package/src/utils/apiUtils.ts +3 -3
- package/src/utils/asyncUtils.ts +2 -2
- package/src/utils/authHelpers.ts +10 -5
- package/src/utils/avatarUtils.ts +11 -6
- package/src/utils/cache.ts +9 -10
- package/src/utils/cacheKey.ts +5 -1
- package/src/utils/coldBoot.ts +1 -3
- package/src/utils/commonsDelivery.ts +1 -4
- package/src/utils/deviceManager.ts +15 -14
- package/src/utils/errorUtils.ts +68 -86
- package/src/utils/languageUtils.ts +407 -58
- package/src/utils/oauthPkce.ts +1 -4
- package/src/utils/platform.ts +0 -1
- package/src/utils/profileLinks.ts +2 -5
- package/src/utils/requestUtils.ts +18 -14
- package/src/utils/sessionUtils.ts +34 -33
- package/src/utils/userHandle.ts +3 -1
- package/src/utils/userIdentity.ts +1 -1
- package/src/utils/validationUtils.ts +11 -9
|
@@ -205,9 +205,7 @@ class OxyInferenceClient {
|
|
|
205
205
|
return __classPrivateFieldGet(this, _OxyInferenceClient_instances, "m", _OxyInferenceClient_request).call(this, 'POST', '/v1/responses', {
|
|
206
206
|
body: request,
|
|
207
207
|
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
208
|
-
...(options.idempotencyKey === undefined
|
|
209
|
-
? {}
|
|
210
|
-
: { idempotencyKey: options.idempotencyKey }),
|
|
208
|
+
...(options.idempotencyKey === undefined ? {} : { idempotencyKey: options.idempotencyKey }),
|
|
211
209
|
...(options.delegatedUserId === undefined
|
|
212
210
|
? {}
|
|
213
211
|
: { delegatedUserId: options.delegatedUserId }),
|
|
@@ -224,7 +222,8 @@ class OxyInferenceClient {
|
|
|
224
222
|
delegatedUserId: options.delegatedUserId,
|
|
225
223
|
});
|
|
226
224
|
const parsed = contracts_1.decisionSuccessSchema.safeParse(payload);
|
|
227
|
-
if (!parsed.success ||
|
|
225
|
+
if (!parsed.success ||
|
|
226
|
+
parsed.data.model !== input.model ||
|
|
228
227
|
!(0, contracts_1.decisionAnswersMatch)(input, parsed.data.data)) {
|
|
229
228
|
throw new OxyInferenceProtocolError('Invalid or mismatched decisions response.');
|
|
230
229
|
}
|
|
@@ -236,9 +235,7 @@ class OxyInferenceClient {
|
|
|
236
235
|
method: 'POST',
|
|
237
236
|
headers: await __classPrivateFieldGet(this, _OxyInferenceClient_instances, "m", _OxyInferenceClient_headers).call(this, 'audio/*', {
|
|
238
237
|
hasBody: true,
|
|
239
|
-
...(options.idempotencyKey === undefined
|
|
240
|
-
? {}
|
|
241
|
-
: { idempotencyKey: options.idempotencyKey }),
|
|
238
|
+
...(options.idempotencyKey === undefined ? {} : { idempotencyKey: options.idempotencyKey }),
|
|
242
239
|
...(options.delegatedUserId === undefined
|
|
243
240
|
? {}
|
|
244
241
|
: { delegatedUserId: options.delegatedUserId }),
|
|
@@ -310,9 +307,7 @@ class OxyInferenceClient {
|
|
|
310
307
|
method: 'POST',
|
|
311
308
|
headers: await __classPrivateFieldGet(this, _OxyInferenceClient_instances, "m", _OxyInferenceClient_headers).call(this, 'text/event-stream', {
|
|
312
309
|
hasBody: true,
|
|
313
|
-
...(options.idempotencyKey === undefined
|
|
314
|
-
? {}
|
|
315
|
-
: { idempotencyKey: options.idempotencyKey }),
|
|
310
|
+
...(options.idempotencyKey === undefined ? {} : { idempotencyKey: options.idempotencyKey }),
|
|
316
311
|
...(options.delegatedUserId === undefined
|
|
317
312
|
? {}
|
|
318
313
|
: { delegatedUserId: options.delegatedUserId }),
|
|
@@ -411,9 +406,7 @@ exports.OxyInferenceClient = OxyInferenceClient;
|
|
|
411
406
|
_OxyInferenceClient_baseURL = new WeakMap(), _OxyInferenceClient_credential = new WeakMap(), _OxyInferenceClient_fetch = new WeakMap(), _OxyInferenceClient_instances = new WeakSet(), _OxyInferenceClient_bearer =
|
|
412
407
|
/** The bearer for this request, from whichever lane was configured. */
|
|
413
408
|
async function _OxyInferenceClient_bearer() {
|
|
414
|
-
const value = typeof __classPrivateFieldGet(this, _OxyInferenceClient_credential, "f") === 'string'
|
|
415
|
-
? __classPrivateFieldGet(this, _OxyInferenceClient_credential, "f")
|
|
416
|
-
: await __classPrivateFieldGet(this, _OxyInferenceClient_credential, "f").call(this);
|
|
409
|
+
const value = typeof __classPrivateFieldGet(this, _OxyInferenceClient_credential, "f") === 'string' ? __classPrivateFieldGet(this, _OxyInferenceClient_credential, "f") : await __classPrivateFieldGet(this, _OxyInferenceClient_credential, "f").call(this);
|
|
417
410
|
if (value === null || value === undefined || value.length === 0) {
|
|
418
411
|
throw new Error('OxyInferenceClient has no bearer: the configured credential resolved to nothing. On the Oxy auth lane this usually means the session is not restored yet.');
|
|
419
412
|
}
|
|
@@ -451,9 +444,7 @@ async function _OxyInferenceClient_request(method, path, options) {
|
|
|
451
444
|
method,
|
|
452
445
|
headers: await __classPrivateFieldGet(this, _OxyInferenceClient_instances, "m", _OxyInferenceClient_headers).call(this, 'application/json', {
|
|
453
446
|
hasBody: options.body !== undefined,
|
|
454
|
-
...(options.idempotencyKey === undefined
|
|
455
|
-
? {}
|
|
456
|
-
: { idempotencyKey: options.idempotencyKey }),
|
|
447
|
+
...(options.idempotencyKey === undefined ? {} : { idempotencyKey: options.idempotencyKey }),
|
|
457
448
|
...(options.delegatedUserId === undefined
|
|
458
449
|
? {}
|
|
459
450
|
: { delegatedUserId: options.delegatedUserId }),
|
|
@@ -467,8 +458,11 @@ async function _OxyInferenceClient_request(method, path, options) {
|
|
|
467
458
|
}
|
|
468
459
|
if (options.bindRequestId) {
|
|
469
460
|
const requestId = response.headers.get('X-Oxy-Request-Id');
|
|
470
|
-
if (!requestId ||
|
|
471
|
-
|
|
461
|
+
if (!requestId ||
|
|
462
|
+
typeof payload !== 'object' ||
|
|
463
|
+
payload === null ||
|
|
464
|
+
!('requestId' in payload) ||
|
|
465
|
+
payload.requestId !== requestId) {
|
|
472
466
|
throw new OxyInferenceProtocolError('Decisions response request ID does not match its header.', requestId ?? undefined);
|
|
473
467
|
}
|
|
474
468
|
}
|
|
@@ -6,15 +6,15 @@ exports.SECURITY_EVENT_SEVERITY_MAP = void 0;
|
|
|
6
6
|
* Maps each event type to its default severity level
|
|
7
7
|
*/
|
|
8
8
|
exports.SECURITY_EVENT_SEVERITY_MAP = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
sign_in: 'low',
|
|
10
|
+
sign_out: 'low',
|
|
11
|
+
profile_updated: 'low',
|
|
12
|
+
email_changed: 'medium',
|
|
13
|
+
device_added: 'medium',
|
|
14
|
+
device_removed: 'medium',
|
|
15
|
+
security_settings_changed: 'medium',
|
|
16
|
+
account_recovery: 'high',
|
|
17
|
+
private_key_exported: 'high',
|
|
18
|
+
backup_created: 'high',
|
|
19
|
+
suspicious_activity: 'critical',
|
|
20
20
|
};
|
|
@@ -35,8 +35,9 @@ const serviceTokenLifetime_1 = require("./serviceTokenLifetime");
|
|
|
35
35
|
function reusableServiceToken(token) {
|
|
36
36
|
try {
|
|
37
37
|
const claims = (0, jwt_decode_1.jwtDecode)(token);
|
|
38
|
-
return (0, serviceTokenLifetime_1.hasBoundedServiceTokenLifetime)(claims) &&
|
|
39
|
-
|
|
38
|
+
return ((0, serviceTokenLifetime_1.hasBoundedServiceTokenLifetime)(claims) &&
|
|
39
|
+
typeof claims.exp === 'number' &&
|
|
40
|
+
claims.exp > Math.floor(Date.now() / 1000));
|
|
40
41
|
}
|
|
41
42
|
catch {
|
|
42
43
|
return false;
|
|
@@ -84,7 +85,11 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
84
85
|
this.actingAsPending = new Map();
|
|
85
86
|
this.actingAsGenerations = new Map();
|
|
86
87
|
/** Public keys only; never private material. */
|
|
87
|
-
this.jwksCache = {
|
|
88
|
+
this.jwksCache = {
|
|
89
|
+
keys: new Map(),
|
|
90
|
+
expiresAt: 0,
|
|
91
|
+
lastAttemptAt: 0,
|
|
92
|
+
};
|
|
88
93
|
/**
|
|
89
94
|
* Before this instant a request without a user session does not try to mint
|
|
90
95
|
* a service token and goes out anonymous. Set after a failed mint.
|
|
@@ -228,7 +233,9 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
228
233
|
});
|
|
229
234
|
throw new ServiceCredentialMismatchError();
|
|
230
235
|
}
|
|
231
|
-
if (entry.token &&
|
|
236
|
+
if (entry.token &&
|
|
237
|
+
reusableServiceToken(entry.token) &&
|
|
238
|
+
entry.expiresAt > now + TOKEN_REUSE_MARGIN_MS) {
|
|
232
239
|
return entry.token;
|
|
233
240
|
}
|
|
234
241
|
if (entry.pending) {
|
|
@@ -287,7 +294,8 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
287
294
|
throw new Error('A user session is required');
|
|
288
295
|
const answer = await this.request('GET', `/v1/products/${encodeURIComponent(parsed.productId)}/access/${encodeURIComponent(parsed.subjectAccountId)}/grants`, undefined, { cache: false, retry: false, headers: { Authorization: `Bearer ${accessToken}` } });
|
|
289
296
|
const snapshot = contracts_1.subjectProductGrantSnapshotSchema.parse(answer);
|
|
290
|
-
if (snapshot.access.subjectAccountId !== parsed.subjectAccountId ||
|
|
297
|
+
if (snapshot.access.subjectAccountId !== parsed.subjectAccountId ||
|
|
298
|
+
snapshot.access.productId !== parsed.productId)
|
|
291
299
|
throw new Error('Product grant response attribution differs');
|
|
292
300
|
return snapshot;
|
|
293
301
|
}
|
|
@@ -296,7 +304,8 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
296
304
|
const parsed = contracts_1.subjectProductAccessQuerySchema.parse(query);
|
|
297
305
|
const answer = await this.serviceRequest('GET', `/v1/products/${encodeURIComponent(parsed.productId)}/access/${encodeURIComponent(parsed.subjectAccountId)}/service-grants`, undefined, { cache: false, retry: false });
|
|
298
306
|
const snapshot = contracts_1.subjectProductGrantSnapshotSchema.parse(answer);
|
|
299
|
-
if (snapshot.access.subjectAccountId !== parsed.subjectAccountId ||
|
|
307
|
+
if (snapshot.access.subjectAccountId !== parsed.subjectAccountId ||
|
|
308
|
+
snapshot.access.productId !== parsed.productId)
|
|
300
309
|
throw new Error('Product grant response attribution differs');
|
|
301
310
|
return snapshot;
|
|
302
311
|
}
|
|
@@ -318,7 +327,13 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
318
327
|
*/
|
|
319
328
|
async verifyActingAs(appId, userId, options = {}) {
|
|
320
329
|
const pair = JSON.stringify([appId, userId]);
|
|
321
|
-
const cacheKey = JSON.stringify([
|
|
330
|
+
const cacheKey = JSON.stringify([
|
|
331
|
+
appId,
|
|
332
|
+
userId,
|
|
333
|
+
options.credentialId,
|
|
334
|
+
options.ownerAccountId,
|
|
335
|
+
options.environment,
|
|
336
|
+
]);
|
|
322
337
|
if (options.cache === true) {
|
|
323
338
|
const cached = this.actingAs.get(cacheKey);
|
|
324
339
|
if (cached && cached.expiresAt > Date.now()) {
|
|
@@ -401,18 +416,32 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
401
416
|
entry.secretBuf = secretBuf;
|
|
402
417
|
}
|
|
403
418
|
else {
|
|
404
|
-
this.serviceTokens.set(cacheKey, {
|
|
419
|
+
this.serviceTokens.set(cacheKey, {
|
|
420
|
+
token: response.token,
|
|
421
|
+
expiresAt,
|
|
422
|
+
secretBuf,
|
|
423
|
+
pending: null,
|
|
424
|
+
apiKey: key,
|
|
425
|
+
});
|
|
405
426
|
}
|
|
406
427
|
return response.token;
|
|
407
428
|
}
|
|
408
429
|
/** A token obtained by attestation, cached like a credential's (one identity per process). */
|
|
409
430
|
async workloadServiceToken() {
|
|
410
431
|
const entry = this.serviceTokens.get(WORKLOAD_CACHE_KEY);
|
|
411
|
-
if (entry?.token &&
|
|
432
|
+
if (entry?.token &&
|
|
433
|
+
reusableServiceToken(entry.token) &&
|
|
434
|
+
entry.expiresAt > Date.now() + TOKEN_REUSE_MARGIN_MS)
|
|
412
435
|
return entry.token;
|
|
413
436
|
if (entry?.pending)
|
|
414
437
|
return entry.pending;
|
|
415
|
-
const seeded = entry ?? {
|
|
438
|
+
const seeded = entry ?? {
|
|
439
|
+
token: '',
|
|
440
|
+
expiresAt: 0,
|
|
441
|
+
secretBuf: Buffer.alloc(0),
|
|
442
|
+
pending: null,
|
|
443
|
+
apiKey: WORKLOAD_CACHE_KEY,
|
|
444
|
+
};
|
|
416
445
|
this.serviceTokens.set(WORKLOAD_CACHE_KEY, seeded);
|
|
417
446
|
const pending = (async () => {
|
|
418
447
|
const granted = await (0, workloadIdentity_1.requestWorkloadServiceToken)({ baseUrl: this.baseURL });
|
|
@@ -442,8 +471,22 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
442
471
|
async lookupActingAs(appId, userId, options, pair, cacheKey, generation, serial, startedAt) {
|
|
443
472
|
try {
|
|
444
473
|
const serviceToken = await this.serviceToken();
|
|
445
|
-
const result = await this.request('GET', '/internal/service-acting-as/verify', {
|
|
446
|
-
|
|
474
|
+
const result = await this.request('GET', '/internal/service-acting-as/verify', {
|
|
475
|
+
appId,
|
|
476
|
+
userId,
|
|
477
|
+
...(options.credentialId
|
|
478
|
+
? {
|
|
479
|
+
credentialId: options.credentialId,
|
|
480
|
+
ownerAccountId: options.ownerAccountId,
|
|
481
|
+
environment: options.environment,
|
|
482
|
+
}
|
|
483
|
+
: {}),
|
|
484
|
+
}, {
|
|
485
|
+
cache: false,
|
|
486
|
+
retry: false,
|
|
487
|
+
timeout: 5000,
|
|
488
|
+
headers: { Authorization: `Bearer ${serviceToken}` },
|
|
489
|
+
});
|
|
447
490
|
// A deadline bounds how long an already old response can authorize. It
|
|
448
491
|
// is not by itself a measurement of end-to-end revocation latency.
|
|
449
492
|
if (this.actingAsGenerations.get(pair) !== generation || serial < generation.completed)
|
|
@@ -458,10 +501,11 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
458
501
|
const epoch = BigInt(rawEpoch);
|
|
459
502
|
if (epoch > 9223372036854775807n)
|
|
460
503
|
return null;
|
|
461
|
-
if (typeof result.authorized !== 'boolean' ||
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
504
|
+
if (typeof result.authorized !== 'boolean' ||
|
|
505
|
+
!Array.isArray(result.scopes) ||
|
|
506
|
+
!result.scopes.every((scope) => typeof scope === 'string' && scope.length > 0 && scope.trim() === scope) ||
|
|
507
|
+
new Set(result.scopes).size !== result.scopes.length ||
|
|
508
|
+
(!result.authorized && result.scopes.length !== 0))
|
|
465
509
|
return null;
|
|
466
510
|
const older = epoch < generation.epoch;
|
|
467
511
|
if (epoch > generation.epoch)
|
|
@@ -469,7 +513,8 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
469
513
|
if (result.authorized && older)
|
|
470
514
|
return null;
|
|
471
515
|
const verified = result.authorized === true
|
|
472
|
-
? { authorized: true, scopes: result.scopes, epoch: rawEpoch }
|
|
516
|
+
? { authorized: true, scopes: result.scopes, epoch: rawEpoch }
|
|
517
|
+
: null;
|
|
473
518
|
if (options.cache === true)
|
|
474
519
|
this.rememberActingAs(cacheKey, verified, startedAt + (verified ? ACTING_AS_GRANT_TTL_MS : ACTING_AS_DENIAL_TTL_MS));
|
|
475
520
|
return verified;
|
|
@@ -480,7 +525,10 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
480
525
|
this.clearActingAsPair(appId, userId);
|
|
481
526
|
}
|
|
482
527
|
logger_1.logger.warn('[oxy.auth] verifyActingAs lookup failed — not cached', {
|
|
483
|
-
component: 'auth',
|
|
528
|
+
component: 'auth',
|
|
529
|
+
method: 'verifyActingAs',
|
|
530
|
+
appId,
|
|
531
|
+
userId,
|
|
484
532
|
}, error);
|
|
485
533
|
return null;
|
|
486
534
|
}
|
|
@@ -519,11 +567,11 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
519
567
|
catch {
|
|
520
568
|
throw new middleware_1.OxyAccountEventError('Account event token is malformed');
|
|
521
569
|
}
|
|
522
|
-
if (Object.keys(header).length !== 3
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
570
|
+
if (Object.keys(header).length !== 3 ||
|
|
571
|
+
header.alg !== 'EdDSA' ||
|
|
572
|
+
header.typ !== 'secevent+jwt' ||
|
|
573
|
+
typeof header.kid !== 'string' ||
|
|
574
|
+
!/^[A-Za-z0-9._-]{1,128}$/.test(header.kid)) {
|
|
527
575
|
throw new middleware_1.OxyAccountEventError('Account event token header is not supported');
|
|
528
576
|
}
|
|
529
577
|
const nodeCrypto = await (0, protocol_1.loadNodeCrypto)();
|
|
@@ -532,7 +580,9 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
532
580
|
jwk = await (0, middleware_1.resolveServiceTokenPublicKey)(header.kid, options.jwksUrl ?? new URL('/.well-known/jwks.json', this.baseURL).toString(), this.jwksCache);
|
|
533
581
|
}
|
|
534
582
|
catch (error) {
|
|
535
|
-
throw new middleware_1.OxyAccountEventError(error instanceof Error
|
|
583
|
+
throw new middleware_1.OxyAccountEventError(error instanceof Error
|
|
584
|
+
? error.message.replace('Service token', 'Account event')
|
|
585
|
+
: 'Signing key is unavailable');
|
|
536
586
|
}
|
|
537
587
|
const signature = Buffer.from(signatureB64, 'base64url');
|
|
538
588
|
if (signature.toString('base64url') !== signatureB64 || signature.length !== 64) {
|
|
@@ -540,7 +590,10 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
540
590
|
}
|
|
541
591
|
let verified = false;
|
|
542
592
|
try {
|
|
543
|
-
const publicKey = nodeCrypto.createPublicKey({
|
|
593
|
+
const publicKey = nodeCrypto.createPublicKey({
|
|
594
|
+
key: jwk,
|
|
595
|
+
format: 'jwk',
|
|
596
|
+
});
|
|
544
597
|
verified = nodeCrypto.verify(null, Buffer.from(`${headerB64}.${payloadB64}`), publicKey, signature);
|
|
545
598
|
}
|
|
546
599
|
catch {
|
|
@@ -551,7 +604,7 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
551
604
|
if (payload.iss !== middleware_1.OXY_JWT_ISSUER) {
|
|
552
605
|
throw new middleware_1.OxyAccountEventError('Account event token issuer is not Oxy');
|
|
553
606
|
}
|
|
554
|
-
const audience = options.audience ?? await this.configuredServiceAppId();
|
|
607
|
+
const audience = options.audience ?? (await this.configuredServiceAppId());
|
|
555
608
|
if (typeof payload.aud !== 'string' || payload.aud !== audience) {
|
|
556
609
|
throw new middleware_1.OxyAccountEventError('Account event token is addressed to another application');
|
|
557
610
|
}
|
|
@@ -567,7 +620,10 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
567
620
|
}
|
|
568
621
|
const entries = Object.entries(events);
|
|
569
622
|
const deleted = events[middleware_1.OXY_ACCOUNT_DELETED_EVENT_URI];
|
|
570
|
-
if (entries.length !== 1 ||
|
|
623
|
+
if (entries.length !== 1 ||
|
|
624
|
+
typeof deleted !== 'object' ||
|
|
625
|
+
deleted === null ||
|
|
626
|
+
Array.isArray(deleted)) {
|
|
571
627
|
throw new middleware_1.OxyAccountEventError('Account event token carries an unknown event');
|
|
572
628
|
}
|
|
573
629
|
const body = deleted;
|
|
@@ -577,7 +633,9 @@ class OxyServer extends OxyServices_1.OxyServices {
|
|
|
577
633
|
if (typeof body.occurredAt !== 'string' || Number.isNaN(Date.parse(body.occurredAt))) {
|
|
578
634
|
throw new middleware_1.OxyAccountEventError('Account event has no occurrence time');
|
|
579
635
|
}
|
|
580
|
-
if (body.username !== undefined &&
|
|
636
|
+
if (body.username !== undefined &&
|
|
637
|
+
body.username !== null &&
|
|
638
|
+
typeof body.username !== 'string') {
|
|
581
639
|
throw new middleware_1.OxyAccountEventError('Account event username is malformed');
|
|
582
640
|
}
|
|
583
641
|
return {
|
|
@@ -10,8 +10,12 @@ async function signInAgentAccount(options) {
|
|
|
10
10
|
const publicKey = (0, secp256k1_1.normalizeSecp256k1PublicKey)(signer.publicKey.trim());
|
|
11
11
|
const claims = await client.auth.agent.requestChallenge(publicKey);
|
|
12
12
|
const timestamp = Date.now();
|
|
13
|
-
if (claims.action !== 'agent_signin' ||
|
|
14
|
-
|
|
13
|
+
if (claims.action !== 'agent_signin' ||
|
|
14
|
+
claims.accountId !== accountId ||
|
|
15
|
+
claims.actorId !== accountId ||
|
|
16
|
+
(0, secp256k1_1.normalizeSecp256k1PublicKey)(claims.publicKey) !== publicKey ||
|
|
17
|
+
!claims.authMethodId ||
|
|
18
|
+
claims.expiresAt <= timestamp) {
|
|
15
19
|
throw new Error('Agent challenge does not match this account and signer');
|
|
16
20
|
}
|
|
17
21
|
const signature = await signer.signMessage((0, contracts_1.buildAgentProofMessage)(claims, timestamp));
|
|
@@ -8,20 +8,34 @@ exports.createOxyAliaMachineCredentialAuth = createOxyAliaMachineCredentialAuth;
|
|
|
8
8
|
exports.OXY_ALIA_RESOURCE_APPLICATION_ID = '6a2f851751b784a86fd0e934';
|
|
9
9
|
exports.OXY_ALIA_MACHINE_SCOPES = ['alia:chat', 'inference:invoke'];
|
|
10
10
|
function id(value) {
|
|
11
|
-
return typeof value === 'string' && value.length > 0 && value.length <= 128 && value.trim() === value;
|
|
11
|
+
return (typeof value === 'string' && value.length > 0 && value.length <= 128 && value.trim() === value);
|
|
12
12
|
}
|
|
13
13
|
/** Strict response boundary: extra user/tier fields cannot smuggle authority. */
|
|
14
14
|
function isOxyAliaMachinePrincipal(value) {
|
|
15
15
|
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
16
16
|
return false;
|
|
17
17
|
const p = value;
|
|
18
|
-
const keys = [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
const keys = [
|
|
19
|
+
'kind',
|
|
20
|
+
'audience',
|
|
21
|
+
'applicationId',
|
|
22
|
+
'credentialId',
|
|
23
|
+
'ownerAccountId',
|
|
24
|
+
'environment',
|
|
25
|
+
'scopes',
|
|
26
|
+
];
|
|
27
|
+
return (Object.keys(p).length === keys.length &&
|
|
28
|
+
keys.every((key) => Object.prototype.hasOwnProperty.call(p, key)) &&
|
|
29
|
+
p.kind === 'machine' &&
|
|
30
|
+
p.audience === exports.OXY_ALIA_RESOURCE_APPLICATION_ID &&
|
|
31
|
+
id(p.applicationId) &&
|
|
32
|
+
id(p.credentialId) &&
|
|
33
|
+
id(p.ownerAccountId) &&
|
|
34
|
+
typeof p.environment === 'string' &&
|
|
35
|
+
['production', 'staging', 'development'].includes(p.environment) &&
|
|
36
|
+
Array.isArray(p.scopes) &&
|
|
37
|
+
p.scopes.length === 2 &&
|
|
38
|
+
exports.OXY_ALIA_MACHINE_SCOPES.every((scope) => p.scopes.includes(scope)));
|
|
25
39
|
}
|
|
26
40
|
// Keep the forwarding credential out of enumerable request/principal objects,
|
|
27
41
|
// logs, response serialization and persistent SDK/session state. No cache.
|
|
@@ -29,7 +43,9 @@ const forwardingCredentials = new WeakMap();
|
|
|
29
43
|
/** Only for the request-scoped Oxy inference client; never for a user API. */
|
|
30
44
|
function getOxyAliaMachineCredentialBearer(req) {
|
|
31
45
|
const bound = forwardingCredentials.get(req);
|
|
32
|
-
return bound && req.machineCredential === bound.principal
|
|
46
|
+
return bound && req.machineCredential === bound.principal
|
|
47
|
+
? bound.bearer
|
|
48
|
+
: null;
|
|
33
49
|
}
|
|
34
50
|
/** Opt into Alia's app-only chat lane on its two chat routes, never globally. */
|
|
35
51
|
function createOxyAliaMachineCredentialAuth(server, options) {
|
|
@@ -41,19 +57,28 @@ function createOxyAliaMachineCredentialAuth(server, options) {
|
|
|
41
57
|
return;
|
|
42
58
|
}
|
|
43
59
|
const existing = req;
|
|
44
|
-
if (existing.user ||
|
|
45
|
-
||
|
|
46
|
-
|
|
60
|
+
if (existing.user ||
|
|
61
|
+
existing.userId ||
|
|
62
|
+
existing.serviceApp ||
|
|
63
|
+
existing.oxyRequester ||
|
|
64
|
+
req.machineCredential ||
|
|
65
|
+
req.headers['x-oxy-user-id'] !== undefined ||
|
|
66
|
+
req.headers['x-oxy-requester-assertion'] !== undefined) {
|
|
47
67
|
res.status(403).json({ error: 'MACHINE_USER_DELEGATION_UNSUPPORTED' });
|
|
48
68
|
return;
|
|
49
69
|
}
|
|
50
70
|
try {
|
|
51
71
|
const answer = await server.apps.introspectAliaMachineCredential(token);
|
|
52
|
-
if (!answer.active ||
|
|
72
|
+
if (!answer.active ||
|
|
73
|
+
!isOxyAliaMachinePrincipal(answer.principal) ||
|
|
74
|
+
answer.principal.environment !== options.environment) {
|
|
53
75
|
res.status(401).json({ error: 'MACHINE_CREDENTIAL_INVALID' });
|
|
54
76
|
return;
|
|
55
77
|
}
|
|
56
|
-
const principal = Object.freeze({
|
|
78
|
+
const principal = Object.freeze({
|
|
79
|
+
...answer.principal,
|
|
80
|
+
scopes: Object.freeze(['alia:chat', 'inference:invoke']),
|
|
81
|
+
});
|
|
57
82
|
req.machineCredential = principal;
|
|
58
83
|
forwardingCredentials.set(req, { principal, bearer: token });
|
|
59
84
|
next();
|
package/dist/cjs/server/auth.js
CHANGED
|
@@ -36,9 +36,7 @@ function ensureUser(req, userId) {
|
|
|
36
36
|
}
|
|
37
37
|
function getOxyUserId(req) {
|
|
38
38
|
const authReq = req;
|
|
39
|
-
return (normalizeId(authReq.userId) ??
|
|
40
|
-
normalizeId(authReq.user?.id) ??
|
|
41
|
-
normalizeId(authReq.user?._id));
|
|
39
|
+
return (normalizeId(authReq.userId) ?? normalizeId(authReq.user?.id) ?? normalizeId(authReq.user?._id));
|
|
42
40
|
}
|
|
43
41
|
/**
|
|
44
42
|
* Who acted, and as whom, on this user session (issue #1520), or `null` when
|
|
@@ -182,7 +180,10 @@ function requireOxyAuth(req, res, next) {
|
|
|
182
180
|
next();
|
|
183
181
|
}
|
|
184
182
|
function createOptionalOxyAuth(oxy, options = {}) {
|
|
185
|
-
const resolveSession = oxy.middleware.auth({
|
|
183
|
+
const resolveSession = oxy.middleware.auth({
|
|
184
|
+
...options.auth,
|
|
185
|
+
optional: true,
|
|
186
|
+
});
|
|
186
187
|
return (req, res, next) => {
|
|
187
188
|
if (getOxyUserId(req)) {
|
|
188
189
|
next();
|
|
@@ -63,11 +63,11 @@ function verifyCapabilityTicket(token, options) {
|
|
|
63
63
|
throw new CapabilityTicketError('malformed', 'Capability ticket header is not supported');
|
|
64
64
|
}
|
|
65
65
|
const headerRecord = header;
|
|
66
|
-
if (Object.keys(headerRecord).length !== 3
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
if (Object.keys(headerRecord).length !== 3 ||
|
|
67
|
+
headerRecord.alg !== ALGORITHM ||
|
|
68
|
+
headerRecord.typ !== TOKEN_TYPE ||
|
|
69
|
+
typeof headerRecord.kid !== 'string' ||
|
|
70
|
+
headerRecord.kid.length === 0) {
|
|
71
71
|
throw new CapabilityTicketError('malformed', 'Capability ticket header is not supported');
|
|
72
72
|
}
|
|
73
73
|
const publicKey = options.resolvePublicKey(headerRecord.kid);
|
package/dist/cjs/server/index.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.inlineScriptCspHash = exports.formatOxyCspPolicy = exports.extractInlineScripts = exports.cspSourcesFor = exports.createOxySecurityHeaders = exports.buildOxyPagesHeaders = exports.buildOxyCspDirectives = exports.createOxyCors = exports.UPSTREAM_HEADERS_TIMEOUT_MS = exports.MAX_URL_LENGTH = exports.MAX_REDIRECTS = exports.DEFAULT_USER_AGENT = exports.BLOCKED_HOSTNAMES = exports.ALLOWED_PROTOCOLS = exports.ALLOWED_PORTS = exports.UpstreamError = exports.SsrfRejection = exports.safeFetch = exports.isBlockedIp = exports.assertSafePublicUrl = exports.createOxyRateLimit = exports.OXY_SERVICE_ENVIRONMENTS = exports.requireOxyAuth = exports.isOxyAuthenticated = exports.getRequiredOxyUserId = exports.getRequiredOxyBillingPrincipal = exports.getOxyUserId = exports.getOxyRequestAttribution = exports.getOxyDelegatedUserId = exports.getOxyBillingPrincipal = exports.getOxyAuthRefusal = exports.getOxyActor = exports.createOxyAuthMiddleware = exports.createOptionalOxyAuth = exports.OXY_ACCOUNT_DELETED_EVENT_URI = exports.OxyAccountEventError = exports.OXY_ALIA_MACHINE_SCOPES = exports.OXY_ALIA_RESOURCE_APPLICATION_ID = exports.isOxyAliaMachinePrincipal = exports.getOxyAliaMachineCredentialBearer = exports.createOxyAliaMachineCredentialAuth = exports.ServerReputationApi = exports.ServerNotificationsApi = exports.ServerLinkedAccountsApi = exports.ServerAssetsApi = exports.ServerAgencyApi = exports.ServerAppsApi = exports.ANONYMOUS_SERVICE_TOKEN_RETRY_MS = exports.ServiceCredentialMismatchError = exports.OxyServer = void 0;
|
|
20
|
-
exports.signInAgentAccount = exports.hasBoundedServiceTokenLifetime = exports.OXY_SERVICE_TOKEN_MAX_LIFETIME_SECONDS = exports.requestWorkloadServiceToken = exports.canAttestWorkloadIdentity = exports.withoutNodeHttpObservation = exports.observeNodeHttp = exports.createEcosystemTraffic = exports.isAllowedDeviceJoinOrigin = exports.isOfficialWebOrigin = exports.isLoopbackOrigin = exports.registrableApex = exports.OXY_IDENTITY_CACHE_PREFIXES = exports.oxyUserByIdCacheKey = exports.evictOxyIdentityCache = exports.publishOxyUserInvalidation = exports.createOxyUserInvalidationHandler = exports.createLiveCapabilityTicketVerifier = exports.verifySecret = exports.verifyOxyRequesterAssertion = exports.signOxyRequesterAssertion = exports.readOxyRequesterAssertionKeyId = exports.oxyRequesterAssertionClaimsSchema = exports.OxyRequesterAssertionError = exports.OXY_REQUESTER_ASSERTION_TYPE = exports.OXY_REQUESTER_ASSERTION_MAX_TTL_SECONDS = exports.OXY_REQUESTER_ASSERTION_HEADER = exports.OXY_REQUESTER_ASSERTION_DEFAULT_ISSUER = exports.createOxyRequesterAssertionAuth = exports.createOxyJwksKeyResolver = exports.verifyCapabilityTicket = exports.readCapabilityAuthorization = exports.issueCapabilityTicket = exports.inputSatisfiesCapabilityLimits = exports.createCapabilityTicketMiddleware = exports.CapabilityTicketError = exports.OXY_CSP_BASELINE = void 0;
|
|
20
|
+
exports.signInAgentAccount = exports.hasBoundedServiceTokenLifetime = exports.OXY_SERVICE_TOKEN_MAX_LIFETIME_SECONDS = exports.requestWorkloadServiceToken = exports.canAttestWorkloadIdentity = exports.attestWorkloadIdentity = exports.withoutNodeHttpObservation = exports.observeNodeHttp = exports.createEcosystemTraffic = exports.isAllowedDeviceJoinOrigin = exports.isOfficialWebOrigin = exports.isLoopbackOrigin = exports.registrableApex = exports.OXY_IDENTITY_CACHE_PREFIXES = exports.oxyUserByIdCacheKey = exports.evictOxyIdentityCache = exports.publishOxyUserInvalidation = exports.createOxyUserInvalidationHandler = exports.createLiveCapabilityTicketVerifier = exports.verifySecret = exports.verifyOxyRequesterAssertion = exports.signOxyRequesterAssertion = exports.readOxyRequesterAssertionKeyId = exports.oxyRequesterAssertionClaimsSchema = exports.OxyRequesterAssertionError = exports.OXY_REQUESTER_ASSERTION_TYPE = exports.OXY_REQUESTER_ASSERTION_MAX_TTL_SECONDS = exports.OXY_REQUESTER_ASSERTION_HEADER = exports.OXY_REQUESTER_ASSERTION_DEFAULT_ISSUER = exports.createOxyRequesterAssertionAuth = exports.createOxyJwksKeyResolver = exports.verifyCapabilityTicket = exports.readCapabilityAuthorization = exports.issueCapabilityTicket = exports.inputSatisfiesCapabilityLimits = exports.createCapabilityTicketMiddleware = exports.CapabilityTicketError = exports.OXY_CSP_BASELINE = void 0;
|
|
21
21
|
// The backend client: OxyServices plus the service-token lane, middleware,
|
|
22
22
|
// account events and the service-only namespace methods.
|
|
23
23
|
var OxyServer_1 = require("./OxyServer");
|
|
@@ -150,6 +150,7 @@ Object.defineProperty(exports, "withoutNodeHttpObservation", { enumerable: true,
|
|
|
150
150
|
* container credentials endpoint.
|
|
151
151
|
*/
|
|
152
152
|
var workloadIdentity_1 = require("./workloadIdentity");
|
|
153
|
+
Object.defineProperty(exports, "attestWorkloadIdentity", { enumerable: true, get: function () { return workloadIdentity_1.attestWorkloadIdentity; } });
|
|
153
154
|
Object.defineProperty(exports, "canAttestWorkloadIdentity", { enumerable: true, get: function () { return workloadIdentity_1.canAttestWorkloadIdentity; } });
|
|
154
155
|
Object.defineProperty(exports, "requestWorkloadServiceToken", { enumerable: true, get: function () { return workloadIdentity_1.requestWorkloadServiceToken; } });
|
|
155
156
|
var serviceTokenLifetime_1 = require("./serviceTokenLifetime");
|
|
@@ -28,7 +28,10 @@ function createLiveCapabilityTicketVerifier(options) {
|
|
|
28
28
|
if (controller.signal.aborted)
|
|
29
29
|
rejectAbort();
|
|
30
30
|
});
|
|
31
|
-
const result = await Promise.race([
|
|
31
|
+
const result = await Promise.race([
|
|
32
|
+
options.introspect(ticket, { signal: controller.signal }),
|
|
33
|
+
interrupted,
|
|
34
|
+
]);
|
|
32
35
|
controller.signal.throwIfAborted();
|
|
33
36
|
if (result.active !== true)
|
|
34
37
|
throw new Error('Capability ticket is inactive');
|