get

get()

Returns the current identity.

Return type:

IdKeystore

Note

Throws Error('cannot get identity with no session') if called before an identity has been established. Call check() first if you’re not sure, or waitForSession() if you just need to wait for one.

Example

const identity = require('dcp/identity');

if (identity.check()) {
  const ks = identity.get();
  console.log('Logged in as', ks.address);
}