mirror of
https://github.com/tlsnotary/tlsn-extension.git
synced 2026-01-09 21:18:02 -05:00
chore: remove Max transcript size and refactor to use constants (#106)
* chore: refactor to use constants * chore: remove stale max_transcript_size closes #105
This commit is contained in:
@@ -119,7 +119,6 @@ export type RequestHistory = {
|
||||
method: string;
|
||||
headers: { [key: string]: string };
|
||||
body?: string;
|
||||
maxTranscriptSize: number;
|
||||
maxSentData: number;
|
||||
maxRecvData: number;
|
||||
notaryUrl: string;
|
||||
@@ -328,7 +327,6 @@ async function handleProveRequestStart(
|
||||
method,
|
||||
headers,
|
||||
body,
|
||||
maxTranscriptSize,
|
||||
maxSentData,
|
||||
maxRecvData,
|
||||
notaryUrl,
|
||||
@@ -344,7 +342,6 @@ async function handleProveRequestStart(
|
||||
body,
|
||||
maxSentData,
|
||||
maxRecvData,
|
||||
maxTranscriptSize,
|
||||
notaryUrl,
|
||||
websocketProxyUrl,
|
||||
secretHeaders,
|
||||
@@ -369,7 +366,6 @@ async function handleProveRequestStart(
|
||||
method,
|
||||
headers,
|
||||
body,
|
||||
maxTranscriptSize,
|
||||
maxSentData,
|
||||
maxRecvData,
|
||||
notaryUrl,
|
||||
@@ -399,14 +395,12 @@ async function runPluginProver(request: BackgroundAction, now = Date.now()) {
|
||||
const websocketProxyUrl = _websocketProxyUrl || (await getProxyApi());
|
||||
const maxSentData = _maxSentData || (await getMaxSent());
|
||||
const maxRecvData = _maxRecvData || (await getMaxRecv());
|
||||
const maxTranscriptSize = 16384;
|
||||
|
||||
const { id } = await addNotaryRequest(now, {
|
||||
url,
|
||||
method,
|
||||
headers,
|
||||
body,
|
||||
maxTranscriptSize,
|
||||
notaryUrl,
|
||||
websocketProxyUrl,
|
||||
maxRecvData,
|
||||
@@ -433,7 +427,6 @@ async function runPluginProver(request: BackgroundAction, now = Date.now()) {
|
||||
method,
|
||||
headers,
|
||||
body,
|
||||
maxTranscriptSize,
|
||||
notaryUrl,
|
||||
websocketProxyUrl,
|
||||
maxRecvData,
|
||||
@@ -808,7 +801,6 @@ async function handleNotarizeRequest(request: BackgroundAction) {
|
||||
body,
|
||||
maxSentData = await getMaxSent(),
|
||||
maxRecvData = await getMaxRecv(),
|
||||
maxTranscriptSize,
|
||||
notaryUrl = await getNotaryApi(),
|
||||
websocketProxyUrl = await getProxyApi(),
|
||||
origin,
|
||||
@@ -823,7 +815,6 @@ async function handleNotarizeRequest(request: BackgroundAction) {
|
||||
body,
|
||||
maxSentData,
|
||||
maxRecvData,
|
||||
maxTranscriptSize,
|
||||
notaryUrl,
|
||||
websocketProxyUrl,
|
||||
metadata,
|
||||
@@ -866,7 +857,6 @@ async function handleNotarizeRequest(request: BackgroundAction) {
|
||||
method,
|
||||
headers,
|
||||
body,
|
||||
maxTranscriptSize,
|
||||
maxSentData,
|
||||
maxRecvData,
|
||||
notaryUrl,
|
||||
|
||||
@@ -47,7 +47,6 @@ class TLSN {
|
||||
websocketProxyUrl?: string;
|
||||
maxSentData?: number;
|
||||
maxRecvData?: number;
|
||||
maxTranscriptSize?: number;
|
||||
metadata?: {
|
||||
[k: string]: string;
|
||||
};
|
||||
@@ -60,7 +59,6 @@ class TLSN {
|
||||
body: requestOptions?.body,
|
||||
maxSentData: proofOptions?.maxSentData,
|
||||
maxRecvData: proofOptions?.maxRecvData,
|
||||
maxTranscriptSize: proofOptions?.maxTranscriptSize,
|
||||
notaryUrl: proofOptions?.notaryUrl,
|
||||
websocketProxyUrl: proofOptions?.websocketProxyUrl,
|
||||
metadata: proofOptions?.metadata,
|
||||
|
||||
@@ -84,7 +84,6 @@ import { urlify } from '../../utils/misc';
|
||||
websocketProxyUrl?: string;
|
||||
maxSentData?: number;
|
||||
maxRecvData?: number;
|
||||
maxTranscriptSize?: number;
|
||||
}>,
|
||||
) => {
|
||||
const {
|
||||
@@ -94,7 +93,6 @@ import { urlify } from '../../utils/misc';
|
||||
body,
|
||||
maxSentData,
|
||||
maxRecvData,
|
||||
maxTranscriptSize,
|
||||
notaryUrl,
|
||||
websocketProxyUrl,
|
||||
metadata,
|
||||
@@ -112,7 +110,6 @@ import { urlify } from '../../utils/misc';
|
||||
body,
|
||||
maxSentData,
|
||||
maxRecvData,
|
||||
maxTranscriptSize,
|
||||
notaryUrl,
|
||||
websocketProxyUrl,
|
||||
metadata,
|
||||
|
||||
@@ -19,8 +19,6 @@ import {
|
||||
} from '../../utils/storage';
|
||||
import { useDispatch } from 'react-redux';
|
||||
|
||||
const maxTranscriptSize = 16384;
|
||||
|
||||
export default function Notarize(): ReactElement {
|
||||
const params = useParams<{ requestId: string }>();
|
||||
const req = useRequest(params.requestId);
|
||||
@@ -58,7 +56,6 @@ export default function Notarize(): ReactElement {
|
||||
body: req.requestBody,
|
||||
maxSentData,
|
||||
maxRecvData,
|
||||
maxTranscriptSize,
|
||||
notaryUrl,
|
||||
websocketProxyUrl,
|
||||
secretHeaders,
|
||||
|
||||
@@ -192,7 +192,6 @@ export default function RequestBuilder(props?: {
|
||||
maxRecvData,
|
||||
secretHeaders: [],
|
||||
secretResps: [],
|
||||
maxTranscriptSize: 0,
|
||||
notaryUrl,
|
||||
websocketProxyUrl,
|
||||
},
|
||||
|
||||
@@ -69,7 +69,6 @@ export const notarizeRequest = (options: RequestHistory) => async () => {
|
||||
method: options.method,
|
||||
headers: options.headers,
|
||||
body: options.body,
|
||||
maxTranscriptSize: options.maxTranscriptSize,
|
||||
maxSentData,
|
||||
maxRecvData,
|
||||
secretHeaders: options.secretHeaders,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const EXPLORER_API = 'https://explorer.tlsnotary.org';
|
||||
export const NOTARY_API = 'https://notary.pse.dev/v0.1.0-alpha.5';
|
||||
export const NOTARY_API = 'https://notary.pse.dev/v0.1.0-alpha.7';
|
||||
export const NOTARY_PROXY = 'wss://notary.pse.dev/proxy';
|
||||
export const MAX_RECV = 16384;
|
||||
export const MAX_SENT = 4096;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { LoggingLevel } from 'tlsn-js';
|
||||
import { MAX_RECV, MAX_SENT, NOTARY_API, NOTARY_PROXY } from './constants';
|
||||
|
||||
export const NOTARY_API_LS_KEY = 'notary-api';
|
||||
export const PROXY_API_LS_KEY = 'proxy-api';
|
||||
@@ -18,19 +19,19 @@ export async function get(key: string, defaultValue?: string) {
|
||||
}
|
||||
|
||||
export async function getMaxSent() {
|
||||
return parseInt(await get(MAX_SENT_LS_KEY, '4096'));
|
||||
return parseInt(await get(MAX_SENT_LS_KEY, MAX_SENT.toString()));
|
||||
}
|
||||
|
||||
export async function getMaxRecv() {
|
||||
return parseInt(await get(MAX_RECEIVED_LS_KEY, '16384'));
|
||||
return parseInt(await get(MAX_RECEIVED_LS_KEY, MAX_RECV.toString()));
|
||||
}
|
||||
|
||||
export async function getNotaryApi() {
|
||||
return await get(NOTARY_API_LS_KEY, 'https://notary.pse.dev/v0.1.0-alpha.7');
|
||||
return await get(NOTARY_API_LS_KEY, NOTARY_API);
|
||||
}
|
||||
|
||||
export async function getProxyApi() {
|
||||
return await get(PROXY_API_LS_KEY, 'wss://notary.pse.dev/proxy');
|
||||
return await get(PROXY_API_LS_KEY, NOTARY_PROXY);
|
||||
}
|
||||
|
||||
export async function getLoggingFilter(): Promise<LoggingLevel> {
|
||||
|
||||
Reference in New Issue
Block a user