fix diff method
use identity_core::{
common::FromJson as _,
- did::{ServiceBuilder, ServiceEndpoint, DID},
+ did::{DIDDocument, ServiceBuilder, ServiceEndpoint, DID},
key::{KeyData, KeyRelation, KeyType, PublicKey, PublicKeyBuilder},
utils::{decode_b58, encode_b58},
};
use identity_iota::did::{DIDDiff, IotaDID, IotaDocument};
+use std::str::FromStr;
use wasm_bindgen::prelude::*;
use crate::{did::DID as WasmDID, js_err, key::Key, pubkey::PubKey};
@@ -152,7 +153,8 @@ impl Doc {
#[wasm_bindgen]
pub fn diff(&self, other: &Doc, key: &Key) -> Result<JsValue, JsValue> {
- let diff: DIDDiff = self.0.diff(&other.0, key.0.secret()).map_err(js_err)?;
+ let doc = DIDDocument::from_str(&other.0.to_string()).map_err(js_err)?;
+ let diff: DIDDiff = self.0.diff(doc, key.0.secret()).map_err(js_err)?;
JsValue::from_serde(&diff).map_err(js_err)
}
