axiam-sdk 1.1.0 → 1.1.2

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.
Files changed (60) hide show
  1. package/README.md +27 -2
  2. package/dist/amqp/index.d.cts +3 -2
  3. package/dist/amqp/index.d.ts +3 -2
  4. package/dist/{authzCore-BQfX9qxN.d.cts → authzCore-CqXzLNmT.d.cts} +4 -3
  5. package/dist/{authzCore-BlSHwGnW.d.ts → authzCore-D-hquWSI.d.ts} +4 -3
  6. package/dist/browser/index.d.cts +8 -7
  7. package/dist/browser/index.d.ts +8 -7
  8. package/dist/{client-7ZKtfXW-.d.cts → client-BGFn1VQh.d.cts} +34 -24
  9. package/dist/{client-Putxo-yi.d.ts → client-DrQZZ1js.d.ts} +34 -24
  10. package/dist/{cookieJar-Cw6Zdeec.d.ts → cookieJar-BTmpjXZe.d.ts} +9 -3
  11. package/dist/{cookieJar-DkGcIr-i.d.cts → cookieJar-BqYOnNN-.d.cts} +9 -3
  12. package/dist/{errors-DMIlw2lN.d.ts → errors-DZ3k8a8i.d.cts} +2 -1
  13. package/dist/{errors-DMIlw2lN.d.cts → errors-DZ3k8a8i.d.ts} +2 -1
  14. package/dist/{errors-VpViVRSx.d.ts → errors-RvGlTyUj.d.cts} +3 -2
  15. package/dist/{errors-CtP_lviy.d.cts → errors-dlGXAsbh.d.ts} +3 -2
  16. package/dist/grpc/index.d.cts +10 -9
  17. package/dist/grpc/index.d.ts +10 -9
  18. package/dist/grpc/index.js +68 -7
  19. package/dist/grpc/index.js.map +1 -1
  20. package/dist/grpc/index.mjs +68 -7
  21. package/dist/grpc/index.mjs.map +1 -1
  22. package/dist/index.d.cts +6 -6
  23. package/dist/index.d.ts +6 -6
  24. package/dist/index.js +60 -7
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +60 -7
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/{jwks-BR55d7-Z.d.cts → jwks-CTVpOWzI.d.cts} +2 -1
  29. package/dist/{jwks-BR55d7-Z.d.ts → jwks-CTVpOWzI.d.ts} +2 -1
  30. package/dist/middleware/index.d.cts +13 -12
  31. package/dist/middleware/index.d.ts +13 -12
  32. package/dist/middleware/index.js +176 -31
  33. package/dist/middleware/index.js.map +1 -1
  34. package/dist/middleware/index.mjs +176 -31
  35. package/dist/middleware/index.mjs.map +1 -1
  36. package/dist/nestjs/index.d.cts +5 -4
  37. package/dist/nestjs/index.d.ts +5 -4
  38. package/dist/node/index.d.cts +10 -9
  39. package/dist/node/index.d.ts +10 -9
  40. package/dist/node/index.js +215 -29
  41. package/dist/node/index.js.map +1 -1
  42. package/dist/node/index.mjs +215 -29
  43. package/dist/node/index.mjs.map +1 -1
  44. package/dist/{oidcState-Cz6erz0g.d.cts → oidcState-BaJ-SM_R.d.cts} +41 -9
  45. package/dist/{oidcState-zGt6VU6v.d.ts → oidcState-C3VLn3eD.d.ts} +41 -9
  46. package/dist/rest/index.d.cts +10 -9
  47. package/dist/rest/index.d.ts +10 -9
  48. package/dist/rest/index.js +60 -7
  49. package/dist/rest/index.js.map +1 -1
  50. package/dist/rest/index.mjs +60 -7
  51. package/dist/rest/index.mjs.map +1 -1
  52. package/dist/{revocationFeed-CDoD7Twr.d.cts → revocationFeed-KQhvMMl8.d.cts} +2 -1
  53. package/dist/{revocationFeed-CDoD7Twr.d.ts → revocationFeed-KQhvMMl8.d.ts} +2 -1
  54. package/dist/{session-CeG6P9GO.d.ts → session-B03NsqVs.d.ts} +19 -2
  55. package/dist/{session-BmjEMowX.d.cts → session-plDr4lFu.d.cts} +19 -2
  56. package/dist/{telemetry--0DwnNjV.d.cts → telemetry-Du0-zS5f.d.cts} +2 -1
  57. package/dist/{telemetry--0DwnNjV.d.ts → telemetry-Du0-zS5f.d.ts} +2 -1
  58. package/dist/{webauthnErrors-fLgfOflO.d.cts → webauthnErrors-m1LZiaRy.d.cts} +2 -1
  59. package/dist/{webauthnErrors-fLgfOflO.d.ts → webauthnErrors-m1LZiaRy.d.ts} +2 -1
  60. package/package.json +2 -2
@@ -1,10 +1,10 @@
1
- import { R as RequireAccessOptions, A as AuthzVerifiableSession } from '../authzCore-BQfX9qxN.cjs';
1
+ import { R as RequireAccessOptions, A as AuthzVerifiableSession } from '../authzCore-CqXzLNmT.cjs';
2
2
  import { CanActivate, ExecutionContext } from '@nestjs/common';
3
3
  import { Reflector } from '@nestjs/core';
4
4
  import '../sensitive-BC_s7Rrd.cjs';
5
5
  import '../types-zXSpiQM-.cjs';
6
- import '../jwks-BR55d7-Z.cjs';
7
- import '../revocationFeed-CDoD7Twr.cjs';
6
+ import '../jwks-CTVpOWzI.cjs';
7
+ import '../revocationFeed-KQhvMMl8.cjs';
8
8
 
9
9
  /** `{ param: 'id' }` form of the `@RequireAccess` `resource` argument (§11.2.3.b): resolve the resource id from the named route parameter at request time. */
10
10
  interface NestParamResource {
@@ -99,4 +99,5 @@ declare const AXIAM_REQUIRE_ACCESS_METADATA: unique symbol;
99
99
  /** Set by {@link RequireRole}; read by {@link AxiamGuard}. Value shape: `string[]`. */
100
100
  declare const AXIAM_REQUIRE_ROLE_METADATA: unique symbol;
101
101
 
102
- export { AXIAM_REQUIRE_ACCESS_METADATA, AXIAM_REQUIRE_AUTH_METADATA, AXIAM_REQUIRE_ROLE_METADATA, AXIAM_SESSION, AuthzVerifiableSession, AxiamGuard, type NestParamResource, type NestResourceSpec, RequireAccess, type RequireAccessMetadata, RequireAccessOptions, RequireAuth, RequireRole };
102
+ export { AXIAM_REQUIRE_ACCESS_METADATA, AXIAM_REQUIRE_AUTH_METADATA, AXIAM_REQUIRE_ROLE_METADATA, AXIAM_SESSION, AuthzVerifiableSession, AxiamGuard, RequireAccess, RequireAccessOptions, RequireAuth, RequireRole };
103
+ export type { NestParamResource, NestResourceSpec, RequireAccessMetadata };
@@ -1,10 +1,10 @@
1
- import { R as RequireAccessOptions, A as AuthzVerifiableSession } from '../authzCore-BlSHwGnW.js';
1
+ import { R as RequireAccessOptions, A as AuthzVerifiableSession } from '../authzCore-D-hquWSI.js';
2
2
  import { CanActivate, ExecutionContext } from '@nestjs/common';
3
3
  import { Reflector } from '@nestjs/core';
4
4
  import '../sensitive-BC_s7Rrd.js';
5
5
  import '../types-BOX-6Srv.js';
6
- import '../jwks-BR55d7-Z.js';
7
- import '../revocationFeed-CDoD7Twr.js';
6
+ import '../jwks-CTVpOWzI.js';
7
+ import '../revocationFeed-KQhvMMl8.js';
8
8
 
9
9
  /** `{ param: 'id' }` form of the `@RequireAccess` `resource` argument (§11.2.3.b): resolve the resource id from the named route parameter at request time. */
10
10
  interface NestParamResource {
@@ -99,4 +99,5 @@ declare const AXIAM_REQUIRE_ACCESS_METADATA: unique symbol;
99
99
  /** Set by {@link RequireRole}; read by {@link AxiamGuard}. Value shape: `string[]`. */
100
100
  declare const AXIAM_REQUIRE_ROLE_METADATA: unique symbol;
101
101
 
102
- export { AXIAM_REQUIRE_ACCESS_METADATA, AXIAM_REQUIRE_AUTH_METADATA, AXIAM_REQUIRE_ROLE_METADATA, AXIAM_SESSION, AuthzVerifiableSession, AxiamGuard, type NestParamResource, type NestResourceSpec, RequireAccess, type RequireAccessMetadata, RequireAccessOptions, RequireAuth, RequireRole };
102
+ export { AXIAM_REQUIRE_ACCESS_METADATA, AXIAM_REQUIRE_AUTH_METADATA, AXIAM_REQUIRE_ROLE_METADATA, AXIAM_SESSION, AuthzVerifiableSession, AxiamGuard, RequireAccess, RequireAccessOptions, RequireAuth, RequireRole };
103
+ export type { NestParamResource, NestResourceSpec, RequireAccessMetadata };
@@ -1,14 +1,14 @@
1
- export { A as ACCESS_COOKIE, C as CSRF_COOKIE, N as NodeSession, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-DkGcIr-i.cjs';
2
- export { D as DEFAULT_POLL_INTERVAL_MS, M as MAX_ENTRIES, a as MIN_POLL_INTERVAL_MS, R as RevocationFeed, b as RevocationFeedOptions } from '../revocationFeed-CDoD7Twr.cjs';
3
- export { a as AccessTokenExpectations, A as AxiamClaims, b as CLOCK_SKEW_LEEWAY_SEC, C as CnfClaim, d as ID_TOKEN_ALG, I as IdTokenClaims, e as IdTokenExpectations, f as IdTokenVerifier, J as JWKS_PATH, g as JwksVerifier, M as MAX_CLOCK_SKEW_SEC, P as PresentedProofs, V as Verifier, h as assertTenantClaim, i as certificateThumbprintS256, j as createJwksVerifier, c as createVerifier, v as verifyCertificateBinding, k as verifyTokenBinding } from '../jwks-BR55d7-Z.cjs';
4
- export { A as ACCESS_TOKEN_TYPE, a as AuthorizationRequest, B as BACKCHANNEL_LOGOUT_EVENT, C as CIBA_GRANT_TYPE, b as CIBA_SLOW_DOWN_INCREMENT_SECS, c as CibaAwaitParams, d as CibaClock, e as CibaDelivery, f as CibaInitiateParams, g as CibaInitiateResponse, h as CibaPingHeaders, i as CibaPollParams, j as CibaRequestSigner, k as CibaSignerDescription, l as CibaSigningAlg, m as CibaSigningKey, n as CibaUserHint, D as DEFAULT_CIBA_INTERVAL_SECS, o as DEFAULT_POLL_INTERVAL_SECS, p as DEVICE_CODE_GRANT_TYPE, q as DISCOVERY_PATH, r as DeviceAuthorization, s as DeviceAuthorizeParams, t as DeviceLoginParams, u as DevicePollParams, E as ExchangedToken, F as FederationProvider, v as FederationProviderList, H as HANDOFF_CODE_TTL_SECS, w as HANDOFF_QUERY_PARAM, I as IntrospectParams, x as IntrospectionResult, J as JWT_TOKEN_TYPE, L as LoginClientCredentialsParams, y as LogoutUrlParams, M as MAX_LOGOUT_TOKEN_AGE_SECS, z as MIN_DISCOVERY_TTL_MS, G as MemoryOidcStateStore, K as MtlsEndpointAliases, O as OIDC_STATE_TTL_MS, N as OidcBeginParams, P as OidcClient, Q as OidcClientOptions, R as OidcConfiguration, S as OidcExchangeParams, T as OidcParParams, U as OidcRefreshParams, V as OidcStateEntry, W as OidcStateStore, X as OidcTokenSet, Y as PROTOCOL_OAUTH2, Z as PROTOCOL_OIDC_CONNECT, _ as PROTOCOL_SAML, $ as PollSchedule, a0 as PushedAuthorizationRequest, a1 as RequestedPermission, a2 as RequestingPartyToken, a3 as ResourceSet, a4 as RevokeParams, a5 as RptPermission, a6 as SIGNED_REQUEST_LIFETIME_SECS, a7 as SLOW_DOWN_INCREMENT_SECS, a8 as SSO_CALLBACK_PATH, a9 as SSO_HANDOFF_PATH, aa as SSO_OAUTH2_CALLBACK_PATH, ab as SSO_OAUTH2_START_PATH, ac as SSO_PROVIDERS_PATH, ad as SSO_START_PATH, ae as SsoCompleteHandoffParams, af as SsoCompleteOauth2Params, ag as SsoCompleteParams, ah as SsoCompleteResult, ai as SsoProvidersParams, aj as SsoStartOauth2Params, ak as SsoStartParams, al as SsoStartResult, am as TOKEN_EXCHANGE_GRANT_TYPE, an as TokenExchangeParams, ao as UMA_CLAIM_TOKEN_FORMAT, ap as UMA_PROTECTION_SCOPE, aq as UMA_TICKET_GRANT_TYPE, ar as UmaChallenge, as as UmaExchangeTicketParams, at as VerifiedLogoutToken, au as createOidcClient, av as isAccessDenied, aw as isExpiredToken, ax as normalizeOrigin, ay as umaChallengeHeader, az as umaParseChallenge } from '../oidcState-Cz6erz0g.cjs';
1
+ export { A as ACCESS_COOKIE, C as CSRF_COOKIE, N as NodeSession, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-BqYOnNN-.cjs';
2
+ export { D as DEFAULT_POLL_INTERVAL_MS, M as MAX_ENTRIES, a as MIN_POLL_INTERVAL_MS, R as RevocationFeed, b as RevocationFeedOptions } from '../revocationFeed-KQhvMMl8.cjs';
3
+ export { a as AccessTokenExpectations, A as AxiamClaims, b as CLOCK_SKEW_LEEWAY_SEC, C as CnfClaim, d as ID_TOKEN_ALG, I as IdTokenClaims, e as IdTokenExpectations, f as IdTokenVerifier, J as JWKS_PATH, g as JwksVerifier, M as MAX_CLOCK_SKEW_SEC, P as PresentedProofs, V as Verifier, h as assertTenantClaim, i as certificateThumbprintS256, j as createJwksVerifier, c as createVerifier, v as verifyCertificateBinding, k as verifyTokenBinding } from '../jwks-CTVpOWzI.cjs';
4
+ export { A as ACCESS_TOKEN_TYPE, a as AuthorizationRequest, B as BACKCHANNEL_LOGOUT_EVENT, C as CIBA_GRANT_TYPE, b as CIBA_SLOW_DOWN_INCREMENT_SECS, c as CibaAwaitParams, d as CibaClock, e as CibaDelivery, f as CibaInitiateParams, g as CibaInitiateResponse, h as CibaPingHeaders, i as CibaPollParams, j as CibaRequestSigner, k as CibaSignerDescription, l as CibaSigningAlg, m as CibaSigningKey, n as CibaUserHint, D as DEFAULT_CIBA_INTERVAL_SECS, o as DEFAULT_POLL_INTERVAL_SECS, p as DEVICE_CODE_GRANT_TYPE, q as DISCOVERY_PATH, r as DeviceAuthorization, s as DeviceAuthorizeParams, t as DeviceLoginParams, u as DevicePollParams, E as ExchangedToken, F as FederationProvider, v as FederationProviderList, H as HANDOFF_CODE_TTL_SECS, w as HANDOFF_QUERY_PARAM, I as IntrospectParams, x as IntrospectionResult, J as JWT_TOKEN_TYPE, L as LoginClientCredentialsParams, y as LogoutUrlParams, M as MAX_LOGOUT_TOKEN_AGE_SECS, z as MIN_DISCOVERY_TTL_MS, G as MemoryOidcStateStore, K as MtlsEndpointAliases, O as OIDC_STATE_TTL_MS, N as OidcBeginParams, P as OidcClient, Q as OidcClientOptions, R as OidcConfiguration, S as OidcExchangeParams, T as OidcParParams, U as OidcRefreshParams, V as OidcStateEntry, W as OidcStateStore, X as OidcTokenSet, Y as PROTOCOL_OAUTH2, Z as PROTOCOL_OIDC_CONNECT, _ as PROTOCOL_SAML, $ as PollSchedule, a0 as PushedAuthorizationRequest, a1 as RequestedPermission, a2 as RequestingPartyToken, a3 as ResourceSet, a4 as RevokeParams, a5 as RptPermission, a6 as SIGNED_REQUEST_LIFETIME_SECS, a7 as SLOW_DOWN_INCREMENT_SECS, a8 as SSO_CALLBACK_PATH, a9 as SSO_HANDOFF_PATH, aa as SSO_OAUTH2_CALLBACK_PATH, ab as SSO_OAUTH2_START_PATH, ac as SSO_PROVIDERS_PATH, ad as SSO_START_PATH, ae as SsoCompleteHandoffParams, af as SsoCompleteOauth2Params, ag as SsoCompleteParams, ah as SsoCompleteResult, ai as SsoProvidersParams, aj as SsoStartOauth2Params, ak as SsoStartParams, al as SsoStartResult, am as TOKEN_EXCHANGE_GRANT_TYPE, an as TokenExchangeParams, ao as UMA_CLAIM_TOKEN_FORMAT, ap as UMA_PROTECTION_SCOPE, aq as UMA_TICKET_GRANT_TYPE, ar as UmaChallenge, as as UmaExchangeTicketParams, at as VerifiedLogoutToken, au as createOidcClient, av as isAccessDenied, aw as isExpiredToken, ax as normalizeOrigin, ay as umaChallengeHeader, az as umaParseChallenge } from '../oidcState-BaJ-SM_R.cjs';
5
5
  import { S as Sensitive } from '../sensitive-BC_s7Rrd.cjs';
6
- import { a as AuthError } from '../errors-DMIlw2lN.cjs';
7
- import { A as AxiamClient } from '../client-7ZKtfXW-.cjs';
6
+ import { AuthError } from '../index.cjs';
7
+ import { AxiamClient } from '../index.cjs';
8
8
  import 'axios';
9
9
  import 'tough-cookie';
10
- import '../session-BmjEMowX.cjs';
11
- import '../telemetry--0DwnNjV.cjs';
10
+ import '../session-plDr4lFu.cjs';
11
+ import '../telemetry-Du0-zS5f.cjs';
12
12
  import '../types-zXSpiQM-.cjs';
13
13
  import 'node:crypto';
14
14
 
@@ -540,4 +540,5 @@ declare class SsfReceiver {
540
540
  poll(streamId: string, options?: SsfPollOptions): Promise<SsfPollResult>;
541
541
  }
542
542
 
543
- export { type AccessTokenProvider, CODE_CHALLENGE_METHOD_S256, CSPRNG_BYTES, DEFAULT_WEBHOOK_TOLERANCE_SEC, DPOP_IAT_LEEWAY_SEC, type DpopVerifyOptions, InMemoryJtiStore, JWKS_REFETCH_INTERVAL_MS, type JtiStore, MIN_REPLAY_WINDOW_MS, MemoryReplayStore, type RefusedSet, type ReplayStore, SSF_EVENT_TYPES, type SecurityEvent, Sensitive, type SetErr, type SetFailureReason, SetRefusedError, type SsfPollOptions, type SsfPollResult, SsfReceiver, type SsfReceiverConfig, type VerifiedWebhookEvent, type VerifyWebhookOptions, WebhookVerifyError, type WebhookVerifyFailureReason, accessTokenHash, canonicalHtu, computeCodeChallenge, generateCodeVerifier, jwkThumbprintS256, pushErrorCode, randomUrlSafeToken, setErrFromReason, verifyDpopProof, verifyWebhook };
543
+ export { CODE_CHALLENGE_METHOD_S256, CSPRNG_BYTES, DEFAULT_WEBHOOK_TOLERANCE_SEC, DPOP_IAT_LEEWAY_SEC, InMemoryJtiStore, JWKS_REFETCH_INTERVAL_MS, MIN_REPLAY_WINDOW_MS, MemoryReplayStore, SSF_EVENT_TYPES, Sensitive, SetRefusedError, SsfReceiver, WebhookVerifyError, accessTokenHash, canonicalHtu, computeCodeChallenge, generateCodeVerifier, jwkThumbprintS256, pushErrorCode, randomUrlSafeToken, setErrFromReason, verifyDpopProof, verifyWebhook };
544
+ export type { AccessTokenProvider, DpopVerifyOptions, JtiStore, RefusedSet, ReplayStore, SecurityEvent, SetErr, SetFailureReason, SsfPollOptions, SsfPollResult, SsfReceiverConfig, VerifiedWebhookEvent, VerifyWebhookOptions, WebhookVerifyFailureReason };
@@ -1,14 +1,14 @@
1
- export { A as ACCESS_COOKIE, C as CSRF_COOKIE, N as NodeSession, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-Cw6Zdeec.js';
2
- export { D as DEFAULT_POLL_INTERVAL_MS, M as MAX_ENTRIES, a as MIN_POLL_INTERVAL_MS, R as RevocationFeed, b as RevocationFeedOptions } from '../revocationFeed-CDoD7Twr.js';
3
- export { a as AccessTokenExpectations, A as AxiamClaims, b as CLOCK_SKEW_LEEWAY_SEC, C as CnfClaim, d as ID_TOKEN_ALG, I as IdTokenClaims, e as IdTokenExpectations, f as IdTokenVerifier, J as JWKS_PATH, g as JwksVerifier, M as MAX_CLOCK_SKEW_SEC, P as PresentedProofs, V as Verifier, h as assertTenantClaim, i as certificateThumbprintS256, j as createJwksVerifier, c as createVerifier, v as verifyCertificateBinding, k as verifyTokenBinding } from '../jwks-BR55d7-Z.js';
4
- export { A as ACCESS_TOKEN_TYPE, a as AuthorizationRequest, B as BACKCHANNEL_LOGOUT_EVENT, C as CIBA_GRANT_TYPE, b as CIBA_SLOW_DOWN_INCREMENT_SECS, c as CibaAwaitParams, d as CibaClock, e as CibaDelivery, f as CibaInitiateParams, g as CibaInitiateResponse, h as CibaPingHeaders, i as CibaPollParams, j as CibaRequestSigner, k as CibaSignerDescription, l as CibaSigningAlg, m as CibaSigningKey, n as CibaUserHint, D as DEFAULT_CIBA_INTERVAL_SECS, o as DEFAULT_POLL_INTERVAL_SECS, p as DEVICE_CODE_GRANT_TYPE, q as DISCOVERY_PATH, r as DeviceAuthorization, s as DeviceAuthorizeParams, t as DeviceLoginParams, u as DevicePollParams, E as ExchangedToken, F as FederationProvider, v as FederationProviderList, H as HANDOFF_CODE_TTL_SECS, w as HANDOFF_QUERY_PARAM, I as IntrospectParams, x as IntrospectionResult, J as JWT_TOKEN_TYPE, L as LoginClientCredentialsParams, y as LogoutUrlParams, M as MAX_LOGOUT_TOKEN_AGE_SECS, z as MIN_DISCOVERY_TTL_MS, G as MemoryOidcStateStore, K as MtlsEndpointAliases, O as OIDC_STATE_TTL_MS, N as OidcBeginParams, P as OidcClient, Q as OidcClientOptions, R as OidcConfiguration, S as OidcExchangeParams, T as OidcParParams, U as OidcRefreshParams, V as OidcStateEntry, W as OidcStateStore, X as OidcTokenSet, Y as PROTOCOL_OAUTH2, Z as PROTOCOL_OIDC_CONNECT, _ as PROTOCOL_SAML, $ as PollSchedule, a0 as PushedAuthorizationRequest, a1 as RequestedPermission, a2 as RequestingPartyToken, a3 as ResourceSet, a4 as RevokeParams, a5 as RptPermission, a6 as SIGNED_REQUEST_LIFETIME_SECS, a7 as SLOW_DOWN_INCREMENT_SECS, a8 as SSO_CALLBACK_PATH, a9 as SSO_HANDOFF_PATH, aa as SSO_OAUTH2_CALLBACK_PATH, ab as SSO_OAUTH2_START_PATH, ac as SSO_PROVIDERS_PATH, ad as SSO_START_PATH, ae as SsoCompleteHandoffParams, af as SsoCompleteOauth2Params, ag as SsoCompleteParams, ah as SsoCompleteResult, ai as SsoProvidersParams, aj as SsoStartOauth2Params, ak as SsoStartParams, al as SsoStartResult, am as TOKEN_EXCHANGE_GRANT_TYPE, an as TokenExchangeParams, ao as UMA_CLAIM_TOKEN_FORMAT, ap as UMA_PROTECTION_SCOPE, aq as UMA_TICKET_GRANT_TYPE, ar as UmaChallenge, as as UmaExchangeTicketParams, at as VerifiedLogoutToken, au as createOidcClient, av as isAccessDenied, aw as isExpiredToken, ax as normalizeOrigin, ay as umaChallengeHeader, az as umaParseChallenge } from '../oidcState-zGt6VU6v.js';
1
+ export { A as ACCESS_COOKIE, C as CSRF_COOKIE, N as NodeSession, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-BTmpjXZe.js';
2
+ export { D as DEFAULT_POLL_INTERVAL_MS, M as MAX_ENTRIES, a as MIN_POLL_INTERVAL_MS, R as RevocationFeed, b as RevocationFeedOptions } from '../revocationFeed-KQhvMMl8.js';
3
+ export { a as AccessTokenExpectations, A as AxiamClaims, b as CLOCK_SKEW_LEEWAY_SEC, C as CnfClaim, d as ID_TOKEN_ALG, I as IdTokenClaims, e as IdTokenExpectations, f as IdTokenVerifier, J as JWKS_PATH, g as JwksVerifier, M as MAX_CLOCK_SKEW_SEC, P as PresentedProofs, V as Verifier, h as assertTenantClaim, i as certificateThumbprintS256, j as createJwksVerifier, c as createVerifier, v as verifyCertificateBinding, k as verifyTokenBinding } from '../jwks-CTVpOWzI.js';
4
+ export { A as ACCESS_TOKEN_TYPE, a as AuthorizationRequest, B as BACKCHANNEL_LOGOUT_EVENT, C as CIBA_GRANT_TYPE, b as CIBA_SLOW_DOWN_INCREMENT_SECS, c as CibaAwaitParams, d as CibaClock, e as CibaDelivery, f as CibaInitiateParams, g as CibaInitiateResponse, h as CibaPingHeaders, i as CibaPollParams, j as CibaRequestSigner, k as CibaSignerDescription, l as CibaSigningAlg, m as CibaSigningKey, n as CibaUserHint, D as DEFAULT_CIBA_INTERVAL_SECS, o as DEFAULT_POLL_INTERVAL_SECS, p as DEVICE_CODE_GRANT_TYPE, q as DISCOVERY_PATH, r as DeviceAuthorization, s as DeviceAuthorizeParams, t as DeviceLoginParams, u as DevicePollParams, E as ExchangedToken, F as FederationProvider, v as FederationProviderList, H as HANDOFF_CODE_TTL_SECS, w as HANDOFF_QUERY_PARAM, I as IntrospectParams, x as IntrospectionResult, J as JWT_TOKEN_TYPE, L as LoginClientCredentialsParams, y as LogoutUrlParams, M as MAX_LOGOUT_TOKEN_AGE_SECS, z as MIN_DISCOVERY_TTL_MS, G as MemoryOidcStateStore, K as MtlsEndpointAliases, O as OIDC_STATE_TTL_MS, N as OidcBeginParams, P as OidcClient, Q as OidcClientOptions, R as OidcConfiguration, S as OidcExchangeParams, T as OidcParParams, U as OidcRefreshParams, V as OidcStateEntry, W as OidcStateStore, X as OidcTokenSet, Y as PROTOCOL_OAUTH2, Z as PROTOCOL_OIDC_CONNECT, _ as PROTOCOL_SAML, $ as PollSchedule, a0 as PushedAuthorizationRequest, a1 as RequestedPermission, a2 as RequestingPartyToken, a3 as ResourceSet, a4 as RevokeParams, a5 as RptPermission, a6 as SIGNED_REQUEST_LIFETIME_SECS, a7 as SLOW_DOWN_INCREMENT_SECS, a8 as SSO_CALLBACK_PATH, a9 as SSO_HANDOFF_PATH, aa as SSO_OAUTH2_CALLBACK_PATH, ab as SSO_OAUTH2_START_PATH, ac as SSO_PROVIDERS_PATH, ad as SSO_START_PATH, ae as SsoCompleteHandoffParams, af as SsoCompleteOauth2Params, ag as SsoCompleteParams, ah as SsoCompleteResult, ai as SsoProvidersParams, aj as SsoStartOauth2Params, ak as SsoStartParams, al as SsoStartResult, am as TOKEN_EXCHANGE_GRANT_TYPE, an as TokenExchangeParams, ao as UMA_CLAIM_TOKEN_FORMAT, ap as UMA_PROTECTION_SCOPE, aq as UMA_TICKET_GRANT_TYPE, ar as UmaChallenge, as as UmaExchangeTicketParams, at as VerifiedLogoutToken, au as createOidcClient, av as isAccessDenied, aw as isExpiredToken, ax as normalizeOrigin, ay as umaChallengeHeader, az as umaParseChallenge } from '../oidcState-C3VLn3eD.js';
5
5
  import { S as Sensitive } from '../sensitive-BC_s7Rrd.js';
6
- import { a as AuthError } from '../errors-DMIlw2lN.js';
7
- import { A as AxiamClient } from '../client-Putxo-yi.js';
6
+ import { AuthError } from '../index.js';
7
+ import { AxiamClient } from '../index.js';
8
8
  import 'axios';
9
9
  import 'tough-cookie';
10
- import '../session-CeG6P9GO.js';
11
- import '../telemetry--0DwnNjV.js';
10
+ import '../session-B03NsqVs.js';
11
+ import '../telemetry-Du0-zS5f.js';
12
12
  import '../types-BOX-6Srv.js';
13
13
  import 'node:crypto';
14
14
 
@@ -540,4 +540,5 @@ declare class SsfReceiver {
540
540
  poll(streamId: string, options?: SsfPollOptions): Promise<SsfPollResult>;
541
541
  }
542
542
 
543
- export { type AccessTokenProvider, CODE_CHALLENGE_METHOD_S256, CSPRNG_BYTES, DEFAULT_WEBHOOK_TOLERANCE_SEC, DPOP_IAT_LEEWAY_SEC, type DpopVerifyOptions, InMemoryJtiStore, JWKS_REFETCH_INTERVAL_MS, type JtiStore, MIN_REPLAY_WINDOW_MS, MemoryReplayStore, type RefusedSet, type ReplayStore, SSF_EVENT_TYPES, type SecurityEvent, Sensitive, type SetErr, type SetFailureReason, SetRefusedError, type SsfPollOptions, type SsfPollResult, SsfReceiver, type SsfReceiverConfig, type VerifiedWebhookEvent, type VerifyWebhookOptions, WebhookVerifyError, type WebhookVerifyFailureReason, accessTokenHash, canonicalHtu, computeCodeChallenge, generateCodeVerifier, jwkThumbprintS256, pushErrorCode, randomUrlSafeToken, setErrFromReason, verifyDpopProof, verifyWebhook };
543
+ export { CODE_CHALLENGE_METHOD_S256, CSPRNG_BYTES, DEFAULT_WEBHOOK_TOLERANCE_SEC, DPOP_IAT_LEEWAY_SEC, InMemoryJtiStore, JWKS_REFETCH_INTERVAL_MS, MIN_REPLAY_WINDOW_MS, MemoryReplayStore, SSF_EVENT_TYPES, Sensitive, SetRefusedError, SsfReceiver, WebhookVerifyError, accessTokenHash, canonicalHtu, computeCodeChallenge, generateCodeVerifier, jwkThumbprintS256, pushErrorCode, randomUrlSafeToken, setErrFromReason, verifyDpopProof, verifyWebhook };
544
+ export type { AccessTokenProvider, DpopVerifyOptions, JtiStore, RefusedSet, ReplayStore, SecurityEvent, SetErr, SetFailureReason, SsfPollOptions, SsfPollResult, SsfReceiverConfig, VerifiedWebhookEvent, VerifyWebhookOptions, WebhookVerifyFailureReason };
@@ -681,6 +681,24 @@ var SharedSession = class {
681
681
  noCredentialsConfig() {
682
682
  return { withCredentials: false };
683
683
  }
684
+ /**
685
+ * Axios config for a request to an `/oauth2/*` endpoint (CONTRACT.md §12.1
686
+ * rule 3, §14.6; C163-12): {@link noCredentialsConfig} and, in the browser
687
+ * persona, the fetch adapter with `credentials: 'omit'`.
688
+ *
689
+ * `withCredentials: false` on axios's default XHR adapter is not enough: that
690
+ * adapter sends a same-origin cookie regardless, so an app served from the
691
+ * AXIAM origin would still present `axiam_*` on a token or device request.
692
+ * The fetch adapter derives its `credentials` from `withCredentials: false`
693
+ * (`'omit'`); `fetchOptions.credentials` is set as well for adapters that
694
+ * read it.
695
+ * `NodeSession` overrides this to {@link noCredentialsConfig}: its jar-free
696
+ * agent pair is what keeps the cookies off there, and the fetch adapter
697
+ * would bypass that pair.
698
+ */
699
+ oauth2RequestConfig() {
700
+ return { ...this.noCredentialsConfig(), adapter: "fetch", fetchOptions: { credentials: "omit" } };
701
+ }
684
702
  };
685
703
  function resolveTenantHeaderValue(options) {
686
704
  if (options.tenantSlug) {
@@ -802,6 +820,9 @@ function installCsrfInterceptor(axiosInstance, session) {
802
820
  if (session.isForeignHost(config.url)) {
803
821
  return config;
804
822
  }
823
+ if (isOAuth2Endpoint(config.url, session.baseUrl)) {
824
+ return config;
825
+ }
805
826
  const method = (config.method ?? "get").toLowerCase();
806
827
  const cookieString = typeof document !== "undefined" ? document.cookie : "";
807
828
  const csrfToken = typeof document !== "undefined" ? csrfHeaderForMethod(method, cookieString) : csrfHeaderForMethod(method, session.csrfToken ? `axiam_csrf=${session.csrfToken}` : "");
@@ -855,23 +876,33 @@ function installRefreshInterceptor(axiosInstance, session) {
855
876
  }
856
877
  );
857
878
  }
858
- function isOAuth2Endpoint(url) {
879
+ function isOAuth2Endpoint(url, baseUrl) {
859
880
  if (!url) {
860
881
  return false;
861
882
  }
862
- const path = url.split(/[?#]/, 1)[0] ?? "";
863
- return path.includes("/oauth2/");
883
+ try {
884
+ const base = new URL(baseUrl);
885
+ let path = new URL(url, base).pathname;
886
+ const prefix = base.pathname.replace(/\/+$/, "");
887
+ if (prefix !== "" && path.startsWith(`${prefix}/`)) {
888
+ path = path.slice(prefix.length);
889
+ }
890
+ return path.startsWith("/oauth2/");
891
+ } catch {
892
+ return false;
893
+ }
864
894
  }
865
895
  function installDeviceTokenInterceptor(axiosInstance, session) {
866
896
  axiosInstance.interceptors.request.use((config) => {
867
897
  const deviceToken = session.deviceAccessToken;
868
- if (session.isForeignHost(config.url) || deviceToken === void 0) {
898
+ const oauth2 = isOAuth2Endpoint(config.url, session.baseUrl);
899
+ if (session.isForeignHost(config.url) || deviceToken === void 0 && !oauth2) {
869
900
  return config;
870
901
  }
871
- const noCred = session.noCredentialsConfig();
902
+ const noCred = oauth2 ? session.oauth2RequestConfig() : session.noCredentialsConfig();
872
903
  Object.assign(config, noCred);
873
904
  config.headers = config.headers ?? {};
874
- if (isOAuth2Endpoint(config.url)) {
905
+ if (oauth2) {
875
906
  return config;
876
907
  }
877
908
  config.headers["Authorization"] = `Bearer ${deviceToken.expose()}`;
@@ -1362,6 +1393,7 @@ async function withRetry(fn, options) {
1362
1393
  }
1363
1394
  const retryAfterMs2 = isRetryAfterCarrier(err) ? err.retryAfterMs : void 0;
1364
1395
  const delay = delayMs(attempt, retryAfterMs2, random());
1396
+ options.admit?.(delay);
1365
1397
  options.telemetry?.emit({
1366
1398
  type: "retry",
1367
1399
  operation: options.operation ?? "unknown",
@@ -1891,7 +1923,10 @@ async function bareRequest(session, operation, config) {
1891
1923
  // jar). Under the Node persona this is the jar-wrapped cookie agent, which
1892
1924
  // `noCredentialsConfig()` below replaces with a plain one.
1893
1925
  ...defaults.httpsAgent !== void 0 ? { httpsAgent: defaults.httpsAgent } : {},
1894
- ...session.noCredentialsConfig(),
1926
+ // The bare transport carries the RFC 7592 registration calls on `/oauth2/register/*`,
1927
+ // so it gets an `/oauth2/*` request's config: in the browser persona the fetch adapter
1928
+ // that omits credentials (C164-06; identical to `noCredentialsConfig()` under Node).
1929
+ ...session.oauth2RequestConfig(),
1895
1930
  withCredentials: false,
1896
1931
  maxRedirects: 0,
1897
1932
  validateStatus: () => true
@@ -2751,6 +2786,11 @@ function validateNetwork(network, problems) {
2751
2786
  problems.push(`network segment ${q(profile.segment)} has more than one profile in the manifest`);
2752
2787
  }
2753
2788
  profiled.add(profile.segment);
2789
+ if (profile.terminationAction === null) {
2790
+ problems.push(
2791
+ `network profile of segment ${q(profile.segment)} states terminationAction as null; it has no "none" in a manifest (leave it out to keep the server default)`
2792
+ );
2793
+ }
2754
2794
  }
2755
2795
  }
2756
2796
  function duplicates(kind, keys, problems) {
@@ -3708,11 +3748,24 @@ function profileDrifted(spec, read) {
3708
3748
  if (spec.serviceType !== void 0 && !sameOptional(spec.serviceType, read.service_type)) return true;
3709
3749
  return false;
3710
3750
  }
3751
+ var KNOWN_TERMINATION_ACTIONS = ["default", "radius_request"];
3752
+ var KNOWN_SERVICE_TYPES = ["framed_user"];
3753
+ function refuseUnknownCarried(member, stated, read, known) {
3754
+ if (stated !== void 0 || read == null || known.includes(read)) return;
3755
+ throw new ValidationError(
3756
+ "manifest.plan",
3757
+ 400,
3758
+ `network profile: ${member} was read as ${JSON.stringify(read)}, a value this SDK does not know, and the manifest does not state it; state ${member} to update this profile (CONTRACT.md \xA727.6.2 item 4)`,
3759
+ [{ field: member, message: `unknown value ${JSON.stringify(read)} on an unstated member` }]
3760
+ );
3761
+ }
3711
3762
  function profileReplaceInput(spec, read) {
3712
3763
  const profile = {
3713
3764
  dictionary: read.dictionary,
3714
3765
  session_timeout_secs: spec.sessionTimeoutSecs
3715
3766
  };
3767
+ refuseUnknownCarried("termination_action", spec.terminationAction, read.termination_action, KNOWN_TERMINATION_ACTIONS);
3768
+ refuseUnknownCarried("service_type", spec.serviceType, read.service_type, KNOWN_SERVICE_TYPES);
3716
3769
  const termination = spec.terminationAction === void 0 ? read.termination_action : spec.terminationAction;
3717
3770
  if (termination != null) profile.termination_action = termination;
3718
3771
  const idle = spec.idleTimeoutSecs === void 0 ? read.idle_timeout_secs : spec.idleTimeoutSecs;
@@ -8527,6 +8580,14 @@ var NodeSession = class extends SharedSession {
8527
8580
  withCredentials: false
8528
8581
  };
8529
8582
  }
8583
+ /**
8584
+ * Overrides {@link SharedSession.oauth2RequestConfig}: under Node the
8585
+ * jar-free agent pair of {@link noCredentialsConfig} is what withholds the
8586
+ * cookies; the browser's fetch adapter (`credentials: 'omit'`) is not used.
8587
+ */
8588
+ oauth2RequestConfig() {
8589
+ return this.noCredentialsConfig();
8590
+ }
8530
8591
  /**
8531
8592
  * Drives the actual `POST /api/v1/auth/refresh` HTTP call. Passed to this
8532
8593
  * session's per-instance `refreshGuard` (inherited from SharedSession) by
@@ -8923,6 +8984,8 @@ var MAX_LOGOUT_TOKEN_AGE_SECS = 300;
8923
8984
  var PollSchedule = class {
8924
8985
  #intervalSecs;
8925
8986
  #remainingSecs;
8987
+ /** A `Retry-After` still to be served by the next wait (§14.2 rule 9, contract 1.64). */
8988
+ #retryAfterSecs = 0;
8926
8989
  constructor(intervalSecs, expiresInSecs) {
8927
8990
  this.#intervalSecs = intervalSecs > 0 ? intervalSecs : DEFAULT_POLL_INTERVAL_SECS;
8928
8991
  this.#remainingSecs = expiresInSecs;
@@ -8931,6 +8994,21 @@ var PollSchedule = class {
8931
8994
  get intervalSecs() {
8932
8995
  return this.#intervalSecs;
8933
8996
  }
8997
+ /**
8998
+ * The delay before the next poll, in seconds: the interval, or the pending
8999
+ * `Retry-After` when that is longer (a minimum, §14.2 rule 9).
9000
+ */
9001
+ get waitSecs() {
9002
+ return Math.max(this.#intervalSecs, this.#retryAfterSecs);
9003
+ }
9004
+ /**
9005
+ * Record a `429 rate_limit_exceeded` (§14.2 rule 9, contract 1.64): the next
9006
+ * wait lasts at least `retryAfterSecs` and stands in for one interval. The
9007
+ * interval itself is **not** raised — only the `400 slow_down` does that.
9008
+ */
9009
+ rateLimited(retryAfterSecs) {
9010
+ this.#retryAfterSecs = retryAfterSecs !== void 0 && retryAfterSecs > 0 ? retryAfterSecs : 0;
9011
+ }
8934
9012
  /** Apply one `slow_down` (§14.2 rule 1): **cumulative, never reset.** */
8935
9013
  slowDown() {
8936
9014
  this.#intervalSecs += SLOW_DOWN_INCREMENT_SECS;
@@ -8943,14 +9021,27 @@ var PollSchedule = class {
8943
9021
  * the server is still answering `authorization_pending`.
8944
9022
  */
8945
9023
  tick() {
8946
- if (this.#intervalSecs >= this.#remainingSecs) {
9024
+ const waitSecs = this.waitSecs;
9025
+ this.#retryAfterSecs = 0;
9026
+ if (waitSecs >= this.#remainingSecs) {
8947
9027
  this.#remainingSecs = 0;
8948
9028
  return false;
8949
9029
  }
8950
- this.#remainingSecs -= this.#intervalSecs;
9030
+ this.#remainingSecs -= waitSecs;
8951
9031
  return true;
8952
9032
  }
8953
9033
  };
9034
+ var POLL_RETRY_AFTER_MS = /* @__PURE__ */ new WeakMap();
9035
+ function pollRateLimit(err) {
9036
+ if (axiosStatus3(err) !== 429) return void 0;
9037
+ const body = axiosBody(err);
9038
+ const description = body !== null && typeof body === "object" && typeof body.error_description === "string" ? body.error_description : "";
9039
+ const limited = new OAuthProtocolError("rate_limit_exceeded", description);
9040
+ const response = err.response;
9041
+ const retryAfter = response ? retryAfterMs(response) : void 0;
9042
+ if (retryAfter !== void 0) POLL_RETRY_AFTER_MS.set(limited, retryAfter);
9043
+ return limited;
9044
+ }
8954
9045
  function sleep(ms) {
8955
9046
  return new Promise((resolve) => {
8956
9047
  setTimeout(resolve, ms);
@@ -9084,6 +9175,19 @@ function transient(error) {
9084
9175
  return error;
9085
9176
  }
9086
9177
  var SYSTEM_CIBA_CLOCK = { now: () => Date.now(), sleep };
9178
+ function deadlineBoundedRetry(bound, what) {
9179
+ return {
9180
+ admit: (ms) => {
9181
+ if (bound.clock.now() + ms >= bound.deadline) {
9182
+ throw new OAuthProtocolError(
9183
+ "expired_token",
9184
+ `the ${what} expired before it was decided (client-side deadline from expires_in; CONTRACT.md \xA714.2 rule 4, \xA734.2 P10)`
9185
+ );
9186
+ }
9187
+ },
9188
+ sleepFn: (ms) => bound.clock.sleep(ms)
9189
+ };
9190
+ }
9087
9191
  function isAccessDenied(err) {
9088
9192
  return err instanceof OAuthProtocolError && err.error === "access_denied";
9089
9193
  }
@@ -9868,26 +9972,36 @@ var OidcClient = class {
9868
9972
  * The raw single call, so an application driving its own loop (a UI
9869
9973
  * rendering a countdown, say) can. The five RFC 8628 §3.5 answers surface as
9870
9974
  * {@link OAuthProtocolError} — `authorization_pending` and `slow_down`
9871
- * included — so a hand-rolled loop sees exactly what {@link deviceLogin}
9872
- * sees. Most callers want {@link deviceLogin}.
9975
+ * included — so a hand-rolled loop dispatches on the same answers
9976
+ * {@link deviceLogin} does. Most callers want {@link deviceLogin}.
9873
9977
  *
9874
9978
  * Client authentication is the one {@link deviceAuthorize} describes
9875
9979
  * (contract 1.62, §14.1 rule 2): a configured `clientSecret` is sent as
9876
9980
  * `client_secret` in the form body, never as `Authorization: Basic`; a public
9877
9981
  * client sends none; `client_id` is sent on **every** poll (§14.1 rule 3). A
9878
9982
  * `401 invalid_client` surfaces as {@link OAuthProtocolError}, is not retried
9879
- * and does not enter the §9 refresh guard (§14.2 rule 5). This SDK ships no
9983
+ * and does not enter the §9 refresh guard (§14.2 rule 5). Any `429`
9984
+ * is an {@link OAuthProtocolError} with `error == 'rate_limit_exceeded'` too
9985
+ * (rule 9, whatever its body names) — never `slow_down`; {@link deviceLogin}
9986
+ * waits it out. Its `Retry-After` is not exposed, so a hand-rolled loop
9987
+ * should wait at least one interval on it without raising the interval, or
9988
+ * use {@link deviceLogin}. This SDK ships no
9880
9989
  * DPoP proof generator, so it cannot drive a client registered for DPoP; it
9881
9990
  * surfaces that client's refusal as the same `invalid_client`.
9882
9991
  */
9883
9992
  async devicePoll(params) {
9993
+ return this.#devicePoll(params, void 0);
9994
+ }
9995
+ /** {@link devicePoll}; `bound` is the loop's deadline, which a §16 retry inside the poll must not pass. */
9996
+ async #devicePoll(params, bound) {
9884
9997
  const configuration = params.configuration ?? await this.oidcDiscover();
9885
9998
  const form = new URLSearchParams();
9886
9999
  form.set("grant_type", DEVICE_CODE_GRANT_TYPE);
9887
10000
  form.set("device_code", exposeSecret(params.deviceCode));
9888
10001
  form.set("client_id", this.#options.clientId);
9889
10002
  this.#appendClientSecret(form);
9890
- const wire = await this.#postToken(configuration, form, params.tenantId);
10003
+ const url = this.#endpointUrl(this.#requiredEndpoint(configuration, "token_endpoint"), params.tenantId);
10004
+ const wire = await this.#postDevicePoll(url, form, bound);
9891
10005
  return this.#toTokenSet(wire, configuration, void 0);
9892
10006
  }
9893
10007
  /**
@@ -9908,31 +10022,44 @@ var OidcClient = class {
9908
10022
  * even if the server has not yet said `expired_token`. A 5xx or transport
9909
10023
  * failure mid-poll is **not** terminal (rule 6) — the loop absorbs it and
9910
10024
  * tries again, bounded by the same deadline, because a server restart must
9911
- * not lose a grant the user has already approved.
10025
+ * not lose a grant the user has already approved: that bound holds for the
10026
+ * §16 retry inside a poll too, whose waits are served on the loop's clock and
10027
+ * never reach the deadline (`Retry-After` included; the typed `expired_token`
10028
+ * is raised at once, C164-36). A `429
10029
+ * rate_limit_exceeded` (rule 9, contract 1.64) is not terminal either: the
10030
+ * loop waits `Retry-After` as a minimum (capped at the `expires_in`
10031
+ * deadline), counts the wait as one interval, does **not** raise the
10032
+ * interval, and polls again.
9912
10033
  */
9913
10034
  async deviceLogin(params) {
9914
10035
  const configuration = params.configuration ?? await this.oidcDiscover();
10036
+ const clock = params.clock ?? SYSTEM_CIBA_CLOCK;
9915
10037
  const authorization = await this.deviceAuthorize({
9916
10038
  ...params.scope !== void 0 ? { scope: params.scope } : {},
9917
10039
  ...params.tenantId !== void 0 ? { tenantId: params.tenantId } : {},
9918
10040
  configuration
9919
10041
  });
10042
+ const deadline = clock.now() + authorization.expiresIn * 1e3;
9920
10043
  await params.onUserCode(authorization);
9921
10044
  const schedule = new PollSchedule(authorization.interval, authorization.expiresIn);
9922
10045
  for (; ; ) {
9923
- if (!schedule.tick()) {
10046
+ const waitSecs = schedule.waitSecs;
10047
+ if (!schedule.tick() || clock.now() + waitSecs * 1e3 >= deadline) {
9924
10048
  throw new OAuthProtocolError(
9925
10049
  "expired_token",
9926
10050
  "the device authorization expired before the user completed it (client-side deadline from expires_in; CONTRACT.md \xA714.2 rule 4)"
9927
10051
  );
9928
10052
  }
9929
- await sleep(schedule.intervalSecs * 1e3);
10053
+ await clock.sleep(waitSecs * 1e3);
9930
10054
  try {
9931
- return await this.devicePoll({
9932
- deviceCode: authorization.deviceCode,
9933
- ...params.tenantId !== void 0 ? { tenantId: params.tenantId } : {},
9934
- configuration
9935
- });
10055
+ return await this.#devicePoll(
10056
+ {
10057
+ deviceCode: authorization.deviceCode,
10058
+ ...params.tenantId !== void 0 ? { tenantId: params.tenantId } : {},
10059
+ configuration
10060
+ },
10061
+ { deadline, clock }
10062
+ );
9936
10063
  } catch (err) {
9937
10064
  if (err instanceof OAuthProtocolError) {
9938
10065
  if (err.error === "authorization_pending") {
@@ -9942,6 +10069,11 @@ var OidcClient = class {
9942
10069
  schedule.slowDown();
9943
10070
  continue;
9944
10071
  }
10072
+ if (err.error === "rate_limit_exceeded") {
10073
+ const pollWaitMs = POLL_RETRY_AFTER_MS.get(err);
10074
+ schedule.rateLimited(pollWaitMs === void 0 ? void 0 : pollWaitMs / 1e3);
10075
+ continue;
10076
+ }
9945
10077
  throw err;
9946
10078
  }
9947
10079
  if (err instanceof NetworkError) {
@@ -10462,6 +10594,10 @@ var OidcClient = class {
10462
10594
  * this client's credential.
10463
10595
  */
10464
10596
  async cibaPoll(params) {
10597
+ return this.#cibaPoll(params, void 0);
10598
+ }
10599
+ /** {@link cibaPoll}; `bound` is `cibaAwait`'s deadline, which a §16 retry inside the poll must not pass. */
10600
+ async #cibaPoll(params, bound) {
10465
10601
  const operation = "ciba_poll";
10466
10602
  const auth = this.#cibaClientAuth(operation);
10467
10603
  const configuration = params.configuration ?? await this.oidcDiscover();
@@ -10495,7 +10631,8 @@ var OidcClient = class {
10495
10631
  idempotent: true,
10496
10632
  operation,
10497
10633
  enabled: this.#session.retryEnabled,
10498
- telemetry: this.#session.telemetry.dispatcher
10634
+ telemetry: this.#session.telemetry.dispatcher,
10635
+ ...bound !== void 0 ? deadlineBoundedRetry(bound, "CIBA request") : {}
10499
10636
  }
10500
10637
  );
10501
10638
  if (outcome.error) throw outcome.error;
@@ -10515,7 +10652,9 @@ var OidcClient = class {
10515
10652
  * the interval and polls again.
10516
10653
  * - Polling stops at `receivedAt + expiresIn`, even if the server has not
10517
10654
  * said `expired_token`: when the next wait would reach the deadline, the
10518
- * same `expired_token` is raised locally, without a request.
10655
+ * same `expired_token` is raised locally, without a request. A §16 retry
10656
+ * inside {@link cibaPoll} is bounded the same way (§34.2 P10): a wait that
10657
+ * would reach the deadline is not served and nothing is sent after it.
10519
10658
  * - `access_denied`, `expired_token`, `invalid_grant` and any other answer
10520
10659
  * end the loop.
10521
10660
  *
@@ -10543,11 +10682,14 @@ var OidcClient = class {
10543
10682
  }
10544
10683
  await clock.sleep(waitMs);
10545
10684
  try {
10546
- return await this.cibaPoll({
10547
- authReqId: initiated.authReqId,
10548
- configuration,
10549
- ...params.tenantId !== void 0 ? { tenantId: params.tenantId } : {}
10550
- });
10685
+ return await this.#cibaPoll(
10686
+ {
10687
+ authReqId: initiated.authReqId,
10688
+ configuration,
10689
+ ...params.tenantId !== void 0 ? { tenantId: params.tenantId } : {}
10690
+ },
10691
+ { deadline, clock }
10692
+ );
10551
10693
  } catch (err) {
10552
10694
  if (err instanceof OAuthProtocolError) {
10553
10695
  if (err.error === "authorization_pending" || err.error === "rate_limit_exceeded") continue;
@@ -10643,6 +10785,46 @@ var OidcClient = class {
10643
10785
  throw transient(new NetworkError(`${operation}: the request failed before any response arrived${code}`));
10644
10786
  }
10645
10787
  }
10788
+ /**
10789
+ * One device-poll attempt under §16 (CONTRACT.md §14.2 rule 6, §16.2; C164-25): a `5xx` or
10790
+ * a transport failure is retried **inside** the poll (three requests in all, the `Retry-After`
10791
+ * a floor) before it surfaces as a `NetworkError`; the loop then takes its next interval. A
10792
+ * `429` is never retried here — it is rule 9's wait, the loop's — nor is any answer the
10793
+ * server decided (`400`, `401`).
10794
+ */
10795
+ async #postDevicePoll(url, form, bound) {
10796
+ const operation = "device_poll";
10797
+ const outcome = await withRetry(
10798
+ async () => {
10799
+ try {
10800
+ const response = await this.#session.axios.post(url, form.toString(), {
10801
+ headers: { "Content-Type": "application/x-www-form-urlencoded" }
10802
+ });
10803
+ return { wire: response.data };
10804
+ } catch (err) {
10805
+ if (err instanceof AxiamError) return { error: err };
10806
+ const status = axiosStatus3(err);
10807
+ const response = err.response;
10808
+ if (status === void 0) {
10809
+ throw new NetworkError(`${operation}: the request failed before any response arrived`, sanitizeAxiosError(err));
10810
+ }
10811
+ if (status >= 500) {
10812
+ throw retryableNetworkError(`${operation}: HTTP ${status}`, response);
10813
+ }
10814
+ return { error: pollRateLimit(err) ?? mapOidcError(err, url, "token request failed") };
10815
+ }
10816
+ },
10817
+ {
10818
+ idempotent: true,
10819
+ operation,
10820
+ enabled: this.#session.retryEnabled,
10821
+ telemetry: this.#session.telemetry.dispatcher,
10822
+ ...bound !== void 0 ? deadlineBoundedRetry(bound, "device authorization") : {}
10823
+ }
10824
+ );
10825
+ if (outcome.error) throw outcome.error;
10826
+ return outcome.wire;
10827
+ }
10646
10828
  /** POST a form body to the token endpoint from the discovery document. */
10647
10829
  async #postToken(configuration, form, tenantId) {
10648
10830
  const url = this.#endpointUrl(this.#requiredEndpoint(configuration, "token_endpoint"), tenantId);
@@ -10805,7 +10987,7 @@ var OidcClient = class {
10805
10987
  this.#session.axios.interceptors.request.use((config) => {
10806
10988
  const adopted = this.#adoptedCredential;
10807
10989
  const url = config.url ?? "";
10808
- if (!adopted || this.#session.isForeignHost(url) || url.includes("/oauth2/")) {
10990
+ if (!adopted || this.#session.isForeignHost(url) || isOAuth2Endpoint(url, this.#session.baseUrl)) {
10809
10991
  return config;
10810
10992
  }
10811
10993
  config.headers = config.headers ?? {};
@@ -10829,6 +11011,10 @@ var OidcClient = class {
10829
11011
  try {
10830
11012
  return await this.#session.axios.post(url, form.toString(), config);
10831
11013
  } catch (err) {
11014
+ if (axiosStatus3(err) === 429) {
11015
+ const protocol = oauth2ErrorFromBody(axiosBody(err));
11016
+ if (protocol) throw protocol;
11017
+ }
10832
11018
  throw mapOidcError(err, url, fallbackMessage);
10833
11019
  }
10834
11020
  }