identity_document/verifiable/
jwp_verification_options.rs

1// Copyright 2020-2024 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4use identity_did::DIDUrl;
5use identity_verification::MethodScope;
6
7/// Holds additional options for verifying a JWP
8#[non_exhaustive]
9#[derive(Default, Debug, serde::Serialize, serde::Deserialize, Clone)]
10#[serde(rename_all = "camelCase")]
11pub struct JwpVerificationOptions {
12  /// Verify the signing verification method relation matches this.
13  pub method_scope: Option<MethodScope>,
14  /// The DID URl of the method, whose JWK should be used to verify the JWP.
15  /// If unset, the `kid` of the JWP is used as the DID Url.
16  pub method_id: Option<DIDUrl>,
17}
18
19impl JwpVerificationOptions {
20  /// Creates a new [`JwpVerificationOptions`].
21  pub fn new() -> Self {
22    Self::default()
23  }
24
25  /// Set the scope of the verification methods that may be used to verify the given JWP.
26  pub fn method_scope(mut self, value: MethodScope) -> Self {
27    self.method_scope = Some(value);
28    self
29  }
30
31  /// The DID URl of the method, whose JWK should be used to verify the JWP.
32  pub fn method_id(mut self, value: DIDUrl) -> Self {
33    self.method_id = Some(value);
34    self
35  }
36}