Files
tlsn-js/test/simple-verify.spec.ts
tsukino bc93d4e46b fix(wasm): change commit_sent to commit_recv (#23)
* 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>
2024-02-22 10:54:35 -05:00

24 lines
781 B
TypeScript

import { verify } from '../src';
import simple_proof_redacted from './assets/simple_proof_redacted.json';
(async function verify_simple() {
try {
const pem = `-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEBv36FI4ZFszJa0DQFJ3wWCXvVLFr\ncRzMG5kaTeHGoSzDu6cFqx3uEWYpFGo6C0EOUgf+mEgbktLrXocv5yHzKg==\n-----END PUBLIC KEY-----`;
const proof = {
...simple_proof_redacted,
notaryUrl: 'http://localhost:7047',
};
console.log(proof);
console.time('verify');
const result = await verify(proof, pem);
console.timeEnd('verify');
// @ts-ignore
document.getElementById('simple-verify').textContent =
JSON.stringify(result);
} catch (err) {
console.log('caught error from wasm');
console.error(err);
}
})();