@zip.js/zip.js 2.8.46 → 2.8.47
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/deno.json +1 -1
- package/dist/zip-core-external.js +85 -9
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +95 -8
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +85 -9
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +86 -8
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +85 -9
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +99 -10
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +98 -9
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +97 -10
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +97 -10
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +96 -9
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +99 -10
- package/index-native.min.js +1 -1
- package/index.cjs +98 -9
- package/index.d.cts +141 -0
- package/index.d.ts +141 -0
- package/index.min.js +1 -1
- package/lib/core/codec-pool.js +6 -3
- package/lib/core/codec-worker.js +2 -1
- package/lib/core/constants.js +2 -0
- package/lib/core/options.js +4 -0
- package/lib/core/streams/codec-stream.js +2 -0
- package/lib/core/streams/common-crypto.js +2 -1
- package/lib/core/streams/zip-entry-stream.js +4 -2
- package/lib/core/util/sync-access-handle-temp-stream.js +2 -1
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-fs.js +1 -1
- package/lib/core/zip-reader.js +58 -5
- package/lib/core/zip-writer.js +43 -8
- package/lib/zip-core-base.js +2 -1
- package/lib/zip-core-reader.js +2 -1
- package/lib/zip-core-writer.js +10 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ const LOCAL_FILE_HEADER_SIGNATURE = 0x04034b50;
|
|
|
41
41
|
const SPLIT_ZIP_FILE_SIGNATURE = 0x08074b50;
|
|
42
42
|
const DATA_DESCRIPTOR_RECORD_SIGNATURE = SPLIT_ZIP_FILE_SIGNATURE;
|
|
43
43
|
const ARCHIVE_EXTRA_DATA_SIGNATURE = 0x08064b50;
|
|
44
|
+
const DIGITAL_SIGNATURE_RECORD_SIGNATURE = 0x05054b50;
|
|
44
45
|
const CENTRAL_FILE_HEADER_SIGNATURE = 0x02014b50;
|
|
45
46
|
const END_OF_CENTRAL_DIR_SIGNATURE = 0x06054b50;
|
|
46
47
|
const ZIP64_END_OF_CENTRAL_DIR_SIGNATURE = 0x06064b50;
|
|
@@ -238,7 +239,7 @@ function resetConfiguration() {
|
|
|
238
239
|
Object.assign(config, DEFAULT_CONFIGURATION);
|
|
239
240
|
}
|
|
240
241
|
|
|
241
|
-
const t$1=new Uint8Array(288);t$1.fill(8,0,144),t$1.fill(9,144,256),t$1.fill(7,256,280),t$1.fill(8,280,288),new Uint8Array(30).fill(5);const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n$1=t=>t({workerURI:t=>{const n="text/javascript";let s='(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){"use strict";const{Array:t,Object:e,Number:n,Math:s,Error:r,Uint8Array:o,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:l,Promise:w,TextEncoder:u,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new o,C=[[],[],[],[],[],[],[],[]];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?e>>>1^3988292384:e>>>1;C[0][t]=e}for(let t=0;256>t;t++)for(let e=1;8>e;e++){const n=C[e-1][t];C[e][t]=n>>>8^C[0][255&n]}const[A,I,x,M,P,D,B,F]=C;class R{constructor(t){this.o=t||-1}append(t){let e=0|this.o;const n=0|t.length;let s=0;if(n>=8&&t.buffer){const r=new l(t.buffer,t.byteOffset,n),o=n-8;for(;o>=s;s+=8){const t=e^r.getInt32(s,!0),n=r.getInt32(s+4,!0);e=F[255&t]^B[t>>>8&255]^D[t>>>16&255]^P[t>>>24&255]^M[255&n]^x[n>>>8&255]^I[n>>>16&255]^A[n>>>24&255]}}for(;n>s;s++)e=e>>>8^A[255&(e^t[s])];this.o=e}get(){return~this.o}}class U extends d{constructor(){let t;const e=new R;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new l(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}function W(t,e){const n=new o(t.length+e.length);return n.set(t),n.set(e,t.length),n}function _(t){return new l(t.buffer,t.byteOffset,t.byteLength)}const T={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],s=T.l(n);return 32===s?t.concat(e):T.h(e,s,0|n,t.slice(0,t.length-1))},m(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+T.l(n)},S(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,s.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=T.v(e,t[n-1]&2147483648>>e-1,1)),t},v:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,l:t=>s.round(t/1099511627776)||32,h(t,e,n,s){for(void 0===s&&(s=[]);e>=32;e-=32)s.push(n),n=0;if(0===e)return s.concat(t);for(let r=0;r<t.length;r++)s.push(n|t[r]>>>e),n=t[r]<<32-e;const r=t.length?t[t.length-1]:0,o=T.l(r);return s.push(T.v(e+o&31,e+o>32?n:s.pop(),1)),s}},V={bytes:{C(t){const e=T.m(t)/8,n=new o(e);let s;for(let r=0;e>r;r++)3&r||(s=t[r/4]),n[r]=s>>>24,s<<=8;return n},A(t){const e=[];let n,s=0;for(n=0;n<t.length;n++)s=s<<8|t[n],3&~n||(e.push(s),s=0);return 3&n&&e.push(T.v(8*(3&n),s)),e}}},K=class{constructor(t){const e=this;e.blockSize=512,e.I=[1732584193,4023233417,2562383102,271733878,3285377520],e.M=[1518500249,1859775393,2400959708,3395469782],t?(e.P=t.P.slice(0),e.D=t.D.slice(0),e.B=t.B):e.reset()}reset(){const t=this;return t.P=t.I.slice(0),t.D=[],t.B=0,t}update(t){const e=this;"string"==typeof t&&(t=V.F.A(t));const n=e.D=T.concat(e.D,t),s=e.B,o=e.B=s+T.m(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const c=new i(n);let a=0;for(let t=e.blockSize+s-(e.blockSize+s&e.blockSize-1);o>=t;t+=e.blockSize)e.R(c.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}U(){const t=this;let e=t.D;const n=t.P;e=T.concat(e,[T.v(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(s.floor(t.B/4294967296)),e.push(0|t.B);e.length;)t.R(e.splice(0,16));return t.reset(),n}W(t,e,n,s){return t>19?t>39?t>59?t>79?void 0:e^n^s:e&n|e&s|n&s:e^n^s:e&n|~e&s}_(t,e){return e<<t|e>>>32-t}R(e){const n=this,r=n.P,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let c=r[0],i=r[1],a=r[2],f=r[3],l=r[4];for(let t=0;79>=t;t++){16>t||(o[t]=n._(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=n._(5,c)+n.W(t,i,a,f)+l+o[t]+n.M[s.floor(t/20)]|0;l=f,f=a,a=n._(30,i),i=c,c=e}r[0]=r[0]+c|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+f|0,r[4]=r[4]+l|0}},E={importKey:t=>new E.T(V.bytes.A(t)),V(t,e,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let c,i,a,f,w;const u=new ArrayBuffer(o),h=new l(u);let p=0;const d=T;for(e=V.bytes.A(e),w=1;(o||1)>p;w++){for(c=i=t.encrypt(d.concat(e,[w])),a=1;n>a;a++)for(i=t.encrypt(i),f=0;f<i.length;f++)c[f]^=i[f];for(a=0;(o||1)>p&&a<c.length;a++)h.setInt32(p,c[a]),p+=4}return u.slice(0,s/8)},T:class{constructor(t){const e=this,n=e.K=K,s=[[],[]];e.L=[new n,new n];const r=e.L[0].blockSize/32;t.length>r&&(t=(new n).update(t).U());for(let e=0;r>e;e++)s[0][e]=909522486^t[e],s[1][e]=1549556828^t[e];e.L[0].update(s[0]),e.L[1].update(s[1]),e.O=new n(e.L[0])}reset(){const t=this;t.O=new t.K(t.L[0]),t.j=!1}update(t){this.j=!0,this.O.update(t)}digest(){const t=this,e=t.O.U(),n=new t.K(t.L[1]).update(e).U();return t.reset(),n}encrypt(t){if(this.j)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},L=typeof h!=b&&typeof h.getRandomValues==k,O="Invalid password",j="Invalid signature",H=j,N="zipjs-abort-check-password";function q(t){if(L)return h.getRandomValues(t);throw new r("Crypto API not supported")}const G=16,J={name:"PBKDF2"},Q=e.assign({hash:{name:"HMAC"}},J),X=e.assign({iterations:1e3,hash:{name:"SHA-1"}},J),Y=["deriveBits"],Z=[8,12,16],$=[16,24,32],tt=10,et=[0,0,0,0],nt=typeof h!=b,st=nt&&h.subtle,rt=nt&&typeof st!=b,ot=V.bytes,ct=class{constructor(t){const e=this;e.H=[[[],[],[],[],[]],[[],[],[],[],[]]],e.H[0][0][0]||e.N();const n=e.H[0][4],s=e.H[1],o=t.length;let c,i,a,f=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(e.M=[i=t.slice(0),a=[]],c=o;4*o+28>c;c++){let t=i[c-1];(c%o===0||8===o&&c%o===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],c%o===0&&(t=t<<8^t>>>24^f<<24,f=f<<1^283*(f>>7))),i[c]=i[c-o]^t}for(let t=0;c;t++,c--){const e=i[3&t?c:c-4];a[t]=4>=c||4>t?e:s[0][n[e>>>24]]^s[1][n[e>>16&255]]^s[2][n[e>>8&255]]^s[3][n[255&e]]}}encrypt(t){return this.G(t,0)}decrypt(t){return this.G(t,1)}N(){const t=this.H[0],e=this.H[1],n=t[4],s=e[4],r=[],o=[];let c,i,a,f;for(let t=0;256>t;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let l=c=0;!n[l];l^=i||1,c=o[c]||1){let o=c^c<<1^c<<2^c<<3^c<<4;o=o>>8^255&o^99,n[l]=o,s[o]=l,f=r[a=r[i=r[l]]];let w=16843009*f^65537*a^257*i^16843008*l,u=257*r[o]^16843008*o;for(let n=0;4>n;n++)t[n][l]=u=u<<24^u>>>8,e[n][o]=w=w<<24^w>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}G(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.M[e],s=n.length/4-2,o=[0,0,0,0],c=this.H[e],i=c[0],a=c[1],f=c[2],l=c[3],w=c[4];let u,h,p,d=t[0]^n[0],y=t[e?3:1]^n[1],m=t[2]^n[2],S=t[e?1:3]^n[3],g=4;for(let t=0;s>t;t++)u=i[d>>>24]^a[y>>16&255]^f[m>>8&255]^l[255&S]^n[g],h=i[y>>>24]^a[m>>16&255]^f[S>>8&255]^l[255&d]^n[g+1],p=i[m>>>24]^a[S>>16&255]^f[d>>8&255]^l[255&y]^n[g+2],S=i[S>>>24]^a[d>>16&255]^f[y>>8&255]^l[255&m]^n[g+3],g+=4,d=u,y=h,m=p;for(let t=0;4>t;t++)o[e?3&-t:t]=w[d>>>24]<<24^w[y>>16&255]<<16^w[m>>8&255]<<8^w[255&S]^n[g++],u=d,d=y,y=m,m=S,S=u;return o}},it=class{constructor(t,e){this.J=t,this.X=e,this.Y=e}reset(){this.Y=this.X}update(t){return this.Z(this.J,t,this.Y)}$(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}return t}et(t){0===(t[0]=this.$(t[0]))&&(t[1]=this.$(t[1]))}Z(t,e,n){let s;if(!(s=e.length))return[];const r=T.m(e);for(let r=0;s>r;r+=4){this.et(n);const s=t.encrypt(n);e[r]^=s[0],e[r+1]^=s[1],e[r+2]^=s[2],e[r+3]^=s[3]}return T.S(e,r)}},at=E.T;let ft=nt&&rt&&typeof st.importKey==k,lt=nt&&rt&&typeof st.deriveBits==k;class wt extends d{constructor({password:t,rawPassword:e,encryptionStrength:n,checkPasswordOnly:s,checkAuthenticationCode:c=!0}){super({start(){ht(this,t,e,n)},async transform(t,e){const n=this,{password:c,strength:i,nt:a,ready:f}=n;c?(await(async(t,e,n,s)=>{const o=await dt(t,e,n,mt(s,0,Z[e])),c=mt(s,Z[e]);if(o[0]!=c[0]||o[1]!=c[1])throw new r(O)})(n,i,c,mt(t,0,Z[i]+2)),t=mt(t,Z[i]+2),s?e.error(new r(N)):a()):await f;const l=new o(t.length-tt-(t.length-tt)%G);e.enqueue(pt(n,t,l,0,tt,!0))},async flush(t){const{st:e,ot:n,pending:s,ready:o}=this;if(n&&e){await o;const i=mt(s,0,s.length-tt),a=mt(s,s.length-tt);let f=z;if(i.length){const t=gt(ot,i);n.update(t);const s=e.update(t);f=St(ot,s)}const l=mt(St(ot,n.digest()),0,tt);let w=s.length<tt?1:0;for(let t=0;tt>t;t++)w|=l[t]^a[t];if(w&&c)throw new r(H);t.enqueue(f)}}})}}class ut extends d{constructor({password:t,rawPassword:e,encryptionStrength:n}){super({start(){ht(this,t,e,n)},async transform(t,e){const n=this,{password:s,strength:r,nt:c,ready:i}=n;let a=z;s?(a=await(async(t,e,n)=>{const s=q(new o(Z[e]));return W(s,await dt(t,e,n,s))})(n,r,s),c()):await i;const f=new o(a.length+t.length-t.length%G);f.set(a,0),e.enqueue(pt(n,t,f,a.length,0))},async flush(t){const{st:e,ot:n,pending:s,ready:r}=this;if(n&&e){await r;let o=z;if(s.length){const t=e.update(gt(ot,s));n.update(t),o=St(ot,t)}const c=St(ot,n.digest()).slice(0,tt);t.enqueue(W(o,c))}}})}}function ht(t,n,s,r){e.assign(t,{ready:new w(e=>t.nt=e),password:yt(n,s),strength:r-1,pending:z})}function pt(t,e,n,s,r,c){const{st:i,ot:a,pending:f}=t;f.length&&(e=W(f,e));const l=e.length-r;let w;for(n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,s+(l-l%G)),w=0;l-G>=w;w+=G){const t=gt(ot,mt(e,w,w+G));c&&a.update(t);const r=i.update(t);c||a.update(r),n.set(St(ot,r),w+s)}return t.pending=mt(e,w),n}async function dt(n,s,r,c){n.password=null;const i=await(async(t,e,n,s,r)=>{if(!ft)return E.importKey(e);try{return await st.importKey("raw",e,n,!1,r)}catch{return ft=!1,E.importKey(e)}})(0,r,Q,0,Y),a=await(async(t,e,n)=>{if(!lt)return E.V(e,t.salt,X.iterations,n);try{return await st.deriveBits(t,e,n)}catch{return lt=!1,E.V(e,t.salt,X.iterations,n)}})(e.assign({salt:c},X),i,8*(2*$[s]+2)),f=new o(a),l=gt(ot,mt(f,0,$[s])),w=gt(ot,mt(f,$[s],2*$[s])),u=mt(f,2*$[s]);return e.assign(n,{keys:{key:l,ct:w,passwordVerification:u},st:new it(new ct(l),t.from(et)),ot:new at(w)}),u}function yt(t,e){return e===v?(t=>{if(typeof u==b){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new u).encode(t)})(t):e}function mt(t,e,n){return t.subarray(e,n)}function St(t,e){return t.C(e)}function gt(t,e){return t.A(e)}class vt extends d{constructor({password:t,rawPassword:e,passwordVerification:n,checkPasswordOnly:s}){super({start(){kt(this,t,e,n)},transform(t,e){const n=this;if(n.password||n.rawPassword){const e=zt(n,t.subarray(0,12));if(n.password=n.rawPassword=null,0!=(e[11]^n.passwordVerification))throw new r(O);t=t.subarray(12)}s?e.error(new r(N)):e.enqueue(zt(n,t))}})}}class bt extends d{constructor({password:t,rawPassword:e,passwordVerification:n}){super({start(){kt(this,t,e,n)},transform(t,e){const n=this;let s,r;if(n.password||n.rawPassword){n.password=n.rawPassword=null;const e=q(new o(12));e[11]=n.passwordVerification,s=new o(t.length+e.length),s.set(Ct(n,e),0),r=12}else s=new o(t.length),r=0;s.set(Ct(n,t),r),e.enqueue(s)}})}}function kt(t,n,s,r){e.assign(t,{password:n,rawPassword:s,passwordVerification:r}),((t,n,s)=>{const r=[305419896,591751049,878082192];if(e.assign(t,{keys:r,it:new R(r[0]),ft:new R(r[2])}),s)for(let e=0;e<s.length;e++)At(t,s[e]);else for(let e=0;e<n.length;e++)At(t,n.charCodeAt(e))})(t,n,s)}function zt(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=It(t)^e[s],At(t,n[s]);return n}function Ct(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=It(t)^e[s],At(t,e[s]);return n}function At(t,e){let[,n]=t.keys;t.it.append([e]);const r=~t.it.get();n=Mt(s.imul(Mt(n+xt(r)),134775813)+1),t.ft.append([n>>>24]);const o=~t.ft.get();t.keys=[r,n,o]}function It(t){const e=2|t.keys[2];return xt(s.imul(e,1^e)>>>8)}function xt(t){return 255&t}function Mt(t){return 4294967295&t}const Pt=new f;function Dt(t){return Pt.get(t)}const Bt="Invalid uncompressed size",Ft=j,Rt="deflate-raw",Ut="gzip",Wt=[31,139,8];class _t extends d{constructor(t,{chunkSize:e,CompressionStreamFallback:n,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:w,format:u,compressionMethod:h}=t,p=this;let d,y,m,S=super.readable;const g=u&&Dt(u),v=a&&r&&!w&&!g&&(!o||i)&&!(!c||!s);if(o&&!i||!a||v||(d=new U,S=jt(S,d)),r)if(g)S=Ht(S,Lt(g.CompressionStream,u,{level:f,chunkSize:e,compressionMethod:h}));else if(v)m=new Tt,S=Ht(S,new s(Ut)),S=jt(S,m);else try{S=Ot(S,c,{level:f,chunkSize:e},s,n)}catch(t){let e;try{e=new s(Ut)}catch{throw t}S=Ht(S,e),S=jt(S,new Tt)}o&&(i?S=jt(S,new bt(t)):(y=new ut(t),S=jt(S,y))),Et(p,S,()=>{o&&!i||!a||(p.crc32=v?m.crc32:new l(d.value.buffer).getUint32(0))})}}class Tt extends d{constructor(){let t,e=10,n=new o(0);super({transform(t,r){if(e){const n=s.min(e,t.length);if(e-=n,!(t=t.subarray(n)).length)return}const o=n.length+t.length;if(8>=o)return void(n=W(n,t));const c=o-8,i=s.min(c,n.length);r.enqueue(W(n.subarray(0,i),t.subarray(0,c-i))),n=W(n.subarray(i),t.subarray(c-i))},flush(){const e=_(n);t.crc32=e.getUint32(0,!0),t.uncompressedSize=e.getUint32(4,!0)}}),t=this}}class Vt extends d{constructor(t,{chunkSize:e,DecompressionStreamFallback:n,DecompressionStream:s}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:u,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:b}=t;let k,z,C=super.readable;if(i&&(c?C=jt(C,new vt(t)):(z=new wt(t),C=jt(C,z))),u){const t=m&&Dt(m);if(t)C=Ht(C,Lt(t.DecompressionStream,m,{chunkSize:e,compressionMethod:S,rawBitFlag:g,uncompressedSize:b}));else try{C=Ot(C,h,{chunkSize:e,deflate64:p},s,n)}catch(t){if(p||b===v)throw t;let e;try{e=new s(Ut)}catch{throw t}C=((t,e,n)=>{const s=new R;let c,i,a,f=0,l=!1;const u=new w((t,e)=>{i=t,a=e});u.catch(()=>{}),n||i();const h=new d({start(t){const e=new o(10);e.set(Wt),t.enqueue(e)},transform(t,e){e.enqueue(t)},async flush(t){l=!0,y();try{await u}finally{m()}const e=new o(8),r=_(e);r.setUint32(0,s.get(),!0),r.setUint32(4,n,!0),t.enqueue(e)},cancel(t){a(t)}}),p=new d({transform(t,e){s.append(t),f+=t.length,n>f?l&&y():i(),e.enqueue(t)},cancel(t){a(t)}});return t=jt(t,h),jt(t=Ht(t,e),p);function y(){m(),c=setTimeout(()=>a(new r(Bt)),5e3)}function m(){clearTimeout(c)}})(C,e,b)}C=(t=>{const e=t.getReader();return new y({async pull(t){let n;try{n=await e.read()}catch(t){if(t&&t.message)throw t;const e=new r("Invalid compressed data");throw e.cause=t,e}const{value:s,done:o}=n;o?t.close():t.enqueue(s)},cancel:t=>e.cancel(t)})})(C)}a&&(k=new U,C=jt(C,k)),Et(this,C,()=>{if(a){const t=new l(k.value.buffer);if(f!=t.getUint32(0,!1))throw new r(Ft)}})}}const Kt=new f;function Et(t,n,s){n=jt(n,new d({flush:s})),e.defineProperty(t,"readable",{get:()=>n})}function Lt(t,e,n){if(!t)throw new r("Compression method not supported");return new t(e,n)}function Ot(t,e,n,s,r){const o=e&&s?s:r||s,c=n.deflate64?"deflate64-raw":Rt;let i;try{i=new o(c,n)}catch(t){if(!e||!r||o==r)throw t;i=new r(c,n)}return Ht(t,i)}function jt(t,e){return(t=>{if(t instanceof y)return t;const e=t.getReader();return new y({async pull(t){const{value:n,done:s}=await e.read();s?t.close():t.enqueue(n)},cancel:t=>e.cancel(t)})})(t).pipeThrough(e)}function Ht(t,e){const n=e.writable.getWriter(),s=t.getReader();return(async()=>{try{for(;;){await n.ready;const t=await s.read();if(t.done){await n.close();break}await n.write(t.value)}}catch(t){await(async(t,e)=>{try{await t.abort(e)}catch{}})(n,t),await(async(t,e)=>{try{await t.cancel(e)}catch{}})(s,t)}})(),e.readable}const Nt="data",qt="close",Gt="deflate";class Jt extends d{constructor(t,n){super({});const s=this,{codecType:o}=t;let c;o.startsWith(Gt)?c=_t:o.startsWith("inflate")&&(c=Vt),s.outputSize=0;let i=0;const a=new c(t,n),f=super.readable,l=new d({transform(t,e){t&&t.length&&(i+=t.length,e.enqueue(t))},flush(){e.assign(s,{inputSize:i})}}),w=new d({transform(e,n){if(e&&e.length&&(n.enqueue(e),s.outputSize+=e.length,t.outputSize!==v&&s.outputSize>t.outputSize))throw new r(Bt)},flush(){const{crc32:t}=a;e.assign(s,{crc32:t,inputSize:i})}});e.defineProperty(s,"readable",{get:()=>f.pipeThrough(l).pipeThrough(a).pipeThrough(w)})}}class Qt extends d{constructor(t){const e=[];let s=0;function r(){const n=new o(t);let r=0;for(;t>r;){const s=e[0],o=t-r;s.length>o?(n.set(s.subarray(0,o),r),e[0]=s.subarray(o),r+=o):(n.set(s,r),r+=s.length,e.shift())}return s-=t,n}n.isFinite(t)&&t>=1||(t=65536),super({transform(n,o){for(e.push(n),s+=n.length;s>t;)o.enqueue(r())},flush(t){s&&t.enqueue(((t,e)=>{const n=new o(e);let s=0;for(const e of t)n.set(e,s),s+=e.length;return n})(e,s))}})}}let Xt=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(Xt=navigator.hardwareConcurrency)}catch{}const Yt=new f,Zt=new f;let $t,te,ee,ne,se,re,oe=0;async function ce(t){let e,o;try{const{options:c,config:i}=t;if(c.format&&await(async(t,e)=>{!Pt.has(t)&&e&&((t,e)=>{const{CompressionStream:n,DecompressionStream:s}=e;if(typeof n!=k&&typeof s!=k)throw new r("Invalid codec module");Pt.set(t,{CompressionStream:n,DecompressionStream:s})})(t,await(import(e)))})(c.format,c.codecURI),i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,c.compressed&&!c.format)if(c.useCompressionStream){if(!((t,e)=>{if(!t)return!1;let n=Kt.get(t);n||(n=new f,Kt.set(t,n));let s=n.get(e);if(s===v){try{new t(e),s=!0}catch{s=!1}n.set(e,s)}return s})(c.codecType.startsWith(Gt)?i.CompressionStream:i.DecompressionStream,Rt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{c.useCompressionStream=!0}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const a={highWaterMark:1},l=t.readable||new y({async pull(t){const e=new w(t=>Yt.set(oe,t));ie({type:"pull",messageId:oe}),oe=(oe+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await e;t.enqueue(s),r&&t.close()}},a);o=t.writable||new m({async write(t){let e;const s=new w(t=>e=t);Zt.set(oe,e),ie({type:Nt,value:t,messageId:oe}),oe=(oe+1)%n.MAX_SAFE_INTEGER,await s}},a),e=new Jt(c,i),$t=new AbortController;const{signal:u}=$t;await l.pipeThrough(e).pipeThrough(new Qt((t=>s.max(t.chunkSize,64))(i))).pipeTo(o,{signal:u,preventClose:!0,preventAbort:!0}),await o.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=e;ie({type:qt,result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){if(t.outputSize=e?e.outputSize:0,o&&!o.locked)try{await o.getWriter().close()}catch{}ae(t)}}function ie(t){const{value:e}=t;if(e)if(e.length)try{t.value=(n=e,n.byteOffset||n.byteLength!=n.buffer.byteLength?new o(n):n).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var n}function ae(t=new r("Unknown error")){const{message:e,stack:n,code:s,name:o,outputSize:c,cause:i}=t,a={message:e,stack:n,code:s,name:o,outputSize:c};i&&(a.cause={name:i.name,message:i.message}),p({error:a})}function fe(t,e,n={}){if(!te){const t=new r("WASM module not loaded");throw t.cause=re,t}const c="number"==typeof n.level?n.level:-1,i="number"==typeof n.outBuffer?n.outBuffer:65536,a="number"==typeof n.inBufferSize?n.inBufferSize:65536;return new d({start(){try{let n;if(this.lt=ee(i),this.in=ee(a),this.inBufferSize=a,!this.lt||!this.in)throw new r("allocation failed");if(this.wt=new o(i),t?(this.ut=te.deflate_process,this.ht=te.deflate_last_consumed,this.yt=te.deflate_end,this.St=te.deflate_new(),n="gzip"===e?te.deflate_init_gzip(this.St,c):"deflate-raw"===e?te.deflate_init_raw(this.St,c):te.deflate_init(this.St,c)):"deflate64-raw"===e?(this.ut=te.inflate9_process,this.ht=te.inflate9_last_consumed,this.yt=te.inflate9_end,this.St=te.inflate9_new(),n=te.inflate9_init_raw(this.St)):(this.ut=te.inflate_process,this.ht=te.inflate_last_consumed,this.yt=te.inflate_end,this.St=te.inflate_new(),n="deflate-raw"===e?te.inflate_init_raw(this.St):"gzip"===e?te.inflate_init_gzip(this.St):te.inflate_init(this.St)),0!==n)throw new r("init failed:"+n)}catch(t){throw f(this),t}},transform(e,n){try{const c=e,a=new o(se.buffer),f=this.ut,l=this.ht,w=this.lt,u=this.wt;let h=0;for(;h<c.length;){const e=s.min(c.length-h,32768);if((!this.in||this.inBufferSize<e)&&(this.in&&ne&&(ne(this.in),this.in=0),this.in=ee(e),this.inBufferSize=e,!this.in))throw new r("allocation failed");a.set(c.subarray(h,h+e),this.in);const o=f(this.St,this.in,e,w,i,0),p=16777215&o;if(p&&(u.set(a.subarray(w,w+p),0),n.enqueue(u.slice(0,p))),!t){const t=o>>24&255,e=128&t?t-256:t;if(0>e)throw new r("process error:"+e)}const d=l(this.St);if(0===d)break;h+=d}}catch(t){f(this),n.error(t)}},flush(e){try{const n=new o(se.buffer),s=this.ut,c=this.lt,a=this.wt;for(;;){const o=s(this.St,0,0,c,i,4),f=16777215&o,l=o>>24&255;if(!t){const t=128&l?l-256:l;if(0>t)throw new r("process error:"+t)}if(f&&(a.set(n.subarray(c,c+f),0),e.enqueue(a.slice(0,f))),1===l||0===f)break}}catch(t){e.error(t)}finally{const t=f(this);0!==t&&e.error(new r("end error:"+t))}},cancel(){f(this)}});function f(t){let e=0;return t.St&&t.yt&&(e=t.yt(t.St)),t.St=0,t.in&&ne&&ne(t.in),t.in=0,t.lt&&ne&&ne(t.lt),t.lt=0,e}}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:s,done:r}=t;try{if("start"==e&&ce(t),e==Nt){const t=Yt.get(n);Yt.delete(n),t({value:s||new o,done:r})}if("ack"==e){const t=Zt.get(n);Zt.delete(n),t()}e==qt&&$t.abort()}catch(t){ae(t)}}),p({type:"ready"});class le{constructor(t="deflate",e){return fe(!0,t,e)}}class we{constructor(t="deflate",e){return fe(!1,t,e)}}le.gt=!0,we.gt=!0;let ue=!1;((t={})=>{const{init:e}=t,n=t.CompressionStreamFallback||t.CompressionStreamZlib,s=t.DecompressionStreamFallback||t.DecompressionStreamZlib;self.initModule=async t=>{e&&await e(t),n&&(t.CompressionStreamFallback=n),s&&(t.DecompressionStreamFallback=s)}})({CompressionStreamFallback:le,DecompressionStreamFallback:we,init:t=>(async(t,{baseURI:e})=>{if(!ue)try{await(async(t,e)=>{let n,s;try{try{s=new URL(t,e)}catch{}const r=await fetch(s);n=await r.arrayBuffer()}catch(e){if(!t.startsWith("data:application/wasm;base64,"))throw e;n=(t=>{const e=t.split(",")[1],n=atob(e),s=n.length,r=new o(s);for(let t=0;s>t;++t)r[t]=n.charCodeAt(t);return r.buffer})(t)}(t=>{if(te=t,({malloc:ee,free:ne,memory:se}=te),"function"!=typeof ee||"function"!=typeof ne||!se)throw te=ee=ne=se=null,new r("Invalid WASM module")})((await WebAssembly.instantiate(n)).instance.exports)})(t,e),ue=!0}catch(t){throw(t=>{re=t})(t),t}})(t.wasmURI,t)})});\n';if("string"==typeof s&&(s=(new TextEncoder).encode(s)),t){const t=new Blob([s],{type:n});return URL.createObjectURL(t)}return "data:"+n+";base64,"+(t=>{let n="";const s=t.length;let r=0;for(;s>r+2;r+=3){const s=t[r]<<16|t[r+1]<<8|t[r+2];n+=e[s>>18&63]+e[s>>12&63]+e[s>>6&63]+e[63&s];}const o=s-r;if(1===o){const s=t[r]<<16;n+=e[s>>18&63]+e[s>>12&63]+"==";}else if(2===o){const s=t[r]<<16|t[r+1]<<8;n+=e[s>>18&63]+e[s>>12&63]+e[s>>6&63]+"=";}return n})(s)}});
|
|
242
|
+
const t$1=new Uint8Array(288);t$1.fill(8,0,144),t$1.fill(9,144,256),t$1.fill(7,256,280),t$1.fill(8,280,288),new Uint8Array(30).fill(5);const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n$1=t=>t({workerURI:t=>{const n="text/javascript";let s='(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){"use strict";const{Array:t,Object:e,Number:n,Math:s,Error:r,Uint8Array:o,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:l,Promise:w,TextEncoder:u,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new o,C=[[],[],[],[],[],[],[],[]];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?e>>>1^3988292384:e>>>1;C[0][t]=e}for(let t=0;256>t;t++)for(let e=1;8>e;e++){const n=C[e-1][t];C[e][t]=n>>>8^C[0][255&n]}const[A,I,x,M,P,D,B,F]=C;class R{constructor(t){this.o=t||-1}append(t){let e=0|this.o;const n=0|t.length;let s=0;if(n>=8&&t.buffer){const r=new l(t.buffer,t.byteOffset,n),o=n-8;for(;o>=s;s+=8){const t=e^r.getInt32(s,!0),n=r.getInt32(s+4,!0);e=F[255&t]^B[t>>>8&255]^D[t>>>16&255]^P[t>>>24&255]^M[255&n]^x[n>>>8&255]^I[n>>>16&255]^A[n>>>24&255]}}for(;n>s;s++)e=e>>>8^A[255&(e^t[s])];this.o=e}get(){return~this.o}}class U extends d{constructor(){let t;const e=new R;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new l(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}function W(t,e){const n=new o(t.length+e.length);return n.set(t),n.set(e,t.length),n}function _(t){return new l(t.buffer,t.byteOffset,t.byteLength)}const T={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],s=T.l(n);return 32===s?t.concat(e):T.h(e,s,0|n,t.slice(0,t.length-1))},bitLength(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+T.l(n)},m(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,s.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=T.S(e,t[n-1]&2147483648>>e-1,1)),t},S:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,l:t=>s.round(t/1099511627776)||32,h(t,e,n,s){for(void 0===s&&(s=[]);e>=32;e-=32)s.push(n),n=0;if(0===e)return s.concat(t);for(let r=0;r<t.length;r++)s.push(n|t[r]>>>e),n=t[r]<<32-e;const r=t.length?t[t.length-1]:0,o=T.l(r);return s.push(T.S(e+o&31,e+o>32?n:s.pop(),1)),s}},V={bytes:{v(t){const e=T.bitLength(t)/8,n=new o(e);let s;for(let r=0;e>r;r++)3&r||(s=t[r/4]),n[r]=s>>>24,s<<=8;return n},C(t){const e=[];let n,s=0;for(n=0;n<t.length;n++)s=s<<8|t[n],3&~n||(e.push(s),s=0);return 3&n&&e.push(T.S(8*(3&n),s)),e}}},K=class{constructor(t){const e=this;e.blockSize=512,e.A=[1732584193,4023233417,2562383102,271733878,3285377520],e.I=[1518500249,1859775393,2400959708,3395469782],t?(e.M=t.M.slice(0),e.P=t.P.slice(0),e.D=t.D):e.reset()}reset(){const t=this;return t.M=t.A.slice(0),t.P=[],t.D=0,t}update(t){const e=this;"string"==typeof t&&(t=V.B.C(t));const n=e.P=T.concat(e.P,t),s=e.D,o=e.D=s+T.bitLength(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const c=new i(n);let a=0;for(let t=e.blockSize+s-(e.blockSize+s&e.blockSize-1);o>=t;t+=e.blockSize)e.F(c.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}R(){const t=this;let e=t.P;const n=t.M;e=T.concat(e,[T.S(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(s.floor(t.D/4294967296)),e.push(0|t.D);e.length;)t.F(e.splice(0,16));return t.reset(),n}U(t,e,n,s){return t>19?t>39?t>59?t>79?void 0:e^n^s:e&n|e&s|n&s:e^n^s:e&n|~e&s}W(t,e){return e<<t|e>>>32-t}F(e){const n=this,r=n.M,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let c=r[0],i=r[1],a=r[2],f=r[3],l=r[4];for(let t=0;79>=t;t++){16>t||(o[t]=n.W(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=n.W(5,c)+n.U(t,i,a,f)+l+o[t]+n.I[s.floor(t/20)]|0;l=f,f=a,a=n.W(30,i),i=c,c=e}r[0]=r[0]+c|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+f|0,r[4]=r[4]+l|0}},E={importKey:t=>new E._(V.bytes.C(t)),T(t,e,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let c,i,a,f,w;const u=new ArrayBuffer(o),h=new l(u);let p=0;const d=T;for(e=V.bytes.C(e),w=1;(o||1)>p;w++){for(c=i=t.encrypt(d.concat(e,[w])),a=1;n>a;a++)for(i=t.encrypt(i),f=0;f<i.length;f++)c[f]^=i[f];for(a=0;(o||1)>p&&a<c.length;a++)h.setInt32(p,c[a]),p+=4}return u.slice(0,s/8)},_:class{constructor(t){const e=this,n=e.V=K,s=[[],[]];e.K=[new n,new n];const r=e.K[0].blockSize/32;t.length>r&&(t=(new n).update(t).R());for(let e=0;r>e;e++)s[0][e]=909522486^t[e],s[1][e]=1549556828^t[e];e.K[0].update(s[0]),e.K[1].update(s[1]),e.L=new n(e.K[0])}reset(){const t=this;t.L=new t.V(t.K[0]),t.O=!1}update(t){this.O=!0,this.L.update(t)}digest(){const t=this,e=t.L.R(),n=new t.V(t.K[1]).update(e).R();return t.reset(),n}encrypt(t){if(this.O)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},L=typeof h!=b&&typeof h.getRandomValues==k,O="Invalid password",j="Invalid signature",H=j,N="zipjs-abort-check-password";function q(t){if(L)return h.getRandomValues(t);throw new r("Crypto API not supported")}const G=16,J={name:"PBKDF2"},Q=e.assign({hash:{name:"HMAC"}},J),X=e.assign({iterations:1e3,hash:{name:"SHA-1"}},J),Y=["deriveBits"],Z=[8,12,16],$=[16,24,32],tt=10,et=[0,0,0,0],nt=typeof h!=b,st=nt&&h.subtle,rt=nt&&typeof st!=b,ot=V.bytes,ct=class{constructor(t){const e=this;e.j=[[[],[],[],[],[]],[[],[],[],[],[]]],e.j[0][0][0]||e.H();const n=e.j[0][4],s=e.j[1],o=t.length;let c,i,a,f=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(e.I=[i=t.slice(0),a=[]],c=o;4*o+28>c;c++){let t=i[c-1];(c%o===0||8===o&&c%o===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],c%o===0&&(t=t<<8^t>>>24^f<<24,f=f<<1^283*(f>>7))),i[c]=i[c-o]^t}for(let t=0;c;t++,c--){const e=i[3&t?c:c-4];a[t]=4>=c||4>t?e:s[0][n[e>>>24]]^s[1][n[e>>16&255]]^s[2][n[e>>8&255]]^s[3][n[255&e]]}}encrypt(t){return this.N(t,0)}decrypt(t){return this.N(t,1)}H(){const t=this.j[0],e=this.j[1],n=t[4],s=e[4],r=[],o=[];let c,i,a,f;for(let t=0;256>t;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let l=c=0;!n[l];l^=i||1,c=o[c]||1){let o=c^c<<1^c<<2^c<<3^c<<4;o=o>>8^255&o^99,n[l]=o,s[o]=l,f=r[a=r[i=r[l]]];let w=16843009*f^65537*a^257*i^16843008*l,u=257*r[o]^16843008*o;for(let n=0;4>n;n++)t[n][l]=u=u<<24^u>>>8,e[n][o]=w=w<<24^w>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}N(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.I[e],s=n.length/4-2,o=[0,0,0,0],c=this.j[e],i=c[0],a=c[1],f=c[2],l=c[3],w=c[4];let u,h,p,d=t[0]^n[0],y=t[e?3:1]^n[1],m=t[2]^n[2],S=t[e?1:3]^n[3],g=4;for(let t=0;s>t;t++)u=i[d>>>24]^a[y>>16&255]^f[m>>8&255]^l[255&S]^n[g],h=i[y>>>24]^a[m>>16&255]^f[S>>8&255]^l[255&d]^n[g+1],p=i[m>>>24]^a[S>>16&255]^f[d>>8&255]^l[255&y]^n[g+2],S=i[S>>>24]^a[d>>16&255]^f[y>>8&255]^l[255&m]^n[g+3],g+=4,d=u,y=h,m=p;for(let t=0;4>t;t++)o[e?3&-t:t]=w[d>>>24]<<24^w[y>>16&255]<<16^w[m>>8&255]<<8^w[255&S]^n[g++],u=d,d=y,y=m,m=S,S=u;return o}},it=class{constructor(t,e){this.G=t,this.J=e,this.X=e}reset(){this.X=this.J}update(t){return this.Y(this.G,t,this.X)}Z(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}return t}$(t){0===(t[0]=this.Z(t[0]))&&(t[1]=this.Z(t[1]))}Y(t,e,n){let s;if(!(s=e.length))return[];const r=T.bitLength(e);for(let r=0;s>r;r+=4){this.$(n);const s=t.encrypt(n);e[r]^=s[0],e[r+1]^=s[1],e[r+2]^=s[2],e[r+3]^=s[3]}return T.m(e,r)}},at=E._;let ft=nt&&rt&&typeof st.importKey==k,lt=nt&&rt&&typeof st.deriveBits==k;class wt extends d{constructor({password:t,rawPassword:e,encryptionStrength:n,checkPasswordOnly:s,checkAuthenticationCode:c=!0}){super({start(){ht(this,t,e,n)},async transform(t,e){const n=this,{password:c,strength:i,et:a,ready:f}=n;c?(await(async(t,e,n,s)=>{const o=await dt(t,e,n,mt(s,0,Z[e])),c=mt(s,Z[e]);if(o[0]!=c[0]||o[1]!=c[1])throw new r(O)})(n,i,c,mt(t,0,Z[i]+2)),t=mt(t,Z[i]+2),s?e.error(new r(N)):a()):await f;const l=new o(t.length-tt-(t.length-tt)%G);e.enqueue(pt(n,t,l,0,tt,!0))},async flush(t){const{nt:e,st:n,pending:s,ready:o}=this;if(n&&e){await o;const i=mt(s,0,s.length-tt),a=mt(s,s.length-tt);let f=z;if(i.length){const t=gt(ot,i);n.update(t);const s=e.update(t);f=St(ot,s)}const l=mt(St(ot,n.digest()),0,tt);let w=s.length<tt?1:0;for(let t=0;tt>t;t++)w|=l[t]^a[t];if(w&&c)throw new r(H);t.enqueue(f)}}})}}class ut extends d{constructor({password:t,rawPassword:e,encryptionStrength:n}){super({start(){ht(this,t,e,n)},async transform(t,e){const n=this,{password:s,strength:r,et:c,ready:i}=n;let a=z;s?(a=await(async(t,e,n)=>{const s=q(new o(Z[e]));return W(s,await dt(t,e,n,s))})(n,r,s),c()):await i;const f=new o(a.length+t.length-t.length%G);f.set(a,0),e.enqueue(pt(n,t,f,a.length,0))},async flush(t){const{nt:e,st:n,pending:s,ready:r}=this;if(n&&e){await r;let o=z;if(s.length){const t=e.update(gt(ot,s));n.update(t),o=St(ot,t)}const c=St(ot,n.digest()).slice(0,tt);t.enqueue(W(o,c))}}})}}function ht(t,n,s,r){e.assign(t,{ready:new w(e=>t.et=e),password:yt(n,s),strength:r-1,pending:z})}function pt(t,e,n,s,r,c){const{nt:i,st:a,pending:f}=t;f.length&&(e=W(f,e));const l=e.length-r;let w;for(n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,s+(l-l%G)),w=0;l-G>=w;w+=G){const t=gt(ot,mt(e,w,w+G));c&&a.update(t);const r=i.update(t);c||a.update(r),n.set(St(ot,r),w+s)}return t.pending=mt(e,w),n}async function dt(n,s,r,c){n.password=null;const i=await(async(t,e,n,s,r)=>{if(!ft)return E.importKey(e);try{return await st.importKey("raw",e,n,!1,r)}catch{return ft=!1,E.importKey(e)}})(0,r,Q,0,Y),a=await(async(t,e,n)=>{if(!lt)return E.T(e,t.salt,X.iterations,n);try{return await st.deriveBits(t,e,n)}catch{return lt=!1,E.T(e,t.salt,X.iterations,n)}})(e.assign({salt:c},X),i,8*(2*$[s]+2)),f=new o(a),l=gt(ot,mt(f,0,$[s])),w=gt(ot,mt(f,$[s],2*$[s])),u=mt(f,2*$[s]);return e.assign(n,{keys:{key:l,ot:w,passwordVerification:u},nt:new it(new ct(l),t.from(et)),st:new at(w)}),u}function yt(t,e){return e===v?(t=>{if(typeof u==b){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new u).encode(t)})(t):e}function mt(t,e,n){return t.subarray(e,n)}function St(t,e){return t.v(e)}function gt(t,e){return t.C(e)}class vt extends d{constructor({password:t,rawPassword:e,passwordVerification:n,checkPasswordOnly:s}){super({start(){kt(this,t,e,n)},transform(t,e){const n=this;if(n.password||n.rawPassword){const e=zt(n,t.subarray(0,12));if(n.password=n.rawPassword=null,0!=(e[11]^n.passwordVerification))throw new r(O);t=t.subarray(12)}s?e.error(new r(N)):e.enqueue(zt(n,t))}})}}class bt extends d{constructor({password:t,rawPassword:e,passwordVerification:n}){super({start(){kt(this,t,e,n)},transform(t,e){const n=this;let s,r;if(n.password||n.rawPassword){n.password=n.rawPassword=null;const e=q(new o(12));e[11]=n.passwordVerification,s=new o(t.length+e.length),s.set(Ct(n,e),0),r=12}else s=new o(t.length),r=0;s.set(Ct(n,t),r),e.enqueue(s)}})}}function kt(t,n,s,r){e.assign(t,{password:n,rawPassword:s,passwordVerification:r}),((t,n,s)=>{const r=[305419896,591751049,878082192];if(e.assign(t,{keys:r,ct:new R(r[0]),it:new R(r[2])}),s)for(let e=0;e<s.length;e++)At(t,s[e]);else for(let e=0;e<n.length;e++)At(t,n.charCodeAt(e))})(t,n,s)}function zt(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=It(t)^e[s],At(t,n[s]);return n}function Ct(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=It(t)^e[s],At(t,e[s]);return n}function At(t,e){let[,n]=t.keys;t.ct.append([e]);const r=~t.ct.get();n=Mt(s.imul(Mt(n+xt(r)),134775813)+1),t.it.append([n>>>24]);const o=~t.it.get();t.keys=[r,n,o]}function It(t){const e=2|t.keys[2];return xt(s.imul(e,1^e)>>>8)}function xt(t){return 255&t}function Mt(t){return 4294967295&t}const Pt=new f;function Dt(t){return Pt.get(t)}const Bt="Invalid uncompressed size",Ft=j,Rt="deflate-raw",Ut="gzip",Wt=[31,139,8];class _t extends d{constructor(t,{chunkSize:e,CompressionStreamFallback:n,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:w,format:u,compressionMethod:h}=t,p=this;let d,y,m,S=super.readable;const g=u&&Dt(u),v=a&&r&&!w&&!g&&(!o||i)&&!(!c||!s);if(o&&!i||!a||v||(d=new U,S=jt(S,d)),r)if(g)S=Ht(S,Lt(g.CompressionStream,u,{level:f,chunkSize:e,compressionMethod:h}));else if(v)m=new Tt,S=Ht(S,new s(Ut)),S=jt(S,m);else try{S=Ot(S,c,{level:f,chunkSize:e},s,n)}catch(t){let e;try{e=new s(Ut)}catch{throw t}S=Ht(S,e),S=jt(S,new Tt)}o&&(i?S=jt(S,new bt(t)):(y=new ut(t),S=jt(S,y))),Et(p,S,()=>{o&&!i||!a||(p.crc32=v?m.crc32:new l(d.value.buffer).getUint32(0))})}}class Tt extends d{constructor(){let t,e=10,n=new o(0);super({transform(t,r){if(e){const n=s.min(e,t.length);if(e-=n,!(t=t.subarray(n)).length)return}const o=n.length+t.length;if(8>=o)return void(n=W(n,t));const c=o-8,i=s.min(c,n.length);r.enqueue(W(n.subarray(0,i),t.subarray(0,c-i))),n=W(n.subarray(i),t.subarray(c-i))},flush(){const e=_(n);t.crc32=e.getUint32(0,!0),t.uncompressedSize=e.getUint32(4,!0)}}),t=this}}class Vt extends d{constructor(t,{chunkSize:e,DecompressionStreamFallback:n,DecompressionStream:s}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:u,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:b}=t;let k,z,C=super.readable;if(i&&(c?C=jt(C,new vt(t)):(z=new wt(t),C=jt(C,z))),u){const t=m&&Dt(m);if(t)C=Ht(C,Lt(t.DecompressionStream,m,{chunkSize:e,compressionMethod:S,rawBitFlag:g,uncompressedSize:b}));else try{C=Ot(C,h,{chunkSize:e,deflate64:p},s,n)}catch(t){if(p||b===v)throw t;let e;try{e=new s(Ut)}catch{throw t}C=((t,e,n)=>{const s=new R;let c,i,a,f=0,l=!1;const u=new w((t,e)=>{i=t,a=e});u.catch(()=>{}),n||i();const h=new d({start(t){const e=new o(10);e.set(Wt),t.enqueue(e)},transform(t,e){e.enqueue(t)},async flush(t){l=!0,y();try{await u}finally{m()}const e=new o(8),r=_(e);r.setUint32(0,s.get(),!0),r.setUint32(4,n,!0),t.enqueue(e)},cancel(t){a(t)}}),p=new d({transform(t,e){s.append(t),f+=t.length,n>f?l&&y():i(),e.enqueue(t)},cancel(t){a(t)}});return t=jt(t,h),jt(t=Ht(t,e),p);function y(){m(),c=setTimeout(()=>a(new r(Bt)),5e3)}function m(){clearTimeout(c)}})(C,e,b)}C=(t=>{const e=t.getReader();return new y({async pull(t){let n;try{n=await e.read()}catch(t){if(t&&t.message)throw t;const e=new r("Invalid compressed data");throw e.cause=t,e}const{value:s,done:o}=n;o?t.close():t.enqueue(s)},cancel:t=>e.cancel(t)})})(C)}a&&(k=new U,C=jt(C,k)),Et(this,C,()=>{if(a){const t=new l(k.value.buffer);if(f!=t.getUint32(0,!1))throw new r(Ft)}})}}const Kt=new f;function Et(t,n,s){n=jt(n,new d({flush:s})),e.defineProperty(t,"readable",{get:()=>n})}function Lt(t,e,n){if(!t)throw new r("Compression method not supported");return new t(e,n)}function Ot(t,e,n,s,r){const o=e&&s?s:r||s,c=n.deflate64?"deflate64-raw":Rt;let i;try{i=new o(c,n)}catch(t){if(!e||!r||o==r)throw t;i=new r(c,n)}return Ht(t,i)}function jt(t,e){return(t=>{if(t instanceof y)return t;const e=t.getReader();return new y({async pull(t){const{value:n,done:s}=await e.read();s?t.close():t.enqueue(n)},cancel:t=>e.cancel(t)})})(t).pipeThrough(e)}function Ht(t,e){const n=e.writable.getWriter(),s=t.getReader();return(async()=>{try{for(;;){await n.ready;const t=await s.read();if(t.done){await n.close();break}await n.write(t.value)}}catch(t){await(async(t,e)=>{try{await t.abort(e)}catch{}})(n,t),await(async(t,e)=>{try{await t.cancel(e)}catch{}})(s,t)}})(),e.readable}const Nt="data",qt="close",Gt="deflate";class Jt extends d{constructor(t,n){super({});const s=this,{codecType:o}=t;let c;o.startsWith(Gt)?c=_t:o.startsWith("inflate")&&(c=Vt),s.outputSize=0;let i=0;const a=new c(t,n),f=super.readable,l=new d({transform(t,e){t&&t.length&&(i+=t.length,e.enqueue(t))},flush(){e.assign(s,{inputSize:i})}}),w=new d({transform(e,n){if(e&&e.length&&(n.enqueue(e),s.outputSize+=e.length,t.outputSize!==v&&s.outputSize>t.outputSize))throw new r(Bt)},flush(){const{crc32:t}=a;e.assign(s,{crc32:t,inputSize:i})}});e.defineProperty(s,"readable",{get:()=>f.pipeThrough(l).pipeThrough(a).pipeThrough(w)})}}class Qt extends d{constructor(t){const e=[];let s=0;function r(){const n=new o(t);let r=0;for(;t>r;){const s=e[0],o=t-r;s.length>o?(n.set(s.subarray(0,o),r),e[0]=s.subarray(o),r+=o):(n.set(s,r),r+=s.length,e.shift())}return s-=t,n}n.isFinite(t)&&t>=1||(t=65536),super({transform(n,o){for(e.push(n),s+=n.length;s>t;)o.enqueue(r())},flush(t){s&&t.enqueue(((t,e)=>{const n=new o(e);let s=0;for(const e of t)n.set(e,s),s+=e.length;return n})(e,s))}})}}let Xt=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(Xt=navigator.hardwareConcurrency)}catch{}const Yt=new f,Zt=new f;let $t,te,ee,ne,se,re,oe=0;async function ce(t){let e,o;try{const{options:c,config:i}=t;if(c.format&&await(async(t,e)=>{!Pt.has(t)&&e&&((t,e)=>{const{CompressionStream:n,DecompressionStream:s}=e;if(typeof n!=k&&typeof s!=k)throw new r("Invalid codec module");Pt.set(t,{CompressionStream:n,DecompressionStream:s})})(t,await(import(e)))})(c.format,c.codecURI),i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,c.compressed&&!c.format)if(c.useCompressionStream){if(!((t,e)=>{if(!t)return!1;let n=Kt.get(t);n||(n=new f,Kt.set(t,n));let s=n.get(e);if(s===v){try{new t(e),s=!0}catch{s=!1}n.set(e,s)}return s})(c.codecType.startsWith(Gt)?i.CompressionStream:i.DecompressionStream,Rt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{c.useCompressionStream=!0}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const a={highWaterMark:1},l=t.readable||new y({async pull(t){const e=new w(t=>Yt.set(oe,t));ie({type:"pull",messageId:oe}),oe=(oe+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await e;t.enqueue(s),r&&t.close()}},a);o=t.writable||new m({async write(t){let e;const s=new w(t=>e=t);Zt.set(oe,e),ie({type:Nt,value:t,messageId:oe}),oe=(oe+1)%n.MAX_SAFE_INTEGER,await s}},a),e=new Jt(c,i),$t=new AbortController;const{signal:u}=$t;await l.pipeThrough(e).pipeThrough(new Qt((t=>s.max(t.chunkSize,64))(i))).pipeTo(o,{signal:u,preventClose:!0,preventAbort:!0}),await o.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=e;ie({type:qt,result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){if(t.outputSize=e?e.outputSize:0,o&&!o.locked)try{await o.getWriter().close()}catch{}ae(t)}}function ie(t){const{value:e}=t;if(e)if(e.length)try{t.value=(n=e,n.byteOffset||n.byteLength!=n.buffer.byteLength?new o(n):n).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var n}function ae(t=new r("Unknown error")){const{message:e,stack:n,code:s,name:o,outputSize:c,cause:i}=t,a={message:e,stack:n,code:s,name:o,outputSize:c};i&&(a.cause={name:i.name,message:i.message}),p({error:a})}function fe(t,e,n={}){if(!te){const t=new r("WASM module not loaded");throw t.cause=re,t}const c="number"==typeof n.level?n.level:-1,i="number"==typeof n.outBuffer?n.outBuffer:65536,a="number"==typeof n.inBufferSize?n.inBufferSize:65536;return new d({start(){try{let n;if(this.ft=ee(i),this.in=ee(a),this.inBufferSize=a,!this.ft||!this.in)throw new r("allocation failed");if(this.lt=new o(i),t?(this.wt=te.deflate_process,this.ut=te.deflate_last_consumed,this.ht=te.deflate_end,this.yt=te.deflate_new(),n="gzip"===e?te.deflate_init_gzip(this.yt,c):"deflate-raw"===e?te.deflate_init_raw(this.yt,c):te.deflate_init(this.yt,c)):"deflate64-raw"===e?(this.wt=te.inflate9_process,this.ut=te.inflate9_last_consumed,this.ht=te.inflate9_end,this.yt=te.inflate9_new(),n=te.inflate9_init_raw(this.yt)):(this.wt=te.inflate_process,this.ut=te.inflate_last_consumed,this.ht=te.inflate_end,this.yt=te.inflate_new(),n="deflate-raw"===e?te.inflate_init_raw(this.yt):"gzip"===e?te.inflate_init_gzip(this.yt):te.inflate_init(this.yt)),0!==n)throw new r("init failed:"+n)}catch(t){throw f(this),t}},transform(e,n){try{const c=e,a=new o(se.buffer),f=this.wt,l=this.ut,w=this.ft,u=this.lt;let h=0;for(;h<c.length;){const e=s.min(c.length-h,32768);if((!this.in||this.inBufferSize<e)&&(this.in&&ne&&(ne(this.in),this.in=0),this.in=ee(e),this.inBufferSize=e,!this.in))throw new r("allocation failed");a.set(c.subarray(h,h+e),this.in);const o=f(this.yt,this.in,e,w,i,0),p=16777215&o;if(p&&(u.set(a.subarray(w,w+p),0),n.enqueue(u.slice(0,p))),!t){const t=o>>24&255,e=128&t?t-256:t;if(0>e)throw new r("process error:"+e)}const d=l(this.yt);if(0===d)break;h+=d}}catch(t){f(this),n.error(t)}},flush(e){try{const n=new o(se.buffer),s=this.wt,c=this.ft,a=this.lt;for(;;){const o=s(this.yt,0,0,c,i,4),f=16777215&o,l=o>>24&255;if(!t){const t=128&l?l-256:l;if(0>t)throw new r("process error:"+t)}if(f&&(a.set(n.subarray(c,c+f),0),e.enqueue(a.slice(0,f))),1===l||0===f)break}}catch(t){e.error(t)}finally{const t=f(this);0!==t&&e.error(new r("end error:"+t))}},cancel(){f(this)}});function f(t){let e=0;return t.yt&&t.ht&&(e=t.ht(t.yt)),t.yt=0,t.in&&ne&&ne(t.in),t.in=0,t.ft&&ne&&ne(t.ft),t.ft=0,e}}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:s,done:r}=t;try{if("start"==e&&ce(t),e==Nt){const t=Yt.get(n);Yt.delete(n),t({value:s||new o,done:r})}if("ack"==e){const t=Zt.get(n);Zt.delete(n),t()}e==qt&&$t.abort()}catch(t){ae(t)}}),p({type:"ready"});class le{constructor(t="deflate",e){return fe(!0,t,e)}}class we{constructor(t="deflate",e){return fe(!1,t,e)}}le.St=!0,we.St=!0;let ue=!1;((t={})=>{const{init:e}=t,n=t.CompressionStreamFallback||t.CompressionStreamZlib,s=t.DecompressionStreamFallback||t.DecompressionStreamZlib;self.initModule=async t=>{e&&await e(t),n&&(t.CompressionStreamFallback=n),s&&(t.DecompressionStreamFallback=s)}})({CompressionStreamFallback:le,DecompressionStreamFallback:we,init:t=>(async(t,{baseURI:e})=>{if(!ue)try{await(async(t,e)=>{let n,s;try{try{s=new URL(t,e)}catch{}const r=await fetch(s);n=await r.arrayBuffer()}catch(e){if(!t.startsWith("data:application/wasm;base64,"))throw e;n=(t=>{const e=t.split(",")[1],n=atob(e),s=n.length,r=new o(s);for(let t=0;s>t;++t)r[t]=n.charCodeAt(t);return r.buffer})(t)}(t=>{if(te=t,({malloc:ee,free:ne,memory:se}=te),"function"!=typeof ee||"function"!=typeof ne||!se)throw te=ee=ne=se=null,new r("Invalid WASM module")})((await WebAssembly.instantiate(n)).instance.exports)})(t,e),ue=!0}catch(t){throw(t=>{re=t})(t),t}})(t.wasmURI,t)})});\n';if("string"==typeof s&&(s=(new TextEncoder).encode(s)),t){const t=new Blob([s],{type:n});return URL.createObjectURL(t)}return "data:"+n+";base64,"+(t=>{let n="";const s=t.length;let r=0;for(;s>r+2;r+=3){const s=t[r]<<16|t[r+1]<<8|t[r+2];n+=e[s>>18&63]+e[s>>12&63]+e[s>>6&63]+e[63&s];}const o=s-r;if(1===o){const s=t[r]<<16;n+=e[s>>18&63]+e[s>>12&63]+"==";}else if(2===o){const s=t[r]<<16|t[r+1]<<8;n+=e[s>>18&63]+e[s>>12&63]+e[s>>6&63]+"=";}return n})(s)}});
|
|
242
243
|
|
|
243
244
|
/*
|
|
244
245
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -4454,6 +4455,8 @@ const OPTION_UNIX_EXTRA_FIELD_TYPE = "unixExtraFieldType";
|
|
|
4454
4455
|
const OPTION_LOCAL_EXTRA_FIELD = "localExtraField";
|
|
4455
4456
|
const OPTION_STRICTNESS = "strictness";
|
|
4456
4457
|
const OPTION_MAX_APPENDED_DATA_SIZE = "maxAppendedDataSize";
|
|
4458
|
+
const OPTION_DECRYPT_CENTRAL_DIRECTORY = "decryptCentralDirectory";
|
|
4459
|
+
const OPTION_SIGN_CENTRAL_DIRECTORY = "signCentralDirectory";
|
|
4457
4460
|
const STRICTNESS_STRICT = "strict";
|
|
4458
4461
|
const STRICTNESS_BALANCED = "balanced";
|
|
4459
4462
|
const STRICTNESS_TOLERANT = "tolerant";
|
|
@@ -4579,6 +4582,7 @@ class ZipReader {
|
|
|
4579
4582
|
let startOffset;
|
|
4580
4583
|
let zip64EndOfDirectory;
|
|
4581
4584
|
let zip64EndOfDirectoryVersion2;
|
|
4585
|
+
let directoryEncryptionInfo;
|
|
4582
4586
|
const requiresZip64 = directoryDataOffset == MAX_32_BITS || directoryDataLength == MAX_32_BITS || filesLength == MAX_16_BITS || diskNumber == MAX_16_BITS;
|
|
4583
4587
|
if (directoryDataOffset != MAX_32_BITS && diskNumber != MAX_16_BITS) {
|
|
4584
4588
|
directoryDataOffset += getDiskOffset$1(reader, diskNumber);
|
|
@@ -4609,6 +4613,15 @@ class ZipReader {
|
|
|
4609
4613
|
}
|
|
4610
4614
|
zip64EndOfDirectory = true;
|
|
4611
4615
|
zip64EndOfDirectoryVersion2 = getBigUint64(endOfDirectoryView, 4) > ZIP64_END_OF_CENTRAL_DIR_LENGTH - 12;
|
|
4616
|
+
if (zip64EndOfDirectoryVersion2) {
|
|
4617
|
+
const extensibleDataLength = Math.min(
|
|
4618
|
+
Number(getBigUint64(endOfDirectoryView, 4)) - (ZIP64_END_OF_CENTRAL_DIR_LENGTH - 12),
|
|
4619
|
+
reader.size - directoryDataOffset - ZIP64_END_OF_CENTRAL_DIR_LENGTH);
|
|
4620
|
+
if (extensibleDataLength > 0) {
|
|
4621
|
+
const rawExtensibleData = await readUint8Array(reader, directoryDataOffset + ZIP64_END_OF_CENTRAL_DIR_LENGTH, extensibleDataLength);
|
|
4622
|
+
directoryEncryptionInfo = getDirectoryEncryptionInfo(rawExtensibleData);
|
|
4623
|
+
}
|
|
4624
|
+
}
|
|
4612
4625
|
if (lastDiskNumber == MAX_16_BITS) {
|
|
4613
4626
|
lastDiskNumber = getUint32(endOfDirectoryView, 16);
|
|
4614
4627
|
} else if (checkAmbiguity && lastDiskNumber != getUint32(endOfDirectoryView, 16)) {
|
|
@@ -4632,7 +4645,7 @@ class ZipReader {
|
|
|
4632
4645
|
directoryDataOffset = getDiskOffset$1(reader, diskNumber) + getBigUint64(endOfDirectoryView, 48) + prependedDataLength;
|
|
4633
4646
|
}
|
|
4634
4647
|
}
|
|
4635
|
-
|
|
4648
|
+
let declaredDirectoryDataLength = directoryDataLength;
|
|
4636
4649
|
const centralDirectoryEndOffset = endOfDirectoryInfo.offset -
|
|
4637
4650
|
(zip64EndOfDirectory ? ZIP64_END_OF_CENTRAL_DIR_LENGTH + ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH : 0);
|
|
4638
4651
|
if (directoryDataOffset >= reader.size) {
|
|
@@ -4680,6 +4693,18 @@ class ZipReader {
|
|
|
4680
4693
|
if (directoryDataOffset < 0 || directoryDataOffset >= reader.size) {
|
|
4681
4694
|
throw new Error(ERR_BAD_FORMAT);
|
|
4682
4695
|
}
|
|
4696
|
+
zipReader.directoryOffset = directoryDataOffset;
|
|
4697
|
+
zipReader.directoryLength = declaredDirectoryDataLength;
|
|
4698
|
+
const decryptCentralDirectory = getOptionValue$1(zipReader, options, OPTION_DECRYPT_CENTRAL_DIRECTORY);
|
|
4699
|
+
let decryptedDirectory;
|
|
4700
|
+
if (decryptCentralDirectory && filesLength && directoryArray.length >= 4 &&
|
|
4701
|
+
getUint32(directoryView, 0) != CENTRAL_FILE_HEADER_SIGNATURE &&
|
|
4702
|
+
(zip64EndOfDirectoryVersion2 || detectEncryptedCentralDirectory(directoryView))) {
|
|
4703
|
+
directoryArray = await decryptCentralDirectory(directoryArray, directoryEncryptionInfo);
|
|
4704
|
+
directoryView = getDataView(directoryArray);
|
|
4705
|
+
declaredDirectoryDataLength = directoryArray.length;
|
|
4706
|
+
decryptedDirectory = true;
|
|
4707
|
+
}
|
|
4683
4708
|
startOffset = directoryDataOffset;
|
|
4684
4709
|
const filenameEncoding = getOptionValue$1(zipReader, options, OPTION_FILENAME_ENCODING);
|
|
4685
4710
|
const commentEncoding = getOptionValue$1(zipReader, options, OPTION_COMMENT_ENCODING);
|
|
@@ -4688,7 +4713,7 @@ class ZipReader {
|
|
|
4688
4713
|
for (let indexFile = 0; indexFile < filesLength; indexFile++) {
|
|
4689
4714
|
const fileEntry = new ZipEntry$1(reader, config, zipReader.options);
|
|
4690
4715
|
if (offset + CENTRAL_FILE_HEADER_LENGTH > directoryArray.length || getUint32(directoryView, offset) != CENTRAL_FILE_HEADER_SIGNATURE) {
|
|
4691
|
-
if (indexFile == 0 && (zip64EndOfDirectoryVersion2 || detectEncryptedCentralDirectory(directoryView))) {
|
|
4716
|
+
if (indexFile == 0 && !decryptedDirectory && (zip64EndOfDirectoryVersion2 || detectEncryptedCentralDirectory(directoryView))) {
|
|
4692
4717
|
throw new Error(ERR_ENCRYPTED_CENTRAL_DIRECTORY);
|
|
4693
4718
|
}
|
|
4694
4719
|
throw new Error(ERR_CENTRAL_DIRECTORY_NOT_FOUND);
|
|
@@ -4801,7 +4826,15 @@ class ZipReader {
|
|
|
4801
4826
|
}
|
|
4802
4827
|
yield entry;
|
|
4803
4828
|
}
|
|
4804
|
-
|
|
4829
|
+
let offsetAfterSignature = offset;
|
|
4830
|
+
if (offset + 6 <= directoryArray.length && getUint32(directoryView, offset) == DIGITAL_SIGNATURE_RECORD_SIGNATURE) {
|
|
4831
|
+
const signatureDataLength = getUint16(directoryView, offset + 4);
|
|
4832
|
+
if (offset + 6 + signatureDataLength <= directoryArray.length) {
|
|
4833
|
+
zipReader.digitalSignature = directoryArray.subarray(offset + 6, offset + 6 + signatureDataLength);
|
|
4834
|
+
offsetAfterSignature = offset + 6 + signatureDataLength;
|
|
4835
|
+
}
|
|
4836
|
+
}
|
|
4837
|
+
if (checkAmbiguity && offset != declaredDirectoryDataLength && offsetAfterSignature != declaredDirectoryDataLength) {
|
|
4805
4838
|
throwAmbiguousArchive("trailing central directory data");
|
|
4806
4839
|
}
|
|
4807
4840
|
if (duplicateFilename) {
|
|
@@ -5073,6 +5106,25 @@ function detectEncryptedCentralDirectory(directoryView) {
|
|
|
5073
5106
|
return false;
|
|
5074
5107
|
}
|
|
5075
5108
|
|
|
5109
|
+
function getDirectoryEncryptionInfo(rawExtensibleData) {
|
|
5110
|
+
const directoryEncryptionInfo = { rawExtensibleData };
|
|
5111
|
+
if (rawExtensibleData.length >= 28) {
|
|
5112
|
+
const extensibleDataView = getDataView(rawExtensibleData);
|
|
5113
|
+
const hashDataLength = getUint16(extensibleDataView, 26);
|
|
5114
|
+
Object.assign(directoryEncryptionInfo, {
|
|
5115
|
+
compressionMethod: getUint16(extensibleDataView, 0),
|
|
5116
|
+
compressedSize: Number(getBigUint64(extensibleDataView, 2)),
|
|
5117
|
+
uncompressedSize: Number(getBigUint64(extensibleDataView, 10)),
|
|
5118
|
+
encryptionAlgorithm: getUint16(extensibleDataView, 18),
|
|
5119
|
+
bitLength: getUint16(extensibleDataView, 20),
|
|
5120
|
+
flags: getUint16(extensibleDataView, 22),
|
|
5121
|
+
hashAlgorithm: getUint16(extensibleDataView, 24),
|
|
5122
|
+
hashData: rawExtensibleData.subarray(28, 28 + hashDataLength)
|
|
5123
|
+
});
|
|
5124
|
+
}
|
|
5125
|
+
return directoryEncryptionInfo;
|
|
5126
|
+
}
|
|
5127
|
+
|
|
5076
5128
|
function readCommonHeader(directory, dataView, offset) {
|
|
5077
5129
|
const rawBitFlag = directory.rawBitFlag = getUint16(dataView, offset + 2);
|
|
5078
5130
|
const encrypted = (rawBitFlag & BITFLAG_ENCRYPTED) == BITFLAG_ENCRYPTED;
|
|
@@ -5624,6 +5676,7 @@ var zipReader = /*#__PURE__*/Object.freeze({
|
|
|
5624
5676
|
ERR_SPLIT_ZIP_FILE: ERR_SPLIT_ZIP_FILE,
|
|
5625
5677
|
ERR_UNSUPPORTED_COMPRESSION: ERR_UNSUPPORTED_COMPRESSION$1,
|
|
5626
5678
|
ERR_UNSUPPORTED_ENCRYPTION: ERR_UNSUPPORTED_ENCRYPTION,
|
|
5679
|
+
ERR_WORKER_STARTUP_TIMEOUT: ERR_WORKER_STARTUP_TIMEOUT,
|
|
5627
5680
|
ZipReader: ZipReader,
|
|
5628
5681
|
ZipReaderStream: ZipReaderStream
|
|
5629
5682
|
});
|
|
@@ -5682,6 +5735,7 @@ const ERR_INVALID_UNIX_EXTRA_FIELD_TYPE = "Invalid unixExtraFieldType (must be '
|
|
|
5682
5735
|
const ERR_INVALID_UNIX_ID_SIZE = "uid/gid must be 0..65535 for unixExtraFieldType 'unix' (use 'infozip' for larger ids)";
|
|
5683
5736
|
const ERR_INVALID_MSDOS_ATTRIBUTES = "Invalid msdosAttributesRaw (must be integer 0..255)";
|
|
5684
5737
|
const ERR_INVALID_MSDOS_DATA = "Invalid msdosAttributes (must be an object with boolean flags)";
|
|
5738
|
+
const ERR_INVALID_SIGNATURE_DATA = "Signature data exceeds 64KB";
|
|
5685
5739
|
|
|
5686
5740
|
const EXTRAFIELD_DATA_AES = new Uint8Array([0x07, 0x00, 0x02, 0x00, 0x41, 0x45, 0x03, 0x00, 0x00]);
|
|
5687
5741
|
const EXTRAFIELD_OFFSET_AES_VENDOR_VERSION = 4;
|
|
@@ -7041,8 +7095,9 @@ function updateLocalHeader({
|
|
|
7041
7095
|
|
|
7042
7096
|
async function closeFile(zipWriter, comment, options) {
|
|
7043
7097
|
const directoryDataLength = createDirectoryRecords(zipWriter.files);
|
|
7044
|
-
const directoryStart = await writeDirectoryRecords(zipWriter, directoryDataLength, options);
|
|
7045
|
-
await
|
|
7098
|
+
const { directoryStart, directoryArray } = await writeDirectoryRecords(zipWriter, directoryDataLength, options);
|
|
7099
|
+
const signatureLength = await writeDigitalSignatureRecord(zipWriter, directoryArray, options);
|
|
7100
|
+
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryDataLength, signatureLength });
|
|
7046
7101
|
}
|
|
7047
7102
|
|
|
7048
7103
|
function createDirectoryRecords(files) {
|
|
@@ -7199,12 +7254,33 @@ async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
|
7199
7254
|
}
|
|
7200
7255
|
}
|
|
7201
7256
|
await writeData(writer, directoryDiskOffset ? directoryArray.slice(directoryDiskOffset) : directoryArray);
|
|
7202
|
-
return {
|
|
7257
|
+
return {
|
|
7258
|
+
directoryStart: { diskNumber: directoryStartDiskNumber, diskOffset: directoryStartDiskOffset },
|
|
7259
|
+
directoryArray
|
|
7260
|
+
};
|
|
7261
|
+
}
|
|
7262
|
+
|
|
7263
|
+
async function writeDigitalSignatureRecord(zipWriter, directoryArray, options) {
|
|
7264
|
+
const signCentralDirectory = getOptionValue(zipWriter, options, OPTION_SIGN_CENTRAL_DIRECTORY);
|
|
7265
|
+
if (signCentralDirectory) {
|
|
7266
|
+
const signatureData = await signCentralDirectory(directoryArray);
|
|
7267
|
+
const signatureDataLength = getLength(signatureData);
|
|
7268
|
+
if (signatureDataLength > MAX_16_BITS) {
|
|
7269
|
+
throw new Error(ERR_INVALID_SIGNATURE_DATA);
|
|
7270
|
+
}
|
|
7271
|
+
const signatureRecord = createRecordWriter(6 + signatureDataLength);
|
|
7272
|
+
signatureRecord.uint32(DIGITAL_SIGNATURE_RECORD_SIGNATURE);
|
|
7273
|
+
signatureRecord.uint16(signatureDataLength);
|
|
7274
|
+
signatureRecord.bytes(signatureData);
|
|
7275
|
+
await writeData(zipWriter.writer, signatureRecord.array);
|
|
7276
|
+
return 6 + signatureDataLength;
|
|
7277
|
+
}
|
|
7278
|
+
return 0;
|
|
7203
7279
|
}
|
|
7204
7280
|
|
|
7205
7281
|
async function writeEndOfDirectoryRecord(zipWriter, comment, options, cdInfo) {
|
|
7206
7282
|
const { writer } = zipWriter;
|
|
7207
|
-
const { directoryStart } = cdInfo;
|
|
7283
|
+
const { directoryStart, signatureLength } = cdInfo;
|
|
7208
7284
|
let { directoryDataLength } = cdInfo;
|
|
7209
7285
|
let filesLength = zipWriter.files.size;
|
|
7210
7286
|
let diskNumber = directoryStart.diskNumber;
|
|
@@ -7243,7 +7319,7 @@ async function writeEndOfDirectoryRecord(zipWriter, comment, options, cdInfo) {
|
|
|
7243
7319
|
endOfdirectoryRecord.uint64(directoryOffset);
|
|
7244
7320
|
endOfdirectoryRecord.uint32(ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE);
|
|
7245
7321
|
endOfdirectoryRecord.uint32(lastDiskNumber);
|
|
7246
|
-
endOfdirectoryRecord.uint64(BigInt(getSegmentOffset(zipWriter, writer)) + BigInt(directoryDataLength));
|
|
7322
|
+
endOfdirectoryRecord.uint64(BigInt(getSegmentOffset(zipWriter, writer)) + BigInt(directoryDataLength) + BigInt(signatureLength));
|
|
7247
7323
|
endOfdirectoryRecord.uint32(lastDiskNumber + 1);
|
|
7248
7324
|
const supportZip64SplitFile = getOptionValue(zipWriter, options, OPTION_SUPPORT_ZIP64_SPLIT_FILE, true);
|
|
7249
7325
|
if (supportZip64SplitFile) {
|
|
@@ -9490,6 +9566,7 @@ exports.ERR_CENTRAL_DIRECTORY_NOT_FOUND = ERR_CENTRAL_DIRECTORY_NOT_FOUND;
|
|
|
9490
9566
|
exports.ERR_DUPLICATED_NAME = ERR_DUPLICATED_NAME;
|
|
9491
9567
|
exports.ERR_ENCRYPTED = ERR_ENCRYPTED;
|
|
9492
9568
|
exports.ERR_ENCRYPTED_CENTRAL_DIRECTORY = ERR_ENCRYPTED_CENTRAL_DIRECTORY;
|
|
9569
|
+
exports.ERR_ENTRY_EXISTS = ERR_ENTRY_EXISTS;
|
|
9493
9570
|
exports.ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND = ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND;
|
|
9494
9571
|
exports.ERR_EOCDR_NOT_FOUND = ERR_EOCDR_NOT_FOUND;
|
|
9495
9572
|
exports.ERR_EXTRAFIELD_ZIP64_NOT_FOUND = ERR_EXTRAFIELD_ZIP64_NOT_FOUND;
|
|
@@ -9506,21 +9583,33 @@ exports.ERR_INVALID_ENTRY_COMMENT = ERR_INVALID_ENTRY_COMMENT;
|
|
|
9506
9583
|
exports.ERR_INVALID_ENTRY_NAME = ERR_INVALID_ENTRY_NAME;
|
|
9507
9584
|
exports.ERR_INVALID_EXTRAFIELD_DATA = ERR_INVALID_EXTRAFIELD_DATA;
|
|
9508
9585
|
exports.ERR_INVALID_EXTRAFIELD_TYPE = ERR_INVALID_EXTRAFIELD_TYPE;
|
|
9586
|
+
exports.ERR_INVALID_GID = ERR_INVALID_GID;
|
|
9587
|
+
exports.ERR_INVALID_MSDOS_ATTRIBUTES = ERR_INVALID_MSDOS_ATTRIBUTES;
|
|
9588
|
+
exports.ERR_INVALID_MSDOS_DATA = ERR_INVALID_MSDOS_DATA;
|
|
9509
9589
|
exports.ERR_INVALID_PASSWORD = ERR_INVALID_PASSWORD;
|
|
9510
9590
|
exports.ERR_INVALID_SIGNATURE = ERR_INVALID_SIGNATURE;
|
|
9591
|
+
exports.ERR_INVALID_SIGNATURE_DATA = ERR_INVALID_SIGNATURE_DATA;
|
|
9592
|
+
exports.ERR_INVALID_UID = ERR_INVALID_UID;
|
|
9511
9593
|
exports.ERR_INVALID_UNCOMPRESSED_SIZE = ERR_INVALID_UNCOMPRESSED_SIZE;
|
|
9594
|
+
exports.ERR_INVALID_UNIX_EXTRA_FIELD_TYPE = ERR_INVALID_UNIX_EXTRA_FIELD_TYPE;
|
|
9595
|
+
exports.ERR_INVALID_UNIX_ID_SIZE = ERR_INVALID_UNIX_ID_SIZE;
|
|
9596
|
+
exports.ERR_INVALID_UNIX_MODE = ERR_INVALID_UNIX_MODE;
|
|
9512
9597
|
exports.ERR_INVALID_VERSION = ERR_INVALID_VERSION;
|
|
9513
9598
|
exports.ERR_ITERATOR_COMPLETED_TOO_SOON = ERR_ITERATOR_COMPLETED_TOO_SOON;
|
|
9514
9599
|
exports.ERR_LOCAL_FILE_HEADER_NOT_FOUND = ERR_LOCAL_FILE_HEADER_NOT_FOUND;
|
|
9515
9600
|
exports.ERR_OVERLAPPING_ENTRY = ERR_OVERLAPPING_ENTRY;
|
|
9601
|
+
exports.ERR_READABLE_CONSUMED = ERR_READABLE_CONSUMED;
|
|
9516
9602
|
exports.ERR_RESERVED_COMPRESSION_METHOD = ERR_RESERVED_COMPRESSION_METHOD;
|
|
9517
9603
|
exports.ERR_SPLIT_ZIP_FILE = ERR_SPLIT_ZIP_FILE;
|
|
9518
9604
|
exports.ERR_UNDEFINED_READER = ERR_UNDEFINED_READER;
|
|
9519
9605
|
exports.ERR_UNDEFINED_UNCOMPRESSED_SIZE = ERR_UNDEFINED_UNCOMPRESSED_SIZE;
|
|
9520
9606
|
exports.ERR_UNSUPPORTED_COMPRESSION = ERR_UNSUPPORTED_COMPRESSION$1;
|
|
9607
|
+
exports.ERR_UNSUPPORTED_CONTEXT = ERR_UNSUPPORTED_CONTEXT;
|
|
9608
|
+
exports.ERR_UNSUPPORTED_CRYPTO_API = ERR_UNSUPPORTED_CRYPTO_API;
|
|
9521
9609
|
exports.ERR_UNSUPPORTED_ENCRYPTION = ERR_UNSUPPORTED_ENCRYPTION;
|
|
9522
9610
|
exports.ERR_UNSUPPORTED_ENCRYPTION_USDZ = ERR_UNSUPPORTED_ENCRYPTION_USDZ;
|
|
9523
9611
|
exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
|
|
9612
|
+
exports.ERR_WORKER_STARTUP_TIMEOUT = ERR_WORKER_STARTUP_TIMEOUT;
|
|
9524
9613
|
exports.ERR_WRITER_NOT_INITIALIZED = ERR_WRITER_NOT_INITIALIZED;
|
|
9525
9614
|
exports.ERR_ZIP_NOT_EMPTY = ERR_ZIP_NOT_EMPTY;
|
|
9526
9615
|
exports.HttpRangeReader = HttpRangeReader;
|
package/index.d.cts
CHANGED
|
@@ -1119,6 +1119,21 @@ export class ZipReader<Type> {
|
|
|
1119
1119
|
* The data appended after the zip file.
|
|
1120
1120
|
*/
|
|
1121
1121
|
appendedData?: Uint8Array;
|
|
1122
|
+
/**
|
|
1123
|
+
* The data of the digital signature record of the central directory (see
|
|
1124
|
+
* {@link ZipWriterCloseOptions#signCentralDirectory}), if the zip file contains one. zip.js does not verify
|
|
1125
|
+
* signatures; use {@link ZipReader#directoryOffset} and {@link ZipReader#directoryLength} to read the signed
|
|
1126
|
+
* central directory data and verify it.
|
|
1127
|
+
*/
|
|
1128
|
+
digitalSignature?: Uint8Array;
|
|
1129
|
+
/**
|
|
1130
|
+
* The offset of the central directory in the zip file.
|
|
1131
|
+
*/
|
|
1132
|
+
directoryOffset?: number;
|
|
1133
|
+
/**
|
|
1134
|
+
* The length in bytes of the central directory as declared in the end of central directory record.
|
|
1135
|
+
*/
|
|
1136
|
+
directoryLength?: number;
|
|
1122
1137
|
/**
|
|
1123
1138
|
* Returns all the entries in the zip file
|
|
1124
1139
|
*
|
|
@@ -1234,6 +1249,66 @@ export interface GetEntriesOptions {
|
|
|
1234
1249
|
* {@link ERR_AMBIGUOUS_ARCHIVE} error otherwise.
|
|
1235
1250
|
*/
|
|
1236
1251
|
maxAppendedDataSize?: number;
|
|
1252
|
+
/**
|
|
1253
|
+
* The function called for decrypting the central directory when it is encrypted (see the Strong Encryption
|
|
1254
|
+
* Specification in the ZIP format specification). Without this function, reading such an archive throws an
|
|
1255
|
+
* {@link ERR_ENCRYPTED_CENTRAL_DIRECTORY} error. zip.js provides the encrypted data and the related metadata
|
|
1256
|
+
* but does not implement the decryption itself.
|
|
1257
|
+
*
|
|
1258
|
+
* @param data The raw data stored in place of the central directory, i.e. the decryption header followed by
|
|
1259
|
+
* the encrypted (and possibly compressed) central directory, as stored in the zip file.
|
|
1260
|
+
* @param encryptionInfo The encryption metadata read from the Zip64 end of central directory record, or
|
|
1261
|
+
* `undefined` if the zip file does not contain a version 2 record.
|
|
1262
|
+
* @returns The decrypted and decompressed central directory records.
|
|
1263
|
+
*/
|
|
1264
|
+
decryptCentralDirectory?(
|
|
1265
|
+
data: Uint8Array,
|
|
1266
|
+
encryptionInfo?: DirectoryEncryptionInfo
|
|
1267
|
+
): Uint8Array | PromiseLike<Uint8Array>;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
/**
|
|
1271
|
+
* Represents the encryption metadata of an encrypted central directory (see
|
|
1272
|
+
* {@link GetEntriesOptions#decryptCentralDirectory}), read from the version 2 Zip64 end of central directory
|
|
1273
|
+
* record.
|
|
1274
|
+
*/
|
|
1275
|
+
export interface DirectoryEncryptionInfo {
|
|
1276
|
+
/**
|
|
1277
|
+
* The raw data of the extensible data sector of the record.
|
|
1278
|
+
*/
|
|
1279
|
+
rawExtensibleData: Uint8Array;
|
|
1280
|
+
/**
|
|
1281
|
+
* The compression method applied to the central directory before encryption.
|
|
1282
|
+
*/
|
|
1283
|
+
compressionMethod?: number;
|
|
1284
|
+
/**
|
|
1285
|
+
* The size of the compressed and encrypted central directory.
|
|
1286
|
+
*/
|
|
1287
|
+
compressedSize?: number;
|
|
1288
|
+
/**
|
|
1289
|
+
* The size of the central directory once decrypted and decompressed.
|
|
1290
|
+
*/
|
|
1291
|
+
uncompressedSize?: number;
|
|
1292
|
+
/**
|
|
1293
|
+
* The identifier of the encryption algorithm (e.g. `0x6610` for AES-256).
|
|
1294
|
+
*/
|
|
1295
|
+
encryptionAlgorithm?: number;
|
|
1296
|
+
/**
|
|
1297
|
+
* The key size in bits.
|
|
1298
|
+
*/
|
|
1299
|
+
bitLength?: number;
|
|
1300
|
+
/**
|
|
1301
|
+
* The processing flags (e.g. `0x0001` for password-based encryption).
|
|
1302
|
+
*/
|
|
1303
|
+
flags?: number;
|
|
1304
|
+
/**
|
|
1305
|
+
* The identifier of the hash algorithm used for the password validation data.
|
|
1306
|
+
*/
|
|
1307
|
+
hashAlgorithm?: number;
|
|
1308
|
+
/**
|
|
1309
|
+
* The password validation data.
|
|
1310
|
+
*/
|
|
1311
|
+
hashData?: Uint8Array;
|
|
1237
1312
|
}
|
|
1238
1313
|
|
|
1239
1314
|
/**
|
|
@@ -2141,6 +2216,19 @@ export interface ZipWriterCloseOptions extends EntryOnprogressOptions {
|
|
|
2141
2216
|
* @defaultValue false
|
|
2142
2217
|
*/
|
|
2143
2218
|
preventClose?: boolean;
|
|
2219
|
+
/**
|
|
2220
|
+
* The function called for signing the central directory. The returned data (e.g. a PKCS#7 signature computed
|
|
2221
|
+
* over the central directory records) is stored in a digital signature record written between the central
|
|
2222
|
+
* directory and the end of central directory record, and exposed by {@link ZipReader#digitalSignature} when
|
|
2223
|
+
* reading the zip file. It must not exceed 64KB, otherwise an {@link ERR_INVALID_SIGNATURE_DATA} error is
|
|
2224
|
+
* thrown. zip.js stores the data as-is and does not implement the signature computation itself.
|
|
2225
|
+
*
|
|
2226
|
+
* @param directory The raw data of the central directory records.
|
|
2227
|
+
* @returns The data of the digital signature record.
|
|
2228
|
+
*/
|
|
2229
|
+
signCentralDirectory?(
|
|
2230
|
+
directory: Uint8Array
|
|
2231
|
+
): Uint8Array | PromiseLike<Uint8Array>;
|
|
2144
2232
|
}
|
|
2145
2233
|
|
|
2146
2234
|
/**
|
|
@@ -3254,3 +3342,56 @@ export const ERR_WRITER_NOT_INITIALIZED: string;
|
|
|
3254
3342
|
* Zip file not empty error
|
|
3255
3343
|
*/
|
|
3256
3344
|
export const ERR_ZIP_NOT_EMPTY: string;
|
|
3345
|
+
/**
|
|
3346
|
+
* Signature data exceeding 64KB error (see {@link ZipWriterCloseOptions#signCentralDirectory})
|
|
3347
|
+
*/
|
|
3348
|
+
export const ERR_INVALID_SIGNATURE_DATA: string;
|
|
3349
|
+
/**
|
|
3350
|
+
* Invalid uid error (thrown when the `uid` option is not an integer in the range 0..2^32-1)
|
|
3351
|
+
*/
|
|
3352
|
+
export const ERR_INVALID_UID: string;
|
|
3353
|
+
/**
|
|
3354
|
+
* Invalid gid error (thrown when the `gid` option is not an integer in the range 0..2^32-1)
|
|
3355
|
+
*/
|
|
3356
|
+
export const ERR_INVALID_GID: string;
|
|
3357
|
+
/**
|
|
3358
|
+
* Invalid UNIX mode error (thrown when the `unixMode` option is not an integer in the range 0..65535)
|
|
3359
|
+
*/
|
|
3360
|
+
export const ERR_INVALID_UNIX_MODE: string;
|
|
3361
|
+
/**
|
|
3362
|
+
* Invalid unixExtraFieldType error (thrown when the `unixExtraFieldType` option is not `"infozip"` or `"unix"`)
|
|
3363
|
+
*/
|
|
3364
|
+
export const ERR_INVALID_UNIX_EXTRA_FIELD_TYPE: string;
|
|
3365
|
+
/**
|
|
3366
|
+
* Invalid UNIX uid/gid size error (thrown when `uid`/`gid` exceeds 65535 with `unixExtraFieldType` set to `"unix"`; use `"infozip"` for larger ids)
|
|
3367
|
+
*/
|
|
3368
|
+
export const ERR_INVALID_UNIX_ID_SIZE: string;
|
|
3369
|
+
/**
|
|
3370
|
+
* Invalid msdosAttributesRaw error (thrown when the `msdosAttributesRaw` option is not an integer in the range 0..255)
|
|
3371
|
+
*/
|
|
3372
|
+
export const ERR_INVALID_MSDOS_ATTRIBUTES: string;
|
|
3373
|
+
/**
|
|
3374
|
+
* Invalid msdosAttributes error (thrown when the `msdosAttributes` option is not an object with boolean flags)
|
|
3375
|
+
*/
|
|
3376
|
+
export const ERR_INVALID_MSDOS_DATA: string;
|
|
3377
|
+
/**
|
|
3378
|
+
* Entry already exists error (thrown by the filesystem API when adding an entry whose filename already exists)
|
|
3379
|
+
*/
|
|
3380
|
+
export const ERR_ENTRY_EXISTS: string;
|
|
3381
|
+
/**
|
|
3382
|
+
* Readable stream already consumed error (thrown by the filesystem API when a readable stream is read more than once)
|
|
3383
|
+
*/
|
|
3384
|
+
export const ERR_READABLE_CONSUMED: string;
|
|
3385
|
+
/**
|
|
3386
|
+
* Unsupported context error (thrown when {@link createSyncAccessHandleTempStream} is used outside a dedicated worker)
|
|
3387
|
+
*/
|
|
3388
|
+
export const ERR_UNSUPPORTED_CONTEXT: string;
|
|
3389
|
+
/**
|
|
3390
|
+
* Unsupported Crypto API error (thrown when writing encrypted entries while `crypto.getRandomValues` is unavailable)
|
|
3391
|
+
*/
|
|
3392
|
+
export const ERR_UNSUPPORTED_CRYPTO_API: string;
|
|
3393
|
+
/**
|
|
3394
|
+
* Web worker startup timeout error (thrown when a web worker does not start in time, e.g. in browser extensions
|
|
3395
|
+
* disallowing workers; set `useWebWorkers` to `false` in {@link configure} to work around it)
|
|
3396
|
+
*/
|
|
3397
|
+
export const ERR_WORKER_STARTUP_TIMEOUT: string;
|