jose_jwk/
lib.rs

1// SPDX-FileCopyrightText: 2022 Profian Inc. <opensource@profian.com>
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4#![no_std]
5#![cfg_attr(docsrs, feature(doc_auto_cfg))]
6#![doc = include_str!("../README.md")]
7#![doc(
8    html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
9    html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
10)]
11#![forbid(unsafe_code)]
12#![warn(
13    clippy::panic,
14    clippy::panic_in_result_fn,
15    clippy::unwrap_used,
16    missing_docs,
17    rust_2018_idioms,
18    unused_lifetimes,
19    unused_qualifications
20)]
21
22extern crate alloc;
23
24pub mod crypto;
25
26mod key;
27mod prm;
28
29pub use key::*;
30pub use prm::{Class, Operations, Parameters, Thumbprint};
31
32pub use jose_b64;
33pub use jose_jwa;
34
35use serde::{Deserialize, Serialize};
36
37/// A set of JSON Web Keys.
38///
39/// This type is defined in [RFC7517 Section 5].
40///
41/// [RFC7517 Section 5]: https://datatracker.ietf.org/doc/html/rfc7517#section-5
42#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
43pub struct JwkSet {
44    /// The keys in the set.
45    pub keys: alloc::vec::Vec<Jwk>,
46}
47
48/// A JSON Web Key.
49///
50/// This type is defined in [RFC7517 Section 4].
51///
52/// [RFC7517 Section 4]: https://datatracker.ietf.org/doc/html/rfc7517#section-4
53#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
54pub struct Jwk {
55    /// The key material.
56    #[serde(flatten)]
57    pub key: Key,
58
59    /// The key parameters.
60    #[serde(flatten)]
61    pub prm: Parameters,
62}