private async Task <IssueAssociatedBlindedAsset> IssueAssociatedAttribute(string schemeName, string content, byte[] blindingPointValue, byte[] blindingPointRoot, string issuer, IStateTransactionsService transactionsService) { byte[] assetId = await _assetsService.GenerateAssetId(schemeName, content, issuer).ConfigureAwait(false); byte[] groupId; if (AttributesSchemes.AttributeSchemes.FirstOrDefault(a => a.Name == schemeName)?.ValueType == AttributeValueType.Date) { groupId = await _identityAttributesService.GetGroupId(schemeName, DateTime.ParseExact(content, "yyyy-MM-dd", null), issuer).ConfigureAwait(false); } else { groupId = schemeName switch { AttributesSchemes.ATTR_SCHEME_NAME_PLACEOFBIRTH => await _identityAttributesService.GetGroupId(schemeName, content, issuer).ConfigureAwait(false), _ => await _identityAttributesService.GetGroupId(schemeName, issuer).ConfigureAwait(false), }; } return(transactionsService.IssueAssociatedAsset(assetId, groupId, blindingPointValue, blindingPointRoot, out byte[] originatingCommitment)); }
private void ProcessIssuingAssociatedAttribute(IdentityAttribute identityAttribute, byte[] blindingPoint, byte[] rootAssetId, IStateTransactionsService transactionsService) { byte[] assetId = _assetsService.GenerateAssetId(identityAttribute.AttributeType, identityAttribute.Content); byte[] groupId = null; switch (identityAttribute.AttributeType) { case AttributeType.PlaceOfBirth: groupId = _identityAttributesService.GetGroupId(identityAttribute.AttributeType, identityAttribute.Content); break; case AttributeType.DateOfBirth: groupId = _identityAttributesService.GetGroupId(identityAttribute.AttributeType, DateTime.ParseExact(identityAttribute.Content, "yyyy-MM-dd", null)); break; default: groupId = _identityAttributesService.GetGroupId(identityAttribute.AttributeType); break; } transactionsService.IssueAssociatedAsset(assetId, groupId, blindingPoint, rootAssetId, out byte[] originatingCommitment); _externalDataAccessService.UpdateAssociatedIdentityAttributeCommitment(identityAttribute.AttributeId, originatingCommitment); }