This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements methods
- Loading branch information
Showing
18 changed files
with
102 additions
and
326 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
src/Hyperledger.Aries/Anoncreds/Presentation/DefaultPresentationService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using anoncreds_rs_dotnet.Models; | ||
using System.Threading.Tasks; | ||
using System.Collections.Generic; | ||
using anoncreds_rs_dotnet.Anoncreds; | ||
using Hyperledger.Aries.Features.IssueCredential; | ||
using Hyperledger.Aries.Agents; | ||
using Hyperledger.Aries.Contracts; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace Hyperledger.Aries.Anoncreds.Presentation | ||
{ | ||
public class DefaultPresentationService : IPresentationService | ||
{ | ||
ISchemaService schemaService; | ||
ILedgerService ledgerService; | ||
|
||
public async Task<bool> VerifyPresentationAsync(IAgentContext context, string presReqJson, string presentationJson) | ||
{ | ||
var presentation = PresentationApi.CreatePresentationFromJsonAsync(presentationJson); | ||
var presentationRequest = PresentationRequestApi.CreatePresReqFromJsonAsync(presReqJson); | ||
|
||
List<string> schemaIds = new List<string>(), credentialDefinitionIds = new List<string>(), revocationRegistryDefinitionIds = new List<string>(); | ||
var schemas = new List<Schema>(); | ||
var credentialDefinitions = new List<CredentialDefinition>(); | ||
var revocationRegistryDefinitions = new List<RevocationRegistryDefinition>(); | ||
var revocationStatusList = new List<RevocationStatusList>(); | ||
|
||
foreach (var identifier in presentation.Result.Identifiers) | ||
{ | ||
schemaIds.Add(identifier.SchemaId.ToString()); | ||
credentialDefinitionIds.Add(identifier.CredentialDefinitionId.ToString()); | ||
revocationRegistryDefinitionIds.Add(identifier.RevocationRegistryId.ToString()); | ||
|
||
var schema = await schemaService.LookupSchemaAsync(context, identifier.SchemaId.ToString()); | ||
schemas.Add(new Schema { JsonString = schema }) ; | ||
|
||
var credentialDef = await schemaService.LookupCredentialDefinitionAsync(context, identifier.CredentialDefinitionId.ToString()); | ||
credentialDefinitions.Add(new CredentialDefinition { JsonString = credentialDef }); | ||
|
||
var revRegDefinition = await ledgerService.LookupRevocationRegistryDefinitionAsync(context, identifier.RevocationRegistryId.ToString()); | ||
revocationRegistryDefinitions.Add(new RevocationRegistryDefinition { JsonString = revRegDefinition.ObjectJson }); | ||
|
||
var revocationStatus = await ledgerService.LookupRevocationRegistryAsync(context, identifier.RevocationRegistryId.ToString(), identifier.Timestamp); | ||
revocationStatusList.Add(new RevocationStatusList { JsonString = revocationStatus.ObjectJson }); | ||
} | ||
return await PresentationApi.VerifyPresentationAsync(presentation.Result, presentationRequest.Result, schemas, schemaIds, credentialDefinitions, credentialDefinitionIds, revocationRegistryDefinitions, revocationRegistryDefinitionIds, revocationStatusList); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Hyperledger.Aries/Anoncreds/Presentation/IPresentationService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using anoncreds_rs_dotnet.Models; | ||
using Hyperledger.Aries.Agents; | ||
using System.Threading.Tasks; | ||
|
||
namespace Hyperledger.Aries.Anoncreds.Presentation | ||
{ | ||
public interface IPresentationService | ||
{ | ||
Task<bool> VerifyPresentationAsync(IAgentContext context, string presReqJson, string presentationJson); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
...cation/Abstractions/IRevocationService.cs → ...noncreds/Revocation/IRevocationService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/Hyperledger.Aries/Anoncreds/Schema/DefaultSchemaService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using anoncreds_rs_dotnet.Anoncreds; | ||
using anoncreds_rs_dotnet.Models; | ||
using Hyperledger.Aries.Agents; | ||
using Hyperledger.Aries.Contracts; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Hyperledger.Aries.Anoncreds.AnoncredsSchema | ||
{ | ||
public class DefaultSchemaService : ISchemaService | ||
{ | ||
public readonly ILedgerService LedgerService; | ||
public async Task CreateAndRegisterSchemaAsync(IAgentContext context, string issuerDid, string schemaName, string schemaVersion, List<string> attrNames) | ||
{ | ||
var schemaJson = await SchemaApi.CreateSchemaJsonAsync(issuerDid, schemaName, schemaVersion, attrNames); | ||
|
||
await LedgerService.RegisterSchemaAsync(context, issuerDid, schemaJson); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using anoncreds_rs_dotnet.Models; | ||
using Hyperledger.Aries.Agents; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace Hyperledger.Aries.Anoncreds.AnoncredsSchema | ||
{ | ||
public interface ISchemaService | ||
{ | ||
Task CreateAndRegisterSchemaAsync(IAgentContext context, string issuerDid, string schemaName, string schemaVersion, List<string> attrNames); | ||
} | ||
} |
47 changes: 0 additions & 47 deletions
47
src/Hyperledger.Aries/Revocation/DefaultRegistryService.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
src/Hyperledger.Aries/Revocation/Models/BaseAnonCredsRegistrar.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
src/Hyperledger.Aries/Revocation/Models/RevRegDefResult.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
src/Hyperledger.Aries/Revocation/Models/RevRegDefinitionState.cs
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/Hyperledger.Aries/Revocation/Utils/AnonCredsRegistrationError.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.