Class PasswordHasher.Builder
java.lang.Object
com.revetsec.password.PasswordHasher.Builder
- Enclosing class:
PasswordHasher
Mutable configuration helper. All provider and cryptographic work occurs during operations.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Validates local configuration without looking up keys, providers, or random bytes.legacyBcrypt(@NonNull LegacyPasswordPreparation preparation, @NonNull Integer maximumLogRounds) Enables explicit verify-only bcrypt migration.legacyPbkdf2(@NonNull LegacyPasswordPreparation preparation, @NonNull Integer maximumIterations) Enables explicit verify-only PBKDF2 migration.Requires RFC 9106 keyed Argon2id for new and native verified hashes.Sets strict input and stored-work ceilings.Sets the shared, process-local preparation, pepper and KDF admission gate.
-
Method Details
-
workGate
Sets the shared, process-local preparation, pepper and KDF admission gate.- Parameters:
gate- shared gate, or null to clear this required setting- Returns:
- this builder
- Since:
- 1.0.0
-
verificationLimits
public @NonNull PasswordHasher.Builder verificationLimits(@Nullable PasswordVerificationLimits limits) Sets strict input and stored-work ceilings. A stored memory cost within these ceilings but above the gate's total budget is intentionally unavailable even with an idle gate.- Parameters:
limits- verification ceilings, or null to restore conservative defaults- Returns:
- this builder
- Since:
- 1.0.0
-
pepperSource
Requires RFC 9106 keyed Argon2id for new and native verified hashes. Ordinary raw PHC values are refused by a pepper-enabled hasher.- Parameters:
source- coherent active/retained key provider, or null to clear pepper policy- Returns:
- this builder
- Since:
- 1.0.0
-
legacyBcrypt
public @NonNull PasswordHasher.Builder legacyBcrypt(@NonNull LegacyPasswordPreparation preparation, @NonNull Integer maximumLogRounds) Enables explicit verify-only bcrypt migration. Historical preparation must be known.- Parameters:
preparation- original character preparationmaximumLogRounds- maximum accepted bcrypt log2 work cost, 4–16- Returns:
- this builder
- Since:
- 1.0.0
-
legacyPbkdf2
public @NonNull PasswordHasher.Builder legacyPbkdf2(@NonNull LegacyPasswordPreparation preparation, @NonNull Integer maximumIterations) Enables explicit verify-only PBKDF2 migration. The application supplies historical salt, tag, iteration count, and HMAC selection from its trusted account schema.- Parameters:
preparation- original character preparationmaximumIterations- maximum accepted iteration count, at most 2,000,000- Returns:
- this builder
- Since:
- 1.0.0
-
build
Validates local configuration without looking up keys, providers, or random bytes.- Returns:
- a thread-safe hasher
- Since:
- 1.0.0
-