File tree 4 files changed +11
-5
lines changed
4 files changed +11
-5
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2020-2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
1
4
use anyhow:: Context as _;
2
5
use itertools:: Itertools ;
3
6
use serde:: Serialize ;
@@ -14,6 +17,7 @@ use crate::Result;
14
17
use crate :: SdJwt ;
15
18
use crate :: SdJwtClaims ;
16
19
use crate :: SdObjectEncoder ;
20
+ #[ cfg( feature = "sha" ) ]
17
21
use crate :: Sha256Hasher ;
18
22
use crate :: DEFAULT_SALT_SIZE ;
19
23
use crate :: HEADER_TYP ;
Original file line number Diff line number Diff line change @@ -36,15 +36,11 @@ pub struct SdObjectEncoder<H> {
36
36
impl TryFrom < Value > for SdObjectEncoder < Sha256Hasher > {
37
37
type Error = crate :: Error ;
38
38
fn try_from ( value : Value ) -> Result < Self > {
39
- Self :: with_custom_hasher ( value, Sha256Hasher :: new ( ) )
39
+ Self :: with_custom_hasher_and_salt_size ( value, Sha256Hasher :: new ( ) , DEFAULT_SALT_SIZE )
40
40
}
41
41
}
42
42
43
43
impl < H : Hasher > SdObjectEncoder < H > {
44
- /// Creates a new [`SdObjectEncoder`] with custom hash function to create digests.
45
- pub fn with_custom_hasher ( object : Value , hasher : H ) -> Result < Self > {
46
- Self :: with_custom_hasher_and_salt_size ( object, hasher, DEFAULT_SALT_SIZE )
47
- }
48
44
/// Creates a new [`SdObjectEncoder`] with custom hash function to create digests, and custom salt size.
49
45
pub fn with_custom_hasher_and_salt_size ( object : Value , hasher : H , salt_size : usize ) -> Result < Self > {
50
46
if !object. is_object ( ) {
Original file line number Diff line number Diff line change
1
+ // Copyright 2020-2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
1
4
use std:: fmt:: Display ;
2
5
use std:: str:: FromStr ;
3
6
Original file line number Diff line number Diff line change
1
+ // Copyright 2020-2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
1
4
use std:: error:: Error ;
2
5
3
6
use async_trait:: async_trait;
You can’t perform that action at this time.
0 commit comments