Skip to content

Commit

Permalink
add license, remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
UMR1352 committed Sep 13, 2024
1 parent d87a37d commit e70dc9a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/builder.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,11 @@ pub struct SdObjectEncoder<H> {
impl TryFrom<Value> for SdObjectEncoder<Sha256Hasher> {
type Error = crate::Error;
fn try_from(value: Value) -> Result<Self> {
Self::with_custom_hasher(value, Sha256Hasher::new())
Self::with_custom_hasher_and_salt_size(value, Sha256Hasher::new(), DEFAULT_SALT_SIZE)
}
}

impl<H: Hasher> SdObjectEncoder<H> {
/// Creates a new [`SdObjectEncoder`] with custom hash function to create digests.
pub fn with_custom_hasher(object: Value, hasher: H) -> Result<Self> {
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<Self> {
if !object.is_object() {
Expand Down
3 changes: 3 additions & 0 deletions src/jwt.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use std::fmt::Display;
use std::str::FromStr;

Expand Down
3 changes: 3 additions & 0 deletions src/signer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use std::error::Error;

use async_trait::async_trait;
Expand Down

0 comments on commit e70dc9a

Please sign in to comment.