@cloudbase/auth 2.25.1 → 2.25.2
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/cjs/index.d.ts +72 -2
- package/dist/cjs/index.js +1600 -258
- package/dist/esm/index.d.ts +72 -2
- package/dist/esm/index.js +1601 -259
- package/dist/miniprogram/index.js +1 -1
- package/package.json +5 -5
- package/src/index.ts +1266 -4
- package/dist/cjs/sbaseApi.d.ts +0 -117
- package/dist/cjs/sbaseApi.js +0 -1529
- package/dist/esm/sbaseApi.d.ts +0 -117
- package/dist/esm/sbaseApi.js +0 -1525
- package/src/sbaseApi.ts +0 -1500
package/dist/cjs/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { ICloudbaseAuthConfig, IUser, IUserInfo, ILoginState } from '@cloud
|
|
|
5
5
|
import type { ProviderSubType } from '@cloudbase/oauth/dist/cjs/auth/models';
|
|
6
6
|
import type { authModels, AuthOptions, Credentials } from '@cloudbase/oauth';
|
|
7
7
|
import { CloudbaseOAuth } from '@cloudbase/oauth';
|
|
8
|
-
import {
|
|
8
|
+
import { CommonRes, DeleteMeReq, GetClaimsRes, GetUserIdentitiesRes, GetUserRes, LinkIdentityReq, LinkIdentityRes, OnAuthStateChangeCallback, ReauthenticateRes, ResendReq, ResendRes, ResetPasswordForEmailRes, ResetPasswordForOldReq, SetSessionReq, SignInAnonymouslyReq, SignInOAuthRes, SignInRes, SignInWithIdTokenReq, SignInWithOAuthReq, SignInWithOtpReq, SignInWithOtpRes, SignInWithPasswordReq, SignUpRes, UnlinkIdentityReq, UpdateUserReq, UpdateUserWithVerificationRes, VerifyOAuthReq, VerifyOtpReq } from './type';
|
|
9
9
|
export type { SignInRes, GetUserRes, CommonRes, SignInWithOtpRes, SignInOAuthRes, GetClaimsRes, ResetPasswordForEmailRes, GetUserIdentitiesRes, LinkIdentityRes, ReauthenticateRes, ResendRes, UpdateUserWithVerificationRes, OnAuthStateChangeCallback, SignInWithPasswordReq, SignInWithIdTokenReq, SignInWithOAuthReq, VerifyOAuthReq, VerifyOtpReq, LinkIdentityReq, UnlinkIdentityReq, UpdateUserReq, SignInWithOtpReq, ResetPasswordForOldReq, ResendReq, SetSessionReq, DeleteMeReq, SignUpRes, } from './type';
|
|
10
10
|
interface UserInfo {
|
|
11
11
|
uid?: string;
|
|
@@ -75,7 +75,12 @@ export declare class LoginState implements ILoginState {
|
|
|
75
75
|
checkLocalState(): void;
|
|
76
76
|
checkLocalStateAsync(): Promise<void>;
|
|
77
77
|
}
|
|
78
|
-
declare class Auth
|
|
78
|
+
declare class Auth {
|
|
79
|
+
readonly config: ICloudbaseAuthConfig;
|
|
80
|
+
oauthInstance: CloudbaseOAuth;
|
|
81
|
+
readonly cache: ICloudbaseCache;
|
|
82
|
+
private listeners;
|
|
83
|
+
private hasListenerSetUp;
|
|
79
84
|
constructor(config: ICloudbaseAuthConfig & {
|
|
80
85
|
cache: ICloudbaseCache;
|
|
81
86
|
request?: ICloudbaseRequest;
|
|
@@ -180,6 +185,71 @@ declare class Auth extends SbaseApi {
|
|
|
180
185
|
userInfo?: any;
|
|
181
186
|
}): Promise<LoginState>;
|
|
182
187
|
setAccessKey(): Promise<void>;
|
|
188
|
+
signInAnonymously(params: SignInAnonymouslyReq): Promise<SignInRes>;
|
|
189
|
+
signUp(params: authModels.SignUpRequest): Promise<SignUpRes>;
|
|
190
|
+
signOut(params?: authModels.SignoutRequest): Promise<void | authModels.SignoutReponse>;
|
|
191
|
+
onAuthStateChange(callback: OnAuthStateChangeCallback): {
|
|
192
|
+
data: {
|
|
193
|
+
subscription: {
|
|
194
|
+
id: string;
|
|
195
|
+
callback: OnAuthStateChangeCallback;
|
|
196
|
+
unsubscribe: () => void;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
signInWithPassword(params: SignInWithPasswordReq): Promise<SignInRes>;
|
|
201
|
+
signInWithIdToken(params: SignInWithIdTokenReq): Promise<SignInRes>;
|
|
202
|
+
signInWithOtp(params: SignInWithOtpReq): Promise<SignInWithOtpRes>;
|
|
203
|
+
verifyOAuth(params?: VerifyOAuthReq): Promise<SignInRes | LinkIdentityRes>;
|
|
204
|
+
signInWithOAuth(params: SignInWithOAuthReq): Promise<SignInOAuthRes>;
|
|
205
|
+
signInWithSSO(): Promise<void>;
|
|
206
|
+
signInWithWeb3(): Promise<void>;
|
|
207
|
+
getClaims(): Promise<GetClaimsRes>;
|
|
208
|
+
resetPasswordForEmail(emailOrPhone: string, options?: {
|
|
209
|
+
redirectTo?: string;
|
|
210
|
+
}): Promise<ResetPasswordForEmailRes>;
|
|
211
|
+
resetPasswordForOld(params: ResetPasswordForOldReq): Promise<{
|
|
212
|
+
data: {
|
|
213
|
+
user: import("./type").User;
|
|
214
|
+
session: import("./type").Session;
|
|
215
|
+
};
|
|
216
|
+
error: any;
|
|
217
|
+
} | {
|
|
218
|
+
data: {
|
|
219
|
+
user?: undefined;
|
|
220
|
+
session?: undefined;
|
|
221
|
+
};
|
|
222
|
+
error: any;
|
|
223
|
+
}>;
|
|
224
|
+
verifyOtp(params: VerifyOtpReq): Promise<SignInRes>;
|
|
225
|
+
getSession(): Promise<SignInRes>;
|
|
226
|
+
refreshSession(refresh_token?: string): Promise<SignInRes>;
|
|
227
|
+
getUser(): Promise<GetUserRes>;
|
|
228
|
+
refreshUser(): Promise<CommonRes>;
|
|
229
|
+
updateUser(params: UpdateUserReq): Promise<GetUserRes | UpdateUserWithVerificationRes>;
|
|
230
|
+
getUserIdentities(): Promise<GetUserIdentitiesRes>;
|
|
231
|
+
linkIdentity(params: LinkIdentityReq): Promise<LinkIdentityRes>;
|
|
232
|
+
unlinkIdentity(params: UnlinkIdentityReq): Promise<CommonRes>;
|
|
233
|
+
reauthenticate(): Promise<ReauthenticateRes>;
|
|
234
|
+
resend(params: ResendReq): Promise<ResendRes>;
|
|
235
|
+
setSession(params: SetSessionReq): Promise<SignInRes>;
|
|
236
|
+
exchangeCodeForSession(): Promise<void>;
|
|
237
|
+
deleteUser(params: DeleteMeReq): Promise<CommonRes>;
|
|
238
|
+
toDefaultLoginPage(params?: authModels.ToDefaultLoginPage): Promise<CommonRes>;
|
|
239
|
+
signInWithCustomTicket(getTickFn?: authModels.GetCustomSignTicketFn): Promise<SignInRes>;
|
|
240
|
+
signInWithOpenId({ useWxCloud }?: {
|
|
241
|
+
useWxCloud?: boolean;
|
|
242
|
+
}): Promise<SignInRes>;
|
|
243
|
+
signInWithPhoneAuth({ phoneCode }: {
|
|
244
|
+
phoneCode?: string;
|
|
245
|
+
}): Promise<SignInRes>;
|
|
246
|
+
private formatPhone;
|
|
247
|
+
private notifyListeners;
|
|
248
|
+
private setupListeners;
|
|
249
|
+
private convertToUser;
|
|
250
|
+
private validateParams;
|
|
251
|
+
private validateAtLeastOne;
|
|
252
|
+
private init;
|
|
183
253
|
}
|
|
184
254
|
type TInitAuthOptions = Pick<ICloudbaseAuthConfig, 'region' | 'persistence' | 'i18n' | 'accessKey' | 'useWxCloud'> & Partial<AuthOptions> & {
|
|
185
255
|
detectSessionInUrl?: boolean;
|