Function generatePasswordHash

  • Generates a password hash that can be stored in the database. Each password hash is generated with a random salt.

    Parameters

    • password: string

      The password to hash.

    • Optional options: Partial<PasswordHashOptions>

      The options to use when generating the password hash. Please refer to constants for default values.

    Returns Promise<PasswordHashType>

    A promise that resolves to a PasswordHashType object.

    Example

    const passwordHash = await generatePasswordHash('password'); // default options used