Identity = async ({ id, publicKey, signatures, type, sign, verify } = {}) => {
  /**
   * @description The Identity instance. Returned by
   * [Identities.createIdentity()]{@link module:Identities~Identities#createIdentity}.
   */
  if (!id) throw new Error('Identity id is required')
  if (!publicKey) throw new Error('Invalid public key')
  if (!signatures) throw new Error('Signatures object is required')
  if (!signatures.id) throw new Error('Signature of id is required')
  if (!signatures.publicKey) throw new Error('Signature of publicKey+id is required')
  if (!type) throw new Error('Identity type is required')

  signatures = Object.assign({}, signatures)

  const identity = {
    id,
    publicKey,
    signatures,
    type,
    sign,
    verify
  }

  const { hash, bytes } = await _encodeIdentity(identity)
  identity.hash = hash
  identity.bytes = bytes

  return identity
}
@typedef {Object} module:Identities~Identity
@property {string} id A unique identifer for the identity.
@property {object} publicKey A public key.
@property {object} signatures A signed identity id and public key.
@property {string} type The type of identity provider.
@property {function} sign A sign function to sign data using this identity.
@property {function} verify A verify function to verify data signed by this identity.