createIdentity = async (options = {}) => {
    options.keystore = keystore
    const DefaultIdentityProvider = getIdentityProvider('publickey')
    const identityProviderInit = options.provider || DefaultIdentityProvider({ keystore })

    const identityProvider = await identityProviderInit()

    if (!getIdentityProvider(identityProvider.type)) {
      throw new Error('Identity provider is unknown. Use useIdentityProvider(provider) to register the identity provider')
    }

    const id = await identityProvider.getId(options)
    const privateKey = await keystore.getKey(id) || await keystore.createKey(id)
    const publicKey = keystore.getPublic(privateKey)
    const idSignature = await signMessage(privateKey, id)
    const publicKeyAndIdSignature = await identityProvider.signIdentity(publicKey + idSignature, options)
    const signatures = {
      id: idSignature,
      publicKey: publicKeyAndIdSignature
    }

    const identity = await Identity({ id, publicKey, signatures, type: identityProvider.type, sign, verify })

    await storage.put(identity.hash, identity.bytes)

    return identity
  }
Creates an identity, adding it to storage.
@param {Object} options Various options for configuring a new identity.
@param {Function} [options.provider=PublicKeyIdentityProvider()] An instance of the Provider to use for generating an identity, e.g. PublicKeyIdentityProvider({ keystore })
@return {module:Identities~Identity} An instance of identity.
@memberof module:Identities~Identities
@instance