237 lines
4.5 KiB
TypeScript
237 lines
4.5 KiB
TypeScript
export type AuthBindingStatus = 'active' | 'pending_bind_phone';
|
|
export type AuthLoginMethod = 'password' | 'phone' | 'wechat';
|
|
|
|
export type AuthUser = {
|
|
id: string;
|
|
publicUserCode: string;
|
|
username: string;
|
|
displayName: string;
|
|
avatarUrl: string | null;
|
|
phoneNumberMasked: string | null;
|
|
loginMethod: AuthLoginMethod;
|
|
bindingStatus: AuthBindingStatus;
|
|
wechatBound: boolean;
|
|
createdAt: string;
|
|
};
|
|
|
|
export type PublicUserSummary = {
|
|
id: string;
|
|
publicUserCode: string;
|
|
displayName: string;
|
|
avatarUrl: string | null;
|
|
};
|
|
|
|
export type PublicUserSearchResponse = {
|
|
user: PublicUserSummary;
|
|
};
|
|
|
|
export type AuthEntryRequest = {
|
|
phone: string;
|
|
password: string;
|
|
};
|
|
|
|
export type AuthEntryResponse = {
|
|
token: string;
|
|
user: AuthUser;
|
|
};
|
|
|
|
export type AuthPasswordChangeRequest = {
|
|
currentPassword?: string;
|
|
newPassword: string;
|
|
};
|
|
|
|
export type AuthPasswordChangeResponse = {
|
|
user: AuthUser;
|
|
};
|
|
|
|
export type AuthProfileUpdateRequest = {
|
|
displayName?: string;
|
|
avatarDataUrl?: string;
|
|
};
|
|
|
|
export type AuthProfileUpdateResponse = {
|
|
user: AuthUser;
|
|
};
|
|
|
|
export type AuthPasswordResetRequest = {
|
|
phone: string;
|
|
code: string;
|
|
newPassword: string;
|
|
};
|
|
|
|
export type AuthPasswordResetResponse = {
|
|
token: string;
|
|
user: AuthUser;
|
|
};
|
|
|
|
export type AuthPhoneSendCodeRequest = {
|
|
phone: string;
|
|
scene?: 'login' | 'bind_phone' | 'change_phone' | 'reset_password';
|
|
captchaChallengeId?: string;
|
|
captchaAnswer?: string;
|
|
};
|
|
|
|
export type AuthPhoneSendCodeResponse = {
|
|
ok: true;
|
|
cooldownSeconds: number;
|
|
expiresInSeconds: number;
|
|
providerRequestId: string | null;
|
|
};
|
|
|
|
export type AuthPhoneLoginRequest = {
|
|
phone: string;
|
|
code: string;
|
|
inviteCode?: string;
|
|
};
|
|
|
|
export type AuthPhoneLoginResponse = {
|
|
token: string;
|
|
user: AuthUser;
|
|
created: boolean;
|
|
referral: AuthPhoneLoginReferral | null;
|
|
};
|
|
|
|
export type AuthPhoneLoginReferral = {
|
|
ok: boolean;
|
|
message: string | null;
|
|
inviteeRewardGranted: boolean;
|
|
inviterRewardGranted: boolean;
|
|
inviteeBalanceAfter: number | null;
|
|
inviterBalanceAfter: number | null;
|
|
};
|
|
|
|
export type AuthMeResponse = {
|
|
user: AuthUser | null;
|
|
availableLoginMethods: AuthLoginMethod[];
|
|
};
|
|
|
|
export type AuthLoginOptionsResponse = {
|
|
availableLoginMethods: AuthLoginMethod[];
|
|
};
|
|
|
|
export type AuthWechatStartResponse = {
|
|
authorizationUrl: string;
|
|
};
|
|
|
|
export type AuthWechatBindPhoneRequest = {
|
|
phone?: string;
|
|
code?: string;
|
|
wechatPhoneCode?: string;
|
|
};
|
|
|
|
export type AuthWechatBindPhoneResponse = {
|
|
token: string;
|
|
user: AuthUser;
|
|
};
|
|
|
|
export type AuthWechatMiniProgramLoginRequest = {
|
|
code: string;
|
|
};
|
|
|
|
export type AuthWechatMiniProgramLoginResponse = {
|
|
token: string;
|
|
bindingStatus: AuthBindingStatus;
|
|
user: AuthUser;
|
|
};
|
|
|
|
export type AuthPhoneChangeRequest = {
|
|
phone: string;
|
|
code: string;
|
|
};
|
|
|
|
export type AuthPhoneChangeResponse = {
|
|
user: AuthUser;
|
|
};
|
|
|
|
export type AuthRefreshResponse = {
|
|
ok: true;
|
|
token?: string;
|
|
};
|
|
|
|
export type AuthSessionSummary = {
|
|
sessionId: string;
|
|
sessionIds: string[];
|
|
sessionCount: number;
|
|
clientType: string;
|
|
clientRuntime: string;
|
|
clientPlatform: string;
|
|
clientLabel: string;
|
|
deviceDisplayName: string;
|
|
miniProgramAppId: string | null;
|
|
miniProgramEnv: string | null;
|
|
userAgent: string | null;
|
|
ipMasked: string | null;
|
|
isCurrent: boolean;
|
|
createdAt: string;
|
|
lastSeenAt: string;
|
|
expiresAt: string;
|
|
};
|
|
|
|
export type AuthSessionsResponse = {
|
|
sessions: AuthSessionSummary[];
|
|
};
|
|
|
|
export type AuthLogoutAllResponse = {
|
|
ok: true;
|
|
};
|
|
|
|
export type AuthRevokeSessionResponse = {
|
|
ok: true;
|
|
};
|
|
|
|
export type AuthAuditLogEventType =
|
|
| 'password_login'
|
|
| 'phone_login'
|
|
| 'wechat_login'
|
|
| 'wechat_bind_phone'
|
|
| 'change_phone'
|
|
| 'captcha_required'
|
|
| 'logout'
|
|
| 'logout_all'
|
|
| 'revoke_session'
|
|
| 'risk_block_phone'
|
|
| 'risk_block_ip'
|
|
| 'risk_unblock_phone'
|
|
| 'risk_unblock_ip';
|
|
|
|
export type AuthAuditLogEntry = {
|
|
id: string;
|
|
eventType: AuthAuditLogEventType;
|
|
title: string;
|
|
detail: string;
|
|
ipMasked: string | null;
|
|
userAgent: string | null;
|
|
createdAt: string;
|
|
};
|
|
|
|
export type AuthAuditLogsResponse = {
|
|
logs: AuthAuditLogEntry[];
|
|
};
|
|
|
|
export type AuthCaptchaChallenge = {
|
|
challengeId: string;
|
|
promptText: string;
|
|
imageDataUrl: string;
|
|
expiresInSeconds: number;
|
|
};
|
|
|
|
export type AuthRiskBlockSummary = {
|
|
scopeType: 'phone' | 'ip';
|
|
title: string;
|
|
detail: string;
|
|
expiresAt: string;
|
|
remainingSeconds: number;
|
|
};
|
|
|
|
export type AuthRiskBlocksResponse = {
|
|
blocks: AuthRiskBlockSummary[];
|
|
};
|
|
|
|
export type AuthLiftRiskBlockResponse = {
|
|
ok: true;
|
|
};
|
|
|
|
export type LogoutResponse = {
|
|
ok: true;
|
|
};
|