No description
- JavaScript 54.6%
- CSS 22.8%
- HTML 20%
- Dockerfile 1.4%
- Makefile 1.2%
| dist | ||
| src | ||
| build.js | ||
| Containerfile | ||
| index.html | ||
| LICENSE | ||
| Makefile | ||
| package.json | ||
| README.md | ||
Attestation Widget
Embeddable widget for verifying TEE (Trusted Execution Environment) attestation documents.
Installation
npm install git+https://git.caution.co/public/attestation-widget.git
Usage
Modal Mode
import { showModal } from 'attestation-widget';
showModal({
attestationUrl: '/attestation',
onVerified: (result) => console.log('Verified!', result),
onError: (err) => console.error('Failed:', err),
onClose: () => console.log('Modal closed')
});
Inline Mode
import { renderInline } from 'attestation-widget';
const widget = renderInline('#container', {
attestationUrl: '/attestation',
autoVerify: true
});
// Later, destroy the widget
widget.destroy();
Manual Control
import { AttestationWidget } from 'attestation-widget';
const widget = new AttestationWidget({
attestationUrl: '/attestation',
mode: 'modal', // or 'inline'
autoVerify: false
});
widget.render(document.body);
await widget.verify();
console.log(widget.result);
Options
| Option | Type | Default | Description |
|---|---|---|---|
attestationUrl |
string | /attestation |
URL of the attestation endpoint |
mode |
string | modal |
Display mode: modal or inline |
autoVerify |
boolean | true |
Automatically verify on render |
showBanner |
boolean | true |
Show success/error banner |
showVerifyButton |
boolean | true |
Show "Verify this app" button |
showChecks |
boolean | true |
Show authentication steps |
showUserData |
boolean | true |
Show user data section |
showPCRs |
boolean | true |
Show PCR values |
showSources |
boolean | true |
Show source information |
showRaw |
boolean | true |
Show raw response |
onVerified |
function | - | Callback on successful verification |
onError |
function | - | Callback on verification error |
onClose |
function | - | Callback when modal is closed |
CSS
Styles are automatically injected when the widget renders. No separate CSS import is required.
If you prefer to load styles separately (e.g., for SSR or to avoid FOUC), you can link the CSS directly:
<link rel="stylesheet" href="node_modules/attestation-widget/dist/styles.css">
Building
make build
Development
make dev
Then open http://localhost:1337 to view the test page.
Source repository
Canonical source: https://git.caution.co/public/attestation-widget.