Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created October 30, 2023 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/7b811ce8ea069649d3eb5ea9dd0b36cf to your computer and use it in GitHub Desktop.
Save bjoerntx/7b811ce8ea069649d3eb5ea9dd0b36cf to your computer and use it in GitHub Desktop.
public IActionResult Validate([FromForm] IFormFile file)
{
if (file == null)
{
return NotFound();
}
byte[] bPDF = GetBytesFromFormFile(file);
var uploadedEnvelope = ExtractEnvelopeFromPDF(bPDF);
if (uploadedEnvelope == null)
{
return NotFound();
}
var envelopes = LoadEnvelopesFromJson();
var envelope = envelopes.FirstOrDefault(e => e.DocumentId == uploadedEnvelope.DocumentId);
if (envelope != null && envelope.SignatureHash == uploadedEnvelope.SignatureHash)
{
return View(true);
}
return View(false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment