Skip to content

Commit fe4e890

Browse files
authored
Merge branch 'main' into docs/broken-links
2 parents 986d1fb + 840d58e commit fe4e890

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

types/index.d.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,16 @@ declare namespace fastifyCsrfProtection {
3636
getToken?: GetTokenFn;
3737
}
3838

39+
type RequiredCSRFHmac = Omit<CSRFOptions, 'hmacKey' | 'userInfo'> &
40+
Required<Pick<CSRFOptions, 'hmacKey'>> & { userInfo: true }
41+
42+
type OptionalCSRFNoUserInfo = Omit<CSRFOptions, 'userInfo'> & {
43+
userInfo?: false;
44+
}
45+
3946
interface FastifyCsrfProtectionOptionsFastifyCookie {
4047
sessionPlugin?: '@fastify/cookie';
41-
csrfOpts?: | ({
42-
[k in keyof CSRFOptions]: k extends 'userInfo'
43-
? true
44-
: CSRFOptions[k];
45-
} & Required<Pick<CSRFOptions, 'hmacKey'>>)
46-
| ({
47-
[k in keyof CSRFOptions]: k extends 'userInfo'
48-
? false
49-
: CSRFOptions[k];
50-
});
48+
csrfOpts?: OptionalCSRFNoUserInfo | RequiredCSRFHmac;
5149
}
5250

5351
interface FastifyCsrfProtectionOptionsFastifySession {

0 commit comments

Comments
 (0)