Files
2026-01-19 19:52:30 +03:00

25 lines
623 B
C++

#pragma once
#include <cstddef>
#include <cstdint>
#include <span>
#include <string>
#include <vector>
namespace ts6bot::crypto
{
// RFC 7636: length 43..128, chars [A-Z a-z 0-9 - . _ ~]
std::string GenerateCodeVerifier(std::size_t length = 64);
// Random state value (base64url, no padding).
std::string GenerateState(std::size_t bytes = 16);
std::vector<std::uint8_t> Sha256(std::span<const std::uint8_t> data);
std::vector<std::uint8_t> Sha256(std::span<const char> data);
// Base64url encode without padding.
std::string Base64UrlEncode(std::span<const std::uint8_t> data);
} // namespace ts6bot::crypto