@freedomofpress/sigstore-browser 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +106 -4
- package/dist/sigstore.d.ts +20 -0
- package/dist/sigstore.d.ts.map +1 -1
- package/dist/sigstore.js +82 -0
- package/dist/sigstore.js.map +1 -1
- package/package.json +2 -5
- package/src/sigstore.ts +118 -0
- package/vite.config.ts +3 -12
- package/dist/index-CRFtwdjM.js +0 -4528
- package/dist/index-CRFtwdjM.js.map +0 -1
- package/dist/sigstore.min.js +0 -6
- package/dist/sigstore.min.js.map +0 -1
- package/dist/tuf-D48cBq5i.js +0 -377
- package/dist/tuf-D48cBq5i.js.map +0 -1
- package/dist/tuf-root-D8m0y2I4.js +0 -5
- package/dist/tuf-root-D8m0y2I4.js.map +0 -1
package/dist/sigstore.min.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
var SigstoreBrowser=(function(I){"use strict";class jt extends Error{}class Xt extends Error{}const Tt={BOOLEAN:1,INTEGER:2,BIT_STRING:3,OCTET_STRING:4,OBJECT_IDENTIFIER:6,UTC_TIME:23,GENERALIZED_TIME:24},Ee={UNIVERSAL:0,CONTEXT_SPECIFIC:2};class tr{constructor(t){if(this.number=t&31,this.constructed=(t&32)===32,this.class=t>>6,this.number===31)throw new jt("long form tags not supported");if(this.class===Ee.UNIVERSAL&&this.number===0)throw new jt("unsupported tag 0x00")}isUniversal(){return this.class===Ee.UNIVERSAL}isContextSpecific(t){const i=this.class===Ee.CONTEXT_SPECIFIC;return t!==void 0?i&&this.number===t:i}isBoolean(){return this.isUniversal()&&this.number===Tt.BOOLEAN}isInteger(){return this.isUniversal()&&this.number===Tt.INTEGER}isBitString(){return this.isUniversal()&&this.number===Tt.BIT_STRING}isOctetString(){return this.isUniversal()&&this.number===Tt.OCTET_STRING}isOID(){return this.isUniversal()&&this.number===Tt.OBJECT_IDENTIFIER}isUTCTime(){return this.isUniversal()&&this.number===Tt.UTC_TIME}isGeneralizedTime(){return this.isUniversal()&&this.number===Tt.GENERALIZED_TIME}toDER(){return this.number|(this.constructed?32:0)|this.class<<6}}function er(e){const t=e.getUint8();if((t&128)===0)return t;const i=t&127;if(i>6)throw new jt("length exceeds 6 byte limit");let n=0;for(let r=0;r<i;r++)n=n*256+e.getUint8();if(n===0)throw new jt("indefinite length encoding not supported");return n}function nr(e){if(e<128)return new Uint8Array([e]);let t=BigInt(e);const i=[];for(;t>0n;)i.unshift(Number(t&255n)),t=t>>8n;return new Uint8Array([128|i.length,...i])}function S(e){const t=atob(e),i=t.length,n=new Uint8Array(i);for(let r=0;r<i;r++)n[r]=t.charCodeAt(r);return n}function An(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4!==0;)t+="=";return S(t)}function pe(e){let t="";for(let i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return btoa(t)}function Ct(e){if(e.length%2!==0)throw new Error("Hex string must have an even length");const t=e.length/2,i=new Uint8Array(t);for(let n=0;n<t;n++)i[n]=parseInt(e.slice(n*2,n*2+2),16);return i}function it(e){let t="";for(let i=0;i<e.length;i++){let n=e[i].toString(16);n.length===1&&(n="0"+n),t+=n}return t}function qt(e){return new TextEncoder().encode(e)}function W(e){return new TextDecoder("utf-8").decode(e)}function ir(e,t){t===void 0&&(t=0);const i=it(e.slice(t,t+8));return BigInt(`0x${i}`)}function Nn(e){return W(S(e))}function j(e,t){if(e.byteLength!==t.byteLength)return!1;let i=0;for(let n=0;n<e.byteLength;n++)i|=e[n]^t[n];return i===0}const rr=/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\.\d{3})?Z$/,sr=/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\.\d{3})?Z$/;function or(e){let t=0;const i=e.length;let n=e[t];const r=n>127,s=r?255:0;for(;n==s&&++t<i;)n=e[t];if(i-t===0)return BigInt(r?-1:0);n=r?n-256:n;let a=BigInt(n);for(let c=t+1;c<i;++c)a=a*BigInt(256)+BigInt(e[c]);return a}function ar(e){return W(e)}function On(e,t){const i=ar(e),n=t?rr.exec(i):sr.exec(i);if(!n)throw new Error("invalid time");if(t){let r=Number(n[1]);r+=r>=50?1900:2e3,n[1]=r.toString()}return new Date(`${n[1]}-${n[2]}-${n[3]}T${n[4]}:${n[5]}:${n[6]}Z`)}function cr(e){let t=0;const i=e.length;let n=e[t++];const r=Math.floor(n/40),s=n%40;let o=`${r}.${s}`,a=0;for(;t<i;++t)n=e[t],a=(a<<7)+(n&127),(n&128)===0&&(o+=`.${a}`,a=0);return o}function fr(e){return e[0]!==0}function lr(e){const t=e[0],i=1,n=e.length,r=[];for(let s=i;s<n;++s){const o=e[s],a=s===n-1?t:0;for(let c=7;c>=a;--c)r.push(o>>c&1)}return r}class ur extends Error{}class rt{constructor(t){this.start=0,this.view=t??new Uint8Array(0)}get buffer(){return this.view.subarray(0,this.start)}get length(){return this.view.byteLength}get position(){return this.start}seek(t){this.start=t}slice(t,i){const n=t+i;if(n>this.length)throw new ur("request past end of buffer");return this.view.subarray(t,n)}appendChar(t){this.ensureCapacity(1),this.view[this.start]=t,this.start+=1}appendUint16(t){this.ensureCapacity(2);const i=new Uint16Array([t]),n=new Uint8Array(i.buffer);this.view[this.start]=n[1],this.view[this.start+1]=n[0],this.start+=2}appendUint24(t){this.ensureCapacity(3);const i=new Uint32Array([t]),n=new Uint8Array(i.buffer);this.view[this.start]=n[2],this.view[this.start+1]=n[1],this.view[this.start+2]=n[0],this.start+=3}appendView(t){this.ensureCapacity(t.length),this.view.set(t,this.start),this.start+=t.length}getBlock(t){if(t<=0)return new Uint8Array(0);if(this.start+t>this.view.length)throw new Error("request past end of buffer");const i=this.view.subarray(this.start,this.start+t);return this.start+=t,i}getUint8(){return this.getBlock(1)[0]}getUint16(){const t=this.getBlock(2);return t[0]<<8|t[1]}ensureCapacity(t){if(this.start+t>this.view.byteLength){const i=rt.BLOCK_SIZE+(t>rt.BLOCK_SIZE?t:0);this.realloc(this.view.byteLength+i)}}realloc(t){const i=new Uint8Array(t);i.set(this.view),this.view=i}}rt.BLOCK_SIZE=1024;class Kt{constructor(t,i,n){this.tag=t,this.value=i,this.subs=n}static parseBuffer(t){return Tn(new rt(t))}toDER(){const t=new rt;if(this.subs.length>0)for(const r of this.subs)t.appendView(r.toDER());else t.appendView(this.value);const i=t.buffer,n=new rt;return n.appendChar(this.tag.toDER()),n.appendView(nr(i.length)),n.appendView(i),n.buffer}toBoolean(){if(!this.tag.isBoolean())throw new Xt("not a boolean");return fr(this.value)}toInteger(){if(!this.tag.isInteger())throw new Xt("not an integer");return or(this.value)}toOID(){if(!this.tag.isOID())throw new Xt("not an OID");return cr(this.value)}toDate(){switch(!0){case this.tag.isUTCTime():return On(this.value,!0);case this.tag.isGeneralizedTime():return On(this.value,!1);default:throw new Xt("not a date")}}toBitString(){if(!this.tag.isBitString())throw new Xt("not a bit string");return lr(this.value)}}function Tn(e){const t=new tr(e.getUint8()),i=er(e),n=e.slice(e.position,i),r=e.position;let s=[];if(t.constructed)s=Cn(e,i);else if(t.isOctetString())try{s=Cn(e,i)}catch{}return s.length===0&&e.seek(r+i),new Kt(t,n,s)}function Cn(e,t){const i=e.position+t;if(i>e.length)throw new jt("invalid length");const n=[];for(;e.position<i;)n.push(Tn(e));if(e.position!==i)throw new jt("invalid length");return n}const hr=/-----BEGIN (.*)-----/,dr=/-----END (.*)-----/;function vn(e){let t="";return e.split(`
|
|
2
|
-
`).forEach(i=>{i.match(hr)||i.match(dr)||(t+=i)}),S(t)}const Rn=",",gr=":",wr="[",yr="]",Ir="{",mr="}";function Dn(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function $t(e){const t=[];if(typeof e=="string")t.push(Dn(e));else if(typeof e=="boolean")t.push(JSON.stringify(e));else if(Number.isInteger(e))t.push(JSON.stringify(e));else if(e===null)t.push(JSON.stringify(e));else if(Array.isArray(e)){t.push(wr);let i=!0;e.forEach(n=>{i||t.push(Rn),i=!1,t.push($t(n))}),t.push(yr)}else if(typeof e=="object"){t.push(Ir);let i=!0;Object.keys(e).sort().forEach(n=>{i||t.push(Rn),i=!1,t.push(Dn(n)),t.push(gr),t.push($t(e[n]))}),t.push(mr)}else throw new TypeError("cannot encode "+e);return t.join("")}var G;(function(e){e.Ecdsa="ECDSA",e.Ed25519="Ed25519",e.RSA="RSA"})(G||(G={}));var st;(function(e){e.P256="P-256",e.P384="P-384",e.P521="P-521"})(st||(st={}));var U;(function(e){e.SHA256="SHA-256",e.SHA384="SHA-384",e.SHA512="SHA-512"})(U||(U={}));var vt;(function(e){e.PKCS1v15="RSASSA-PKCS1-v1_5",e.PSS="RSA-PSS"})(vt||(vt={}));var te;(function(e){e.PKCS1="PKCS1",e.RSAPKCS1="RSAPKCS1"})(te||(te={}));const kt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ee(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Se(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Rt(e,...t){if(!ee(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Bn(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Se(e.outputLen),Se(e.blockLen)}function ne(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function br(e,t){Rt(e);const i=t.outputLen;if(e.length<i)throw new Error("digestInto() expects output buffer of length at least "+i)}function Zt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function xe(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ft(e,t){return e<<32-t|e>>>t}const Un=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Er=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Vt(e){if(Rt(e),Un)return e.toHex();let t="";for(let i=0;i<e.length;i++)t+=Er[e[i]];return t}const dt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Mn(e){if(e>=dt._0&&e<=dt._9)return e-dt._0;if(e>=dt.A&&e<=dt.F)return e-(dt.A-10);if(e>=dt.a&&e<=dt.f)return e-(dt.a-10)}function ie(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Un)return Uint8Array.fromHex(e);const t=e.length,i=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(i);for(let r=0,s=0;r<i;r++,s+=2){const o=Mn(e.charCodeAt(s)),a=Mn(e.charCodeAt(s+1));if(o===void 0||a===void 0){const c=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}n[r]=o*16+a}return n}function pr(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ae(e){return typeof e=="string"&&(e=pr(e)),Rt(e),e}function bt(...e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];Rt(r),t+=r.length}const i=new Uint8Array(t);for(let n=0,r=0;n<e.length;n++){const s=e[n];i.set(s,r),r+=s.length}return i}class _n{}function Ne(e){const t=n=>e().update(Ae(n)).digest(),i=e();return t.outputLen=i.outputLen,t.blockLen=i.blockLen,t.create=()=>e(),t}function jn(e=32){if(kt&&typeof kt.getRandomValues=="function")return kt.getRandomValues(new Uint8Array(e));if(kt&&typeof kt.randomBytes=="function")return Uint8Array.from(kt.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}function Sr(e,t,i,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,i,n);const r=BigInt(32),s=BigInt(4294967295),o=Number(i>>r&s),a=Number(i&s),c=n?4:0,f=n?0:4;e.setUint32(t+c,o,n),e.setUint32(t+f,a,n)}function xr(e,t,i){return e&t^~e&i}function Ar(e,t,i){return e&t^e&i^t&i}class kn extends _n{constructor(t,i,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=i,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(t),this.view=xe(this.buffer)}update(t){ne(this),t=Ae(t),Rt(t);const{view:i,buffer:n,blockLen:r}=this,s=t.length;for(let o=0;o<s;){const a=Math.min(r-this.pos,s-o);if(a===r){const c=xe(t);for(;r<=s-o;o+=r)this.process(c,o);continue}n.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(i,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ne(this),br(t,this),this.finished=!0;const{buffer:i,view:n,blockLen:r,isLE:s}=this;let{pos:o}=this;i[o++]=128,Zt(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(n,0),o=0);for(let u=o;u<r;u++)i[u]=0;Sr(n,r-8,BigInt(this.length*8),s),this.process(n,0);const a=xe(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const f=c/4,h=this.get();if(f>h.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<f;u++)a.setUint32(4*u,h[u],s)}digest(){const{buffer:t,outputLen:i}=this;this.digestInto(t);const n=t.slice(0,i);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:i,buffer:n,length:r,finished:s,destroyed:o,pos:a}=this;return t.destroyed=o,t.finished=s,t.length=r,t.pos=a,r%i&&t.buffer.set(n),t}clone(){return this._cloneInto()}}const Et=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),F=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),z=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),re=BigInt(2**32-1),Zn=BigInt(32);function Nr(e,t=!1){return t?{h:Number(e&re),l:Number(e>>Zn&re)}:{h:Number(e>>Zn&re)|0,l:Number(e&re)|0}}function Or(e,t=!1){const i=e.length;let n=new Uint32Array(i),r=new Uint32Array(i);for(let s=0;s<i;s++){const{h:o,l:a}=Nr(e[s],t);[n[s],r[s]]=[o,a]}return[n,r]}const Vn=(e,t,i)=>e>>>i,Hn=(e,t,i)=>e<<32-i|t>>>i,Ht=(e,t,i)=>e>>>i|t<<32-i,Yt=(e,t,i)=>e<<32-i|t>>>i,se=(e,t,i)=>e<<64-i|t>>>i-32,oe=(e,t,i)=>e>>>i-32|t<<64-i;function gt(e,t,i,n){const r=(t>>>0)+(n>>>0);return{h:e+i+(r/4294967296|0)|0,l:r|0}}const Tr=(e,t,i)=>(e>>>0)+(t>>>0)+(i>>>0),Cr=(e,t,i,n)=>t+i+n+(e/2**32|0)|0,vr=(e,t,i,n)=>(e>>>0)+(t>>>0)+(i>>>0)+(n>>>0),Rr=(e,t,i,n,r)=>t+i+n+r+(e/2**32|0)|0,Dr=(e,t,i,n,r)=>(e>>>0)+(t>>>0)+(i>>>0)+(n>>>0)+(r>>>0),Br=(e,t,i,n,r,s)=>t+i+n+r+s+(e/2**32|0)|0,Ur=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),pt=new Uint32Array(64);class Mr extends kn{constructor(t=32){super(64,t,8,!1),this.A=Et[0]|0,this.B=Et[1]|0,this.C=Et[2]|0,this.D=Et[3]|0,this.E=Et[4]|0,this.F=Et[5]|0,this.G=Et[6]|0,this.H=Et[7]|0}get(){const{A:t,B:i,C:n,D:r,E:s,F:o,G:a,H:c}=this;return[t,i,n,r,s,o,a,c]}set(t,i,n,r,s,o,a,c){this.A=t|0,this.B=i|0,this.C=n|0,this.D=r|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,i){for(let u=0;u<16;u++,i+=4)pt[u]=t.getUint32(i,!1);for(let u=16;u<64;u++){const l=pt[u-15],d=pt[u-2],m=ft(l,7)^ft(l,18)^l>>>3,E=ft(d,17)^ft(d,19)^d>>>10;pt[u]=E+pt[u-7]+m+pt[u-16]|0}let{A:n,B:r,C:s,D:o,E:a,F:c,G:f,H:h}=this;for(let u=0;u<64;u++){const l=ft(a,6)^ft(a,11)^ft(a,25),d=h+l+xr(a,c,f)+Ur[u]+pt[u]|0,E=(ft(n,2)^ft(n,13)^ft(n,22))+Ar(n,r,s)|0;h=f,f=c,c=a,a=o+d|0,o=s,s=r,r=n,n=d+E|0}n=n+this.A|0,r=r+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,f=f+this.G|0,h=h+this.H|0,this.set(n,r,s,o,a,c,f,h)}roundClean(){Zt(pt)}destroy(){this.set(0,0,0,0,0,0,0,0),Zt(this.buffer)}}const Yn=Or(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),_r=Yn[0],jr=Yn[1],St=new Uint32Array(80),xt=new Uint32Array(80);class Ln extends kn{constructor(t=64){super(128,t,16,!1),this.Ah=z[0]|0,this.Al=z[1]|0,this.Bh=z[2]|0,this.Bl=z[3]|0,this.Ch=z[4]|0,this.Cl=z[5]|0,this.Dh=z[6]|0,this.Dl=z[7]|0,this.Eh=z[8]|0,this.El=z[9]|0,this.Fh=z[10]|0,this.Fl=z[11]|0,this.Gh=z[12]|0,this.Gl=z[13]|0,this.Hh=z[14]|0,this.Hl=z[15]|0}get(){const{Ah:t,Al:i,Bh:n,Bl:r,Ch:s,Cl:o,Dh:a,Dl:c,Eh:f,El:h,Fh:u,Fl:l,Gh:d,Gl:m,Hh:E,Hl:v}=this;return[t,i,n,r,s,o,a,c,f,h,u,l,d,m,E,v]}set(t,i,n,r,s,o,a,c,f,h,u,l,d,m,E,v){this.Ah=t|0,this.Al=i|0,this.Bh=n|0,this.Bl=r|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=f|0,this.El=h|0,this.Fh=u|0,this.Fl=l|0,this.Gh=d|0,this.Gl=m|0,this.Hh=E|0,this.Hl=v|0}process(t,i){for(let O=0;O<16;O++,i+=4)St[O]=t.getUint32(i),xt[O]=t.getUint32(i+=4);for(let O=16;O<80;O++){const Q=St[O-15]|0,L=xt[O-15]|0,ht=Ht(Q,L,1)^Ht(Q,L,8)^Vn(Q,L,7),Ot=Yt(Q,L,1)^Yt(Q,L,8)^Hn(Q,L,7),X=St[O-2]|0,C=xt[O-2]|0,mt=Ht(X,C,19)^se(X,C,61)^Vn(X,C,6),ct=Yt(X,C,19)^oe(X,C,61)^Hn(X,C,6),B=vr(Ot,ct,xt[O-7],xt[O-16]),y=Rr(B,ht,mt,St[O-7],St[O-16]);St[O]=y|0,xt[O]=B|0}let{Ah:n,Al:r,Bh:s,Bl:o,Ch:a,Cl:c,Dh:f,Dl:h,Eh:u,El:l,Fh:d,Fl:m,Gh:E,Gl:v,Hh:_,Hl:at}=this;for(let O=0;O<80;O++){const Q=Ht(u,l,14)^Ht(u,l,18)^se(u,l,41),L=Yt(u,l,14)^Yt(u,l,18)^oe(u,l,41),ht=u&d^~u&E,Ot=l&m^~l&v,X=Dr(at,L,Ot,jr[O],xt[O]),C=Br(X,_,Q,ht,_r[O],St[O]),mt=X|0,ct=Ht(n,r,28)^se(n,r,34)^se(n,r,39),B=Yt(n,r,28)^oe(n,r,34)^oe(n,r,39),y=n&s^n&a^s&a,w=r&o^r&c^o&c;_=E|0,at=v|0,E=d|0,v=m|0,d=u|0,m=l|0,{h:u,l}=gt(f|0,h|0,C|0,mt|0),f=a|0,h=c|0,a=s|0,c=o|0,s=n|0,o=r|0;const g=Tr(mt,B,w);n=Cr(g,C,ct,y),r=g|0}({h:n,l:r}=gt(this.Ah|0,this.Al|0,n|0,r|0)),{h:s,l:o}=gt(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:c}=gt(this.Ch|0,this.Cl|0,a|0,c|0),{h:f,l:h}=gt(this.Dh|0,this.Dl|0,f|0,h|0),{h:u,l}=gt(this.Eh|0,this.El|0,u|0,l|0),{h:d,l:m}=gt(this.Fh|0,this.Fl|0,d|0,m|0),{h:E,l:v}=gt(this.Gh|0,this.Gl|0,E|0,v|0),{h:_,l:at}=gt(this.Hh|0,this.Hl|0,_|0,at|0),this.set(n,r,s,o,a,c,f,h,u,l,d,m,E,v,_,at)}roundClean(){Zt(St,xt)}destroy(){Zt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class kr extends Ln{constructor(){super(48),this.Ah=F[0]|0,this.Al=F[1]|0,this.Bh=F[2]|0,this.Bl=F[3]|0,this.Ch=F[4]|0,this.Cl=F[5]|0,this.Dh=F[6]|0,this.Dl=F[7]|0,this.Eh=F[8]|0,this.El=F[9]|0,this.Fh=F[10]|0,this.Fl=F[11]|0,this.Gh=F[12]|0,this.Gl=F[13]|0,this.Hh=F[14]|0,this.Hl=F[15]|0}}const Zr=Ne(()=>new Mr),Vr=Ne(()=>new Ln),Hr=Ne(()=>new kr);class Gn extends _n{constructor(t,i){super(),this.finished=!1,this.destroyed=!1,Bn(t);const n=Ae(i);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,s=new Uint8Array(r);s.set(n.length>r?t.create().update(n).digest():n);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),Zt(s)}update(t){return ne(this),this.iHash.update(t),this}digestInto(t){ne(this),Rt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:i,iHash:n,finished:r,destroyed:s,blockLen:o,outputLen:a}=this;return t=t,t.finished=r,t.destroyed=s,t.blockLen=o,t.outputLen=a,t.oHash=i._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Wn=(e,t,i)=>new Gn(e,t).update(i).digest();Wn.create=(e,t)=>new Gn(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Oe=BigInt(0),Te=BigInt(1);function ae(e,t=""){if(typeof e!="boolean"){const i=t&&`"${t}"`;throw new Error(i+"expected boolean, got type="+typeof e)}return e}function Dt(e,t,i=""){const n=ee(e),r=e?.length,s=t!==void 0;if(!n||s&&r!==t){const o=i&&`"${i}" `,a=s?` of length ${t}`:"",c=n?`length=${r}`:`type=${typeof e}`;throw new Error(o+"expected Uint8Array"+a+", got "+c)}return e}function ce(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Fn(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Oe:BigInt("0x"+e)}function fe(e){return Fn(Vt(e))}function zn(e){return Rt(e),Fn(Vt(Uint8Array.from(e).reverse()))}function Ce(e,t){return ie(e.toString(16).padStart(t*2,"0"))}function Xn(e,t){return Ce(e,t).reverse()}function q(e,t,i){let n;if(typeof t=="string")try{n=ie(t)}catch(r){throw new Error(e+" must be hex string or Uint8Array, cause: "+r)}else if(ee(t))n=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return n.length,n}const ve=e=>typeof e=="bigint"&&Oe<=e;function Yr(e,t,i){return ve(e)&&ve(t)&&ve(i)&&t<=e&&e<i}function Lr(e,t,i,n){if(!Yr(t,i,n))throw new Error("expected valid "+e+": "+i+" <= n < "+n+", got "+t)}function Kn(e){let t;for(t=0;e>Oe;e>>=Te,t+=1);return t}const Pt=e=>(Te<<BigInt(e))-Te;function Gr(e,t,i){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof i!="function")throw new Error("hmacFn must be a function");const n=d=>new Uint8Array(d),r=d=>Uint8Array.of(d);let s=n(e),o=n(e),a=0;const c=()=>{s.fill(1),o.fill(0),a=0},f=(...d)=>i(o,s,...d),h=(d=n(0))=>{o=f(r(0),d),s=f(),d.length!==0&&(o=f(r(1),d),s=f())},u=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const m=[];for(;d<t;){s=f();const E=s.slice();m.push(E),d+=s.length}return bt(...m)};return(d,m)=>{c(),h(d);let E;for(;!(E=m(u()));)h();return c(),E}}function Re(e,t,i={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function n(r,s,o){const a=e[r];if(o&&a===void 0)return;const c=typeof a;if(c!==s||a===null)throw new Error(`param "${r}" is invalid: expected ${s}, got ${c}`)}Object.entries(t).forEach(([r,s])=>n(r,s,!1)),Object.entries(i).forEach(([r,s])=>n(r,s,!0))}function $n(e){const t=new WeakMap;return(i,...n)=>{const r=t.get(i);if(r!==void 0)return r;const s=e(i,...n);return t.set(i,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const nt=BigInt(0),$=BigInt(1),Bt=BigInt(2),Pn=BigInt(3),Jn=BigInt(4),Qn=BigInt(5),Wr=BigInt(7),qn=BigInt(8),Fr=BigInt(9),ti=BigInt(16);function ot(e,t){const i=e%t;return i>=nt?i:t+i}function ei(e,t){if(e===nt)throw new Error("invert: expected non-zero number");if(t<=nt)throw new Error("invert: expected positive modulus, got "+t);let i=ot(e,t),n=t,r=nt,s=$;for(;i!==nt;){const a=n/i,c=n%i,f=r-s*a;n=i,i=c,r=s,s=f}if(n!==$)throw new Error("invert: does not exist");return ot(r,t)}function De(e,t,i){if(!e.eql(e.sqr(t),i))throw new Error("Cannot find square root")}function ni(e,t){const i=(e.ORDER+$)/Jn,n=e.pow(t,i);return De(e,n,t),n}function zr(e,t){const i=(e.ORDER-Qn)/qn,n=e.mul(t,Bt),r=e.pow(n,i),s=e.mul(t,r),o=e.mul(e.mul(s,Bt),r),a=e.mul(s,e.sub(o,e.ONE));return De(e,a,t),a}function Xr(e){const t=Ut(e),i=ii(e),n=i(t,t.neg(t.ONE)),r=i(t,n),s=i(t,t.neg(n)),o=(e+Wr)/ti;return(a,c)=>{let f=a.pow(c,o),h=a.mul(f,n);const u=a.mul(f,r),l=a.mul(f,s),d=a.eql(a.sqr(h),c),m=a.eql(a.sqr(u),c);f=a.cmov(f,h,d),h=a.cmov(l,u,m);const E=a.eql(a.sqr(h),c),v=a.cmov(f,h,E);return De(a,v,c),v}}function ii(e){if(e<Pn)throw new Error("sqrt is not defined for small field");let t=e-$,i=0;for(;t%Bt===nt;)t/=Bt,i++;let n=Bt;const r=Ut(e);for(;si(r,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(i===1)return ni;let s=r.pow(n,t);const o=(t+$)/Bt;return function(c,f){if(c.is0(f))return f;if(si(c,f)!==1)throw new Error("Cannot find square root");let h=i,u=c.mul(c.ONE,s),l=c.pow(f,t),d=c.pow(f,o);for(;!c.eql(l,c.ONE);){if(c.is0(l))return c.ZERO;let m=1,E=c.sqr(l);for(;!c.eql(E,c.ONE);)if(m++,E=c.sqr(E),m===h)throw new Error("Cannot find square root");const v=$<<BigInt(h-m-1),_=c.pow(u,v);h=m,u=c.sqr(_),l=c.mul(l,u),d=c.mul(d,_)}return d}}function Kr(e){return e%Jn===Pn?ni:e%qn===Qn?zr:e%ti===Fr?Xr(e):ii(e)}const $r=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Pr(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},i=$r.reduce((n,r)=>(n[r]="function",n),t);return Re(e,i),e}function Jr(e,t,i){if(i<nt)throw new Error("invalid exponent, negatives unsupported");if(i===nt)return e.ONE;if(i===$)return t;let n=e.ONE,r=t;for(;i>nt;)i&$&&(n=e.mul(n,r)),r=e.sqr(r),i>>=$;return n}function ri(e,t,i=!1){const n=new Array(t.length).fill(i?e.ZERO:void 0),r=t.reduce((o,a,c)=>e.is0(a)?o:(n[c]=o,e.mul(o,a)),e.ONE),s=e.inv(r);return t.reduceRight((o,a,c)=>e.is0(a)?o:(n[c]=e.mul(o,n[c]),e.mul(o,a)),s),n}function si(e,t){const i=(e.ORDER-$)/Bt,n=e.pow(t,i),r=e.eql(n,e.ONE),s=e.eql(n,e.ZERO),o=e.eql(n,e.neg(e.ONE));if(!r&&!s&&!o)throw new Error("invalid Legendre symbol result");return r?1:s?0:-1}function oi(e,t){t!==void 0&&Se(t);const i=t!==void 0?t:e.toString(2).length,n=Math.ceil(i/8);return{nBitLength:i,nByteLength:n}}function Ut(e,t,i=!1,n={}){if(e<=nt)throw new Error("invalid field: expected ORDER > 0, got "+e);let r,s,o=!1,a;if(typeof t=="object"&&t!=null){if(n.sqrt||i)throw new Error("cannot specify opts in two arguments");const l=t;l.BITS&&(r=l.BITS),l.sqrt&&(s=l.sqrt),typeof l.isLE=="boolean"&&(i=l.isLE),typeof l.modFromBytes=="boolean"&&(o=l.modFromBytes),a=l.allowedLengths}else typeof t=="number"&&(r=t),n.sqrt&&(s=n.sqrt);const{nBitLength:c,nByteLength:f}=oi(e,r);if(f>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let h;const u=Object.freeze({ORDER:e,isLE:i,BITS:c,BYTES:f,MASK:Pt(c),ZERO:nt,ONE:$,allowedLengths:a,create:l=>ot(l,e),isValid:l=>{if(typeof l!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof l);return nt<=l&&l<e},is0:l=>l===nt,isValidNot0:l=>!u.is0(l)&&u.isValid(l),isOdd:l=>(l&$)===$,neg:l=>ot(-l,e),eql:(l,d)=>l===d,sqr:l=>ot(l*l,e),add:(l,d)=>ot(l+d,e),sub:(l,d)=>ot(l-d,e),mul:(l,d)=>ot(l*d,e),pow:(l,d)=>Jr(u,l,d),div:(l,d)=>ot(l*ei(d,e),e),sqrN:l=>l*l,addN:(l,d)=>l+d,subN:(l,d)=>l-d,mulN:(l,d)=>l*d,inv:l=>ei(l,e),sqrt:s||(l=>(h||(h=Kr(e)),h(u,l))),toBytes:l=>i?Xn(l,f):Ce(l,f),fromBytes:(l,d=!0)=>{if(a){if(!a.includes(l.length)||l.length>f)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+l.length);const E=new Uint8Array(f);E.set(l,i?0:E.length-l.length),l=E}if(l.length!==f)throw new Error("Field.fromBytes: expected "+f+" bytes, got "+l.length);let m=i?zn(l):fe(l);if(o&&(m=ot(m,e)),!d&&!u.isValid(m))throw new Error("invalid field element: outside of range 0..ORDER");return m},invertBatch:l=>ri(u,l),cmov:(l,d,m)=>m?d:l});return Object.freeze(u)}function ai(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function ci(e){const t=ai(e);return t+Math.ceil(t/2)}function Qr(e,t,i=!1){const n=e.length,r=ai(t),s=ci(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const o=i?zn(e):fe(e),a=ot(o,t-$)+$;return i?Xn(a,r):Ce(a,r)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Lt=BigInt(0),Mt=BigInt(1);function le(e,t){const i=t.negate();return e?i:t}function Be(e,t){const i=ri(e.Fp,t.map(n=>n.Z));return t.map((n,r)=>e.fromAffine(n.toAffine(i[r])))}function fi(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Ue(e,t){fi(e,t);const i=Math.ceil(t/e)+1,n=2**(e-1),r=2**e,s=Pt(e),o=BigInt(e);return{windows:i,windowSize:n,mask:s,maxNumber:r,shiftBy:o}}function li(e,t,i){const{windowSize:n,mask:r,maxNumber:s,shiftBy:o}=i;let a=Number(e&r),c=e>>o;a>n&&(a-=s,c+=Mt);const f=t*n,h=f+Math.abs(a)-1,u=a===0,l=a<0,d=t%2!==0;return{nextN:c,offset:h,isZero:u,isNeg:l,isNegF:d,offsetF:f}}function qr(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((i,n)=>{if(!(i instanceof t))throw new Error("invalid point at index "+n)})}function ts(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((i,n)=>{if(!t.isValid(i))throw new Error("invalid scalar at index "+n)})}const Me=new WeakMap,ui=new WeakMap;function _e(e){return ui.get(e)||1}function hi(e){if(e!==Lt)throw new Error("invalid wNAF")}class es{constructor(t,i){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=i}_unsafeLadder(t,i,n=this.ZERO){let r=t;for(;i>Lt;)i&Mt&&(n=n.add(r)),r=r.double(),i>>=Mt;return n}precomputeWindow(t,i){const{windows:n,windowSize:r}=Ue(i,this.bits),s=[];let o=t,a=o;for(let c=0;c<n;c++){a=o,s.push(a);for(let f=1;f<r;f++)a=a.add(o),s.push(a);o=a.double()}return s}wNAF(t,i,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let r=this.ZERO,s=this.BASE;const o=Ue(t,this.bits);for(let a=0;a<o.windows;a++){const{nextN:c,offset:f,isZero:h,isNeg:u,isNegF:l,offsetF:d}=li(n,a,o);n=c,h?s=s.add(le(l,i[d])):r=r.add(le(u,i[f]))}return hi(n),{p:r,f:s}}wNAFUnsafe(t,i,n,r=this.ZERO){const s=Ue(t,this.bits);for(let o=0;o<s.windows&&n!==Lt;o++){const{nextN:a,offset:c,isZero:f,isNeg:h}=li(n,o,s);if(n=a,!f){const u=i[c];r=r.add(h?u.negate():u)}}return hi(n),r}getPrecomputes(t,i,n){let r=Me.get(i);return r||(r=this.precomputeWindow(i,t),t!==1&&(typeof n=="function"&&(r=n(r)),Me.set(i,r))),r}cached(t,i,n){const r=_e(t);return this.wNAF(r,this.getPrecomputes(r,t,n),i)}unsafe(t,i,n,r){const s=_e(t);return s===1?this._unsafeLadder(t,i,r):this.wNAFUnsafe(s,this.getPrecomputes(s,t,n),i,r)}createCache(t,i){fi(i,this.bits),ui.set(t,i),Me.delete(t)}hasCache(t){return _e(t)!==1}}function ns(e,t,i,n){let r=t,s=e.ZERO,o=e.ZERO;for(;i>Lt||n>Lt;)i&Mt&&(s=s.add(r)),n&Mt&&(o=o.add(r)),r=r.double(),i>>=Mt,n>>=Mt;return{p1:s,p2:o}}function is(e,t,i,n){qr(i,e),ts(n,t);const r=i.length,s=n.length;if(r!==s)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=Kn(BigInt(r));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const f=Pt(c),h=new Array(Number(f)+1).fill(o),u=Math.floor((t.BITS-1)/c)*c;let l=o;for(let d=u;d>=0;d-=c){h.fill(o);for(let E=0;E<s;E++){const v=n[E],_=Number(v>>BigInt(d)&f);h[_]=h[_].add(i[E])}let m=o;for(let E=h.length-1,v=o;E>0;E--)v=v.add(h[E]),m=m.add(v);if(l=l.add(m),d!==0)for(let E=0;E<c;E++)l=l.double()}return l}function di(e,t,i){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Pr(t),t}else return Ut(e,{isLE:i})}function rs(e,t,i={},n){if(n===void 0&&(n=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const c of["p","n","h"]){const f=t[c];if(!(typeof f=="bigint"&&f>Lt))throw new Error(`CURVE.${c} must be positive bigint`)}const r=di(t.p,i.Fp,n),s=di(t.n,i.Fn,n),a=["Gx","Gy","a","b"];for(const c of a)if(!r.isValid(t[c]))throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:r,Fn:s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gi=(e,t)=>(e+(e>=0?t:-t)/wi)/t;function ss(e,t,i){const[[n,r],[s,o]]=t,a=gi(o*e,i),c=gi(-r*e,i);let f=e-a*n-c*s,h=-a*r-c*o;const u=f<yt,l=h<yt;u&&(f=-f),l&&(h=-h);const d=Pt(Math.ceil(Kn(i)/2))+Gt;if(f<yt||f>=d||h<yt||h>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:u,k1:f,k2neg:l,k2:h}}function je(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function ke(e,t){const i={};for(let n of Object.keys(t))i[n]=e[n]===void 0?t[n]:e[n];return ae(i.lowS,"lowS"),ae(i.prehash,"prehash"),i.format!==void 0&&je(i.format),i}class os extends Error{constructor(t=""){super(t)}}const wt={Err:os,_tlv:{encode:(e,t)=>{const{Err:i}=wt;if(e<0||e>256)throw new i("tlv.encode: wrong tag");if(t.length&1)throw new i("tlv.encode: unpadded data");const n=t.length/2,r=ce(n);if(r.length/2&128)throw new i("tlv.encode: long form length too big");const s=n>127?ce(r.length/2|128):"";return ce(e)+s+r+t},decode(e,t){const{Err:i}=wt;let n=0;if(e<0||e>256)throw new i("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new i("tlv.decode: wrong tlv");const r=t[n++],s=!!(r&128);let o=0;if(!s)o=r;else{const c=r&127;if(!c)throw new i("tlv.decode(long): indefinite length not supported");if(c>4)throw new i("tlv.decode(long): byte length is too big");const f=t.subarray(n,n+c);if(f.length!==c)throw new i("tlv.decode: length bytes not complete");if(f[0]===0)throw new i("tlv.decode(long): zero leftmost byte");for(const h of f)o=o<<8|h;if(n+=c,o<128)throw new i("tlv.decode(long): not minimal encoding")}const a=t.subarray(n,n+o);if(a.length!==o)throw new i("tlv.decode: wrong value length");return{v:a,l:t.subarray(n+o)}}},_int:{encode(e){const{Err:t}=wt;if(e<yt)throw new t("integer: negative integers are not allowed");let i=ce(e);if(Number.parseInt(i[0],16)&8&&(i="00"+i),i.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return i},decode(e){const{Err:t}=wt;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return fe(e)}},toSig(e){const{Err:t,_int:i,_tlv:n}=wt,r=q("signature",e),{v:s,l:o}=n.decode(48,r);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=n.decode(2,s),{v:f,l:h}=n.decode(2,c);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:i.decode(a),s:i.decode(f)}},hexFromSig(e){const{_tlv:t,_int:i}=wt,n=t.encode(2,i.encode(e.r)),r=t.encode(2,i.encode(e.s)),s=n+r;return t.encode(48,s)}},yt=BigInt(0),Gt=BigInt(1),wi=BigInt(2),ue=BigInt(3),as=BigInt(4);function Wt(e,t){const{BYTES:i}=e;let n;if(typeof t=="bigint")n=t;else{let r=q("private key",t);try{n=e.fromBytes(r)}catch{throw new Error(`invalid private key: expected ui8a of size ${i}, got ${typeof t}`)}}if(!e.isValidNot0(n))throw new Error("invalid private key: out of range [1..N-1]");return n}function cs(e,t={}){const i=rs("weierstrass",e,t),{Fp:n,Fn:r}=i;let s=i.CURVE;const{h:o,n:a}=s;Re(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:c}=t;if(c&&(!n.is0(s.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const f=Ii(n,r);function h(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function u(B,y,w){const{x:g,y:b}=y.toAffine(),p=n.toBytes(g);if(ae(w,"isCompressed"),w){h();const N=!n.isOdd(b);return bt(yi(N),p)}else return bt(Uint8Array.of(4),p,n.toBytes(b))}function l(B){Dt(B,void 0,"Point");const{publicKey:y,publicKeyUncompressed:w}=f,g=B.length,b=B[0],p=B.subarray(1);if(g===y&&(b===2||b===3)){const N=n.fromBytes(p);if(!n.isValid(N))throw new Error("bad point: is not on curve, wrong x");const A=E(N);let x;try{x=n.sqrt(A)}catch(H){const k=H instanceof Error?": "+H.message:"";throw new Error("bad point: is not on curve, sqrt error"+k)}h();const T=n.isOdd(x);return(b&1)===1!==T&&(x=n.neg(x)),{x:N,y:x}}else if(g===w&&b===4){const N=n.BYTES,A=n.fromBytes(p.subarray(0,N)),x=n.fromBytes(p.subarray(N,N*2));if(!v(A,x))throw new Error("bad point: is not on curve");return{x:A,y:x}}else throw new Error(`bad point: got length ${g}, expected compressed=${y} or uncompressed=${w}`)}const d=t.toBytes||u,m=t.fromBytes||l;function E(B){const y=n.sqr(B),w=n.mul(y,B);return n.add(n.add(w,n.mul(B,s.a)),s.b)}function v(B,y){const w=n.sqr(y),g=E(B);return n.eql(w,g)}if(!v(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const _=n.mul(n.pow(s.a,ue),as),at=n.mul(n.sqr(s.b),BigInt(27));if(n.is0(n.add(_,at)))throw new Error("bad curve params: a or b");function O(B,y,w=!1){if(!n.isValid(y)||w&&n.is0(y))throw new Error(`bad point coordinate ${B}`);return y}function Q(B){if(!(B instanceof C))throw new Error("ProjectivePoint expected")}function L(B){if(!c||!c.basises)throw new Error("no endo");return ss(B,c.basises,r.ORDER)}const ht=$n((B,y)=>{const{X:w,Y:g,Z:b}=B;if(n.eql(b,n.ONE))return{x:w,y:g};const p=B.is0();y==null&&(y=p?n.ONE:n.inv(b));const N=n.mul(w,y),A=n.mul(g,y),x=n.mul(b,y);if(p)return{x:n.ZERO,y:n.ZERO};if(!n.eql(x,n.ONE))throw new Error("invZ was invalid");return{x:N,y:A}}),Ot=$n(B=>{if(B.is0()){if(t.allowInfinityPoint&&!n.is0(B.Y))return;throw new Error("bad point: ZERO")}const{x:y,y:w}=B.toAffine();if(!n.isValid(y)||!n.isValid(w))throw new Error("bad point: x or y not field elements");if(!v(y,w))throw new Error("bad point: equation left != right");if(!B.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function X(B,y,w,g,b){return w=new C(n.mul(w.X,B),w.Y,w.Z),y=le(g,y),w=le(b,w),y.add(w)}class C{constructor(y,w,g){this.X=O("x",y),this.Y=O("y",w,!0),this.Z=O("z",g),Object.freeze(this)}static CURVE(){return s}static fromAffine(y){const{x:w,y:g}=y||{};if(!y||!n.isValid(w)||!n.isValid(g))throw new Error("invalid affine point");if(y instanceof C)throw new Error("projective point not allowed");return n.is0(w)&&n.is0(g)?C.ZERO:new C(w,g,n.ONE)}static fromBytes(y){const w=C.fromAffine(m(Dt(y,void 0,"point")));return w.assertValidity(),w}static fromHex(y){return C.fromBytes(q("pointHex",y))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(y=8,w=!0){return ct.createCache(this,y),w||this.multiply(ue),this}assertValidity(){Ot(this)}hasEvenY(){const{y}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(y)}equals(y){Q(y);const{X:w,Y:g,Z:b}=this,{X:p,Y:N,Z:A}=y,x=n.eql(n.mul(w,A),n.mul(p,b)),T=n.eql(n.mul(g,A),n.mul(N,b));return x&&T}negate(){return new C(this.X,n.neg(this.Y),this.Z)}double(){const{a:y,b:w}=s,g=n.mul(w,ue),{X:b,Y:p,Z:N}=this;let A=n.ZERO,x=n.ZERO,T=n.ZERO,D=n.mul(b,b),H=n.mul(p,p),k=n.mul(N,N),M=n.mul(b,p);return M=n.add(M,M),T=n.mul(b,N),T=n.add(T,T),A=n.mul(y,T),x=n.mul(g,k),x=n.add(A,x),A=n.sub(H,x),x=n.add(H,x),x=n.mul(A,x),A=n.mul(M,A),T=n.mul(g,T),k=n.mul(y,k),M=n.sub(D,k),M=n.mul(y,M),M=n.add(M,T),T=n.add(D,D),D=n.add(T,D),D=n.add(D,k),D=n.mul(D,M),x=n.add(x,D),k=n.mul(p,N),k=n.add(k,k),D=n.mul(k,M),A=n.sub(A,D),T=n.mul(k,H),T=n.add(T,T),T=n.add(T,T),new C(A,x,T)}add(y){Q(y);const{X:w,Y:g,Z:b}=this,{X:p,Y:N,Z:A}=y;let x=n.ZERO,T=n.ZERO,D=n.ZERO;const H=s.a,k=n.mul(s.b,ue);let M=n.mul(w,p),Z=n.mul(g,N),Y=n.mul(b,A),et=n.add(w,g),V=n.add(p,N);et=n.mul(et,V),V=n.add(M,Z),et=n.sub(et,V),V=n.add(w,b);let K=n.add(p,A);return V=n.mul(V,K),K=n.add(M,Y),V=n.sub(V,K),K=n.add(g,b),x=n.add(N,A),K=n.mul(K,x),x=n.add(Z,Y),K=n.sub(K,x),D=n.mul(H,V),x=n.mul(k,Y),D=n.add(x,D),x=n.sub(Z,D),D=n.add(Z,D),T=n.mul(x,D),Z=n.add(M,M),Z=n.add(Z,M),Y=n.mul(H,Y),V=n.mul(k,V),Z=n.add(Z,Y),Y=n.sub(M,Y),Y=n.mul(H,Y),V=n.add(V,Y),M=n.mul(Z,V),T=n.add(T,M),M=n.mul(K,V),x=n.mul(et,x),x=n.sub(x,M),M=n.mul(et,Z),D=n.mul(K,D),D=n.add(D,M),new C(x,T,D)}subtract(y){return this.add(y.negate())}is0(){return this.equals(C.ZERO)}multiply(y){const{endo:w}=t;if(!r.isValidNot0(y))throw new Error("invalid scalar: out of range");let g,b;const p=N=>ct.cached(this,N,A=>Be(C,A));if(w){const{k1neg:N,k1:A,k2neg:x,k2:T}=L(y),{p:D,f:H}=p(A),{p:k,f:M}=p(T);b=H.add(M),g=X(w.beta,D,k,N,x)}else{const{p:N,f:A}=p(y);g=N,b=A}return Be(C,[g,b])[0]}multiplyUnsafe(y){const{endo:w}=t,g=this;if(!r.isValid(y))throw new Error("invalid scalar: out of range");if(y===yt||g.is0())return C.ZERO;if(y===Gt)return g;if(ct.hasCache(this))return this.multiply(y);if(w){const{k1neg:b,k1:p,k2neg:N,k2:A}=L(y),{p1:x,p2:T}=ns(C,g,p,A);return X(w.beta,x,T,b,N)}else return ct.unsafe(g,y)}multiplyAndAddUnsafe(y,w,g){const b=this.multiplyUnsafe(w).add(y.multiplyUnsafe(g));return b.is0()?void 0:b}toAffine(y){return ht(this,y)}isTorsionFree(){const{isTorsionFree:y}=t;return o===Gt?!0:y?y(C,this):ct.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:y}=t;return o===Gt?this:y?y(C,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(y=!0){return ae(y,"isCompressed"),this.assertValidity(),d(C,this,y)}toHex(y=!0){return Vt(this.toBytes(y))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(y=!0){return this.toBytes(y)}_setWindowSize(y){this.precompute(y)}static normalizeZ(y){return Be(C,y)}static msm(y,w){return is(C,r,y,w)}static fromPrivateKey(y){return C.BASE.multiply(Wt(r,y))}}C.BASE=new C(s.Gx,s.Gy,n.ONE),C.ZERO=new C(n.ZERO,n.ONE,n.ZERO),C.Fp=n,C.Fn=r;const mt=r.BITS,ct=new es(C,t.endo?Math.ceil(mt/2):mt);return C.BASE.precompute(8),C}function yi(e){return Uint8Array.of(e?2:3)}function Ii(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function fs(e,t={}){const{Fn:i}=e,n=t.randomBytes||jn,r=Object.assign(Ii(e.Fp,i),{seed:ci(i.ORDER)});function s(d){try{return!!Wt(i,d)}catch{return!1}}function o(d,m){const{publicKey:E,publicKeyUncompressed:v}=r;try{const _=d.length;return m===!0&&_!==E||m===!1&&_!==v?!1:!!e.fromBytes(d)}catch{return!1}}function a(d=n(r.seed)){return Qr(Dt(d,r.seed,"seed"),i.ORDER)}function c(d,m=!0){return e.BASE.multiply(Wt(i,d)).toBytes(m)}function f(d){const m=a(d);return{secretKey:m,publicKey:c(m)}}function h(d){if(typeof d=="bigint")return!1;if(d instanceof e)return!0;const{secretKey:m,publicKey:E,publicKeyUncompressed:v}=r;if(i.allowedLengths||m===E)return;const _=q("key",d).length;return _===E||_===v}function u(d,m,E=!0){if(h(d)===!0)throw new Error("first arg must be private key");if(h(m)===!1)throw new Error("second arg must be public key");const v=Wt(i,d);return e.fromHex(m).multiply(v).toBytes(E)}return Object.freeze({getPublicKey:c,getSharedSecret:u,keygen:f,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:o,randomSecretKey:a,isValidPrivateKey:s,randomPrivateKey:a,normPrivateKeyToScalar:d=>Wt(i,d),precompute(d=8,m=e.BASE){return m.precompute(d,!1)}},lengths:r})}function ls(e,t,i={}){Bn(t),Re(i,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=i.randomBytes||jn,r=i.hmac||((w,...g)=>Wn(t,w,bt(...g))),{Fp:s,Fn:o}=e,{ORDER:a,BITS:c}=o,{keygen:f,getPublicKey:h,getSharedSecret:u,utils:l,lengths:d}=fs(e,i),m={prehash:!1,lowS:typeof i.lowS=="boolean"?i.lowS:!1,format:void 0,extraEntropy:!1},E="compact";function v(w){const g=a>>Gt;return w>g}function _(w,g){if(!o.isValidNot0(g))throw new Error(`invalid signature ${w}: out of range 1..Point.Fn.ORDER`);return g}function at(w,g){je(g);const b=d.signature,p=g==="compact"?b:g==="recovered"?b+1:void 0;return Dt(w,p,`${g} signature`)}class O{constructor(g,b,p){this.r=_("r",g),this.s=_("s",b),p!=null&&(this.recovery=p),Object.freeze(this)}static fromBytes(g,b=E){at(g,b);let p;if(b==="der"){const{r:T,s:D}=wt.toSig(Dt(g));return new O(T,D)}b==="recovered"&&(p=g[0],b="compact",g=g.subarray(1));const N=o.BYTES,A=g.subarray(0,N),x=g.subarray(N,N*2);return new O(o.fromBytes(A),o.fromBytes(x),p)}static fromHex(g,b){return this.fromBytes(ie(g),b)}addRecoveryBit(g){return new O(this.r,this.s,g)}recoverPublicKey(g){const b=s.ORDER,{r:p,s:N,recovery:A}=this;if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");if(a*wi<b&&A>1)throw new Error("recovery id is ambiguous for h>1 curve");const T=A===2||A===3?p+a:p;if(!s.isValid(T))throw new Error("recovery id 2 or 3 invalid");const D=s.toBytes(T),H=e.fromBytes(bt(yi((A&1)===0),D)),k=o.inv(T),M=L(q("msgHash",g)),Z=o.create(-M*k),Y=o.create(N*k),et=e.BASE.multiplyUnsafe(Z).add(H.multiplyUnsafe(Y));if(et.is0())throw new Error("point at infinify");return et.assertValidity(),et}hasHighS(){return v(this.s)}toBytes(g=E){if(je(g),g==="der")return ie(wt.hexFromSig(this));const b=o.toBytes(this.r),p=o.toBytes(this.s);if(g==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return bt(Uint8Array.of(this.recovery),b,p)}return bt(b,p)}toHex(g){return Vt(this.toBytes(g))}assertValidity(){}static fromCompact(g){return O.fromBytes(q("sig",g),"compact")}static fromDER(g){return O.fromBytes(q("sig",g),"der")}normalizeS(){return this.hasHighS()?new O(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Vt(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Vt(this.toBytes("compact"))}}const Q=i.bits2int||function(g){if(g.length>8192)throw new Error("input is too large");const b=fe(g),p=g.length*8-c;return p>0?b>>BigInt(p):b},L=i.bits2int_modN||function(g){return o.create(Q(g))},ht=Pt(c);function Ot(w){return Lr("num < 2^"+c,w,yt,ht),o.toBytes(w)}function X(w,g){return Dt(w,void 0,"message"),g?Dt(t(w),void 0,"prehashed message"):w}function C(w,g,b){if(["recovered","canonical"].some(Z=>Z in b))throw new Error("sign() legacy options not supported");const{lowS:p,prehash:N,extraEntropy:A}=ke(b,m);w=X(w,N);const x=L(w),T=Wt(o,g),D=[Ot(T),Ot(x)];if(A!=null&&A!==!1){const Z=A===!0?n(d.secretKey):A;D.push(q("extraEntropy",Z))}const H=bt(...D),k=x;function M(Z){const Y=Q(Z);if(!o.isValidNot0(Y))return;const et=o.inv(Y),V=e.BASE.multiply(Y).toAffine(),K=o.create(V.x);if(K===yt)return;const be=o.create(et*o.create(k+K*T));if(be===yt)return;let Qi=(V.x===K?0:2)|Number(V.y&Gt),qi=be;return p&&v(be)&&(qi=o.neg(be),Qi^=1),new O(K,qi,Qi)}return{seed:H,k2sig:M}}function mt(w,g,b={}){w=q("message",w);const{seed:p,k2sig:N}=C(w,g,b);return Gr(t.outputLen,o.BYTES,r)(p,N)}function ct(w){let g;const b=typeof w=="string"||ee(w),p=!b&&w!==null&&typeof w=="object"&&typeof w.r=="bigint"&&typeof w.s=="bigint";if(!b&&!p)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(p)g=new O(w.r,w.s);else if(b){try{g=O.fromBytes(q("sig",w),"der")}catch(N){if(!(N instanceof wt.Err))throw N}if(!g)try{g=O.fromBytes(q("sig",w),"compact")}catch{return!1}}return g||!1}function B(w,g,b,p={}){const{lowS:N,prehash:A,format:x}=ke(p,m);if(b=q("publicKey",b),g=X(q("message",g),A),"strict"in p)throw new Error("options.strict was renamed to lowS");const T=x===void 0?ct(w):O.fromBytes(q("sig",w),x);if(T===!1)return!1;try{const D=e.fromBytes(b);if(N&&T.hasHighS())return!1;const{r:H,s:k}=T,M=L(g),Z=o.inv(k),Y=o.create(M*Z),et=o.create(H*Z),V=e.BASE.multiplyUnsafe(Y).add(D.multiplyUnsafe(et));return V.is0()?!1:o.create(V.x)===H}catch{return!1}}function y(w,g,b={}){const{prehash:p}=ke(b,m);return g=X(g,p),O.fromBytes(w,"recovered").recoverPublicKey(g).toBytes()}return Object.freeze({keygen:f,getPublicKey:h,getSharedSecret:u,utils:l,lengths:d,Point:e,sign:mt,verify:B,recoverPublicKey:y,Signature:O,hash:t})}function us(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},i=e.Fp;let n=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0;const r=Ut(t.n,{BITS:e.nBitLength,allowedLengths:n,modFromBytes:e.wrapPrivateKey}),s={Fp:i,Fn:r,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function hs(e){const{CURVE:t,curveOpts:i}=us(e),n={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:i,hash:e.hash,ecdsaOpts:n}}function ds(e,t){const i=t.Point;return Object.assign({},t,{ProjectivePoint:i,CURVE:Object.assign({},e,oi(i.Fn.ORDER,i.Fn.BITS))})}function gs(e){const{CURVE:t,curveOpts:i,hash:n,ecdsaOpts:r}=hs(e),s=cs(t,i),o=ls(s,n,r);return ds(e,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ze(e,t){const i=n=>gs({...e,hash:n});return{...i(t),create:i}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const mi={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},bi={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},Ei={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},ws=Ut(mi.p),ys=Ut(bi.p),Is=Ut(Ei.p),ms=Ze({...mi,Fp:ws,lowS:!1},Zr),bs=Ze({...bi,Fp:ys,lowS:!1},Hr),Es=Ze({...Ei,Fp:Is,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},Vr);function ps(e){const t=new Uint8Array([48,13,6,9,42,134,72,134,247,13,1,1,1,5,0]),i=e.length+1,n=t.length+1+he(i).length+i,r=new Uint8Array(1+he(n).length+n);let s=0;r[s++]=48;const o=he(n);r.set(o,s),s+=o.length,r.set(t,s),s+=t.length,r[s++]=3;const a=he(i);return r.set(a,s),s+=a.length,r[s++]=0,r.set(e,s),r}function he(e){return e<128?new Uint8Array([e]):e<256?new Uint8Array([129,e]):new Uint8Array([130,e>>8&255,e&255])}async function Ft(e,t,i){class n{constructor(){this.format="spki",this.keyData=new Uint8Array(0),this.algorithm={name:G.Ecdsa},this.extractable=!0,this.usage=["verify"]}}const r=new n;if(i.includes("BEGIN"))r.format="spki",r.keyData=vn(i);else if(/^[0-9A-Fa-f]+$/.test(i))r.format="raw",r.keyData=Ct(i);else{r.format="spki";const s=S(i);e.toLowerCase().includes("pkcs1")&&s[0]===48&&s[1]===130&&s[4]===2&&s[5]===130?r.keyData=ps(s):r.keyData=s}if(e.toLowerCase().includes("ecdsa"))if(t.includes("256"))r.algorithm={name:G.Ecdsa,namedCurve:st.P256};else if(t.includes("384"))r.algorithm={name:G.Ecdsa,namedCurve:st.P384};else if(t.includes("521"))r.algorithm={name:G.Ecdsa,namedCurve:st.P521};else throw new Error("Cannot determine ECDSA key size.");else if(e.toLowerCase().includes("ed25519"))r.algorithm={name:G.Ed25519};else if(e.toLowerCase().includes("rsa")||e.toLowerCase().includes("pkcs1")){let s=U.SHA256;const o=t.toUpperCase().replace(/[-_]/g,"");o.includes("SHA256")||o.includes("256")?s=U.SHA256:o.includes("SHA384")||o.includes("384")?s=U.SHA384:(o.includes("SHA512")||o.includes("512"))&&(s=U.SHA512),o.includes(te.PKCS1)||o.includes(te.RSAPKCS1)?r.algorithm={name:vt.PKCS1v15,hash:{name:s}}:r.algorithm={name:vt.PSS,hash:{name:s}}}else throw new Error(`Unsupported ${e}`);return await crypto.subtle.importKey(r.format,r.keyData,r.algorithm,r.extractable,r.usage)}async function At(e,t,i,n="sha256"){const r={name:e.algorithm.name};if(e.algorithm.name===G.Ecdsa){const s=e.algorithm.namedCurve;let o=32;if(s===st.P256?o=32:s===st.P384?o=48:s===st.P521&&(o=66),r.hash={name:""},n.includes("256"))r.hash.name=U.SHA256;else if(n.includes("384"))r.hash.name=U.SHA384;else if(n.includes("512"))r.hash.name=U.SHA512;else throw new Error("Cannot determine hashing algorithm;");let a;try{const c=Kt.parseBuffer(i),f=c.subs[0].toInteger(),h=c.subs[1].toInteger(),u=Ct(f.toString(16).padStart(o*2,"0")),l=Ct(h.toString(16).padStart(o*2,"0"));a=new Uint8Array(u.length+l.length),a.set(u,0),a.set(l,u.length)}catch{return!1}return await crypto.subtle.verify(r,e,a,t)}else{if(e.algorithm.name===G.Ed25519)return await crypto.subtle.verify(e.algorithm.name,e,i,t);if(e.algorithm.name===vt.PSS){const s=e.algorithm.hash.name,o=s===U.SHA256?32:s===U.SHA384?48:s===U.SHA512?64:32;return await crypto.subtle.verify({name:vt.PSS,saltLength:o},e,i,t)}else{if(e.algorithm.name===vt.PKCS1v15)return await crypto.subtle.verify(e.algorithm.name,e,i,t);throw new Error("Unsupported key type!")}}}async function Ss(e,t,i){if(e.algorithm.name!==G.Ecdsa)throw new Error("verifySignatureOverDigest only supports ECDSA keys");const n=e.algorithm.namedCurve;let r;if(n===st.P256)r=ms;else if(n===st.P384)r=bs;else if(n===st.P521)r=Es;else throw new Error(`Unsupported curve: ${n}`);const s=await crypto.subtle.exportKey("jwk",e);if(!s.x||!s.y)throw new Error("Invalid ECDSA public key: missing x or y coordinates");const o=An(s.x),a=An(s.y),c=new Uint8Array(1+o.length+a.length);return c[0]=4,c.set(o,1),c.set(a,1+o.length),r.verify(i,t,c,{format:"der",prehash:!1,lowS:!1})}var de=(e=>(e.certificateAuthorities="certificateAuthorities",e.ctlogs="ctlogs",e.timestampAuthorities="timestampAuthorities",e.tlogs="tlogs",e))(de||{});const xs={sha256:U.SHA256,sha384:U.SHA384,sha512:U.SHA512,SHA2_256:U.SHA256,SHA2_384:U.SHA384,SHA2_512:U.SHA512};function Ve(e){const t=xs[e];if(!t)throw new Error(`Unsupported hash algorithm: ${e}`);return t}const ge={"1.2.840.10045.4.3.1":"sha224","1.2.840.10045.4.3.2":"sha256","1.2.840.10045.4.3.3":"sha384","1.2.840.10045.4.3.4":"sha512"},we={"1.2.840.113549.1.1.11":"sha256","1.2.840.113549.1.1.12":"sha384","1.2.840.113549.1.1.13":"sha512","1.2.840.113549.1.1.5":"sha1"},He="1.2.840.113549.1.1.10",Ye={"2.16.840.1.101.3.4.2.1":"sha256","2.16.840.1.101.3.4.2.2":"sha384","2.16.840.1.101.3.4.2.3":"sha512"},ye="sha256",As={"1.2.840.10045.3.1.7":"secp256r1","1.3.132.0.34":"secp384r1","1.3.132.0.35":"secp521r1"};class Le{version;logID;timestamp;extensions;hashAlgorithm;signatureAlgorithm;signature;constructor(t){this.version=t.version,this.logID=t.logID,this.timestamp=t.timestamp,this.extensions=t.extensions,this.hashAlgorithm=t.hashAlgorithm,this.signatureAlgorithm=t.signatureAlgorithm,this.signature=t.signature}get datetime(){return new Date(Number(ir(this.timestamp)))}get algorithm(){switch(this.hashAlgorithm){case 0:return"none";case 1:return"md5";case 2:return"sha1";case 3:return"sha224";case 4:return"sha256";case 5:return"sha384";case 6:return"sha512";default:return"unknown"}}async verify(t,i){const n=new rt;return n.appendChar(this.version),n.appendChar(0),n.appendView(this.timestamp),n.appendUint16(1),n.appendView(t),n.appendUint16(this.extensions.byteLength),this.extensions.byteLength>0&&n.appendView(this.extensions),await At(i,n.buffer,this.signature,this.algorithm)}static parse(t){const i=new rt(t),n=i.getUint8();if(n!==0)throw new Error(`Unsupported SCT version: ${n} (expected 0 for v1)`);const r=i.getBlock(32),s=i.getBlock(8),o=i.getUint16(),a=i.getBlock(o),c=i.getUint8(),f=i.getUint8(),h=i.getUint16(),u=i.getBlock(h);if(i.position!==t.length)throw new Error("SCT buffer length mismatch");return new Le({version:n,logID:r,timestamp:s,extensions:a,hashAlgorithm:c,signatureAlgorithm:f,signature:u})}}class lt{root;constructor(t){this.root=t}get oid(){return this.root.subs[0].toOID()}get critical(){return this.root.subs.length===3?this.root.subs[1].toBoolean():!1}get value(){return this.extnValueObj.value}get valueObj(){return this.extnValueObj}get extnValueObj(){return this.root.subs[this.root.subs.length-1]}}class Ns extends lt{get isCA(){return this.sequence.subs[0]?.toBoolean()??!1}get pathLenConstraint(){return this.sequence.subs.length>1?this.sequence.subs[1].toInteger():void 0}get sequence(){return this.extnValueObj.subs[0]}}class Os extends lt{get digitalSignature(){return this.bitString[0]===1}get keyCertSign(){return this.bitString[5]===1}get crlSign(){return this.bitString[6]===1}get bitString(){return this.extnValueObj.subs[0].toBitString()}}class Ts extends lt{get rfc822Name(){const t=this.findGeneralName(1)?.value;if(t!==void 0)return W(t)}get uri(){const t=this.findGeneralName(6)?.value;if(t!==void 0)return W(t)}otherName(t){const i=this.findGeneralName(0);if(i===void 0||i.subs[0].toOID()!==t)return;const r=i.subs[1];return W(r.subs[0].value)}findGeneralName(t){return this.generalNames.find(i=>i.tag.isContextSpecific(t))}get generalNames(){return this.extnValueObj.subs[0].subs}}class Cs extends lt{get keyIdentifier(){return this.findSequenceMember(0)?.value}findSequenceMember(t){return this.sequence.subs.find(i=>i.tag.isContextSpecific(t))}get sequence(){return this.extnValueObj.subs[0]}}class vs extends lt{get keyIdentifier(){return this.extnValueObj.subs[0].value}}class zt extends lt{get stringValue(){return W(this.extnValueObj.value)}}class P extends lt{get stringValue(){return W(this.extnValueObj.subs[0].value)}}class pi extends zt{get issuer(){return this.stringValue}}class Si extends zt{get workflowTrigger(){return this.stringValue}}class xi extends zt{get workflowSHA(){return this.stringValue}}class Ai extends zt{get workflowName(){return this.stringValue}}class Ni extends zt{get workflowRepository(){return this.stringValue}}class Oi extends zt{get workflowRef(){return this.stringValue}}class Ti extends P{get issuer(){return this.stringValue}}class Ci extends P{get buildSignerURI(){return this.stringValue}}class vi extends P{get buildSignerDigest(){return this.stringValue}}class Ri extends P{get runnerEnvironment(){return this.stringValue}}class Di extends P{get sourceRepositoryURI(){return this.stringValue}}class Bi extends P{get sourceRepositoryDigest(){return this.stringValue}}class Ui extends P{get sourceRepositoryRef(){return this.stringValue}}class Mi extends P{get sourceRepositoryIdentifier(){return this.stringValue}}class _i extends P{get sourceRepositoryOwnerURI(){return this.stringValue}}class ji extends P{get sourceRepositoryOwnerIdentifier(){return this.stringValue}}class ki extends P{get buildConfigURI(){return this.stringValue}}class Zi extends P{get buildConfigDigest(){return this.stringValue}}class Vi extends P{get buildTrigger(){return this.stringValue}}class Hi extends P{get runInvocationURI(){return this.stringValue}}class Yi extends P{get sourceRepositoryVisibility(){return this.stringValue}}class Li extends lt{constructor(t){super(t)}get signedCertificateTimestamps(){const t=this.extnValueObj.subs[0].value,i=new rt(t),n=i.getUint16()+2,r=[];for(;i.position<n;){const s=i.getUint16(),o=i.getBlock(s);r.push(Le.parse(o))}if(i.position!==n)throw new Error("SCT list length does not match actual length");return r}}const Rs="2.5.29.14",Ds="2.5.29.15",Bs="2.5.29.17",Us="2.5.29.19",Ms="2.5.29.35",Ge="1.3.6.1.4.1.11129.2.4.2",We="1.3.6.1.4.1.57264.1.1",Fe="1.3.6.1.4.1.57264.1.2",ze="1.3.6.1.4.1.57264.1.3",Xe="1.3.6.1.4.1.57264.1.4",Ke="1.3.6.1.4.1.57264.1.5",$e="1.3.6.1.4.1.57264.1.6",Gi="1.3.6.1.4.1.57264.1.7",Pe="1.3.6.1.4.1.57264.1.8",Je="1.3.6.1.4.1.57264.1.9",Qe="1.3.6.1.4.1.57264.1.10",qe="1.3.6.1.4.1.57264.1.11",tn="1.3.6.1.4.1.57264.1.12",en="1.3.6.1.4.1.57264.1.13",nn="1.3.6.1.4.1.57264.1.14",rn="1.3.6.1.4.1.57264.1.15",sn="1.3.6.1.4.1.57264.1.16",on="1.3.6.1.4.1.57264.1.17",an="1.3.6.1.4.1.57264.1.18",cn="1.3.6.1.4.1.57264.1.19",fn="1.3.6.1.4.1.57264.1.20",ln="1.3.6.1.4.1.57264.1.21",un="1.3.6.1.4.1.57264.1.22";class tt{root;constructor(t){this.root=t}static parse(t){const i=typeof t=="string"?vn(t):t,n=Kt.parseBuffer(i);return new tt(n)}get tbsCertificate(){return this.tbsCertificateObj}get version(){return`v${(this.versionObj.subs[0].toInteger()+BigInt(1)).toString()}`}get serialNumber(){return this.serialNumberObj.value}get notBefore(){return this.validityObj.subs[0].toDate()}get notAfter(){return this.validityObj.subs[1].toDate()}get issuer(){return this.issuerObj.value}get subject(){return this.subjectObj.value}get publicKey(){return this.subjectPublicKeyInfoObj.toDER()}async getPublicKeyObj(t,i){const n=this.subjectPublicKeyInfoObj.toDER(),r=Kt.parseBuffer(n),s=r.subs[0].subs[0].toOID(),o=s==="1.2.840.113549.1.1.1";if(s===He)throw new Error("RSA-PSS public keys (id-RSASSA-PSS OID) are not supported by WebCrypto. Only certificates with standard RSA keys (rsaEncryption OID) signed using RSA-PSS are supported.");if(o){const c=t||ye,f=i?c:`PKCS1_${c}`;return Ft(G.RSA,f,pe(n))}else{const c=r.subs[0].subs[1]?.toOID(),f=As[c];if(!f)throw new Error(`Unknown ECDSA curve OID: ${c}`);return Ft(G.Ecdsa,f,pe(n))}}get publicKeyObj(){return this.getPublicKeyObj()}get signatureAlgorithm(){const t=this.signatureAlgorithmObj.subs[0].toOID();return ge[t]||we[t]||this.parseRsaPssHashAlgorithm()}get signatureAlgorithmOid(){return this.signatureAlgorithmObj.subs[0].toOID()}parseRsaPssHashAlgorithm(){if(this.signatureAlgorithmObj.subs[0].toOID()!==He)return"";const i=this.signatureAlgorithmObj.subs[1];if(!i||i.subs.length===0)return ye;const n=i.subs[0];if(n&&n.subs.length>0){const r=n.subs[0];if(r&&r.subs.length>0){const s=r.subs[0].toOID();return Ye[s]||ye}}return ye}get signatureValue(){return this.signatureValueObj.value.subarray(1)}get subjectAltName(){const t=this.extSubjectAltName;return t?.uri||t?.rfc822Name}get extensions(){return this.extensionsObj?.subs[0]?.subs||[]}get extKeyUsage(){const t=this.findExtension(Ds);return t?new Os(t):void 0}get extBasicConstraints(){const t=this.findExtension(Us);return t?new Ns(t):void 0}get extSubjectAltName(){const t=this.findExtension(Bs);return t?new Ts(t):void 0}get extAuthorityKeyID(){const t=this.findExtension(Ms);return t?new Cs(t):void 0}get extSubjectKeyID(){const t=this.findExtension(Rs);return t?new vs(t):void 0}get extSCT(){const t=this.findExtension(Ge);return t?new Li(t):void 0}get extFulcioIssuerV1(){const t=this.findExtension(We);return t?new pi(t):void 0}get extFulcioIssuerV2(){const t=this.findExtension(Pe);return t?new Ti(t):void 0}get extGitHubWorkflowTrigger(){const t=this.findExtension(Fe);return t?new Si(t):void 0}get extGitHubWorkflowSHA(){const t=this.findExtension(ze);return t?new xi(t):void 0}get extGitHubWorkflowName(){const t=this.findExtension(Xe);return t?new Ai(t):void 0}get extGitHubWorkflowRepository(){const t=this.findExtension(Ke);return t?new Ni(t):void 0}get extGitHubWorkflowRef(){const t=this.findExtension($e);return t?new Oi(t):void 0}get extBuildSignerURI(){const t=this.findExtension(Je);return t?new Ci(t):void 0}get extBuildSignerDigest(){const t=this.findExtension(Qe);return t?new vi(t):void 0}get extRunnerEnvironment(){const t=this.findExtension(qe);return t?new Ri(t):void 0}get extSourceRepositoryURI(){const t=this.findExtension(tn);return t?new Di(t):void 0}get extSourceRepositoryDigest(){const t=this.findExtension(en);return t?new Bi(t):void 0}get extSourceRepositoryRef(){const t=this.findExtension(nn);return t?new Ui(t):void 0}get extSourceRepositoryIdentifier(){const t=this.findExtension(rn);return t?new Mi(t):void 0}get extSourceRepositoryOwnerURI(){const t=this.findExtension(sn);return t?new _i(t):void 0}get extSourceRepositoryOwnerIdentifier(){const t=this.findExtension(on);return t?new ji(t):void 0}get extBuildConfigURI(){const t=this.findExtension(an);return t?new ki(t):void 0}get extBuildConfigDigest(){const t=this.findExtension(cn);return t?new Zi(t):void 0}get extBuildTrigger(){const t=this.findExtension(fn);return t?new Vi(t):void 0}get extRunInvocationURI(){const t=this.findExtension(ln);return t?new Hi(t):void 0}get extSourceRepositoryVisibility(){const t=this.findExtension(un);return t?new Yi(t):void 0}get isCA(){const t=this.extBasicConstraints?.isCA||!1;return this.extKeyUsage?t&&this.extKeyUsage.keyCertSign:t}extension(t){const i=this.findExtension(t);return i?new lt(i):void 0}async verify(t){const i=this.signatureAlgorithmOid,n=i===He,r=n?this.parseRsaPssHashAlgorithm():we[i]||ge[i],s=t?await t.getPublicKeyObj(r,n):await this.getPublicKeyObj(r,n);return await At(s,this.tbsCertificate.toDER(),this.signatureValue,this.signatureAlgorithm)}validForDate(t){return this.notBefore<=t&&t<=this.notAfter}equals(t){return j(this.root.toDER(),t.root.toDER())}clone(){const t=this.root.toDER(),i=new Uint8Array(t);return tt.parse(i)}findExtension(t){return this.extensions.find(i=>i.subs[0].toOID()===t)}get tbsCertificateObj(){return this.root.subs[0]}get signatureAlgorithmObj(){return this.root.subs[1]}get signatureValueObj(){return this.root.subs[2]}get versionObj(){return this.tbsCertificateObj.subs[0]}get serialNumberObj(){return this.tbsCertificateObj.subs[1]}get issuerObj(){return this.tbsCertificateObj.subs[3]}get validityObj(){return this.tbsCertificateObj.subs[4]}get subjectObj(){return this.tbsCertificateObj.subs[5]}get subjectPublicKeyInfoObj(){return this.tbsCertificateObj.subs[6]}get extensionsObj(){return this.tbsCertificateObj.subs.find(t=>t.tag.isContextSpecific(3))}}class hn{untrustedCert;trustedCerts;localCerts;timestamp;constructor(t){this.untrustedCert=t.untrustedCert,this.trustedCerts=t.trustedCerts,this.localCerts=_s([...t.trustedCerts,t.untrustedCert]),this.timestamp=t.timestamp}async verify(){const t=await this.sort();if(this.checkPath(t),!t.every(n=>n.validForDate(this.timestamp)))throw new Error("certificate is not valid or expired at the specified date");return t}async sort(){const t=this.untrustedCert;let i=await this.buildPaths(t);if(i=i.filter(r=>r.some(s=>this.trustedCerts.includes(s))),i.length===0)throw new Error("no trusted certificate path found");const n=i.reduce((r,s)=>r.length<s.length?r:s);return[t,...n].slice(0,-1)}async buildPaths(t){const i=[],n=await this.findIssuer(t);if(n.length===0)throw new Error("no valid certificate path found");for(let r=0;r<n.length;r++){const s=n[r];if(s.equals(t)){i.push([t]);continue}const o=await this.buildPaths(s);for(let a=0;a<o.length;a++)i.push([s,...o[a]])}return i}async findIssuer(t){let i=[],n;if(j(t.subject,t.issuer)&&await t.verify())return[t];t.extAuthorityKeyID&&(n=t.extAuthorityKeyID.keyIdentifier),this.localCerts.forEach(s=>{if(n&&s.extSubjectKeyID){j(s.extSubjectKeyID.keyIdentifier,n)&&i.push(s);return}j(s.subject,t.issuer)&&i.push(s)});const r=[];for(const s of i)try{await t.verify(s)&&r.push(s)}catch{}return r}checkPath(t){if(t.length<1)throw new Error("certificate chain must contain at least one certificate");if(!t.slice(1).every(n=>n.isCA))throw new Error("intermediate certificate is not a CA");for(let n=t.length-2;n>=0;n--)if(!j(t[n].issuer,t[n+1].subject))throw new Error("incorrect certificate name chaining");for(let n=0;n<t.length;n++){const r=t[n];if(r.extBasicConstraints?.isCA){const s=r.extBasicConstraints.pathLenConstraint;if(s!==void 0&&s<BigInt(n-1))throw new Error("path length constraint exceeded")}}}}function _s(e){for(let t=0;t<e.length;t++)for(let i=t+1;i<e.length;i++)e[t].equals(e[i])&&(e.splice(i,1),i--);return e}const js="DSSEv1";function ks(e,t){const i=[js,e.length,e,t.length,""].join(" "),r=new TextEncoder().encode(i);for(let o=0;o<r.length;o++)if(r[o]>127)throw new Error(`Invalid non-ASCII character in PAE prefix at position ${o}`);const s=new Uint8Array(r.length+t.length);return s.set(r,0),s.set(t,r.length),s}const dn=new Uint8Array([0]),Ie=new Uint8Array([1]);async function Zs(e){if(!e.inclusionProof)throw new Error("Missing inclusion proof");const t=e.inclusionProof,i=BigInt(t.logIndex),n=BigInt(t.treeSize);if(i<0n||i>=n)throw new Error(`Invalid log index: ${i}`);const{inner:r,border:s}=Vs(i,n);if(t.hashes.length!==r+s)throw new Error("Invalid hash count in inclusion proof");const o=t.hashes.slice(0,r).map(u=>S(u)),a=t.hashes.slice(r).map(u=>S(u)),c=await Fs(S(e.canonicalizedBody)),f=await Ys(await Hs(c,o,i),a),h=S(t.rootHash);if(!j(f,h))throw new Error("Calculated root hash does not match inclusion proof")}function Vs(e,t){const i=Ls(e,t),n=Gs(e>>BigInt(i));return{inner:i,border:n}}async function Hs(e,t,i){let n=e;for(let r=0;r<t.length;r++){const s=t[r];i>>BigInt(r)&BigInt(1)?n=await gn(s,n):n=await gn(n,s)}return n}async function Ys(e,t){let i=e;for(const n of t)i=await gn(n,i);return i}function Ls(e,t){return Ws(e^t-BigInt(1))}function Gs(e){return e.toString(2).split("1").length-1}function Ws(e){return e===0n?0:e.toString(2).length}async function gn(e,t){const i=new Uint8Array(Ie.length+e.length+t.length);i.set(Ie,0),i.set(e,Ie.length),i.set(t,Ie.length+e.length);const n=await crypto.subtle.digest(U.SHA256,i);return new Uint8Array(n)}async function Fs(e){const t=new Uint8Array(dn.length+e.length);t.set(dn,0),t.set(e,dn.length);const i=await crypto.subtle.digest(U.SHA256,t);return new Uint8Array(i)}const wn=`
|
|
3
|
-
|
|
4
|
-
`,zs=/\u2014 (\S+) (\S+)\n/g;class yn{note;signatures;constructor(t,i){this.note=t,this.signatures=i}static fromString(t){if(!t.includes(wn))throw new Error("Missing checkpoint separator");const i=t.indexOf(wn),n=t.slice(0,i+1),s=t.slice(i+wn.length).matchAll(zs),o=[];for(const a of s){const[,c,f]=a,h=S(f);if(h.length<5)throw new Error("Malformed checkpoint signature");o.push({name:c,keyHint:h.subarray(0,4),signature:h.subarray(4)})}if(o.length===0)throw new Error("No signatures found in checkpoint");return new yn(n,o)}}class In{origin;logSize;logHash;rest;constructor(t,i,n,r){this.origin=t,this.logSize=i,this.logHash=n,this.rest=r}static fromString(t){const i=t.trimEnd().split(`
|
|
5
|
-
`);if(i.length<3)throw new Error("Too few lines in checkpoint header");const n=i[0],r=BigInt(i[1]),s=S(i[2]),o=i.slice(3);return new In(n,r,s,o)}}async function Xs(e,t){if(!e.inclusionProof?.checkpoint)throw new Error("Missing checkpoint in inclusion proof");const i=S(e.logId.keyId),n=t.filter(f=>{const h=S(f.logId.keyId);return j(h,i)}),r=e.integratedTime?$s(n,new Date(Number(e.integratedTime)*1e3)):n,s=e.inclusionProof,o=yn.fromString(s.checkpoint.envelope),a=In.fromString(o.note);if(!await Ks(o,r))throw new Error("Invalid checkpoint signature");const c=S(s.rootHash);if(!j(a.logHash,c))throw new Error("Root hash mismatch between checkpoint and inclusion proof")}async function Ks(e,t){const i=qt(e.note);let n=!1;for(const r of e.signatures){const s=t.find(c=>{const f=S(c.logId.keyId);return j(f.subarray(0,4),r.keyHint)});if(!s)continue;const o=await Ps(s);await At(o,i,r.signature,s.hashAlgorithm)&&(n=!0)}return n}function $s(e,t){return e.filter(i=>{const n=new Date(i.publicKey.validFor.start),r=i.publicKey.validFor.end?new Date(i.publicKey.validFor.end):null;return t>=n&&(!r||t<=r)})}async function Ps(e){const t=e.publicKey.keyDetails;let i,n;if(t==="ecdsa-sha2-nistp256")i=G.Ecdsa,n="P256-SHA256";else if(t.includes("ECDSA"))i=G.Ecdsa,n=t.replace("PKIX_ECDSA_","").replaceAll("_","-");else if(t.includes("ED25519"))i=G.Ed25519,n=G.Ed25519;else if(t.includes("RSA"))i=G.RSA,n=t.replace("PKIX_RSA_","").replaceAll("_","-");else throw new Error(`Unsupported key type in keyDetails: ${t}`);return Ft(i,n,e.publicKey.rawBytes)}async function Js(e,t){const i=e;switch(i.apiVersion){case"0.0.1":return Qs(i,t);case"0.0.2":return qs(i,t);default:throw new Error(`Unsupported hashedrekord version: ${i.apiVersion}`)}}function Qs(e,t){const i=e.spec;if(!t.messageSignature)throw new Error("Bundle missing messageSignature for hashedrekord entry");const n=i.signature.content||"",r=S(n),s=S(t.messageSignature.signature);if(!j(r,s))throw new Error("Signature mismatch between TLog entry and bundle");const o=i.data.hash?.value||"",a=Ct(o),c=S(t.messageSignature.messageDigest.digest);if(!j(a,c))throw new Error("Digest mismatch between TLog entry and bundle")}function qs(e,t){const i=e.spec.hashedRekordV002;if(!t.messageSignature)throw new Error("Bundle missing messageSignature for hashedrekord v0.0.2 entry");const n=i.signature.content||"",r=S(n),s=S(t.messageSignature.signature);if(!j(r,s))throw new Error("Signature mismatch between TLog entry and bundle (v0.0.2)");const o=i.data.digest||"",a=S(o),c=S(t.messageSignature.messageDigest.digest);if(!j(a,c))throw new Error("Digest mismatch between TLog entry and bundle (v0.0.2)")}async function to(e,t){const i=e;switch(i.apiVersion){case"0.0.1":return eo(i,t);case"0.0.2":return no(i,t);default:throw new Error(`Unsupported dsse version: ${i.apiVersion}`)}}async function eo(e,t){if(!t.dsseEnvelope)throw new Error("Bundle missing dsseEnvelope for DSSE entry");if(!e.spec.signatures||e.spec.signatures.length!==1)throw new Error("DSSE entry must have exactly one signature");const i=e.spec.signatures[0].signature,n=S(i);if(t.dsseEnvelope.signatures.length===0)throw new Error("Bundle DSSE envelope missing signatures");const r=S(t.dsseEnvelope.signatures[0].sig);if(!j(n,r))throw new Error("DSSE signature mismatch between TLog entry and bundle");if(!e.spec.payloadHash?.value||!e.spec.payloadHash?.algorithm)throw new Error("DSSE entry missing payloadHash or algorithm");const s=Ve(e.spec.payloadHash.algorithm),o=Ct(e.spec.payloadHash.value),a=S(t.dsseEnvelope.payload),c=new Uint8Array(await crypto.subtle.digest(s,a));if(!j(o,c))throw new Error("DSSE payload hash mismatch between TLog entry and bundle")}async function no(e,t){if(!t.dsseEnvelope)throw new Error("Bundle missing dsseEnvelope for DSSE v0.0.2 entry");const i=e.spec.dsseV002;if(!i)throw new Error("DSSE v0.0.2 entry missing dsseV002 spec");if(!i.signatures||i.signatures.length!==1)throw new Error("DSSE v0.0.2 entry must have exactly one signature");const n=i.signatures[0].content,r=S(n);if(t.dsseEnvelope.signatures.length===0)throw new Error("Bundle DSSE envelope missing signatures");const s=S(t.dsseEnvelope.signatures[0].sig);if(!j(r,s))throw new Error("DSSE signature mismatch between TLog entry and bundle (v0.0.2)");if(!i.payloadHash?.digest||!i.payloadHash?.algorithm)throw new Error("DSSE v0.0.2 entry missing payloadHash or algorithm");const o=Ve(i.payloadHash.algorithm),a=S(i.payloadHash.digest),c=S(t.dsseEnvelope.payload),f=new Uint8Array(await crypto.subtle.digest(o,c));if(!j(a,f))throw new Error("DSSE payload hash mismatch between TLog entry and bundle (v0.0.2)")}async function io(e,t){const i=e;if(i.apiVersion!=="0.0.2")throw new Error(`Unsupported intoto version: ${i.apiVersion}`);if(!t.dsseEnvelope)throw new Error("Bundle missing dsseEnvelope for intoto entry");const n=i.spec.content.envelope;if(!n.signatures||n.signatures.length!==1)throw new Error("Intoto entry must have exactly one signature");const r=n.signatures[0].sig,s=Nn(r),o=S(s);if(t.dsseEnvelope.signatures.length===0)throw new Error("Bundle DSSE envelope missing signatures");const a=S(t.dsseEnvelope.signatures[0].sig);if(!j(o,a))throw new Error("Intoto signature mismatch between TLog entry and bundle");if(i.spec.content.payloadHash){if(!i.spec.content.payloadHash.algorithm)throw new Error("Intoto entry missing payloadHash algorithm");const c=Ve(i.spec.content.payloadHash.algorithm),f=Ct(i.spec.content.payloadHash.value),h=S(t.dsseEnvelope.payload),u=new Uint8Array(await crypto.subtle.digest(c,h));if(!j(f,u))throw new Error("Intoto payload hash mismatch between TLog entry and bundle")}}async function ro(e,t){const i=so(e),{kind:n,version:r}=e.kindVersion;if(n!==i.kind||r!==i.apiVersion)throw new Error(`kind/version mismatch - expected: ${n}/${r}, received: ${i.kind}/${i.apiVersion}`);switch(i.kind){case"hashedrekord":return Js(i,t);case"dsse":return to(i,t);case"intoto":return io(i,t);default:throw new Error(`Unsupported TLog entry kind: ${i.kind}`)}}function so(e){try{const t=Nn(e.canonicalizedBody),i=JSON.parse(t);if(!i.apiVersion||!i.kind||!i.spec)throw new Error("Invalid Rekor entry structure");return i}catch(t){throw new Error(`Failed to parse canonicalized body: ${t instanceof Error?t.message:String(t)}`)}}class ut extends Error{}class oo{root;constructor(t){this.root=t}get version(){return this.root.subs[0].toInteger()}get genTime(){return this.root.subs[4].toDate()}get messageImprintHashAlgorithm(){const t=this.messageImprintObj.subs[0].subs[0].toOID(),i=Ye[t];if(!i)throw new Error(`Unknown message imprint hash algorithm OID: ${t}`);return i}get messageImprintHashedMessage(){return this.messageImprintObj.subs[1].value}get raw(){return this.root.toDER()}async verify(t){const i=this.messageImprintHashAlgorithm,n=i==="sha256"?U.SHA256:i==="sha384"?U.SHA384:i==="sha512"?U.SHA512:i,r=await crypto.subtle.digest(n,t);if(!j(new Uint8Array(r),this.messageImprintHashedMessage))throw new ut("message imprint does not match artifact")}get messageImprintObj(){return this.root.subs[2]}}const ao="1.2.840.113549.1.7.2",co="1.2.840.113549.1.9.16.1.4",fo="1.2.840.113549.1.9.4";class mn{root;constructor(t){this.root=t}static parse(t){const i=Kt.parseBuffer(t);return new mn(i)}get status(){return this.pkiStatusInfoObj.subs[0].toInteger()}get contentType(){return this.contentTypeObj.toOID()}get eContentType(){return this.eContentTypeObj.toOID()}get signingTime(){return this.tstInfo.genTime}get signerIssuer(){return this.signerSidObj.subs[0].value}get signerSerialNumber(){return this.signerSidObj.subs[1].value}get signerDigestAlgorithm(){const t=this.signerDigestAlgorithmObj.subs[0].toOID(),i=Ye[t];if(!i)throw new Error(`Unknown digest algorithm OID: ${t}`);return i}get signatureAlgorithm(){const t=this.signatureAlgorithmObj.subs[0].toOID();return ge[t]||we[t]}get signatureValue(){return this.signatureValueObj.value}get tstInfo(){return new oo(this.eContentObj.subs[0].subs[0])}async verify(t,i){if(!this.timeStampTokenObj)throw new ut("timeStampToken is missing");if(this.contentType!==ao)throw new ut(`incorrect content type: ${this.contentType}`);if(this.eContentType!==co)throw new ut(`incorrect encapsulated content type: ${this.eContentType}`);await this.tstInfo.verify(t),await this.verifyMessageDigest(),await this.verifySignature(i)}async verifyMessageDigest(){const t=this.signerDigestAlgorithm,i=t==="sha256"?U.SHA256:t==="sha384"?U.SHA384:t==="sha512"?U.SHA512:t,n=await crypto.subtle.digest(i,this.tstInfo.raw),r=this.messageDigestAttributeObj.subs[1].subs[0].value;if(!j(new Uint8Array(n),r))throw new ut("signed data does not match tstInfo")}async verifySignature(t){const i=this.signedAttrsObj.toDER();i[0]=49;const n=this.signatureAlgorithmObj.subs[0].toOID(),r=ge[n]||we[n];if(!r)throw new ut(`Unsupported signature algorithm OID: ${n}`);if(!await At(t,i,this.signatureValue,r))throw new ut("signature verification failed")}get pkiStatusInfoObj(){return this.root.subs[0]}get timeStampTokenObj(){return this.root.subs[1]}get contentTypeObj(){return this.timeStampTokenObj.subs[0]}get signedDataObj(){const t=this.timeStampTokenObj.subs.find(i=>i.tag.isContextSpecific(0));if(!t)throw new ut("Missing timeStampTokenObj sub.");return t.subs[0]}get encapContentInfoObj(){return this.signedDataObj.subs[2]}get signerInfosObj(){const t=this.signedDataObj;return t.subs[t.subs.length-1]}get signerInfoObj(){return this.signerInfosObj.subs[0]}get eContentTypeObj(){return this.encapContentInfoObj.subs[0]}get eContentObj(){return this.encapContentInfoObj.subs[1]}get signedAttrsObj(){const t=this.signerInfoObj.subs.find(i=>i.tag.isContextSpecific(0));if(!t)throw new ut("Missing signedAttrsObj.");return t}get messageDigestAttributeObj(){const t=this.signedAttrsObj.subs.find(i=>i.subs[0].tag.isOID()&&i.subs[0].toOID()===fo);if(!t)throw new ut("Missing messageDigest.");return t}get signerSidObj(){return this.signerInfoObj.subs[1]}get signerDigestAlgorithmObj(){return this.signerInfoObj.subs[2]}get signatureAlgorithmObj(){return this.signerInfoObj.subs[4]}get signatureValueObj(){return this.signerInfoObj.subs[5]}}async function Wi(e,t,i){const n=e.signingTime;let r=lo(i,n);r=uo(r,{serialNumber:e.signerSerialNumber,issuer:e.signerIssuer});const s=await Promise.allSettled(r.map(a=>ho(e,t,a)));if(!s.some(a=>a.status==="fulfilled")){const a=s.filter(c=>c.status==="rejected").map(c=>c.reason?.message||"Unknown error");throw new Error(`Timestamp could not be verified against any trusted authority. Errors: ${a.join(", ")}`)}return n}function lo(e,t){return e.filter(i=>{if(i.validFor){const n=i.validFor.start?new Date(i.validFor.start):null,r=i.validFor.end?new Date(i.validFor.end):null;if(n&&t<n||r&&t>r)return!1}return!0})}function uo(e,t){return e.filter(i=>{if(!i.certChain||i.certChain.certificates.length===0)return!1;const n=tt.parse(S(i.certChain.certificates[0].rawBytes));return j(n.serialNumber,t.serialNumber)&&j(n.issuer,t.issuer)})}async function ho(e,t,i){if(!i.certChain||i.certChain.certificates.length===0)throw new Error("Certificate authority missing certificate chain");const n=tt.parse(S(i.certChain.certificates[0].rawBytes)),r=e.signingTime,s=i.certChain.certificates.slice(1).map(a=>tt.parse(S(a.rawBytes)));try{await new hn({untrustedCert:n,trustedCerts:s,timestamp:r}).verify()}catch(a){throw new Error(`TSA certificate chain verification failed: ${a instanceof Error?a.message:String(a)}`)}const o=await n.publicKeyObj;await e.verify(t,o)}async function Fi(e,t,i){if(!e?.rfc3161Timestamps?.length)return[];const n=[];for(const r of e.rfc3161Timestamps){const s=S(r.signedTimestamp),o=mn.parse(s),a=await Wi(o,t,i);n.push({signingTime:a,signerSerialNumber:Array.from(o.signerSerialNumber).join(",")})}for(let r=0;r<n.length;r++)for(let s=r+1;s<n.length;s++)if(n[r].signingTime.getTime()===n[s].signingTime.getTime()&&n[r].signerSerialNumber===n[s].signerSerialNumber)throw new Error("Duplicate TSA timestamp detected");return n.map(r=>r.signingTime)}const Jt={metadataUrl:"https://tuf-repo-cdn.sigstore.dev/",targetBaseUrl:"https://tuf-repo-cdn.sigstore.dev/targets/",namespace:"sigstore-browser",trustedRootTarget:"trusted_root.json",cacheTTL:36e5};class zi{metadataUrl;targetBaseUrl;initialRoot;namespace;trustedRootTarget;cacheTTL;tufClient;cachedRoot;cacheTimestamp;constructor(t={}){const i=t.metadataUrl||Jt.metadataUrl;this.metadataUrl=i.endsWith("/")?i:`${i}/`;const n=t.targetBaseUrl||Jt.targetBaseUrl;this.targetBaseUrl=n.endsWith("/")?n:`${n}/`,this.initialRoot=t.initialRoot,this.namespace=t.namespace||Jt.namespace,this.trustedRootTarget=t.trustedRootTarget||Jt.trustedRootTarget,this.cacheTTL=t.cacheTTL??Jt.cacheTTL}async initTUFClient(){if(!this.tufClient)try{const{TUFClient:t}=await Promise.resolve().then(()=>Fo),i=this.initialRoot||await this.getDefaultRoot();this.tufClient=new t(this.metadataUrl,i,this.namespace,this.targetBaseUrl)}catch(t){throw new Error(`Failed to initialize TUF client: ${t instanceof Error?t.message:String(t)}`)}}async getDefaultRoot(){const i=(await Promise.resolve().then(()=>zo)).default,n=new TextDecoder,r=Uint8Array.from(atob(i),s=>s.charCodeAt(0));return n.decode(r)}isCacheValid(){return!this.cachedRoot||!this.cacheTimestamp?!1:Date.now()-this.cacheTimestamp<this.cacheTTL}async getTrustedRoot(){if(this.isCacheValid()&&this.cachedRoot)return this.cachedRoot;if(await this.initTUFClient(),!this.tufClient)throw new Error("TUF client not initialized");try{await this.tufClient.updateTUF();const t=await this.tufClient.getTarget(this.trustedRootTarget),i=W(new Uint8Array(t)),n=JSON.parse(i);return this.cachedRoot=n,this.cacheTimestamp=Date.now(),n}catch(t){throw new Error(`Failed to fetch trusted root via TUF: ${t instanceof Error?t.message:String(t)}`)}}async refreshTrustedRoot(){return this.cachedRoot=void 0,this.cacheTimestamp=void 0,await this.getTrustedRoot()}clearCache(){this.cachedRoot=void 0,this.cacheTimestamp=void 0}}const Qt="application/vnd.dev.sigstore.bundle";function go(e){switch(e){case`${Qt}+json;version=0.1`:return"0.1";case`${Qt}+json;version=0.2`:return"0.2";case`${Qt}+json;version=0.3`:return"0.3"}if(e.startsWith(`${Qt}.v`)&&e.endsWith("+json")){const t=e.replace(`${Qt}.v`,"").replace("+json","");if(/^\d+\.\d+(\.\d+)?$/.test(t))return t}return"0.1"}class wo{root;rawRoot;options;constructor(t={}){this.root=void 0,this.rawRoot=void 0,this.options={tlogThreshold:t.tlogThreshold??1,ctlogThreshold:t.ctlogThreshold??1,tsaThreshold:t.tsaThreshold??0}}async loadLog(t,i){for(const n of i)if(t>new Date(n.publicKey.validFor.start)&&(!n.publicKey.validFor.end||new Date(n.publicKey.validFor.end)>t))return{publicKey:await Ft(n.publicKey.keyDetails,n.publicKey.keyDetails,n.publicKey.rawBytes),logId:S(n.logId.keyId)}}async loadCTLogs(t,i){const n=[];for(const r of i){const s=new Date(r.publicKey.validFor.start),o=r.publicKey.validFor.end?new Date(r.publicKey.validFor.end):new Date("9999-12-31");if(s<=t){const a=await Ft(r.publicKey.keyDetails,r.publicKey.keyDetails,r.publicKey.rawBytes);n.push({logID:S(r.logId.keyId),publicKey:a,validFor:{start:s,end:o}})}}if(n.length===0)throw new Error("Could not find any valid CT logs in sigstore root.");return n}async verifyCertificateChain(t,i,n){let r;for(const s of n)if(!(t<s.validFor.start||t>s.validFor.end))try{return await new hn({trustedCerts:s.certChain,untrustedCert:i,timestamp:t}).verify()}catch(o){r=o}throw new Error(`Failed to verify certificate chain: ${r?.message||"No valid CAs found"}`)}loadTSA(t,i){if(!i||i.length===0)return[];const n=[];for(const r of i){const s=new Date(r.validFor.start),o=r.validFor.end?new Date(r.validFor.end):new Date(864e13);if(t>s&&t<o){const a=r.certChain.certificates.map(c=>tt.parse(S(c.rawBytes)));a.length>0&&n.push({certChain:a,validFor:{start:s,end:o}})}}return n}loadCA(t,i){const n=[];for(const r of i){const s=new Date(r.validFor.start),o=r.validFor.end?new Date(r.validFor.end):new Date(864e13);if(t>s&&t<o){const a=r.certChain.certificates.map(c=>tt.parse(S(c.rawBytes)));a.length>0&&n.push({certChain:a,validFor:{start:s,end:o}})}}return n}async loadSigstoreRoot(t){const i=new Date;this.rawRoot=t,this.root={rekor:await this.loadLog(i,t[de.tlogs]),ctlogs:await this.loadCTLogs(i,t[de.ctlogs]),certificateAuthorities:this.loadCA(i,t[de.certificateAuthorities]),timestampAuthorities:this.loadTSA(i,t.timestampAuthorities)}}async loadSigstoreRootWithTUF(t){const n=await(t||new zi).getTrustedRoot();await this.loadSigstoreRoot(n)}async verifySCT(t,i,n){let r;const s=t.clone();for(let u=0;u<s.extensions.length;u++){const l=s.extensions[u];if(l.subs[0].toOID()===Ge){r=new Li(l),s.extensions.splice(u,1);break}}if(!r)throw new Error("Certificate is missing required SCT extension");if(r.signedCertificateTimestamps.length===0)throw new Error("SCT extension is present but contains no SCTs");const o=new Set;for(const u of r.signedCertificateTimestamps){const l=it(u.logID);if(o.has(l))throw new Error(`Duplicate SCT found for log ID: ${l}`);o.add(l)}const a=new rt,c=new Uint8Array(await crypto.subtle.digest(U.SHA256,i.publicKey));a.appendView(c);const f=s.tbsCertificate.toDER();a.appendUint24(f.length),a.appendView(f);const h=[];for(const u of r.signedCertificateTimestamps){const l=n.filter(m=>j(m.logID,u.logID)?m.validFor.start<=u.datetime&&u.datetime<=m.validFor.end:!1);if(!await(async()=>{for(const m of l)try{if(await u.verify(a.buffer,m.publicKey))return!0}catch{}return!1})())throw new Error("SCT verification failed");h.push(u.logID)}return h}async verifyInclusionPromise(t,i,n){const r=i.verificationMaterial.tlogEntries;if(r.length<this.options.tlogThreshold)throw new Error(`Not enough tlog entries: ${r.length} < ${this.options.tlogThreshold}`);const s=32;if(r.length>s)throw new Error(`Too many tlog entries: ${r.length} > ${s}`);for(let h=0;h<r.length;h++)for(let u=h+1;u<r.length;u++){const l=it(S(r[h].logId.keyId)),d=it(S(r[u].logId.keyId));if(l===d&&r[h].logIndex===r[u].logIndex)throw new Error(`Duplicate tlog entry found: logID=${l}, logIndex=${r[h].logIndex}`)}const o=r[0],a=go(i.mediaType);if(parseFloat(a)>=.2&&!o.inclusionProof)throw new Error("Bundle v0.2+ requires an inclusion proof.");if(o.inclusionPromise?.signedEntryTimestamp){if(!(!n&&o.inclusionProof)){if(!n)throw new Error("Rekor public key not found in trusted root");const h=S(o.logId.keyId);if(!j(n.logId,h))throw new Error(`Rekor log ID mismatch: bundle uses ${it(h)} but loaded key is for ${it(n.logId)}`);const u=S(o.inclusionPromise.signedEntryTimestamp),l=it(h),d=Number(o.integratedTime),m=qt($t({body:o.canonicalizedBody,integratedTime:d,logIndex:Number(o.logIndex),logID:l}));if(!await At(n.publicKey,m,u))throw new Error("Failed to verify the inclusion promise in the provided bundle.")}}else if(!o.inclusionProof)throw new Error("Bundle must have either an inclusion promise or an inclusion proof.");if(o.integratedTime){const h=Number(o.integratedTime),u=new Date(h*1e3);if(!t.validForDate(u))throw new Error("Artifact signing was logged outside of the certificate validity.")}else if(!i.verificationMaterial.timestampVerificationData)throw new Error("Rekor v2 bundles require a timestamp for verification.");const f=JSON.parse(W(S(o.canonicalizedBody)));if(f.kind==="hashedrekord"){let h;if(f.spec.hashedRekordV002){const u=f.spec.hashedRekordV002.signature.verifier;u?.x509Certificate&&(h=u.x509Certificate.rawBytes)}else f.spec.signature?.publicKey&&(h=f.spec.signature.publicKey.content);if(h){let u;if(f.spec.hashedRekordV002)u=tt.parse(S(h));else{const l=W(S(h));u=tt.parse(l)}if(!t.equals(u))throw new Error("Certificate in Rekor log does not match the signing certificate.")}}else if(f.kind==="dsse"){const h=f.spec.signatures?.[0]?.verifier;if(h){const u=W(S(h)),l=tt.parse(u);if(!t.equals(l))throw new Error("Certificate in DSSE tlog entry does not match the signing certificate.")}}else if(f.kind==="intoto"){const h=f.spec.content?.envelope?.signatures?.[0]?.publicKey;if(h){const u=W(S(h)),l=tt.parse(u);if(!t.equals(l))throw new Error("Certificate in intoto tlog entry does not match the signing certificate.")}}else throw new Error(`Unsupported tlog entry kind: ${f.kind}`);return!0}async verifyInclusionProof(t){if(!this.rawRoot)throw new Error("Sigstore root is undefined");if(t.verificationMaterial.tlogEntries.length<1)throw new Error("No transparency log entries found in bundle");for(const i of t.verificationMaterial.tlogEntries)i.inclusionProof&&(await Zs(i),i.inclusionProof.checkpoint&&await Xs(i,this.rawRoot.tlogs))}async verifyArtifact(t,i,n,r,s=!1){if(!this.root)throw new Error("Sigstore root is undefined");const o=n.verificationMaterial.certificate||n.verificationMaterial.x509CertificateChain?.certificates[0];if(!o)throw new Error("No certificate found in bundle");const a=tt.parse(S(o.rawBytes));let c;if(n.messageSignature)c=S(n.messageSignature.signature);else if(n.dsseEnvelope){if(!n.dsseEnvelope.signatures||n.dsseEnvelope.signatures.length===0)throw new Error("DSSE envelope has no signatures");c=S(n.dsseEnvelope.signatures[0].sig)}else throw new Error("Bundle does not contain a message signature or DSSE envelope");if(a.subjectAltName!==t)throw new Error("Certificate identity (subjectAltName) do not match the verifying one.");if((a.extFulcioIssuerV2?.issuer||a.extFulcioIssuerV1?.issuer)!==i)throw new Error("Identity issuer is not the verifying one.");const h=await this.verifyCertificateChain(a.notBefore,a,this.root.certificateAuthorities),u=h.length>1?h[1]:h[0],l=await this.verifySCT(a,u,this.root.ctlogs);if(l.length<this.options.ctlogThreshold)throw new Error(`Not enough valid SCTs: found ${l.length}, required ${this.options.ctlogThreshold}`);if(!await this.verifyInclusionPromise(a,n,this.root.rekor))throw new Error("Inclusion promise validation failed.");await this.verifyInclusionProof(n);for(const m of n.verificationMaterial.tlogEntries)await ro(m,n);const d=await Fi(n.verificationMaterial.timestampVerificationData,c,this.rawRoot?.timestampAuthorities||[]);if(d.length<this.options.tsaThreshold)throw new Error(`Not enough verified TSA timestamps: ${d.length} < ${this.options.tsaThreshold}`);for(const m of d)if(!a.validForDate(m))throw new Error("Certificate was not valid at the time of timestamping");if(n.dsseEnvelope){const m=S(n.dsseEnvelope.payload),E=JSON.parse(W(m));if(!E.subject||E.subject.length===0)throw new Error("DSSE payload has no subject");let v;s?v=it(r):v=it(new Uint8Array(await crypto.subtle.digest(U.SHA256,r)));let _=null;for(const L of E.subject){const ht=L.digest?.sha256;if(ht&&v===ht.toLowerCase()){_=L;break}}if(!_)throw new Error(`Artifact digest ${v} does not match any subject in DSSE payload`);const at=ks(n.dsseEnvelope.payloadType,m),O=await a.publicKeyObj;if(!await At(O,at,c))throw new Error("DSSE signature verification failed")}else{const m=await a.publicKeyObj;if(s){if(!await Ss(m,r,c))throw new Error("Error verifying signature over digest")}else if(!await At(m,r,c)){const v=m.algorithm.name||"unknown";throw new Error(`Error verifying artifact signature. Key algorithm: ${v}, Data length: ${r.length}, Signature length: ${c.length}`)}}return!0}}class Nt extends Error{constructor(t,i){super(i),this.code=t,this.name="VerificationError",Object.setPrototypeOf(this,Nt.prototype)}}class bn extends Nt{constructor(t){super("TIMESTAMP_ERROR",t),this.name="TimestampError",Object.setPrototypeOf(this,bn.prototype)}}class En extends Nt{constructor(t){super("CERTIFICATE_ERROR",t),this.name="CertificateError",Object.setPrototypeOf(this,En.prototype)}}class pn extends Nt{constructor(t){super("TLOG_ERROR",t),this.name="TLogError",Object.setPrototypeOf(this,pn.prototype)}}class Sn extends Nt{constructor(t){super("SIGNATURE_ERROR",t),this.name="SignatureError",Object.setPrototypeOf(this,Sn.prototype)}}class It extends Nt{constructor(t){super("POLICY_ERROR",t),this.name="PolicyError",Object.setPrototypeOf(this,It.prototype)}}const yo="https://token.actions.githubusercontent.com";class _t{expectedValue;constructor(t){this.expectedValue=t}verify(t){const i=this.getExtensionValue(t);if(i===void 0)throw new It(`Certificate does not contain ${this.name} (${this.oid}) extension`);if(i!==this.expectedValue)throw new It(`Certificate's ${this.name} does not match (got '${i}', expected '${this.expectedValue}')`)}}class J extends _t{}class Xi extends _t{oid=We;name="OIDCIssuer";getExtensionValue(t){return t.extFulcioIssuerV1?.issuer}}class Io extends _t{oid=Fe;name="GitHubWorkflowTrigger";getExtensionValue(t){return t.extGitHubWorkflowTrigger?.workflowTrigger}}class mo extends _t{oid=ze;name="GitHubWorkflowSHA";getExtensionValue(t){return t.extGitHubWorkflowSHA?.workflowSHA}}class bo extends _t{oid=Xe;name="GitHubWorkflowName";getExtensionValue(t){return t.extGitHubWorkflowName?.workflowName}}class Eo extends _t{oid=Ke;name="GitHubWorkflowRepository";getExtensionValue(t){return t.extGitHubWorkflowRepository?.workflowRepository}}class po extends _t{oid=$e;name="GitHubWorkflowRef";getExtensionValue(t){return t.extGitHubWorkflowRef?.workflowRef}}class So extends J{oid=Pe;name="OIDCIssuerV2";getExtensionValue(t){return t.extFulcioIssuerV2?.issuer}}class xo extends J{oid=Je;name="OIDCBuildSignerURI";getExtensionValue(t){return t.extBuildSignerURI?.buildSignerURI}}class Ao extends J{oid=Qe;name="OIDCBuildSignerDigest";getExtensionValue(t){return t.extBuildSignerDigest?.buildSignerDigest}}class No extends J{oid=qe;name="OIDCRunnerEnvironment";getExtensionValue(t){return t.extRunnerEnvironment?.runnerEnvironment}}class Oo extends J{oid=tn;name="OIDCSourceRepositoryURI";getExtensionValue(t){return t.extSourceRepositoryURI?.sourceRepositoryURI}}class To extends J{oid=en;name="OIDCSourceRepositoryDigest";getExtensionValue(t){return t.extSourceRepositoryDigest?.sourceRepositoryDigest}}class Co extends J{oid=nn;name="OIDCSourceRepositoryRef";getExtensionValue(t){return t.extSourceRepositoryRef?.sourceRepositoryRef}}class vo extends J{oid=rn;name="OIDCSourceRepositoryIdentifier";getExtensionValue(t){return t.extSourceRepositoryIdentifier?.sourceRepositoryIdentifier}}class Ro extends J{oid=sn;name="OIDCSourceRepositoryOwnerURI";getExtensionValue(t){return t.extSourceRepositoryOwnerURI?.sourceRepositoryOwnerURI}}class Do extends J{oid=on;name="OIDCSourceRepositoryOwnerIdentifier";getExtensionValue(t){return t.extSourceRepositoryOwnerIdentifier?.sourceRepositoryOwnerIdentifier}}class Bo extends J{oid=an;name="OIDCBuildConfigURI";getExtensionValue(t){return t.extBuildConfigURI?.buildConfigURI}}class Uo extends J{oid=cn;name="OIDCBuildConfigDigest";getExtensionValue(t){return t.extBuildConfigDigest?.buildConfigDigest}}class Mo extends J{oid=fn;name="OIDCBuildTrigger";getExtensionValue(t){return t.extBuildTrigger?.buildTrigger}}class _o extends J{oid=ln;name="OIDCRunInvocationURI";getExtensionValue(t){return t.extRunInvocationURI?.runInvocationURI}}class jo extends J{oid=un;name="OIDCSourceRepositoryVisibility";getExtensionValue(t){return t.extSourceRepositoryVisibility?.sourceRepositoryVisibility}}class ko{children;constructor(t){this.children=t}verify(t){for(const i of this.children)try{i.verify(t);return}catch{}throw new It(`0 of ${this.children.length} policies succeeded`)}}class Zo{children;constructor(t){this.children=t}verify(t){if(this.children.length<1)throw new It("no child policies to verify");for(const i of this.children)i.verify(t)}}class Vo{identity;issuerPolicy;constructor(t){this.identity=t.identity,this.issuerPolicy=t.issuer?new Xi(t.issuer):null}verify(t){this.issuerPolicy&&this.issuerPolicy.verify(t);const i=t.extSubjectAltName;if(!i)throw new It("Certificate does not contain SubjectAlternativeName extension");const n=new Set;i.rfc822Name&&n.add(i.rfc822Name),i.uri&&n.add(i.uri);const r=i.otherName(Gi);if(r&&n.add(r),!n.has(this.identity))throw new It(`Certificate's SANs do not match ${this.identity}; actual SANs: ${Array.from(n).join(", ")}`)}}function xn(e,t){const i=new Map(e);for(const n of e.keys())t.includes(n)||i.delete(n);return i}async function Ki(e){const t=new Map;for(const i in e){const n=e[i],r=qt($t(n)),s=it(new Uint8Array(await crypto.subtle.digest(U.SHA256,r)));if(t.has(s))throw new Error("Duplicate keyId found!");s!==i&&console.warn(`KeyId ${i} does not match the expected ${s}, importing anyway the provided one for proper referencing.`),t.set(i,await Ft(n.keytype,n.scheme,n.keyval.public))}return t}async function me(e,t,i,n,r){if(r<1)throw new Error("Threshold must be at least 1");if(r>e.size)throw new Error("Threshold is bigger than the number of keys provided, something is wrong.");const s=new Set(t),o=$t(i);let a=0;for(const c of n){if(!s.has(c.keyid))continue;s.delete(c.keyid);const f=e.get(c.keyid),h=Ct(c.sig);if(!f)throw new Error("Keyid was empty.");await At(f,qt(o),h)===!0&&a++}return a>=r}function $i(e){return e!=null&&typeof e=="object"&&"__raw_bytes__"in e&&typeof e.__raw_bytes__=="string"}function Pi(e){const t=S(e.__raw_bytes__);return JSON.parse(new TextDecoder().decode(t))}function Ji(e){return{__raw_bytes__:pe(e)}}class Ho{async read(t){const n=(await browser.storage.local.get(t))[t];return $i(n)?Pi(n):n}async write(t,i){await browser.storage.local.set({[t]:i})}async writeRaw(t,i){await browser.storage.local.set({[t]:Ji(i)})}async delete(t){await browser.storage.local.remove(t)}}class Yo{async read(t){try{const i=await(void 0)(t,"utf8");return JSON.parse(i)}catch{return}}async write(t,i){await this.ensureParentDir(t),await(void 0)(t,JSON.stringify(i),"utf8")}async writeRaw(t,i){await this.ensureParentDir(t),await(void 0)(t,i)}async ensureParentDir(t){await(void 0)((void 0)(t),{recursive:!0})}async delete(t){try{await(void 0)(t)}catch(i){if(i.code!=="ENOENT")throw i}}}class Lo{async read(t){const i=localStorage.getItem(t);if(i){const n=JSON.parse(i);return $i(n)?Pi(n):n}}async write(t,i){localStorage.setItem(t,JSON.stringify(i))}async writeRaw(t,i){localStorage.setItem(t,JSON.stringify(Ji(i)))}async delete(t){localStorage.removeItem(t)}}var R;(function(e){e.Root="root",e.Timestamp="timestamp",e.Snapshot="snapshot",e.Targets="targets"})(R||(R={}));const Go=[R.Root,R.Targets,R.Snapshot,R.Timestamp];class Wo{repositoryUrl;targetBaseUrl;startingRoot;namespace;backend;constructor(t,i,n,r){if(this.repositoryUrl=t,this.targetBaseUrl=r||t,this.startingRoot=i,this.namespace=n,typeof process<"u"&&process.versions?.node)this.backend=new Yo;else if(typeof browser<"u"&&browser.storage?.local)this.backend=new Ho;else if(typeof localStorage<"u")this.backend=new Lo;else throw new Error("No cache backend available")}getCacheKey(t){if(t.startsWith("/")||t.startsWith("./")||t.includes("..")||t.includes("\\"))throw new Error(`key contains an invalid pattern (${t})`);return`${this.namespace}/${t}.json`}async getFromCache(t){const i=this.getCacheKey(t);return await this.backend.read(i)}async setInCache(t,i){const n=this.getCacheKey(t);await this.backend.write(n,i)}async fetchMetafileBase(t,i,n=!1){let r;t=encodeURIComponent(t),n?r=`${this.repositoryUrl}${i}.${t}`:r=i!==-1?`${this.repositoryUrl}${i}.${t}.json`:`${this.repositoryUrl}${t}.json`;const s=await fetch(r);if(!s.ok)throw new Error(`Failed to fetch file: ${s.status} ${s.statusText}`);return s}validateMetadata(t){const i=new Set;for(const s of t.signatures){if(i.has(s.keyid))throw new Error(`Duplicate signature found for keyid: ${s.keyid}`);i.add(s.keyid)}const n=t.signed.spec_version;if(!n)throw new Error("spec_version is required");const r=n.split(".");if(r.length<2||r.length>3)throw new Error(`Invalid spec_version format: ${n}`);if(!r.every(s=>/^\d+$/.test(s)))throw new Error(`spec_version parts must be numeric: ${n}`);if(r[0]!=="1")throw new Error(`Unsupported spec_version major version: ${r[0]} (expected 1)`)}async fetchMetafileJson(t,i=-1){const r=await(await this.fetchMetafileBase(t,i)).json();return this.validateMetadata(r),r}async fetchMetafileBinary(t,i=-1,n=!1){const r=await this.fetchMetafileBase(t,i,n);return new Uint8Array(await r.arrayBuffer())}bootstrapRoot(t){try{const i=JSON.parse(t);return this.validateMetadata(i),i}catch(i){throw new Error(`Failed to load the JSON file: ${i}`)}}async verifyHashes(t,i,n){if(!i)return;const r={sha256:U.SHA256,sha384:U.SHA384,sha512:U.SHA512};for(const[s,o]of Object.entries(i)){const a=r[s];if(!a)throw new Error(`${n}: unsupported hash algorithm '${s}'`);const c=it(new Uint8Array(await crypto.subtle.digest(a,t)));if(o!==c)throw new Error(`${n}: ${s} hash mismatch`)}}async loadRoot(t,i){if(t.signed._type!==R.Root)throw new Error("Loading the wrong metafile as root.");let n,r,s;if(i==null?(n=await Ki(t.signed.keys),s=t.signed.roles.root.keyids,r=t.signed.roles.root.threshold):(n=i.keys,s=i.roles.root.keyids,r=i.threshold),await me(n,s,t.signed,t.signatures,r)!==!0)throw new Error("Failed to verify metafile.");if(n=await Ki(t.signed.keys),!Number.isSafeInteger(t.signed.version)||t.signed.version<1)throw new Error("There is something wrong with the root version number.");for(const o of Go)if(!t.signed.roles[o])throw new Error(`Missing required top-level role: ${o}`);for(const[o,a]of Object.entries(t.signed.roles))if(new Set(a.keyids).size!==a.keyids.length)throw new Error(`Duplicate key IDs found in role: ${o}`);return{keys:n,version:t.signed.version,expires:new Date(t.signed.expires),threshold:t.signed.roles.root.threshold,consistent_snapshot:t.signed.consistent_snapshot,roles:t.signed.roles}}async updateRoot(t){let i=await this.getFromCache(R.Root);i||(i=await this.bootstrapRoot(this.startingRoot));let n=await this.loadRoot(i);const r=n;let s,o;for(let a=n.version+1;a<Number.MAX_SAFE_INTEGER;a++){try{o=await this.fetchMetafileJson(R.Root,a)}catch(c){if(c instanceof Error&&c.message.includes("Failed to fetch"))break;throw c}if(o.signed.version!==a)throw new Error(`Version mismatch: URL version ${a} but file contains version ${o.signed.version}`);if(o.signed?._type!==R.Root)throw new Error("Incorrect metadata type for root.");if(s=await this.loadRoot(o,n),s.version!==n.version+1)throw new Error(`Root version must be exactly ${n.version+1}, got ${s.version}. Probable rollback attack.`);s=await this.loadRoot(o),n=s,await this.setInCache(R.Root,o)}if(n.expires<=t)throw new Error("Freeze attack on the root metafile.");if(n.version>r.version){const a=JSON.stringify(n.roles.timestamp.keyids.sort())!==JSON.stringify(r.roles.timestamp.keyids.sort()),c=JSON.stringify(n.roles.snapshot.keyids.sort())!==JSON.stringify(r.roles.snapshot.keyids.sort()),f=JSON.stringify(n.roles.targets.keyids.sort())!==JSON.stringify(r.roles.targets.keyids.sort());a&&(await this.backend.delete(this.getCacheKey(R.Timestamp)),await this.backend.delete(this.getCacheKey(R.Snapshot)),await this.backend.delete(this.getCacheKey(R.Targets))),c&&(await this.backend.delete(this.getCacheKey(R.Snapshot)),await this.backend.delete(this.getCacheKey(R.Targets))),f&&await this.backend.delete(this.getCacheKey(R.Targets))}return n}async updateTimestamp(t,i){const n=xn(t.keys,t.roles.timestamp.keyids);if(n.size<1)throw new Error("No valid keys found for the timestamp role.");const r=await this.getFromCache(R.Timestamp),s=await this.fetchMetafileBinary(R.Timestamp,-1),o=JSON.parse(W(s));if(this.validateMetadata(o),o.signed._type!==R.Timestamp)throw new Error(`Invalid metadata type: expected ${R.Timestamp}, got ${o.signed._type}`);if(!o.signed.meta||!o.signed.meta["snapshot.json"])throw new Error("Timestamp metadata missing required meta['snapshot.json']");if(await me(n,t.roles.timestamp.keyids,o.signed,o.signatures,t.roles.timestamp.threshold)!==!0)throw new Error("Failed verifying timestamp role signature(s).");if(r!==void 0){if(o.signed.version<r.signed.version)throw new Error("New timestamp file has a lower version that the currently cached one.");if(o.signed.version==r.signed.version)return null;if(o.signed.meta["snapshot.json"].version<r.signed.meta["snapshot.json"].version)throw new Error("Timestamp has been updated, but snapshot version has been rolled back.")}if(new Date(o.signed.expires)<=i)throw new Error("Freeze attack on the timestamp metafile.");return await this.backend.writeRaw(this.getCacheKey(R.Timestamp),s),o}async updateSnapshot(t,i,n){const r=n.signed.meta["snapshot.json"].version,s=xn(t.keys,t.roles.snapshot.keyids),o=await this.getFromCache(R.Snapshot);let a;t.consistent_snapshot?a=await this.fetchMetafileBinary(R.Snapshot,r):a=await this.fetchMetafileBinary(R.Snapshot,-1);const c=n.signed.meta["snapshot.json"];if(c.length!==void 0&&a.length!==c.length)throw new Error(`Snapshot length mismatch: expected ${c.length}, got ${a.length}`);await this.verifyHashes(a,c.hashes,"Snapshot");const f=JSON.parse(W(a));if(this.validateMetadata(f),f.signed._type!==R.Snapshot)throw new Error(`Invalid metadata type: expected ${R.Snapshot}, got ${f.signed._type}`);if(!f.signed.meta||!f.signed.meta["targets.json"])throw new Error("Snapshot metadata missing required meta['targets.json']");if(await me(s,t.roles.snapshot.keyids,f.signed,f.signatures,t.roles.snapshot.threshold)!==!0)throw new Error("Failed verifying snapshot role signature(s).");if(f.signed.version!==r)throw new Error(`Snapshot version mismatch: URL version ${r} but file contains version ${f.signed.version}`);if(o!==void 0)for(const[h]of Object.entries(o.signed.meta)){if(!(h in f.signed.meta))throw new Error("Target that was listed in an older snapshot was dropped in a newer one.");if(f.signed.meta[h].version<o.signed.meta[h].version)throw new Error("Target version in newer snapshot is lower than the cached one. Probable rollback attack.")}if(new Date(f.signed.expires)<=i)throw new Error("Freeze attack on the snapshot metafile.");return await this.backend.writeRaw(this.getCacheKey(R.Snapshot),a),f.signed.meta}async updateTargets(t,i,n){const r=xn(t.keys,t.roles.targets.keyids),s=await this.getFromCache(R.Targets);let o;t.consistent_snapshot?o=await this.fetchMetafileBinary(R.Targets,n[`${R.Targets}.json`].version):o=await this.fetchMetafileBinary(R.Targets,-1);const a=n[`${R.Targets}.json`];if(a.length!==void 0&&o.length!==a.length)throw new Error(`Targets length mismatch: expected ${a.length}, got ${o.length}`);await this.verifyHashes(o,a.hashes,"Targets");const c=JSON.parse(W(o));if(this.validateMetadata(c),c.signed._type!==R.Targets)throw new Error(`Invalid metadata type: expected ${R.Targets}, got ${c.signed._type}`);if(await me(r,t.roles.targets.keyids,c.signed,c.signatures,t.roles.targets.threshold)!==!0)throw new Error("Failed verifying targets role.");const f=n[`${R.Targets}.json`].version;if(c.signed.version!==f)throw new Error(`Targets version mismatch: URL version ${f} but file contains version ${c.signed.version}`);if(s!==void 0&&c.signed.version<s.signed.version)throw new Error("Targets version is lower than the cached one. Probable rollback attack.");if(new Date(c.signed.expires)<=i)throw new Error("Freeze attack on the targets metafile.");await this.backend.writeRaw(this.getCacheKey(R.Targets),o)}async listSignedTargets(){const t=await this.getFromCache(R.Targets),i=[];if(t)for(const n of Object.keys(t.signed.targets))i.push(n);return i}async fetchTarget(t){const i=await this.getFromCache(R.Targets);if(i===void 0)throw new Error("Failed to find the targets metafile when it should have existed.");if(!(t in i.signed.targets))throw new Error(`${t} not present in the targets role.`);const n=i.signed.targets[t],r=n.hashes;let s;if(r.sha256)s=r.sha256;else if(r.sha512)s=r.sha512;else throw new Error(`No supported hash algorithm found for ${t}. Available: ${Object.keys(r).join(", ")}`);const o=t.lastIndexOf("/"),a=o===-1?`${this.targetBaseUrl}${s}.${t}`:`${this.targetBaseUrl}${t.substring(0,o+1)}${s}.${t.substring(o+1)}`,c=await fetch(a);if(!c.ok)throw new Error(`Failed to fetch target: ${c.status} ${c.statusText}`);const f=new Uint8Array(await c.arrayBuffer());if(f.byteLength!==n.length)throw new Error(`${t} length mismatch: expected ${n.length}, got ${f.byteLength}`);return await this.verifyHashes(f,r,`Target '${t}'`),f.buffer}async updateTUF(){const t=new Date,i=await this.updateRoot(t),n=await this.updateTimestamp(i,t);if(n===null)return;const r=await this.updateSnapshot(i,t,n);await this.updateTargets(i,t,r)}async getTarget(t){return await this.fetchTarget(t)}}const Fo=Object.freeze(Object.defineProperty({__proto__:null,TUFClient:Wo},Symbol.toStringTag,{value:"Module"})),zo=Object.freeze(Object.defineProperty({__proto__:null,default:"ewogInNpZ25hdHVyZXMiOiBbCiAgewogICAia2V5aWQiOiAiNmYyNjAwODlkNTkyM2RhZjIwMTY2Y2E2NTdjNTQzYWY2MTgzNDZhYjk3MTg4NGE5OTk2MmIwMTk4OGJiZTBjMyIsCiAgICJzaWciOiAiIgogIH0sCiAgewogICAia2V5aWQiOiAiZTcxYTU0ZDU0MzgzNWJhODZhZGFkOTQ2MDM3OWM3NjQxZmI4NzI2ZDE2NGVhNzY2ODAxYTFjNTIyYWJhN2VhMiIsCiAgICJzaWciOiAiMzA0NTAyMjEwMGJiZGRkNDY0ZjgwNjZjZWI4OGJhNzg3Mzc1YzEyY2Q2MzMwNjgwZTA4YzI5MTA3MDNlNjUzOGM3MWNjNzlhZDIwMjIwNTE5MGIwNmU0NTM3ZmU5NjFiM2VmODFmZTY4ZWRjZDAwODljMTlmOTE5YWZlZDQyM2I5YWFmZDcwMDY0MTE1MyIKICB9LAogIHsKICAgImtleWlkIjogIjIyZjRjYWVjNmQ4ZTZmOTU1NWFmNjZiM2Q0YzNjYjA2YTNiYjIzZmRjN2UzOWM5MTZjNjFmNDYyZTZmNTJiMDYiLAogICAic2lnIjogIjMwNDQwMjIwNjkzMDZjZDUyNTdmNzMyYTc0MGMxYWZlNjBhOGU0MzNjNWRlNThlYWZlYWRiZTk5YzMzNmM5YzcxZDE5OGNmODAyMjAwZDc3Mzk1M2FlN2RiYzQ4ZDNlNWJhZDlhNmY2NGJhZmZmMTk2YjdlMmFkNGE1MmExOTUxOTM2N2Q0N2RjMDQyIgogIH0sCiAgewogICAia2V5aWQiOiAiNjE2NDM4MzgxMjViNDQwYjQwZGI2OTQyZjVjYjVhMzFjMGRjMDQzNjgzMTZlYjJhYWE1OGI5NTkwNGE1ODIyMiIsCiAgICJzaWciOiAiMzA0NDAyMjA0ZDIxYTJlYzgwZGY2NmU2MWY2ZmUyOTEyOTUxZGM0N2RmODM2MDM2ZjhjMGFiMTA4MTZkMzc1ZTcxZGJmNzllMDIyMDU0N2FkY2UxYWZkZjA0ZTY3OTRlZmEyMDNkZDUyNjRjNmY3ZTBlZjc4ZTU3ZmU5MzRiMGQyNmNiOTk0ZWVjNzYiCiAgfSwKICB7CiAgICJrZXlpZCI6ICJhNjg3ZTViZjRmYWI4MmIwZWU1OGQ0NmUwNWM5NTM1MTQ1YTJjOWFmYjQ1OGY0M2Q0MmI0NWNhMGZkY2UyYTcwIiwKICAgInNpZyI6ICIzMDQ1MDIyMDYwODI2NDk2NTU3MTQ0ZWIxNjQ5ODkzZWQ1ZjZmNGVhNTQ1MzZmZWIwY2E4MmY4Yjg5YWU2NDFiZTM5NzQzZTUwMjIxMDBhZDcxMThiNWU5ZDQ4MzczMjYyMDZlNDEyZmM2ZGEyOTk5OTI1ZDExMDMyOGE3YzE2NmIwNmM2MjQzMzZjOTNmIgogIH0sCiAgewogICAia2V5aWQiOiAiMTgzZTY0ZjM3NjcwZGMxM2NhMGQyODk5NWEzMDUzZjM3NDA5NTRkZGNlNDQzMjFhNDFlNDY1MzRjZjQ0ZTYzMiIsCiAgICJzaWciOiAiMzA0NjAyMjEwMGQ4MTc5NDM5YzJlNzNlYjBjMTczM2FiZWU3ZmFmODMyZGNhZWE3MjYzZWRjYjQ5MTk4OTFjM2EyNDdmMDU5MjMwMjIxMDBlMWE0MzdlMDc5N2U4MDNmOWI3MmRjOWQyZDkyMTU1YjBhMjI3MGMyNGVmZGQ1ZjRiM2E1ZDhmMGIwZjQzMWE3IgogIH0KIF0sCiAic2lnbmVkIjogewogICJfdHlwZSI6ICJyb290IiwKICAiY29uc2lzdGVudF9zbmFwc2hvdCI6IHRydWUsCiAgImV4cGlyZXMiOiAiMjAyNi0wMS0yMlQxMzowNTo1OVoiLAogICJrZXlzIjogewogICAiMGM4NzQzMmMzYmYwOWZkOTkxODlmZGMzMmZhNWVhZWRmNGU0YTVmYWM3YmFiNzNmYTA0YTJlMGZjNjRhZjZmNSI6IHsKICAgICJrZXlpZF9oYXNoX2FsZ29yaXRobXMiOiBbCiAgICAgInNoYTI1NiIsCiAgICAgInNoYTUxMiIKICAgIF0sCiAgICAia2V5dHlwZSI6ICJlY2RzYSIsCiAgICAia2V5dmFsIjogewogICAgICJwdWJsaWMiOiAiLS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS1cbk1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRVdSaUdyNStqKzNKNVNzSCtadHI1bkUySDJ3TzdcbkJWK25PM3M5M2dMY2ExOHFUT3pIWTFvV3lBR0R5a01Tc0dUVUJTdDlEK0FuMEtmS3NEMm1mU000MlE9PVxuLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tXG4iCiAgICB9LAogICAgInNjaGVtZSI6ICJlY2RzYS1zaGEyLW5pc3RwMjU2IiwKICAgICJ4LXR1Zi1vbi1jaS1vbmxpbmUtdXJpIjogImdjcGttczpwcm9qZWN0cy9zaWdzdG9yZS1yb290LXNpZ25pbmcvbG9jYXRpb25zL2dsb2JhbC9rZXlSaW5ncy9yb290L2NyeXB0b0tleXMvdGltZXN0YW1wL2NyeXB0b0tleVZlcnNpb25zLzEiCiAgIH0sCiAgICIxODNlNjRmMzc2NzBkYzEzY2EwZDI4OTk1YTMwNTNmMzc0MDk1NGRkY2U0NDMyMWE0MWU0NjUzNGNmNDRlNjMyIjogewogICAgImtleXR5cGUiOiAiZWNkc2EiLAogICAgImtleXZhbCI6IHsKICAgICAicHVibGljIjogIi0tLS0tQkVHSU4gUFVCTElDIEtFWS0tLS0tXG5NRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUVNeHBQT0pDSVo1b3RHNDEwNmZHSnNlRVFpM1Y5XG5wa01ZUTR1eVY5VGoxTTdXSFhJeUxHK2prZnZ1RzBnbFExSlpiUlpaQlYzZ0FSNHNvamRHSElTZW93PT1cbi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLVxuIgogICAgfSwKICAgICJzY2hlbWUiOiAiZWNkc2Etc2hhMi1uaXN0cDI1NiIsCiAgICAieC10dWYtb24tY2kta2V5b3duZXIiOiAiQGxhbmNlIgogICB9LAogICAiMjJmNGNhZWM2ZDhlNmY5NTU1YWY2NmIzZDRjM2NiMDZhM2JiMjNmZGM3ZTM5YzkxNmM2MWY0NjJlNmY1MmIwNiI6IHsKICAgICJrZXlpZF9oYXNoX2FsZ29yaXRobXMiOiBbCiAgICAgInNoYTI1NiIsCiAgICAgInNoYTUxMiIKICAgIF0sCiAgICAia2V5dHlwZSI6ICJlY2RzYSIsCiAgICAia2V5dmFsIjogewogICAgICJwdWJsaWMiOiAiLS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS1cbk1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRXpCelZPbUhDUG9qTVZMU0kzNjRXaWlWOE5QckRcbjZJZ1J4Vmxpc2t6L3YreTNKRVI1bWNWR2NPTmxpRGNXTUM1SjJsZkhtalBOUGhiNEg3eG04THpmU0E9PVxuLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tXG4iCiAgICB9LAogICAgInNjaGVtZSI6ICJlY2RzYS1zaGEyLW5pc3RwMjU2IiwKICAgICJ4LXR1Zi1vbi1jaS1rZXlvd25lciI6ICJAc2FudGlhZ290b3JyZXMiCiAgIH0sCiAgICI2MTY0MzgzODEyNWI0NDBiNDBkYjY5NDJmNWNiNWEzMWMwZGMwNDM2ODMxNmViMmFhYTU4Yjk1OTA0YTU4MjIyIjogewogICAgImtleWlkX2hhc2hfYWxnb3JpdGhtcyI6IFsKICAgICAic2hhMjU2IiwKICAgICAic2hhNTEyIgogICAgXSwKICAgICJrZXl0eXBlIjogImVjZHNhIiwKICAgICJrZXl2YWwiOiB7CiAgICAgInB1YmxpYyI6ICItLS0tLUJFR0lOIFBVQkxJQyBLRVktLS0tLVxuTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFaW5pa1NzQVFtWWtOZUg1ZVlxL0NuSXpMYWFjT1xueGxTYWF3UURPd3FLeS90Q3F4cTV4eFBTSmMyMUs0V0loczlHeU9rS2Z6dWVZM0dJTHpjTUpaNGNXdz09XG4tLS0tLUVORCBQVUJMSUMgS0VZLS0tLS1cbiIKICAgIH0sCiAgICAic2NoZW1lIjogImVjZHNhLXNoYTItbmlzdHAyNTYiLAogICAgIngtdHVmLW9uLWNpLWtleW93bmVyIjogIkBib2JjYWxsYXdheSIKICAgfSwKICAgImE2ODdlNWJmNGZhYjgyYjBlZTU4ZDQ2ZTA1Yzk1MzUxNDVhMmM5YWZiNDU4ZjQzZDQyYjQ1Y2EwZmRjZTJhNzAiOiB7CiAgICAia2V5aWRfaGFzaF9hbGdvcml0aG1zIjogWwogICAgICJzaGEyNTYiLAogICAgICJzaGE1MTIiCiAgICBdLAogICAgImtleXR5cGUiOiAiZWNkc2EiLAogICAgImtleXZhbCI6IHsKICAgICAicHVibGljIjogIi0tLS0tQkVHSU4gUFVCTElDIEtFWS0tLS0tXG5NRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUUwZ2hyaDkyTHcxWXIzaWRHVjVXcUN0TURCOEN4XG4rRDhoZEM0dzJaTE5JcGxWUm9WR0xza1lhM2doZU15T2ppSjhrUGkxNWFRMi8vN1Arb2o3VXZKUEd3PT1cbi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLVxuIgogICAgfSwKICAgICJzY2hlbWUiOiAiZWNkc2Etc2hhMi1uaXN0cDI1NiIsCiAgICAieC10dWYtb24tY2kta2V5b3duZXIiOiAiQGpvc2h1YWdsIgogICB9LAogICAiZTcxYTU0ZDU0MzgzNWJhODZhZGFkOTQ2MDM3OWM3NjQxZmI4NzI2ZDE2NGVhNzY2ODAxYTFjNTIyYWJhN2VhMiI6IHsKICAgICJrZXlpZF9oYXNoX2FsZ29yaXRobXMiOiBbCiAgICAgInNoYTI1NiIsCiAgICAgInNoYTUxMiIKICAgIF0sCiAgICAia2V5dHlwZSI6ICJlY2RzYSIsCiAgICAia2V5dmFsIjogewogICAgICJwdWJsaWMiOiAiLS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS1cbk1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRUVYc3ozU1pYRmI4ak1WNDJqNnBKbHlqYmpSOEtcbk4zQndvY2V4cTZMTUliNXFzV0tPUXZMTjE2TlVlZkxjNEhzd09vdW1Sc1ZWYWFqU3BRUzZmb2JrUnc9PVxuLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tXG4iCiAgICB9LAogICAgInNjaGVtZSI6ICJlY2RzYS1zaGEyLW5pc3RwMjU2IiwKICAgICJ4LXR1Zi1vbi1jaS1rZXlvd25lciI6ICJAbW5tNjc4IgogICB9CiAgfSwKICAicm9sZXMiOiB7CiAgICJyb290IjogewogICAgImtleWlkcyI6IFsKICAgICAiZTcxYTU0ZDU0MzgzNWJhODZhZGFkOTQ2MDM3OWM3NjQxZmI4NzI2ZDE2NGVhNzY2ODAxYTFjNTIyYWJhN2VhMiIsCiAgICAgIjIyZjRjYWVjNmQ4ZTZmOTU1NWFmNjZiM2Q0YzNjYjA2YTNiYjIzZmRjN2UzOWM5MTZjNjFmNDYyZTZmNTJiMDYiLAogICAgICI2MTY0MzgzODEyNWI0NDBiNDBkYjY5NDJmNWNiNWEzMWMwZGMwNDM2ODMxNmViMmFhYTU4Yjk1OTA0YTU4MjIyIiwKICAgICAiYTY4N2U1YmY0ZmFiODJiMGVlNThkNDZlMDVjOTUzNTE0NWEyYzlhZmI0NThmNDNkNDJiNDVjYTBmZGNlMmE3MCIsCiAgICAgIjE4M2U2NGYzNzY3MGRjMTNjYTBkMjg5OTVhMzA1M2YzNzQwOTU0ZGRjZTQ0MzIxYTQxZTQ2NTM0Y2Y0NGU2MzIiCiAgICBdLAogICAgInRocmVzaG9sZCI6IDMKICAgfSwKICAgInNuYXBzaG90IjogewogICAgImtleWlkcyI6IFsKICAgICAiMGM4NzQzMmMzYmYwOWZkOTkxODlmZGMzMmZhNWVhZWRmNGU0YTVmYWM3YmFiNzNmYTA0YTJlMGZjNjRhZjZmNSIKICAgIF0sCiAgICAidGhyZXNob2xkIjogMSwKICAgICJ4LXR1Zi1vbi1jaS1leHBpcnktcGVyaW9kIjogMzY1MCwKICAgICJ4LXR1Zi1vbi1jaS1zaWduaW5nLXBlcmlvZCI6IDM2NQogICB9LAogICAidGFyZ2V0cyI6IHsKICAgICJrZXlpZHMiOiBbCiAgICAgImU3MWE1NGQ1NDM4MzViYTg2YWRhZDk0NjAzNzljNzY0MWZiODcyNmQxNjRlYTc2NjgwMWExYzUyMmFiYTdlYTIiLAogICAgICIyMmY0Y2FlYzZkOGU2Zjk1NTVhZjY2YjNkNGMzY2IwNmEzYmIyM2ZkYzdlMzljOTE2YzYxZjQ2MmU2ZjUyYjA2IiwKICAgICAiNjE2NDM4MzgxMjViNDQwYjQwZGI2OTQyZjVjYjVhMzFjMGRjMDQzNjgzMTZlYjJhYWE1OGI5NTkwNGE1ODIyMiIsCiAgICAgImE2ODdlNWJmNGZhYjgyYjBlZTU4ZDQ2ZTA1Yzk1MzUxNDVhMmM5YWZiNDU4ZjQzZDQyYjQ1Y2EwZmRjZTJhNzAiLAogICAgICIxODNlNjRmMzc2NzBkYzEzY2EwZDI4OTk1YTMwNTNmMzc0MDk1NGRkY2U0NDMyMWE0MWU0NjUzNGNmNDRlNjMyIgogICAgXSwKICAgICJ0aHJlc2hvbGQiOiAzCiAgIH0sCiAgICJ0aW1lc3RhbXAiOiB7CiAgICAia2V5aWRzIjogWwogICAgICIwYzg3NDMyYzNiZjA5ZmQ5OTE4OWZkYzMyZmE1ZWFlZGY0ZTRhNWZhYzdiYWI3M2ZhMDRhMmUwZmM2NGFmNmY1IgogICAgXSwKICAgICJ0aHJlc2hvbGQiOiAxLAogICAgIngtdHVmLW9uLWNpLWV4cGlyeS1wZXJpb2QiOiA3LAogICAgIngtdHVmLW9uLWNpLXNpZ25pbmctcGVyaW9kIjogNgogICB9CiAgfSwKICAic3BlY192ZXJzaW9uIjogIjEuMCIsCiAgInZlcnNpb24iOiAxMywKICAieC10dWYtb24tY2ktZXhwaXJ5LXBlcmlvZCI6IDE5NywKICAieC10dWYtb24tY2ktc2lnbmluZy1wZXJpb2QiOiA0NgogfQp9"},Symbol.toStringTag,{value:"Module"}));return I.AllOf=Zo,I.AnyOf=ko,I.CertificateChainVerifier=hn,I.CertificateError=En,I.EXTENSION_OID_BUILD_CONFIG_DIGEST=cn,I.EXTENSION_OID_BUILD_CONFIG_URI=an,I.EXTENSION_OID_BUILD_SIGNER_DIGEST=Qe,I.EXTENSION_OID_BUILD_SIGNER_URI=Je,I.EXTENSION_OID_BUILD_TRIGGER=fn,I.EXTENSION_OID_FULCIO_ISSUER_V1=We,I.EXTENSION_OID_FULCIO_ISSUER_V2=Pe,I.EXTENSION_OID_GITHUB_WORKFLOW_NAME=Xe,I.EXTENSION_OID_GITHUB_WORKFLOW_REF=$e,I.EXTENSION_OID_GITHUB_WORKFLOW_REPOSITORY=Ke,I.EXTENSION_OID_GITHUB_WORKFLOW_SHA=ze,I.EXTENSION_OID_GITHUB_WORKFLOW_TRIGGER=Fe,I.EXTENSION_OID_OTHERNAME=Gi,I.EXTENSION_OID_RUNNER_ENVIRONMENT=qe,I.EXTENSION_OID_RUN_INVOCATION_URI=ln,I.EXTENSION_OID_SCT=Ge,I.EXTENSION_OID_SOURCE_REPOSITORY_DIGEST=en,I.EXTENSION_OID_SOURCE_REPOSITORY_IDENTIFIER=rn,I.EXTENSION_OID_SOURCE_REPOSITORY_OWNER_IDENTIFIER=on,I.EXTENSION_OID_SOURCE_REPOSITORY_OWNER_URI=sn,I.EXTENSION_OID_SOURCE_REPOSITORY_REF=nn,I.EXTENSION_OID_SOURCE_REPOSITORY_URI=tn,I.EXTENSION_OID_SOURCE_REPOSITORY_VISIBILITY=un,I.GITHUB_OIDC_ISSUER=yo,I.GitHubWorkflowName=bo,I.GitHubWorkflowRef=po,I.GitHubWorkflowRepository=Eo,I.GitHubWorkflowSHA=mo,I.GitHubWorkflowTrigger=Io,I.Identity=Vo,I.OIDCBuildConfigDigest=Uo,I.OIDCBuildConfigURI=Bo,I.OIDCBuildSignerDigest=Ao,I.OIDCBuildSignerURI=xo,I.OIDCBuildTrigger=Mo,I.OIDCIssuer=Xi,I.OIDCIssuerV2=So,I.OIDCRunInvocationURI=_o,I.OIDCRunnerEnvironment=No,I.OIDCSourceRepositoryDigest=To,I.OIDCSourceRepositoryIdentifier=vo,I.OIDCSourceRepositoryOwnerIdentifier=Do,I.OIDCSourceRepositoryOwnerURI=Ro,I.OIDCSourceRepositoryRef=Co,I.OIDCSourceRepositoryURI=Oo,I.OIDCSourceRepositoryVisibility=jo,I.PolicyError=It,I.SignatureError=Sn,I.SigstoreVerifier=wo,I.TLogError=pn,I.TimestampError=bn,I.TrustedRootProvider=zi,I.VerificationError=Nt,I.X509BuildConfigDigestExtension=Zi,I.X509BuildConfigURIExtension=ki,I.X509BuildSignerDigestExtension=vi,I.X509BuildSignerURIExtension=Ci,I.X509BuildTriggerExtension=Vi,I.X509Certificate=tt,I.X509Extension=lt,I.X509FulcioIssuerV1=pi,I.X509FulcioIssuerV2=Ti,I.X509GitHubWorkflowNameExtension=Ai,I.X509GitHubWorkflowRefExtension=Oi,I.X509GitHubWorkflowRepositoryExtension=Ni,I.X509GitHubWorkflowSHAExtension=xi,I.X509GitHubWorkflowTriggerExtension=Si,I.X509RunInvocationURIExtension=Hi,I.X509RunnerEnvironmentExtension=Ri,I.X509SourceRepositoryDigestExtension=Bi,I.X509SourceRepositoryIdentifierExtension=Mi,I.X509SourceRepositoryOwnerIdentifierExtension=ji,I.X509SourceRepositoryOwnerURIExtension=_i,I.X509SourceRepositoryRefExtension=Ui,I.X509SourceRepositoryURIExtension=Di,I.X509SourceRepositoryVisibilityExtension=Yi,I.verifyBundleTimestamp=Fi,I.verifyRFC3161Timestamp=Wi,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"}),I})({});
|
|
6
|
-
//# sourceMappingURL=sigstore.min.js.map
|