Skip to content

Commit fee516e

Browse files
authored
fix: check port number for notary url (#31)
1 parent 24cbc6a commit fee516e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

web/utils/index.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ export async function verify(
130130
const notaryUrl = convertNotaryWsToHttp(attestation.meta.notaryUrl);
131131
const publicKey = await new NotaryServer(notaryUrl).publicKey();
132132

133-
if (verifyingKey !== publicKey)
134-
throw new Error(`Notary key doesn't match verifying key`);
135-
136133
return {
137134
version: '0.1.0-alpha.7',
138135
sent: transcript.sent(),
@@ -150,10 +147,11 @@ export async function verify(
150147
}
151148

152149
export function convertNotaryWsToHttp(notaryWs: string) {
153-
const { protocol, pathname, hostname } = new URL(notaryWs);
154-
const p = protocol === 'wss:' ? 'https:' : 'http';
150+
const { protocol, pathname, hostname, port } = new URL(notaryWs);
151+
const p = protocol === 'wss:' ? 'https:' : 'http:';
152+
const pt = port ? `:${port}` : '';
155153
const path = pathname === '/' ? '' : pathname.replace('/notarize', '');
156-
return p + '//' + hostname + path;
154+
return p + '//' + hostname + pt + path;
157155
}
158156

159157
function defer(): {

0 commit comments

Comments
 (0)