From c902968e594a3c74ec79b3cbd4ebb392aafaaf65 Mon Sep 17 00:00:00 2001 From: Matt Renaud Date: Thu, 16 Sep 2021 21:41:20 -0700 Subject: [PATCH 1/2] Rename document1 to did1 in README example. Previously, the example used `document1` to refer to the DID, whereas the "document" isn't resolved until `account.resolve_identity()` is called. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b42d785097..c77f0e85ad 100644 --- a/README.md +++ b/README.md @@ -101,21 +101,21 @@ use identity::iota::IotaDocument; async fn main() -> Result<()> { pretty_env_logger::init(); - // The Stronghold settings for the storage + // The Stronghold settings for the storage. let snapshot: PathBuf = "./example-strong.hodl".into(); let password: String = "my-password".into(); - // Create a new Account with Stronghold as the storage adapter + // Create a new Account with Stronghold as the storage adapter. let account: Account = Account::builder() .storage(AccountStorage::Stronghold(snapshot, Some(password))) .build() .await?; - // Create a new Identity with default settings + // Create a new Identity with default settings. let snapshot1: IdentitySnapshot = account.create_identity(IdentityCreate::default()).await?; // Retrieve the DID from the newly created Identity state. - let document1: &IotaDID = snapshot1.identity().try_did()?; + let did1: &IotaDID = snapshot1.identity().try_did()?; println!("[Example] Local Snapshot = {:#?}", snapshot1); println!("[Example] Local Document = {:#?}", snapshot1.identity().to_document()?); @@ -124,7 +124,7 @@ async fn main() -> Result<()> { // Fetch the DID Document from the Tangle // // This is an optional step to ensure DID Document consistency. - let resolved: IotaDocument = account.resolve_identity(document1).await?; + let resolved: IotaDocument = account.resolve_identity(did1).await?; println!("[Example] Tangle Document = {:#?}", resolved); From a8635ac1ff5258233792e9f8e83e9792b9b87247 Mon Sep 17 00:00:00 2001 From: Craig Bester Date: Fri, 17 Sep 2021 20:27:36 +0200 Subject: [PATCH 2/2] Apply suggestions --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c77f0e85ad..7617390cfd 100644 --- a/README.md +++ b/README.md @@ -112,19 +112,19 @@ async fn main() -> Result<()> { .await?; // Create a new Identity with default settings. - let snapshot1: IdentitySnapshot = account.create_identity(IdentityCreate::default()).await?; + let snapshot: IdentitySnapshot = account.create_identity(IdentityCreate::default()).await?; // Retrieve the DID from the newly created Identity state. - let did1: &IotaDID = snapshot1.identity().try_did()?; + let did: &IotaDID = snapshot.identity().try_did()?; - println!("[Example] Local Snapshot = {:#?}", snapshot1); - println!("[Example] Local Document = {:#?}", snapshot1.identity().to_document()?); + println!("[Example] Local Snapshot = {:#?}", snapshot); + println!("[Example] Local Document = {:#?}", snapshot.identity().to_document()?); println!("[Example] Local Document List = {:#?}", account.list_identities().await); // Fetch the DID Document from the Tangle // // This is an optional step to ensure DID Document consistency. - let resolved: IotaDocument = account.resolve_identity(did1).await?; + let resolved: IotaDocument = account.resolve_identity(did).await?; println!("[Example] Tangle Document = {:#?}", resolved);