From 440fe109a76ec19f03f34c536b28e10ad90b0aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aran=C4=91el=20=C5=A0arenac?= <11753867+big-kahuna-burger@users.noreply.github.com> Date: Sat, 30 Dec 2023 17:52:51 +0100 Subject: [PATCH] docs: fix ret value with custom nonces example (#241) --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index d36e80e..238c40d 100644 --- a/README.md +++ b/README.md @@ -200,12 +200,16 @@ fastify.register( function (req, res) { // "res" here is actually "reply.raw" in fastify res.scriptNonce = crypto.randomBytes(16).toString('hex') + // make sure to return nonce-... directive to helmet, so it can be sent in the headers + return `'nonce-${res.scriptNonce}'` } ], styleSrc: [ function (req, res) { // "res" here is actually "reply.raw" in fastify res.styleNonce = crypto.randomBytes(16).toString('hex') + // make sure to return nonce-... directive to helmet, so it can be sent in the headers + return `'nonce-${res.styleNonce}'` } ] }