diff --git a/identity/README.md b/identity/README.md index e4cc59fe5b..44f2fc0e7a 100644 --- a/identity/README.md +++ b/identity/README.md @@ -15,7 +15,6 @@ use identity::iota::TangleRef; #[smol_potat::main] async fn main() -> Result<()> { - // Create a client to interact with the IOTA Tangle. let client: Client = Client::new()?; diff --git a/identity/src/lib.rs b/identity/src/lib.rs index 502202c94e..31ece6b764 100644 --- a/identity/src/lib.rs +++ b/identity/src/lib.rs @@ -9,8 +9,10 @@ //! ``` //! use identity::crypto::KeyPair; //! use identity::iota::Client; -//! use identity::iota::IotaDocument; +//! use identity::iota::Document; +//! use identity::iota::Network; //! use identity::iota::Result; +//! use identity::iota::TangleRef; //! //! #[smol_potat::main] //! async fn main() -> Result<()> { @@ -18,19 +20,20 @@ //! let client: Client = Client::new()?; //! //! // Create a DID Document (an identity). -//! let (mut document, keypair): (IotaDocument, KeyPair) = IotaDocument::builder() -//! .authentication_tag("key-1") -//! .did_network(client.network().as_str()) -//! .build()?; +//! let keypair: KeyPair = KeyPair::new_ed25519()?; +//! let mut document: Document = Document::from_keypair(&keypair)?; //! //! // Sign the DID Document with the default authentication key. //! document.sign(keypair.secret())?; //! //! // Use the client to publish the DID Document to the IOTA Tangle. -//! let transaction: _ = client.publish_document(&document).await?; +//! document.publish(&client).await?; //! //! // Print the DID Document transaction link. -//! println!("DID Document Transaction > {}", client.transaction_url(&transaction)); +//! let network: Network = document.id().into(); +//! let explore: String = format!("{}/transaction/{}", network.explorer_url(), document.message_id()); +//! +//! println!("DID Document Transaction > {}", explore); //! //! Ok(()) //! }