@alien_org/sso-sdk-core 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -5,16 +5,16 @@ export interface JWTHeader {
5
5
  typ: string;
6
6
  }
7
7
  export declare const AlienSsoSdkClientSchema: z.ZodMiniObject<{
8
- serverSdkBaseUrl: z.ZodMiniString<string>;
9
8
  ssoBaseUrl: z.ZodMiniURL;
9
+ providerAddress: z.ZodMiniString<string>;
10
10
  pollingInterval: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
11
11
  }, z.core.$strip>;
12
12
  export type AlienSsoSdkClientConfig = z.infer<typeof AlienSsoSdkClientSchema>;
13
13
  export declare class AlienSsoSdkClient {
14
14
  readonly config: AlienSsoSdkClientConfig;
15
15
  readonly pollingInterval: number;
16
- readonly serverSdkBaseUrl: string;
17
16
  readonly ssoBaseUrl: string;
17
+ readonly providerAddress: string;
18
18
  constructor(config: AlienSsoSdkClientConfig);
19
19
  private generateCodeVerifier;
20
20
  private generateCodeChallenge;
package/dist/client.js CHANGED
@@ -3,20 +3,19 @@ import { z } from 'zod/v4-mini';
3
3
  import base64url from 'base64url';
4
4
  import CryptoJS from 'crypto-js';
5
5
  import { joinUrl } from './utils';
6
- const SERVER_SDK_BASEURL = 'http://localhost:3000';
7
6
  const SSO_BASE_URL = 'https://sso.alien.com';
8
7
  const POLLING_INTERVAL = 5000;
9
8
  const STORAGE_KEY = 'alien-sso_';
10
9
  export const AlienSsoSdkClientSchema = z.object({
11
- serverSdkBaseUrl: z.string(),
12
10
  ssoBaseUrl: z.url(),
11
+ providerAddress: z.string(),
13
12
  pollingInterval: z.optional(z.number()),
14
13
  });
15
14
  export class AlienSsoSdkClient {
16
15
  constructor(config) {
17
16
  this.config = AlienSsoSdkClientSchema.parse(config);
18
17
  this.ssoBaseUrl = this.config.ssoBaseUrl || SSO_BASE_URL;
19
- this.serverSdkBaseUrl = this.config.serverSdkBaseUrl || SERVER_SDK_BASEURL;
18
+ this.providerAddress = this.config.providerAddress;
20
19
  this.pollingInterval = this.config.pollingInterval || POLLING_INTERVAL;
21
20
  }
22
21
  generateCodeVerifier(length = 128) {
@@ -45,7 +44,7 @@ export class AlienSsoSdkClient {
45
44
  const codeVerifier = this.generateCodeVerifier();
46
45
  const codeChallenge = await this.generateCodeChallenge(codeVerifier);
47
46
  sessionStorage.setItem(STORAGE_KEY + 'code_verifier', codeVerifier);
48
- const authorizeUrl = `${this.config.serverSdkBaseUrl}/authorize`;
47
+ const authorizeUrl = `${this.config.ssoBaseUrl}/authorize`;
49
48
  const authorizePayload = {
50
49
  code_challenge: codeChallenge,
51
50
  };
@@ -54,6 +53,7 @@ export class AlienSsoSdkClient {
54
53
  method: 'POST',
55
54
  headers: {
56
55
  'Content-Type': 'application/json',
56
+ 'X-PROVIDER-ADDRESS': this.providerAddress,
57
57
  },
58
58
  body: JSON.stringify(authorizePayload),
59
59
  });
@@ -70,6 +70,7 @@ export class AlienSsoSdkClient {
70
70
  method: 'POST',
71
71
  headers: {
72
72
  'Content-Type': 'application/json',
73
+ 'X-PROVIDER-ADDRESS': this.providerAddress,
73
74
  },
74
75
  body: JSON.stringify(pollPayload),
75
76
  });
@@ -103,6 +104,7 @@ export class AlienSsoSdkClient {
103
104
  method: 'POST',
104
105
  headers: {
105
106
  'Content-Type': 'application/json',
107
+ 'X-PROVIDER-ADDRESS': this.providerAddress,
106
108
  },
107
109
  body: JSON.stringify(exchangeCodePayload),
108
110
  });
@@ -132,6 +134,7 @@ export class AlienSsoSdkClient {
132
134
  method: 'POST',
133
135
  headers: {
134
136
  'Content-Type': 'application/json',
137
+ 'X-PROVIDER-ADDRESS': this.providerAddress,
135
138
  },
136
139
  body: JSON.stringify(verifyTokenPayload),
137
140
  });
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from './client';
2
- export * from './server';
3
2
  export * from './errors';
4
3
  export * from './schema';
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from './client';
2
- export * from './server';
3
2
  export * from './errors';
4
3
  export * from './schema';
package/dist/schema.d.ts CHANGED
@@ -12,8 +12,6 @@ export type InternalAuthorizeRequest = z.infer<typeof InternalAuthorizeRequestSc
12
12
  export declare const AuthorizeRequestSchema: z.ZodMiniObject<{
13
13
  code_challenge: z.ZodMiniString<string>;
14
14
  code_challenge_method: z.ZodMiniLiteral<"S256">;
15
- provider_address: z.ZodMiniString<string>;
16
- provider_signature: z.ZodMiniString<string>;
17
15
  }, z.core.$strip>;
18
16
  export type AuthorizeRequest = z.infer<typeof AuthorizeRequestSchema>;
19
17
  export declare const AuthorizeResponseSchema: z.ZodMiniObject<{
package/dist/schema.js CHANGED
@@ -11,8 +11,6 @@ export const InternalAuthorizeRequestSchema = z.object({
11
11
  export const AuthorizeRequestSchema = z.object({
12
12
  code_challenge: z.string(),
13
13
  code_challenge_method: z.literal('S256'),
14
- provider_address: z.string(),
15
- provider_signature: z.string(),
16
14
  });
17
15
  export const AuthorizeResponseSchema = z.object({
18
16
  deep_link: z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alien_org/sso-sdk-core",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/alien-id/sso-sdk-js.git"