@kynesyslabs/demosdk 2.7.9 → 2.8.0

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.
@@ -37,9 +37,35 @@
37
37
  *
38
38
  * console.log('Proof stored:', txHash);
39
39
  * ```
40
+ *
41
+ * @example Using low-level tlsn-js classes (re-exported for convenience)
42
+ * ```typescript
43
+ * import {
44
+ * Prover, Presentation, NotaryServer, Transcript,
45
+ * init as initTlsnWasm
46
+ * } from '@kynesyslabs/demosdk/tlsnotary';
47
+ *
48
+ * // Initialize WASM (required before using Prover/Presentation)
49
+ * await initTlsnWasm({ loggingLevel: 'Info' });
50
+ *
51
+ * // Now you can use the classes directly without installing tlsn-js
52
+ * const notary = NotaryServer.from('wss://notary.example.com');
53
+ * const prover = await new Prover({ serverDns: 'api.example.com' });
54
+ * ```
40
55
  */
41
56
  export { TLSNotary } from "./TLSNotary";
42
57
  export { TLSNotaryService, type AttestationTokenResponse, type StoreProofResponse, type TLSNotaryToken, type RequestAttestationOptions, type StoreProofOptions, } from "./TLSNotaryService";
43
58
  export type { TLSNotaryConfig, TLSNotaryDiscoveryInfo, AttestRequest, AttestResult, AttestOptions, CommitRanges, Range, PresentationJSON, VerificationResult, TranscriptInfo, StatusCallback, ProxyRequestResponse, ProxyRequestError, } from "./types";
44
59
  export { default } from "./TLSNotary";
45
60
  export { calculateStorageFee } from "./helpers";
61
+ /**
62
+ * Re-export tlsn-js classes and functions for convenience.
63
+ *
64
+ * This allows users to import everything from '@kynesyslabs/demosdk/tlsnotary'
65
+ * without needing to install tlsn-js as a separate dependency.
66
+ *
67
+ * Note: The WASM must still be initialized (call `init()`) before using
68
+ * Prover or Presentation classes.
69
+ */
70
+ export { default as init, Prover, Presentation, NotaryServer, Transcript, type Commit, type Reveal, type Method, type ProverConfig, type LoggingLevel, type LoggingConfig, } from "tlsn-js";
71
+ export type { PresentationJSON as TlsnPresentationJSON, } from "tlsn-js/build/types";
@@ -38,12 +38,27 @@
38
38
  *
39
39
  * console.log('Proof stored:', txHash);
40
40
  * ```
41
+ *
42
+ * @example Using low-level tlsn-js classes (re-exported for convenience)
43
+ * ```typescript
44
+ * import {
45
+ * Prover, Presentation, NotaryServer, Transcript,
46
+ * init as initTlsnWasm
47
+ * } from '@kynesyslabs/demosdk/tlsnotary';
48
+ *
49
+ * // Initialize WASM (required before using Prover/Presentation)
50
+ * await initTlsnWasm({ loggingLevel: 'Info' });
51
+ *
52
+ * // Now you can use the classes directly without installing tlsn-js
53
+ * const notary = NotaryServer.from('wss://notary.example.com');
54
+ * const prover = await new Prover({ serverDns: 'api.example.com' });
55
+ * ```
41
56
  */
42
57
  var __importDefault = (this && this.__importDefault) || function (mod) {
43
58
  return (mod && mod.__esModule) ? mod : { "default": mod };
44
59
  };
45
60
  Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.calculateStorageFee = exports.default = exports.TLSNotaryService = exports.TLSNotary = void 0;
61
+ exports.Transcript = exports.NotaryServer = exports.Presentation = exports.Prover = exports.init = exports.calculateStorageFee = exports.default = exports.TLSNotaryService = exports.TLSNotary = void 0;
47
62
  // Core TLSNotary class for attestation
48
63
  var TLSNotary_1 = require("./TLSNotary");
49
64
  Object.defineProperty(exports, "TLSNotary", { enumerable: true, get: function () { return TLSNotary_1.TLSNotary; } });
@@ -56,4 +71,21 @@ Object.defineProperty(exports, "default", { enumerable: true, get: function () {
56
71
  // Helper function exports
57
72
  var helpers_1 = require("./helpers");
58
73
  Object.defineProperty(exports, "calculateStorageFee", { enumerable: true, get: function () { return helpers_1.calculateStorageFee; } });
74
+ /**
75
+ * Re-export tlsn-js classes and functions for convenience.
76
+ *
77
+ * This allows users to import everything from '@kynesyslabs/demosdk/tlsnotary'
78
+ * without needing to install tlsn-js as a separate dependency.
79
+ *
80
+ * Note: The WASM must still be initialized (call `init()`) before using
81
+ * Prover or Presentation classes.
82
+ */
83
+ var tlsn_js_1 = require("tlsn-js");
84
+ // WASM initialization
85
+ Object.defineProperty(exports, "init", { enumerable: true, get: function () { return __importDefault(tlsn_js_1).default; } });
86
+ // Core classes
87
+ Object.defineProperty(exports, "Prover", { enumerable: true, get: function () { return tlsn_js_1.Prover; } });
88
+ Object.defineProperty(exports, "Presentation", { enumerable: true, get: function () { return tlsn_js_1.Presentation; } });
89
+ Object.defineProperty(exports, "NotaryServer", { enumerable: true, get: function () { return tlsn_js_1.NotaryServer; } });
90
+ Object.defineProperty(exports, "Transcript", { enumerable: true, get: function () { return tlsn_js_1.Transcript; } });
59
91
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tlsnotary/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;;;;;;AAEH,uCAAuC;AACvC,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAElB,2DAA2D;AAC3D,uDAO2B;AANvB,oHAAA,gBAAgB,OAAA;AAyBpB,oBAAoB;AACpB,yCAAqC;AAA5B,qHAAA,OAAO,OAAA;AAEhB,0BAA0B;AAC1B,qCAA+C;AAAtC,8GAAA,mBAAmB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tlsnotary/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;;;;;;AAEH,uCAAuC;AACvC,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAElB,2DAA2D;AAC3D,uDAO2B;AANvB,oHAAA,gBAAgB,OAAA;AAyBpB,oBAAoB;AACpB,yCAAqC;AAA5B,qHAAA,OAAO,OAAA;AAEhB,0BAA0B;AAC1B,qCAA+C;AAAtC,8GAAA,mBAAmB,OAAA;AAE5B;;;;;;;;GAQG;AACH,mCAegB;AAdZ,sBAAsB;AACtB,gHAAA,OAAO,OAAQ;AACf,eAAe;AACf,iGAAA,MAAM,OAAA;AACN,uGAAA,YAAY,OAAA;AACZ,uGAAA,YAAY,OAAA;AACZ,qGAAA,UAAU,OAAA"}
@@ -0,0 +1 @@
1
+ function registerMessageListener(e,s,a){e.addEventListener("message",(async e=>{const t=e.data;t&&t.type===s&&await a(t.data)}))}registerMessageListener(self,"web_spawn_start_spawner",(async e=>{const s=new URL("./spawn.js",import.meta.url),[a,t,n]=e,r=await import("../../../tlsn_wasm.js");await r.default({module:a,memory:t});const w=r.web_spawn_recover_spawner(n);postMessage("web_spawn_spawner_ready"),await w.run(s.toString()),close()})),registerMessageListener(self,"web_spawn_start_worker",(async e=>{const[s,a,t]=e,n=await import("../../../tlsn_wasm.js");await n.default({module:s,memory:a}),n.web_spawn_start_worker(t),close()}));export async function startSpawnerWorker(e,s,a){const t=new URL("./spawn.js",import.meta.url),n=new Worker(t,{name:"web-spawn-spawner",type:"module"}),r=[e,s,a.intoRaw()];n.postMessage({type:"web_spawn_start_spawner",data:r}),await new Promise((e=>{n.addEventListener("message",(function s(a){"web_spawn_spawner_ready"===a.data&&(n.removeEventListener("message",s),e())}))}))}
@@ -0,0 +1,3 @@
1
+ /*! For license information please see lib.js.LICENSE.txt */
2
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,(()=>(()=>{var t={33:(t,e,n)=>{"use strict";t.exports=n.p+"a6de6b189c13ad309102.js"},251:(t,e)=>{e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,f=(1<<a)-1,u=f>>1,c=-7,_=n?i-1:0,g=n?-1:1,l=t[e+_];for(_+=g,o=l&(1<<-c)-1,l>>=-c,c+=a;c>0;o=256*o+t[e+_],_+=g,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+t[e+_],_+=g,c-=8);if(0===o)o=1-u;else{if(o===f)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,r),o-=u}return(l?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,f,u=8*o-i-1,c=(1<<u)-1,_=c>>1,g=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=r?0:o-1,w=r?1:-1,h=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-s))<1&&(s--,f*=2),(e+=s+_>=1?g/f:g*Math.pow(2,1-_))*f>=2&&(s++,f/=2),s+_>=c?(a=0,s=c):s+_>=1?(a=(e*f-1)*Math.pow(2,i),s+=_):(a=e*Math.pow(2,_-1)*Math.pow(2,i),s=0));i>=8;t[n+l]=255&a,l+=w,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+l]=255&s,l+=w,s/=256,u-=8);t[n+l-w]|=128*h}},287:(t,e,n)=>{"use strict";const r=n(526),i=n(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=f,e.IS=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,f.prototype),e}function f(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return _(t)}return u(t,e,n)}function u(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|h(t,e);let r=a(n);const i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(K(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return g(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(K(t,ArrayBuffer)||t&&K(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(K(t,SharedArrayBuffer)||t&&K(t.buffer,SharedArrayBuffer)))return l(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return f.from(r,e,n);const i=function(t){if(f.isBuffer(t)){const e=0|w(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?a(0):g(t):"Buffer"===t.type&&Array.isArray(t.data)?g(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return f.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function _(t){return c(t),a(t<0?0:0|w(t))}function g(t){const e=t.length<0?0:0|w(t.length),n=a(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function l(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,f.prototype),r}function w(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function h(t,e){if(f.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||K(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Y(t).length;default:if(i)return r?-1:V(t).length;e=(""+e).toLowerCase(),i=!0}}function b(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,n);case"utf8":case"utf-8":return I(this,e,n);case"ascii":return x(this,e,n);case"latin1":case"binary":return S(this,e,n);case"base64":return R(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function d(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function p(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=f.from(e,r)),f.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){let o,s=1,a=t.length,f=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,f/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(u(t,o)===u(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===f)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+f>a&&(n=a-f),o=n;o>=0;o--){let n=!0;for(let r=0;r<f;r++)if(u(t,o+r)!==u(e,r)){n=!1;break}if(n)return o}return-1}function m(t,e,n,r){n=Number(n)||0;const i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s<r;++s){const r=parseInt(e.substr(2*s,2),16);if(J(r))return s;t[n+s]=r}return s}function v(t,e,n,r){return H(V(e,t.length-n),t,n,r)}function E(t,e,n,r){return H(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function B(t,e,n,r){return H(Y(e),t,n,r)}function A(t,e,n,r){return H(function(t,e){let n,r,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function R(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function I(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i<n;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,f;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(f=(31&e)<<6|63&n,f>127&&(o=f));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(f=(15&e)<<12|(63&n)<<6|63&r,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(f=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,f>65535&&f<1114112&&(o=f))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=U)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=U));return n}(r)}f.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),f.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.buffer}}),Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.byteOffset}}),f.poolSize=8192,f.from=function(t,e,n){return u(t,e,n)},Object.setPrototypeOf(f.prototype,Uint8Array.prototype),Object.setPrototypeOf(f,Uint8Array),f.alloc=function(t,e,n){return function(t,e,n){return c(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},f.allocUnsafe=function(t){return _(t)},f.allocUnsafeSlow=function(t){return _(t)},f.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==f.prototype},f.compare=function(t,e){if(K(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),K(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(t)||!f.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},f.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=f.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(K(e,Uint8Array))i+e.length>r.length?(f.isBuffer(e)||(e=f.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!f.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},f.byteLength=h,f.prototype._isBuffer=!0,f.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)d(this,e,e+1);return this},f.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},f.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},f.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?I(this,0,t):b.apply(this,arguments)},f.prototype.toLocaleString=f.prototype.toString,f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){let t="";const n=e.IS;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},o&&(f.prototype[o]=f.prototype.inspect),f.prototype.compare=function(t,e,n,r,i){if(K(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),!f.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),u=this.slice(r,i),c=t.slice(e,n);for(let t=0;t<a;++t)if(u[t]!==c[t]){o=u[t],s=c[t];break}return o<s?-1:s<o?1:0},f.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},f.prototype.indexOf=function(t,e,n){return p(this,t,e,n,!0)},f.prototype.lastIndexOf=function(t,e,n){return p(this,t,e,n,!1)},f.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return m(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return E(this,t,e,n);case"base64":return B(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const U=4096;function x(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function S(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function O(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=Z[t[r]];return i}function z(t,e,n){const r=t.slice(e,n);let i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function T(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function k(t,e,n,r,i,o){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function L(t,e,n,r,i){N(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function j(t,e,n,r,i){N(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function M(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(t,e,n,r,o){return e=+e,n>>>=0,o||M(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function C(t,e,n,r,o){return e=+e,n>>>=0,o||M(t,0,n,8),i.write(t,e,n,r,52,8),n+8}f.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,f.prototype),r},f.prototype.readUintLE=f.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||T(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},f.prototype.readUintBE=f.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||T(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},f.prototype.readUint8=f.prototype.readUInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),this[t]},f.prototype.readUint16LE=f.prototype.readUInt16LE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUint16BE=f.prototype.readUInt16BE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUint32LE=f.prototype.readUInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUint32BE=f.prototype.readUInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readBigUInt64LE=Q((function(t){D(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||q(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),f.prototype.readBigUInt64BE=Q((function(t){D(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||q(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),f.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||T(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},f.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||T(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},f.prototype.readInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,e){t>>>=0,e||T(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},f.prototype.readInt16BE=function(t,e){t>>>=0,e||T(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},f.prototype.readInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readBigInt64LE=Q((function(t){D(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||q(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),f.prototype.readBigInt64BE=Q((function(t){D(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||q(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),f.prototype.readFloatLE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,e){return t>>>=0,e||T(t,8,this.length),i.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,e){return t>>>=0,e||T(t,8,this.length),i.read(this,t,!1,52,8)},f.prototype.writeUintLE=f.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||k(this,t,e,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},f.prototype.writeUintBE=f.prototype.writeUIntBE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||k(this,t,e,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},f.prototype.writeUint8=f.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,1,255,0),this[e]=255&t,e+1},f.prototype.writeUint16LE=f.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},f.prototype.writeUint16BE=f.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},f.prototype.writeUint32LE=f.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},f.prototype.writeUint32BE=f.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},f.prototype.writeBigUInt64LE=Q((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),f.prototype.writeBigUInt64BE=Q((function(t,e=0){return j(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),f.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);k(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+n},f.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);k(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+n},f.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},f.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},f.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},f.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},f.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},f.prototype.writeBigInt64LE=Q((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),f.prototype.writeBigInt64BE=Q((function(t,e=0){return j(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),f.prototype.writeFloatLE=function(t,e,n){return P(this,t,e,!0,n)},f.prototype.writeFloatBE=function(t,e,n){return P(this,t,e,!1,n)},f.prototype.writeDoubleLE=function(t,e,n){return C(this,t,e,!0,n)},f.prototype.writeDoubleBE=function(t,e,n){return C(this,t,e,!1,n)},f.prototype.copy=function(t,e,n,r){if(!f.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},f.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!f.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const o=f.isBuffer(t)?t:f.from(t,r),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%s]}return this};const $={};function F(t,e,n){$[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function W(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function N(t,e,n,r,i,o){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new $.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){D(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||q(e,t.length-(n+1))}(r,i,o)}function D(t,e){if("number"!=typeof t)throw new $.ERR_INVALID_ARG_TYPE(e,"number",t)}function q(t,e,n){if(Math.floor(t)!==t)throw D(t,n),new $.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=W(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=W(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function V(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Y(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function K(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Q(t){return"undefined"==typeof BigInt?X:t}function X(){throw new Error("BigInt not supported")}},526:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],f=o[1],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,f)),c=0,_=f>0?s-4:s;for(n=0;n<_;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],u[c++]=e>>16&255,u[c++]=e>>8&255,u[c++]=255&e;return 2===f&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,u[c++]=255&e),1===f&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,u[c++]=e>>8&255,u[c++]=255&e),u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,u=r-i;a<u;a+=s)o.push(f(t,a,a+s>u?u:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function f(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},822:(t,e,n)=>{"use strict";function r(t,e,n){t.addEventListener("message",(async t=>{const r=t.data;r&&r.type===e&&await n(r.data)}))}let i;n.r(e),n.d(e,{Attestation:()=>M,NotarizationOutput:()=>C,Presentation:()=>F,Prover:()=>N,Secrets:()=>q,Spawner:()=>V,Verifier:()=>H,WorkerData:()=>J,build_presentation:()=>I,default:()=>nt,initSync:()=>tt,initialize:()=>R,startSpawner:()=>S,web_spawn_recover_spawner:()=>x,web_spawn_start_worker:()=>U}),r(self,"web_spawn_start_spawner",(async t=>{const e=new URL(n(33),n.b),[r,i,o]=t,s=await Promise.resolve().then(n.bind(n,822));await s.default({module:r,memory:i});const a=s.web_spawn_recover_spawner(o);postMessage("web_spawn_spawner_ready"),await a.run(e.toString()),close()})),r(self,"web_spawn_start_worker",(async t=>{const[e,r,i]=t,o=await Promise.resolve().then(n.bind(n,822));await o.default({module:e,memory:r}),o.web_spawn_start_worker(i),close()}));let o=0,s=null;function a(){return null!==s&&s.buffer===i.memory.buffer||(s=new Uint8Array(i.memory.buffer)),s}const f="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},u=function(t,e){const n=f.encode(t);return e.set(n),{read:t.length,written:n.length}};function c(t,e,n){if(void 0===n){const n=f.encode(t),r=e(n.length,1)>>>0;return a().subarray(r,r+n.length).set(n),o=n.length,r}let r=t.length,i=e(r,1)>>>0;const s=a();let c=0;for(;c<r;c++){const e=t.charCodeAt(c);if(e>127)break;s[i+c]=e}if(c!==r){0!==c&&(t=t.slice(c)),i=n(i,r,r=c+3*t.length,1)>>>0;const e=a().subarray(i+c,i+r);c+=u(t,e).written,i=n(i,r,c,1)>>>0}return o=c,i}let _=null;function g(){return null!==_&&_.buffer===i.memory.buffer||(_=new DataView(i.memory.buffer)),_}function l(t){const e=i.__externref_table_alloc();return i.__wbindgen_export_5.set(e,t),e}function w(t,e){try{return t.apply(this,e)}catch(t){const e=l(t);i.__wbindgen_exn_store(e)}}const h="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};function b(t,e){return t>>>=0,h.decode(a().slice(t,t+e))}function d(t){return null==t}"undefined"!=typeof TextDecoder&&h.decode();const p="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>{i.__wbindgen_export_7.get(t.dtor)(t.a,t.b)}));function y(t,e,n,r){const o={a:t,b:e,cnt:1,dtor:n},s=(...t)=>{o.cnt++;const e=o.a;o.a=0;try{return r(e,o.b,...t)}finally{0==--o.cnt?(i.__wbindgen_export_7.get(o.dtor)(e,o.b),p.unregister(o)):o.a=e}};return s.original=o,p.register(s,o,o),s}function m(t){const e=typeof t;if("number"==e||"boolean"==e||null==t)return`${t}`;if("string"==e)return`"${t}"`;if("symbol"==e){const e=t.description;return null==e?"Symbol":`Symbol(${e})`}if("function"==e){const e=t.name;return"string"==typeof e&&e.length>0?`Function(${e})`:"Function"}if(Array.isArray(t)){const e=t.length;let n="[";e>0&&(n+=m(t[0]));for(let r=1;r<e;r++)n+=", "+m(t[r]);return n+="]",n}const n=/\[object ([^\]]+)\]/.exec(toString.call(t));let r;if(!(n&&n.length>1))return toString.call(t);if(r=n[1],"Object"==r)try{return"Object("+JSON.stringify(t)+")"}catch(t){return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:r}function v(t){const e=i.__wbindgen_export_5.get(t);return i.__externref_table_dealloc(t),e}function E(t,e){return t>>>=0,a().subarray(t/1,t/1+e)}function B(t,e){const n=e(1*t.length,1)>>>0;return a().set(t,n/1),o=t.length,n}function A(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`)}function R(t,e){return i.initialize(d(t)?0:l(t),e)}function I(t,e,n){A(t,M),A(e,q);const r=i.build_presentation(t.__wbg_ptr,e.__wbg_ptr,n);if(r[2])throw v(r[1]);return F.__wrap(r[0])}function U(t){i.web_spawn_start_worker(t)}function x(t){const e=i.web_spawn_recover_spawner(t);return V.__wrap(e)}function S(){return i.startSpawner()}function O(t,e){i._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36d577a13c442f93(t,e)}function z(t,e,n){i.closure1094_externref_shim(t,e,n)}function T(t,e,n){i.closure3738_externref_shim(t,e,n)}const k=["blob","arraybuffer"],L=["classic","module"],j="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>i.__wbg_attestation_free(t>>>0,1)));class M{static __wrap(t){t>>>=0;const e=Object.create(M.prototype);return e.__wbg_ptr=t,j.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,j.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_attestation_free(t,0)}verifying_key(){return i.attestation_verifying_key(this.__wbg_ptr)}serialize(){const t=i.attestation_serialize(this.__wbg_ptr);var e=E(t[0],t[1]).slice();return i.__wbindgen_free(t[0],1*t[1],1),e}static deserialize(t){const e=B(t,i.__wbindgen_malloc),n=o,r=i.attestation_deserialize(e,n);if(r[2])throw v(r[1]);return M.__wrap(r[0])}}const P="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>i.__wbg_notarizationoutput_free(t>>>0,1)));class C{static __wrap(t){t>>>=0;const e=Object.create(C.prototype);return e.__wbg_ptr=t,P.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,P.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_notarizationoutput_free(t,0)}get attestation(){const t=i.__wbg_get_notarizationoutput_attestation(this.__wbg_ptr);return M.__wrap(t)}set attestation(t){A(t,M);var e=t.__destroy_into_raw();i.__wbg_set_notarizationoutput_attestation(this.__wbg_ptr,e)}get secrets(){const t=i.__wbg_get_notarizationoutput_secrets(this.__wbg_ptr);return q.__wrap(t)}set secrets(t){A(t,q);var e=t.__destroy_into_raw();i.__wbg_set_notarizationoutput_secrets(this.__wbg_ptr,e)}}const $="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>i.__wbg_presentation_free(t>>>0,1)));class F{static __wrap(t){t>>>=0;const e=Object.create(F.prototype);return e.__wbg_ptr=t,$.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,$.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_presentation_free(t,0)}verifying_key(){return i.presentation_verifying_key(this.__wbg_ptr)}verify(){const t=i.presentation_verify(this.__wbg_ptr);if(t[2])throw v(t[1]);return v(t[0])}serialize(){const t=i.presentation_serialize(this.__wbg_ptr);var e=E(t[0],t[1]).slice();return i.__wbindgen_free(t[0],1*t[1],1),e}static deserialize(t){const e=B(t,i.__wbindgen_malloc),n=o,r=i.presentation_deserialize(e,n);if(r[2])throw v(r[1]);return F.__wrap(r[0])}}const W="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>i.__wbg_prover_free(t>>>0,1)));class N{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,W.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_prover_free(t,0)}constructor(t){const e=i.prover_new(t);return this.__wbg_ptr=e>>>0,W.register(this,this.__wbg_ptr,this),this}setup(t){const e=c(t,i.__wbindgen_malloc,i.__wbindgen_realloc),n=o;return i.prover_setup(this.__wbg_ptr,e,n)}send_request(t,e){const n=c(t,i.__wbindgen_malloc,i.__wbindgen_realloc),r=o;return i.prover_send_request(this.__wbg_ptr,n,r,e)}transcript(){const t=i.prover_transcript(this.__wbg_ptr);if(t[2])throw v(t[1]);return v(t[0])}notarize(t){return i.prover_notarize(this.__wbg_ptr,t)}reveal(t){return i.prover_reveal(this.__wbg_ptr,t)}}const D="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>i.__wbg_secrets_free(t>>>0,1)));class q{static __wrap(t){t>>>=0;const e=Object.create(q.prototype);return e.__wbg_ptr=t,D.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,D.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_secrets_free(t,0)}transcript(){return i.secrets_transcript(this.__wbg_ptr)}serialize(){const t=i.secrets_serialize(this.__wbg_ptr);var e=E(t[0],t[1]).slice();return i.__wbindgen_free(t[0],1*t[1],1),e}static deserialize(t){const e=B(t,i.__wbindgen_malloc),n=o,r=i.secrets_deserialize(e,n);if(r[2])throw v(r[1]);return q.__wrap(r[0])}}const G="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>i.__wbg_spawner_free(t>>>0,1)));class V{static __wrap(t){t>>>=0;const e=Object.create(V.prototype);return e.__wbg_ptr=t,G.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,G.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_spawner_free(t,0)}intoRaw(){const t=this.__destroy_into_raw();return i.spawner_intoRaw(t)>>>0}run(t){const e=c(t,i.__wbindgen_malloc,i.__wbindgen_realloc),n=o;return i.spawner_run(this.__wbg_ptr,e,n)}}const Y="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>i.__wbg_verifier_free(t>>>0,1)));class H{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Y.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_verifier_free(t,0)}constructor(t){const e=i.verifier_new(t);return this.__wbg_ptr=e>>>0,Y.register(this,this.__wbg_ptr,this),this}connect(t){const e=c(t,i.__wbindgen_malloc,i.__wbindgen_realloc),n=o;return i.verifier_connect(this.__wbg_ptr,e,n)}verify(){return i.verifier_verify(this.__wbg_ptr)}}const K="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>i.__wbg_workerdata_free(t>>>0,1)));class J{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,K.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_workerdata_free(t,0)}}function Z(){const t={wbg:{}};return t.wbg.__wbg_String_8f0eb39a4a4c2f66=function(t,e){const n=c(String(e),i.__wbindgen_malloc,i.__wbindgen_realloc),r=o;g().setInt32(t+4,r,!0),g().setInt32(t+0,n,!0)},t.wbg.__wbg_async_9ff6d9e405f13772=function(t){return t.async},t.wbg.__wbg_buffer_609cc3eee51ed158=function(t){return t.buffer},t.wbg.__wbg_call_672a4d21634d4a24=function(){return w((function(t,e){return t.call(e)}),arguments)},t.wbg.__wbg_call_7cccdd69e0791ae2=function(){return w((function(t,e,n){return t.call(e,n)}),arguments)},t.wbg.__wbg_close_2893b7d056a0627d=function(){return w((function(t){t.close()}),arguments)},t.wbg.__wbg_code_cfd8f6868bdaed9b=function(t){return t.code},t.wbg.__wbg_code_f4ec1e6e2e1b0417=function(t){return t.code},t.wbg.__wbg_crypto_574e78ad8b13b65f=function(t){return t.crypto},t.wbg.__wbg_data_432d9c3df2630942=function(t){return t.data},t.wbg.__wbg_debug_3cb59063b29f58c1=function(t){console.debug(t)},t.wbg.__wbg_debug_e17b51583ca6a632=function(t,e,n,r){console.debug(t,e,n,r)},t.wbg.__wbg_done_769e5ede4b31c67b=function(t){return t.done},t.wbg.__wbg_entries_3265d4158b33e5dc=function(t){return Object.entries(t)},t.wbg.__wbg_error_524f506f44df1645=function(t){console.error(t)},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(t,e){let n,r;try{n=t,r=e,console.error(b(t,e))}finally{i.__wbindgen_free(n,r,1)}},t.wbg.__wbg_error_80de38b3f7cc3c3c=function(t,e,n,r){console.error(t,e,n,r)},t.wbg.__wbg_getRandomValues_80578b2ff2a093ba=function(){return w((function(t){globalThis.crypto.getRandomValues(t)}),arguments)},t.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return w((function(t,e){t.getRandomValues(e)}),arguments)},t.wbg.__wbg_get_67b2ba62fc30de12=function(){return w((function(t,e){return Reflect.get(t,e)}),arguments)},t.wbg.__wbg_get_b9b93047fe3cf45b=function(t,e){return t[e>>>0]},t.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(t,e){return t[e]},t.wbg.__wbg_info_033d8b8a0838f1d3=function(t,e,n,r){console.info(t,e,n,r)},t.wbg.__wbg_info_3daf2e093e091b66=function(t){console.info(t)},t.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc=function(t){let e;try{e=t instanceof ArrayBuffer}catch(t){e=!1}return e},t.wbg.__wbg_instanceof_Blob_ca721ef3bdab15d1=function(t){let e;try{e=t instanceof Blob}catch(t){e=!1}return e},t.wbg.__wbg_instanceof_Map_f3469ce2244d2430=function(t){let e;try{e=t instanceof Map}catch(t){e=!1}return e},t.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9=function(t){let e;try{e=t instanceof Uint8Array}catch(t){e=!1}return e},t.wbg.__wbg_isArray_a1eab7e0d067391b=function(t){return Array.isArray(t)},t.wbg.__wbg_isSafeInteger_343e2beeeece1bb0=function(t){return Number.isSafeInteger(t)},t.wbg.__wbg_iterator_9a24c88df860dc65=function(){return Symbol.iterator},t.wbg.__wbg_length_a446193dc22c12f8=function(t){return t.length},t.wbg.__wbg_length_e2d2a49132c1b256=function(t){return t.length},t.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(t){return t.msCrypto},t.wbg.__wbg_new_23a2665fac83c611=function(t,e){try{var n={a:t,b:e};const r=new Promise(((t,e)=>{const r=n.a;n.a=0;try{return function(t,e,n,r){i.closure4289_externref_shim(t,e,n,r)}(r,n.b,t,e)}finally{n.a=r}}));return r}finally{n.a=n.b=0}},t.wbg.__wbg_new_405e22f390576ce2=function(){return new Object},t.wbg.__wbg_new_757fd34d47ff40d2=function(t){return new ArrayBuffer(t>>>0)},t.wbg.__wbg_new_78feb108b6472713=function(){return new Array},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},t.wbg.__wbg_new_92c54fc74574ef55=function(){return w((function(t,e){return new WebSocket(b(t,e))}),arguments)},t.wbg.__wbg_new_a12002a7f91c75be=function(t){return new Uint8Array(t)},t.wbg.__wbg_new_b1a33e5095abf678=function(){return w((function(t,e){return new Worker(b(t,e))}),arguments)},t.wbg.__wbg_new_e9a4a67dbababe57=function(t){return new Int32Array(t)},t.wbg.__wbg_newnoargs_105ed471475aaf50=function(t,e){return new Function(b(t,e))},t.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(t,e,n){return new Uint8Array(t,e>>>0,n>>>0)},t.wbg.__wbg_newwithlength_a381634e90c276d4=function(t){return new Uint8Array(t>>>0)},t.wbg.__wbg_newwithoptions_0419cac3977d7f7f=function(){return w((function(t,e,n){return new Worker(b(t,e),n)}),arguments)},t.wbg.__wbg_newwithstrsequence_6e9d6479e1cf978d=function(){return w((function(t,e,n){return new WebSocket(b(t,e),n)}),arguments)},t.wbg.__wbg_next_25feadfc0913fea9=function(t){return t.next},t.wbg.__wbg_next_6574e1a8a62d1055=function(){return w((function(t){return t.next()}),arguments)},t.wbg.__wbg_node_905d3e251edff8a2=function(t){return t.node},t.wbg.__wbg_notarizationoutput_new=function(t){return C.__wrap(t)},t.wbg.__wbg_now_2c95c9de01293173=function(t){return t.now()},t.wbg.__wbg_now_807e54c39636c349=function(){return Date.now()},t.wbg.__wbg_of_4a05197bfc89556f=function(t,e,n){return Array.of(t,e,n)},t.wbg.__wbg_performance_7a3ffd0b17f663ad=function(t){return t.performance},t.wbg.__wbg_postMessage_6edafa8f7b9c2f52=function(){return w((function(t,e){t.postMessage(e)}),arguments)},t.wbg.__wbg_process_dc0fbacc7c1c06f7=function(t){return t.process},t.wbg.__wbg_push_737cfc8c1432c2c6=function(t,e){return t.push(e)},t.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5=function(t){queueMicrotask(t)},t.wbg.__wbg_queueMicrotask_d3219def82552485=function(t){return t.queueMicrotask},t.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return w((function(t,e){t.randomFillSync(e)}),arguments)},t.wbg.__wbg_readyState_7ef6e63c349899ed=function(t){return t.readyState},t.wbg.__wbg_reason_49f1cede8bcf23dd=function(t,e){const n=c(e.reason,i.__wbindgen_malloc,i.__wbindgen_realloc),r=o;g().setInt32(t+4,r,!0),g().setInt32(t+0,n,!0)},t.wbg.__wbg_require_60cc747a6bc5215a=function(){return w((function(){return module.require}),arguments)},t.wbg.__wbg_resolve_4851785c9c5f573d=function(t){return Promise.resolve(t)},t.wbg.__wbg_send_0293179ba074ffb4=function(){return w((function(t,e,n){t.send(b(e,n))}),arguments)},t.wbg.__wbg_send_7c4769e24cf1d784=function(){return w((function(t,e){t.send(e)}),arguments)},t.wbg.__wbg_set_37837023f3d740e8=function(t,e,n){t[e>>>0]=n},t.wbg.__wbg_set_3f1d0b984ed272ed=function(t,e,n){t[e]=n},t.wbg.__wbg_set_65595bdd868b3009=function(t,e,n){t.set(e,n>>>0)},t.wbg.__wbg_set_bb8cecf6a62b9f46=function(){return w((function(t,e,n){return Reflect.set(t,e,n)}),arguments)},t.wbg.__wbg_setbinaryType_92fa1ffd873b327c=function(t,e){t.binaryType=k[e]},t.wbg.__wbg_setname_73878b09a5ee3d0c=function(t,e,n){t.name=b(e,n)},t.wbg.__wbg_setonclose_14fc475a49d488fc=function(t,e){t.onclose=e},t.wbg.__wbg_setonerror_8639efe354b947cd=function(t,e){t.onerror=e},t.wbg.__wbg_setonmessage_5a885b16bdc6dca6=function(t,e){t.onmessage=e},t.wbg.__wbg_setonmessage_6eccab530a8fb4c7=function(t,e){t.onmessage=e},t.wbg.__wbg_setonopen_2da654e1f39745d5=function(t,e){t.onopen=e},t.wbg.__wbg_settype_47fae7d6c82625e7=function(t,e){t.type=L[e]},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(t,e){const n=c(e.stack,i.__wbindgen_malloc,i.__wbindgen_realloc),r=o;g().setInt32(t+4,r,!0),g().setInt32(t+0,n,!0)},t.wbg.__wbg_startSpawnerWorker_74e47ad8e112560b=function(t,e,r){return async function(t,e,r){const i=new URL(n(33),n.b),o=new Worker(i,{name:"web-spawn-spawner",type:"module"}),s=[t,e,r.intoRaw()];o.postMessage({type:"web_spawn_start_spawner",data:s}),await new Promise((t=>{o.addEventListener("message",(function e(n){"web_spawn_spawner_ready"===n.data&&(o.removeEventListener("message",e),t())}))}))}(t,e,V.__wrap(r))},t.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const t="undefined"==typeof global?null:global;return d(t)?0:l(t)},t.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const t="undefined"==typeof globalThis?null:globalThis;return d(t)?0:l(t)},t.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const t="undefined"==typeof self?null:self;return d(t)?0:l(t)},t.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const t="undefined"==typeof window?null:window;return d(t)?0:l(t)},t.wbg.__wbg_subarray_aa9065fa9dc5df96=function(t,e,n){return t.subarray(e>>>0,n>>>0)},t.wbg.__wbg_then_44b73946d2fb3e7d=function(t,e){return t.then(e)},t.wbg.__wbg_then_48b406749878a531=function(t,e,n){return t.then(e,n)},t.wbg.__wbg_timeOrigin_9f29a08704a944d0=function(t){return t.timeOrigin},t.wbg.__wbg_url_ce9ab75bf9627ae4=function(t,e){const n=c(e.url,i.__wbindgen_malloc,i.__wbindgen_realloc),r=o;g().setInt32(t+4,r,!0),g().setInt32(t+0,n,!0)},t.wbg.__wbg_value_cd1ffa7b1ab794f1=function(t){return t.value},t.wbg.__wbg_value_dab73d3d5d4abaaf=function(t){return t.value},t.wbg.__wbg_versions_c01dfd4722a88165=function(t){return t.versions},t.wbg.__wbg_waitAsync_61f0a081053dd3c2=function(t,e,n){return Atomics.waitAsync(t,e>>>0,n)},t.wbg.__wbg_waitAsync_7ce6c8a047c752c3=function(){return Atomics.waitAsync},t.wbg.__wbg_warn_4ca3906c248c47c4=function(t){console.warn(t)},t.wbg.__wbg_warn_aaf1f4664a035bd6=function(t,e,n,r){console.warn(t,e,n,r)},t.wbg.__wbg_wasClean_605b4fd66d44354a=function(t){return t.wasClean},t.wbg.__wbindgen_as_number=function(t){return+t},t.wbg.__wbindgen_bigint_from_i64=function(t){return t},t.wbg.__wbindgen_bigint_from_u64=function(t){return BigInt.asUintN(64,t)},t.wbg.__wbindgen_bigint_get_as_i64=function(t,e){const n="bigint"==typeof e?e:void 0;g().setBigInt64(t+8,d(n)?BigInt(0):n,!0),g().setInt32(t+0,!d(n),!0)},t.wbg.__wbindgen_boolean_get=function(t){return"boolean"==typeof t?t?1:0:2},t.wbg.__wbindgen_cb_drop=function(t){const e=t.original;return 1==e.cnt--&&(e.a=0,!0)},t.wbg.__wbindgen_closure_wrapper1017=function(t,e,n){return y(t,e,1093,O)},t.wbg.__wbindgen_closure_wrapper1019=function(t,e,n){return y(t,e,1093,z)},t.wbg.__wbindgen_closure_wrapper12426=function(t,e,n){return y(t,e,3739,T)},t.wbg.__wbindgen_closure_wrapper12427=function(t,e,n){return y(t,e,3739,T)},t.wbg.__wbindgen_debug_string=function(t,e){const n=c(m(e),i.__wbindgen_malloc,i.__wbindgen_realloc),r=o;g().setInt32(t+4,r,!0),g().setInt32(t+0,n,!0)},t.wbg.__wbindgen_error_new=function(t,e){return new Error(b(t,e))},t.wbg.__wbindgen_in=function(t,e){return t in e},t.wbg.__wbindgen_init_externref_table=function(){const t=i.__wbindgen_export_5,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)},t.wbg.__wbindgen_is_bigint=function(t){return"bigint"==typeof t},t.wbg.__wbindgen_is_function=function(t){return"function"==typeof t},t.wbg.__wbindgen_is_object=function(t){return"object"==typeof t&&null!==t},t.wbg.__wbindgen_is_string=function(t){return"string"==typeof t},t.wbg.__wbindgen_is_undefined=function(t){return void 0===t},t.wbg.__wbindgen_jsval_eq=function(t,e){return t===e},t.wbg.__wbindgen_jsval_loose_eq=function(t,e){return t==e},t.wbg.__wbindgen_link_9579f016b4522a24=function(t){const e="onmessage = function (ev) {\n let [ia, index, value] = ev.data;\n ia = new Int32Array(ia.buffer);\n let result = Atomics.wait(ia, index, value);\n postMessage(result);\n };\n ",n=c(void 0===URL.createObjectURL?"data:application/javascript,"+encodeURIComponent(e):URL.createObjectURL(new Blob([e],{type:"text/javascript"})),i.__wbindgen_malloc,i.__wbindgen_realloc),r=o;g().setInt32(t+4,r,!0),g().setInt32(t+0,n,!0)},t.wbg.__wbindgen_memory=function(){return i.memory},t.wbg.__wbindgen_module=function(){return et.__wbindgen_wasm_module},t.wbg.__wbindgen_number_get=function(t,e){const n="number"==typeof e?e:void 0;g().setFloat64(t+8,d(n)?0:n,!0),g().setInt32(t+0,!d(n),!0)},t.wbg.__wbindgen_number_new=function(t){return t},t.wbg.__wbindgen_rethrow=function(t){throw t},t.wbg.__wbindgen_string_get=function(t,e){const n="string"==typeof e?e:void 0;var r=d(n)?0:c(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=o;g().setInt32(t+4,s,!0),g().setInt32(t+0,r,!0)},t.wbg.__wbindgen_string_new=function(t,e){return b(t,e)},t.wbg.__wbindgen_throw=function(t,e){throw new Error(b(t,e))},t}function Q(t,e){t.wbg.memory=e||new WebAssembly.Memory({initial:99,maximum:65536,shared:!0})}function X(t,e,n){if(i=t.exports,et.__wbindgen_wasm_module=e,_=null,s=null,void 0!==n&&("number"!=typeof n||0===n||n%65536!=0))throw"invalid stack size";return i.__wbindgen_start(n),i}function tt(t,e){if(void 0!==i)return i;let n;void 0!==t&&(Object.getPrototypeOf(t)===Object.prototype?({module:t,memory:e,thread_stack_size:n}=t):console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const r=Z();return Q(r,e),t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t)),X(new WebAssembly.Instance(t,r),t,n)}async function et(t,e){if(void 0!==i)return i;let r;void 0!==t&&(Object.getPrototypeOf(t)===Object.prototype?({module_or_path:t,memory:e,thread_stack_size:r}=t):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===t&&(t=new URL(n(857),n.b));const o=Z();("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t)),Q(o,e);const{instance:s,module:a}=await async function(t,e){if("function"==typeof Response&&t instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(t,e)}catch(e){if("application/wasm"==t.headers.get("Content-Type"))throw e;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",e)}const n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}{const n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}(await t,o);return X(s,a,r)}const nt=et},857:(t,e,n)=>{"use strict";t.exports=n.p+"96d038089797746d7695.wasm"}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,n),o.exports}n.m=t,n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.p="",n.b=self.location+"";var r={};return(()=>{"use strict";n.r(r),n.d(r,{Attestation:()=>M,NotaryServer:()=>C,Presentation:()=>j,Prover:()=>k,Secrets:()=>P,Transcript:()=>_,Verifier:()=>L,default:()=>T,mapStringToRange:()=>l,subtractRanges:()=>g});var t=n(822),e=n(287);function i(t,e="invalid expression"){if(!t)throw new Error(e)}function o(t){return e.hp.from(t).toString("hex")}function s(t){return new Uint8Array(e.hp.from(t,"hex"))}var a,f,u=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n},c=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};class _{constructor(t){a.set(this,void 0),f.set(this,void 0),this.text=(t="*")=>({sent:this.sent(t),recv:this.recv(t)}),u(this,f,t.recv,"f"),u(this,a,t.sent,"f")}get raw(){return{recv:c(this,f,"f"),sent:c(this,a,"f")}}recv(t="*"){return c(this,f,"f").reduce(((n,r)=>n+(0===r?t:e.hp.from([r]).toString())),"")}sent(t="*"){return c(this,a,"f").reduce(((n,r)=>n+(0===r?t:e.hp.from([r]).toString())),"")}}function g(t,e){const n=[t];return e.sort(((t,e)=>t.start<e.start?-1:1)).forEach((({start:t,end:e})=>{const r=n.pop();if(t<r.start||e>r.end)console.error("invalid ranges");else if(t!==r.start||e!==r.end){if(!(t===r.start&&e<r.end))return t>r.start&&e<r.end?(n.push({start:r.start,end:t}),void n.push({start:e,end:r.end})):void(t>r.start&&e===r.end&&n.push({start:r.start,end:t}));n.push({start:e,end:r.end})}})),n}function l(t,n){return t.map((t=>{const r=(i=n,o=t,e.hp.from(i).indexOf(e.hp.from(o)));var i,o;return r>-1?{start:r,end:r+w(t)}:null})).filter((t=>!!t))}function w(t){return e.hp.from(t).byteLength}a=new WeakMap,f=new WeakMap;var h,b,d,p,y,m,v,E,B,A,R,I,U=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{f(r.next(t))}catch(t){o(t)}}function a(t){try{f(r.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}f((r=r.apply(t,e||[])).next())}))},x=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n},S=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};let O="Info";function z(...t){["Debug","Trace"].includes(O)&&console.log("tlsn-js DEBUG",...t)}function T(e){return U(this,void 0,void 0,(function*(){const{loggingLevel:n="Info",hardwareConcurrency:r=navigator.hardwareConcurrency}=e||{};O=n;const i=yield(0,t.default)();z("res.memory",i.memory),z("res.memory.buffer.length",i.memory.buffer.byteLength),z("initialize thread pool"),yield(0,t.initialize)({level:n,crate_filters:void 0,span_events:void 0},r),z("initialized thread pool")}))}class k{static notarize(e){return U(this,void 0,void 0,(function*(){const{url:n,method:r="GET",headers:i={},body:s,maxSentData:a=1024,maxSentRecords:f,maxRecvData:u=1024,maxRecvDataOnline:c,maxRecvRecordsOnline:_,network:g="Bandwidth",deferDecryptionFromStart:l,notaryUrl:w,websocketProxyUrl:h,commit:b,serverIdentity:d=!1,clientAuth:p}=e,y=new URL(n).hostname,m=C.from(w),v=new t.Prover({server_name:y,max_sent_data:a,max_sent_records:f,max_recv_data:u,max_recv_data_online:c,max_recv_records_online:_,defer_decryption_from_start:l,network:g,client_auth:p});yield v.setup(yield m.sessionUrl(a,u));const E=k.getHeaderMap(n,s,i);yield v.send_request(h+`?token=${y}`,{uri:n,method:r,headers:E,body:s});const B=v.transcript(),A=b||{sent:[{start:0,end:B.sent.length}],recv:[{start:0,end:B.recv.length}]},{attestation:R,secrets:I}=yield v.notarize(A),U=Object.assign(Object.assign({},A),{server_identity:d});return{version:"0.1.0-alpha.12",data:o((0,t.build_presentation)(R,I,U).serialize()),meta:{notaryUrl:m.normalizeUrl(),websocketProxyUrl:h}}}))}constructor(e){h.set(this,void 0),b.set(this,void 0),d.set(this,void 0),p.set(this,void 0),x(this,b,{server_name:e.serverDns,max_sent_data:e.maxSentData||1024,max_sent_records:e.maxSentRecords,max_recv_data:e.maxRecvData||1024,max_recv_data_online:e.maxRecvDataOnline,max_recv_records_online:e.maxRecvRecordsOnline,defer_decryption_from_start:e.deferDecryptionFromStart,network:e.network||"Bandwidth",client_auth:e.clientAuth},"f"),x(this,h,new t.Prover(S(this,b,"f")),"f")}free(){return U(this,void 0,void 0,(function*(){return S(this,h,"f").free()}))}setup(t){return U(this,void 0,void 0,(function*(){return x(this,d,t,"f"),S(this,h,"f").setup(t)}))}transcript(){return U(this,void 0,void 0,(function*(){const t=S(this,h,"f").transcript();return{sent:t.sent,recv:t.recv}}))}static getHeaderMap(t,n,r){const i={Host:new URL(t).hostname,Connection:"close"};return"string"==typeof n?i["Content-Length"]=n.length.toString():"object"==typeof n?i["Content-Length"]=JSON.stringify(n).length.toString():"number"==typeof n&&(i["Content-Length"]=n.toString().length.toString()),function(t){const n=new Map;return Object.entries(t).forEach((([t,r])=>{var i;n.set(t,(i=r,e.hp.from(i).toJSON().data))})),n}(Object.assign(Object.assign({},i),r))}sendRequest(t,n){return U(this,void 0,void 0,(function*(){x(this,p,t,"f");const{url:r,method:i="GET",headers:o={},body:s}=n,a=k.getHeaderMap(r,s,o),f=yield S(this,h,"f").send_request(t,{uri:r,method:i,headers:a,body:s});return z("prover.sendRequest",f),{status:f.status,headers:f.headers.reduce(((t,[n,r])=>(t[n]=e.hp.from(r).toString(),t)),{})}}))}notarize(t){return U(this,void 0,void 0,(function*(){const e=yield this.transcript(),n=yield S(this,h,"f").notarize(t||{sent:[{start:0,end:e.sent.length}],recv:[{start:0,end:e.recv.length}]});return{attestation:o(n.attestation.serialize()),secrets:o(n.secrets.serialize()),notaryUrl:S(this,d,"f"),websocketProxyUrl:S(this,p,"f")}}))}reveal(t){return U(this,void 0,void 0,(function*(){return S(this,h,"f").reveal(t)}))}}h=new WeakMap,b=new WeakMap,d=new WeakMap,p=new WeakMap;class L{constructor(e){y.set(this,void 0),m.set(this,void 0),x(this,y,{max_recv_data:e.maxRecvData||1024,max_sent_data:e.maxSentData||1024,max_sent_records:e.maxSentRecords,max_recv_records_online:e.maxRecvRecordsOnline},"f"),x(this,m,new t.Verifier(S(this,y,"f")),"f")}verify(){return U(this,void 0,void 0,(function*(){return S(this,m,"f").verify()}))}connect(t){return U(this,void 0,void 0,(function*(){return S(this,m,"f").connect(t)}))}}y=new WeakMap,m=new WeakMap;class j{constructor(e){if(v.set(this,void 0),E.set(this,void 0),B.set(this,void 0),"string"==typeof e)x(this,v,t.Presentation.deserialize(s(e)),"f");else{const n=t.Attestation.deserialize(s(e.attestationHex)),r=t.Secrets.deserialize(s(e.secretsHex)),i=r.transcript();x(this,v,(0,t.build_presentation)(n,r,e.reveal||{sent:[{start:0,end:i.sent.length}],recv:[{start:0,end:i.recv.length}],server_identity:!1}),"f"),x(this,B,e.websocketProxyUrl,"f"),x(this,E,e.notaryUrl,"f")}}free(){return U(this,void 0,void 0,(function*(){return S(this,v,"f").free()}))}serialize(){return U(this,void 0,void 0,(function*(){return o(S(this,v,"f").serialize())}))}verifyingKey(){return U(this,void 0,void 0,(function*(){return S(this,v,"f").verifying_key()}))}json(){return U(this,void 0,void 0,(function*(){return{version:"0.1.0-alpha.12",data:yield this.serialize(),meta:{notaryUrl:S(this,E,"f")?C.from(S(this,E,"f")).normalizeUrl():"",websocketProxyUrl:S(this,B,"f")}}}))}verify(){return U(this,void 0,void 0,(function*(){const{server_name:t="",connection_info:e,transcript:n={sent:[],recv:[],recv_authed:[],sent_authed:[]}}=S(this,v,"f").verify();return{server_name:t,connection_info:e,transcript:n}}))}}v=new WeakMap,E=new WeakMap,B=new WeakMap;class M{constructor(e){A.set(this,void 0),x(this,A,t.Attestation.deserialize(s(e)),"f")}free(){return U(this,void 0,void 0,(function*(){return S(this,A,"f").free()}))}verifyingKey(){return U(this,void 0,void 0,(function*(){return S(this,A,"f").verifying_key()}))}serialize(){return U(this,void 0,void 0,(function*(){return S(this,A,"f").serialize()}))}}A=new WeakMap;class P{constructor(e){R.set(this,void 0),x(this,R,t.Secrets.deserialize(s(e)),"f")}free(){return U(this,void 0,void 0,(function*(){return S(this,R,"f").free()}))}serialize(){return U(this,void 0,void 0,(function*(){return S(this,R,"f").serialize()}))}transcript(){return U(this,void 0,void 0,(function*(){return S(this,R,"f").transcript()}))}}R=new WeakMap;class C{static from(t){return new C(t)}constructor(t){I.set(this,void 0),x(this,I,t,"f")}get url(){return S(this,I,"f")}publicKey(t="hex"){return U(this,void 0,void 0,(function*(){const n=yield fetch(S(this,I,"f")+"/info"),{publicKey:r}=yield n.json();return i("string"==typeof r&&!!r.length,"invalid public key"),"pem"===t?r:e.hp.from(r.replace("-----BEGIN PUBLIC KEY-----","").replace("-----END PUBLIC KEY-----","").replace(/\n/g,""),"base64").slice(23).toString("hex")}))}normalizeUrl(){const t=new URL(S(this,I,"f"));let e;return e="https:"===t.protocol||"http:"===t.protocol?t.protocol:"wss:"===t.protocol?"https:":"http:",`${e}//${t.host}`}sessionUrl(t,e){return U(this,void 0,void 0,(function*(){const n=yield fetch(`${S(this,I,"f")}/session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientType:"Websocket",maxRecvData:e,maxSentData:t})}),{sessionId:r}=yield n.json();i("string"==typeof r&&!!r.length,"invalid session id");const o=new URL(S(this,I,"f")),s="https:"===o.protocol?"wss":"ws",a=o.pathname;return`${s}://${o.host}${"/"===a?"":a}/notarize?sessionId=${r}`}))}}I=new WeakMap})(),r})()));
3
+ //# sourceMappingURL=lib.js.map
@@ -0,0 +1 @@
1
+ function registerMessageListener(e,s,a){e.addEventListener("message",(async e=>{const t=e.data;t&&t.type===s&&await a(t.data)}))}registerMessageListener(self,"web_spawn_start_spawner",(async e=>{const s=new URL("./spawn.js",import.meta.url),[a,t,n]=e,r=await import("../../../tlsn_wasm.js");await r.default({module:a,memory:t});const w=r.web_spawn_recover_spawner(n);postMessage("web_spawn_spawner_ready"),await w.run(s.toString()),close()})),registerMessageListener(self,"web_spawn_start_worker",(async e=>{const[s,a,t]=e,n=await import("../../../tlsn_wasm.js");await n.default({module:s,memory:a}),n.web_spawn_start_worker(t),close()}));export async function startSpawnerWorker(e,s,a){const t=new URL("./spawn.js",import.meta.url),n=new Worker(t,{name:"web-spawn-spawner",type:"module"}),r=[e,s,a.intoRaw()];n.postMessage({type:"web_spawn_start_spawner",data:r}),await new Promise((e=>{n.addEventListener("message",(function s(a){"web_spawn_spawner_ready"===a.data&&(n.removeEventListener("message",s),e())}))}))}
@@ -0,0 +1 @@
1
+ function registerMessageListener(e,s,a){e.addEventListener("message",(async e=>{const t=e.data;t&&t.type===s&&await a(t.data)}))}registerMessageListener(self,"web_spawn_start_spawner",(async e=>{const s=new URL("./spawn.js",import.meta.url),[a,t,n]=e,r=await import("../../../tlsn_wasm.js");await r.default({module:a,memory:t});const w=r.web_spawn_recover_spawner(n);postMessage("web_spawn_spawner_ready"),await w.run(s.toString()),close()})),registerMessageListener(self,"web_spawn_start_worker",(async e=>{const[s,a,t]=e,n=await import("../../../tlsn_wasm.js");await n.default({module:s,memory:a}),n.web_spawn_start_worker(t),close()}));export async function startSpawnerWorker(e,s,a){const t=new URL("./spawn.js",import.meta.url),n=new Worker(t,{name:"web-spawn-spawner",type:"module"}),r=[e,s,a.intoRaw()];n.postMessage({type:"web_spawn_start_spawner",data:r}),await new Promise((e=>{n.addEventListener("message",(function s(a){"web_spawn_spawner_ready"===a.data&&(n.removeEventListener("message",s),e())}))}))}
@@ -0,0 +1 @@
1
+ import{startSpawnerWorker}from"./snippets/web-spawn-0303048270a97ee1/js/spawn.js";let wasm,WASM_VECTOR_LEN=0,cachedUint8ArrayMemory0=null;function getUint8ArrayMemory0(){return null!==cachedUint8ArrayMemory0&&cachedUint8ArrayMemory0.buffer===wasm.memory.buffer||(cachedUint8ArrayMemory0=new Uint8Array(wasm.memory.buffer)),cachedUint8ArrayMemory0}const cachedTextEncoder="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},encodeString=function(e,t){const n=cachedTextEncoder.encode(e);return t.set(n),{read:e.length,written:n.length}};function passStringToWasm0(e,t,n){if(void 0===n){const n=cachedTextEncoder.encode(e),r=t(n.length,1)>>>0;return getUint8ArrayMemory0().subarray(r,r+n.length).set(n),WASM_VECTOR_LEN=n.length,r}let r=e.length,_=t(r,1)>>>0;const i=getUint8ArrayMemory0();let a=0;for(;a<r;a++){const t=e.charCodeAt(a);if(t>127)break;i[_+a]=t}if(a!==r){0!==a&&(e=e.slice(a)),_=n(_,r,r=a+3*e.length,1)>>>0;const t=getUint8ArrayMemory0().subarray(_+a,_+r);a+=encodeString(e,t).written,_=n(_,r,a,1)>>>0}return WASM_VECTOR_LEN=a,_}let cachedDataViewMemory0=null;function getDataViewMemory0(){return null!==cachedDataViewMemory0&&cachedDataViewMemory0.buffer===wasm.memory.buffer||(cachedDataViewMemory0=new DataView(wasm.memory.buffer)),cachedDataViewMemory0}function addToExternrefTable0(e){const t=wasm.__externref_table_alloc();return wasm.__wbindgen_export_5.set(t,e),t}function handleError(e,t){try{return e.apply(this,t)}catch(e){const t=addToExternrefTable0(e);wasm.__wbindgen_exn_store(t)}}const cachedTextDecoder="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};function getStringFromWasm0(e,t){return e>>>=0,cachedTextDecoder.decode(getUint8ArrayMemory0().slice(e,e+t))}function isLikeNone(e){return null==e}"undefined"!=typeof TextDecoder&&cachedTextDecoder.decode();const CLOSURE_DTORS="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((e=>{wasm.__wbindgen_export_7.get(e.dtor)(e.a,e.b)}));function makeMutClosure(e,t,n,r){const _={a:e,b:t,cnt:1,dtor:n},i=(...e)=>{_.cnt++;const t=_.a;_.a=0;try{return r(t,_.b,...e)}finally{0==--_.cnt?(wasm.__wbindgen_export_7.get(_.dtor)(t,_.b),CLOSURE_DTORS.unregister(_)):_.a=t}};return i.original=_,CLOSURE_DTORS.register(i,_,_),i}function debugString(e){const t=typeof e;if("number"==t||"boolean"==t||null==e)return`${e}`;if("string"==t)return`"${e}"`;if("symbol"==t){const t=e.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=e.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(e)){const t=e.length;let n="[";t>0&&(n+=debugString(e[0]));for(let r=1;r<t;r++)n+=", "+debugString(e[r]);return n+="]",n}const n=/\[object ([^\]]+)\]/.exec(toString.call(e));let r;if(!(n&&n.length>1))return toString.call(e);if(r=n[1],"Object"==r)try{return"Object("+JSON.stringify(e)+")"}catch(e){return"Object"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}function takeFromExternrefTable0(e){const t=wasm.__wbindgen_export_5.get(e);return wasm.__externref_table_dealloc(e),t}function getArrayU8FromWasm0(e,t){return e>>>=0,getUint8ArrayMemory0().subarray(e/1,e/1+t)}function passArray8ToWasm0(e,t){const n=t(1*e.length,1)>>>0;return getUint8ArrayMemory0().set(e,n/1),WASM_VECTOR_LEN=e.length,n}function _assertClass(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`)}export function initialize(e,t){return wasm.initialize(isLikeNone(e)?0:addToExternrefTable0(e),t)}export function build_presentation(e,t,n){_assertClass(e,Attestation),_assertClass(t,Secrets);const r=wasm.build_presentation(e.__wbg_ptr,t.__wbg_ptr,n);if(r[2])throw takeFromExternrefTable0(r[1]);return Presentation.__wrap(r[0])}export function web_spawn_start_worker(e){wasm.web_spawn_start_worker(e)}export function web_spawn_recover_spawner(e){const t=wasm.web_spawn_recover_spawner(e);return Spawner.__wrap(t)}export function startSpawner(){return wasm.startSpawner()}function __wbg_adapter_56(e,t){wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36d577a13c442f93(e,t)}function __wbg_adapter_59(e,t,n){wasm.closure1094_externref_shim(e,t,n)}function __wbg_adapter_62(e,t,n){wasm.closure3738_externref_shim(e,t,n)}function __wbg_adapter_257(e,t,n,r){wasm.closure4289_externref_shim(e,t,n,r)}const __wbindgen_enum_BinaryType=["blob","arraybuffer"],__wbindgen_enum_WorkerType=["classic","module"],AttestationFinalization="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((e=>wasm.__wbg_attestation_free(e>>>0,1)));export class Attestation{static __wrap(e){e>>>=0;const t=Object.create(Attestation.prototype);return t.__wbg_ptr=e,AttestationFinalization.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,AttestationFinalization.unregister(this),e}free(){const e=this.__destroy_into_raw();wasm.__wbg_attestation_free(e,0)}verifying_key(){return wasm.attestation_verifying_key(this.__wbg_ptr)}serialize(){const e=wasm.attestation_serialize(this.__wbg_ptr);var t=getArrayU8FromWasm0(e[0],e[1]).slice();return wasm.__wbindgen_free(e[0],1*e[1],1),t}static deserialize(e){const t=passArray8ToWasm0(e,wasm.__wbindgen_malloc),n=WASM_VECTOR_LEN,r=wasm.attestation_deserialize(t,n);if(r[2])throw takeFromExternrefTable0(r[1]);return Attestation.__wrap(r[0])}}const NotarizationOutputFinalization="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((e=>wasm.__wbg_notarizationoutput_free(e>>>0,1)));export class NotarizationOutput{static __wrap(e){e>>>=0;const t=Object.create(NotarizationOutput.prototype);return t.__wbg_ptr=e,NotarizationOutputFinalization.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,NotarizationOutputFinalization.unregister(this),e}free(){const e=this.__destroy_into_raw();wasm.__wbg_notarizationoutput_free(e,0)}get attestation(){const e=wasm.__wbg_get_notarizationoutput_attestation(this.__wbg_ptr);return Attestation.__wrap(e)}set attestation(e){_assertClass(e,Attestation);var t=e.__destroy_into_raw();wasm.__wbg_set_notarizationoutput_attestation(this.__wbg_ptr,t)}get secrets(){const e=wasm.__wbg_get_notarizationoutput_secrets(this.__wbg_ptr);return Secrets.__wrap(e)}set secrets(e){_assertClass(e,Secrets);var t=e.__destroy_into_raw();wasm.__wbg_set_notarizationoutput_secrets(this.__wbg_ptr,t)}}const PresentationFinalization="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((e=>wasm.__wbg_presentation_free(e>>>0,1)));export class Presentation{static __wrap(e){e>>>=0;const t=Object.create(Presentation.prototype);return t.__wbg_ptr=e,PresentationFinalization.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,PresentationFinalization.unregister(this),e}free(){const e=this.__destroy_into_raw();wasm.__wbg_presentation_free(e,0)}verifying_key(){return wasm.presentation_verifying_key(this.__wbg_ptr)}verify(){const e=wasm.presentation_verify(this.__wbg_ptr);if(e[2])throw takeFromExternrefTable0(e[1]);return takeFromExternrefTable0(e[0])}serialize(){const e=wasm.presentation_serialize(this.__wbg_ptr);var t=getArrayU8FromWasm0(e[0],e[1]).slice();return wasm.__wbindgen_free(e[0],1*e[1],1),t}static deserialize(e){const t=passArray8ToWasm0(e,wasm.__wbindgen_malloc),n=WASM_VECTOR_LEN,r=wasm.presentation_deserialize(t,n);if(r[2])throw takeFromExternrefTable0(r[1]);return Presentation.__wrap(r[0])}}const ProverFinalization="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((e=>wasm.__wbg_prover_free(e>>>0,1)));export class Prover{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ProverFinalization.unregister(this),e}free(){const e=this.__destroy_into_raw();wasm.__wbg_prover_free(e,0)}constructor(e){const t=wasm.prover_new(e);return this.__wbg_ptr=t>>>0,ProverFinalization.register(this,this.__wbg_ptr,this),this}setup(e){const t=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),n=WASM_VECTOR_LEN;return wasm.prover_setup(this.__wbg_ptr,t,n)}send_request(e,t){const n=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),r=WASM_VECTOR_LEN;return wasm.prover_send_request(this.__wbg_ptr,n,r,t)}transcript(){const e=wasm.prover_transcript(this.__wbg_ptr);if(e[2])throw takeFromExternrefTable0(e[1]);return takeFromExternrefTable0(e[0])}notarize(e){return wasm.prover_notarize(this.__wbg_ptr,e)}reveal(e){return wasm.prover_reveal(this.__wbg_ptr,e)}}const SecretsFinalization="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((e=>wasm.__wbg_secrets_free(e>>>0,1)));export class Secrets{static __wrap(e){e>>>=0;const t=Object.create(Secrets.prototype);return t.__wbg_ptr=e,SecretsFinalization.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,SecretsFinalization.unregister(this),e}free(){const e=this.__destroy_into_raw();wasm.__wbg_secrets_free(e,0)}transcript(){return wasm.secrets_transcript(this.__wbg_ptr)}serialize(){const e=wasm.secrets_serialize(this.__wbg_ptr);var t=getArrayU8FromWasm0(e[0],e[1]).slice();return wasm.__wbindgen_free(e[0],1*e[1],1),t}static deserialize(e){const t=passArray8ToWasm0(e,wasm.__wbindgen_malloc),n=WASM_VECTOR_LEN,r=wasm.secrets_deserialize(t,n);if(r[2])throw takeFromExternrefTable0(r[1]);return Secrets.__wrap(r[0])}}const SpawnerFinalization="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((e=>wasm.__wbg_spawner_free(e>>>0,1)));export class Spawner{static __wrap(e){e>>>=0;const t=Object.create(Spawner.prototype);return t.__wbg_ptr=e,SpawnerFinalization.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,SpawnerFinalization.unregister(this),e}free(){const e=this.__destroy_into_raw();wasm.__wbg_spawner_free(e,0)}intoRaw(){const e=this.__destroy_into_raw();return wasm.spawner_intoRaw(e)>>>0}run(e){const t=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),n=WASM_VECTOR_LEN;return wasm.spawner_run(this.__wbg_ptr,t,n)}}const VerifierFinalization="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((e=>wasm.__wbg_verifier_free(e>>>0,1)));export class Verifier{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,VerifierFinalization.unregister(this),e}free(){const e=this.__destroy_into_raw();wasm.__wbg_verifier_free(e,0)}constructor(e){const t=wasm.verifier_new(e);return this.__wbg_ptr=t>>>0,VerifierFinalization.register(this,this.__wbg_ptr,this),this}connect(e){const t=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),n=WASM_VECTOR_LEN;return wasm.verifier_connect(this.__wbg_ptr,t,n)}verify(){return wasm.verifier_verify(this.__wbg_ptr)}}const WorkerDataFinalization="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((e=>wasm.__wbg_workerdata_free(e>>>0,1)));export class WorkerData{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,WorkerDataFinalization.unregister(this),e}free(){const e=this.__destroy_into_raw();wasm.__wbg_workerdata_free(e,0)}}async function __wbg_load(e,t){if("function"==typeof Response&&e instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if("application/wasm"==e.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function __wbg_get_imports(){const e={wbg:{}};return e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(e,t){const n=passStringToWasm0(String(t),wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),r=WASM_VECTOR_LEN;getDataViewMemory0().setInt32(e+4,r,!0),getDataViewMemory0().setInt32(e+0,n,!0)},e.wbg.__wbg_async_9ff6d9e405f13772=function(e){return e.async},e.wbg.__wbg_buffer_609cc3eee51ed158=function(e){return e.buffer},e.wbg.__wbg_call_672a4d21634d4a24=function(){return handleError((function(e,t){return e.call(t)}),arguments)},e.wbg.__wbg_call_7cccdd69e0791ae2=function(){return handleError((function(e,t,n){return e.call(t,n)}),arguments)},e.wbg.__wbg_close_2893b7d056a0627d=function(){return handleError((function(e){e.close()}),arguments)},e.wbg.__wbg_code_cfd8f6868bdaed9b=function(e){return e.code},e.wbg.__wbg_code_f4ec1e6e2e1b0417=function(e){return e.code},e.wbg.__wbg_crypto_574e78ad8b13b65f=function(e){return e.crypto},e.wbg.__wbg_data_432d9c3df2630942=function(e){return e.data},e.wbg.__wbg_debug_3cb59063b29f58c1=function(e){console.debug(e)},e.wbg.__wbg_debug_e17b51583ca6a632=function(e,t,n,r){console.debug(e,t,n,r)},e.wbg.__wbg_done_769e5ede4b31c67b=function(e){return e.done},e.wbg.__wbg_entries_3265d4158b33e5dc=function(e){return Object.entries(e)},e.wbg.__wbg_error_524f506f44df1645=function(e){console.error(e)},e.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,t){let n,r;try{n=e,r=t,console.error(getStringFromWasm0(e,t))}finally{wasm.__wbindgen_free(n,r,1)}},e.wbg.__wbg_error_80de38b3f7cc3c3c=function(e,t,n,r){console.error(e,t,n,r)},e.wbg.__wbg_getRandomValues_80578b2ff2a093ba=function(){return handleError((function(e){globalThis.crypto.getRandomValues(e)}),arguments)},e.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return handleError((function(e,t){e.getRandomValues(t)}),arguments)},e.wbg.__wbg_get_67b2ba62fc30de12=function(){return handleError((function(e,t){return Reflect.get(e,t)}),arguments)},e.wbg.__wbg_get_b9b93047fe3cf45b=function(e,t){return e[t>>>0]},e.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(e,t){return e[t]},e.wbg.__wbg_info_033d8b8a0838f1d3=function(e,t,n,r){console.info(e,t,n,r)},e.wbg.__wbg_info_3daf2e093e091b66=function(e){console.info(e)},e.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc=function(e){let t;try{t=e instanceof ArrayBuffer}catch(e){t=!1}return t},e.wbg.__wbg_instanceof_Blob_ca721ef3bdab15d1=function(e){let t;try{t=e instanceof Blob}catch(e){t=!1}return t},e.wbg.__wbg_instanceof_Map_f3469ce2244d2430=function(e){let t;try{t=e instanceof Map}catch(e){t=!1}return t},e.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9=function(e){let t;try{t=e instanceof Uint8Array}catch(e){t=!1}return t},e.wbg.__wbg_isArray_a1eab7e0d067391b=function(e){return Array.isArray(e)},e.wbg.__wbg_isSafeInteger_343e2beeeece1bb0=function(e){return Number.isSafeInteger(e)},e.wbg.__wbg_iterator_9a24c88df860dc65=function(){return Symbol.iterator},e.wbg.__wbg_length_a446193dc22c12f8=function(e){return e.length},e.wbg.__wbg_length_e2d2a49132c1b256=function(e){return e.length},e.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(e){return e.msCrypto},e.wbg.__wbg_new_23a2665fac83c611=function(e,t){try{var n={a:e,b:t};const r=new Promise(((e,t)=>{const r=n.a;n.a=0;try{return __wbg_adapter_257(r,n.b,e,t)}finally{n.a=r}}));return r}finally{n.a=n.b=0}},e.wbg.__wbg_new_405e22f390576ce2=function(){return new Object},e.wbg.__wbg_new_757fd34d47ff40d2=function(e){return new ArrayBuffer(e>>>0)},e.wbg.__wbg_new_78feb108b6472713=function(){return new Array},e.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},e.wbg.__wbg_new_92c54fc74574ef55=function(){return handleError((function(e,t){return new WebSocket(getStringFromWasm0(e,t))}),arguments)},e.wbg.__wbg_new_a12002a7f91c75be=function(e){return new Uint8Array(e)},e.wbg.__wbg_new_b1a33e5095abf678=function(){return handleError((function(e,t){return new Worker(getStringFromWasm0(e,t))}),arguments)},e.wbg.__wbg_new_e9a4a67dbababe57=function(e){return new Int32Array(e)},e.wbg.__wbg_newnoargs_105ed471475aaf50=function(e,t){return new Function(getStringFromWasm0(e,t))},e.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(e,t,n){return new Uint8Array(e,t>>>0,n>>>0)},e.wbg.__wbg_newwithlength_a381634e90c276d4=function(e){return new Uint8Array(e>>>0)},e.wbg.__wbg_newwithoptions_0419cac3977d7f7f=function(){return handleError((function(e,t,n){return new Worker(getStringFromWasm0(e,t),n)}),arguments)},e.wbg.__wbg_newwithstrsequence_6e9d6479e1cf978d=function(){return handleError((function(e,t,n){return new WebSocket(getStringFromWasm0(e,t),n)}),arguments)},e.wbg.__wbg_next_25feadfc0913fea9=function(e){return e.next},e.wbg.__wbg_next_6574e1a8a62d1055=function(){return handleError((function(e){return e.next()}),arguments)},e.wbg.__wbg_node_905d3e251edff8a2=function(e){return e.node},e.wbg.__wbg_notarizationoutput_new=function(e){return NotarizationOutput.__wrap(e)},e.wbg.__wbg_now_2c95c9de01293173=function(e){return e.now()},e.wbg.__wbg_now_807e54c39636c349=function(){return Date.now()},e.wbg.__wbg_of_4a05197bfc89556f=function(e,t,n){return Array.of(e,t,n)},e.wbg.__wbg_performance_7a3ffd0b17f663ad=function(e){return e.performance},e.wbg.__wbg_postMessage_6edafa8f7b9c2f52=function(){return handleError((function(e,t){e.postMessage(t)}),arguments)},e.wbg.__wbg_process_dc0fbacc7c1c06f7=function(e){return e.process},e.wbg.__wbg_push_737cfc8c1432c2c6=function(e,t){return e.push(t)},e.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5=function(e){queueMicrotask(e)},e.wbg.__wbg_queueMicrotask_d3219def82552485=function(e){return e.queueMicrotask},e.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return handleError((function(e,t){e.randomFillSync(t)}),arguments)},e.wbg.__wbg_readyState_7ef6e63c349899ed=function(e){return e.readyState},e.wbg.__wbg_reason_49f1cede8bcf23dd=function(e,t){const n=passStringToWasm0(t.reason,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),r=WASM_VECTOR_LEN;getDataViewMemory0().setInt32(e+4,r,!0),getDataViewMemory0().setInt32(e+0,n,!0)},e.wbg.__wbg_require_60cc747a6bc5215a=function(){return handleError((function(){return module.require}),arguments)},e.wbg.__wbg_resolve_4851785c9c5f573d=function(e){return Promise.resolve(e)},e.wbg.__wbg_send_0293179ba074ffb4=function(){return handleError((function(e,t,n){e.send(getStringFromWasm0(t,n))}),arguments)},e.wbg.__wbg_send_7c4769e24cf1d784=function(){return handleError((function(e,t){e.send(t)}),arguments)},e.wbg.__wbg_set_37837023f3d740e8=function(e,t,n){e[t>>>0]=n},e.wbg.__wbg_set_3f1d0b984ed272ed=function(e,t,n){e[t]=n},e.wbg.__wbg_set_65595bdd868b3009=function(e,t,n){e.set(t,n>>>0)},e.wbg.__wbg_set_bb8cecf6a62b9f46=function(){return handleError((function(e,t,n){return Reflect.set(e,t,n)}),arguments)},e.wbg.__wbg_setbinaryType_92fa1ffd873b327c=function(e,t){e.binaryType=__wbindgen_enum_BinaryType[t]},e.wbg.__wbg_setname_73878b09a5ee3d0c=function(e,t,n){e.name=getStringFromWasm0(t,n)},e.wbg.__wbg_setonclose_14fc475a49d488fc=function(e,t){e.onclose=t},e.wbg.__wbg_setonerror_8639efe354b947cd=function(e,t){e.onerror=t},e.wbg.__wbg_setonmessage_5a885b16bdc6dca6=function(e,t){e.onmessage=t},e.wbg.__wbg_setonmessage_6eccab530a8fb4c7=function(e,t){e.onmessage=t},e.wbg.__wbg_setonopen_2da654e1f39745d5=function(e,t){e.onopen=t},e.wbg.__wbg_settype_47fae7d6c82625e7=function(e,t){e.type=__wbindgen_enum_WorkerType[t]},e.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,t){const n=passStringToWasm0(t.stack,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),r=WASM_VECTOR_LEN;getDataViewMemory0().setInt32(e+4,r,!0),getDataViewMemory0().setInt32(e+0,n,!0)},e.wbg.__wbg_startSpawnerWorker_74e47ad8e112560b=function(e,t,n){return startSpawnerWorker(e,t,Spawner.__wrap(n))},e.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const e="undefined"==typeof global?null:global;return isLikeNone(e)?0:addToExternrefTable0(e)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const e="undefined"==typeof globalThis?null:globalThis;return isLikeNone(e)?0:addToExternrefTable0(e)},e.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const e="undefined"==typeof self?null:self;return isLikeNone(e)?0:addToExternrefTable0(e)},e.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const e="undefined"==typeof window?null:window;return isLikeNone(e)?0:addToExternrefTable0(e)},e.wbg.__wbg_subarray_aa9065fa9dc5df96=function(e,t,n){return e.subarray(t>>>0,n>>>0)},e.wbg.__wbg_then_44b73946d2fb3e7d=function(e,t){return e.then(t)},e.wbg.__wbg_then_48b406749878a531=function(e,t,n){return e.then(t,n)},e.wbg.__wbg_timeOrigin_9f29a08704a944d0=function(e){return e.timeOrigin},e.wbg.__wbg_url_ce9ab75bf9627ae4=function(e,t){const n=passStringToWasm0(t.url,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),r=WASM_VECTOR_LEN;getDataViewMemory0().setInt32(e+4,r,!0),getDataViewMemory0().setInt32(e+0,n,!0)},e.wbg.__wbg_value_cd1ffa7b1ab794f1=function(e){return e.value},e.wbg.__wbg_value_dab73d3d5d4abaaf=function(e){return e.value},e.wbg.__wbg_versions_c01dfd4722a88165=function(e){return e.versions},e.wbg.__wbg_waitAsync_61f0a081053dd3c2=function(e,t,n){return Atomics.waitAsync(e,t>>>0,n)},e.wbg.__wbg_waitAsync_7ce6c8a047c752c3=function(){return Atomics.waitAsync},e.wbg.__wbg_warn_4ca3906c248c47c4=function(e){console.warn(e)},e.wbg.__wbg_warn_aaf1f4664a035bd6=function(e,t,n,r){console.warn(e,t,n,r)},e.wbg.__wbg_wasClean_605b4fd66d44354a=function(e){return e.wasClean},e.wbg.__wbindgen_as_number=function(e){return+e},e.wbg.__wbindgen_bigint_from_i64=function(e){return e},e.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},e.wbg.__wbindgen_bigint_get_as_i64=function(e,t){const n="bigint"==typeof t?t:void 0;getDataViewMemory0().setBigInt64(e+8,isLikeNone(n)?BigInt(0):n,!0),getDataViewMemory0().setInt32(e+0,!isLikeNone(n),!0)},e.wbg.__wbindgen_boolean_get=function(e){return"boolean"==typeof e?e?1:0:2},e.wbg.__wbindgen_cb_drop=function(e){const t=e.original;return 1==t.cnt--&&(t.a=0,!0)},e.wbg.__wbindgen_closure_wrapper1017=function(e,t,n){return makeMutClosure(e,t,1093,__wbg_adapter_56)},e.wbg.__wbindgen_closure_wrapper1019=function(e,t,n){return makeMutClosure(e,t,1093,__wbg_adapter_59)},e.wbg.__wbindgen_closure_wrapper12426=function(e,t,n){return makeMutClosure(e,t,3739,__wbg_adapter_62)},e.wbg.__wbindgen_closure_wrapper12427=function(e,t,n){return makeMutClosure(e,t,3739,__wbg_adapter_62)},e.wbg.__wbindgen_debug_string=function(e,t){const n=passStringToWasm0(debugString(t),wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),r=WASM_VECTOR_LEN;getDataViewMemory0().setInt32(e+4,r,!0),getDataViewMemory0().setInt32(e+0,n,!0)},e.wbg.__wbindgen_error_new=function(e,t){return new Error(getStringFromWasm0(e,t))},e.wbg.__wbindgen_in=function(e,t){return e in t},e.wbg.__wbindgen_init_externref_table=function(){const e=wasm.__wbindgen_export_5,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)},e.wbg.__wbindgen_is_bigint=function(e){return"bigint"==typeof e},e.wbg.__wbindgen_is_function=function(e){return"function"==typeof e},e.wbg.__wbindgen_is_object=function(e){return"object"==typeof e&&null!==e},e.wbg.__wbindgen_is_string=function(e){return"string"==typeof e},e.wbg.__wbindgen_is_undefined=function(e){return void 0===e},e.wbg.__wbindgen_jsval_eq=function(e,t){return e===t},e.wbg.__wbindgen_jsval_loose_eq=function(e,t){return e==t},e.wbg.__wbindgen_link_9579f016b4522a24=function(e){const t="onmessage = function (ev) {\n let [ia, index, value] = ev.data;\n ia = new Int32Array(ia.buffer);\n let result = Atomics.wait(ia, index, value);\n postMessage(result);\n };\n ",n=passStringToWasm0(void 0===URL.createObjectURL?"data:application/javascript,"+encodeURIComponent(t):URL.createObjectURL(new Blob([t],{type:"text/javascript"})),wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),r=WASM_VECTOR_LEN;getDataViewMemory0().setInt32(e+4,r,!0),getDataViewMemory0().setInt32(e+0,n,!0)},e.wbg.__wbindgen_memory=function(){return wasm.memory},e.wbg.__wbindgen_module=function(){return __wbg_init.__wbindgen_wasm_module},e.wbg.__wbindgen_number_get=function(e,t){const n="number"==typeof t?t:void 0;getDataViewMemory0().setFloat64(e+8,isLikeNone(n)?0:n,!0),getDataViewMemory0().setInt32(e+0,!isLikeNone(n),!0)},e.wbg.__wbindgen_number_new=function(e){return e},e.wbg.__wbindgen_rethrow=function(e){throw e},e.wbg.__wbindgen_string_get=function(e,t){const n="string"==typeof t?t:void 0;var r=isLikeNone(n)?0:passStringToWasm0(n,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),_=WASM_VECTOR_LEN;getDataViewMemory0().setInt32(e+4,_,!0),getDataViewMemory0().setInt32(e+0,r,!0)},e.wbg.__wbindgen_string_new=function(e,t){return getStringFromWasm0(e,t)},e.wbg.__wbindgen_throw=function(e,t){throw new Error(getStringFromWasm0(e,t))},e}function __wbg_init_memory(e,t){e.wbg.memory=t||new WebAssembly.Memory({initial:99,maximum:65536,shared:!0})}function __wbg_finalize_init(e,t,n){if(wasm=e.exports,__wbg_init.__wbindgen_wasm_module=t,cachedDataViewMemory0=null,cachedUint8ArrayMemory0=null,void 0!==n&&("number"!=typeof n||0===n||n%65536!=0))throw"invalid stack size";return wasm.__wbindgen_start(n),wasm}function initSync(e,t){if(void 0!==wasm)return wasm;let n;void 0!==e&&(Object.getPrototypeOf(e)===Object.prototype?({module:e,memory:t,thread_stack_size:n}=e):console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const r=__wbg_get_imports();return __wbg_init_memory(r,t),e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),__wbg_finalize_init(new WebAssembly.Instance(e,r),e,n)}async function __wbg_init(e,t){if(void 0!==wasm)return wasm;let n;void 0!==e&&(Object.getPrototypeOf(e)===Object.prototype?({module_or_path:e,memory:t,thread_stack_size:n}=e):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===e&&(e=new URL("tlsn_wasm_bg.wasm",import.meta.url));const r=__wbg_get_imports();("string"==typeof e||"function"==typeof Request&&e instanceof Request||"function"==typeof URL&&e instanceof URL)&&(e=fetch(e)),__wbg_init_memory(r,t);const{instance:_,module:i}=await __wbg_load(await e,r);return __wbg_finalize_init(_,i,n)}export{initSync};export default __wbg_init;
@@ -0,0 +1,175 @@
1
+ /**
2
+ * TLSNotary Webpack Configuration Helper
3
+ *
4
+ * Provides pre-configured webpack settings for TLSNotary WASM integration.
5
+ * This helper makes it easy to set up TLSNotary in webpack projects without
6
+ * manually configuring WASM file copying and Node.js polyfills.
7
+ *
8
+ * @packageDocumentation
9
+ * @module tlsnotary/webpack
10
+ *
11
+ * @example
12
+ * ```javascript
13
+ * // webpack.config.js
14
+ * const { getTlsnWebpackConfig, getTlsnWasmPath } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
15
+ *
16
+ * module.exports = {
17
+ * // ... your config
18
+ * plugins: [
19
+ * ...getTlsnWebpackConfig().plugins,
20
+ * ],
21
+ * resolve: {
22
+ * fallback: {
23
+ * ...getTlsnWebpackConfig().resolve.fallback,
24
+ * },
25
+ * },
26
+ * };
27
+ * ```
28
+ *
29
+ * @example Using the merge helper
30
+ * ```javascript
31
+ * const { mergeTlsnWebpackConfig } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
32
+ *
33
+ * module.exports = mergeTlsnWebpackConfig({
34
+ * entry: './src/index.ts',
35
+ * output: { path: './dist' },
36
+ * });
37
+ * ```
38
+ */
39
+ /**
40
+ * Get the absolute path to the bundled WASM files directory.
41
+ *
42
+ * This returns the path to the pre-bundled tlsn-js WASM files included
43
+ * in the SDK. Use this when configuring CopyWebpackPlugin or other
44
+ * file copying mechanisms.
45
+ *
46
+ * @returns Absolute path to the WASM directory
47
+ *
48
+ * @example
49
+ * ```javascript
50
+ * const { getTlsnWasmPath } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
51
+ *
52
+ * new CopyWebpackPlugin({
53
+ * patterns: [
54
+ * { from: getTlsnWasmPath(), to: 'tlsn-wasm' }
55
+ * ]
56
+ * });
57
+ * ```
58
+ */
59
+ export declare function getTlsnWasmPath(): string;
60
+ /**
61
+ * Get the path to a specific WASM file.
62
+ *
63
+ * @param filename - The WASM filename (e.g., 'tlsn_wasm_bg.wasm')
64
+ * @returns Absolute path to the specific WASM file
65
+ */
66
+ export declare function getTlsnWasmFile(filename: string): string;
67
+ /**
68
+ * Node.js polyfill configuration for browser environments.
69
+ *
70
+ * TLSNotary requires certain Node.js modules to be polyfilled
71
+ * when running in the browser.
72
+ */
73
+ export declare const nodeFallbacks: {
74
+ crypto: boolean;
75
+ stream: boolean;
76
+ buffer: string;
77
+ process: boolean;
78
+ fs: boolean;
79
+ path: boolean;
80
+ os: boolean;
81
+ };
82
+ /**
83
+ * Get webpack configuration for TLSNotary integration.
84
+ *
85
+ * Returns a partial webpack configuration object that can be merged
86
+ * with your existing config. Includes:
87
+ * - CopyWebpackPlugin configuration for WASM files
88
+ * - Node.js polyfill fallbacks
89
+ * - Required plugins array
90
+ *
91
+ * @param options - Configuration options
92
+ * @param options.wasmOutputPath - Output path for WASM files (default: 'tlsn-wasm')
93
+ * @param options.publicPath - Public path prefix for WASM files (default: '/')
94
+ * @returns Partial webpack configuration
95
+ *
96
+ * @example
97
+ * ```javascript
98
+ * const { getTlsnWebpackConfig } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
99
+ * const config = getTlsnWebpackConfig({ wasmOutputPath: 'assets/wasm' });
100
+ * ```
101
+ */
102
+ export declare function getTlsnWebpackConfig(options?: {
103
+ wasmOutputPath?: string;
104
+ publicPath?: string;
105
+ }): {
106
+ plugins: any[];
107
+ resolve: {
108
+ fallback: typeof nodeFallbacks;
109
+ };
110
+ experiments: {
111
+ asyncWebAssembly: boolean;
112
+ };
113
+ };
114
+ /**
115
+ * Merge TLSNotary webpack config with an existing configuration.
116
+ *
117
+ * This is a convenience helper that deep-merges the TLSNotary
118
+ * configuration with your existing webpack config.
119
+ *
120
+ * @param existingConfig - Your existing webpack configuration
121
+ * @param tlsnOptions - TLSNotary-specific options
122
+ * @returns Merged webpack configuration
123
+ *
124
+ * @example
125
+ * ```javascript
126
+ * const { mergeTlsnWebpackConfig } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
127
+ *
128
+ * module.exports = mergeTlsnWebpackConfig({
129
+ * entry: './src/index.ts',
130
+ * output: {
131
+ * filename: 'bundle.js',
132
+ * path: path.resolve(__dirname, 'dist'),
133
+ * },
134
+ * module: {
135
+ * rules: [
136
+ * { test: /\.tsx?$/, use: 'ts-loader' },
137
+ * ],
138
+ * },
139
+ * });
140
+ * ```
141
+ */
142
+ export declare function mergeTlsnWebpackConfig<T extends Record<string, any>>(existingConfig: T, tlsnOptions?: Parameters<typeof getTlsnWebpackConfig>[0]): T;
143
+ /**
144
+ * Get headers required for SharedArrayBuffer support.
145
+ *
146
+ * TLSNotary uses SharedArrayBuffer for WASM threads, which requires
147
+ * specific CORS headers. Use these with your dev server configuration.
148
+ *
149
+ * @returns Object with required headers
150
+ *
151
+ * @example
152
+ * ```javascript
153
+ * const { getCrossOriginHeaders } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
154
+ *
155
+ * // webpack-dev-server config
156
+ * devServer: {
157
+ * headers: getCrossOriginHeaders(),
158
+ * }
159
+ * ```
160
+ */
161
+ export declare function getCrossOriginHeaders(): Record<string, string>;
162
+ /**
163
+ * Complete webpack dev server configuration for TLSNotary.
164
+ *
165
+ * @param port - Dev server port (default: 8080)
166
+ * @returns Dev server configuration object
167
+ */
168
+ export declare function getTlsnDevServerConfig(port?: number): {
169
+ port: number;
170
+ hot: boolean;
171
+ headers: Record<string, string>;
172
+ static: {
173
+ directory: string;
174
+ }[];
175
+ };
@@ -0,0 +1,281 @@
1
+ "use strict";
2
+ /**
3
+ * TLSNotary Webpack Configuration Helper
4
+ *
5
+ * Provides pre-configured webpack settings for TLSNotary WASM integration.
6
+ * This helper makes it easy to set up TLSNotary in webpack projects without
7
+ * manually configuring WASM file copying and Node.js polyfills.
8
+ *
9
+ * @packageDocumentation
10
+ * @module tlsnotary/webpack
11
+ *
12
+ * @example
13
+ * ```javascript
14
+ * // webpack.config.js
15
+ * const { getTlsnWebpackConfig, getTlsnWasmPath } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
16
+ *
17
+ * module.exports = {
18
+ * // ... your config
19
+ * plugins: [
20
+ * ...getTlsnWebpackConfig().plugins,
21
+ * ],
22
+ * resolve: {
23
+ * fallback: {
24
+ * ...getTlsnWebpackConfig().resolve.fallback,
25
+ * },
26
+ * },
27
+ * };
28
+ * ```
29
+ *
30
+ * @example Using the merge helper
31
+ * ```javascript
32
+ * const { mergeTlsnWebpackConfig } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
33
+ *
34
+ * module.exports = mergeTlsnWebpackConfig({
35
+ * entry: './src/index.ts',
36
+ * output: { path: './dist' },
37
+ * });
38
+ * ```
39
+ */
40
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
41
+ if (k2 === undefined) k2 = k;
42
+ var desc = Object.getOwnPropertyDescriptor(m, k);
43
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
44
+ desc = { enumerable: true, get: function() { return m[k]; } };
45
+ }
46
+ Object.defineProperty(o, k2, desc);
47
+ }) : (function(o, m, k, k2) {
48
+ if (k2 === undefined) k2 = k;
49
+ o[k2] = m[k];
50
+ }));
51
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
52
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
53
+ }) : function(o, v) {
54
+ o["default"] = v;
55
+ });
56
+ var __importStar = (this && this.__importStar) || (function () {
57
+ var ownKeys = function(o) {
58
+ ownKeys = Object.getOwnPropertyNames || function (o) {
59
+ var ar = [];
60
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
61
+ return ar;
62
+ };
63
+ return ownKeys(o);
64
+ };
65
+ return function (mod) {
66
+ if (mod && mod.__esModule) return mod;
67
+ var result = {};
68
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
69
+ __setModuleDefault(result, mod);
70
+ return result;
71
+ };
72
+ })();
73
+ Object.defineProperty(exports, "__esModule", { value: true });
74
+ exports.nodeFallbacks = void 0;
75
+ exports.getTlsnWasmPath = getTlsnWasmPath;
76
+ exports.getTlsnWasmFile = getTlsnWasmFile;
77
+ exports.getTlsnWebpackConfig = getTlsnWebpackConfig;
78
+ exports.mergeTlsnWebpackConfig = mergeTlsnWebpackConfig;
79
+ exports.getCrossOriginHeaders = getCrossOriginHeaders;
80
+ exports.getTlsnDevServerConfig = getTlsnDevServerConfig;
81
+ const path = __importStar(require("path"));
82
+ /**
83
+ * Get the absolute path to the bundled WASM files directory.
84
+ *
85
+ * This returns the path to the pre-bundled tlsn-js WASM files included
86
+ * in the SDK. Use this when configuring CopyWebpackPlugin or other
87
+ * file copying mechanisms.
88
+ *
89
+ * @returns Absolute path to the WASM directory
90
+ *
91
+ * @example
92
+ * ```javascript
93
+ * const { getTlsnWasmPath } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
94
+ *
95
+ * new CopyWebpackPlugin({
96
+ * patterns: [
97
+ * { from: getTlsnWasmPath(), to: 'tlsn-wasm' }
98
+ * ]
99
+ * });
100
+ * ```
101
+ */
102
+ function getTlsnWasmPath() {
103
+ // __dirname will be build/tlsnotary after compilation
104
+ // WASM files are in build/tlsnotary/wasm
105
+ return path.resolve(__dirname, "wasm");
106
+ }
107
+ /**
108
+ * Get the path to a specific WASM file.
109
+ *
110
+ * @param filename - The WASM filename (e.g., 'tlsn_wasm_bg.wasm')
111
+ * @returns Absolute path to the specific WASM file
112
+ */
113
+ function getTlsnWasmFile(filename) {
114
+ return path.join(getTlsnWasmPath(), filename);
115
+ }
116
+ /**
117
+ * Node.js polyfill configuration for browser environments.
118
+ *
119
+ * TLSNotary requires certain Node.js modules to be polyfilled
120
+ * when running in the browser.
121
+ */
122
+ exports.nodeFallbacks = {
123
+ crypto: false,
124
+ stream: false,
125
+ buffer: require.resolve("buffer/"),
126
+ process: false,
127
+ fs: false,
128
+ path: false,
129
+ os: false,
130
+ };
131
+ /**
132
+ * Get webpack configuration for TLSNotary integration.
133
+ *
134
+ * Returns a partial webpack configuration object that can be merged
135
+ * with your existing config. Includes:
136
+ * - CopyWebpackPlugin configuration for WASM files
137
+ * - Node.js polyfill fallbacks
138
+ * - Required plugins array
139
+ *
140
+ * @param options - Configuration options
141
+ * @param options.wasmOutputPath - Output path for WASM files (default: 'tlsn-wasm')
142
+ * @param options.publicPath - Public path prefix for WASM files (default: '/')
143
+ * @returns Partial webpack configuration
144
+ *
145
+ * @example
146
+ * ```javascript
147
+ * const { getTlsnWebpackConfig } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
148
+ * const config = getTlsnWebpackConfig({ wasmOutputPath: 'assets/wasm' });
149
+ * ```
150
+ */
151
+ function getTlsnWebpackConfig(options = {}) {
152
+ const { wasmOutputPath = "tlsn-wasm" } = options;
153
+ // Dynamic import to avoid requiring CopyWebpackPlugin as a peer dependency
154
+ // Users must have it installed in their project
155
+ let CopyWebpackPlugin;
156
+ try {
157
+ CopyWebpackPlugin = require("copy-webpack-plugin");
158
+ }
159
+ catch {
160
+ console.warn("[TLSNotary] copy-webpack-plugin not found. " +
161
+ "Install it with: npm install --save-dev copy-webpack-plugin");
162
+ return {
163
+ plugins: [],
164
+ resolve: { fallback: exports.nodeFallbacks },
165
+ experiments: { asyncWebAssembly: true },
166
+ };
167
+ }
168
+ return {
169
+ plugins: [
170
+ new CopyWebpackPlugin({
171
+ patterns: [
172
+ {
173
+ from: getTlsnWasmPath(),
174
+ to: wasmOutputPath,
175
+ globOptions: {
176
+ ignore: ["**/*.map", "**/*.d.ts"],
177
+ },
178
+ },
179
+ ],
180
+ }),
181
+ ],
182
+ resolve: {
183
+ fallback: exports.nodeFallbacks,
184
+ },
185
+ experiments: {
186
+ asyncWebAssembly: true,
187
+ },
188
+ };
189
+ }
190
+ /**
191
+ * Merge TLSNotary webpack config with an existing configuration.
192
+ *
193
+ * This is a convenience helper that deep-merges the TLSNotary
194
+ * configuration with your existing webpack config.
195
+ *
196
+ * @param existingConfig - Your existing webpack configuration
197
+ * @param tlsnOptions - TLSNotary-specific options
198
+ * @returns Merged webpack configuration
199
+ *
200
+ * @example
201
+ * ```javascript
202
+ * const { mergeTlsnWebpackConfig } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
203
+ *
204
+ * module.exports = mergeTlsnWebpackConfig({
205
+ * entry: './src/index.ts',
206
+ * output: {
207
+ * filename: 'bundle.js',
208
+ * path: path.resolve(__dirname, 'dist'),
209
+ * },
210
+ * module: {
211
+ * rules: [
212
+ * { test: /\.tsx?$/, use: 'ts-loader' },
213
+ * ],
214
+ * },
215
+ * });
216
+ * ```
217
+ */
218
+ function mergeTlsnWebpackConfig(existingConfig, tlsnOptions = {}) {
219
+ const tlsnConfig = getTlsnWebpackConfig(tlsnOptions);
220
+ return {
221
+ ...existingConfig,
222
+ plugins: [
223
+ ...(existingConfig.plugins || []),
224
+ ...tlsnConfig.plugins,
225
+ ],
226
+ resolve: {
227
+ ...(existingConfig.resolve || {}),
228
+ fallback: {
229
+ ...(existingConfig.resolve?.fallback || {}),
230
+ ...tlsnConfig.resolve.fallback,
231
+ },
232
+ },
233
+ experiments: {
234
+ ...(existingConfig.experiments || {}),
235
+ ...tlsnConfig.experiments,
236
+ },
237
+ };
238
+ }
239
+ /**
240
+ * Get headers required for SharedArrayBuffer support.
241
+ *
242
+ * TLSNotary uses SharedArrayBuffer for WASM threads, which requires
243
+ * specific CORS headers. Use these with your dev server configuration.
244
+ *
245
+ * @returns Object with required headers
246
+ *
247
+ * @example
248
+ * ```javascript
249
+ * const { getCrossOriginHeaders } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
250
+ *
251
+ * // webpack-dev-server config
252
+ * devServer: {
253
+ * headers: getCrossOriginHeaders(),
254
+ * }
255
+ * ```
256
+ */
257
+ function getCrossOriginHeaders() {
258
+ return {
259
+ "Cross-Origin-Opener-Policy": "same-origin",
260
+ "Cross-Origin-Embedder-Policy": "require-corp",
261
+ };
262
+ }
263
+ /**
264
+ * Complete webpack dev server configuration for TLSNotary.
265
+ *
266
+ * @param port - Dev server port (default: 8080)
267
+ * @returns Dev server configuration object
268
+ */
269
+ function getTlsnDevServerConfig(port = 8080) {
270
+ return {
271
+ port,
272
+ hot: true,
273
+ headers: getCrossOriginHeaders(),
274
+ static: [
275
+ {
276
+ directory: getTlsnWasmPath(),
277
+ },
278
+ ],
279
+ };
280
+ }
281
+ //# sourceMappingURL=webpack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack.js","sourceRoot":"","sources":["../../../src/tlsnotary/webpack.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBH,0CAIC;AAQD,0CAEC;AAsCD,oDAgDC;AA8BD,wDAwBC;AAoBD,sDAKC;AAQD,wDAgBC;AAjOD,2CAA4B;AAE5B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,eAAe;IAC3B,sDAAsD;IACtD,yCAAyC;IACzC,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;AAC1C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,QAAgB;IAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,QAAQ,CAAC,CAAA;AACjD,CAAC;AAED;;;;;GAKG;AACU,QAAA,aAAa,GAAG;IACzB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;IAClC,OAAO,EAAE,KAAK;IACd,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,KAAK;IACX,EAAE,EAAE,KAAK;CACZ,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,oBAAoB,CAAC,UAGjC,EAAE;IAKF,MAAM,EAAE,cAAc,GAAG,WAAW,EAAE,GAAG,OAAO,CAAA;IAEhD,2EAA2E;IAC3E,gDAAgD;IAChD,IAAI,iBAAsB,CAAA;IAC1B,IAAI,CAAC;QACD,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACtD,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,CAAC,IAAI,CACR,6CAA6C;YAC7C,6DAA6D,CAChE,CAAA;QACD,OAAO;YACH,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE,QAAQ,EAAE,qBAAa,EAAE;YACpC,WAAW,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE;SAC1C,CAAA;IACL,CAAC;IAED,OAAO;QACH,OAAO,EAAE;YACL,IAAI,iBAAiB,CAAC;gBAClB,QAAQ,EAAE;oBACN;wBACI,IAAI,EAAE,eAAe,EAAE;wBACvB,EAAE,EAAE,cAAc;wBAClB,WAAW,EAAE;4BACT,MAAM,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;yBACpC;qBACJ;iBACJ;aACJ,CAAC;SACL;QACD,OAAO,EAAE;YACL,QAAQ,EAAE,qBAAa;SAC1B;QACD,WAAW,EAAE;YACT,gBAAgB,EAAE,IAAI;SACzB;KACJ,CAAA;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,sBAAsB,CAClC,cAAiB,EACjB,cAA0D,EAAE;IAE5D,MAAM,UAAU,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAA;IAEpD,OAAO;QACH,GAAG,cAAc;QACjB,OAAO,EAAE;YACL,GAAG,CAAC,cAAc,CAAC,OAAO,IAAI,EAAE,CAAC;YACjC,GAAG,UAAU,CAAC,OAAO;SACxB;QACD,OAAO,EAAE;YACL,GAAG,CAAC,cAAc,CAAC,OAAO,IAAI,EAAE,CAAC;YACjC,QAAQ,EAAE;gBACN,GAAG,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,IAAI,EAAE,CAAC;gBAC3C,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ;aACjC;SACJ;QACD,WAAW,EAAE;YACT,GAAG,CAAC,cAAc,CAAC,WAAW,IAAI,EAAE,CAAC;YACrC,GAAG,UAAU,CAAC,WAAW;SAC5B;KACJ,CAAA;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,qBAAqB;IACjC,OAAO;QACH,4BAA4B,EAAE,aAAa;QAC3C,8BAA8B,EAAE,cAAc;KACjD,CAAA;AACL,CAAC;AAED;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,IAAI,GAAG,IAAI;IAM9C,OAAO;QACH,IAAI;QACJ,GAAG,EAAE,IAAI;QACT,OAAO,EAAE,qBAAqB,EAAE;QAChC,MAAM,EAAE;YACJ;gBACI,SAAS,EAAE,eAAe,EAAE;aAC/B;SACJ;KACJ,CAAA;AACL,CAAC"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Custom Charges Types
3
+ *
4
+ * Defines types for variable-cost operations that require user consent
5
+ * before execution. Used in the confirm/execute two-step transaction flow
6
+ * to provide cost transparency.
7
+ *
8
+ * @fileoverview Custom charges type definitions for cost estimation
9
+ */
10
+ /**
11
+ * Cost breakdown for IPFS operations
12
+ *
13
+ * Provides detailed cost calculation components so users can understand
14
+ * what they're paying for.
15
+ */
16
+ export interface IPFSCostBreakdown {
17
+ /** Base cost for the operation in DEM wei */
18
+ base_cost: string;
19
+ /** Cost based on file size in DEM wei */
20
+ size_cost: string;
21
+ /** Cost based on storage duration in DEM wei (optional for indefinite pins) */
22
+ duration_cost?: string;
23
+ /** Any additional costs (network fees, etc.) */
24
+ additional_costs?: Record<string, string>;
25
+ }
26
+ /**
27
+ * IPFS custom charges configuration
28
+ *
29
+ * Included in transaction content to specify maximum cost user agrees to pay.
30
+ * Node will validate that actual cost does not exceed max_cost_dem.
31
+ */
32
+ export interface IPFSCustomCharges {
33
+ /** Maximum cost user is willing to pay (in DEM wei as string for BigInt safety) */
34
+ max_cost_dem: string;
35
+ /** File size in bytes - used for cost calculation validation */
36
+ file_size_bytes: number;
37
+ /** IPFS operation type */
38
+ operation: "IPFS_ADD" | "IPFS_PIN" | "IPFS_UNPIN";
39
+ /** Optional duration in blocks (for PIN operations) */
40
+ duration_blocks?: number;
41
+ /** Optional cost breakdown from ipfsQuote (for reference) */
42
+ estimated_breakdown?: IPFSCostBreakdown;
43
+ }
44
+ /**
45
+ * Custom charges container for transaction content
46
+ *
47
+ * Extensible structure to support various operation types that require
48
+ * cost estimation. Each field is optional and specific to operation type.
49
+ *
50
+ * @example
51
+ * // IPFS operation with custom charges
52
+ * const tx: TransactionContent = {
53
+ * type: "ipfs",
54
+ * // ... other fields
55
+ * custom_charges: {
56
+ * ipfs: {
57
+ * max_cost_dem: "1000000000000000000",
58
+ * file_size_bytes: 1024,
59
+ * operation: "IPFS_ADD"
60
+ * }
61
+ * }
62
+ * }
63
+ */
64
+ export interface CustomCharges {
65
+ /** IPFS operation cost configuration */
66
+ ipfs?: IPFSCustomCharges;
67
+ }
68
+ /**
69
+ * Custom charges response in ValidityData
70
+ *
71
+ * Returned by confirmTx to show actual costs vs maximum user agreed to pay.
72
+ * Allows user to review and abort if actual cost is higher than expected.
73
+ */
74
+ export interface ValidityDataCustomCharges {
75
+ /** Charge type identifier */
76
+ type: "ipfs_storage" | "ipfs_bandwidth" | "compute" | string;
77
+ /** What user signed as maximum (from TX custom_charges) */
78
+ max_cost_dem: string;
79
+ /** What node will actually charge (must be <= max_cost_dem) */
80
+ actual_cost_dem: string;
81
+ /** Detailed breakdown of actual costs */
82
+ breakdown: IPFSCostBreakdown;
83
+ }
84
+ /**
85
+ * Check if custom charges include IPFS configuration
86
+ */
87
+ export declare function hasIPFSCustomCharges(charges: CustomCharges | undefined): charges is CustomCharges & {
88
+ ipfs: IPFSCustomCharges;
89
+ };
90
+ /**
91
+ * Validate that actual cost does not exceed maximum
92
+ */
93
+ export declare function isValidCharge(maxCostDem: string, actualCostDem: string): boolean;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * Custom Charges Types
4
+ *
5
+ * Defines types for variable-cost operations that require user consent
6
+ * before execution. Used in the confirm/execute two-step transaction flow
7
+ * to provide cost transparency.
8
+ *
9
+ * @fileoverview Custom charges type definitions for cost estimation
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.hasIPFSCustomCharges = hasIPFSCustomCharges;
13
+ exports.isValidCharge = isValidCharge;
14
+ // ============================================================================
15
+ // Type Guards
16
+ // ============================================================================
17
+ /**
18
+ * Check if custom charges include IPFS configuration
19
+ */
20
+ function hasIPFSCustomCharges(charges) {
21
+ return charges?.ipfs !== undefined;
22
+ }
23
+ /**
24
+ * Validate that actual cost does not exceed maximum
25
+ */
26
+ function isValidCharge(maxCostDem, actualCostDem) {
27
+ try {
28
+ const max = BigInt(maxCostDem);
29
+ const actual = BigInt(actualCostDem);
30
+ return actual <= max;
31
+ }
32
+ catch {
33
+ return false;
34
+ }
35
+ }
36
+ //# sourceMappingURL=CustomCharges.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomCharges.js","sourceRoot":"","sources":["../../../../src/types/blockchain/CustomCharges.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAkHH,oDAIC;AAKD,sCAWC;AA3BD,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E;;GAEG;AACH,SAAgB,oBAAoB,CAChC,OAAkC;IAElC,OAAO,OAAO,EAAE,IAAI,KAAK,SAAS,CAAA;AACtC,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CACzB,UAAkB,EAClB,aAAqB;IAErB,IAAI,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;QAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;QACpC,OAAO,MAAM,IAAI,GAAG,CAAA;IACxB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAA;IAChB,CAAC;AACL,CAAC"}
@@ -17,6 +17,7 @@ import { ContractCallPayload } from "./TransactionSubtypes/ContractCallTransacti
17
17
  import { D402PaymentPayload } from "./TransactionSubtypes/D402PaymentTransaction";
18
18
  import { EscrowPayload } from "./TransactionSubtypes/EscrowTransaction";
19
19
  import { IPFSPayload } from "./TransactionSubtypes/IPFSTransaction";
20
+ import { CustomCharges } from "./CustomCharges";
20
21
  export type TransactionContentData = ["web2Request", IWeb2Payload] | ["crosschainOperation", XMScript] | ["native", INativePayload] | ["demoswork", DemoScript] | ["l2psEncryptedTx", L2PSEncryptedPayload] | ["identity", IdentityPayload] | ["instantMessaging", InstantMessagingPayload] | ["nativeBridge", NativeBridgeTxPayload] | ["storage", StoragePayload] | ["storageProgram", StorageProgramPayload] | ["l2ps_hash_update", L2PSHashPayload] | ["contractDeploy", ContractDeployPayload] | ["contractCall", ContractCallPayload] | ["d402_payment", D402PaymentPayload] | ["escrow", EscrowPayload] | ["ipfs", IPFSPayload];
21
22
  export interface TransactionContent {
22
23
  type: "web2Request" | "crosschainOperation" | "subnet" | "native" | "demoswork" | "genesis" | "NODE_ONLINE" | "identity" | "instantMessaging" | "nativeBridge" | "l2psEncryptedTx" | "storage" | "storageProgram" | "l2ps_hash_update" | "contractDeploy" | "contractCall" | "d402_payment" | "escrow" | "ipfs";
@@ -29,6 +30,7 @@ export interface TransactionContent {
29
30
  nonce: number;
30
31
  timestamp: number;
31
32
  transaction_fee: TxFee;
33
+ custom_charges?: CustomCharges;
32
34
  }
33
35
  export interface Transaction {
34
36
  content: TransactionContent;
@@ -1 +1 @@
1
- {"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/types/blockchain/Transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAiGA,uCAAuC;AACvC,wDAAqC"}
1
+ {"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/types/blockchain/Transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAqGA,uCAAuC;AACvC,wDAAqC"}
@@ -3,6 +3,7 @@ export { Block, BlockContent, NativeTablesHashes, GenesisBlock } from "./blockch
3
3
  export { ISignature } from "./blockchain/ISignature";
4
4
  export { RawTransaction } from "./blockchain/rawTransaction";
5
5
  export { Transaction, TransactionContent, TransactionContentData, } from "./blockchain/Transaction";
6
+ export { type CustomCharges, type IPFSCustomCharges, type IPFSCostBreakdown, type ValidityDataCustomCharges, hasIPFSCustomCharges, isValidCharge, } from "./blockchain/CustomCharges";
6
7
  export { L2PSTransaction, Web2Transaction, CrosschainTransaction, NativeTransaction, DemosworkTransaction, IdentityTransaction, InstantMessagingTransaction, NativeBridgeTransaction, SpecificTransaction, IPFSTransaction, type IPFSTransactionContent, type IPFSPayload, type IPFSAddPayload, type IPFSPinPayload, type IPFSUnpinPayload, type IPFSOperationType, isIPFSAddPayload, isIPFSPinPayload, isIPFSUnpinPayload, isIPFSPayload, } from "./blockchain/TransactionSubtypes";
7
8
  export { INativePayload } from "./native/INativePayload";
8
9
  export { InstantMessagingPayload } from "./instantMessaging";
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTransactionDataType = exports.isTransactionType = exports.SupportedTokens = exports.SupportedChains = exports.ChainProviders = exports.RPCResponseSkeleton = exports.stepKeysEnum = exports.XmStepResult = exports.DataTypes = exports.EnumWeb2Actions = exports.CValidityData = exports.isIPFSPayload = exports.isIPFSUnpinPayload = exports.isIPFSPinPayload = exports.isIPFSAddPayload = void 0;
3
+ exports.isTransactionDataType = exports.isTransactionType = exports.SupportedTokens = exports.SupportedChains = exports.ChainProviders = exports.RPCResponseSkeleton = exports.stepKeysEnum = exports.XmStepResult = exports.DataTypes = exports.EnumWeb2Actions = exports.CValidityData = exports.isIPFSPayload = exports.isIPFSUnpinPayload = exports.isIPFSPinPayload = exports.isIPFSAddPayload = exports.isValidCharge = exports.hasIPFSCustomCharges = void 0;
4
+ // REVIEW: Phase 9 - Custom charges for variable-cost operations
5
+ var CustomCharges_1 = require("./blockchain/CustomCharges");
6
+ Object.defineProperty(exports, "hasIPFSCustomCharges", { enumerable: true, get: function () { return CustomCharges_1.hasIPFSCustomCharges; } });
7
+ Object.defineProperty(exports, "isValidCharge", { enumerable: true, get: function () { return CustomCharges_1.isValidCharge; } });
4
8
  // Export all specific transaction types
5
9
  var TransactionSubtypes_1 = require("./blockchain/TransactionSubtypes");
6
10
  Object.defineProperty(exports, "isIPFSAddPayload", { enumerable: true, get: function () { return TransactionSubtypes_1.isIPFSAddPayload; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;AAmBA,wCAAwC;AACxC,wEAsByC;AAJrC,uHAAA,gBAAgB,OAAA;AAChB,uHAAA,gBAAgB,OAAA;AAChB,yHAAA,kBAAkB,OAAA;AAClB,oHAAA,aAAa,OAAA;AAUjB,0DAAuE;AAA9D,6GAAA,aAAa,OAAA;AA6CtB,OAAO;AACP,+BAce;AADX,uGAAA,eAAe,OAAA;AAgBnB,mDAA4D;AAAnD,sGAAA,SAAS,OAAA;AAOlB,2CAQ0B;AAHtB,qGAAA,YAAY,OAAA;AAEZ,qGAAA,YAAY,OAAA;AAGhB,2CAU4B;AADxB,0GAAA,aAAa,OAAuB;AAgBxC,gDAI2B;AAHvB,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,4GAAA,eAAe,OAAA;AAanB,+BAA+B;AAC/B,gEAG+C;AAF3C,0GAAA,iBAAiB,OAAA;AACjB,8GAAA,qBAAqB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;AAmBA,gEAAgE;AAChE,4DAOmC;AAF/B,qHAAA,oBAAoB,OAAA;AACpB,8GAAA,aAAa,OAAA;AAGjB,wCAAwC;AACxC,wEAsByC;AAJrC,uHAAA,gBAAgB,OAAA;AAChB,uHAAA,gBAAgB,OAAA;AAChB,yHAAA,kBAAkB,OAAA;AAClB,oHAAA,aAAa,OAAA;AAUjB,0DAAuE;AAA9D,6GAAA,aAAa,OAAA;AA6CtB,OAAO;AACP,+BAce;AADX,uGAAA,eAAe,OAAA;AAgBnB,mDAA4D;AAAnD,sGAAA,SAAS,OAAA;AAOlB,2CAQ0B;AAHtB,qGAAA,YAAY,OAAA;AAEZ,qGAAA,YAAY,OAAA;AAGhB,2CAU4B;AADxB,0GAAA,aAAa,OAAuB;AAgBxC,gDAI2B;AAHvB,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,4GAAA,eAAe,OAAA;AAanB,+BAA+B;AAC/B,gEAG+C;AAF3C,0GAAA,iBAAiB,OAAA;AACjB,8GAAA,qBAAqB,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kynesyslabs/demosdk",
3
- "version": "2.7.9",
3
+ "version": "2.8.0",
4
4
  "description": "Demosdk is a JavaScript/TypeScript SDK that provides a unified interface for interacting with Demos network",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -57,11 +57,14 @@
57
57
  "./d402/client": "./build/d402/client/index.js",
58
58
  "./keyserver": "./build/keyserver/index.js",
59
59
  "./tlsnotary": "./build/tlsnotary/index.js",
60
- "./tlsnotary/service": "./build/tlsnotary/service.js"
60
+ "./tlsnotary/service": "./build/tlsnotary/service.js",
61
+ "./tlsnotary/webpack": "./build/tlsnotary/webpack.js",
62
+ "./tlsnotary/wasm/*": "./build/tlsnotary/wasm/*"
61
63
  },
62
64
  "scripts": {
63
65
  "postinstall": "cp .github/hooks/pre-commit .git/hooks/pre-commit 2>/dev/null && chmod +x .git/hooks/pre-commit 2>/dev/null || true",
64
- "build": "rm -rf build && tsc --skipLibCheck && resolve-tspaths && mv build/src/* build/ && rm -rf build/src",
66
+ "build": "rm -rf build && tsc --skipLibCheck && resolve-tspaths && mv build/src/* build/ && rm -rf build/src && npm run build:copy-wasm",
67
+ "build:copy-wasm": "mkdir -p build/tlsnotary/wasm && cp node_modules/tlsn-js/build/*.wasm build/tlsnotary/wasm/ && cp node_modules/tlsn-js/build/*.js build/tlsnotary/wasm/ && cp -r node_modules/tlsn-js/build/snippets build/tlsnotary/wasm/",
65
68
  "typedoc": "typedoc",
66
69
  "test": "jest",
67
70
  "setup:pre-push": "cp .github/hooks/pre-push .git/hooks/pre-push && chmod +x .git/hooks/pre-push && echo \"Pre-push hook installed\"",