feature: fetch public key from notaryUrl in proof on upload

This commit is contained in:
Tanner Shaw
2024-03-21 10:37:30 -07:00
parent 9ef42e2c41
commit 51dc0ef351
2 changed files with 8 additions and 2 deletions

View File

@@ -33,7 +33,13 @@ export default function FileDrop(): ReactElement {
let verifiedProof: Proof;
const proofContent = await readFileAsync(file);
try {
verifiedProof = await verify(JSON.parse(proofContent), notaryKey);
let pubKey: any;
if (JSON.parse(proofContent).notaryUrl) {
const notaryFetch = await fetch(JSON.parse(proofContent).notaryUrl + '/info');
const notaryData = await notaryFetch.json();
pubKey = notaryData.publicKey;
}
verifiedProof = await verify(JSON.parse(proofContent), pubKey || notaryKey);
setVerifiedProof(verifiedProof);
} catch(e) {
setError(e as string);

View File

@@ -27,7 +27,7 @@ export default function SharedProof(): ReactElement {
}
const data = await response.json();
try {
let pubKey;
let pubKey: any;
if (data.notaryUrl) {
const notaryFetch = await fetch(data.notaryUrl + '/info');
const notaryData = await notaryFetch.json();