Skip to content

Commit 08520a9

Browse files
authored
chore: update to alpha.10 (#177)
1 parent 264128d commit 08520a9

File tree

5 files changed

+51
-54
lines changed

5 files changed

+51
-54
lines changed

package-lock.json

Lines changed: 10 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tlsn-extension",
3-
"version": "0.1.0.900",
3+
"version": "0.1.0.1000",
44
"license": "MIT",
55
"repository": {
66
"type": "git",
@@ -40,8 +40,7 @@
4040
"redux-logger": "^3.0.6",
4141
"redux-thunk": "^2.4.2",
4242
"tailwindcss": "^3.3.3",
43-
"tlsn-js": "0.1.0-alpha.9",
44-
"tlsn-js-v5": "npm:[email protected]"
43+
"tlsn-js": "0.1.0-alpha.10.0"
4544
},
4645
"devDependencies": {
4746
"@babel/core": "^7.20.12",

src/entries/Offscreen/rpc.ts

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import * as Comlink from 'comlink';
1919
import { PresentationJSON as PresentationJSONa7 } from 'tlsn-js/build/types';
2020
import { OffscreenActionTypes } from './types';
2121
import { PresentationJSON } from '../../utils/types';
22-
import { verify } from 'tlsn-js-v5';
2322
import { waitForEvent } from '../utils';
2423
import {
2524
setNotaryRequestError,
@@ -37,7 +36,10 @@ export const initThreads = async () => {
3736
type: BackgroundActiontype.get_logging_level,
3837
hardwareConcurrency: navigator.hardwareConcurrency,
3938
});
40-
await init({ loggingLevel });
39+
await init({
40+
loggingLevel,
41+
hardwareConcurrency: navigator.hardwareConcurrency,
42+
});
4143
};
4244
export const onNotarizationRequest = async (request: any) => {
4345
const { id } = request.data;
@@ -536,36 +538,47 @@ async function verifyProof(proof: PresentationJSON): Promise<{
536538
};
537539

538540
switch (proof.version) {
539-
case undefined: {
540-
result = await verify(proof);
541-
break;
542-
}
541+
case undefined:
543542
case '0.1.0-alpha.7':
544543
case '0.1.0-alpha.8':
545544
case '0.1.0-alpha.9':
546-
const presentation: TPresentation = await new Presentation(proof.data);
547-
const verifierOutput = await presentation.verify();
548-
const transcript = new Transcript({
549-
sent: verifierOutput.transcript.sent,
550-
recv: verifierOutput.transcript.recv,
551-
});
552-
const vk = await presentation.verifyingKey();
553-
const verifyingKey = Buffer.from(vk.data).toString('hex');
554-
const notaryUrl = proof.meta.notaryUrl
555-
? convertNotaryWsToHttp(proof.meta.notaryUrl)
556-
: '';
557-
const publicKey = await new NotaryServer(notaryUrl)
558-
.publicKey()
559-
.catch(() => '');
560545
result = {
561-
sent: transcript.sent(),
562-
recv: transcript.recv(),
563-
verifierKey: verifyingKey,
564-
notaryKey: publicKey,
546+
sent: 'version not supported',
547+
recv: 'version not supported',
565548
};
566549
break;
550+
case '0.1.0-alpha.10':
551+
result = await verify(proof);
552+
break;
567553
}
568-
return result;
554+
555+
return result!;
556+
}
557+
558+
async function verify(proof: PresentationJSON) {
559+
if (proof.version !== '0.1.0-alpha.10') {
560+
throw new Error('wrong version');
561+
}
562+
const presentation: TPresentation = await new Presentation(proof.data);
563+
const verifierOutput = await presentation.verify();
564+
const transcript = new Transcript({
565+
sent: verifierOutput.transcript.sent,
566+
recv: verifierOutput.transcript.recv,
567+
});
568+
const vk = await presentation.verifyingKey();
569+
const verifyingKey = Buffer.from(vk.data).toString('hex');
570+
const notaryUrl = proof.meta.notaryUrl
571+
? convertNotaryWsToHttp(proof.meta.notaryUrl)
572+
: '';
573+
const publicKey = await new NotaryServer(notaryUrl)
574+
.publicKey()
575+
.catch(() => '');
576+
return {
577+
sent: transcript.sent(),
578+
recv: transcript.recv(),
579+
verifierKey: verifyingKey,
580+
notaryKey: publicKey,
581+
};
569582
}
570583

571584
function updateRequestProgress(

src/pages/PeerToPeer/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import browser from 'webextension-polyfill';
3838
import { sha256 } from '../../utils/misc';
3939
import { openSidePanel } from '../../entries/utils';
4040
import { SidePanelActionTypes } from '../../entries/SidePanel/types';
41-
import { verify } from 'tlsn-js-v5';
4241
import ProofViewer from '../ProofViewer';
4342

4443
export function P2PHome(): ReactElement {

src/utils/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const EXPLORER_API = 'https://explorer.tlsnotary.org';
2-
export const NOTARY_API = 'https://notary.pse.dev/v0.1.0-alpha.9';
2+
export const NOTARY_API = 'https://notary.pse.dev/v0.1.0-alpha.10';
33
export const RENDEZVOUS_API = 'wss://explorer.tlsnotary.org';
44
export const NOTARY_PROXY = 'wss://notary.pse.dev/proxy';
55
export const MAX_RECV = 16384;

0 commit comments

Comments
 (0)