PasswordHash

@Serializable
sealed interface PasswordHash

A stored password hash, tagged in YAML with the algorithm that produced it (!Argon2id, !BCrypt).

The tag — not a sniffed prefix on the string — selects the algorithm, so a new algorithm is a new tag and existing hashes never need re-encoding. Each variant owns the encoding of its encoded string and knows how to verify a plaintext against it.

Inheritors

Types

Link copied to clipboard
@Serializable(with = PasswordHash.Argon2id.Serde::class)
@SerialName(value = "!Argon2id")
data class Argon2id(val encoded: String) : PasswordHash
Link copied to clipboard
@Serializable(with = PasswordHash.BCrypt.Serde::class)
@SerialName(value = "!BCrypt")
data class BCrypt(val encoded: String) : PasswordHash
Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val encoded: String

Functions

Link copied to clipboard
abstract fun verify(password: String): Boolean