@cloudbase/oauth 2.25.3 → 2.25.4

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 (51) hide show
  1. package/dist/{types → cjs}/auth/apis.d.ts +2 -2
  2. package/dist/cjs/auth/apis.js +1 -1
  3. package/dist/{types → cjs}/auth/models.d.ts +8 -2
  4. package/dist/cjs/auth/models.js +1 -1
  5. package/dist/{types → cjs}/index.d.ts +3 -2
  6. package/dist/cjs/index.js +3 -3
  7. package/dist/{types → cjs}/utils/base64.d.ts +1 -1
  8. package/dist/cjs/utils/base64.js +4 -4
  9. package/dist/esm/auth/apis.d.ts +141 -0
  10. package/dist/esm/auth/auth-error.d.ts +6 -0
  11. package/dist/esm/auth/consts.d.ts +132 -0
  12. package/dist/esm/auth/models.d.ts +550 -0
  13. package/dist/esm/captcha/captcha-dom.d.ts +3 -0
  14. package/dist/esm/captcha/captcha.d.ts +42 -0
  15. package/dist/esm/index.d.ts +23 -0
  16. package/dist/esm/index.js +1 -1
  17. package/dist/esm/oauth2client/consts.d.ts +20 -0
  18. package/dist/esm/oauth2client/interface.d.ts +15 -0
  19. package/dist/esm/oauth2client/models.d.ts +74 -0
  20. package/dist/esm/oauth2client/oauth2client.d.ts +129 -0
  21. package/dist/esm/utils/base64.d.ts +9 -0
  22. package/dist/esm/utils/base64.js +1 -1
  23. package/dist/esm/utils/encrypt.d.ts +4 -0
  24. package/dist/esm/utils/encryptlong/index.d.ts +546 -0
  25. package/dist/esm/utils/function/single-promise.d.ts +6 -0
  26. package/dist/esm/utils/index.d.ts +2 -0
  27. package/dist/esm/utils/mp.d.ts +2 -0
  28. package/dist/esm/utils/urlSearchParams.d.ts +13 -0
  29. package/dist/esm/utils/uuid.d.ts +1 -0
  30. package/dist/miniprogram/index.js +1 -1
  31. package/package.json +5 -4
  32. package/src/auth/apis.ts +4 -4
  33. package/src/auth/models.ts +8 -2
  34. package/src/index.ts +2 -2
  35. package/src/utils/base64.ts +1 -1
  36. package/tsconfig.json +1 -2
  37. /package/dist/{types → cjs}/auth/auth-error.d.ts +0 -0
  38. /package/dist/{types → cjs}/auth/consts.d.ts +0 -0
  39. /package/dist/{types → cjs}/captcha/captcha-dom.d.ts +0 -0
  40. /package/dist/{types → cjs}/captcha/captcha.d.ts +0 -0
  41. /package/dist/{types → cjs}/oauth2client/consts.d.ts +0 -0
  42. /package/dist/{types → cjs}/oauth2client/interface.d.ts +0 -0
  43. /package/dist/{types → cjs}/oauth2client/models.d.ts +0 -0
  44. /package/dist/{types → cjs}/oauth2client/oauth2client.d.ts +0 -0
  45. /package/dist/{types → cjs}/utils/encrypt.d.ts +0 -0
  46. /package/dist/{types → cjs}/utils/encryptlong/index.d.ts +0 -0
  47. /package/dist/{types → cjs}/utils/function/single-promise.d.ts +0 -0
  48. /package/dist/{types → cjs}/utils/index.d.ts +0 -0
  49. /package/dist/{types → cjs}/utils/mp.d.ts +0 -0
  50. /package/dist/{types → cjs}/utils/urlSearchParams.d.ts +0 -0
  51. /package/dist/{types → cjs}/utils/uuid.d.ts +0 -0
@@ -0,0 +1,550 @@
1
+ interface BaseRequest {
2
+ client_id?: string;
3
+ }
4
+ export type GetCustomSignTicketFn = () => Promise<string>;
5
+ export interface SignInRequest extends BaseRequest, EncryptParams {
6
+ username?: string;
7
+ password?: string;
8
+ verification_token?: string;
9
+ version?: string;
10
+ query?: {
11
+ with_department?: boolean;
12
+ with_role?: boolean;
13
+ };
14
+ }
15
+ export interface SignInWithProviderRequest extends BaseRequest {
16
+ provider_token: string;
17
+ version?: string;
18
+ }
19
+ export interface SignUpRequest extends BaseRequest {
20
+ phone_number?: string;
21
+ email?: string;
22
+ verification_code?: string;
23
+ verification_token?: string;
24
+ provider_token?: string;
25
+ password?: string;
26
+ name?: string;
27
+ gender?: string;
28
+ picture?: string;
29
+ locale?: string;
30
+ }
31
+ export interface GetVerificationRequest extends BaseRequest {
32
+ phone_number?: string;
33
+ email?: string;
34
+ target?: string | 'ANY';
35
+ usage?: string;
36
+ }
37
+ export interface GetVerificationResponse {
38
+ verification_id?: string;
39
+ is_user?: boolean | false;
40
+ }
41
+ export interface VerifyResponse {
42
+ verification_token?: string;
43
+ }
44
+ export interface VerifyRequest extends BaseRequest {
45
+ verification_code: string;
46
+ verification_id?: string;
47
+ verification_token?: string;
48
+ version?: string;
49
+ }
50
+ export interface ProviderBindRequest {
51
+ provider_token: string;
52
+ }
53
+ export interface GrantProviderTokenRequest extends BaseRequest {
54
+ provider_id: string;
55
+ provider_redirect_uri?: string;
56
+ provider_code?: string;
57
+ provider_access_token?: string;
58
+ provider_id_token?: string;
59
+ }
60
+ export interface GrantProviderTokenResponse {
61
+ provider_token: string;
62
+ expires_in: number;
63
+ code?: string;
64
+ error_code?: string;
65
+ provider_profile?: ProviderProfile;
66
+ }
67
+ export interface PatchProviderTokenRequest extends BaseRequest {
68
+ provider_id?: string;
69
+ provider_token: string;
70
+ provider_params: {
71
+ encryptedData?: string;
72
+ iv?: string;
73
+ code?: string;
74
+ provider_code_type?: string;
75
+ };
76
+ }
77
+ export interface PatchProviderTokenResponse {
78
+ provider_token: string;
79
+ expires_in: number;
80
+ provider_profile: ProviderProfile;
81
+ }
82
+ export interface GenProviderRedirectUriResponse {
83
+ uri: string;
84
+ signout_uri?: string;
85
+ }
86
+ export interface BindWithProviderRequest extends BaseRequest {
87
+ provider_token: string;
88
+ }
89
+ export interface BindWithProviderRequest {
90
+ provider_token: string;
91
+ }
92
+ export interface UserProfileProvider {
93
+ id?: string;
94
+ provider_user_id?: string;
95
+ name?: string;
96
+ }
97
+ export interface UserProfile {
98
+ name?: string;
99
+ picture?: string;
100
+ username?: string;
101
+ email?: string;
102
+ email_verified?: boolean;
103
+ phone_number?: string;
104
+ providers?: [UserProfileProvider];
105
+ gender?: string;
106
+ birthdate?: string;
107
+ zoneinfo?: string;
108
+ locale?: string;
109
+ created_from?: string;
110
+ sub?: string;
111
+ uid?: string;
112
+ address?: {
113
+ formatted?: string;
114
+ street_address?: string;
115
+ locality?: string;
116
+ region?: string;
117
+ postal_code?: string;
118
+ country?: string;
119
+ };
120
+ nickName?: string;
121
+ province?: string;
122
+ country?: string;
123
+ city?: string;
124
+ }
125
+ export type UserInfo = UserProfile;
126
+ export interface ProviderProfile {
127
+ provider_id: string;
128
+ phone_number?: string;
129
+ name?: string;
130
+ picture?: string;
131
+ email?: string;
132
+ }
133
+ export interface TransByProviderRequest {
134
+ provider_token: string;
135
+ }
136
+ export interface GrantTokenRequest extends BaseRequest {
137
+ client_secret?: string;
138
+ code?: string;
139
+ grant_type?: string;
140
+ redirect_uri?: string;
141
+ nonce?: string;
142
+ refresh_token?: string;
143
+ scope?: string;
144
+ }
145
+ export interface UnbindProviderRequest extends BaseRequest {
146
+ provider_id: string;
147
+ }
148
+ export interface BindPhoneRequest extends BaseRequest {
149
+ phone_number: string;
150
+ sudo_token: string;
151
+ verification_token: string;
152
+ }
153
+ export interface SetPasswordRequest extends BaseRequest {
154
+ new_password: string;
155
+ sudo_token: string;
156
+ }
157
+ export interface ChangeBindedProviderRequest extends BaseRequest {
158
+ trans_token: string;
159
+ provider_id: string;
160
+ }
161
+ export interface QueryUserProfileReq extends BaseRequest {
162
+ appended_params: string;
163
+ }
164
+ export interface SignInWithProviderRequest {
165
+ provider_token: string;
166
+ provider_id?: string;
167
+ }
168
+ export interface SignInCustomRequest {
169
+ provider_id?: string;
170
+ ticket: string;
171
+ }
172
+ export interface SignUpRequest {
173
+ phone_number?: string;
174
+ email?: string;
175
+ verification_code?: string;
176
+ verification_token?: string;
177
+ provider_token?: string;
178
+ username?: string;
179
+ password?: string;
180
+ name?: string;
181
+ gender?: string;
182
+ picture?: string;
183
+ locale?: string;
184
+ anonymous_token?: string;
185
+ }
186
+ export interface GetVerificationRequest {
187
+ phone_number?: string;
188
+ email?: string;
189
+ target?: string | 'ANY';
190
+ usage?: string;
191
+ }
192
+ export interface GetVerificationResponse {
193
+ verification_id?: string;
194
+ is_user?: boolean | false;
195
+ }
196
+ export interface VerifyResponse {
197
+ verification_token?: string;
198
+ expires_in: number;
199
+ }
200
+ export interface VerifyRequest {
201
+ verification_code: string;
202
+ verification_id?: string;
203
+ verification_token?: string;
204
+ version?: string;
205
+ }
206
+ export interface ProviderBindRequest {
207
+ provider_token: string;
208
+ expires_in: number;
209
+ }
210
+ export interface GrantProviderTokenRequest {
211
+ provider_id: string;
212
+ provider_redirect_uri?: string;
213
+ provider_code?: string;
214
+ provider_access_token?: string;
215
+ provider_id_token?: string;
216
+ provider_params?: {
217
+ provider_code_type?: string;
218
+ appid?: string;
219
+ };
220
+ }
221
+ export interface PatchProviderTokenRequest {
222
+ provider_token: string;
223
+ provider_id?: string;
224
+ provider_params: {
225
+ encryptedData?: string;
226
+ iv?: string;
227
+ code?: string;
228
+ provider_code_type?: string;
229
+ };
230
+ }
231
+ export interface PatchProviderTokenResponse {
232
+ provider_token: string;
233
+ expires_in: number;
234
+ provider_profile: ProviderProfile;
235
+ }
236
+ export interface GenProviderRedirectUriRequest {
237
+ provider_id: string;
238
+ redirect_uri?: string;
239
+ provider_redirect_uri?: string;
240
+ state: string;
241
+ scope?: string;
242
+ response_type?: string;
243
+ other_params?: {
244
+ [key: string]: string;
245
+ };
246
+ }
247
+ export interface GenProviderRedirectUriResponse {
248
+ uri: string;
249
+ signout_uri?: string;
250
+ }
251
+ export interface BindWithProviderRequest {
252
+ provider_token: string;
253
+ }
254
+ export interface BindWithProviderRequest {
255
+ provider_token: string;
256
+ }
257
+ export interface UserProfileProvider {
258
+ id?: string;
259
+ provider_user_id?: string;
260
+ name?: string;
261
+ }
262
+ interface ProfileGroup {
263
+ id: string;
264
+ expires_at?: string;
265
+ }
266
+ export interface UserProfile {
267
+ sub?: string;
268
+ name?: string;
269
+ picture?: string;
270
+ username?: string;
271
+ email?: string;
272
+ email_verified?: boolean;
273
+ phone_number?: string;
274
+ groups?: [ProfileGroup];
275
+ providers?: [UserProfileProvider];
276
+ gender?: string;
277
+ birthdate?: string;
278
+ zoneinfo?: string;
279
+ locale?: string;
280
+ created_from?: string;
281
+ created_at?: string;
282
+ updated_at?: string;
283
+ loginType?: string;
284
+ avatarUrl?: string;
285
+ location?: any;
286
+ hasPassword?: boolean;
287
+ }
288
+ interface UserProvider {
289
+ id: string;
290
+ name: string;
291
+ provider_user_name?: string;
292
+ bind: boolean;
293
+ }
294
+ export interface ProvidersResponse {
295
+ total: number;
296
+ data: [UserProvider];
297
+ }
298
+ export interface ProviderProfile {
299
+ provider_id: string;
300
+ name?: string;
301
+ picture?: string;
302
+ phone_number?: string;
303
+ email?: string;
304
+ }
305
+ export interface TransByProviderRequest {
306
+ provider_token: string;
307
+ }
308
+ export interface GrantTokenRequest {
309
+ client_secret?: string;
310
+ code?: string;
311
+ grant_type?: string;
312
+ redirect_uri?: string;
313
+ nonce?: string;
314
+ refresh_token?: string;
315
+ username?: string;
316
+ password?: string;
317
+ scope?: string;
318
+ code_verifier?: string;
319
+ device_code?: string;
320
+ }
321
+ export interface UnbindProviderRequest {
322
+ provider_id: string;
323
+ }
324
+ export interface CheckPasswordRequest extends BaseRequest {
325
+ password: string;
326
+ }
327
+ export interface EditContactRequest {
328
+ phone_number?: string;
329
+ email?: string;
330
+ sudo_token: string;
331
+ verification_token: string;
332
+ conflict_resolution?: string;
333
+ }
334
+ export interface BindPhoneRequest {
335
+ phone_number: string;
336
+ sudo_token: string;
337
+ verification_token: string;
338
+ conflict_resolution: string;
339
+ }
340
+ export interface BindEmailRequest {
341
+ email: string;
342
+ sudo_token: string;
343
+ verification_token: string;
344
+ }
345
+ export interface SetPasswordRequest {
346
+ new_password: string;
347
+ sudo_token: string;
348
+ }
349
+ export interface SetPasswordRequest {
350
+ new_password: string;
351
+ sudo_token: string;
352
+ }
353
+ export interface UpdatePasswordRequest {
354
+ old_password: string;
355
+ new_password: string;
356
+ }
357
+ export interface SudoRequest {
358
+ password?: string;
359
+ verification_token?: string;
360
+ }
361
+ export interface SudoResponse {
362
+ sudo_token?: string;
363
+ }
364
+ export interface WithSudoRequest {
365
+ sudo_token: string;
366
+ version?: string;
367
+ }
368
+ export interface ChangeBoundProviderRequest {
369
+ trans_token: string;
370
+ provider_id: string;
371
+ }
372
+ export interface ChangeBoundProviderResponse {
373
+ client_id: string;
374
+ }
375
+ export interface QueryUserProfileRequest {
376
+ id?: [string];
377
+ username?: string;
378
+ email?: string;
379
+ phone_number?: string;
380
+ }
381
+ export interface QueryUserProfileResponse {
382
+ total: number;
383
+ data?: [SimpleUserProfile];
384
+ }
385
+ export interface ResetPasswordRequest extends BaseRequest {
386
+ email?: string;
387
+ phone_number?: string;
388
+ new_password: string;
389
+ verification_token: string;
390
+ }
391
+ export interface DeviceAuthorizeRequest extends BaseRequest {
392
+ scope?: string;
393
+ }
394
+ export interface AuthorizeRequest extends BaseRequest {
395
+ response_type?: string;
396
+ redirect_uri?: string;
397
+ state?: string;
398
+ scope?: string;
399
+ code_challenge?: string;
400
+ code_challenge_method?: string;
401
+ sign_out_uri?: string;
402
+ }
403
+ export interface AuthorizeResponse {
404
+ code?: string;
405
+ access_token?: string;
406
+ id_token?: string;
407
+ token_type?: string;
408
+ scope?: string;
409
+ state?: string;
410
+ expires_in?: number;
411
+ }
412
+ export interface AuthorizeInfoRequest extends BaseRequest {
413
+ response_type?: string;
414
+ redirect_uri?: string;
415
+ state?: string;
416
+ scope?: string;
417
+ sign_out_uri?: string;
418
+ locale?: string;
419
+ }
420
+ export interface Scope {
421
+ id: string;
422
+ name: string;
423
+ description?: string;
424
+ picture?: string;
425
+ url?: string;
426
+ children?: Scope[];
427
+ }
428
+ export interface AuthorizeInfoResponse {
429
+ client: {
430
+ id: string;
431
+ name: string;
432
+ description?: string;
433
+ picture?: string;
434
+ url?: string;
435
+ };
436
+ scopes?: Scope[];
437
+ }
438
+ export interface RevokeDeviceRequest {
439
+ device_id: string;
440
+ }
441
+ export interface SignoutRequest {
442
+ redirect_uri?: string;
443
+ state?: string;
444
+ }
445
+ export interface SignoutResponse {
446
+ redirect_uri?: string;
447
+ }
448
+ export interface AuthorizeDeviceRequest extends BaseRequest {
449
+ user_code: string;
450
+ scope?: string;
451
+ state?: string;
452
+ }
453
+ export interface DeviceAuthorizeResponse {
454
+ device_code: string;
455
+ user_code?: string;
456
+ expires_in: number;
457
+ interval: number;
458
+ verification_uri?: string;
459
+ verification_uri_complete?: string;
460
+ }
461
+ export interface SimpleUserProfile {
462
+ sub: string;
463
+ name: string;
464
+ picture?: string;
465
+ gender?: string;
466
+ locale?: string;
467
+ email?: string;
468
+ phone_number?: string;
469
+ }
470
+ export interface CheckUsernameRequest {
471
+ username: string;
472
+ }
473
+ export interface CheckIfUserExistRequest {
474
+ username: string;
475
+ }
476
+ export interface CheckIfUserExistResponse {
477
+ exist: boolean;
478
+ }
479
+ export interface PublicKey {
480
+ public_key: string;
481
+ public_key_thumbprint: string;
482
+ }
483
+ export interface EncryptParams {
484
+ isEncrypt?: boolean;
485
+ public_key_thumbprint?: string;
486
+ params?: string;
487
+ }
488
+ export interface ProviderSubType {
489
+ id: string;
490
+ provider_sub_type: 'NO_AUTH_LOGIN' | '';
491
+ }
492
+ export interface GetMiniProgramQrCodeRequest {
493
+ envId: string;
494
+ wxAppId: string;
495
+ }
496
+ export interface GetMiniProgramQrCodeResponse {
497
+ qr_code: string;
498
+ qr_code_id: string;
499
+ expires_in: number;
500
+ }
501
+ export interface GetMiniProgramQrCodeStatusRequest {
502
+ qrCodeId: string;
503
+ envId: string;
504
+ wxAppId: string;
505
+ }
506
+ export interface GetMiniProgramQrCodeStatusResponse {
507
+ status: string;
508
+ provider_token: string;
509
+ expires_in: number;
510
+ }
511
+ export interface ModifyUserBasicInfoRequest {
512
+ user_id?: string;
513
+ nickname?: string;
514
+ username?: string;
515
+ description?: string;
516
+ avatar_url?: string;
517
+ gender?: 'MALE' | 'FEMALE';
518
+ password?: string;
519
+ new_password?: string;
520
+ email?: string;
521
+ phone?: string;
522
+ }
523
+ export interface GetUserBehaviorLog {
524
+ type: 'LOGIN' | 'MODIFY';
525
+ limit: number;
526
+ page_token?: string;
527
+ }
528
+ export interface GetUserBehaviorLogRes {
529
+ id: string;
530
+ ip: string;
531
+ user_agent: string;
532
+ client_id: string;
533
+ device_id: string;
534
+ created_at: string;
535
+ meta: {
536
+ from: string;
537
+ };
538
+ }
539
+ export interface ModifyPasswordWithoutLoginRequest {
540
+ username?: string;
541
+ password?: string;
542
+ new_password?: string;
543
+ }
544
+ export interface ToDefaultLoginPage {
545
+ config_version?: 'env' | string;
546
+ redirect_uri?: string;
547
+ app_id?: string;
548
+ query?: Record<string, any>;
549
+ }
550
+ export {};
@@ -0,0 +1,3 @@
1
+ import { CaptchaToken } from '@cloudbase/adapter-interface';
2
+ import { Auth } from '../auth/apis';
3
+ export declare const openURIWithCallback: (url: string, oauthInstance?: Auth) => Promise<CaptchaToken>;
@@ -0,0 +1,42 @@
1
+ import { SimpleStorage, RequestFunction } from '../oauth2client/interface';
2
+ import { AuthClientRequestOptions } from '../oauth2client/models';
3
+ import { SDKAdapterInterface } from '@cloudbase/adapter-interface';
4
+ import { Auth } from '../auth/apis';
5
+ export interface CaptchaOptions {
6
+ env: string;
7
+ clientId: string;
8
+ request: RequestFunction;
9
+ storage: SimpleStorage;
10
+ openURIWithCallback?: OpenURIWithCallbackFuction;
11
+ adapter?: SDKAdapterInterface & {
12
+ isMatch?: () => boolean;
13
+ };
14
+ oauthInstance?: Auth;
15
+ }
16
+ type OpenURIWithCallbackFuction = (url: string) => Promise<CaptchaToken>;
17
+ export interface CaptchaToken {
18
+ captcha_token: string;
19
+ expires_in: number;
20
+ expires_at?: Date | null;
21
+ }
22
+ export interface CaptchaRequestOptions extends AuthClientRequestOptions {
23
+ withCaptcha?: boolean;
24
+ }
25
+ export interface GetCaptchaResponse {
26
+ captcha_token?: string;
27
+ expires_in?: number;
28
+ url?: string;
29
+ }
30
+ export declare class Captcha {
31
+ private config;
32
+ private tokenSectionName;
33
+ constructor(opts: CaptchaOptions);
34
+ isMatch(): boolean;
35
+ request<T>(url: string, options?: CaptchaRequestOptions): Promise<T>;
36
+ private getDefaultOpenURIWithCallback;
37
+ private getCaptchaToken;
38
+ private appendCaptchaTokenToURL;
39
+ private saveCaptchaToken;
40
+ private findCaptchaToken;
41
+ }
42
+ export {};
@@ -0,0 +1,23 @@
1
+ import { OAuth2Client } from './oauth2client/oauth2client';
2
+ import { AuthOptions, Auth } from './auth/apis';
3
+ import { Credentials } from './oauth2client/models';
4
+ export { Auth } from './auth/apis';
5
+ export { AUTH_API_PREFIX, OAUTH_TYPE } from './auth/consts';
6
+ export { AuthError } from './auth/auth-error';
7
+ export * as authModels from './auth/models';
8
+ export type { ProviderProfile, UserInfo, ModifyUserBasicInfoRequest } from './auth/models';
9
+ export type { Credentials, OAuth2ClientOptions, ResponseError, AuthClientRequestOptions } from './oauth2client/models';
10
+ export type { AuthOptions } from './auth/apis';
11
+ export { weAppJwtDecodeAll } from './utils/base64';
12
+ export { LOGIN_STATE_CHANGED_TYPE, EVENTS, AUTH_STATE_CHANGED_TYPE } from './auth/consts';
13
+ export declare class CloudbaseOAuth {
14
+ oauth2client: OAuth2Client;
15
+ authApi: Auth;
16
+ private detectSessionInUrl;
17
+ constructor(authOptions: AuthOptions);
18
+ initializeSession(onUserObtained?: (data: {
19
+ session: Credentials;
20
+ user?: any;
21
+ type?: string;
22
+ }, error?: any) => void | Promise<void>): void;
23
+ }
package/dist/esm/index.js CHANGED
@@ -6,7 +6,7 @@ export { AUTH_API_PREFIX, OAUTH_TYPE } from './auth/consts';
6
6
  export { AuthError } from './auth/auth-error';
7
7
  import * as authModels_1 from './auth/models';
8
8
  export { authModels_1 as authModels };
9
- export { weappJwtDecodeAll } from './utils/base64';
9
+ export { weAppJwtDecodeAll } from './utils/base64';
10
10
  export { LOGIN_STATE_CHANGED_TYPE, EVENTS, AUTH_STATE_CHANGED_TYPE } from './auth/consts';
11
11
  export class CloudbaseOAuth {
12
12
  constructor(authOptions) {
@@ -0,0 +1,20 @@
1
+ export { ErrorType } from '../auth/consts';
2
+ export declare enum Syntax {
3
+ CLIENT_ID = "client_id",
4
+ CLIENT_SECRET = "client_secret",
5
+ RESPONSE_TYPE = "response_type",
6
+ SCOPE = "scope",
7
+ STATE = "state",
8
+ REDIRECT_URI = "redirect_uri",
9
+ ERROR = "error",
10
+ ERROR_DESCRIPTION = "error_description",
11
+ ERROR_URI = "error_uri",
12
+ GRANT_TYPE = "grant_type",
13
+ CODE = "code",
14
+ ACCESS_TOKEN = "access_token",
15
+ TOKEN_TYPE = "token_type",
16
+ EXPIRES_IN = "expires_in",
17
+ USERNAME = "username",
18
+ PASSWORD = "password",
19
+ REFRESH_TOKEN = "refresh_token"
20
+ }
@@ -0,0 +1,15 @@
1
+ import { Credentials, AuthClientRequestOptions } from './models';
2
+ export declare abstract class AuthClient {
3
+ abstract request: RequestFunction;
4
+ abstract setCredentials(credentials?: Credentials): Promise<void>;
5
+ abstract getAccessToken(): Promise<string>;
6
+ }
7
+ export type RequestFunction = <T>(url: string, options?: AuthClientRequestOptions) => Promise<T>;
8
+ export interface SimpleStorage {
9
+ getItem: (key: string) => Promise<string | null>;
10
+ removeItem: (key: string) => Promise<void>;
11
+ setItem: (key: string, value: string) => Promise<void>;
12
+ getItemSync: (key: string) => string | null;
13
+ removeItemSync: (key: string) => void;
14
+ setItemSync: (key: string, value: string) => void;
15
+ }