mirror of
https://github.com/tlsnotary/tlsn-js.git
synced 2026-01-09 20:47:55 -05:00
* fix(wasm): change commit_sent to commit_recv * fix: fix tests (alpha4) * test: Test redactions * fix: skip puppeteer chrome install * chore: fix linter --------- Co-authored-by: Hendrik Eeckhaut <hendrik@eeckhaut.org>
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
import { prove, verify } from '../src';
|
|
|
|
(async function () {
|
|
try {
|
|
// @ts-ignore
|
|
console.log('test start');
|
|
console.time('prove');
|
|
const proof = await prove('https://swapi.dev/api/people/1', {
|
|
method: 'GET',
|
|
headers: { secret: 'test_secret' },
|
|
maxTranscriptSize: 16384,
|
|
notaryUrl: process.env.LOCAL
|
|
? 'http://localhost:7047'
|
|
: 'https://notary.pse.dev',
|
|
websocketProxyUrl: process.env.LOCAL
|
|
? 'ws://localhost:55688'
|
|
: 'wss://notary.pse.dev/proxy?token=swapi.dev',
|
|
secretHeaders: ['test_secret'],
|
|
secretResps: ['blond', 'fair'],
|
|
});
|
|
console.timeEnd('prove');
|
|
|
|
console.log('Proof: ', JSON.stringify(proof));
|
|
|
|
console.time('verify');
|
|
const result = await verify(proof);
|
|
console.timeEnd('verify');
|
|
|
|
console.log(result);
|
|
// @ts-ignore
|
|
document.getElementById('full-integration-swapi').textContent =
|
|
JSON.stringify(result);
|
|
} catch (err) {
|
|
console.log('caught error from wasm');
|
|
console.error(err);
|
|
}
|
|
})();
|