@cloudbase/auth 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.
@@ -1 +1,2 @@
1
+ import type { AuthOptions } from '@cloudbase/oauth';
1
2
  export declare const useAuthAdapter: (config: AuthOptions) => any;
@@ -1,10 +1,9 @@
1
1
  import type { ICloudbase, ICloudbaseConfig } from '@cloudbase/types';
2
2
  import type { ICloudbaseCache } from '@cloudbase/types/cache';
3
3
  import type { ICloudbaseRequest } from '@cloudbase/types/request';
4
- import type { ICloudbaseAuthConfig, IUser, IUserInfo, ILoginState } from '@cloudbase/types/auth';
5
- import type { ProviderSubType } from '@cloudbase/oauth/dist/cjs/auth/models';
6
- import type { authModels, AuthOptions, Credentials } from '@cloudbase/oauth';
7
- import { CloudbaseOAuth } from '@cloudbase/oauth';
4
+ import type { ICloudbaseAuthConfig, IUser, ILoginState } from '@cloudbase/types/auth';
5
+ import type { AuthOptions, Credentials } from '@cloudbase/oauth';
6
+ import { CloudbaseOAuth, AuthError, authModels } from '@cloudbase/oauth';
8
7
  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
8
  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
9
  interface UserInfo {
@@ -52,12 +51,12 @@ export declare class User implements IUser {
52
51
  checkLocalInfoAsync(): Promise<void>;
53
52
  update(userInfo: authModels.UserProfile): Promise<void>;
54
53
  updateUserBasicInfo(params: authModels.ModifyUserBasicInfoRequest): Promise<void>;
55
- updatePassword(newPassword: string, oldPassword: string): any;
54
+ updatePassword(newPassword: string, oldPassword: string): Promise<void>;
56
55
  updateUsername(username: string): Promise<void>;
57
56
  refresh(params?: {
58
57
  version?: string;
59
58
  query?: any;
60
- }): Promise<IUserInfo>;
59
+ }): Promise<authModels.UserInfo>;
61
60
  getLocalUserInfo(key?: string): string | boolean | Record<string, any>;
62
61
  setLocalUserInfo(userInfo: any): void;
63
62
  private getLocalUserInfoAsync;
@@ -86,9 +85,9 @@ declare class Auth {
86
85
  request?: ICloudbaseRequest;
87
86
  runtime?: string;
88
87
  });
89
- bindPhoneNumber(params: authModels.BindPhoneRequest): Promise<any>;
88
+ bindPhoneNumber(params: authModels.BindPhoneRequest): Promise<void>;
90
89
  unbindProvider(params: authModels.UnbindProviderRequest): Promise<void>;
91
- bindEmail(params: authModels.BindEmailRequest): any;
90
+ bindEmail(params: authModels.BindEmailRequest): Promise<void>;
92
91
  verify(params: authModels.VerifyRequest): Promise<authModels.VerifyResponse>;
93
92
  getVerification(params: authModels.GetVerificationRequest, options?: {
94
93
  withCaptcha: boolean;
@@ -131,7 +130,7 @@ declare class Auth {
131
130
  bindWithProvider(params: authModels.BindWithProviderRequest): Promise<void>;
132
131
  queryUser(queryObj: authModels.QueryUserProfileRequest): Promise<authModels.QueryUserProfileResponse>;
133
132
  getAccessToken(): Promise<{
134
- accessToken: any;
133
+ accessToken: string;
135
134
  env: string;
136
135
  }>;
137
136
  grantProviderToken(params: authModels.GrantProviderTokenRequest): Promise<authModels.GrantProviderTokenResponse>;
@@ -153,25 +152,28 @@ declare class Auth {
153
152
  }): Promise<Credentials>;
154
153
  getCredentials(): Promise<Credentials>;
155
154
  setCredentials(credentials: Credentials): Promise<void>;
156
- getProviderSubType(): Promise<ProviderSubType>;
155
+ getProviderSubType(): Promise<authModels.ProviderSubType>;
157
156
  createCaptchaData(params: {
158
157
  state: string;
159
158
  redirect_uri?: string;
160
- }): Promise<any>;
159
+ }): Promise<{
160
+ token: string;
161
+ data: string;
162
+ }>;
161
163
  verifyCaptchaData(params: {
162
164
  token: string;
163
165
  key: string;
164
- }): Promise<any>;
166
+ }): Promise<{
167
+ captcha_token: string;
168
+ expires_in: number;
169
+ }>;
165
170
  getMiniProgramQrCode(params: authModels.GetMiniProgramQrCodeRequest): Promise<authModels.GetMiniProgramQrCodeResponse>;
166
171
  getMiniProgramQrCodeStatus(params: authModels.GetMiniProgramQrCodeStatusRequest): Promise<authModels.GetMiniProgramQrCodeStatusResponse>;
167
172
  modifyPassword(params: authModels.ModifyUserBasicInfoRequest): Promise<void>;
168
173
  modifyPasswordWithoutLogin(params: authModels.ModifyPasswordWithoutLoginRequest): Promise<void>;
169
174
  getUserBehaviorLog(params: authModels.GetUserBehaviorLog): Promise<authModels.GetUserBehaviorLogRes>;
170
175
  signInWithUsername({ verificationInfo, verificationCode, username: rawUsername, bindInfo, loginType, }: {
171
- verificationInfo?: {
172
- verification_id: string;
173
- is_user: boolean;
174
- };
176
+ verificationInfo?: authModels.GetVerificationResponse;
175
177
  verificationCode?: string;
176
178
  username?: string;
177
179
  bindInfo?: any;
@@ -186,8 +188,13 @@ declare class Auth {
186
188
  }): Promise<LoginState>;
187
189
  setAccessKey(): Promise<void>;
188
190
  signInAnonymously(params: SignInAnonymouslyReq): Promise<SignInRes>;
189
- signUp(params: authModels.SignUpRequest): Promise<SignUpRes>;
190
- signOut(params?: authModels.SignoutRequest): Promise<void | authModels.SignoutReponse>;
191
+ signUp(params: authModels.SignUpRequest & {
192
+ phone?: string;
193
+ }): Promise<SignUpRes>;
194
+ signOut(params?: authModels.SignoutRequest): Promise<authModels.SignoutResponse & {
195
+ data: Object;
196
+ error: AuthError;
197
+ }>;
191
198
  onAuthStateChange(callback: OnAuthStateChangeCallback): {
192
199
  data: {
193
200
  subscription: {
@@ -202,8 +209,6 @@ declare class Auth {
202
209
  signInWithOtp(params: SignInWithOtpReq): Promise<SignInWithOtpRes>;
203
210
  verifyOAuth(params?: VerifyOAuthReq): Promise<SignInRes | LinkIdentityRes>;
204
211
  signInWithOAuth(params: SignInWithOAuthReq): Promise<SignInOAuthRes>;
205
- signInWithSSO(): Promise<void>;
206
- signInWithWeb3(): Promise<void>;
207
212
  getClaims(): Promise<GetClaimsRes>;
208
213
  resetPasswordForEmail(emailOrPhone: string, options?: {
209
214
  redirectTo?: string;
@@ -219,7 +224,7 @@ declare class Auth {
219
224
  user?: undefined;
220
225
  session?: undefined;
221
226
  };
222
- error: any;
227
+ error: AuthError;
223
228
  }>;
224
229
  verifyOtp(params: VerifyOtpReq): Promise<SignInRes>;
225
230
  getSession(): Promise<SignInRes>;
@@ -254,7 +259,9 @@ declare class Auth {
254
259
  type TInitAuthOptions = Pick<ICloudbaseAuthConfig, 'region' | 'persistence' | 'i18n' | 'accessKey' | 'useWxCloud'> & Partial<AuthOptions> & {
255
260
  detectSessionInUrl?: boolean;
256
261
  };
257
- export declare function generateAuthInstance(config: TInitAuthOptions, options?: {
262
+ export declare function generateAuthInstance(config: TInitAuthOptions & {
263
+ sdkVersion?: string;
264
+ }, options?: {
258
265
  clientId: ICloudbaseConfig['clientId'];
259
266
  env: ICloudbaseConfig['env'];
260
267
  apiOrigin: string;
@@ -265,7 +272,7 @@ export declare function generateAuthInstance(config: TInitAuthOptions, options?:
265
272
  detectSessionInUrl?: ICloudbaseAuthConfig['detectSessionInUrl'];
266
273
  }): {
267
274
  authInstance: Auth;
268
- oauthInstance: any;
275
+ oauthInstance: CloudbaseOAuth;
269
276
  };
270
277
  export { UserInfo, Auth };
271
278
  export declare function registerAuth(app: Pick<ICloudbase, 'registerComponent'>): void;