tsukino e4a8a9c723 feat: upgrade to alpha.6 and new tlsn-wasm prover (#61)
* Revert "chore: release v0.1.0-alpha.6 (#57)"

This reverts commit 292b4263d7.

* parsed json

* add json commitments

* parse json from transcript

* wip

* wip

* wip

* feat: update to alpha.6

* chore: commit wasm pkg directory

* chore: version nump

* fix: test suite for alpha.6

* fix: remove wasm build from ci

* fix: update pnpm lockfile

* fix: remove test:wasm

* fix: linter and add new devDependency
2024-08-12 05:52:19 -04:00
2023-11-14 09:41:01 +03:00
2023-12-19 21:11:10 -08:00
2024-05-21 08:03:26 -04:00
2023-11-14 09:19:56 +03:00

MIT licensed Apache licensed

tlsn-js

NPM Modules for proving and verifying using TLSNotary in the browser.

The prover requires a notary-server and a websocket proxy

Important

tlsn-js is developed for the usage of TLSNotary in the Browser. This module does not work in nodejs.

License

This repository is licensed under either of

at your option.

Example

import { prove, verify } from '../src';

// To create a proof
const proof = await prove('https://swapi.dev/api/people/1', {
    method: 'GET',
    headers: {
      Connection: 'close',
      Accept: 'application/json',
      'Accept-Encoding': 'identity',
    },
    body: '',
    maxTranscriptSize: 20000,
    notaryUrl: 'https://127.0.0.1:7047',
    websocketProxyUrl: 'ws://127.0.0.1:55688',
});

// To verify a proof
const result = await verify(proof);
console.log(result);

Running a local websocket proxy for https://swapi.dev

  1. Install websocat:

    tool command
    cargo cargo install websocat
    brew brew install websocat
    source https://github.com/vi/websocat
  2. Run a websocket proxy for https://swapi.dev:

websocat --binary -v ws-l:0.0.0.0:55688 tcp:swapi.dev:443

Install as NPM Package

npm install tlsn-js

Development

Important

Note on Rust-to-WASM Compilation: This project requires compiling Rust into WASM, which needs clang version 16.0.0 or newer. MacOS users, be aware that Xcode's default clang might be older. If you encounter the error No available targets are compatible with triple "wasm32-unknown-unknown", it's likely due to an outdated clang. Updating clang to a newer version should resolve this issue.

# make sure you have rust installed
# https://www.rust-lang.org/tools/install
npm install

# this serve a page that will execute the example code at http://localhost:3001 
npm run dev

Build for NPM

npm install
npm run build

Adding a new test

  1. Create a new new-test.spec.ts file in the test/ directory
  2. Add your spec file to the entry object fin webpack.web.dev.config.js
  3. Add a new div block to test/test.ejs like this: <div>Testing "new-test":<div id="new-test"></div></div>. The div id must be the same as the filename.
Description
No description provided
Readme 11 MiB
Latest
2025-06-19 15:23:49 -04:00
Languages
TypeScript 87.2%
JavaScript 9.8%
Shell 1.6%
EJS 1.4%