import argon2 from 'argon2' ; import { getConfigFromEnv } from './get-config-from-env' ; export function generateHash ( stringToHash ) { const argon2HashConfigOptions = getConfigFromEnv ( 'HASH_' , 'HASH_RAW' ) ; 'associatedData' in argon2HashConfigOptions && ( argon2HashConfigOptions . associatedData = Buffer . from ( argon2HashConfigOptions . associatedData ) ) ; return argon2 . hash ( stringToHash , argon2HashConfigOptions ) ; }