import * as crypto from 'crypto' ; import { ValueTransformer } from 'typeorm' ; export class PasswordTransformer implements ValueTransformer { from ( value ) { return value ; } to ( value ) { return crypto . createHmac ( 'sha256' , value ) . digest ( 'hex' ) ; } }