public IActionResult CreateIdentity([FromBody] IdentityDto identity) { ulong accountId = ulong.Parse(User.Identity.Name, CultureInfo.InvariantCulture); StatePersistency statePersistency = _executionContextManager.ResolveStateExecutionServices(accountId); Account account = _accountsService.GetById(accountId); byte[] assetId = _assetsService.GenerateAssetId((AttributeType)identity.RootAttribute.AttributeType, identity.RootAttribute.Content); statePersistency.TransactionsService.IssueBlindedAsset(assetId, 0UL.ToByteArray(32), out byte[] originatingCommitment); identity.RootAttribute.OriginatingCommitment = originatingCommitment.ToHexString(); Identity identityDb = _externalDataAccessService.CreateIdentity(accountId, identity.Description, new IdentityAttribute { AttributeType = AttributeType.IdCard, Content = identity.RootAttribute.Content, Subject = ClaimSubject.User, Commitment = originatingCommitment }); identity.Id = identityDb.IdentityId.ToString(CultureInfo.InvariantCulture); string imageContent = null; foreach (var identityAttributeDto in identity.AssociatedAttributes) { IdentityAttribute identityAttribute = new IdentityAttribute { AttributeType = (AttributeType)identityAttributeDto.AttributeType, Content = identityAttributeDto.Content, Subject = ClaimSubject.User }; _externalDataAccessService.AddAssociatedIdentityAttribute(identityDb.IdentityId, ref identityAttribute); if (((AttributeType)identityAttributeDto.AttributeType) == AttributeType.PassportPhoto) { imageContent = identityAttributeDto.Content; } } if (!string.IsNullOrEmpty(identity.RootAttribute.Content) && !string.IsNullOrEmpty(imageContent)) { $"{Request.Scheme}://{Request.Host.ToUriComponent()}/biometric/".AppendPathSegment("RegisterPerson").PostJsonAsync(new BiometricPersonDataDto { Requester = account.PublicSpendKey.ToHexString(), PersonData = identity.RootAttribute.Content, ImageString = imageContent }); } _hubContext.Clients.Group(User.Identity.Name).SendAsync("PushIdentity", identity); return(Ok()); }