@alien_org/sso-sdk-core 1.0.5 → 1.0.6
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 +2 -4
- package/dist/client.js +3 -11
- package/dist/schema.d.ts +0 -9
- package/dist/schema.js +0 -8
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthorizeResponse, TokenInfo
|
|
1
|
+
import { AuthorizeResponse, TokenInfo } from './schema';
|
|
2
2
|
import { z } from 'zod/v4-mini';
|
|
3
3
|
export interface JWTHeader {
|
|
4
4
|
alg: string;
|
|
@@ -23,8 +23,6 @@ export declare class AlienSsoSdkClient {
|
|
|
23
23
|
exchangeToken(authorizationCode: string): Promise<string | null>;
|
|
24
24
|
verifyAuth(): Promise<boolean>;
|
|
25
25
|
getAccessToken(): string | null;
|
|
26
|
-
|
|
27
|
-
user: UserInfo;
|
|
28
|
-
}) | null;
|
|
26
|
+
getAuthData(): TokenInfo | null;
|
|
29
27
|
logout(): void;
|
|
30
28
|
}
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthorizeResponseSchema, ExchangeCodeRequestSchema, ExchangeCodeResponseSchema, InternalAuthorizeRequestSchema, PollRequestSchema, PollResponseSchema, TokenInfoSchema,
|
|
1
|
+
import { AuthorizeResponseSchema, ExchangeCodeRequestSchema, ExchangeCodeResponseSchema, InternalAuthorizeRequestSchema, PollRequestSchema, PollResponseSchema, TokenInfoSchema, VerifyTokenRequestSchema, VerifyTokenResponseSchema, } from './schema';
|
|
2
2
|
import { z } from 'zod/v4-mini';
|
|
3
3
|
import base64url from 'base64url';
|
|
4
4
|
import CryptoJS from 'crypto-js';
|
|
@@ -148,7 +148,7 @@ export class AlienSsoSdkClient {
|
|
|
148
148
|
getAccessToken() {
|
|
149
149
|
return localStorage.getItem(STORAGE_KEY + 'access_token');
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
getAuthData() {
|
|
152
152
|
const token = this.getAccessToken();
|
|
153
153
|
if (!token)
|
|
154
154
|
return null;
|
|
@@ -181,15 +181,7 @@ export class AlienSsoSdkClient {
|
|
|
181
181
|
catch {
|
|
182
182
|
throw new Error('Invalid token payload format');
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
try {
|
|
186
|
-
const userJson = JSON.parse(payload.app_callback_payload);
|
|
187
|
-
user = UserInfoSchema.parse(userJson);
|
|
188
|
-
}
|
|
189
|
-
catch {
|
|
190
|
-
throw new Error('Invalid app_callback_payload JSON format');
|
|
191
|
-
}
|
|
192
|
-
return Object.assign({}, payload, { user });
|
|
184
|
+
return payload;
|
|
193
185
|
}
|
|
194
186
|
logout() {
|
|
195
187
|
localStorage.removeItem(STORAGE_KEY + 'access_token');
|
package/dist/schema.d.ts
CHANGED
|
@@ -60,19 +60,10 @@ export declare const VerifyTokenResponseSchema: z.ZodMiniObject<{
|
|
|
60
60
|
is_valid: z.ZodMiniBoolean<boolean>;
|
|
61
61
|
}, z.core.$strip>;
|
|
62
62
|
export type VerifyTokenResponse = z.infer<typeof VerifyTokenResponseSchema>;
|
|
63
|
-
/**
|
|
64
|
-
* User info schema
|
|
65
|
-
*/
|
|
66
|
-
export declare const UserInfoSchema: z.ZodMiniObject<{
|
|
67
|
-
session_address: z.ZodMiniString<string>;
|
|
68
|
-
}, z.core.$strip>;
|
|
69
|
-
export type UserInfo = z.infer<typeof UserInfoSchema>;
|
|
70
63
|
/**
|
|
71
64
|
* Token info schema
|
|
72
65
|
*/
|
|
73
66
|
export declare const TokenInfoSchema: z.ZodMiniObject<{
|
|
74
|
-
app_callback_payload: z.ZodMiniString<string>;
|
|
75
|
-
app_callback_session_signature: z.ZodMiniString<string>;
|
|
76
67
|
app_callback_session_address: z.ZodMiniString<string>;
|
|
77
68
|
expired_at: z.ZodMiniNumber<number>;
|
|
78
69
|
issued_at: z.ZodMiniNumber<number>;
|
package/dist/schema.js
CHANGED
|
@@ -50,18 +50,10 @@ export const VerifyTokenRequestSchema = z.object({
|
|
|
50
50
|
export const VerifyTokenResponseSchema = z.object({
|
|
51
51
|
is_valid: z.boolean(),
|
|
52
52
|
});
|
|
53
|
-
/**
|
|
54
|
-
* User info schema
|
|
55
|
-
*/
|
|
56
|
-
export const UserInfoSchema = z.object({
|
|
57
|
-
session_address: z.string(),
|
|
58
|
-
});
|
|
59
53
|
/**
|
|
60
54
|
* Token info schema
|
|
61
55
|
*/
|
|
62
56
|
export const TokenInfoSchema = z.object({
|
|
63
|
-
app_callback_payload: z.string(),
|
|
64
|
-
app_callback_session_signature: z.string(),
|
|
65
57
|
app_callback_session_address: z.string(),
|
|
66
58
|
expired_at: z.number(),
|
|
67
59
|
issued_at: z.number(),
|