group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
RelayToken.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <array>
7#include <cstddef>
8#include <cstdint>
9
10namespace net
11{
12
13inline constexpr std::size_t k_relayTokenMacBytes = 32;
14
16{
17 std::uint64_t expiresAtMs = 0;
18 std::array<std::uint8_t, k_relayTokenMacBytes> mac{};
19};
20
21inline bool hasRelayToken(const RelayToken& token)
22{
23 if (token.expiresAtMs == 0)
24 return false;
25 for (std::uint8_t byte : token.mac) {
26 if (byte != 0)
27 return true;
28 }
29 return false;
30}
31
32} // namespace net
Definition ChatProtocol.cpp:12
bool hasRelayToken(const RelayToken &token)
Definition RelayToken.hpp:21
constexpr std::size_t k_relayTokenMacBytes
Definition RelayToken.hpp:13
Definition RelayToken.hpp:16
std::uint64_t expiresAtMs
Definition RelayToken.hpp:17
std::array< std::uint8_t, k_relayTokenMacBytes > mac
Definition RelayToken.hpp:18