identity_credential/credential/
jws.rs

1// Copyright 2020-2023 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4/// A wrapper around a JSON Web Signature (JWS).
5#[derive(Debug, Clone)]
6pub struct Jws(String);
7
8impl Jws {
9  /// Creates a new `Jws` from the given string.
10  pub fn new(jws_string: String) -> Self {
11    Self(jws_string)
12  }
13
14  /// Returns a reference of the JWS string.
15  pub fn as_str(&self) -> &str {
16    &self.0
17  }
18}
19
20impl From<String> for Jws {
21  fn from(jws: String) -> Self {
22    Self::new(jws)
23  }
24}
25impl From<Jws> for String {
26  fn from(jws: Jws) -> Self {
27    jws.0
28  }
29}