1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
// SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved // // SPDX-License-Identifier: Apache-2.0 use std::collections::BTreeMap; use serde::{Deserialize, Serialize}; use crate::JsonValue; /// Arbitrary private JWT claims. /// /// This is a transparent JSON object. #[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(transparent)] pub struct AnyClaims(pub BTreeMap<String, JsonValue>); impl AnyClaims { /// Returns a claim value by key. pub fn get(&self, key: &str) -> Option<&JsonValue> { self.0.get(key) } /// Inserts or replaces a claim value. pub fn insert(&mut self, key: String, value: JsonValue) { self.0.insert(key, value); } }