Esempio n. 1
0
        /// <inheritdoc />
        public virtual async Task <string> CreateSchemaAsync(IAgentContext context, string issuerDid, string name,
                                                             string version, string[] attributeNames)
        {
            var schema = await AnonCreds.IssuerCreateSchemaAsync(issuerDid, name, version, attributeNames.ToJson());

            var schemaRecord = new SchemaRecord
            {
                Id             = schema.SchemaId,
                Name           = name,
                Version        = version,
                AttributeNames = attributeNames
            };

            var paymentInfo = await paymentService.GetTransactionCostAsync(context, TransactionTypes.SCHEMA);

            await LedgerService.RegisterSchemaAsync(context, issuerDid, schema.SchemaJson, paymentInfo);

            await RecordService.AddAsync(context.Wallet, schemaRecord);

            if (paymentInfo != null)
            {
                await RecordService.UpdateAsync(context.Wallet, paymentInfo.PaymentAddress);
            }

            return(schemaRecord.Id);
        }
        /// <inheritdoc />
        public virtual async Task <string> CreateSchemaAsync(Pool pool, Wallet wallet, string issuerDid, string name,
                                                             string version, string[] attributeNames)
        {
            var schema = await AnonCreds.IssuerCreateSchemaAsync(issuerDid, name, version, attributeNames.ToJson());

            var schemaRecord = new SchemaRecord {
                SchemaId = schema.SchemaId
            };

            await LedgerService.RegisterSchemaAsync(pool, wallet, issuerDid, schema.SchemaJson);

            await RecordService.AddAsync(wallet, schemaRecord);

            return(schemaRecord.SchemaId);
        }