mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 13:00:39 +00:00
Enhance UserDecryptionOptions structure for mobile compatibility; add MasterPasswordUnlock interface
This commit is contained in:
@@ -85,6 +85,16 @@ export async function handleToken(request: Request, env: Env): Promise<Response>
|
|||||||
UserDecryptionOptions: {
|
UserDecryptionOptions: {
|
||||||
HasMasterPassword: true,
|
HasMasterPassword: true,
|
||||||
Object: 'userDecryptionOptions',
|
Object: 'userDecryptionOptions',
|
||||||
|
MasterPasswordUnlock: {
|
||||||
|
Kdf: {
|
||||||
|
KdfType: user.kdfType,
|
||||||
|
Iterations: user.kdfIterations,
|
||||||
|
Memory: user.kdfMemory || null,
|
||||||
|
Parallelism: user.kdfParallelism || null,
|
||||||
|
},
|
||||||
|
MasterKeyEncryptedUserKey: user.key,
|
||||||
|
Salt: email, // email is already lowercased above
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+21
-4
@@ -145,6 +145,26 @@ export interface JWTPayload {
|
|||||||
premium: boolean;
|
premium: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UserDecryptionOptions types for mobile client compatibility
|
||||||
|
export interface MasterPasswordUnlockKdf {
|
||||||
|
KdfType: number;
|
||||||
|
Iterations: number;
|
||||||
|
Memory: number | null;
|
||||||
|
Parallelism: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MasterPasswordUnlock {
|
||||||
|
Kdf: MasterPasswordUnlockKdf;
|
||||||
|
MasterKeyEncryptedUserKey: string;
|
||||||
|
Salt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UserDecryptionOptions {
|
||||||
|
HasMasterPassword: boolean;
|
||||||
|
Object: string;
|
||||||
|
MasterPasswordUnlock?: MasterPasswordUnlock;
|
||||||
|
}
|
||||||
|
|
||||||
// API Response types
|
// API Response types
|
||||||
export interface TokenResponse {
|
export interface TokenResponse {
|
||||||
access_token: string;
|
access_token: string;
|
||||||
@@ -161,10 +181,7 @@ export interface TokenResponse {
|
|||||||
ResetMasterPassword: boolean;
|
ResetMasterPassword: boolean;
|
||||||
scope: string;
|
scope: string;
|
||||||
unofficialServer: boolean;
|
unofficialServer: boolean;
|
||||||
UserDecryptionOptions: {
|
UserDecryptionOptions: UserDecryptionOptions;
|
||||||
HasMasterPassword: boolean;
|
|
||||||
Object: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProfileResponse {
|
export interface ProfileResponse {
|
||||||
|
|||||||
Reference in New Issue
Block a user