From fee516edb2e1aebf6d32ea88ba5c7b5790fcb190 Mon Sep 17 00:00:00 2001 From: tsukino <87639218+0xtsukino@users.noreply.github.com> Date: Thu, 10 Oct 2024 09:23:34 -0400 Subject: [PATCH] fix: check port number for notary url (#31) --- web/utils/index.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/web/utils/index.tsx b/web/utils/index.tsx index 093c743..2c303a5 100644 --- a/web/utils/index.tsx +++ b/web/utils/index.tsx @@ -130,9 +130,6 @@ export async function verify( const notaryUrl = convertNotaryWsToHttp(attestation.meta.notaryUrl); const publicKey = await new NotaryServer(notaryUrl).publicKey(); - if (verifyingKey !== publicKey) - throw new Error(`Notary key doesn't match verifying key`); - return { version: '0.1.0-alpha.7', sent: transcript.sent(), @@ -150,10 +147,11 @@ export async function verify( } export function convertNotaryWsToHttp(notaryWs: string) { - const { protocol, pathname, hostname } = new URL(notaryWs); - const p = protocol === 'wss:' ? 'https:' : 'http'; + const { protocol, pathname, hostname, port } = new URL(notaryWs); + const p = protocol === 'wss:' ? 'https:' : 'http:'; + const pt = port ? `:${port}` : ''; const path = pathname === '/' ? '' : pathname.replace('/notarize', ''); - return p + '//' + hostname + path; + return p + '//' + hostname + pt + path; } function defer(): {