Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ public OrganizationUserResetPasswordDetailsResponseModel(OrganizationUserResetPa
KdfIterations = orgUser.KdfIterations;
KdfMemory = orgUser.KdfMemory;
KdfParallelism = orgUser.KdfParallelism;
MasterPasswordSalt = orgUser.MasterPasswordSalt;
ResetPasswordKey = orgUser.ResetPasswordKey;
EncryptedPrivateKey = orgUser.EncryptedPrivateKey;
}
Expand All @@ -214,6 +215,7 @@ public OrganizationUserResetPasswordDetailsResponseModel(OrganizationUserResetPa
public int KdfIterations { get; set; }
public int? KdfMemory { get; set; }
public int? KdfParallelism { get; set; }
public string MasterPasswordSalt { get; set; }
public string ResetPasswordKey { get; set; }
public string EncryptedPrivateKey { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public OrganizationUserResetPasswordDetails(OrganizationUser orgUser, User user,
KdfIterations = user.KdfIterations;
KdfMemory = user.KdfMemory;
KdfParallelism = user.KdfParallelism;
MasterPasswordSalt = user.MasterPasswordSalt;
ResetPasswordKey = orgUser.ResetPasswordKey;
EncryptedPrivateKey = org.PrivateKey;
}
Expand All @@ -41,6 +42,7 @@ public OrganizationUserResetPasswordDetails(OrganizationUser orgUser, User user,
public int KdfIterations { get; set; }
public int? KdfMemory { get; set; }
public int? KdfParallelism { get; set; }
public string MasterPasswordSalt { get; set; }
public string ResetPasswordKey { get; set; }
public string EncryptedPrivateKey { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ public async Task GetAccountRecoveryDetails_ReturnsDetails(
ou.KdfMemory == r.KdfMemory &&
ou.KdfParallelism == r.KdfParallelism &&
ou.ResetPasswordKey == r.ResetPasswordKey &&
ou.EncryptedPrivateKey == r.EncryptedPrivateKey)));
ou.EncryptedPrivateKey == r.EncryptedPrivateKey &&
ou.MasterPasswordSalt == r.MasterPasswordSalt)));
}

[Theory]
Expand Down Expand Up @@ -404,6 +405,7 @@ public async Task GetResetPasswordDetails_WhenValid_ReturnsDetails(
Assert.Equal(user.Kdf, response.Kdf);
Assert.Equal(user.KdfIterations, response.KdfIterations);
Assert.Equal(org.PrivateKey, response.EncryptedPrivateKey);
Assert.Equal(user.MasterPasswordSalt, response.MasterPasswordSalt);
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ public async Task GetManyAccountRecoveryDetailsByOrganizationUserAsync_Works(IUs
Kdf = KdfType.PBKDF2_SHA256,
KdfIterations = 1,
KdfMemory = 2,
KdfParallelism = 3
KdfParallelism = 3,
MasterPasswordSalt = "master-salt1"
});

var user2 = await userRepository.CreateAsync(new User
Expand All @@ -302,7 +303,8 @@ public async Task GetManyAccountRecoveryDetailsByOrganizationUserAsync_Works(IUs
Kdf = KdfType.Argon2id,
KdfIterations = 4,
KdfMemory = 5,
KdfParallelism = 6
KdfParallelism = 6,
MasterPasswordSalt = "master-salt2"
});

var organization = await organizationRepository.CreateAsync(new Organization
Expand Down Expand Up @@ -352,15 +354,17 @@ public async Task GetManyAccountRecoveryDetailsByOrganizationUserAsync_Works(IUs
r.KdfMemory == 2 &&
r.KdfParallelism == 3 &&
r.ResetPasswordKey == "resetpasswordkey1" &&
r.EncryptedPrivateKey == "privatekey");
r.EncryptedPrivateKey == "privatekey" &&
r.MasterPasswordSalt == "master-salt1");
Assert.Contains(recoveryDetails, r =>
r.OrganizationUserId == orgUser2.Id &&
r.Kdf == KdfType.Argon2id &&
r.KdfIterations == 4 &&
r.KdfMemory == 5 &&
r.KdfParallelism == 6 &&
r.ResetPasswordKey == "resetpasswordkey2" &&
r.EncryptedPrivateKey == "privatekey");
r.EncryptedPrivateKey == "privatekey" &&
r.MasterPasswordSalt == "master-salt2");
}

[DatabaseTheory, DatabaseData]
Expand Down
Loading