1#ifndef SOURCEMETA_CORE_JOSE_JWKS_H_
2#define SOURCEMETA_CORE_JOSE_JWKS_H_
4#ifndef SOURCEMETA_CORE_JOSE_EXPORT
5#include <sourcemeta/core/jose_export.h>
9#include <sourcemeta/core/jose_error.h>
12#include <sourcemeta/core/jose_jwk.h>
13#include <sourcemeta/core/json.h>
20namespace sourcemeta::core {
40class SOURCEMETA_CORE_JOSE_EXPORT
JWKS {
51 auto operator=(
JWKS &&other)
noexcept ->
JWKS & =
default;
53 auto operator=(
const JWKS &) ->
JWKS & =
delete;
57 [[nodiscard]]
static auto from(
const JSON &value) -> std::optional<JWKS>;
60 [[nodiscard]]
static auto from(
JSON &&value) -> std::optional<JWKS>;
64 [[nodiscard]]
auto find(
const std::string_view key_id)
const noexcept
68 [[nodiscard]]
auto size() const noexcept -> std::
size_t {
69 return this->keys_.size();
73 [[nodiscard]]
auto empty() const noexcept ->
bool {
74 return this->keys_.empty();
77 [[nodiscard]]
auto begin() const noexcept {
return this->keys_.begin(); }
78 [[nodiscard]]
auto end() const noexcept {
return this->keys_.end(); }
82 static auto parse(
const JSON &value, JWKS &result) -> bool;
85#pragma warning(disable : 4251)
87 std::vector<JWK> keys_;
89#pragma warning(default : 4251)
static auto from(JSON &&value) -> std::optional< JWKS >
auto find(const std::string_view key_id) const noexcept -> const JWK *
auto empty() const noexcept -> bool
Whether the set holds no keys.
Definition jose_jwks.h:73
JWKS(JWKS &&other) noexcept=default
A key set exclusively owns its keys, so it is move-only.
static auto from(const JSON &value) -> std::optional< JWKS >
auto size() const noexcept -> std::size_t
The number of keys in the set.
Definition jose_jwks.h:68