code refactor

This commit is contained in:
MaysWind
2025-01-14 00:14:07 +08:00
parent 593e123610
commit f4ea9a85f0
11 changed files with 73 additions and 73 deletions
+5 -5
View File
@@ -130,11 +130,11 @@ import { getTimezoneOffsetMinutes } from './datetime.ts';
import { generateRandomUUID } from './misc.ts';
interface ApiRequestConfig extends AxiosRequestConfig {
headers: AxiosRequestHeaders;
noAuth?: boolean;
ignoreBlocked?: boolean;
ignoreError?: boolean;
timeout?: number;
readonly headers: AxiosRequestHeaders;
readonly noAuth?: boolean;
readonly ignoreBlocked?: boolean;
readonly ignoreError?: boolean;
readonly timeout?: number;
}
export type ApiResponsePromise<T> = Promise<AxiosResponse<ApiResponse<T>>>;
+10 -10
View File
@@ -3,18 +3,18 @@ import uaParser from 'ua-parser-js';
import { TOKEN_CLI_USER_AGENT, type TokenInfoResponse, SessionInfo } from '@/models/token.ts';
interface UserAgentInfo {
device: {
vendor?: string;
model?: string;
type?: string;
readonly device: {
readonly vendor?: string;
readonly model?: string;
readonly type?: string;
};
os: {
name?: string;
version?: string;
readonly os: {
readonly name?: string;
readonly version?: string;
};
browser: {
name?: string;
version?: string;
readonly browser: {
readonly name?: string;
readonly version?: string;
};
}
+15 -15
View File
@@ -16,30 +16,30 @@ import {
import logger from './logger.ts';
interface ClientData {
challenge: string;
crossOrigin: boolean;
origin: string;
type: string;
readonly challenge: string;
readonly crossOrigin: boolean;
readonly origin: string;
readonly type: string;
}
interface AttestationData {
authData: Uint8Array;
fmt: string;
readonly authData: Uint8Array;
readonly fmt: string;
}
interface WebAuthnRegisterResponse {
id: string | null;
clientData: ClientData;
publicKey: Uint8Array | null;
rawCredential: Credential;
readonly id: string | null;
readonly clientData: ClientData;
readonly publicKey: Uint8Array | null;
readonly rawCredential: Credential;
}
interface WebAuthnVerifyResponse {
id: string | null;
userName: string;
userSecret: string;
clientData: ClientData;
rawCredential: Credential;
readonly id: string | null;
readonly userName: string;
readonly userSecret: string;
readonly clientData: ClientData;
readonly rawCredential: Credential;
}
const PUBLIC_KEY_CREDENTIAL_CREATION_OPTIONS_BASE_TEMPLATE = {