File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
auth/src/common/services/login-strategies
common/src/auth/models/response Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,7 @@ export class LoginStrategyService implements LoginStrategyServiceAbstraction {
247247 async makePreloginKey ( masterPassword : string , email : string ) : Promise < MasterKey > {
248248 email = email . trim ( ) . toLowerCase ( ) ;
249249 let kdfConfig : KdfConfig = null ;
250+ let salt : string | undefined = undefined ;
250251 try {
251252 const preloginResponse = await this . apiService . postPrelogin ( new PreloginRequest ( email ) ) ;
252253 if ( preloginResponse != null ) {
@@ -258,6 +259,7 @@ export class LoginStrategyService implements LoginStrategyServiceAbstraction {
258259 preloginResponse . kdfMemory ,
259260 preloginResponse . kdfParallelism ,
260261 ) ;
262+ salt = preloginResponse . salt ;
261263 }
262264 } catch ( e ) {
263265 if ( e == null || e . statusCode !== 404 ) {
@@ -267,7 +269,8 @@ export class LoginStrategyService implements LoginStrategyServiceAbstraction {
267269
268270 kdfConfig . validateKdfConfigForPrelogin ( ) ;
269271
270- return await this . keyService . makeMasterKey ( masterPassword , email , kdfConfig ) ;
272+ // Cozy customization; used salt from backend
273+ return await this . keyService . makeMasterKey ( masterPassword , salt , kdfConfig ) ;
271274 }
272275
273276 private async clearCache ( ) : Promise < void > {
Original file line number Diff line number Diff line change @@ -6,12 +6,14 @@ export class PreloginResponse extends BaseResponse {
66 kdfIterations : number ;
77 kdfMemory ?: number ;
88 kdfParallelism ?: number ;
9+ salt ?: string ; // Cozy customization
910
1011 constructor ( response : any ) {
1112 super ( response ) ;
1213 this . kdf = this . getResponseProperty ( "Kdf" ) ;
1314 this . kdfIterations = this . getResponseProperty ( "KdfIterations" ) ;
1415 this . kdfMemory = this . getResponseProperty ( "KdfMemory" ) ;
1516 this . kdfParallelism = this . getResponseProperty ( "KdfParallelism" ) ;
17+ this . salt = this . getResponseProperty ( "Salt" ) ; // Cozy customization
1618 }
1719}
You can’t perform that action at this time.
0 commit comments