In this tutorial we will retrieve the identity created in the Register an Identity tutorial.
`const Hellar = require('hellar');
const client = new Hellar.Client({ network: 'mainnet' });
const retrieveIdentity = async () => { return client.platform.identities.get('an identity ID goes here'); };
retrieveIdentity() .then((d) => console.log('Identity retrieved:\n', d.toJSON())) .catch((e) => console.error('Something went wrong:\n', e)) .finally(() => client.disconnect());`
The following example response shows a retrieved identity:
{ "protocolVersion":0, "id":"6Jz8pFZFhssKSTacgQmZP14zGZNnFYZFKSbx4WVAJFy3", "publicKeys":[ { "id":0, "type":0, "data":"A4zZl0EaRBB6IlDbyR80YUM2l02qqNUCoIizkQxubtxi" } ], "balance":10997588, "revision":0 }
After we initialize the Client, we request an identity. The platform.identities.get
method takes a single argument: an identity ID. After the identity is retrieved, it is displayed on the console.