4lessandrodev/ts-logs

Ensure encrypt sub object key

Closed this issue · 0 comments

The encryption do not encrypt subobject key

ensure encrypt all match key

Step.error({
	name: 'Teste',
	message: 'Example',
	additionalInfo: 'Info',
	data: JSON.stringify({
		product: { id: "1", price: 200 },
		card: { n: 123123123 },
		payment: { card: { n: 12312312 } }
	})
}).encrypt({ attributes: ['card'] }).then((step) => {

  console.log(step);
  
  /*
  Step {
  name: 'Teste',
  tags: [],
  url: 'none',
  stack: 'none',
  data: '{"product":{"id":"1","price":200},"card":"939b6197d0050191839a8d01e7e658","payment":{"card":{"n":12312312}}}',
  statusCode: 400,
  message: 'Example',
  type: 'error',
  method: 'NONE',
  createdAt: 2023-02-10T15:55:33.651Z,
  uid: 'f953ce12-7da4-4ca8-b3bf-b4842bc89f4b',
  additionalInfo: 'Info'
}
  */  

});

Ensure encrypt all matching key in data