Skip to content

Commit

Permalink
fix wasm clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulmth committed Jan 15, 2024
1 parent 7573000 commit b2fe9d7
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 18 deletions.
12 changes: 7 additions & 5 deletions bindings/wasm/src/sd_jwt/decoder.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use crate::{
common::{ArrayString, RecordStringAny},
error::{Result, WasmResult},
};
use crate::common::ArrayString;
use crate::common::RecordStringAny;
use crate::error::Result;
use crate::error::WasmResult;
use identity_iota::sd_jwt_payload::SdObjectDecoder;
use serde_json::{Map, Value};
use serde_json::Map;
use serde_json::Value;
use wasm_bindgen::prelude::*;

/// Substitutes digests in an SD-JWT object by their corresponding plaintext values provided by disclosures.
#[wasm_bindgen(js_name = SdObjectDecoder, inspectable)]
pub struct WasmSdObjectDecoder(pub(crate) SdObjectDecoder);

#[wasm_bindgen(js_class = SdObjectDecoder)]
#[allow(clippy::new_without_default)]
impl WasmSdObjectDecoder {
/// Creates a new `SdObjectDecoder` with `sha-256` hasher.
#[wasm_bindgen(constructor)]
Expand Down
2 changes: 1 addition & 1 deletion bindings/wasm/src/sd_jwt/disclosure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl WasmDisclosure {

/// Returns a copy of the base64url-encoded string.
#[wasm_bindgen(js_name = toString)]
pub fn to_string(&self) -> String {
pub fn to_string_clone(&self) -> String {
self.0.disclosure.clone()
}

Expand Down
14 changes: 8 additions & 6 deletions bindings/wasm/src/sd_jwt/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
// SPDX-License-Identifier: Apache-2.0

use super::disclosure::WasmDisclosure;
use crate::{
common::{ArrayString, RecordStringAny},
error::{Result, WasmResult},
};
use identity_iota::sd_jwt_payload::{SdObjectEncoder, Sha256Hasher};
use js_sys::{Array, JsString};
use crate::common::ArrayString;
use crate::common::RecordStringAny;
use crate::error::Result;
use crate::error::WasmResult;
use identity_iota::sd_jwt_payload::SdObjectEncoder;
use identity_iota::sd_jwt_payload::Sha256Hasher;
use js_sys::Array;
use js_sys::JsString;
use serde_json::Value;
use wasm_bindgen::prelude::*;

Expand Down
2 changes: 1 addition & 1 deletion bindings/wasm/src/sd_jwt/key_binding_jwt_claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl WasmKeyBindingJwtClaims {
/// Returns a copy of the issued at `iat` property.
#[wasm_bindgen]
pub fn iat(&self) -> i64 {
self.0.iat.clone()
self.0.iat
}

/// Returns a copy of the audience `aud` property.
Expand Down
4 changes: 2 additions & 2 deletions bindings/wasm/src/sd_jwt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ mod decoder;
mod disclosure;
mod encoder;
mod key_binding_jwt_claims;
mod sd_jwt;
mod wasm_sd_jwt;

pub use decoder::*;
pub use disclosure::*;
pub use encoder::*;
pub use key_binding_jwt_claims::*;
pub use sd_jwt::*;
pub use wasm_sd_jwt::*;
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use crate::common::ArrayString;
use crate::error::Result;
use crate::{common::ArrayString, error::WasmResult};
use crate::error::WasmResult;
use identity_iota::sd_jwt_payload::SdJwt;
use js_sys::{Array, JsString};
use js_sys::Array;
use js_sys::JsString;
use wasm_bindgen::prelude::*;

/// Representation of an SD-JWT of the format
Expand Down Expand Up @@ -44,7 +46,7 @@ impl WasmSdJwt {

/// Serializes the components into the final SD-JWT.
#[wasm_bindgen(js_name = toString)]
pub fn to_string(&self) -> String {
pub fn to_string_clone(&self) -> String {
self.0.presentation()
}

Expand Down

0 comments on commit b2fe9d7

Please sign in to comment.