@cloudbase/oauth 1.2.1-beta → 2.0.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.
- package/.eslintignore +2 -0
- package/.eslintrc +26 -0
- package/CHANGELOG.md +30 -0
- package/Dockerfile +15 -0
- package/README.md +183 -0
- package/_exmaple/assets/scripts/function/function.ts +99 -0
- package/_exmaple/assets/scripts/index.ts +101 -0
- package/_exmaple/assets/scripts/request.ts +11 -0
- package/_exmaple/index.html +15 -0
- package/_exmaple/package.json +33 -0
- package/_exmaple/tsconfig.json +71 -0
- package/_exmaple/typings.d.ts +0 -0
- package/_exmaple/webpack.config.js +42 -0
- package/dist/cjs/auth/apis.d.ts +55 -0
- package/dist/cjs/auth/apis.js +568 -0
- package/{auth → dist/cjs/auth}/consts.d.ts +9 -21
- package/dist/cjs/auth/consts.js +61 -0
- package/dist/cjs/auth/models.d.ts +354 -0
- package/dist/cjs/auth/models.js +3 -0
- package/dist/cjs/captcha/captcha.d.ts +35 -0
- package/dist/cjs/captcha/captcha.js +267 -0
- package/dist/cjs/index.d.ts +14 -0
- package/dist/cjs/index.js +63 -0
- package/{oauthclient → dist/cjs/oauth2client}/consts.d.ts +22 -1
- package/dist/cjs/oauth2client/consts.js +73 -0
- package/dist/cjs/oauth2client/interface.d.ts +15 -0
- package/dist/cjs/oauth2client/interface.js +10 -0
- package/dist/cjs/oauth2client/models.d.ts +47 -0
- package/dist/cjs/oauth2client/models.js +3 -0
- package/dist/cjs/oauth2client/oauth2client.d.ts +71 -0
- package/dist/cjs/oauth2client/oauth2client.js +640 -0
- package/dist/cjs/utils/function/single-promise.d.ts +5 -0
- package/dist/cjs/utils/function/single-promise.js +89 -0
- package/dist/cjs/utils/uuid.d.ts +1 -0
- package/dist/cjs/utils/uuid.js +12 -0
- package/dist/esm/auth/apis.d.ts +55 -0
- package/dist/esm/auth/apis.js +566 -0
- package/dist/esm/auth/consts.d.ts +54 -0
- package/dist/esm/auth/consts.js +58 -0
- package/dist/esm/auth/models.d.ts +354 -0
- package/dist/esm/auth/models.js +1 -0
- package/dist/esm/captcha/captcha.d.ts +35 -0
- package/dist/esm/captcha/captcha.js +264 -0
- package/dist/esm/index.d.ts +14 -0
- package/dist/esm/index.js +32 -0
- package/dist/esm/oauth2client/consts.d.ts +67 -0
- package/dist/esm/oauth2client/consts.js +70 -0
- package/dist/esm/oauth2client/interface.d.ts +15 -0
- package/dist/esm/oauth2client/interface.js +7 -0
- package/dist/esm/oauth2client/models.d.ts +47 -0
- package/dist/esm/oauth2client/models.js +1 -0
- package/dist/esm/oauth2client/oauth2client.d.ts +71 -0
- package/dist/esm/oauth2client/oauth2client.js +636 -0
- package/dist/esm/utils/function/single-promise.d.ts +5 -0
- package/dist/esm/utils/function/single-promise.js +86 -0
- package/dist/esm/utils/uuid.d.ts +1 -0
- package/dist/esm/utils/uuid.js +8 -0
- package/package.json +27 -14
- package/publish.sh +2 -0
- package/src/auth/apis.ts +642 -0
- package/src/auth/consts.ts +57 -0
- package/src/auth/models.ts +444 -0
- package/src/captcha/captcha.ts +222 -0
- package/src/index.ts +49 -0
- package/src/oauth2client/consts.ts +69 -0
- package/src/oauth2client/interface.ts +57 -0
- package/src/oauth2client/models.ts +61 -0
- package/src/oauth2client/oauth2client.ts +620 -0
- package/src/utils/function/single-promise.ts +40 -0
- package/src/utils/uuid.ts +11 -0
- package/tsconfig.esm.json +44 -0
- package/tsconfig.json +44 -0
- package/wiki/README.md +75 -0
- package/app/index.d.ts +0 -29
- package/app/index.js +0 -50
- package/app/index.js.map +0 -1
- package/app/internal.d.ts +0 -12
- package/app/internal.js +0 -25
- package/app/internal.js.map +0 -1
- package/app/openuri.d.ts +0 -20
- package/app/openuri.js +0 -106
- package/app/openuri.js.map +0 -1
- package/app/request.d.ts +0 -19
- package/app/request.js +0 -52
- package/app/request.js.map +0 -1
- package/app/storage.d.ts +0 -41
- package/app/storage.js +0 -35
- package/app/storage.js.map +0 -1
- package/auth/consts.js +0 -79
- package/auth/consts.js.map +0 -1
- package/auth/index.d.ts +0 -242
- package/auth/index.js +0 -550
- package/auth/index.js.map +0 -1
- package/auth/models.d.ts +0 -284
- package/auth/models.js +0 -4
- package/auth/models.js.map +0 -1
- package/captcha/index.d.ts +0 -45
- package/captcha/index.js +0 -135
- package/captcha/index.js.map +0 -1
- package/function/index.d.ts +0 -38
- package/function/index.js +0 -80
- package/function/index.js.map +0 -1
- package/index.d.ts +0 -8
- package/index.js +0 -17
- package/index.js.map +0 -1
- package/oauthclient/consts.js +0 -53
- package/oauthclient/consts.js.map +0 -1
- package/oauthclient/index.d.ts +0 -18
- package/oauthclient/index.js +0 -21
- package/oauthclient/index.js.map +0 -1
- package/oauthclient/interface.d.ts +0 -29
- package/oauthclient/interface.js +0 -10
- package/oauthclient/interface.js.map +0 -1
- package/oauthclient/models.d.ts +0 -40
- package/oauthclient/models.js +0 -3
- package/oauthclient/models.js.map +0 -1
- package/oauthclient/oauthclient.d.ts +0 -146
- package/oauthclient/oauthclient.js +0 -414
- package/oauthclient/oauthclient.js.map +0 -1
- package/utils/promise.d.ts +0 -18
- package/utils/promise.js +0 -48
- package/utils/promise.js.map +0 -1
- package/utils/uuid.d.ts +0 -5
- package/utils/uuid.js +0 -16
- package/utils/uuid.js.map +0 -1
package/auth/index.d.ts
DELETED
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import { UserProfile, SignInRequest, SignUpRequest, VerifyRequest, VerifyResponse, GenProviderRedirectUriRequest, GenProviderRedirectUriResponse, GrantProviderTokenRequest, GrantProviderTokenResponse, PatchProviderTokenRequest, PatchProviderTokenResponse, SignInWithProviderRequest, BindWithProviderRequest, TransByProviderRequest, GrantTokenRequest, UnbindProviderRequest, CheckPasswordRequest, SetPasswordRequest, ChangeBoundProviderRequest, ChangeBoundProviderResponse, QueryUserProfileRequest, UpdatePasswordRequest, SudoRequest, SudoResponse, QueryUserProfileResponse, EditContactRequest, CheckIfUserExistResponse, CheckIfUserExistRequest, SendVerificationCodeRequest, SendVerificationCodeResponse, ResetPasswordRequest, AuthorizeRequest, AuthorizeResponse, AuthorizeInfoRequest, AuthorizeInfoResponse, RevokeDeviceRequest, WithSudoRequest, AuthorizeDeviceRequest, DeviceAuthorizeRequest, DeviceAuthorizeResponse, ProvidersResponse } from './models';
|
|
2
|
-
import { Credentials, AuthClient } from '../oauthclient';
|
|
3
|
-
import { Captcha } from '../captcha';
|
|
4
|
-
import { App, RequestFn as appRequestFn } from "../app";
|
|
5
|
-
export { ErrorType, VerificationUsages, DeviceAuthorizeState } from './consts';
|
|
6
|
-
export { ResponseError } from '../oauthclient';
|
|
7
|
-
export interface AuthOptions {
|
|
8
|
-
credentialsClient: AuthClient;
|
|
9
|
-
captcha: Captcha;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Returns the existing `Auth` instance that is associated with the app
|
|
13
|
-
*/
|
|
14
|
-
export declare function getAuth(app: App, initOptions?: any): Auth;
|
|
15
|
-
export declare type GetCustomSignTicketFn = () => Promise<string>;
|
|
16
|
-
/**
|
|
17
|
-
* Auth
|
|
18
|
-
*/
|
|
19
|
-
export declare class Auth {
|
|
20
|
-
readonly request: appRequestFn;
|
|
21
|
-
readonly credentialsClient: AuthClient;
|
|
22
|
-
private _getCustomSignTicketFn?;
|
|
23
|
-
/**
|
|
24
|
-
* constructor
|
|
25
|
-
* @param {AuthOptions} opts
|
|
26
|
-
*/
|
|
27
|
-
constructor(opts: AuthOptions);
|
|
28
|
-
/**
|
|
29
|
-
* Sign in.
|
|
30
|
-
* @param {SignInRequest} params A SignInRequest Object.
|
|
31
|
-
* @return {Promise<Credentials>} A Promise<Credentials> object.
|
|
32
|
-
*/
|
|
33
|
-
signIn(params: SignInRequest): Promise<Credentials>;
|
|
34
|
-
/**
|
|
35
|
-
* Sign in Anonymously
|
|
36
|
-
* @return {Promise<Credentials>} A Promise<Credentials> object.
|
|
37
|
-
*/
|
|
38
|
-
signInAnonymously(): Promise<Credentials>;
|
|
39
|
-
/**
|
|
40
|
-
* Sign up.
|
|
41
|
-
* @param {SignUpRequest} params A SignUpRequest Object.
|
|
42
|
-
* @return {Promise<Credentials>} A Promise<Credentials> object.
|
|
43
|
-
*/
|
|
44
|
-
signUp(params: SignUpRequest): Promise<Credentials>;
|
|
45
|
-
/**
|
|
46
|
-
* Sign out.
|
|
47
|
-
* @return {Object} A Promise<void> object.
|
|
48
|
-
*/
|
|
49
|
-
signOut(): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Revoke All Devices
|
|
52
|
-
* @return {Object} A Promise<void> object.
|
|
53
|
-
*/
|
|
54
|
-
revokeAllDevices(): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* Revoke Device
|
|
57
|
-
* @return {Object} A Promise<void> object.
|
|
58
|
-
*/
|
|
59
|
-
revokeDevice(params: RevokeDeviceRequest): Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Send the VerificationCode.
|
|
62
|
-
* @param {SendVerificationCodeRequest} params A GetVerificationRequest Object.
|
|
63
|
-
* @return {Promise<SendVerificationCodeResponse>} A Promise<GetVerificationResponse> object.
|
|
64
|
-
*/
|
|
65
|
-
sendVerificationCode(params: SendVerificationCodeRequest): Promise<SendVerificationCodeResponse>;
|
|
66
|
-
/**
|
|
67
|
-
* Verify the code
|
|
68
|
-
* @param {VerifyRequest} params A VerifyRequest Object.
|
|
69
|
-
* @return {Promise<VerifyResponse>} A Promise<VerifyResponse> object.
|
|
70
|
-
*/
|
|
71
|
-
verify(params: VerifyRequest): Promise<VerifyResponse>;
|
|
72
|
-
/**
|
|
73
|
-
* Reset Password
|
|
74
|
-
* @param params A ResetPasswordRequest Object
|
|
75
|
-
*/
|
|
76
|
-
resetPassword(params: ResetPasswordRequest): Promise<void>;
|
|
77
|
-
/**
|
|
78
|
-
* Gen provider redirect uri.
|
|
79
|
-
* @param {GenProviderRedirectUriRequest} params A GenProviderRedirectUriRequest object.
|
|
80
|
-
* @return {Promise<GenProviderRedirectUriResponse>} A Promise<GenProviderRedirectUriResponse> object.
|
|
81
|
-
*/
|
|
82
|
-
genProviderRedirectUri(params: GenProviderRedirectUriRequest): Promise<GenProviderRedirectUriResponse>;
|
|
83
|
-
/**
|
|
84
|
-
* Grant provider token.
|
|
85
|
-
* @param {GrantProviderTokenRequest} params A GrantProviderTokenRequest object.
|
|
86
|
-
* @return {Promise<GrantProviderTokenResponse>} A Promise<GrantProviderTokenResponse> object.
|
|
87
|
-
*/
|
|
88
|
-
grantProviderToken(params: GrantProviderTokenRequest): Promise<GrantProviderTokenResponse>;
|
|
89
|
-
/**
|
|
90
|
-
* Grant provider token.
|
|
91
|
-
* @param {PatchProviderTokenRequest} params A PatchProviderTokenRequest object.
|
|
92
|
-
* @return {Promise<PatchProviderTokenResponse>} A Promise<PatchProviderTokenResponse> object.
|
|
93
|
-
*/
|
|
94
|
-
patchProviderToken(params: PatchProviderTokenRequest): Promise<PatchProviderTokenResponse>;
|
|
95
|
-
/**
|
|
96
|
-
* Signin with provider request.
|
|
97
|
-
* @param {SignInWithProviderRequest} params A SignInWithProviderRequest object.
|
|
98
|
-
* @return {Promise<Credentials>} A Promise<Credentials> object.
|
|
99
|
-
*/
|
|
100
|
-
signInWithProvider(params: SignInWithProviderRequest): Promise<Credentials>;
|
|
101
|
-
/**
|
|
102
|
-
* Bind with provider
|
|
103
|
-
* @param {BindWithProviderRequest} params A BindWithProviderRequest object.
|
|
104
|
-
* @return {Promise<void>} A Promise<void> object.
|
|
105
|
-
*/
|
|
106
|
-
bindWithProvider(params: BindWithProviderRequest): Promise<void>;
|
|
107
|
-
/**
|
|
108
|
-
* Get the user profile.
|
|
109
|
-
* @return {Promise<UserProfile>} A Promise<UserProfile> object.
|
|
110
|
-
*/
|
|
111
|
-
getUserProfile(): Promise<UserProfile>;
|
|
112
|
-
/**
|
|
113
|
-
* Get the user profile.
|
|
114
|
-
* @return {Promise<UserProfile>} A Promise<UserProfile> object.
|
|
115
|
-
*/
|
|
116
|
-
updateUserProfile(params: UserProfile): Promise<UserProfile>;
|
|
117
|
-
/**
|
|
118
|
-
* hasLoginState check if has login state
|
|
119
|
-
* @return {Promise<boolean>} A Promise<boolean> object.
|
|
120
|
-
*/
|
|
121
|
-
hasLoginState(): Promise<boolean>;
|
|
122
|
-
/**
|
|
123
|
-
* loginScope return scope of current token
|
|
124
|
-
* @return {Promise<string>} A Promise<string> object.
|
|
125
|
-
*/
|
|
126
|
-
loginScope(): Promise<string>;
|
|
127
|
-
/**
|
|
128
|
-
* Trans by provider.
|
|
129
|
-
* @param {TransByProviderRequest} params A TransByProviderRequest object.
|
|
130
|
-
* @return {Promise<Credentials>} A Promise<Credentials> object.
|
|
131
|
-
*/
|
|
132
|
-
transByProvider(params: TransByProviderRequest): Promise<Credentials>;
|
|
133
|
-
/**
|
|
134
|
-
* Grant token.
|
|
135
|
-
* @param {GrantTokenRequest} params A GrantTokenRequest object.
|
|
136
|
-
* @return {Promise<Credentials>} A Promise<Credentials> object.
|
|
137
|
-
*/
|
|
138
|
-
grantToken(params: GrantTokenRequest): Promise<Credentials>;
|
|
139
|
-
/**
|
|
140
|
-
* Get the provide list.
|
|
141
|
-
* @return {Promise<ProvidersResponse>} A Promise<UserProfileProviderList> object.
|
|
142
|
-
*/
|
|
143
|
-
getProviders(): Promise<ProvidersResponse>;
|
|
144
|
-
/**
|
|
145
|
-
* check if username is exist
|
|
146
|
-
* @param params CheckIfUserExistRequest
|
|
147
|
-
*/
|
|
148
|
-
checkIfUserExist(params: CheckIfUserExistRequest): Promise<CheckIfUserExistResponse>;
|
|
149
|
-
/**
|
|
150
|
-
* unbind provider.
|
|
151
|
-
* @param {UnbindProviderRequest} params
|
|
152
|
-
* @return {Promise<void>}
|
|
153
|
-
*/
|
|
154
|
-
unbindProvider(params: UnbindProviderRequest): Promise<void>;
|
|
155
|
-
/**
|
|
156
|
-
* check Password.
|
|
157
|
-
* @param {CheckPasswordRequest} params
|
|
158
|
-
* @return {Promise<void>}
|
|
159
|
-
*/
|
|
160
|
-
checkPassword(params: CheckPasswordRequest): Promise<void>;
|
|
161
|
-
/**
|
|
162
|
-
* Edit Contact 修改 手机号 或 邮箱
|
|
163
|
-
* @param {EditContactRequest} params
|
|
164
|
-
* @return {Promise<void>}
|
|
165
|
-
*/
|
|
166
|
-
editContact(params: EditContactRequest): Promise<void>;
|
|
167
|
-
/**
|
|
168
|
-
* Set Password.
|
|
169
|
-
* @param {SetPasswordRequest} params
|
|
170
|
-
* @return {Promise<void>}
|
|
171
|
-
*/
|
|
172
|
-
setPassword(params: SetPasswordRequest): Promise<void>;
|
|
173
|
-
/**
|
|
174
|
-
* updatePasswordByOld 使用旧密码修改密码,如果已经绑定手机号,请先:sudo,再修改密码
|
|
175
|
-
* @param {UpdatePasswordRequest} params
|
|
176
|
-
* @return {Promise<void>}
|
|
177
|
-
*/
|
|
178
|
-
updatePasswordByOld(params: UpdatePasswordRequest): Promise<void>;
|
|
179
|
-
/**
|
|
180
|
-
* sudo
|
|
181
|
-
* @param {sudo} params
|
|
182
|
-
* @return {Promise<SudoResponse>}
|
|
183
|
-
*/
|
|
184
|
-
sudo(params: SudoRequest): Promise<SudoResponse>;
|
|
185
|
-
/**
|
|
186
|
-
* Get the current user verification.
|
|
187
|
-
* @param {SendVerificationCodeRequest} params A SendVerificationCodeToCurrentUser Object.
|
|
188
|
-
* @return {Promise<SendVerificationCodeResponse>} A Promise<SendVerificationCodeResponse> object.
|
|
189
|
-
*/
|
|
190
|
-
SendVerificationCodeToCurrentUser(params: SendVerificationCodeRequest): Promise<SendVerificationCodeResponse>;
|
|
191
|
-
/**
|
|
192
|
-
* change Bound provider.
|
|
193
|
-
* @param {ChangeBoundProviderRequest} params A GetVerificationRequest Object.
|
|
194
|
-
* @return {Promise<ChangeBoundProviderResponse>} A Promise<GetVerificationResponse> object.
|
|
195
|
-
*/
|
|
196
|
-
changeBoundProvider(params: ChangeBoundProviderRequest): Promise<ChangeBoundProviderResponse>;
|
|
197
|
-
/**
|
|
198
|
-
* set the user profile.
|
|
199
|
-
* @param {UserProfile} params A UserProfile Object.
|
|
200
|
-
* @return {Promise<UserProfile>} A Promise<UserProfile> object.
|
|
201
|
-
*/
|
|
202
|
-
setUserProfile(params: UserProfile): Promise<UserProfile>;
|
|
203
|
-
/**
|
|
204
|
-
* Delete me
|
|
205
|
-
* @param params
|
|
206
|
-
*/
|
|
207
|
-
deleteMe(params: WithSudoRequest): Promise<UserProfile>;
|
|
208
|
-
/**
|
|
209
|
-
* setCustomSignFunc set the get ticket function
|
|
210
|
-
* @param getTickFn
|
|
211
|
-
*/
|
|
212
|
-
setCustomSignFunc(getTickFn: GetCustomSignTicketFn): void;
|
|
213
|
-
/**
|
|
214
|
-
* SignInWithCustomTicket custom signIn
|
|
215
|
-
* @constructor
|
|
216
|
-
*/
|
|
217
|
-
SignInWithCustomTicket(): Promise<Credentials>;
|
|
218
|
-
/**
|
|
219
|
-
* queryUserProfile query user profile
|
|
220
|
-
* @param params queryUserProfile query user profile
|
|
221
|
-
*/
|
|
222
|
-
queryUserProfile(params: QueryUserProfileRequest): Promise<QueryUserProfileResponse>;
|
|
223
|
-
/**
|
|
224
|
-
* Authorize oauth Authorize
|
|
225
|
-
* @param params
|
|
226
|
-
* @constructor
|
|
227
|
-
*/
|
|
228
|
-
authorize(params: AuthorizeRequest): Promise<AuthorizeResponse>;
|
|
229
|
-
/**
|
|
230
|
-
* authorize device
|
|
231
|
-
* @param params
|
|
232
|
-
*/
|
|
233
|
-
authorizeDevice(params: AuthorizeDeviceRequest): Promise<void>;
|
|
234
|
-
deviceAuthorize(params: DeviceAuthorizeRequest): Promise<DeviceAuthorizeResponse>;
|
|
235
|
-
/**
|
|
236
|
-
* OAuth get authorize info
|
|
237
|
-
* @param params
|
|
238
|
-
* @constructor
|
|
239
|
-
*/
|
|
240
|
-
authorizeInfo(params: AuthorizeInfoRequest): Promise<AuthorizeInfoResponse>;
|
|
241
|
-
private static parseParamsToSearch;
|
|
242
|
-
}
|