use identity_core::common::Object;
use identity_core::common::Url;
#[non_exhaustive]
#[derive(Debug, Default, serde::Serialize, serde::Deserialize, Eq, PartialEq, Clone)]
#[serde(rename_all = "camelCase")]
#[serde(default)]
pub struct JwsSignatureOptions {
pub attach_jwk: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub b64: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub typ: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cty: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<Url>,
#[serde(skip_serializing_if = "Option::is_none")]
pub nonce: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub kid: Option<String>,
pub detached_payload: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_header_parameters: Option<Object>,
}
impl JwsSignatureOptions {
pub fn new() -> Self {
Self::default()
}
pub fn attach_jwk_to_header(mut self, value: bool) -> Self {
self.attach_jwk = value;
self
}
pub fn b64(mut self, value: bool) -> Self {
self.b64 = Some(value);
self
}
pub fn typ(mut self, value: impl Into<String>) -> Self {
self.typ = Some(value.into());
self
}
pub fn cty(mut self, value: impl Into<String>) -> Self {
self.cty = Some(value.into());
self
}
pub fn url(mut self, value: Url) -> Self {
self.url = Some(value);
self
}
pub fn nonce(mut self, value: impl Into<String>) -> Self {
self.nonce = Some(value.into());
self
}
pub fn kid(mut self, value: impl Into<String>) -> Self {
self.kid = Some(value.into());
self
}
pub fn detached_payload(mut self, value: bool) -> Self {
self.detached_payload = value;
self
}
pub fn custom_header_parameters(mut self, value: Object) -> Self {
self.custom_header_parameters = Some(value);
self
}
}