diff --git a/bindings/grpc/src/main.rs b/bindings/grpc/src/main.rs index 46219402c..cc9ee844d 100644 --- a/bindings/grpc/src/main.rs +++ b/bindings/grpc/src/main.rs @@ -25,7 +25,7 @@ async fn main() -> anyhow::Result<()> { let iota_client = iota_sdk::IotaClientBuilder::default().build(api_endpoint).await?; - let read_only_client = IdentityClientReadOnly::new(iota_client, identity_pkg_id).await?; + let read_only_client = IdentityClientReadOnly::new_with_pkg_id(iota_client, identity_pkg_id).await?; let stronghold = init_stronghold()?; diff --git a/bindings/grpc/src/services/document.rs b/bindings/grpc/src/services/document.rs index 6a668906a..7104e1e96 100644 --- a/bindings/grpc/src/services/document.rs +++ b/bindings/grpc/src/services/document.rs @@ -6,10 +6,11 @@ use _document::document_service_server::DocumentServiceServer; use _document::CreateDidRequest; use _document::CreateDidResponse; use identity_iota::core::ToJson; +use identity_iota::iota::rebased::client::IdentityClient; +use identity_iota::iota::rebased::client::IdentityClientReadOnly; +use identity_iota::iota::rebased::transaction::Transaction; use identity_iota::iota::IotaDID; use identity_iota::iota::IotaDocument; -use identity_iota::iota::StateMetadataDocument; -use identity_iota::iota::StateMetadataEncoding; use identity_iota::storage::JwkDocumentExt; use identity_iota::storage::JwkStorageDocumentError; use identity_iota::storage::Storage; @@ -18,11 +19,9 @@ use identity_iota::verification::MethodScope; use identity_storage::KeyId; use identity_storage::KeyStorageErrorKind; use identity_storage::StorageSigner; +use identity_stronghold::StrongholdKeyType; use identity_stronghold::StrongholdStorage; use identity_stronghold::ED25519_KEY_TYPE; -use identity_iota::iota::rebased::client::IdentityClient; -use identity_iota::iota::rebased::client::IdentityClientReadOnly; -use identity_iota::iota::rebased::transaction::Transaction; use tonic::Code; use tonic::Request; use tonic::Response; @@ -82,7 +81,7 @@ impl DocumentService for DocumentSvc { let pub_key = self .storage .key_id_storage() - .get_public_key(&key_id) + .get_public_key_with_type(&key_id, StrongholdKeyType::Ed25519) .await .map_err(Error::StrongholdError)?; @@ -94,16 +93,8 @@ impl DocumentService for DocumentSvc { .await .map_err(Error::IdentityClientError)?; - let iota_doc = { - let doc = IotaDocument::new(network_name); - - let iota_doc_md = StateMetadataDocument::from(doc); - - iota_doc_md.pack(StateMetadataEncoding::Json).expect("shouldn't fail") - }; - let mut created_identity = identity_client - .create_identity(&iota_doc) + .create_identity(IotaDocument::new(network_name)) .finish() .execute(&identity_client) .await diff --git a/bindings/grpc/src/services/utils.rs b/bindings/grpc/src/services/utils.rs index 0e7d2fc57..d1bf4c588 100644 --- a/bindings/grpc/src/services/utils.rs +++ b/bindings/grpc/src/services/utils.rs @@ -8,6 +8,7 @@ use _utils::DataSigningResponse; use identity_iota::storage::JwkStorage; use identity_iota::storage::KeyId; use identity_iota::storage::KeyStorageError; +use identity_stronghold::StrongholdKeyType; use identity_stronghold::StrongholdStorage; use tonic::Request; use tonic::Response; @@ -51,7 +52,11 @@ impl SigningSvc for SigningService { async fn sign(&self, req: Request) -> Result, Status> { let DataSigningRequest { data, key_id } = req.into_inner(); let key_id = KeyId::new(key_id); - let public_key_jwk = self.storage.get_public_key(&key_id).await.map_err(Error)?; + let public_key_jwk = self + .storage + .get_public_key_with_type(&key_id, StrongholdKeyType::Ed25519) + .await + .map_err(Error)?; let signature = self .storage .sign(&key_id, &data, &public_key_jwk)