mirror of
https://github.com/bitwarden/server
synced 2026-01-08 03:23:20 +00:00
[PM-22736] Send password hasher (#6112)
* feat: - Add SendPasswordHasher class and interface - DI for SendPasswordHasher to use Marker class allowing us to use custom options for the SendPasswordHasher without impacting other PasswordHashers. * test: Unit tests for SendPasswordHasher implementation * doc: docs for interface and comments Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
This commit is contained in:
21
src/Core/KeyManagement/Sends/ISendPasswordHasher.cs
Normal file
21
src/Core/KeyManagement/Sends/ISendPasswordHasher.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace Bit.Core.KeyManagement.Sends;
|
||||
|
||||
public interface ISendPasswordHasher
|
||||
{
|
||||
/// <summary>
|
||||
/// Matches the send password hash against the user provided client password hash. The send password is server hashed and the client
|
||||
/// password hash is hashed by the server for comparison <see cref="HashOfClientPasswordHash"/> in this method.
|
||||
/// </summary>
|
||||
/// <param name="sendPasswordHash">The send password that is hashed by the server.</param>
|
||||
/// <param name="clientPasswordHash">The user provided password hash that has not yet been hashed by the server for comparison.</param>
|
||||
/// <returns>true if hashes match false otherwise</returns>
|
||||
/// <exception cref="InvalidOperationException">Thrown if the server password hash or client password hash is null or empty.</exception>
|
||||
bool PasswordHashMatches(string sendPasswordHash, string clientPasswordHash);
|
||||
|
||||
/// <summary>
|
||||
/// Accepts a client hashed send password and returns a server hashed password.
|
||||
/// </summary>
|
||||
/// <param name="clientHashedPassword"></param>
|
||||
/// <returns>server hashed password</returns>
|
||||
string HashOfClientPasswordHash(string clientHashedPassword);
|
||||
}
|
||||
Reference in New Issue
Block a user