Skip to content

Commit

Permalink
Update validation checks
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbod committed Sep 28, 2023
1 parent 3ed7bdf commit 6530c28
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
19 changes: 13 additions & 6 deletions src/CompanyXHumanResources/DiplomaVerifyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public class DiplomaVerifyService
/// </summary>
public readonly List<SelectListItem> TrustedUniversities = new List<SelectListItem>
{
new SelectListItem { Text ="University SSI Schweiz SSI FH", Value="did:web:peaceful-booth-zrpufxfp6l3c.connect.trinsic.cloud:zV9t25XybyBV7qEB1v6u9Bb"}
new SelectListItem { Text ="University SSI Schweiz SSI", Value="did:web:peaceful-booth-zrpufxfp6l3c.connect.trinsic.cloud:zV9t25XybyBV7qEB1v6u9Bb"}
};

public readonly List<SelectListItem> TrustedCredentials = new List<SelectListItem>
{
new SelectListItem { Text ="University SSI Schweiz SSI", Value= "https://schema.trinsic.cloud/peaceful-booth-zrpufxfp6l3c/diploma-credential-for-swiss-self-sovereign-identity-ssi"},
new SelectListItem { Text ="University FH Basel, Schweiz", Value= "https://schema.trinsic.cloud/peaceful-booth-zrpufxfp6l3c/fh-basel-ux-engineer"}
new SelectListItem { Text ="University SSI Schweiz SSI Diploma", Value= "https://schema.trinsic.cloud/peaceful-booth-zrpufxfp6l3c/diploma-credential-for-swiss-self-sovereign-identity-ssi"},
new SelectListItem { Text ="FH Basel UX Engineer Diploma", Value= "https://schema.trinsic.cloud/peaceful-booth-zrpufxfp6l3c/fh-basel-ux-engineer"}
};

public DiplomaVerifyService(TrinsicService trinsicService, IConfiguration configuration)
Expand All @@ -31,7 +31,7 @@ public DiplomaVerifyService(TrinsicService trinsicService, IConfiguration config
_configuration = configuration;
}

public async Task<(VerifyProofResponse? Proof, bool IsValid)> Verify(string studentProof, string universityCredentialScheme)
public async Task<(VerifyProofResponse? Proof, bool IsValid)> Verify(string studentProof, string universityIssuer)
{
// Verifiers auth token
// Auth token from trinsic.id root API KEY provider
Expand All @@ -44,13 +44,20 @@ public DiplomaVerifyService(TrinsicService trinsicService, IConfiguration config

var jsonObject = JsonNode.Parse(studentProof)!;
var credentialSchemaId = jsonObject["credentialSchema"]!["id"];
var issuer = jsonObject["issuer"];

// We need to check if the SchemeUri is once we trust
if(universityCredentialScheme != credentialSchemaId!.ToString())
// check issuer
if (universityIssuer != issuer!.ToString())
{
return (null, false);
}

// Do we need to check if the SchemeUri is once we trust
//if (universityCredentialScheme != credentialSchemaId!.ToString())
//{
// return (null, false);
//}

return (verifyProofResponse, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public VerifyStudentDiplomaModel(DiplomaVerifyService diplomaVerifyService)

public void OnGet()
{
Universities = _diplomaVerifyService.TrustedCredentials;
Universities = _diplomaVerifyService.TrustedUniversities;
}

public async Task OnPostAsync()
Expand Down
1 change: 0 additions & 1 deletion src/TrinsicV2WebWallet/GenerateProofService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public async Task<List<SelectListItem>> GetItemsInWallet(string userAuthToken)
break;
}
}
//var issuer = jsonObject["data"]!["issuer"];

results.Add(new SelectListItem(vc, id!.ToString()));
}
Expand Down

0 comments on commit 6530c28

Please sign in to comment.