Skip to content

Commit

Permalink
docs: fix ret value with custom nonces example (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
big-kahuna-burger authored Dec 30, 2023
1 parent 197438f commit 440fe10
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}'`
}
]
}
Expand Down

0 comments on commit 440fe10

Please sign in to comment.