Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

multiformats

Package Overview
Dependencies
Maintainers
2
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multiformats - npm Package Compare versions

Comparing version 12.0.1 to 12.0.2

23

CHANGELOG.md

@@ -0,1 +1,24 @@

## [12.0.2](https://github.com/multiformats/js-multiformats/compare/v12.0.1...v12.0.2) (2023-08-28)
### Bug Fixes
* linting ([3d74818](https://github.com/multiformats/js-multiformats/commit/3d74818e975099c7c83112434f7ed23a68b9af0a))
* remove old ts option ([638dbed](https://github.com/multiformats/js-multiformats/commit/638dbed357cfe65e4d3402899dde5a7620ab5ce7))
### Trivial Changes
* add or force update .github/workflows/js-test-and-release.yml ([21b7591](https://github.com/multiformats/js-multiformats/commit/21b75911e0aee1ba7a6be9687db83328cfd961b5))
* delete templates [skip ci] ([#263](https://github.com/multiformats/js-multiformats/issues/263)) ([d2b614d](https://github.com/multiformats/js-multiformats/commit/d2b614d34631537a97176657b478691ca0ab5522))
* **deps:** bump actions/setup-node from 3.5.0 to 3.8.0 ([7dcf225](https://github.com/multiformats/js-multiformats/commit/7dcf225914fd6cebfa9f5cf0f5897cc0a0f356ab))
* **deps:** bump actions/setup-node from 3.8.0 to 3.8.1 ([d7ec85c](https://github.com/multiformats/js-multiformats/commit/d7ec85c29500ff0a9bb02d2ea4c808047938ce97))
* **deps:** bump gozala/typescript-error-reporter-action ([4a36fb7](https://github.com/multiformats/js-multiformats/commit/4a36fb7ee49edb4300267b90301ef0e4300cbc46))
* Update .github/dependabot.yml [skip ci] ([58bebda](https://github.com/multiformats/js-multiformats/commit/58bebda0a892429bf125ea6bc2e4f0a2208b27a6))
### Dependencies
* **dev:** bump aegir from 37.12.1 to 40.0.11 ([d17424d](https://github.com/multiformats/js-multiformats/commit/d17424d257fd9995ad775d2309a67ae2dc4f3c54))
## [12.0.1](https://github.com/multiformats/js-multiformats/compare/v12.0.0...v12.0.1) (2023-06-15)

@@ -2,0 +25,0 @@

2

dist/index.min.js
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Multiformats = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var Multiformats=(()=>{var R=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var le=Object.prototype.hasOwnProperty;var D=(r,e)=>{for(var t in e)R(r,t,{get:e[t],enumerable:!0})},ue=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of pe(e))!le.call(r,o)&&o!==t&&R(r,o,{get:()=>e[o],enumerable:!(n=fe(e,o))||n.enumerable});return r};var we=r=>ue(R({},"__esModule",{value:!0}),r);var Ze={};D(Ze,{CID:()=>h,bytes:()=>j,digest:()=>B,hasher:()=>_,varint:()=>T});var T={};D(T,{decode:()=>O,encodeTo:()=>E,encodingLength:()=>U});var be=re,ee=128,ge=127,me=~ge,ye=Math.pow(2,31);function re(r,e,t){e=e||[],t=t||0;for(var n=t;r>=ye;)e[t++]=r&255|ee,r/=128;for(;r&me;)e[t++]=r&255|ee,r>>>=7;return e[t]=r|0,re.bytes=t-n+1,e}var xe=J,ve=128,te=127;function J(r,n){var t=0,n=n||0,o=0,s=n,i,c=r.length;do{if(s>=c)throw J.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&te)<<o:(i&te)*Math.pow(2,o),o+=7}while(i>=ve);return J.bytes=s-n,t}var Ae=Math.pow(2,7),Se=Math.pow(2,14),Ee=Math.pow(2,21),Ue=Math.pow(2,28),ze=Math.pow(2,35),Ce=Math.pow(2,42),Me=Math.pow(2,49),Ne=Math.pow(2,56),Oe=Math.pow(2,63),Ve=function(r){return r<Ae?1:r<Se?2:r<Ee?3:r<Ue?4:r<ze?5:r<Ce?6:r<Me?7:r<Ne?8:r<Oe?9:10},De={encode:be,decode:xe,encodingLength:Ve},Le=De,L=Le;var O=(r,e=0)=>[L.decode(r,e),L.decode.bytes],E=(r,e,t=0)=>(L.encode(r,e,t),e),U=r=>L.encodingLength(r);var B={};D(B,{Digest:()=>C,create:()=>V,decode:()=>Q,equals:()=>G});var j={};D(j,{coerce:()=>z,empty:()=>ne,equals:()=>P,fromHex:()=>Be,fromString:()=>Ie,isBinary:()=>$e,toHex:()=>Te,toString:()=>ke});var ne=new Uint8Array(0),Te=r=>r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),Be=r=>{let e=r.match(/../g);return e?new Uint8Array(e.map(t=>parseInt(t,16))):ne},P=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},z=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},$e=r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),Ie=r=>new TextEncoder().encode(r),ke=r=>new TextDecoder().decode(r);var V=(r,e)=>{let t=e.byteLength,n=U(r),o=n+U(t),s=new Uint8Array(o+t);return E(r,s,0),E(t,s,n),s.set(e,o),new C(r,t,e,s)},Q=r=>{let e=z(r),[t,n]=O(e),[o,s]=O(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new C(t,o,i,e)},G=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&P(r.bytes,t.bytes)}},C=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};function Fe(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var c=r.length,d=r.charAt(0),M=Math.log(c)/Math.log(256),p=Math.log(256)/Math.log(c);function N(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var f=0,S=0,u=0,b=a.length;u!==b&&a[u]===0;)u++,f++;for(var g=(b-u)*p+1>>>0,l=new Uint8Array(g);u!==b;){for(var m=a[u],A=0,w=g-1;(m!==0||A<S)&&w!==-1;w--,A++)m+=256*l[w]>>>0,l[w]=m%c>>>0,m=m/c>>>0;if(m!==0)throw new Error("Non-zero carry");S=A,u++}for(var x=g-S;x!==g&&l[x]===0;)x++;for(var F=d.repeat(f);x<g;++x)F+=r.charAt(l[x]);return F}function k(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var f=0;if(a[f]!==" "){for(var S=0,u=0;a[f]===d;)S++,f++;for(var b=(a.length-f)*M+1>>>0,g=new Uint8Array(b);a[f];){var l=t[a.charCodeAt(f)];if(l===255)return;for(var m=0,A=b-1;(l!==0||m<u)&&A!==-1;A--,m++)l+=c*g[A]>>>0,g[A]=l%256>>>0,l=l/256>>>0;if(l!==0)throw new Error("Non-zero carry");u=m,f++}if(a[f]!==" "){for(var w=b-u;w!==b&&g[w]===0;)w++;for(var x=new Uint8Array(S+(b-w)),F=S;w!==b;)x[F++]=g[w++];return x}}}function de(a){var f=k(a);if(f)return f;throw new Error(`Non-${e} character`)}return{encode:N,decodeUnsafe:k,decode:de}}var qe=Fe,Re=qe,oe=Re;var X=class{constructor(e,t,n){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")}},K=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){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))}else throw Error("Can only multibase decode strings")}or(e){return se(this,e)}},W=class{constructor(e){this.decoders=e}or(e){return se(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},se=(r,e)=>new W({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Z=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new X(e,t,n),this.decoder=new K(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ie=({name:r,prefix:e,encode:t,decode:n})=>new Z(r,e,t,n),Y=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=oe(t,e);return ie({prefix:r,name:e,encode:n,decode:s=>z(o(s))})},Je=(r,e,t,n)=>{let o={};for(let p=0;p<e.length;++p)o[e[p]]=p;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),c=0,d=0,M=0;for(let p=0;p<s;++p){let N=o[r[p]];if(N===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<t|N,c+=t,c>=8&&(c-=8,i[M++]=255&d>>c)}if(c>=t||255&d<<8-c)throw new SyntaxError("Unexpected end of data");return i},Pe=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,c=0;for(let d=0;d<r.length;++d)for(c=c<<8|r[d],i+=8;i>t;)i-=t,s+=e[o&c>>i];if(i&&(s+=e[o&c<<t-i]),n)for(;s.length*t&7;)s+="=";return s},y=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>ie({prefix:e,name:r,encode(o){return Pe(o,n,t)},decode(o){return Je(o,n,t,r)}});var v=Y({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),it=Y({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var $=y({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ht=y({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),dt=y({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ft=y({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pt=y({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),lt=y({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ut=y({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),wt=y({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),bt=y({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ae=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return Qe(t,H(r),e||v.encoder);default:return Ge(t,H(r),e||$.encoder)}};var ce=new WeakMap,H=r=>{let e=ce.get(r);if(e==null){let t=new Map;return ce.set(r,t),t}return e},h=class{constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==I)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Xe)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return h.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=V(e,t);return h.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return h.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&G(e.multihash,n.multihash)}toString(e){return ae(this,e)}toJSON(){return{"/":ae(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof h)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new h(n,o,s,i||he(n,o,s.bytes))}else if(t[Ke]===!0){let{version:n,multihash:o,code:s}=t,i=Q(o);return h.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==I)throw new Error(`Version 0 CID must use dag-pb (code: ${I}) block encoding`);return new h(e,t,n,n.bytes)}case 1:{let o=he(e,t,n.bytes);return new h(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return h.create(0,I,e)}static createV1(e,t){return h.create(1,e,t)}static decode(e){let[t,n]=h.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=h.inspectBytes(e),n=t.size-t.multihashSize,o=z(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new C(t.multihashCode,t.digestSize,s,o);return[t.version===0?h.createV0(i):h.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[N,k]=O(e.subarray(t));return t+=k,N},o=n(),s=I;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,c=n(),d=n(),M=t+d,p=M-i;return{version:o,codec:s,multihashCode:c,digestSize:d,multihashSize:p,size:M}}static parse(e,t){let[n,o]=je(e,t),s=h.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return H(s).set(n,e),s}},je=(r,e)=>{switch(r[0]){case"Q":{let t=e||v;return[v.prefix,t.decode(`${v.prefix}${r}`)]}case v.prefix:{let t=e||v;return[v.prefix,t.decode(r)]}case $.prefix:{let t=e||$;return[$.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},Qe=(r,e,t)=>{let{prefix:n}=t;if(n!==v.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o},Ge=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o},I=112,Xe=18,he=(r,e,t)=>{let n=U(r),o=n+U(e),s=new Uint8Array(o+t.byteLength);return E(r,s,0),E(e,s,n),s.set(t,o),s},Ke=Symbol.for("@ipld/js-cid/CID");var _={};D(_,{Hasher:()=>q,from:()=>We});var We=({name:r,code:e,encode:t})=>new q(r,e,t),q=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?V(this.code,t):t.then(n=>V(this.code,n))}else throw Error("Unknown type, must be binary type")}};return we(Ze);})();
"use strict";var Multiformats=(()=>{var R=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var le=Object.prototype.hasOwnProperty;var N=(r,e)=>{for(var t in e)R(r,t,{get:e[t],enumerable:!0})},ue=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of pe(e))!le.call(r,o)&&o!==t&&R(r,o,{get:()=>e[o],enumerable:!(n=fe(e,o))||n.enumerable});return r};var we=r=>ue(R({},"__esModule",{value:!0}),r);var Ze={};N(Ze,{CID:()=>F,bytes:()=>P,digest:()=>T,hasher:()=>_,varint:()=>L});var P={};N(P,{coerce:()=>S,empty:()=>ee,equals:()=>J,fromHex:()=>ge,fromString:()=>ye,isBinary:()=>me,toHex:()=>be,toString:()=>xe});var ee=new Uint8Array(0),be=r=>r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),ge=r=>{let e=r.match(/../g);return e?new Uint8Array(e.map(t=>parseInt(t,16))):ee},J=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},S=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},me=r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),ye=r=>new TextEncoder().encode(r),xe=r=>new TextDecoder().decode(r);function ve(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var c=r.length,h=r.charAt(0),D=Math.log(c)/Math.log(256),f=Math.log(256)/Math.log(c);function z(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var d=0,A=0,l=0,w=a.length;l!==w&&a[l]===0;)l++,d++;for(var b=(w-l)*f+1>>>0,p=new Uint8Array(b);l!==w;){for(var g=a[l],v=0,u=b-1;(g!==0||v<A)&&u!==-1;u--,v++)g+=256*p[u]>>>0,p[u]=g%c>>>0,g=g/c>>>0;if(g!==0)throw new Error("Non-zero carry");A=v,l++}for(var y=b-A;y!==b&&p[y]===0;)y++;for(var k=h.repeat(d);y<b;++y)k+=r.charAt(p[y]);return k}function $(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var d=0;if(a[d]!==" "){for(var A=0,l=0;a[d]===h;)A++,d++;for(var w=(a.length-d)*D+1>>>0,b=new Uint8Array(w);a[d];){var p=t[a.charCodeAt(d)];if(p===255)return;for(var g=0,v=w-1;(p!==0||g<l)&&v!==-1;v--,g++)p+=c*b[v]>>>0,b[v]=p%256>>>0,p=p/256>>>0;if(p!==0)throw new Error("Non-zero carry");l=g,d++}if(a[d]!==" "){for(var u=w-l;u!==w&&b[u]===0;)u++;for(var y=new Uint8Array(A+(w-u)),k=A;u!==w;)y[k++]=b[u++];return y}}}function de(a){var d=$(a);if(d)return d;throw new Error(`Non-${e} character`)}return{encode:z,decodeUnsafe:$,decode:de}}var Ae=ve,Se=Ae,te=Se;var j=class{constructor(e,t,n){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")}},Q=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){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))}else throw Error("Can only multibase decode strings")}or(e){return re(this,e)}},G=class{constructor(e){this.decoders=e}or(e){return re(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},re=(r,e)=>new G({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),X=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new j(e,t,n),this.decoder=new Q(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ne=({name:r,prefix:e,encode:t,decode:n})=>new X(r,e,t,n),K=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=te(t,e);return ne({prefix:r,name:e,encode:n,decode:s=>S(o(s))})},Ee=(r,e,t,n)=>{let o={};for(let f=0;f<e.length;++f)o[e[f]]=f;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),c=0,h=0,D=0;for(let f=0;f<s;++f){let z=o[r[f]];if(z===void 0)throw new SyntaxError(`Non-${n} character`);h=h<<t|z,c+=t,c>=8&&(c-=8,i[D++]=255&h>>c)}if(c>=t||255&h<<8-c)throw new SyntaxError("Unexpected end of data");return i},Ce=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,c=0;for(let h=0;h<r.length;++h)for(c=c<<8|r[h],i+=8;i>t;)i-=t,s+=e[o&c>>i];if(i&&(s+=e[o&c<<t-i]),n)for(;s.length*t&7;)s+="=";return s},m=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>ne({prefix:e,name:r,encode(o){return Ce(o,n,t)},decode(o){return Ee(o,n,t,r)}});var O=m({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),nt=m({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ot=m({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),st=m({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),it=m({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),at=m({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ct=m({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ht=m({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),dt=m({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var x=K({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),lt=K({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var T={};N(T,{Digest:()=>U,create:()=>M,decode:()=>Z,equals:()=>Y});var L={};N(L,{decode:()=>I,encodeTo:()=>E,encodingLength:()=>C});var Ue=ie,oe=128,De=127,ze=~De,Ie=Math.pow(2,31);function ie(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Ie;)e[t++]=r&255|oe,r/=128;for(;r&ze;)e[t++]=r&255|oe,r>>>=7;return e[t]=r|0,ie.bytes=t-n+1,e}var Me=W,Ne=128,se=127;function W(r,n){var t=0,n=n||0,o=0,s=n,i,c=r.length;do{if(s>=c)throw W.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&se)<<o:(i&se)*Math.pow(2,o),o+=7}while(i>=Ne);return W.bytes=s-n,t}var Oe=Math.pow(2,7),Ve=Math.pow(2,14),Le=Math.pow(2,21),Te=Math.pow(2,28),Be=Math.pow(2,35),$e=Math.pow(2,42),ke=Math.pow(2,49),Fe=Math.pow(2,56),qe=Math.pow(2,63),Re=function(r){return r<Oe?1:r<Ve?2:r<Le?3:r<Te?4:r<Be?5:r<$e?6:r<ke?7:r<Fe?8:r<qe?9:10},Je={encode:Ue,decode:Me,encodingLength:Re},Pe=Je,V=Pe;var I=(r,e=0)=>[V.decode(r,e),V.decode.bytes],E=(r,e,t=0)=>(V.encode(r,e,t),e),C=r=>V.encodingLength(r);var M=(r,e)=>{let t=e.byteLength,n=C(r),o=n+C(t),s=new Uint8Array(o+t);return E(r,s,0),E(t,s,n),s.set(e,o),new U(r,t,e,s)},Z=r=>{let e=S(r),[t,n]=I(e),[o,s]=I(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new U(t,o,i,e)},Y=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&J(r.bytes,t.bytes)}},U=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var ae=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return Qe(t,H(r),e||x.encoder);default:return Ge(t,H(r),e||O.encoder)}};var ce=new WeakMap,H=r=>{let e=ce.get(r);if(e==null){let t=new Map;return ce.set(r,t),t}return e},F=class r{constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==B)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Xe)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=M(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&Y(e.multihash,n.multihash)}toString(e){return ae(this,e)}toJSON(){return{"/":ae(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new r(n,o,s,i||he(n,o,s.bytes))}else if(t[Ke]===!0){let{version:n,multihash:o,code:s}=t,i=Z(o);return r.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==B)throw new Error(`Version 0 CID must use dag-pb (code: ${B}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=he(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,B,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=S(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new U(t.multihashCode,t.digestSize,s,o);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[z,$]=I(e.subarray(t));return t+=$,z},o=n(),s=B;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,c=n(),h=n(),D=t+h,f=D-i;return{version:o,codec:s,multihashCode:c,digestSize:h,multihashSize:f,size:D}}static parse(e,t){let[n,o]=je(e,t),s=r.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return H(s).set(n,e),s}},je=(r,e)=>{switch(r[0]){case"Q":{let t=e||x;return[x.prefix,t.decode(`${x.prefix}${r}`)]}case x.prefix:{let t=e||x;return[x.prefix,t.decode(r)]}case O.prefix:{let t=e||O;return[O.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},Qe=(r,e,t)=>{let{prefix:n}=t;if(n!==x.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o},Ge=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o},B=112,Xe=18,he=(r,e,t)=>{let n=C(r),o=n+C(e),s=new Uint8Array(o+t.byteLength);return E(r,s,0),E(e,s,n),s.set(t,o),s},Ke=Symbol.for("@ipld/js-cid/CID");var _={};N(_,{Hasher:()=>q,from:()=>We});var We=({name:r,code:e,encode:t})=>new q(r,e,t),q=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?M(this.code,t):t.then(n=>M(this.code,n))}else throw Error("Unknown type, must be binary type")}};return we(Ze);})();
return Multiformats}));
{
"Codec": "https://multiformats.github.io/js-multiformats/classes/bases_base10._internal_.Codec.html",
"ComposedDecoder": "https://multiformats.github.io/js-multiformats/classes/bases_base10._internal_.ComposedDecoder.html",
"Decoder": "https://multiformats.github.io/js-multiformats/classes/bases_base10._internal_.Decoder.html",
"Encoder": "https://multiformats.github.io/js-multiformats/classes/bases_base10._internal_.Encoder.html",
"Decoders": "https://multiformats.github.io/js-multiformats/types/bases_base10._internal_.Decoders.html",
"base10": "https://multiformats.github.io/js-multiformats/variables/bases_base10.base10.html",

@@ -30,2 +25,7 @@ "base16": "https://multiformats.github.io/js-multiformats/variables/bases_base16.base16.html",

"base8": "https://multiformats.github.io/js-multiformats/variables/bases_base8.base8.html",
"Codec": "https://multiformats.github.io/js-multiformats/classes/bases_identity._internal_.Codec.html",
"ComposedDecoder": "https://multiformats.github.io/js-multiformats/classes/bases_identity._internal_.ComposedDecoder.html",
"Decoder": "https://multiformats.github.io/js-multiformats/classes/bases_identity._internal_.Decoder.html",
"Encoder": "https://multiformats.github.io/js-multiformats/classes/bases_identity._internal_.Encoder.html",
"Decoders": "https://multiformats.github.io/js-multiformats/types/bases_identity._internal_.Decoders.html",
"identity": "https://multiformats.github.io/js-multiformats/variables/bases_identity.identity.html",

@@ -71,2 +71,3 @@ "bases": "https://multiformats.github.io/js-multiformats/variables/basics.bases.html",

"BlockEncoder": "https://multiformats.github.io/js-multiformats/interfaces/index.BlockEncoder.html",
"BlockView": "https://multiformats.github.io/js-multiformats/interfaces/index.BlockView.html",
"CombobaseDecoder": "https://multiformats.github.io/js-multiformats/interfaces/index.CombobaseDecoder.html",

@@ -92,4 +93,3 @@ "LegacyLink": "https://multiformats.github.io/js-multiformats/interfaces/index.LegacyLink.html",

"parse": "https://multiformats.github.io/js-multiformats/functions/link.parse.html",
"BlockView": "https://multiformats.github.io/js-multiformats/interfaces/traversal.BlockView.html",
"walk": "https://multiformats.github.io/js-multiformats/functions/traversal.walk.html"
}

@@ -54,3 +54,3 @@ export function or<L extends string, R extends string>(left: API.UnibaseDecoder<L> | API.CombobaseDecoder<L>, right: API.UnibaseDecoder<R> | API.CombobaseDecoder<R>): ComposedDecoder<L | R>;

export type Decoders<Prefix extends string> = Record<Prefix, API.UnibaseDecoder<Prefix>>;
import * as API from "./interface.js";
import * as API from './interface.js';
/**

@@ -57,0 +57,0 @@ * @template {string} Prefix

@@ -1,6 +0,6 @@

import { CID } from "./index.js";
import { hasher } from "./index.js";
import { digest } from "./index.js";
import { varint } from "./index.js";
import { bytes } from "./index.js";
import { CID } from './index.js';
import { hasher } from './index.js';
import { digest } from './index.js';
import { varint } from './index.js';
import { bytes } from './index.js';
export const hashes: {

@@ -46,5 +46,5 @@ identity: {

}
import * as raw from "./codecs/raw.js";
import * as json from "./codecs/json.js";
import * as raw from './codecs/raw.js';
import * as json from './codecs/json.js';
export { CID, hasher, digest, varint, bytes };
//# sourceMappingURL=basics.d.ts.map

@@ -96,4 +96,4 @@ export type RequiredCreateOptions = {

bytes: API.ByteView<T>;
value: T;
asBlock: Block<T, C, A, V>;
value: T & ({} | null);
asBlock: this;
links(): Iterable<[string, CID<any, number, number, API.Version>]>;

@@ -108,4 +108,4 @@ tree(): Iterable<string>;

}
import * as API from "./interface.js";
import { CID } from "./index.js";
import * as API from './interface.js';
import { CID } from './index.js';
//# sourceMappingURL=block.d.ts.map

@@ -1,3 +0,3 @@

import { Link, Version } from '../link/interface.js';
import { CID } from '../cid.js';
import type { CID } from '../cid.js';
import type { Link, Version } from '../link/interface.js';
/**

@@ -4,0 +4,0 @@ * A byte-encoded representation of some type of `Data`.

@@ -150,3 +150,2 @@ export * from "./link/interface.js";

* @param {Uint8Array} bytes
*
*/

@@ -170,3 +169,3 @@ constructor(version: Version, code: Format, multihash: API.MultihashDigest<Alg>, bytes: Uint8Array);

*/
get asCID(): CID<Data, Format, Alg, Version>;
get asCID(): this;
get byteOffset(): number;

@@ -192,6 +191,7 @@ get byteLength(): number;

toString(base?: API.MultibaseEncoder<string> | undefined): string;
toJSON(): {
'/': API.ToString<CID<Data, Format, Alg, Version>, string>;
};
link(): CID<Data, Format, Alg, Version>;
/**
* @returns {API.LinkJSON<this>}
*/
toJSON(): API.LinkJSON<this>;
link(): this;
get [Symbol.toStringTag](): string;

@@ -198,0 +198,0 @@ }

@@ -34,3 +34,3 @@ export function from<Name extends string, Code extends number>({ name, code, encode }: {

export type Await<T> = Promise<T> | T;
import * as Digest from "./digest.js";
import * as Digest from './digest.js';
//# sourceMappingURL=hasher.d.ts.map

@@ -16,4 +16,4 @@ export namespace identity {

declare function digest(input: Uint8Array): Digest.Digest<typeof code, number>;
import * as Digest from "./digest.js";
import * as Digest from './digest.js';
export {};
//# sourceMappingURL=identity.d.ts.map
export * from "./interface.js";
import { CID } from "./cid.js";
import * as hasher from "./hashes/hasher.js";
import * as digest from "./hashes/digest.js";
import * as varint from "./varint.js";
import * as bytes from "./bytes.js";
import { CID } from './cid.js';
import * as hasher from './hashes/hasher.js';
import * as digest from './hashes/digest.js';
import * as varint from './varint.js';
import * as bytes from './bytes.js';
export { CID, hasher, digest, varint, bytes };
//# sourceMappingURL=index.d.ts.map

@@ -9,7 +9,7 @@ export * from "./link/interface.js";

declare const SHA_256_CODE: 18;
import { CID } from "./cid.js";
import { format } from "./cid.js";
import { toJSON } from "./cid.js";
import { fromJSON } from "./cid.js";
import { CID } from './cid.js';
import { format } from './cid.js';
import { toJSON } from './cid.js';
import { fromJSON } from './cid.js';
export { format, toJSON, fromJSON };
//# sourceMappingURL=link.d.ts.map

@@ -1,4 +0,4 @@

import type { MultihashDigest } from '../hashes/interface.js';
import type { MultibaseEncoder, MultibaseDecoder, Multibase } from '../bases/interface.js';
import type { Phantom, ByteView } from '../block/interface.js';
import type { MultihashDigest } from '../hashes/interface.js';
export type { MultihashDigest, MultibaseEncoder, MultibaseDecoder };

@@ -5,0 +5,0 @@ export type Version = 0 | 1;

@@ -1,15 +0,8 @@

export type CID<C = number, A = number, V = 0 | 1> = import('./cid').CID<unknown, C, A, V>;
export type BlockView<T = unknown, C = number, A = number, V = 0 | 1> = import('./block/interface.js').BlockView<T, C, A, V>;
export type CID = import('./cid').CID;
export type BlockView = import('./block/interface.js').BlockView;
/**
* @template [C=number] - multicodec code corresponding to codec used to encode the block
* @template [A=number] - multicodec code corresponding to the hashing algorithm used in CID creation.
* @template [V=0|1] - CID version
* @typedef {import('./cid').CID<unknown, C, A, V>} CID
* @typedef {import('./cid').CID} CID
*/
/**
* @template [T=unknown] - Logical type of the data encoded in the block
* @template [C=number] - multicodec code corresponding to codec used to encode the block
* @template [A=number] - multicodec code corresponding to the hashing algorithm used in CID creation.
* @template [V=0|1] - CID version
* @typedef {import('./block/interface.js').BlockView<T, C, A, V>} BlockView
* @typedef {import('./block/interface.js').BlockView} BlockView
*/

@@ -16,0 +9,0 @@ /**

{
"name": "multiformats",
"version": "12.0.1",
"version": "12.0.2",
"description": "Interface for multihash, multicodec, multibase and CID",

@@ -287,3 +287,3 @@ "author": "Mikeal Rogers <mikeal.rogers@gmail.com> (https://www.mikealrogers.com/)",

"@types/node": "^20.3.1",
"aegir": "^37.7.5",
"aegir": "^40.0.11",
"buffer": "^6.0.3",

@@ -290,0 +290,0 @@ "cids": "^1.1.9"

// @ts-check
import { fromString, toString } from '../bytes.js'
import { from } from './base.js'
import { fromString, toString } from '../bytes.js'

@@ -6,0 +6,0 @@ export const identity = from({

// @ts-check
import * as identityBase from './bases/identity.js'
import * as base2 from './bases/base2.js'
import * as base8 from './bases/base8.js'
import * as base10 from './bases/base10.js'
import * as base16 from './bases/base16.js'
import * as base2 from './bases/base2.js'
import * as base256emoji from './bases/base256emoji.js'
import * as base32 from './bases/base32.js'

@@ -12,9 +11,8 @@ import * as base36 from './bases/base36.js'

import * as base64 from './bases/base64.js'
import * as base256emoji from './bases/base256emoji.js'
import * as base8 from './bases/base8.js'
import * as identityBase from './bases/identity.js'
import * as json from './codecs/json.js'
import * as raw from './codecs/raw.js'
import * as identity from './hashes/identity.js'
import * as sha2 from './hashes/sha2.js'
import * as identity from './hashes/identity.js'
import * as raw from './codecs/raw.js'
import * as json from './codecs/json.js'
import { CID, hasher, digest, varint, bytes } from './index.js'

@@ -21,0 +19,0 @@

/* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */
/* eslint-disable no-use-before-define */
import { Link, Version } from '../link/interface.js'
import { CID } from '../cid.js'
import type { CID } from '../cid.js'
import type { Link, Version } from '../link/interface.js'
/**

@@ -7,0 +8,0 @@ * A byte-encoded representation of some type of `Data`.

@@ -1,9 +0,9 @@

import * as varint from './varint.js'
import * as Digest from './hashes/digest.js'
import { base32 } from './bases/base32.js'
import { base58btc } from './bases/base58.js'
import { base32 } from './bases/base32.js'
import { coerce } from './bytes.js'
import * as Digest from './hashes/digest.js'
// Linter can see that API is used in types.
// eslint-disable-next-line
import * as API from "./link/interface.js"
import * as varint from './varint.js'

@@ -85,3 +85,2 @@ // This way TS will also expose all the types from module

* @param {Uint8Array} bytes
*
*/

@@ -219,2 +218,5 @@ constructor (version, code, multihash, bytes) {

/**
* @returns {API.LinkJSON<this>}
*/
toJSON () {

@@ -221,0 +223,0 @@ return { '/': format(this) }

// @ts-check
import crypto from 'crypto'
import { coerce } from '../bytes.js'
import { from } from './hasher.js'
import { coerce } from '../bytes.js'

@@ -7,0 +7,0 @@ export const sha256 = from({

@@ -0,6 +1,7 @@

import * as bytes from './bytes.js'
import { CID } from './cid.js'
import * as digest from './hashes/digest.js'
import * as hasher from './hashes/hasher.js'
import * as varint from './varint.js'
import * as bytes from './bytes.js'
import * as hasher from './hashes/hasher.js'
import * as digest from './hashes/digest.js'
// This way TS will also expose all the types from module

@@ -7,0 +8,0 @@ export * from './interface.js'

@@ -0,5 +1,5 @@

import { CID, format, toJSON, fromJSON } from './cid.js'
// Linter can see that API is used in types.
// eslint-disable-next-line
import * as API from "./link/interface.js"
import { CID, format, toJSON, fromJSON } from './cid.js'
// This way TS will also expose all the types from module

@@ -6,0 +6,0 @@ export * from './link/interface.js'

/* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */
/* eslint-disable no-use-before-define */
import type { MultihashDigest } from '../hashes/interface.js'
import type { MultibaseEncoder, MultibaseDecoder, Multibase } from '../bases/interface.js'
import type { Phantom, ByteView } from '../block/interface.js'
import type { MultihashDigest } from '../hashes/interface.js'

@@ -7,0 +8,0 @@ export type { MultihashDigest, MultibaseEncoder, MultibaseDecoder }

import { base58btc } from './bases/base58.js'
/**
* @template [C=number] - multicodec code corresponding to codec used to encode the block
* @template [A=number] - multicodec code corresponding to the hashing algorithm used in CID creation.
* @template [V=0|1] - CID version
* @typedef {import('./cid').CID<unknown, C, A, V>} CID
* @typedef {import('./cid').CID} CID
*/
/**
* @template [T=unknown] - Logical type of the data encoded in the block
* @template [C=number] - multicodec code corresponding to codec used to encode the block
* @template [A=number] - multicodec code corresponding to the hashing algorithm used in CID creation.
* @template [V=0|1] - CID version
* @typedef {import('./block/interface.js').BlockView<T, C, A, V>} BlockView
* @typedef {import('./block/interface.js').BlockView} BlockView
*/

@@ -17,0 +10,0 @@

/* globals describe, it */
import { assert } from 'aegir/chai'
import * as main from '../src/block.js'
import * as codec from '../src/codecs/json.js'
import { sha256 as hasher } from '../src/hashes/sha2.js'
import * as main from '../src/block.js'
import { CID, bytes } from '../src/index.js'
import { assert } from 'aegir/chai'

@@ -8,0 +9,0 @@ const fixture = { hello: 'world' }

/* globals describe, it */
import { assert } from 'aegir/chai'
import * as bytes from '../src/bytes.js'
import { assert } from 'aegir/chai'

@@ -5,0 +6,0 @@ describe('bytes', () => {

/* globals describe, it */
import { fromHex, toHex, equals } from '../src/bytes.js'
import { varint, CID } from '../src/index.js'
import { assert } from 'aegir/chai'
import OLDCID from 'cids'
// Linter can see that API is used in types.
// eslint-disable-next-line
import * as API from 'multiformats'
import { base32 } from '../src/bases/base32.js'
import { base58btc } from '../src/bases/base58.js'
import { base32 } from '../src/bases/base32.js'
import { base64 } from '../src/bases/base64.js'
import { fromHex, toHex, equals } from '../src/bytes.js'
import { sha256, sha512 } from '../src/hashes/sha2.js'
import { varint, CID } from '../src/index.js'
import invalidMultihash from './fixtures/invalid-multihash.js'
import OLDCID from 'cids'
import { assert } from 'aegir/chai'
// Linter can see that API is used in types.
// eslint-disable-next-line
import * as API from 'multiformats'

@@ -16,0 +16,0 @@ const textEncoder = new TextEncoder()

/* globals describe, it */
import * as Link from '../src/link.js'
import { assert } from 'aegir/chai'
import { sha256 } from '../src/hashes/sha2.js'
import * as Link from '../src/link.js'

@@ -7,0 +7,0 @@ const utf8 = new TextEncoder()

/* eslint-env mocha */
import { assert } from 'aegir/chai'
import { bases } from '../src/basics.js'
import { fromString } from '../src/bytes.js'
import { assert } from 'aegir/chai'

@@ -7,0 +7,0 @@ const encoded = [

/* globals describe, it */
import * as bytes from '../src/bytes.js'
import * as b2 from '../src/bases/base2.js'
import * as b8 from '../src/bases/base8.js'
import { assert } from 'aegir/chai'
import * as b10 from '../src/bases/base10.js'
import * as b16 from '../src/bases/base16.js'
import * as b2 from '../src/bases/base2.js'
import * as b32 from '../src/bases/base32.js'

@@ -11,3 +11,4 @@ import * as b36 from '../src/bases/base36.js'

import * as b64 from '../src/bases/base64.js'
import { assert } from 'aegir/chai'
import * as b8 from '../src/bases/base8.js'
import * as bytes from '../src/bytes.js'

@@ -14,0 +15,0 @@ const { base16, base32, base58btc, base64 } = { ...b16, ...b32, ...b58, ...b64 }

/* globals describe, it */
import { assert } from 'aegir/chai'
import * as bytes from '../src/bytes.js'
import * as json from '../src/codecs/json.js'
import * as raw from '../src/codecs/raw.js'
import * as json from '../src/codecs/json.js'
import { assert } from 'aegir/chai'

@@ -7,0 +8,0 @@ describe('multicodec', () => {

/* globals describe, it */
import { hash as slSha256 } from '@stablelib/sha256'
import { hash as slSha512 } from '@stablelib/sha512'
import { assert } from 'aegir/chai'
import { fromHex, fromString } from '../src/bytes.js'
import { decode as decodeDigest, create as createDigest } from '../src/hashes/digest.js'
import { identity } from '../src/hashes/identity.js'
import { sha256, sha512 } from '../src/hashes/sha2.js'
import { identity } from '../src/hashes/identity.js'
import { decode as decodeDigest, create as createDigest } from '../src/hashes/digest.js'
import invalid from './fixtures/invalid-multihash.js'
import valid from './fixtures/valid-multihash.js'
import invalid from './fixtures/invalid-multihash.js'
import { hash as slSha256 } from '@stablelib/sha256'
import { hash as slSha512 } from '@stablelib/sha512'
import { assert } from 'aegir/chai'

@@ -12,0 +13,0 @@ /**

/* globals describe, it */
import { assert } from 'aegir/chai'
import * as main from '../src/block.js'
import { fromString } from '../src/bytes.js'
import * as codec from '../src/codecs/json.js'
import { sha256 as hasher } from '../src/hashes/sha2.js'
import * as main from '../src/block.js'
import { walk } from '../src/traversal.js'
import { fromString } from '../src/bytes.js'
import { assert } from 'aegir/chai'

@@ -9,0 +10,0 @@ /** @typedef {import('../src/cid.js').CID} CID */

/* globals describe, it */
import { assert } from 'aegir/chai'
import { varint } from '../src/index.js'
import { assert } from 'aegir/chai'

@@ -6,0 +6,0 @@ const UTF8 = new TextEncoder()

import * as Block from 'multiformats/block'
import * as json from 'multiformats/codecs/json'
import { sha256 } from 'multiformats/hashes/sha2'
import * as json from 'multiformats/codecs/json'
const main = async () => {
const main = async (): Promise<void> => {
const block = await Block.encode({

@@ -7,0 +7,0 @@ value: { hello: 'world' },

@@ -6,3 +6,2 @@ {

"emitDeclarationOnly": true,
"importsNotUsedAsValues": "preserve",
"paths": {

@@ -27,2 +26,2 @@ "multiformats": [

]
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc