@tinycloud/web-sdk 3.12.0-beta.32 โ 3.12.0-beta.34
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{createRegistryVerdictCache:()=>xe});var r=Object.defineProperty,n=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},a=(e,t,n)=>((e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);function i(e){if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}n({},{base10:()=>b}),new Uint8Array(0);var o=class{constructor(e,t,r){a(this,"name"),a(this,"prefix"),a(this,"baseEncode"),this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},s=class{constructor(e,t,r){a(this,"name"),a(this,"prefix"),a(this,"baseDecode"),a(this,"prefixCodePoint"),this.name=e,this.prefix=t;const n=t.codePointAt(0);if(void 0===n)throw new Error("Invalid prefix character");this.prefixCodePoint=n,this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return h(this,e)}},c=class{constructor(e){a(this,"decoders"),this.decoders=e}or(e){return h(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(null!=r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function h(e,t){return new c({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var d=class{constructor(e,t,r,n){a(this,"name"),a(this,"prefix"),a(this,"baseEncode"),a(this,"baseDecode"),a(this,"encoder"),a(this,"decoder"),this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new o(e,t,r),this.decoder=new s(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function u({name:e,prefix:t,encode:r,decode:n}){return new d(e,t,r,n)}function f({name:e,prefix:t,alphabet:r}){const{encode:n,decode:a}=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var a=0;a<e.length;a++){var i=e.charAt(a),o=i.charCodeAt(0);if(255!==r[o])throw new TypeError(i+" is ambiguous");r[o]=a}var s=e.length,c=e.charAt(0),h=Math.log(s)/Math.log(256),d=Math.log(256)/Math.log(s);function u(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,a=0;e[t]===c;)n++,t++;for(var i=(e.length-t)*h+1>>>0,o=new Uint8Array(i);e[t];){var d=r[e.charCodeAt(t)];if(255===d)return;for(var u=0,f=i-1;(0!==d||u<a)&&-1!==f;f--,u++)d+=s*o[f]>>>0,o[f]=d%256>>>0,d=d/256>>>0;if(0!==d)throw new Error("Non-zero carry");a=u,t++}if(" "!==e[t]){for(var p=i-a;p!==i&&0===o[p];)p++;for(var b=new Uint8Array(n+(i-p)),l=n;p!==i;)b[l++]=o[p++];return b}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,a=0,i=t.length;a!==i&&0===t[a];)a++,r++;for(var o=(i-a)*d+1>>>0,h=new Uint8Array(o);a!==i;){for(var u=t[a],f=0,p=o-1;(0!==u||f<n)&&-1!==p;p--,f++)u+=256*h[p]>>>0,h[p]=u%s>>>0,u=u/s>>>0;if(0!==u)throw new Error("Non-zero carry");n=f,a++}for(var b=o-n;b!==o&&0===h[b];)b++;for(var l=c.repeat(r);b<o;++b)l+=e.charAt(h[b]);return l},decodeUnsafe:u,decode:function(e){var r=u(e);if(r)return r;throw new Error(`Non-${t} character`)}}}(r,e);return u({prefix:t,name:e,encode:n,decode:e=>i(a(e))})}function p({name:e,prefix:t,bitsPerChar:r,alphabet:n}){const a=function(e){const t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}(n);return u({prefix:t,name:e,encode:e=>function(e,t,r){const n="="===t[t.length-1],a=(1<<r)-1;let i="",o=0,s=0;for(let n=0;n<e.length;++n)for(s=s<<8|e[n],o+=8;o>r;)o-=r,i+=t[a&s>>o];if(0!==o&&(i+=t[a&s<<r-o]),n)for(;i.length*r&7;)i+="=";return i}(e,n,r),decode:t=>function(e,t,r,n){let a=e.length;for(;"="===e[a-1];)--a;const i=new Uint8Array(a*r/8|0);let o=0,s=0,c=0;for(let h=0;h<a;++h){const a=t[e[h]];if(void 0===a)throw new SyntaxError(`Non-${n} character`);s=s<<r|a,o+=r,o>=8&&(o-=8,i[c++]=255&s>>o)}if(o>=r||255&s<<8-o)throw new SyntaxError("Unexpected end of data");return i}(t,a,r,e)})}var b=f({prefix:"9",name:"base10",alphabet:"0123456789"});n({},{base16:()=>l,base16upper:()=>g});var l=p({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),g=p({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});n({},{base2:()=>w});var w=p({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});n({},{base256emoji:()=>v});var y=Array.from("๐๐ชโ๐ฐ๐๐๐๐๐๐๐๐๐๐๐๐๐โ๐ป๐ฅ๐พ๐ฟ๐โค๐๐คฃ๐๐๐๐ญ๐๐๐
๐๐๐ฅ๐ฅฐ๐๐๐๐ข๐ค๐๐๐ช๐โบ๐๐ค๐๐๐๐๐น๐คฆ๐๐โโจ๐คท๐ฑ๐๐ธ๐๐๐๐๐๐๐๐๐คฉ๐๐๐ค๐๐ฏ๐๐๐ถ๐๐คญโฃ๐๐๐๐ช๐๐ฅ๐๐๐ฉ๐ก๐คช๐๐ฅณ๐ฅ๐คค๐๐๐ณโ๐๐๐ด๐๐ฌ๐๐๐ท๐ป๐โญโ
๐ฅบ๐๐๐ค๐ฆโ๐ฃ๐๐โน๐๐๐ โ๐๐บ๐๐ป๐๐๐๐๐น๐ฃ๐ซ๐๐๐ต๐ค๐๐ด๐ค๐ผ๐ซโฝ๐คโ๐๐คซ๐๐ฎ๐๐ป๐๐ถ๐๐ฒ๐ฟ๐งก๐โก๐๐โโ๐๐ฐ๐คจ๐ถ๐ค๐ถ๐ฐ๐๐ข๐ค๐๐จ๐จ๐คฌโ๐๐บ๐ค๐๐๐ฑ๐๐ถ๐ฅดโถโกโ๐๐ธโฌ๐จ๐๐ฆ๐ท๐บโ ๐
๐๐ต๐๐คฒ๐ค ๐คง๐๐ต๐
๐ง๐พ๐๐๐ค๐๐คฏ๐ทโ๐ง๐ฏ๐๐๐ค๐๐โ๐ด๐ฃ๐ธ๐๐๐ฅ๐คข๐
๐ก๐ฉ๐๐ธ๐ป๐ค๐คฎ๐ผ๐ฅต๐ฉ๐๐๐ผ๐๐ฃ๐ฅ"),m=y.reduce((e,t,r)=>(e[r]=t,e),[]),x=y.reduce((e,t,r)=>{const n=t.codePointAt(0);if(null==n)throw new Error(`Invalid character: ${t}`);return e[n]=r,e},[]),v=u({prefix:"๐",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+m[t],"")},decode:function(e){const t=[];for(const r of e){const e=r.codePointAt(0);if(null==e)throw new Error(`Invalid character: ${r}`);const n=x[e];if(null==n)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}});n({},{base32:()=>A,base32hex:()=>C,base32hexpad:()=>S,base32hexpadupper:()=>D,base32hexupper:()=>L,base32pad:()=>U,base32padupper:()=>P,base32upper:()=>E,base32z:()=>M});var A=p({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),E=p({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),U=p({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),P=p({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),C=p({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),L=p({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),S=p({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),D=p({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),M=p({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});n({},{base36:()=>k,base36upper:()=>T});var k=f({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),T=f({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});n({},{base58btc:()=>q,base58flickr:()=>j});var q=f({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),j=f({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});n({},{base64:()=>$,base64pad:()=>O,base64url:()=>I,base64urlpad:()=>N});var $=p({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),O=p({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),I=p({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),N=p({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});n({},{base8:()=>R});var R=p({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});n({},{identity:()=>z});var z=u({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>function(e){return(new TextEncoder).encode(e)}(e)});n((new TextEncoder,new TextDecoder,{}),{identity:()=>se});var B=128,V=-128,F=Math.pow(2,31),J=128,H=127,Z=Math.pow(2,7),K=Math.pow(2,14),G=Math.pow(2,21),Q=Math.pow(2,28),W=Math.pow(2,35),Y=Math.pow(2,42),X=Math.pow(2,49),_=Math.pow(2,56),ee=Math.pow(2,63),te={encode:function e(t,r,n){r=r||[];for(var a=n=n||0;t>=F;)r[n++]=255&t|B,t/=128;for(;t&V;)r[n++]=255&t|B,t>>>=7;return r[n]=0|t,e.bytes=n-a+1,r},decode:function e(t,r){var n,a=0,i=0,o=r=r||0,s=t.length;do{if(o>=s)throw e.bytes=0,new RangeError("Could not decode varint");n=t[o++],a+=i<28?(n&H)<<i:(n&H)*Math.pow(2,i),i+=7}while(n>=J);return e.bytes=o-r,a},encodingLength:function(e){return e<Z?1:e<K?2:e<G?3:e<Q?4:e<W?5:e<Y?6:e<X?7:e<_?8:e<ee?9:10}};function re(e,t,r=0){return te.encode(e,t,r),t}function ne(e){return te.encodingLength(e)}function ae(e,t){const r=t.byteLength,n=ne(e),a=n+ne(r),i=new Uint8Array(a+r);return re(e,i,0),re(r,i,n),i.set(t,a),new ie(e,r,t,i)}var ie=class{constructor(e,t,r,n){a(this,"code"),a(this,"size"),a(this,"digest"),a(this,"bytes"),this.code=e,this.size=t,this.digest=r,this.bytes=n}},oe=i,se={code:0,name:"identity",encode:oe,digest:function(e,t){if(null!=t?.truncate&&t.truncate!==e.byteLength){if(t.truncate<0||t.truncate>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,t.truncate)}return ae(0,oe(e))}};function ce({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:a}){return new he(e,t,r,n,a)}n({},{sha256:()=>fe,sha512:()=>pe});var he=class{constructor(e,t,r,n,i){a(this,"name"),a(this,"code"),a(this,"encode"),a(this,"minDigestLength"),a(this,"maxDigestLength"),this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??20,this.maxDigestLength=i}digest(e,t){if(null!=t?.truncate){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(null!=this.maxDigestLength&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?de(r,this.code,t?.truncate):r.then(e=>de(e,this.code,t?.truncate))}throw Error("Unknown type, must be binary type")}};function de(e,t,r){if(null!=r&&r!==e.byteLength){if(r>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,r)}return ae(t,e)}function ue(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var fe=ce({name:"sha2-256",code:18,encode:ue("SHA-256")}),pe=ce({name:"sha2-512",code:19,encode:ue("SHA-512")});Symbol.toStringTag;var be="(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])",le=(new RegExp(`^${be}(\\.${be}){3}$`),"[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?");new RegExp(`^${le}(\\.${le})*$`);var ge=6e4,we=6e4,ye=256;function me(e){const t=[["?","query"],["#","fragment"],["@","credentials"],["\\","backslash"]].filter(([t])=>e.includes(t)).map(([,e])=>e);if(/\s/.test(e)&&t.push("whitespace"),t.length)throw new TypeError(`A registry URL used with a verdict cache must not contain a query, fragment, credentials, backslash or whitespace (found: ${t.join(", ")})`);try{const t=new URL(e);return t.origin+t.pathname.replace(/\/$/,"")}catch{return e}}function xe(){return function(e={}){const t=e.now??(()=>performance.now()),r=new Map,n=(e,t)=>JSON.stringify([me(e),t]);return{async get(a,i){const o=n(a.registryUrl,a.subject);if("absent-reads"===e.mode&&!0!==a.dataRead)return r.delete(o),i();const s=r.get(o);if(s&&t()<s.expiresAt){const t=await s.verdict;if("unavailable"===t.status||("registered"!==t.status||"absent-reads"!==e.mode)&&await async function(e,t){try{const n=(r=e.subject).startsWith("did:pkh:")?r.slice(r.lastIndexOf(":")+1):r,a=await async function(e,t){if(!e)return;if(e.getRegistration)return e.getRegistration(t);const r=await e.get(t);return void 0===r?void 0:{sequence:r,kind:"unknown"}}(e.sequenceStore,n),i=await(e.cacheStore?.get(n));return"unregistered"===t.status?void 0===a&&void 0===i&&!(e.cacheStore&&await e.cacheStore.getRevision(n)>0):!("registered"!==t.status||t.offline||e.sequenceStore&&(!a||"legacy-v1"===a.kind||a.sequence!==t.sequence)||e.cacheStore&&i?.sequence!==t.sequence)}catch{return!1}var r}(a,t))return t;r.get(o)===s&&r.delete(o)}const c={verdict:i(),expiresAt:Number.POSITIVE_INFINITY};return((e,n)=>{const a=t();for(const[e,t]of r)t.expiresAt<=a&&r.delete(e);for(;r.size>=ye;)r.delete(r.keys().next().value);r.set(e,n)})(o,c),c.verdict.then(n=>{if(r.get(o)!==c)return;const a="unavailable"===n.status||n.offline?void 0:"registered"===n.status?"absent-reads"===e.mode?void 0:ge:we;void 0===a?r.delete(o):(c.settled=n,c.expiresAt=t()+a)},()=>{r.get(o)===c&&r.delete(o)}),c.verdict},invalidate(e,t){/[?#@\\\s]/.test(e)||r.delete(n(e,t))}}}({mode:"absent-reads"})}module.exports=t})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=(t,r)=>{for(var n in r)e(t,n,{get:r[n],enumerable:!0})},r=(t,r,n)=>((t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n)(t,"symbol"!=typeof r?r+"":r,n);function n(e){if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}t({},{base10:()=>f}),new Uint8Array(0);var a=class{constructor(e,t,n){r(this,"name"),r(this,"prefix"),r(this,"baseEncode"),this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},i=class{constructor(e,t,n){r(this,"name"),r(this,"prefix"),r(this,"baseDecode"),r(this,"prefixCodePoint"),this.name=e,this.prefix=t;const a=t.codePointAt(0);if(void 0===a)throw new Error("Invalid prefix character");this.prefixCodePoint=a,this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return s(this,e)}},o=class{constructor(e){r(this,"decoders"),this.decoders=e}or(e){return s(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(null!=r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function s(e,t){return new o({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var c=class{constructor(e,t,n,o){r(this,"name"),r(this,"prefix"),r(this,"baseEncode"),r(this,"baseDecode"),r(this,"encoder"),r(this,"decoder"),this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new a(e,t,n),this.decoder=new i(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function h({name:e,prefix:t,encode:r,decode:n}){return new c(e,t,r,n)}function d({name:e,prefix:t,alphabet:r}){const{encode:a,decode:i}=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var a=0;a<e.length;a++){var i=e.charAt(a),o=i.charCodeAt(0);if(255!==r[o])throw new TypeError(i+" is ambiguous");r[o]=a}var s=e.length,c=e.charAt(0),h=Math.log(s)/Math.log(256),d=Math.log(256)/Math.log(s);function u(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,a=0;e[t]===c;)n++,t++;for(var i=(e.length-t)*h+1>>>0,o=new Uint8Array(i);e[t];){var d=r[e.charCodeAt(t)];if(255===d)return;for(var u=0,f=i-1;(0!==d||u<a)&&-1!==f;f--,u++)d+=s*o[f]>>>0,o[f]=d%256>>>0,d=d/256>>>0;if(0!==d)throw new Error("Non-zero carry");a=u,t++}if(" "!==e[t]){for(var p=i-a;p!==i&&0===o[p];)p++;for(var b=new Uint8Array(n+(i-p)),l=n;p!==i;)b[l++]=o[p++];return b}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,a=0,i=t.length;a!==i&&0===t[a];)a++,r++;for(var o=(i-a)*d+1>>>0,h=new Uint8Array(o);a!==i;){for(var u=t[a],f=0,p=o-1;(0!==u||f<n)&&-1!==p;p--,f++)u+=256*h[p]>>>0,h[p]=u%s>>>0,u=u/s>>>0;if(0!==u)throw new Error("Non-zero carry");n=f,a++}for(var b=o-n;b!==o&&0===h[b];)b++;for(var l=c.repeat(r);b<o;++b)l+=e.charAt(h[b]);return l},decodeUnsafe:u,decode:function(e){var r=u(e);if(r)return r;throw new Error(`Non-${t} character`)}}}(r,e);return h({prefix:t,name:e,encode:a,decode:e=>n(i(e))})}function u({name:e,prefix:t,bitsPerChar:r,alphabet:n}){const a=function(e){const t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}(n);return h({prefix:t,name:e,encode:e=>function(e,t,r){const n="="===t[t.length-1],a=(1<<r)-1;let i="",o=0,s=0;for(let n=0;n<e.length;++n)for(s=s<<8|e[n],o+=8;o>r;)o-=r,i+=t[a&s>>o];if(0!==o&&(i+=t[a&s<<r-o]),n)for(;i.length*r&7;)i+="=";return i}(e,n,r),decode:t=>function(e,t,r,n){let a=e.length;for(;"="===e[a-1];)--a;const i=new Uint8Array(a*r/8|0);let o=0,s=0,c=0;for(let h=0;h<a;++h){const a=t[e[h]];if(void 0===a)throw new SyntaxError(`Non-${n} character`);s=s<<r|a,o+=r,o>=8&&(o-=8,i[c++]=255&s>>o)}if(o>=r||255&s<<8-o)throw new SyntaxError("Unexpected end of data");return i}(t,a,r,e)})}var f=d({prefix:"9",name:"base10",alphabet:"0123456789"});t({},{base16:()=>p,base16upper:()=>b});var p=u({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),b=u({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});t({},{base2:()=>l});var l=u({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});t({},{base256emoji:()=>m});var g=Array.from("๐๐ชโ๐ฐ๐๐๐๐๐๐๐๐๐๐๐๐๐โ๐ป๐ฅ๐พ๐ฟ๐โค๐๐คฃ๐๐๐๐ญ๐๐๐
๐๐๐ฅ๐ฅฐ๐๐๐๐ข๐ค๐๐๐ช๐โบ๐๐ค๐๐๐๐๐น๐คฆ๐๐โโจ๐คท๐ฑ๐๐ธ๐๐๐๐๐๐๐๐๐คฉ๐๐๐ค๐๐ฏ๐๐๐ถ๐๐คญโฃ๐๐๐๐ช๐๐ฅ๐๐๐ฉ๐ก๐คช๐๐ฅณ๐ฅ๐คค๐๐๐ณโ๐๐๐ด๐๐ฌ๐๐๐ท๐ป๐โญโ
๐ฅบ๐๐๐ค๐ฆโ๐ฃ๐๐โน๐๐๐ โ๐๐บ๐๐ป๐๐๐๐๐น๐ฃ๐ซ๐๐๐ต๐ค๐๐ด๐ค๐ผ๐ซโฝ๐คโ๐๐คซ๐๐ฎ๐๐ป๐๐ถ๐๐ฒ๐ฟ๐งก๐โก๐๐โโ๐๐ฐ๐คจ๐ถ๐ค๐ถ๐ฐ๐๐ข๐ค๐๐จ๐จ๐คฌโ๐๐บ๐ค๐๐๐ฑ๐๐ถ๐ฅดโถโกโ๐๐ธโฌ๐จ๐๐ฆ๐ท๐บโ ๐
๐๐ต๐๐คฒ๐ค ๐คง๐๐ต๐
๐ง๐พ๐๐๐ค๐๐คฏ๐ทโ๐ง๐ฏ๐๐๐ค๐๐โ๐ด๐ฃ๐ธ๐๐๐ฅ๐คข๐
๐ก๐ฉ๐๐ธ๐ป๐ค๐คฎ๐ผ๐ฅต๐ฉ๐๐๐ผ๐๐ฃ๐ฅ"),w=g.reduce((e,t,r)=>(e[r]=t,e),[]),y=g.reduce((e,t,r)=>{const n=t.codePointAt(0);if(null==n)throw new Error(`Invalid character: ${t}`);return e[n]=r,e},[]),m=h({prefix:"๐",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+w[t],"")},decode:function(e){const t=[];for(const r of e){const e=r.codePointAt(0);if(null==e)throw new Error(`Invalid character: ${r}`);const n=y[e];if(null==n)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}});t({},{base32:()=>x,base32hex:()=>U,base32hexpad:()=>P,base32hexpadupper:()=>L,base32hexupper:()=>C,base32pad:()=>A,base32padupper:()=>E,base32upper:()=>v,base32z:()=>D});var x=u({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),v=u({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),A=u({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),E=u({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),U=u({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),C=u({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),P=u({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),L=u({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),D=u({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});t({},{base36:()=>M,base36upper:()=>S});var M=d({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),S=d({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});t({},{base58btc:()=>k,base58flickr:()=>q});var k=d({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),q=d({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});t({},{base64:()=>T,base64pad:()=>$,base64url:()=>I,base64urlpad:()=>N});var T=u({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),$=u({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),I=u({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),N=u({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});t({},{base8:()=>R});var R=u({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});t({},{identity:()=>z});var z=h({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>function(e){return(new TextEncoder).encode(e)}(e)});t((new TextEncoder,new TextDecoder,{}),{identity:()=>ie});var j=128,O=-128,B=Math.pow(2,31),V=128,F=127,J=Math.pow(2,7),H=Math.pow(2,14),Z=Math.pow(2,21),K=Math.pow(2,28),G=Math.pow(2,35),Q=Math.pow(2,42),W=Math.pow(2,49),Y=Math.pow(2,56),X=Math.pow(2,63),_={encode:function e(t,r,n){r=r||[];for(var a=n=n||0;t>=B;)r[n++]=255&t|j,t/=128;for(;t&O;)r[n++]=255&t|j,t>>>=7;return r[n]=0|t,e.bytes=n-a+1,r},decode:function e(t,r){var n,a=0,i=0,o=r=r||0,s=t.length;do{if(o>=s)throw e.bytes=0,new RangeError("Could not decode varint");n=t[o++],a+=i<28?(n&F)<<i:(n&F)*Math.pow(2,i),i+=7}while(n>=V);return e.bytes=o-r,a},encodingLength:function(e){return e<J?1:e<H?2:e<Z?3:e<K?4:e<G?5:e<Q?6:e<W?7:e<Y?8:e<X?9:10}};function ee(e,t,r=0){return _.encode(e,t,r),t}function te(e){return _.encodingLength(e)}function re(e,t){const r=t.byteLength,n=te(e),a=n+te(r),i=new Uint8Array(a+r);return ee(e,i,0),ee(r,i,n),i.set(t,a),new ne(e,r,t,i)}var ne=class{constructor(e,t,n,a){r(this,"code"),r(this,"size"),r(this,"digest"),r(this,"bytes"),this.code=e,this.size=t,this.digest=n,this.bytes=a}},ae=n,ie={code:0,name:"identity",encode:ae,digest:function(e,t){if(null!=t?.truncate&&t.truncate!==e.byteLength){if(t.truncate<0||t.truncate>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,t.truncate)}return re(0,ae(e))}};function oe({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:a}){return new se(e,t,r,n,a)}t({},{sha256:()=>de,sha512:()=>ue});var se=class{constructor(e,t,n,a,i){r(this,"name"),r(this,"code"),r(this,"encode"),r(this,"minDigestLength"),r(this,"maxDigestLength"),this.name=e,this.code=t,this.encode=n,this.minDigestLength=a??20,this.maxDigestLength=i}digest(e,t){if(null!=t?.truncate){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(null!=this.maxDigestLength&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?ce(r,this.code,t?.truncate):r.then(e=>ce(e,this.code,t?.truncate))}throw Error("Unknown type, must be binary type")}};function ce(e,t,r){if(null!=r&&r!==e.byteLength){if(r>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,r)}return re(t,e)}function he(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var de=oe({name:"sha2-256",code:18,encode:he("SHA-256")}),ue=oe({name:"sha2-512",code:19,encode:he("SHA-512")});Symbol.toStringTag;var fe="(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])",pe=(new RegExp(`^${fe}(\\.${fe}){3}$`),"[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?");function be(e){const t=[["?","query"],["#","fragment"],["@","credentials"],["\\","backslash"]].filter(([t])=>e.includes(t)).map(([,e])=>e);if(/\s/.test(e)&&t.push("whitespace"),t.length)throw new TypeError(`A registry URL used with a verdict cache must not contain a query, fragment, credentials, backslash or whitespace (found: ${t.join(", ")})`);try{const t=new URL(e);return t.origin+t.pathname.replace(/\/$/,"")}catch{return e}}function le(){return function(e={}){const t=e.now??(()=>performance.now()),r=new Map,n=(e,t)=>JSON.stringify([be(e),t]);return{async get(a,i){const o=n(a.registryUrl,a.subject);if("absent-reads"===e.mode&&!0!==a.dataRead)return r.delete(o),i();const s=r.get(o);if(s&&t()<s.expiresAt){const t=await s.verdict;if("unavailable"===t.status||("registered"!==t.status||"absent-reads"!==e.mode)&&await async function(e,t){try{const n=(r=e.subject).startsWith("did:pkh:")?r.slice(r.lastIndexOf(":")+1):r,a=await async function(e,t){if(!e)return;if(e.getRegistration)return e.getRegistration(t);const r=await e.get(t);return void 0===r?void 0:{sequence:r,kind:"unknown"}}(e.sequenceStore,n),i=await(e.cacheStore?.get(n));return"unregistered"===t.status?void 0===a&&void 0===i&&!(e.cacheStore&&await e.cacheStore.getRevision(n)>0):!("registered"!==t.status||t.offline||e.sequenceStore&&(!a||"legacy-v1"===a.kind||a.sequence!==t.sequence)||e.cacheStore&&i?.sequence!==t.sequence)}catch{return!1}var r}(a,t))return t;r.get(o)===s&&r.delete(o)}const c={verdict:i(),expiresAt:Number.POSITIVE_INFINITY};return((e,n)=>{const a=t();for(const[e,t]of r)t.expiresAt<=a&&r.delete(e);for(;r.size>=256;)r.delete(r.keys().next().value);r.set(e,n)})(o,c),c.verdict.then(n=>{if(r.get(o)!==c)return;const a="unavailable"===n.status||n.offline||"registered"===n.status&&"absent-reads"===e.mode?void 0:6e4;void 0===a?r.delete(o):(c.settled=n,c.expiresAt=t()+a)},()=>{r.get(o)===c&&r.delete(o)}),c.verdict},invalidate(e,t){/[?#@\\\s]/.test(e)||r.delete(n(e,t))}}}({mode:"absent-reads"})}new RegExp(`^${pe}(\\.${pe})*$`);export{le as createRegistryVerdictCache};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinycloud/web-sdk",
|
|
3
|
-
"version": "3.12.0-beta.
|
|
3
|
+
"version": "3.12.0-beta.34",
|
|
4
4
|
"description": "A set of tools and utilities to help you build your app with TinyCloud.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"@multiformats/multiaddr": "^13.0.1",
|
|
68
68
|
"@multiformats/multiaddr-to-uri": "^12.0.0",
|
|
69
69
|
"@noble/curves": "^1.9.7",
|
|
70
|
-
"@tinycloud/node-sdk": "3.12.0-beta.
|
|
71
|
-
"@tinycloud/replica": "0.4.5-beta.
|
|
72
|
-
"@tinycloud/sdk-core": "3.12.0-beta.
|
|
70
|
+
"@tinycloud/node-sdk": "3.12.0-beta.34",
|
|
71
|
+
"@tinycloud/replica": "0.4.5-beta.10",
|
|
72
|
+
"@tinycloud/sdk-core": "3.12.0-beta.34",
|
|
73
73
|
"@tinycloud/share-envelope": "1.6.0-beta.1",
|
|
74
74
|
"@tinycloud/share-sdk": "1.5.0-beta.4",
|
|
75
75
|
"@tinycloud/web-sdk-wasm": "1.7.8-beta.0",
|