treadwheel 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser/widget.js
CHANGED
|
@@ -7,11 +7,12 @@ template.innerHTML = html `
|
|
|
7
7
|
display: contents;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
#widget {
|
|
11
11
|
all: initial;
|
|
12
12
|
display: block;
|
|
13
13
|
box-sizing: border-box;
|
|
14
|
-
width:
|
|
14
|
+
width: 300px;
|
|
15
|
+
max-width: 100%;
|
|
15
16
|
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
16
17
|
border-radius: 10px;
|
|
17
18
|
color: #111;
|
|
@@ -22,6 +23,7 @@ template.innerHTML = html `
|
|
|
22
23
|
sans-serif;
|
|
23
24
|
font-size: 16px;
|
|
24
25
|
line-height: 1.25;
|
|
26
|
+
-webkit-user-select: none;
|
|
25
27
|
user-select: none;
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -30,7 +32,7 @@ template.innerHTML = html `
|
|
|
30
32
|
position: relative;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
:host([layout="floating"])
|
|
35
|
+
:host([layout="floating"]) #widget {
|
|
34
36
|
display: none;
|
|
35
37
|
position: absolute;
|
|
36
38
|
z-index: 1000000;
|
|
@@ -38,12 +40,12 @@ template.innerHTML = html `
|
|
|
38
40
|
transition: opacity .2s ease-in .8s;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
:host([layout="floating"][status])
|
|
43
|
+
:host([layout="floating"][status]) #widget {
|
|
42
44
|
display: block;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
:host([layout="floating"][status="processing"])
|
|
46
|
-
:host([layout="floating"][status="error"])
|
|
47
|
+
:host([layout="floating"][status="processing"]) #widget,
|
|
48
|
+
:host([layout="floating"][status="error"]) #widget {
|
|
47
49
|
opacity: 1;
|
|
48
50
|
transition: opacity .1s ease-out;
|
|
49
51
|
}
|
|
@@ -63,7 +65,7 @@ template.innerHTML = html `
|
|
|
63
65
|
anchor-name: --base;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
|
-
:host([layout="floating"])
|
|
68
|
+
:host([layout="floating"]) #widget {
|
|
67
69
|
position: fixed;
|
|
68
70
|
position-anchor: --base;
|
|
69
71
|
position-area: block-end span-inline-end;
|
|
@@ -147,7 +149,7 @@ template.innerHTML = html `
|
|
|
147
149
|
</style>
|
|
148
150
|
<div id="base">
|
|
149
151
|
<slot id="trigger"></slot>
|
|
150
|
-
<article lang="en">
|
|
152
|
+
<article id="widget" lang="en">
|
|
151
153
|
<button type="button">I'm not a robot</button>
|
|
152
154
|
<div id="status" role="status"></div>
|
|
153
155
|
<footer>
|
|
@@ -204,14 +206,15 @@ class TreadwheelWidget extends HTMLElement {
|
|
|
204
206
|
slot.name = '_output';
|
|
205
207
|
const purge = () => {
|
|
206
208
|
this._shadow.replaceChildren(style, slot);
|
|
207
|
-
this.childNodes.forEach((node) => {
|
|
209
|
+
[...this.childNodes].forEach((node) => {
|
|
208
210
|
if (node !== output)
|
|
209
211
|
node.remove();
|
|
210
212
|
});
|
|
211
213
|
};
|
|
212
|
-
|
|
214
|
+
const widget = this._shadow.getElementById('widget');
|
|
215
|
+
if (widget && this.getAttribute('layout') === 'floating') {
|
|
213
216
|
this._shadow.append(slot);
|
|
214
|
-
|
|
217
|
+
widget.addEventListener('transitionend', purge, { once: true });
|
|
215
218
|
}
|
|
216
219
|
else {
|
|
217
220
|
purge();
|
|
@@ -235,7 +238,7 @@ class TreadwheelWidget extends HTMLElement {
|
|
|
235
238
|
};
|
|
236
239
|
this._shadow.appendChild(template.content.cloneNode(true));
|
|
237
240
|
this._shadow.addEventListener('click', this._handleClick);
|
|
238
|
-
this._shadow.
|
|
241
|
+
this._shadow.getElementById('trigger')?.addEventListener('slotchange', () => {
|
|
239
242
|
if (this.hasAttribute('layout'))
|
|
240
243
|
return;
|
|
241
244
|
if (this.querySelector('button')) {
|
package/dist/node/index.js
CHANGED
|
@@ -2,15 +2,20 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import { Worker } from 'node:worker_threads';
|
|
3
3
|
import { SEAL_DEFAULTS } from '../core/defaults.js';
|
|
4
4
|
import { sealFromPrimes, unsealFromBytes } from '../core/index.js';
|
|
5
|
-
|
|
5
|
+
import { bytesToBigInt } from '../core/io.js';
|
|
6
|
+
function generatePrimesAsync(modulusLength) {
|
|
6
7
|
return new Promise((resolve, reject) => {
|
|
7
|
-
const callback = (err,
|
|
8
|
+
const callback = (err, _publicKey, privateKey) => {
|
|
8
9
|
if (err)
|
|
9
|
-
reject(err);
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
return reject(err);
|
|
11
|
+
const jwk = privateKey.export({ format: 'jwk' });
|
|
12
|
+
if (!jwk.p || !jwk.q)
|
|
13
|
+
return reject(new Error('RSA JWK is missing primes p or q'));
|
|
14
|
+
const p = bytesToBigInt(Buffer.from(jwk.p, 'base64url'));
|
|
15
|
+
const q = bytesToBigInt(Buffer.from(jwk.q, 'base64url'));
|
|
16
|
+
resolve({ p, q });
|
|
12
17
|
};
|
|
13
|
-
crypto.
|
|
18
|
+
crypto.generateKeyPair('rsa', { modulusLength }, callback);
|
|
14
19
|
});
|
|
15
20
|
}
|
|
16
21
|
/**
|
|
@@ -22,12 +27,7 @@ function generatePrimeAsync(size) {
|
|
|
22
27
|
*/
|
|
23
28
|
export async function seal(plaintext, options) {
|
|
24
29
|
const config = { ...SEAL_DEFAULTS, ...options };
|
|
25
|
-
const
|
|
26
|
-
const qLength = config.modulusLength - pLength;
|
|
27
|
-
const [p, q] = await Promise.all([
|
|
28
|
-
generatePrimeAsync(pLength),
|
|
29
|
-
generatePrimeAsync(qLength),
|
|
30
|
-
]);
|
|
30
|
+
const { p, q } = await generatePrimesAsync(config.modulusLength);
|
|
31
31
|
const envelope = await sealFromPrimes(plaintext, p, q, config);
|
|
32
32
|
return Buffer.from(envelope).toString('base64url');
|
|
33
33
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t){return new Promise((n,r)=>{if(t?.signal?.aborted)return r(t.signal.reason);t?.signal?.addEventListener(`abort`,s);let i=URL.createObjectURL(new Blob(["(function(){let e=new TextEncoder().encode(`treadwheel-v1`);async function t(t,n){let r=await globalThis.crypto.subtle.importKey(`raw`,t,`HKDF`,!1,[`deriveKey`]);return await globalThis.crypto.subtle.deriveKey({name:`HKDF`,hash:`SHA-256`,salt:n,info:e},r,{name:`AES-GCM`,length:256},!1,[`encrypt`,`decrypt`])}async function n(e,n){let r=await t(n,e.salt);return new Uint8Array(await globalThis.crypto.subtle.decrypt({name:`AES-GCM`,iv:e.iv},r,e.ciphertext))}let r=new Uint8Array([183,15,255]);var i=class{constructor(e){this.offset=0,this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}},a=class extends i{readUint8(){return this.view.getUint8(this.offset++)}readUint16(){let e=this.view.getUint16(this.offset);return this.offset+=2,e}readUint32(){let e=this.view.getUint32(this.offset);return this.offset+=4,e}readBigUInt64(){let e=this.view.getBigUint64(this.offset);return this.offset+=8,e}readBytes(e){let t=this.offset+e;if(t>this.bytes.byteLength)throw Error(`Malformed envelope: unexpected end of data`);let n=this.bytes.subarray(this.offset,t);return this.offset=t,n}};function o(e){let t=0n;for(let n=0;n<e.length;n++)t=t<<8n|BigInt(e[n]);return t}function s(e,t){let n=new Uint8Array(t);for(let r=0;r<t;r++){let i=BigInt((t-1-r)*8);n[r]=Number(e>>i&255n)}return n}function c(e){let t=new a(e);if(!t.readBytes(r.byteLength).every((e,t)=>e===r[t]))throw Error(`Invalid envelope: magic bytes mismatch`);let n=t.readUint8();if(n!==1)throw Error(`Unsupported envelope version ${n}`);let i=t.readUint16(),s=t.readUint32();return{v:n,modulusByteLength:i,time:t.readBigUInt64(),modulus:o(t.readBytes(i)),base:o(t.readBytes(i)),salt:t.readBytes(32),iv:t.readBytes(12),ciphertext:t.readBytes(s)}}function l({modulus:e,base:t,time:n}){for(let r=0n;r<n;r++)t=t*t%e;return t}new TextEncoder;let u=new TextDecoder;async function d(e){let t=c(e),r=s(l(t),t.modulusByteLength),i;try{i=await n(t,r)}finally{r.fill(0)}return u.decode(i)}function f(e){if(`fromBase64`in Uint8Array&&typeof Uint8Array.fromBase64==`function`)return Uint8Array.fromBase64(e,{alphabet:`base64url`});let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return t+=`==`.slice((t.length+2)%4),Uint8Array.from(atob(t),e=>e.charCodeAt(0))}async function p(e){if(!globalThis.crypto?.subtle)throw Error(`Web Crypto API is not available`);return await d(f(e))}self.onmessage=async e=>{try{let t=await p(e.data);self.postMessage({success:!0,plaintext:t})}catch(e){self.postMessage({success:!1,error:e instanceof Error?e:Error(String(e))})}}})();"],{type:`application/javascript`})),a=new Worker(i);URL.revokeObjectURL(i);let o=()=>{a.terminate(),t?.signal?.removeEventListener(`abort`,s)};a.onmessage=e=>{e.data.success?n(e.data.plaintext):r(e.data.error),o()},a.onerror=e=>{e.preventDefault(),r(e.error??Error(e.message)),o()};function s(e){r(e.target.reason),o()}a.postMessage(e)})}const t=String.raw,n=document.createElement(`template`);n.innerHTML=t`<style>#base,:host{display:contents}
|
|
1
|
+
function e(e,t){return new Promise((n,r)=>{if(t?.signal?.aborted)return r(t.signal.reason);t?.signal?.addEventListener(`abort`,s);let i=URL.createObjectURL(new Blob(["(function(){let e=new TextEncoder().encode(`treadwheel-v1`);async function t(t,n){let r=await globalThis.crypto.subtle.importKey(`raw`,t,`HKDF`,!1,[`deriveKey`]);return await globalThis.crypto.subtle.deriveKey({name:`HKDF`,hash:`SHA-256`,salt:n,info:e},r,{name:`AES-GCM`,length:256},!1,[`encrypt`,`decrypt`])}async function n(e,n){let r=await t(n,e.salt);return new Uint8Array(await globalThis.crypto.subtle.decrypt({name:`AES-GCM`,iv:e.iv},r,e.ciphertext))}let r=new Uint8Array([183,15,255]);var i=class{constructor(e){this.offset=0,this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}},a=class extends i{readUint8(){return this.view.getUint8(this.offset++)}readUint16(){let e=this.view.getUint16(this.offset);return this.offset+=2,e}readUint32(){let e=this.view.getUint32(this.offset);return this.offset+=4,e}readBigUInt64(){let e=this.view.getBigUint64(this.offset);return this.offset+=8,e}readBytes(e){let t=this.offset+e;if(t>this.bytes.byteLength)throw Error(`Malformed envelope: unexpected end of data`);let n=this.bytes.subarray(this.offset,t);return this.offset=t,n}};function o(e){let t=0n;for(let n=0;n<e.length;n++)t=t<<8n|BigInt(e[n]);return t}function s(e,t){let n=new Uint8Array(t);for(let r=0;r<t;r++){let i=BigInt((t-1-r)*8);n[r]=Number(e>>i&255n)}return n}function c(e){let t=new a(e);if(!t.readBytes(r.byteLength).every((e,t)=>e===r[t]))throw Error(`Invalid envelope: magic bytes mismatch`);let n=t.readUint8();if(n!==1)throw Error(`Unsupported envelope version ${n}`);let i=t.readUint16(),s=t.readUint32();return{v:n,modulusByteLength:i,time:t.readBigUInt64(),modulus:o(t.readBytes(i)),base:o(t.readBytes(i)),salt:t.readBytes(32),iv:t.readBytes(12),ciphertext:t.readBytes(s)}}function l({modulus:e,base:t,time:n}){for(let r=0n;r<n;r++)t=t*t%e;return t}new TextEncoder;let u=new TextDecoder;async function d(e){let t=c(e),r=s(l(t),t.modulusByteLength),i;try{i=await n(t,r)}finally{r.fill(0)}return u.decode(i)}function f(e){if(`fromBase64`in Uint8Array&&typeof Uint8Array.fromBase64==`function`)return Uint8Array.fromBase64(e,{alphabet:`base64url`});let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return t+=`==`.slice((t.length+2)%4),Uint8Array.from(atob(t),e=>e.charCodeAt(0))}async function p(e){if(!globalThis.crypto?.subtle)throw Error(`Web Crypto API is not available`);return await d(f(e))}self.onmessage=async e=>{try{let t=await p(e.data);self.postMessage({success:!0,plaintext:t})}catch(e){self.postMessage({success:!1,error:e instanceof Error?e:Error(String(e))})}}})();"],{type:`application/javascript`})),a=new Worker(i);URL.revokeObjectURL(i);let o=()=>{a.terminate(),t?.signal?.removeEventListener(`abort`,s)};a.onmessage=e=>{e.data.success?n(e.data.plaintext):r(e.data.error),o()},a.onerror=e=>{e.preventDefault(),r(e.error??Error(e.message)),o()};function s(e){r(e.target.reason),o()}a.postMessage(e)})}const t=String.raw,n=document.createElement(`template`);n.innerHTML=t`<style>#base,:host{display:contents}#widget{all:initial;display:block;box-sizing:border-box;width:300px;max-width:100%;border:1px solid rgba(0,0,0,.12);border-radius:10px;color:#111;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.06);font-family:Inter,Roboto,"Helvetica Neue","Arial Nova","Nimbus Sans",Arial,sans-serif;font-size:16px;line-height:1.25;-webkit-user-select:none;user-select:none}:host([layout=floating]) #base{display:inline-block;position:relative}:host([layout=floating]) #widget{display:none;position:absolute;z-index:1000000;opacity:0;transition:opacity .2s ease-in .8s}:host([layout=floating][status]) #widget{display:block}:host([layout=floating][status=error]) #widget,:host([layout=floating][status=processing]) #widget{opacity:1;transition:opacity .1s ease-out}:host([layout=floating][status=success]) #base{position:absolute;pointer-events:none}:host([layout=floating][status=success]) #trigger{visibility:hidden}@supports (position-area:block-end span-inline-end){:host([layout=floating]) #base{position:static;anchor-name:--base}:host([layout=floating]) #widget{position:fixed;position-anchor:--base;position-area:block-end span-inline-end;position-try-fallbacks:flip-inline}}button{all:unset;width:100%;cursor:pointer}button:focus-visible{outline:revert}:host([status]) #status,button{position:relative;box-sizing:border-box;min-height:46px;padding:16px 16px 10px 52px;border-radius:6px}:host([status]) button{display:none}:host([status=processing]) #status{cursor:wait}:host([status]) #status::before,button::before{content:'';position:absolute;left:14px;top:50%;width:24px;height:24px;margin-top:-10px;border:1px solid #bbb;border-radius:6px}:host([status=processing]) #status::before{border-radius:50%;border-color:transparent transparent #111 #111;animation:spin 1s linear infinite}:host([status=success]) #status::before{border-color:#16a34a;background-color:#16a34a;background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0ibTE4IDgtOCA5LTQtNCIvPjwvc3ZnPg==")}:host([status=error]) #status::before{border-color:#dc2626;background-color:#dc2626;background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0iTTE3IDcgNyAxN003IDdsMTAgMTAiLz48L3N2Zz4=")}footer{text-align:right;font-size:12px;color:#666;padding:2px 9px 7px 9px}footer a{color:inherit;text-decoration:none}footer a:hover{text-decoration:underline}@keyframes spin{to{transform:rotate(360deg)}}</style><div id="base"><slot id="trigger"></slot><article id="widget" lang="en"><button type="button">I'm not a robot</button><div id="status" role="status"></div><footer>Protected by <a href="https://github.com/jo-phil/treadwheel" target="_blank" rel="noopener noreferrer" translate="no">Treadwheel</a></footer></article></div>`;var r=class extends HTMLElement{constructor(){super(),this._shadow=this.attachShadow({mode:`open`}),this._handleClick=async t=>{if(!t.target?.closest(`button`))return;let n=this.getAttribute(`envelope`);if(!n)return;this.setAttribute(`status`,`processing`),this.querySelectorAll(`button`).forEach(e=>{e.disabled=!0});let r=this._shadow.getElementById(`status`);r&&(r.textContent=`Verifying…`);try{let t=await e(n,{signal:this._abortController?.signal});this._shadow.removeEventListener(`click`,this._handleClick),this.setAttribute(`status`,`success`),r&&(r.textContent=`Verified`);let i=document.createElement(`div`);i.slot=`_output`,i.style.display=`contents`,this.getAttribute(`output`)===`html`?i.innerHTML=t:i.textContent=t,this.append(i);let a=document.createElement(`style`);a.textContent=`:host{display:contents}`;let o=document.createElement(`slot`);o.name=`_output`;let s=()=>{this._shadow.replaceChildren(a,o),[...this.childNodes].forEach(e=>{e!==i&&e.remove()})},c=this._shadow.getElementById(`widget`);c&&this.getAttribute(`layout`)===`floating`?(this._shadow.append(o),c.addEventListener(`transitionend`,s,{once:!0})):s()}catch(e){e instanceof DOMException&&e.name===`AbortError`?(this.removeAttribute(`status`),r&&(r.textContent=``),this.querySelectorAll(`button`).forEach(e=>{e.disabled=!1})):(this.setAttribute(`status`,`error`),r&&(r.textContent=`Verification failed`))}},this._shadow.appendChild(n.content.cloneNode(!0)),this._shadow.addEventListener(`click`,this._handleClick),this._shadow.getElementById(`trigger`)?.addEventListener(`slotchange`,()=>{this.hasAttribute(`layout`)||this.querySelector(`button`)&&this.setAttribute(`layout`,`floating`)},{once:!0})}connectedCallback(){this._abortController=new AbortController}disconnectedCallback(){this._abortController?.abort()}};customElements.define(`treadwheel-widget`,r);
|
|
2
2
|
//# sourceMappingURL=treadwheel-widget.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treadwheel-widget.min.js","names":["unsealInWorker","options","reject","handleAbort","url","worker","cleanup","event","resolve","errorEvent","envelope","html","template","TreadwheelWidget","e","status","plaintext","output","style","slot","purge","node","error"],"sources":["../src/browser/index.ts","../src/browser/widget.ts"],"sourcesContent":["import { SEAL_DEFAULTS } from '../core/defaults.js';\nimport { sealFromPrimes, unsealFromBytes } from '../core/index.js';\nimport { bytesToBigInt } from '../core/io.js';\nimport type { SealOptions, UnsealInWorkerOptions } from '../core/types.js';\nimport { base64UrlToBytes, bytesToBase64Url } from './codec.js';\n\nexport type { SealOptions, UnsealInWorkerOptions };\n\n/**\n * Seal plaintext using a time-lock puzzle.\n *\n * @param plaintext - The plaintext to seal.\n * @param options - Optional configuration options.\n * @returns A Base64URL-encoded envelope.\n */\nexport async function seal(\n plaintext: string,\n options?: SealOptions,\n): Promise<string> {\n const config = { ...SEAL_DEFAULTS, ...options };\n\n const keyPair = await globalThis.crypto.subtle.generateKey(\n {\n name: 'RSA-OAEP',\n modulusLength: config.modulusLength,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n hash: 'SHA-256',\n },\n true,\n ['decrypt'],\n );\n const jwk = await globalThis.crypto.subtle.exportKey(\n 'jwk',\n keyPair.privateKey,\n );\n\n if (!jwk.p || !jwk.q) throw new Error('RSA JWK is missing primes p or q');\n const p = bytesToBigInt(base64UrlToBytes(jwk.p));\n const q = bytesToBigInt(base64UrlToBytes(jwk.q));\n\n return bytesToBase64Url(await sealFromPrimes(plaintext, p, q, config));\n}\n\n/**\n * Unseal an envelope by solving its time-lock puzzle.\n *\n * @param envelope - A Base64URL-encoded envelope.\n * @returns The decrypted plaintext.\n */\nexport async function unseal(envelope: string): Promise<string> {\n if (!globalThis.crypto?.subtle)\n throw new Error('Web Crypto API is not available');\n\n return await unsealFromBytes(base64UrlToBytes(envelope));\n}\n\n/**\n * Unseal an envelope in a web worker.\n *\n * @param envelope - A Base64URL-encoded envelope.\n * @param options - Optional configuration options.\n * @returns The decrypted plaintext.\n */\nexport function unsealInWorker(\n envelope: string,\n options?: UnsealInWorkerOptions,\n): Promise<string> {\n return new Promise((resolve, reject) => {\n if (options?.signal?.aborted) return reject(options.signal.reason);\n options?.signal?.addEventListener('abort', handleAbort);\n\n const worker = new Worker(new URL('./worker.js', import.meta.url), {\n type: 'module',\n });\n\n const cleanup = () => {\n worker.terminate();\n options?.signal?.removeEventListener('abort', handleAbort);\n };\n\n worker.onmessage = (event) => {\n if (event.data.success) resolve(event.data.plaintext);\n else reject(event.data.error);\n cleanup();\n };\n\n worker.onerror = (errorEvent) => {\n errorEvent.preventDefault();\n reject(errorEvent.error ?? new Error(errorEvent.message));\n cleanup();\n };\n\n function handleAbort(event: Event) {\n reject((event.target as AbortSignal).reason);\n cleanup();\n }\n\n worker.postMessage(envelope);\n });\n}\n","import { unsealInWorker } from './index.js';\n\nconst html = String.raw;\n\nconst template = document.createElement('template');\ntemplate.innerHTML = html`\n <style>\n :host, #base {\n display: contents;\n }\n\n article {\n all: initial;\n display: block;\n box-sizing: border-box;\n width: min(300px, 100dvw);\n border: 1px solid rgba(0, 0, 0, 0.12);\n border-radius: 10px;\n color: #111;\n background: #fff;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);\n font-family:\n Inter, Roboto, \"Helvetica Neue\", \"Arial Nova\", \"Nimbus Sans\", Arial,\n sans-serif;\n font-size: 16px;\n line-height: 1.25;\n user-select: none;\n }\n\n :host([layout=\"floating\"]) #base {\n display: inline-block;\n position: relative;\n }\n\n :host([layout=\"floating\"]) article {\n display: none;\n position: absolute;\n z-index: 1000000;\n opacity: 0;\n transition: opacity .2s ease-in .8s;\n }\n\n :host([layout=\"floating\"][status]) article {\n display: block;\n }\n\n :host([layout=\"floating\"][status=\"processing\"]) article,\n :host([layout=\"floating\"][status=\"error\"]) article {\n opacity: 1;\n transition: opacity .1s ease-out;\n }\n\n :host([layout=\"floating\"][status=\"success\"]) #base {\n position: absolute;\n pointer-events: none;\n }\n\n :host([layout=\"floating\"][status=\"success\"]) #trigger {\n visibility: hidden;\n }\n\n @supports (position-area: block-end span-inline-end) {\n :host([layout=\"floating\"]) #base {\n position: static;\n anchor-name: --base;\n }\n\n :host([layout=\"floating\"]) article {\n position: fixed;\n position-anchor: --base;\n position-area: block-end span-inline-end;\n position-try-fallbacks: flip-inline;\n }\n }\n\n button {\n all: unset;\n width: 100%;\n cursor: pointer;\n }\n\n button:focus-visible {\n outline: revert;\n }\n\n button, :host([status]) #status {\n position: relative;\n box-sizing: border-box;\n min-height: 46px;\n padding: 16px 16px 10px 52px;\n border-radius: 6px;\n }\n\n :host([status]) button {\n display: none;\n }\n\n :host([status=\"processing\"]) #status {\n cursor: wait;\n }\n\n button::before, :host([status]) #status::before {\n content: '';\n position: absolute;\n left: 14px;\n top: 50%;\n width: 24px;\n height: 24px;\n margin-top: -10px;\n border: 1px solid #bbb;\n border-radius: 6px;\n }\n\n :host([status=\"processing\"]) #status::before {\n border-radius: 50%;\n border-color: transparent transparent #111 #111;\n animation: spin 1s linear infinite;\n }\n\n :host([status=\"success\"]) #status::before {\n border-color: #16a34a;\n background-color: #16a34a;\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0ibTE4IDgtOCA5LTQtNCIvPjwvc3ZnPg==\");\n }\n\n :host([status=\"error\"]) #status::before {\n border-color: #dc2626;\n background-color: #dc2626;\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0iTTE3IDcgNyAxN003IDdsMTAgMTAiLz48L3N2Zz4=\");\n }\n\n footer {\n text-align: right;\n font-size: 12px;\n color: #666;\n padding: 2px 9px 7px 9px;\n }\n\n footer a {\n color: inherit;\n text-decoration: none;\n }\n\n footer a:hover {\n text-decoration: underline;\n }\n\n @keyframes spin { to { transform: rotate(360deg); } }\n </style>\n <div id=\"base\">\n <slot id=\"trigger\"></slot>\n <article lang=\"en\">\n <button type=\"button\">I'm not a robot</button>\n <div id=\"status\" role=\"status\"></div>\n <footer>\n Protected by\n <a\n href=\"https://github.com/jo-phil/treadwheel\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n translate=\"no\"\n >\n Treadwheel\n </a>\n </footer>\n </article>\n </div>\n`;\n\nclass TreadwheelWidget extends HTMLElement {\n private _shadow = this.attachShadow({ mode: 'open' });\n private _abortController?: AbortController;\n\n constructor() {\n super();\n\n this._shadow.appendChild(template.content.cloneNode(true));\n this._shadow.addEventListener('click', this._handleClick);\n this._shadow.querySelector('slot')?.addEventListener(\n 'slotchange',\n () => {\n if (this.hasAttribute('layout')) return;\n if (this.querySelector('button')) {\n this.setAttribute('layout', 'floating');\n }\n },\n { once: true },\n );\n }\n\n connectedCallback() {\n this._abortController = new AbortController();\n }\n\n disconnectedCallback() {\n this._abortController?.abort();\n }\n\n private _handleClick = async (e: Event) => {\n const target = e.target as HTMLElement | null;\n if (!target?.closest('button')) return;\n\n const envelope = this.getAttribute('envelope');\n if (!envelope) return;\n\n this.setAttribute('status', 'processing');\n this.querySelectorAll('button').forEach((button) => {\n button.disabled = true;\n });\n\n const status = this._shadow.getElementById('status');\n if (status) status.textContent = 'Verifying…';\n\n try {\n const plaintext = await unsealInWorker(envelope, {\n signal: this._abortController?.signal,\n });\n\n this._shadow.removeEventListener('click', this._handleClick);\n this.setAttribute('status', 'success');\n if (status) status.textContent = 'Verified';\n\n const output = document.createElement('div');\n output.slot = '_output';\n output.style.display = 'contents';\n\n if (this.getAttribute('output') === 'html') output.innerHTML = plaintext;\n else output.textContent = plaintext;\n this.append(output);\n\n const style = document.createElement('style');\n style.textContent = ':host{display:contents}';\n\n const slot = document.createElement('slot');\n slot.name = '_output';\n\n const purge = () => {\n this._shadow.replaceChildren(style, slot);\n this.childNodes.forEach((node) => {\n if (node !== output) node.remove();\n });\n };\n\n if (this.getAttribute('layout') === 'floating') {\n this._shadow.append(slot);\n this._shadow.addEventListener('transitionend', purge, { once: true });\n } else {\n purge();\n }\n } catch (error) {\n if (error instanceof DOMException && error.name === 'AbortError') {\n this.removeAttribute('status');\n if (status) status.textContent = '';\n this.querySelectorAll('button').forEach((button) => {\n button.disabled = false;\n });\n } else {\n this.setAttribute('status', 'error');\n if (status) status.textContent = 'Verification failed';\n }\n }\n };\n}\n\ncustomElements.define('tread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AAQ,iBAAiB,QAAS,KAAK,YAAY,EACxD,KAAK,QAAQ,cAAc,MAAM,CAAC,EAAE,iBAClC,iBACM,CACA,KAAK,aAAa,QAAQ,GAC1B,KAAK,cAAc,QAAQ,GAC7B,KAAK,aAAa,SAAU,UAAU,CAE1C,EACA,CAAE,KAAM,EAAK,CACf,CACF,CAEA,mBAAoB,CAClB,KAAK,iBAAmB,IAAI,eAC9B,CAEA,sBAAuB,CACrB,KAAK,kBAAkB,MAAM,CAC/B,CAkEF,EAEA,eAAe,OAAO,oBAAqBC,CAAgB"}
|
|
1
|
+
{"version":3,"file":"treadwheel-widget.min.js","names":["unsealInWorker","options","reject","handleAbort","url","worker","cleanup","event","resolve","errorEvent","envelope","html","template","TreadwheelWidget","e","status","plaintext","output","style","slot","purge","node","widget","error"],"sources":["../src/browser/index.ts","../src/browser/widget.ts"],"sourcesContent":["import { SEAL_DEFAULTS } from '../core/defaults.js';\nimport { sealFromPrimes, unsealFromBytes } from '../core/index.js';\nimport { bytesToBigInt } from '../core/io.js';\nimport type { SealOptions, UnsealInWorkerOptions } from '../core/types.js';\nimport { base64UrlToBytes, bytesToBase64Url } from './codec.js';\n\nexport type { SealOptions, UnsealInWorkerOptions };\n\n/**\n * Seal plaintext using a time-lock puzzle.\n *\n * @param plaintext - The plaintext to seal.\n * @param options - Optional configuration options.\n * @returns A Base64URL-encoded envelope.\n */\nexport async function seal(\n plaintext: string,\n options?: SealOptions,\n): Promise<string> {\n const config = { ...SEAL_DEFAULTS, ...options };\n\n const keyPair = await globalThis.crypto.subtle.generateKey(\n {\n name: 'RSA-OAEP',\n modulusLength: config.modulusLength,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n hash: 'SHA-256',\n },\n true,\n ['decrypt'],\n );\n const jwk = await globalThis.crypto.subtle.exportKey(\n 'jwk',\n keyPair.privateKey,\n );\n\n if (!jwk.p || !jwk.q) throw new Error('RSA JWK is missing primes p or q');\n const p = bytesToBigInt(base64UrlToBytes(jwk.p));\n const q = bytesToBigInt(base64UrlToBytes(jwk.q));\n\n return bytesToBase64Url(await sealFromPrimes(plaintext, p, q, config));\n}\n\n/**\n * Unseal an envelope by solving its time-lock puzzle.\n *\n * @param envelope - A Base64URL-encoded envelope.\n * @returns The decrypted plaintext.\n */\nexport async function unseal(envelope: string): Promise<string> {\n if (!globalThis.crypto?.subtle)\n throw new Error('Web Crypto API is not available');\n\n return await unsealFromBytes(base64UrlToBytes(envelope));\n}\n\n/**\n * Unseal an envelope in a web worker.\n *\n * @param envelope - A Base64URL-encoded envelope.\n * @param options - Optional configuration options.\n * @returns The decrypted plaintext.\n */\nexport function unsealInWorker(\n envelope: string,\n options?: UnsealInWorkerOptions,\n): Promise<string> {\n return new Promise((resolve, reject) => {\n if (options?.signal?.aborted) return reject(options.signal.reason);\n options?.signal?.addEventListener('abort', handleAbort);\n\n const worker = new Worker(new URL('./worker.js', import.meta.url), {\n type: 'module',\n });\n\n const cleanup = () => {\n worker.terminate();\n options?.signal?.removeEventListener('abort', handleAbort);\n };\n\n worker.onmessage = (event) => {\n if (event.data.success) resolve(event.data.plaintext);\n else reject(event.data.error);\n cleanup();\n };\n\n worker.onerror = (errorEvent) => {\n errorEvent.preventDefault();\n reject(errorEvent.error ?? new Error(errorEvent.message));\n cleanup();\n };\n\n function handleAbort(event: Event) {\n reject((event.target as AbortSignal).reason);\n cleanup();\n }\n\n worker.postMessage(envelope);\n });\n}\n","import { unsealInWorker } from './index.js';\n\nconst html = String.raw;\n\nconst template = document.createElement('template');\ntemplate.innerHTML = html`\n <style>\n :host, #base {\n display: contents;\n }\n\n #widget {\n all: initial;\n display: block;\n box-sizing: border-box;\n width: 300px;\n max-width: 100%;\n border: 1px solid rgba(0, 0, 0, 0.12);\n border-radius: 10px;\n color: #111;\n background: #fff;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);\n font-family:\n Inter, Roboto, \"Helvetica Neue\", \"Arial Nova\", \"Nimbus Sans\", Arial,\n sans-serif;\n font-size: 16px;\n line-height: 1.25;\n -webkit-user-select: none;\n user-select: none;\n }\n\n :host([layout=\"floating\"]) #base {\n display: inline-block;\n position: relative;\n }\n\n :host([layout=\"floating\"]) #widget {\n display: none;\n position: absolute;\n z-index: 1000000;\n opacity: 0;\n transition: opacity .2s ease-in .8s;\n }\n\n :host([layout=\"floating\"][status]) #widget {\n display: block;\n }\n\n :host([layout=\"floating\"][status=\"processing\"]) #widget,\n :host([layout=\"floating\"][status=\"error\"]) #widget {\n opacity: 1;\n transition: opacity .1s ease-out;\n }\n\n :host([layout=\"floating\"][status=\"success\"]) #base {\n position: absolute;\n pointer-events: none;\n }\n\n :host([layout=\"floating\"][status=\"success\"]) #trigger {\n visibility: hidden;\n }\n\n @supports (position-area: block-end span-inline-end) {\n :host([layout=\"floating\"]) #base {\n position: static;\n anchor-name: --base;\n }\n\n :host([layout=\"floating\"]) #widget {\n position: fixed;\n position-anchor: --base;\n position-area: block-end span-inline-end;\n position-try-fallbacks: flip-inline;\n }\n }\n\n button {\n all: unset;\n width: 100%;\n cursor: pointer;\n }\n\n button:focus-visible {\n outline: revert;\n }\n\n button, :host([status]) #status {\n position: relative;\n box-sizing: border-box;\n min-height: 46px;\n padding: 16px 16px 10px 52px;\n border-radius: 6px;\n }\n\n :host([status]) button {\n display: none;\n }\n\n :host([status=\"processing\"]) #status {\n cursor: wait;\n }\n\n button::before, :host([status]) #status::before {\n content: '';\n position: absolute;\n left: 14px;\n top: 50%;\n width: 24px;\n height: 24px;\n margin-top: -10px;\n border: 1px solid #bbb;\n border-radius: 6px;\n }\n\n :host([status=\"processing\"]) #status::before {\n border-radius: 50%;\n border-color: transparent transparent #111 #111;\n animation: spin 1s linear infinite;\n }\n\n :host([status=\"success\"]) #status::before {\n border-color: #16a34a;\n background-color: #16a34a;\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0ibTE4IDgtOCA5LTQtNCIvPjwvc3ZnPg==\");\n }\n\n :host([status=\"error\"]) #status::before {\n border-color: #dc2626;\n background-color: #dc2626;\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0iTTE3IDcgNyAxN003IDdsMTAgMTAiLz48L3N2Zz4=\");\n }\n\n footer {\n text-align: right;\n font-size: 12px;\n color: #666;\n padding: 2px 9px 7px 9px;\n }\n\n footer a {\n color: inherit;\n text-decoration: none;\n }\n\n footer a:hover {\n text-decoration: underline;\n }\n\n @keyframes spin { to { transform: rotate(360deg); } }\n </style>\n <div id=\"base\">\n <slot id=\"trigger\"></slot>\n <article id=\"widget\" lang=\"en\">\n <button type=\"button\">I'm not a robot</button>\n <div id=\"status\" role=\"status\"></div>\n <footer>\n Protected by\n <a\n href=\"https://github.com/jo-phil/treadwheel\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n translate=\"no\"\n >\n Treadwheel\n </a>\n </footer>\n </article>\n </div>\n`;\n\nclass TreadwheelWidget extends HTMLElement {\n private _shadow = this.attachShadow({ mode: 'open' });\n private _abortController?: AbortController;\n\n constructor() {\n super();\n\n this._shadow.appendChild(template.content.cloneNode(true));\n this._shadow.addEventListener('click', this._handleClick);\n this._shadow.getElementById('trigger')?.addEventListener(\n 'slotchange',\n () => {\n if (this.hasAttribute('layout')) return;\n if (this.querySelector('button')) {\n this.setAttribute('layout', 'floating');\n }\n },\n { once: true },\n );\n }\n\n connectedCallback() {\n this._abortController = new AbortController();\n }\n\n disconnectedCallback() {\n this._abortController?.abort();\n }\n\n private _handleClick = async (e: Event) => {\n const target = e.target as HTMLElement | null;\n if (!target?.closest('button')) return;\n\n const envelope = this.getAttribute('envelope');\n if (!envelope) return;\n\n this.setAttribute('status', 'processing');\n this.querySelectorAll('button').forEach((button) => {\n button.disabled = true;\n });\n\n const status = this._shadow.getElementById('status');\n if (status) status.textContent = 'Verifying…';\n\n try {\n const plaintext = await unsealInWorker(envelope, {\n signal: this._abortController?.signal,\n });\n\n this._shadow.removeEventListener('click', this._handleClick);\n this.setAttribute('status', 'success');\n if (status) status.textContent = 'Verified';\n\n const output = document.createElement('div');\n output.slot = '_output';\n output.style.display = 'contents';\n\n if (this.getAttribute('output') === 'html') output.innerHTML = plaintext;\n else output.textContent = plaintext;\n this.append(output);\n\n const style = document.createElement('style');\n style.textContent = ':host{display:contents}';\n\n const slot = document.createElement('slot');\n slot.name = '_output';\n\n const purge = () => {\n this._shadow.replaceChildren(style, slot);\n [...this.childNodes].forEach((node) => {\n if (node !== output) node.remove();\n });\n };\n\n const widget = this._shadow.getElementById('widget');\n if (widget && this.getAttribute('layout') === 'floating') {\n this._shadow.append(slot);\n widget.addEventListener('transitionend', purge, { once: true });\n } else {\n purge();\n }\n } catch (error) {\n if (error instanceof DOMException && error.name === 'AbortError') {\n this.removeAttribute('status');\n if (status) status.textContent = '';\n this.querySelectorAll('button').forEach((button) => {\n button.disabled = false;\n });\n } else {\n this.setAttribute('status', 'error');\n if (status) status.textContent = 'Verification failed';\n }\n }\n };\n}\n\ncustomElements.define('treadwheel-widget', TreadwheelWidget);\n"],"mappings":"AA+DA,SAAgBA,EACd,EACA,EACiB,CACjB,OAAO,IAAI,SAAS,EAAS,IAAW,CACtC,GAAIC,GAAS,QAAQ,QAAS,OAAOC,EAAOD,EAAQ,OAAO,MAAM,EACjEA,GAAS,QAAQ,iBAAiB,QAASE,CAAW,EAEtD,IAAAC,EAAA,IAAA,gBAAA,IAAA,KAAA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AAE,KAAM,EAAK,CACf,CACF,CAEA,mBAAoB,CAClB,KAAK,iBAAmB,IAAI,eAC9B,CAEA,sBAAuB,CACrB,KAAK,kBAAkB,MAAM,CAC/B,CAmEF,EAEA,eAAe,OAAO,oBAAqBC,CAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "treadwheel",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Time-release encryption to protect sensitive information from bots",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anti-scraping",
|
|
@@ -68,20 +68,20 @@
|
|
|
68
68
|
"@biomejs/biome": "2.5.6",
|
|
69
69
|
"@lit-labs/rollup-plugin-minify-html-literals": "^0.2.0",
|
|
70
70
|
"@types/node": "^26.6.6",
|
|
71
|
-
"@vitest/browser-playwright": "^5.0
|
|
72
|
-
"@vitest/coverage-istanbul": "^5.0
|
|
71
|
+
"@vitest/browser-playwright": "^5.1.0",
|
|
72
|
+
"@vitest/coverage-istanbul": "^5.1.0",
|
|
73
73
|
"execa": "^10.2.1",
|
|
74
74
|
"magic-string": "^1.4.5",
|
|
75
75
|
"nyc": "^18.0.0",
|
|
76
|
-
"playwright": "^1.
|
|
77
|
-
"rimraf": "^6.1.
|
|
78
|
-
"tsdown": "^0.23.
|
|
76
|
+
"playwright": "^1.65.0",
|
|
77
|
+
"rimraf": "^6.1.4",
|
|
78
|
+
"tsdown": "^0.23.7",
|
|
79
79
|
"tsx": "^4.23.15",
|
|
80
80
|
"typedoc": "^0.28.20",
|
|
81
81
|
"typedoc-plugin-markdown": "^4.14.1",
|
|
82
82
|
"typescript": "^5.9.3",
|
|
83
83
|
"vitepress": "^1.6.4",
|
|
84
|
-
"vitest": "^5.0
|
|
84
|
+
"vitest": "^5.1.0"
|
|
85
85
|
},
|
|
86
86
|
"packageManager": "pnpm@12.16.1",
|
|
87
87
|
"engines": {
|