@authorizerdev/authorizer-js 1.1.5 → 1.2.0-beta.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.
@@ -1,185 +0,0 @@
1
- export type ConfigType = {
2
- authorizerURL: string;
3
- redirectURL: string;
4
- clientID: string;
5
- extraHeaders?: Record<string, string>;
6
- };
7
- export type User = {
8
- id: string;
9
- email: string;
10
- preferred_username: string;
11
- email_verified: boolean;
12
- signup_methods: string;
13
- given_name?: string | null;
14
- family_name?: string | null;
15
- middle_name?: string | null;
16
- nickname?: string | null;
17
- picture?: string | null;
18
- gender?: string | null;
19
- birthdate?: string | null;
20
- phone_number?: string | null;
21
- phone_number_verified?: boolean | null;
22
- roles?: string[];
23
- created_at: number;
24
- updated_at: number;
25
- is_multi_factor_auth_enabled?: boolean;
26
- };
27
- export type AuthToken = {
28
- message?: string;
29
- access_token: string;
30
- expires_in: number;
31
- id_token: string;
32
- refresh_token?: string;
33
- user?: User;
34
- should_show_otp_screen?: boolean;
35
- };
36
- export type Response = {
37
- message: string;
38
- };
39
- export type Headers = Record<string, string>;
40
- export type LoginInput = {
41
- email: string;
42
- password: string;
43
- roles?: string[];
44
- scope?: string[];
45
- state?: string;
46
- };
47
- export type SignupInput = {
48
- email: string;
49
- password: string;
50
- confirm_password: string;
51
- given_name?: string;
52
- family_name?: string;
53
- middle_name?: string;
54
- nickname?: string;
55
- picture?: string;
56
- gender?: string;
57
- birthdate?: string;
58
- phone_number?: string;
59
- roles?: string[];
60
- scope?: string[];
61
- redirect_uri?: string;
62
- is_multi_factor_auth_enabled?: boolean;
63
- state?: string;
64
- };
65
- export type MagicLinkLoginInput = {
66
- email: string;
67
- roles?: string[];
68
- scopes?: string[];
69
- state?: string;
70
- redirect_uri?: string;
71
- };
72
- export type VerifyEmailInput = {
73
- token: string;
74
- state?: string;
75
- };
76
- export type VerifyOtpInput = {
77
- email: string;
78
- otp: string;
79
- state?: string;
80
- };
81
- export type ResendOtpInput = {
82
- email: string;
83
- };
84
- export type GraphqlQueryInput = {
85
- query: string;
86
- variables?: Record<string, any>;
87
- headers?: Headers;
88
- };
89
- export type MetaData = {
90
- version: string;
91
- client_id: string;
92
- is_google_login_enabled: boolean;
93
- is_facebook_login_enabled: boolean;
94
- is_github_login_enabled: boolean;
95
- is_linkedin_login_enabled: boolean;
96
- is_apple_login_enabled: boolean;
97
- is_twitter_login_enabled: boolean;
98
- is_microsoft_login_enabled: boolean;
99
- is_email_verification_enabled: boolean;
100
- is_basic_authentication_enabled: boolean;
101
- is_magic_link_login_enabled: boolean;
102
- is_sign_up_enabled: boolean;
103
- is_strong_password_enabled: boolean;
104
- };
105
- export type UpdateProfileInput = {
106
- old_password?: string;
107
- new_password?: string;
108
- confirm_new_password?: string;
109
- email?: string;
110
- given_name?: string;
111
- family_name?: string;
112
- middle_name?: string;
113
- nickname?: string;
114
- gender?: string;
115
- birthdate?: string;
116
- phone_number?: string;
117
- picture?: string;
118
- is_multi_factor_auth_enabled?: boolean;
119
- };
120
- export type ForgotPasswordInput = {
121
- email: string;
122
- state?: string;
123
- redirect_uri?: string;
124
- };
125
- export type ResetPasswordInput = {
126
- token: string;
127
- password: string;
128
- confirm_password: string;
129
- };
130
- export type SessionQueryInput = {
131
- roles?: string[];
132
- };
133
- export type IsValidJWTQueryInput = {
134
- jwt: string;
135
- roles?: string[];
136
- };
137
- export type ValidJWTResponse = {
138
- valid: string;
139
- message: string;
140
- };
141
- export declare enum OAuthProviders {
142
- Apple = "apple",
143
- Github = "github",
144
- Google = "google",
145
- Facebook = "facebook",
146
- LinkedIn = "linkedin"
147
- }
148
- export declare enum ResponseTypes {
149
- Code = "code",
150
- Token = "token"
151
- }
152
- export type AuthorizeInput = {
153
- response_type: ResponseTypes;
154
- use_refresh_token?: boolean;
155
- response_mode?: string;
156
- };
157
- export type AuthorizeResponse = {
158
- state: string;
159
- code?: string;
160
- error?: string;
161
- error_description?: string;
162
- };
163
- export type RevokeTokenInput = {
164
- refresh_token: string;
165
- };
166
- export type GetTokenInput = {
167
- code?: string;
168
- grant_type?: string;
169
- refresh_token?: string;
170
- };
171
- export type GetTokenResponse = {
172
- access_token: string;
173
- expires_in: number;
174
- id_token: string;
175
- refresh_token?: string;
176
- };
177
- export type ValidateJWTTokenInput = {
178
- token_type: 'access_token' | 'id_token' | 'refresh_token';
179
- token: string;
180
- roles?: string[];
181
- };
182
- export type ValidateJWTTokenResponse = {
183
- is_valid: boolean;
184
- claims: Record<string, any>;
185
- };
@@ -1,13 +0,0 @@
1
- import { AuthorizeResponse } from './types';
2
- export declare const hasWindow: () => boolean;
3
- export declare const trimURL: (url: string) => string;
4
- export declare const getCrypto: () => Crypto | null;
5
- export declare const getCryptoSubtle: () => any;
6
- export declare const createRandomString: () => string;
7
- export declare const encode: (value: string) => string;
8
- export declare const decode: (value: string) => string;
9
- export declare const createQueryParams: (params: any) => string;
10
- export declare const sha256: (s: string) => Promise<any>;
11
- export declare const urlDecodeB64: (input: string) => string;
12
- export declare const bufferToBase64UrlEncoded: (input: number[] | Uint8Array) => string;
13
- export declare const executeIframe: (authorizeUrl: string, eventOrigin: string, timeoutInSeconds?: number) => Promise<AuthorizeResponse>;
package/lib/index.d.ts DELETED
@@ -1,29 +0,0 @@
1
- import * as Types from './types';
2
- export * from './types';
3
- export declare class Authorizer {
4
- config: Types.ConfigType;
5
- codeVerifier: string;
6
- constructor(config: Types.ConfigType);
7
- authorize: (data: Types.AuthorizeInput) => Promise<Types.AuthorizeResponse | Types.GetTokenResponse | undefined>;
8
- browserLogin: () => Promise<Types.AuthToken | void>;
9
- forgotPassword: (data: Types.ForgotPasswordInput) => Promise<Types.Response | void>;
10
- getMetaData: () => Promise<Types.MetaData | void>;
11
- getProfile: (headers?: Types.Headers) => Promise<Types.User | void>;
12
- getSession: (headers?: Types.Headers, params?: Types.SessionQueryInput) => Promise<Types.AuthToken>;
13
- getToken: (data: Types.GetTokenInput) => Promise<Types.GetTokenResponse>;
14
- graphqlQuery: (data: Types.GraphqlQueryInput) => Promise<any>;
15
- login: (data: Types.LoginInput) => Promise<Types.AuthToken | void>;
16
- logout: (headers?: Types.Headers) => Promise<Types.Response | void>;
17
- magicLinkLogin: (data: Types.MagicLinkLoginInput) => Promise<Types.Response>;
18
- oauthLogin: (oauthProvider: string, roles?: string[], redirect_uri?: string, state?: string) => Promise<void>;
19
- resendOtp: (data: Types.ResendOtpInput) => Promise<Types.Response | void>;
20
- resetPassword: (data: Types.ResetPasswordInput) => Promise<Types.Response | void>;
21
- revokeToken: (data: {
22
- refresh_token: string;
23
- }) => Promise<any>;
24
- signup: (data: Types.SignupInput) => Promise<Types.AuthToken | void>;
25
- updateProfile: (data: Types.UpdateProfileInput, headers?: Types.Headers) => Promise<Types.Response | void>;
26
- validateJWTToken: (params?: Types.ValidateJWTTokenInput) => Promise<Types.ValidateJWTTokenResponse>;
27
- verifyEmail: (data: Types.VerifyEmailInput) => Promise<Types.AuthToken | void>;
28
- verifyOtp: (data: Types.VerifyOtpInput) => Promise<Types.AuthToken | void>;
29
- }
package/lib/types.d.ts DELETED
@@ -1,185 +0,0 @@
1
- export type ConfigType = {
2
- authorizerURL: string;
3
- redirectURL: string;
4
- clientID: string;
5
- extraHeaders?: Record<string, string>;
6
- };
7
- export type User = {
8
- id: string;
9
- email: string;
10
- preferred_username: string;
11
- email_verified: boolean;
12
- signup_methods: string;
13
- given_name?: string | null;
14
- family_name?: string | null;
15
- middle_name?: string | null;
16
- nickname?: string | null;
17
- picture?: string | null;
18
- gender?: string | null;
19
- birthdate?: string | null;
20
- phone_number?: string | null;
21
- phone_number_verified?: boolean | null;
22
- roles?: string[];
23
- created_at: number;
24
- updated_at: number;
25
- is_multi_factor_auth_enabled?: boolean;
26
- };
27
- export type AuthToken = {
28
- message?: string;
29
- access_token: string;
30
- expires_in: number;
31
- id_token: string;
32
- refresh_token?: string;
33
- user?: User;
34
- should_show_otp_screen?: boolean;
35
- };
36
- export type Response = {
37
- message: string;
38
- };
39
- export type Headers = Record<string, string>;
40
- export type LoginInput = {
41
- email: string;
42
- password: string;
43
- roles?: string[];
44
- scope?: string[];
45
- state?: string;
46
- };
47
- export type SignupInput = {
48
- email: string;
49
- password: string;
50
- confirm_password: string;
51
- given_name?: string;
52
- family_name?: string;
53
- middle_name?: string;
54
- nickname?: string;
55
- picture?: string;
56
- gender?: string;
57
- birthdate?: string;
58
- phone_number?: string;
59
- roles?: string[];
60
- scope?: string[];
61
- redirect_uri?: string;
62
- is_multi_factor_auth_enabled?: boolean;
63
- state?: string;
64
- };
65
- export type MagicLinkLoginInput = {
66
- email: string;
67
- roles?: string[];
68
- scopes?: string[];
69
- state?: string;
70
- redirect_uri?: string;
71
- };
72
- export type VerifyEmailInput = {
73
- token: string;
74
- state?: string;
75
- };
76
- export type VerifyOtpInput = {
77
- email: string;
78
- otp: string;
79
- state?: string;
80
- };
81
- export type ResendOtpInput = {
82
- email: string;
83
- };
84
- export type GraphqlQueryInput = {
85
- query: string;
86
- variables?: Record<string, any>;
87
- headers?: Headers;
88
- };
89
- export type MetaData = {
90
- version: string;
91
- client_id: string;
92
- is_google_login_enabled: boolean;
93
- is_facebook_login_enabled: boolean;
94
- is_github_login_enabled: boolean;
95
- is_linkedin_login_enabled: boolean;
96
- is_apple_login_enabled: boolean;
97
- is_twitter_login_enabled: boolean;
98
- is_microsoft_login_enabled: boolean;
99
- is_email_verification_enabled: boolean;
100
- is_basic_authentication_enabled: boolean;
101
- is_magic_link_login_enabled: boolean;
102
- is_sign_up_enabled: boolean;
103
- is_strong_password_enabled: boolean;
104
- };
105
- export type UpdateProfileInput = {
106
- old_password?: string;
107
- new_password?: string;
108
- confirm_new_password?: string;
109
- email?: string;
110
- given_name?: string;
111
- family_name?: string;
112
- middle_name?: string;
113
- nickname?: string;
114
- gender?: string;
115
- birthdate?: string;
116
- phone_number?: string;
117
- picture?: string;
118
- is_multi_factor_auth_enabled?: boolean;
119
- };
120
- export type ForgotPasswordInput = {
121
- email: string;
122
- state?: string;
123
- redirect_uri?: string;
124
- };
125
- export type ResetPasswordInput = {
126
- token: string;
127
- password: string;
128
- confirm_password: string;
129
- };
130
- export type SessionQueryInput = {
131
- roles?: string[];
132
- };
133
- export type IsValidJWTQueryInput = {
134
- jwt: string;
135
- roles?: string[];
136
- };
137
- export type ValidJWTResponse = {
138
- valid: string;
139
- message: string;
140
- };
141
- export declare enum OAuthProviders {
142
- Apple = "apple",
143
- Github = "github",
144
- Google = "google",
145
- Facebook = "facebook",
146
- LinkedIn = "linkedin"
147
- }
148
- export declare enum ResponseTypes {
149
- Code = "code",
150
- Token = "token"
151
- }
152
- export type AuthorizeInput = {
153
- response_type: ResponseTypes;
154
- use_refresh_token?: boolean;
155
- response_mode?: string;
156
- };
157
- export type AuthorizeResponse = {
158
- state: string;
159
- code?: string;
160
- error?: string;
161
- error_description?: string;
162
- };
163
- export type RevokeTokenInput = {
164
- refresh_token: string;
165
- };
166
- export type GetTokenInput = {
167
- code?: string;
168
- grant_type?: string;
169
- refresh_token?: string;
170
- };
171
- export type GetTokenResponse = {
172
- access_token: string;
173
- expires_in: number;
174
- id_token: string;
175
- refresh_token?: string;
176
- };
177
- export type ValidateJWTTokenInput = {
178
- token_type: 'access_token' | 'id_token' | 'refresh_token';
179
- token: string;
180
- roles?: string[];
181
- };
182
- export type ValidateJWTTokenResponse = {
183
- is_valid: boolean;
184
- claims: Record<string, any>;
185
- };
package/lib/utils.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import { AuthorizeResponse } from './types';
2
- export declare const hasWindow: () => boolean;
3
- export declare const trimURL: (url: string) => string;
4
- export declare const getCrypto: () => Crypto | null;
5
- export declare const getCryptoSubtle: () => any;
6
- export declare const createRandomString: () => string;
7
- export declare const encode: (value: string) => string;
8
- export declare const decode: (value: string) => string;
9
- export declare const createQueryParams: (params: any) => string;
10
- export declare const sha256: (s: string) => Promise<any>;
11
- export declare const urlDecodeB64: (input: string) => string;
12
- export declare const bufferToBase64UrlEncoded: (input: number[] | Uint8Array) => string;
13
- export declare const executeIframe: (authorizeUrl: string, eventOrigin: string, timeoutInSeconds?: number) => Promise<AuthorizeResponse>;
package/src/constants.ts DELETED
@@ -1,3 +0,0 @@
1
- export const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
2
- export const CLEANUP_IFRAME_TIMEOUT_IN_SECONDS = 2;
3
- export const AUTHORIZE_IFRAME_TIMEOUT = 5;