Checks what a verified token says before it is trusted. It types the payloads of session and password reset tokens, and lib/jwt.ts runs their guards when it verifies one.

Functions

f
isAuthPayload(obj: unknown): obj is AuthPayload

Checks whether obj is an AuthPayload. A media or reset token's payload, which has a purpose, never is.

f
isPasswordResetPayload(obj: unknown): obj is PasswordResetPayload

Checks whether obj is a PasswordResetPayload. It doesn't check exp, which jwtVerify has already enforced.

Interfaces

I
AuthPayload

Signed into a session token by createJWT, and returned by authenticate to the auth middleware as ctx.state.user. By then role is the user's live role, while username is still the one at issue time.

I
PasswordResetPayload

Signed into a reset link's token by createPasswordResetToken, and returned by verifyPasswordResetToken to resetPassword.