xtr_password_hasher.command ¶
The security:hash-password console command.
Importing this module declares it. With a container, the security bundle loads it when the console bundle is active, and the command resolves a named user class's hasher through the container's factory. Without one, the console builds it bare and it hashes with the secure default hasher.
Needs xtr-console, installed beside this package.
UserPasswordHashCommand ¶
UserPasswordHashCommand(factory: PasswordHasherFactoryInterface, user_classes: tuple[str, ...] = ())
Hashes a password the way the application's configuration would.
The hasher is the one configured for user-class — a module:Class,
or the name of a configured hasher — or, when it is left out, for the
first of user_classes (asked, when there are several and the run is
interactive). user_classes are the keys the factory is configured
with, as module:Class strings or hasher names.
The password is asked for, hidden, when left out; - reads it from
standard input, which keeps it out of the shell history and the process
list. A hasher that takes its salt from outside gets a generated one,
printed with the hash, unless --empty-salt is given.
Resolve hashers through factory, defaulting to the first of user_classes.