Skip to content

Commit

Permalink
Rename document1 to did1 in README example. (#400)
Browse files Browse the repository at this point in the history
* 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.

* Apply suggestions
  • Loading branch information
m-renaud authored Sep 17, 2021
1 parent ca0cdae commit 75bb07b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,30 +101,30 @@ 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
let snapshot1: IdentitySnapshot = account.create_identity(IdentityCreate::default()).await?;
// Create a new Identity with default settings.
let snapshot: IdentitySnapshot = account.create_identity(IdentityCreate::default()).await?;

// Retrieve the DID from the newly created Identity state.
let document1: &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(document1).await?;
let resolved: IotaDocument = account.resolve_identity(did).await?;

println!("[Example] Tangle Document = {:#?}", resolved);

Expand Down

0 comments on commit 75bb07b

Please sign in to comment.