From e70dc9afaceacddee5527be9358bfc8b8fd25fc6 Mon Sep 17 00:00:00 2001 From: Enrico Marconi Date: Fri, 13 Sep 2024 11:03:22 +0200 Subject: [PATCH] add license, remove unused code --- src/builder.rs | 4 ++++ src/encoder.rs | 6 +----- src/jwt.rs | 3 +++ src/signer.rs | 3 +++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/builder.rs b/src/builder.rs index 0534af7..3bcbe07 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -1,3 +1,6 @@ +// Copyright 2020-2024 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + use anyhow::Context as _; use itertools::Itertools; use serde::Serialize; @@ -14,6 +17,7 @@ use crate::Result; use crate::SdJwt; use crate::SdJwtClaims; use crate::SdObjectEncoder; +#[cfg(feature = "sha")] use crate::Sha256Hasher; use crate::DEFAULT_SALT_SIZE; use crate::HEADER_TYP; diff --git a/src/encoder.rs b/src/encoder.rs index 7bc3f36..84c1b11 100644 --- a/src/encoder.rs +++ b/src/encoder.rs @@ -36,15 +36,11 @@ pub struct SdObjectEncoder { impl TryFrom for SdObjectEncoder { type Error = crate::Error; fn try_from(value: Value) -> Result { - Self::with_custom_hasher(value, Sha256Hasher::new()) + Self::with_custom_hasher_and_salt_size(value, Sha256Hasher::new(), DEFAULT_SALT_SIZE) } } impl SdObjectEncoder { - /// Creates a new [`SdObjectEncoder`] with custom hash function to create digests. - pub fn with_custom_hasher(object: Value, hasher: H) -> Result { - Self::with_custom_hasher_and_salt_size(object, hasher, DEFAULT_SALT_SIZE) - } /// Creates a new [`SdObjectEncoder`] with custom hash function to create digests, and custom salt size. pub fn with_custom_hasher_and_salt_size(object: Value, hasher: H, salt_size: usize) -> Result { if !object.is_object() { diff --git a/src/jwt.rs b/src/jwt.rs index 30c3cc0..5934a5e 100644 --- a/src/jwt.rs +++ b/src/jwt.rs @@ -1,3 +1,6 @@ +// Copyright 2020-2024 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + use std::fmt::Display; use std::str::FromStr; diff --git a/src/signer.rs b/src/signer.rs index f0f5add..0e6508c 100644 --- a/src/signer.rs +++ b/src/signer.rs @@ -1,3 +1,6 @@ +// Copyright 2020-2024 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + use std::error::Error; use async_trait::async_trait;