Skip to content

Commit f8c480f

Browse files
Documentation WIP
1 parent e1ff2be commit f8c480f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/Router.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ Below is a breakdown of the `Router` object which is essentially a mini-app that
3333
* `max_body_length`[`Number`]: Overrides the global `Server.max_body_length` parameter used to enforce a maximum body size limit for this route.
3434
* `middlewares`[`Array`]: Can be used to provide route specific middlewares.
3535
* `jwt`[`Object`] JWT options:
36-
* **secret** (required)
36+
* `secret` **(required)**
3737
The secret can be a primitive type String, a function that returns a String or an object { private, public }.
3838
In this object `{ private, public }` the `private` key is a string, buffer or object containing either the secret for HMAC algorithms or the PEM encoded private key for RSA and ECDSA. In case of a private key with passphrase an object `{ private: { key, passphrase }, public }` can be used (based on [crypto documentation](https://nodejs.org/api/crypto.html#crypto_sign_sign_private_key_output_format)), in this case be sure you pass the `algorithm` inside the signing options prefixed by the `sign` key of the plugin registering options).
3939
In this object `{ private, public }` the `public` key is a string or buffer containing either the secret for HMAC algorithms, or the PEM encoded public key for RSA and ECDSA.
4040
Function based `secret` is supported by the `request.jwtVerify()` and `response.jwtSign()` methods and is called with `request`, `token`, and `callback` parameters.
4141

42-
* **cookie**[`Object`]
43-
* **cookieName**[`String`]
44-
* **signed**[`Boolean`]
42+
* `cookie`[`Object`]
43+
* `cookieName`[`String`]
44+
* `signed`[`Boolean`]
4545

4646
In some situations you may want to store a token in a cookie. This allows you to drastically reduce the attack surface of XSS on your web app with the `httpOnly` and `secure` flags. Cookies can be susceptible to CSRF. You can mitigate this by either setting the `sameSite` flag to `strict`, or by using a CSRF library
4747
The plugin will fallback to looking for the token in the authorization header if either of the following happens (even if the cookie option is enabled):

0 commit comments

Comments
 (0)