Logo

Cake Planner

Backend

token_utils.cpp

File Header Information

FieldValue
SPDX CommentJWT Token Utilities Implementation
SPDX TypeSOURCE
ContributorZHENG Robert
License IDMIT
Filetoken_utils.cpp
DescriptionJWT Token Utilities Implementation
Version0.15.0
Date2026-01-24
AuthorZHENG Robert (robert@hase-zheng.net)
CopyrightCopyright (c) 2026 ZHENG Robert
LicenseMIT

Table of Contents

API Documentation

namespace utils

utils namespace.


QString TokenUtils::generateToken(const QString &userId, const QString &email,

Generates a JWT (JSON Web Token) for a user.

ParameterDescription
userIdThe ID of the user.
emailThe email address of the user.
isAdminTrue if the user is an administrator.

Returns: The generated JWT as a string.


std::optional

Verifies and decodes a JWT.

ParameterDescription
rawTokenThe raw JWT string.

Returns: An optional TokenPayload containing the user info if verification succeeds, std::nullopt otherwise.