mirror of
https://github.com/tlsnotary/tlsn-js.git
synced 2026-01-09 15:07:59 -05:00
Update to tlsnotary v0.1.0-alpha.10 (#104)
* Update to tlsnotary v0.1.0-alpha.10 * Prove data from GitHub server instead of swapi in tests * Log browser messages during test execution
This commit is contained in:
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
RELEASE_MODE: 'dry-run' # dry-run by default, will be set to 'publish' for release builds
|
||||
services:
|
||||
notary-server:
|
||||
image: ghcr.io/tlsnotary/tlsn/notary-server:v0.1.0-alpha.9
|
||||
image: ghcr.io/tlsnotary/tlsn/notary-server:v0.1.0-alpha.10
|
||||
env:
|
||||
NOTARY_SERVER__TLS__ENABLED: false
|
||||
ports:
|
||||
|
||||
@@ -25,6 +25,6 @@ tracing-subscriber = { version ="0.3.18", features = ["env-filter"] }
|
||||
uuid = { version = "1.4.1", features = ["v4", "fast-rng"] }
|
||||
ws_stream_tungstenite = { version = "0.13", features = ["tokio_io"] }
|
||||
|
||||
tlsn-core = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.9", package = "tlsn-core" }
|
||||
tlsn-prover = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.9", package = "tlsn-prover" }
|
||||
tlsn-common = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.9", package = "tlsn-common" }
|
||||
tlsn-core = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.10", package = "tlsn-core" }
|
||||
tlsn-prover = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.10", package = "tlsn-prover" }
|
||||
tlsn-common = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.10", package = "tlsn-common" }
|
||||
@@ -32,7 +32,7 @@ tracing = "0.1.40"
|
||||
tracing-subscriber = { version ="0.3.18", features = ["env-filter"] }
|
||||
ws_stream_tungstenite = { version = "0.13", features = ["tokio_io"] }
|
||||
|
||||
tlsn-core = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.9", package = "tlsn-core" }
|
||||
tlsn-verifier = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.9", package = "tlsn-verifier" }
|
||||
tlsn-common = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.9", package = "tlsn-common" }
|
||||
tlsn-core = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.10", package = "tlsn-core" }
|
||||
tlsn-verifier = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.10", package = "tlsn-verifier" }
|
||||
tlsn-common = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.10", package = "tlsn-common" }
|
||||
tower-util = "0.3.1"
|
||||
|
||||
@@ -26,7 +26,7 @@ root.render(<App />);
|
||||
const local = true; // Toggle between local and remote notary
|
||||
const notaryUrl = local
|
||||
? 'http://localhost:7047'
|
||||
: 'https://notary.pse.dev/v0.1.0-alpha.9';
|
||||
: 'https://notary.pse.dev/v0.1.0-alpha.10';
|
||||
const websocketProxyUrl = local
|
||||
? 'ws://localhost:55688'
|
||||
: 'wss://notary.pse.dev/proxy?token=swapi.dev';
|
||||
|
||||
3439
demo/web-to-web-p2p/pnpm-lock.yaml
generated
3439
demo/web-to-web-p2p/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
12
package-lock.json
generated
12
package-lock.json
generated
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "tlsn-js",
|
||||
"version": "0.1.0-alpha.9.1",
|
||||
"version": "0.1.0-alpha.10.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "tlsn-js",
|
||||
"version": "0.1.0-alpha.9.1",
|
||||
"version": "0.1.0-alpha.10.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"tlsn-wasm": "0.1.0-alpha.9"
|
||||
"tlsn-wasm": "0.1.0-alpha.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^10.0.6",
|
||||
@@ -11687,9 +11687,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/tlsn-wasm": {
|
||||
"version": "0.1.0-alpha.9",
|
||||
"resolved": "https://registry.npmjs.org/tlsn-wasm/-/tlsn-wasm-0.1.0-alpha.9.tgz",
|
||||
"integrity": "sha512-/7DKVXzFdlzD9vwsROb/tvGHJ+xHlAbvaVjMGBWOrecG5KR+Dcg6QMSb4R0/2jePX6u8r6JNXbRpKgQ+yf1zaA==",
|
||||
"version": "0.1.0-alpha.10",
|
||||
"resolved": "https://registry.npmjs.org/tlsn-wasm/-/tlsn-wasm-0.1.0-alpha.10.tgz",
|
||||
"integrity": "sha512-HgGLmaxyw18v34hxAOnVc9P/HuEjVuQeb/6TcskaSHGFOY2t2pjWBz93toinEAD2N1LwVQJXoECxsP5Qo81Haw==",
|
||||
"license": "MIT OR Apache-2.0"
|
||||
},
|
||||
"node_modules/to-buffer": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tlsn-js",
|
||||
"version": "0.1.0-alpha.9.1",
|
||||
"version": "0.1.0-alpha.10.0",
|
||||
"description": "",
|
||||
"repository": "https://github.com/tlsnotary/tlsn-js",
|
||||
"main": "build/lib.js",
|
||||
@@ -16,7 +16,7 @@
|
||||
"build:src": "webpack --config webpack.build.config.js",
|
||||
"build:types": "tsc --project tsconfig.compile.json",
|
||||
"build:lib": "NODE_ENV=production concurrently npm:build:src npm:build:types",
|
||||
"build:wasm": "sh tlsn-wasm/build.sh v0.1.0-alpha.9",
|
||||
"build:wasm": "sh tlsn-wasm/build.sh v0.1.0-alpha.10",
|
||||
"build": "npm run build:lib",
|
||||
"watch:dev": "webpack --config webpack.web.dev.config.js --watch",
|
||||
"dev": "concurrently npm:watch:dev npm:serve:test",
|
||||
@@ -26,7 +26,7 @@
|
||||
"run:spec": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha -r ts-node/register 'test/specs/*.ts'",
|
||||
"run:e2e": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha -r ts-node/register 'test/testRunner.ts'",
|
||||
"test": "npm run build:test && npm run run:e2e",
|
||||
"notary": "docker run --platform=linux/amd64 -p 7047:7047 --rm ghcr.io/tlsnotary/tlsn/notary-server:v0.1.0-alpha.9 notary-server --tls-enabled=false"
|
||||
"notary": "docker run --platform=linux/amd64 -p 7047:7047 --rm ghcr.io/tlsnotary/tlsn/notary-server:v0.1.0-alpha.10 notary-server --tls-enabled=false"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^10.0.6",
|
||||
@@ -71,6 +71,6 @@
|
||||
"node": ">= 16.20.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"tlsn-wasm": "0.1.0-alpha.9"
|
||||
"tlsn-wasm": "0.1.0-alpha.10"
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ For this demo, we also need to run a local notary server.
|
||||
* Or, compile and run the notary server natively:
|
||||
```sh
|
||||
# Clone the TLSNotary repository:
|
||||
git clone https://github.com/tlsnotary/tlsn.git --branch "v0.1.0-alpha.9"
|
||||
git clone https://github.com/tlsnotary/tlsn.git --branch "v0.1.0-alpha.10"
|
||||
cd tlsn/crates/notary/server/
|
||||
# Run the ntoary server
|
||||
cargo run --release -- --tls-enabled false
|
||||
|
||||
@@ -128,7 +128,7 @@ export class Prover {
|
||||
const presentation = build_presentation(attestation, secrets, commit);
|
||||
|
||||
return {
|
||||
version: '0.1.0-alpha.9',
|
||||
version: '0.1.0-alpha.10',
|
||||
data: arrayToHex(presentation.serialize()),
|
||||
meta: {
|
||||
notaryUrl: notary.normalizeUrl(),
|
||||
@@ -331,7 +331,7 @@ export class Presentation {
|
||||
|
||||
async json(): Promise<PresentationJSON> {
|
||||
return {
|
||||
version: '0.1.0-alpha.9',
|
||||
version: '0.1.0-alpha.10',
|
||||
data: await this.serialize(),
|
||||
meta: {
|
||||
notaryUrl: this.#notaryUrl
|
||||
|
||||
@@ -4,7 +4,7 @@ export type CommitData = {
|
||||
};
|
||||
|
||||
export type PresentationJSON = {
|
||||
version: '0.1.0-alpha.7' | '0.1.0-alpha.8' | '0.1.0-alpha.9';
|
||||
version: '0.1.0-alpha.7' | '0.1.0-alpha.8' | '0.1.0-alpha.9' | '0.1.0-alpha.10';
|
||||
data: string;
|
||||
meta: {
|
||||
notaryUrl?: string;
|
||||
|
||||
@@ -23,13 +23,13 @@ const { init, Prover, Presentation }: any = Comlink.wrap(
|
||||
console.log('test start');
|
||||
console.time('prove');
|
||||
const prover = (await new Prover({
|
||||
id: 'test',
|
||||
serverDns: 'swapi.dev',
|
||||
serverDns: 'raw.githubusercontent.com',
|
||||
maxRecvData: 1700
|
||||
})) as _Prover;
|
||||
const notary = NotaryServer.from('http://127.0.0.1:7047');
|
||||
await prover.setup(await notary.sessionUrl());
|
||||
await prover.sendRequest('wss://notary.pse.dev/proxy?token=swapi.dev', {
|
||||
url: 'https://swapi.dev/api/people/1',
|
||||
await prover.sendRequest('wss://notary.pse.dev/proxy?token=raw.githubusercontent.com', {
|
||||
url: 'https://raw.githubusercontent.com/tlsnotary/tlsn/refs/heads/main/crates/server-fixture/server/src/data/protected_data.json',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
secret: 'test_secret',
|
||||
@@ -65,9 +65,10 @@ const { init, Prover, Presentation }: any = Comlink.wrap(
|
||||
`${recvHeaders[14]}: ${recvHeaders[15]}`,
|
||||
`${recvHeaders[16]}: ${recvHeaders[17]}`,
|
||||
`${recvHeaders[18]}: ${recvHeaders[19]}`,
|
||||
`"name":"${body.name}"`,
|
||||
`"hair_color":"${body.hair_color}"`,
|
||||
`"skin_color":"${body.skin_color}"`,
|
||||
`"id": ${body.id}`,
|
||||
`"city": "${body.information.address.city}"`,
|
||||
`"postalCode": "12345"`,
|
||||
|
||||
],
|
||||
Buffer.from(recv).toString('utf-8'),
|
||||
),
|
||||
@@ -85,7 +86,7 @@ const { init, Prover, Presentation }: any = Comlink.wrap(
|
||||
console.log('presentation:', await presentation.serialize());
|
||||
console.timeEnd('prove');
|
||||
const json = await presentation.json();
|
||||
assert(json.version === '0.1.0-alpha.9');
|
||||
assert(json.version === '0.1.0-alpha.10');
|
||||
assert(new URL(json.meta.notaryUrl!).protocol === 'http:');
|
||||
|
||||
console.time('verify');
|
||||
@@ -101,21 +102,25 @@ const { init, Prover, Presentation }: any = Comlink.wrap(
|
||||
});
|
||||
const sentStr = t.sent();
|
||||
const recvStr = t.recv();
|
||||
assert(sentStr.includes('host: swapi.dev'));
|
||||
|
||||
console.log("Sent:", sentStr);
|
||||
console.log("Received:", recvStr);
|
||||
|
||||
assert(sentStr.includes('host: raw.githubusercontent.com'));
|
||||
assert(!sentStr.includes('secret: test_secret'));
|
||||
assert(recvStr.includes('"name":"Luke Skywalker"'));
|
||||
assert(recvStr.includes('"hair_color":"blond"'));
|
||||
assert(recvStr.includes('"skin_color":"fair"'));
|
||||
assert(server_name === 'swapi.dev');
|
||||
assert(recvStr.includes('"id": 1234567890'));
|
||||
assert(recvStr.includes('"city": "Anytown"'));
|
||||
assert(recvStr.includes('"postalCode": "12345"'));
|
||||
assert(server_name === 'raw.githubusercontent.com');
|
||||
|
||||
// @ts-ignore
|
||||
document.getElementById('full-integration-swapi').textContent = 'OK';
|
||||
document.getElementById('full-integration').textContent = 'OK';
|
||||
} catch (err) {
|
||||
console.log('caught error from wasm');
|
||||
console.error(err);
|
||||
|
||||
// @ts-ignore
|
||||
document.getElementById('full-integration-swapi').textContent = err.message;
|
||||
document.getElementById('full-integration').textContent = err.message;
|
||||
}
|
||||
})();
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -12,8 +12,8 @@
|
||||
<script>
|
||||
global = globalThis //<- this should be enough
|
||||
</script>
|
||||
<div>Testing "full-integration-swapi":
|
||||
<div id="full-integration-swapi"></div>
|
||||
<div>Testing "full-integration":
|
||||
<div id="full-integration"></div>
|
||||
</div>
|
||||
<div>Testing "simple-verify":
|
||||
<div id="simple-verify"></div>
|
||||
|
||||
@@ -48,6 +48,12 @@ before(async function () {
|
||||
await waitForNotaryServer();
|
||||
browser = await puppeteer.launch(opts);
|
||||
page = await browser.newPage();
|
||||
|
||||
// log browser console messages
|
||||
page.on('console', (msg) => {
|
||||
console.log(`[BROWSER ${msg.type().toUpperCase()}] ${msg.text()}`);
|
||||
});
|
||||
|
||||
await page.goto('http://127.0.0.1:3001');
|
||||
});
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ module.exports = [
|
||||
target: 'web',
|
||||
mode: isProd ? 'production' : 'development',
|
||||
entry: {
|
||||
'full-integration-swapi.spec': path.join(__dirname, 'test', 'e2e', 'full-integration-swapi.spec.ts'),
|
||||
'full-integration.spec': path.join(__dirname, 'test', 'e2e', 'full-integration.spec.ts'),
|
||||
'simple-verify': path.join(__dirname, 'test', 'e2e', 'simple-verify.spec.ts'),
|
||||
},
|
||||
output: {
|
||||
|
||||
Reference in New Issue
Block a user