@oxyhq/core 1.11.8 → 1.11.9

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.
@@ -33,8 +33,6 @@ export interface FedCMConfig {
33
33
  */
34
34
  export declare function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T): {
35
35
  new (...args: any[]): {
36
- /** Resolved FedCM config URL: derived from config.authWebUrl or uses the static default */
37
- get fedcmConfigUrl(): string;
38
36
  /**
39
37
  * Instance method to check FedCM support
40
38
  */
@@ -204,7 +202,6 @@ export declare function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(
204
202
  [key: string]: any;
205
203
  }>;
206
204
  };
207
- readonly DEFAULT_AUTH_URL: "https://auth.oxy.so";
208
205
  readonly DEFAULT_CONFIG_URL: "https://auth.oxy.so/fedcm.json";
209
206
  readonly FEDCM_TIMEOUT: 15000;
210
207
  readonly FEDCM_SILENT_TIMEOUT: 3000;
@@ -33,8 +33,6 @@ export interface SilentAuthOptions {
33
33
  */
34
34
  export declare function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base: T): {
35
35
  new (...args: any[]): {
36
- /** Resolved auth URL: config.authWebUrl takes precedence over the static default */
37
- get authUrl(): string;
38
36
  /**
39
37
  * Sign in using popup window
40
38
  *
@@ -31,8 +31,6 @@ export interface RedirectAuthOptions {
31
31
  */
32
32
  export declare function OxyServicesRedirectAuthMixin<T extends typeof OxyServicesBase>(Base: T): {
33
33
  new (...args: any[]): {
34
- /** Resolved auth URL: config.authWebUrl takes precedence over the static default */
35
- get authUrl(): string;
36
34
  /**
37
35
  * Sign in using full page redirect
38
36
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/core",
3
- "version": "1.11.8",
3
+ "version": "1.11.9",
4
4
  "description": "OxyHQ SDK Foundation — API client, authentication, cryptographic identity, and shared utilities",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -51,15 +51,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
51
51
  constructor(...args: any[]) {
52
52
  super(...(args as [any]));
53
53
  }
54
- public static readonly DEFAULT_AUTH_URL = 'https://auth.oxy.so';
55
54
  public static readonly DEFAULT_CONFIG_URL = 'https://auth.oxy.so/fedcm.json';
56
-
57
- /** Resolved FedCM config URL: derived from config.authWebUrl or uses the static default */
58
- public get fedcmConfigUrl(): string {
59
- return this.config.authWebUrl
60
- ? `${this.config.authWebUrl}/fedcm.json`
61
- : (this.constructor as any).DEFAULT_CONFIG_URL;
62
- }
63
55
  public static readonly FEDCM_TIMEOUT = 15000; // 15 seconds for interactive
64
56
  public static readonly FEDCM_SILENT_TIMEOUT = 3000; // 3 seconds for silent mediation
65
57
 
@@ -121,7 +113,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
121
113
  // Request credential from browser's native identity flow
122
114
  // mode: 'button' signals this is a user-gesture-initiated flow (Chrome 125+)
123
115
  const credential = await this.requestIdentityCredential({
124
- configURL: this.fedcmConfigUrl,
116
+ configURL: (this.config.authWebUrl ? `${this.config.authWebUrl}/fedcm.json` : (this.constructor as any).DEFAULT_CONFIG_URL),
125
117
  clientId,
126
118
  nonce,
127
119
  context: options.context,
@@ -224,7 +216,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
224
216
  debug.log('Silent SSO: Attempting silent mediation...', loginHint ? `(hint: ${loginHint})` : '');
225
217
 
226
218
  credential = await this.requestIdentityCredential({
227
- configURL: this.fedcmConfigUrl,
219
+ configURL: (this.config.authWebUrl ? `${this.config.authWebUrl}/fedcm.json` : (this.constructor as any).DEFAULT_CONFIG_URL),
228
220
  clientId,
229
221
  nonce,
230
222
  loginHint,
@@ -469,7 +461,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
469
461
  if ('IdentityCredential' in window && 'disconnect' in (window as any).IdentityCredential) {
470
462
  const clientId = this.getClientId();
471
463
  await (window as any).IdentityCredential.disconnect({
472
- configURL: this.fedcmConfigUrl,
464
+ configURL: (this.config.authWebUrl ? `${this.config.authWebUrl}/fedcm.json` : (this.constructor as any).DEFAULT_CONFIG_URL),
473
465
  clientId,
474
466
  accountHint: accountHint || '*',
475
467
  });
@@ -488,7 +480,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
488
480
  getFedCMConfig(): FedCMConfig {
489
481
  return {
490
482
  enabled: this.isFedCMSupported(),
491
- configURL: this.fedcmConfigUrl,
483
+ configURL: (this.config.authWebUrl ? `${this.config.authWebUrl}/fedcm.json` : (this.constructor as any).DEFAULT_CONFIG_URL),
492
484
  clientId: this.getClientId(),
493
485
  };
494
486
  }
@@ -44,11 +44,6 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
44
44
  super(...(args as [any]));
45
45
  }
46
46
  public static readonly DEFAULT_AUTH_URL = 'https://auth.oxy.so';
47
-
48
- /** Resolved auth URL: config.authWebUrl takes precedence over the static default */
49
- public get authUrl(): string {
50
- return this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL;
51
- }
52
47
  public static readonly POPUP_WIDTH = 500;
53
48
  public static readonly POPUP_HEIGHT = 700;
54
49
  public static readonly POPUP_TIMEOUT = 60000; // 1 minute
@@ -100,7 +95,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
100
95
  state,
101
96
  nonce,
102
97
  clientId: window.location.origin,
103
- redirectUri: `${this.authUrl}/auth/callback`,
98
+ redirectUri: `${(this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL)}/auth/callback`,
104
99
  });
105
100
 
106
101
  const popup = this.openCenteredPopup(authUrl, 'Oxy Sign In', width, height);
@@ -203,7 +198,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
203
198
  iframe.style.height = '0';
204
199
  iframe.style.border = 'none';
205
200
 
206
- const silentUrl = `${this.authUrl}/auth/silent?` + `client_id=${encodeURIComponent(clientId)}&` + `nonce=${nonce}`;
201
+ const silentUrl = `${(this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL)}/auth/silent?` + `client_id=${encodeURIComponent(clientId)}&` + `nonce=${nonce}`;
207
202
 
208
203
  iframe.src = silentUrl;
209
204
  document.body.appendChild(iframe);
@@ -265,7 +260,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
265
260
  }, timeout);
266
261
 
267
262
  const messageHandler = (event: MessageEvent) => {
268
- const authUrl = this.authUrl;
263
+ const authUrl = (this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL);
269
264
 
270
265
  // Log all messages for debugging
271
266
  if (event.data && typeof event.data === 'object' && event.data.type) {
@@ -352,7 +347,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
352
347
 
353
348
  const messageHandler = (event: MessageEvent) => {
354
349
  // Verify origin
355
- if (event.origin !== this.authUrl) {
350
+ if (event.origin !== (this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL)) {
356
351
  return;
357
352
  }
358
353
 
@@ -387,7 +382,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
387
382
  clientId: string;
388
383
  redirectUri: string;
389
384
  }): string {
390
- const url = new URL(`${this.authUrl}/${params.mode}`);
385
+ const url = new URL(`${(this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL)}/${params.mode}`);
391
386
  url.searchParams.set('response_type', 'token');
392
387
  url.searchParams.set('client_id', params.clientId);
393
388
  url.searchParams.set('redirect_uri', params.redirectUri);
@@ -38,11 +38,6 @@ export function OxyServicesRedirectAuthMixin<T extends typeof OxyServicesBase>(B
38
38
  super(...(args as [any]));
39
39
  }
40
40
  public static readonly DEFAULT_AUTH_URL = 'https://auth.oxy.so';
41
-
42
- /** Resolved auth URL: config.authWebUrl takes precedence over the static default */
43
- public get authUrl(): string {
44
- return this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL;
45
- }
46
41
  public static readonly TOKEN_STORAGE_KEY = 'oxy_access_token';
47
42
  public static readonly SESSION_STORAGE_KEY = 'oxy_session_id';
48
43
  public static readonly STATE_STORAGE_KEY = 'oxy_auth_state';
@@ -275,7 +270,7 @@ export function OxyServicesRedirectAuthMixin<T extends typeof OxyServicesBase>(B
275
270
  nonce: string;
276
271
  clientId: string;
277
272
  }): string {
278
- const url = new URL(`${this.authUrl}/${params.mode}`);
273
+ const url = new URL(`${(this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL)}/${params.mode}`);
279
274
  url.searchParams.set('redirect_uri', params.redirectUri);
280
275
  url.searchParams.set('state', params.state);
281
276
  url.searchParams.set('nonce', params.nonce);