1
0
mirror of https://github.com/bitwarden/server synced 2026-01-01 08:03:23 +00:00
Files
server/src/Core/KeyManagement/Sends/ISendPasswordHasher.cs
Ike 05398ad8a4 [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>
2025-07-24 12:49:15 -04:00

22 lines
1.2 KiB
C#

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);
}