identity_credential/credential/
jwp_credential_options.rs

1// Copyright 2020-2024 IOTA Stiftung, Fondazione Links
2// SPDX-License-Identifier: Apache-2.0
3
4/// Options for creating a JSON Web Proof.
5#[non_exhaustive]
6#[derive(Debug, Default, serde::Serialize, serde::Deserialize, Eq, PartialEq, Clone)]
7#[serde(rename_all = "camelCase")]
8#[serde(default)]
9pub struct JwpCredentialOptions {
10  /// The kid to set in the Issuer Protected Header.
11  ///
12  /// If unset, the kid of the JWK with which the JWP is produced is used.
13  #[serde(skip_serializing_if = "Option::is_none")]
14  pub kid: Option<String>,
15}
16
17impl JwpCredentialOptions {
18  /// Creates a new [`JwsSignatureOptions`].
19  pub fn new() -> Self {
20    Self::default()
21  }
22
23  /// Replace the value of the `kid` field.
24  pub fn kid(mut self, value: impl Into<String>) -> Self {
25    self.kid = Some(value.into());
26    self
27  }
28}