@blockcerts/blockcerts-verifier 1.70.1 → 1.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle-stats.html +13 -13
- package/dist/DataIntegrityProof-elCNKq16-DBDuaDNt.js +7 -0
- package/dist/EcdsaSd2023-B0XPAIp6-K61axvBA.js +30 -0
- package/dist/EcdsaSecp256k1Signature2019-BHgoxmKI-DT2qHZod.js +1 -0
- package/dist/Ed25519Signature2020-BQsESRnS-TKZI_1AX.js +34 -0
- package/dist/EddsaRdfc2022-DQKzWHK4-BILzDBp-.js +14 -0
- package/dist/{HashlinkVerifier-mEn5oMxx-0x0OtiE4.js → HashlinkVerifier-BsVlaml5-B4Niv2-b.js} +2 -2
- package/dist/{MerkleProof2017-Cgbk--lC-CKvOfXrT.js → MerkleProof2017-CYM8CJHB-FYpMvld0.js} +1 -1
- package/dist/MerkleProof2019-BLrywo8h-Bo9rH2Eq.js +13 -0
- package/dist/{checkCredentialSchemaConformity-CuuMYTl6-DqE6I7JD.js → checkCredentialSchemaConformity-CKNtOu_t-B9iaCRUE.js} +1 -1
- package/dist/{controlVerificationMethod-C87jwGUr-CpVyq-8H.js → controlVerificationMethod-B4TgLED0-BGpxLjMq.js} +1 -1
- package/dist/{did-key-common.esm-D1RQn0yL-kJBnihy7.js → did-key-common.esm-BIftA62j-hVrUMxjy.js} +3 -3
- package/dist/{did-key-ed25519.esm-0v03exJh-COIOTeQ5.js → did-key-ed25519.esm-Drn3Y7PF-CqD0ifNk.js} +1 -1
- package/dist/{did-key-secp256k1.esm-Cs0ZCHjg-B35GrJww.js → did-key-secp256k1.esm-DH-f3o5q-C66E7IxB.js} +1 -1
- package/dist/{downloadPDF-CWa3ZYVl.js → downloadPDF-eGAsbwF0.js} +1 -1
- package/dist/ed25519-key-pair.esm-DPOFpdJ2-BrwuS0Ia.js +25 -0
- package/dist/{elliptic-HXNc7riQ-DrFZxkx3.js → elliptic-4aZS_cwf-BpaNaVm0.js} +1 -1
- package/dist/elliptic-BYqApR8Y-CKp7atgR.js +1 -0
- package/dist/{index-BJkS6Wwm-C8oVP6LM.js → index-BgTFEYQ4-DMaz98iZ.js} +7 -7
- package/dist/index-lyuTDW_o-nyi7dklX.js +1 -0
- package/dist/{index.es-kH7iskh8.js → index.es-B7xY76Pb.js} +2 -2
- package/dist/{jsonld-CMQE_cGn-899pOqB6.js → jsonld-B_Q2jvnp-BJ5uVeOU.js} +1 -1
- package/dist/{jsonld-signatures-ZtLxJmqT-B0W14Jb0.js → jsonld-signatures-BbILf-Q7-DTp6__ud.js} +1 -1
- package/dist/keyUtils-ExMI0fmg-NVOmd8LH.js +1 -0
- package/dist/main.js +116 -116
- package/dist/{retrieveVerificationMethodPublicKey-nmb3CCVx-DA6ovQri.js → retrieveVerificationMethodPublicKey-C5Gafl1E-Lv4waRy7.js} +1 -1
- package/dist/verifyIssuerProfile-DCJyz3ho-BwuCK9F3.js +1 -0
- package/dist/{x25519-CbZcE2Ac-NSl6svWQ.js → x25519-Kp6t9B5a-Dh8L0KYb.js} +1 -1
- package/package.json +4 -4
- package/dist/EcdsaSd2023-BDSl7Ei2-BKyD2rP9.js +0 -35
- package/dist/EcdsaSecp256k1Signature2019-Bk8_LQ8c-BqdRm-Jv.js +0 -1
- package/dist/Ed25519Signature2020-fyWut63D-R9eZ2oN0.js +0 -58
- package/dist/MerkleProof2019-Dhsn349H-DFyc-5gT.js +0 -3
- package/dist/elliptic-CRAl7yyq-DbLzV4aB.js +0 -1
- package/dist/verifyIssuerProfile-CYqfuwV1-DeQqsjiM.js +0 -1
- /package/dist/{checkRevocationStatusList2021-UjTyRcl_-BEBD8TO8.js → checkRevocationStatusList2021-CMAVXAVE-BEBD8TO8.js} +0 -0
- /package/dist/{ensureNotRevoked-CdrYFvh7-DvMIgM4L.js → ensureNotRevoked-hGps0prO-DvMIgM4L.js} +0 -0
- /package/dist/{ensureValidIssuingKey-n3jD_OlE-BdV46XBb.js → ensureValidIssuingKey-BMVCi2T2-BdV46XBb.js} +0 -0
- /package/dist/{index-BcfLkJHS-Dgus2xdV.js → index-BS134367-Dgus2xdV.js} +0 -0
- /package/dist/{index-DYND9Svl-C0eXpZGn.js → index-CQYVZlSE-C0eXpZGn.js} +0 -0
- /package/dist/{sha256-CN3v2fAD-C1PUWFZm.js → sha256-u2xsd4MQ-C1PUWFZm.js} +0 -0
- /package/dist/{webcrypto.es-hNUMWa8--BnVhHKeM.js → webcrypto.es-DpqeDikX-BnVhHKeM.js} +0 -0
|
@@ -284,7 +284,7 @@ function(A){var t=function(A){for(var t=A.length,e=new Uint8Array(t),r=0;r<t;r++
|
|
|
284
284
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
285
285
|
* ====================================================================
|
|
286
286
|
*/
|
|
287
|
-
function(){function A(){return(AA.canvg?Promise.resolve(AA.canvg):import("./index.es-
|
|
287
|
+
function(){function A(){return(AA.canvg?Promise.resolve(AA.canvg):import("./index.es-B7xY76Pb.js")).catch((function(A){return Promise.reject(new Error("Could not load canvg: "+A))})).then((function(A){return A.default?A.default:A}))}SA.API.addSvgAsImage=function(t,e,r,n,i,o,s,a){if(isNaN(e)||isNaN(r))throw eA.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(i))throw eA.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var c=document.createElement("canvas");c.width=n,c.height=i;var u=c.getContext("2d");u.fillStyle="#fff",u.fillRect(0,0,c.width,c.height);var l={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},h=this;return A().then((function(A){return A.fromString(u,t,l)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(A){return A.render(l)})).then((function(){h.addImage(c.toDataURL("image/jpeg",1),e,r,n,i,s,a)}))}}(),SA.API.putTotalPages=function(A){var t,e=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(A,"g"),e=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(A,this.internal.getFont()),"g"),e=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var n=0;n<this.internal.pages[r].length;n++)this.internal.pages[r][n]=this.internal.pages[r][n].replace(t,e);return this},SA.API.viewerPreferences=function(A,t){var e;A=A||{},t=t||!1;var r,n,i,o={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},a=Object.keys(o),c=[],u=0,l=0,h=0;function f(A,t){var e,r=!1;for(e=0;e<A.length;e+=1)A[e]===t&&(r=!0);return r}if(void 0===this.internal.viewerpreferences&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),e=this.internal.viewerpreferences.configuration,"reset"===A||!0===t){var B=a.length;for(h=0;h<B;h+=1)e[a[h]].value=e[a[h]].defaultValue,e[a[h]].explicitSet=!1}if("object"===s(A))for(n in A)if(i=A[n],f(a,n)&&void 0!==i){if("boolean"===e[n].type&&"boolean"==typeof i)e[n].value=i;else if("name"===e[n].type&&f(e[n].valueSet,i))e[n].value=i;else if("integer"===e[n].type&&Number.isInteger(i))e[n].value=i;else if("array"===e[n].type){for(u=0;u<i.length;u+=1)if(r=!0,1===i[u].length&&"number"==typeof i[u][0])c.push(String(i[u]-1));else if(i[u].length>1){for(l=0;l<i[u].length;l+=1)"number"!=typeof i[u][l]&&(r=!1);!0===r&&c.push([i[u][0]-1,i[u][1]-1].join(" "))}e[n].value="["+c.join(" ")+"]"}else e[n].value=e[n].defaultValue;e[n].explicitSet=!0}return!1===this.internal.viewerpreferences.isSubscribed&&(this.internal.events.subscribe("putCatalog",(function(){var A,t=[];for(A in e)!0===e[A].explicitSet&&("name"===e[A].type?t.push("/"+A+" /"+e[A].value):t.push("/"+A+" "+e[A].value));0!==t.length&&this.internal.write("/ViewerPreferences\n<<\n"+t.join("\n")+"\n>>")})),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=e,this
|
|
288
288
|
/** ====================================================================
|
|
289
289
|
* @license
|
|
290
290
|
* jsPDF XMP metadata plugin
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import{x as t,B as e,i as r}from"./main.js";import{d as n}from"./base64url-Cy03LJLt-vkTPfQOh.js";import{d as i,e as o}from"./index-DZLKRa_V-D_IQzjvG.js";import{_ as a}from"./tslib.es6--gQC4x5c-CmLYFWVC.js";import{e as c,x as s}from"./x25519-Kp6t9B5a-Dh8L0KYb.js";
|
|
2
|
+
/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */const u=BigInt(0),f=BigInt(1),l=BigInt(2),y=BigInt(8),p=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:p,n:p,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),d=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),w=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742");const v=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),g=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),b=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),m=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class x{constructor(t,e,r,n){this.x=t,this.y=e,this.z=r,this.t=n}static fromAffine(t){if(!(t instanceof U))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return t.equals(U.ZERO)?x.ZERO:new x(t.x,t.y,f,J(t.x*t.y))}static toAffineBatch(t){const e=function(t,e=h.P){const r=new Array(t.length),n=F(t.reduce(((t,n,i)=>n===u?t:(r[i]=t,J(t*n,e))),f),e);return t.reduceRight(((t,n,i)=>n===u?t:(r[i]=J(t*r[i],e),J(t*n,e))),n),r}(t.map((t=>t.z)));return t.map(((t,r)=>t.toAffine(e[r])))}static normalizeZ(t){return this.toAffineBatch(t).map(this.fromAffine)}equals(t){E(t);const{x:e,y:r,z:n}=this,{x:i,y:o,z:a}=t,c=J(e*a),s=J(i*n),u=J(r*a),f=J(o*n);return c===s&&u===f}negate(){return new x(J(-this.x),this.y,this.z,J(-this.t))}double(){const{x:t,y:e,z:r}=this,{a:n}=h,i=J(t*t),o=J(e*e),a=J(l*J(r*r)),c=J(n*i),s=t+e,u=J(J(s*s)-i-o),f=c+o,y=f-a,p=c-o,d=J(u*y),w=J(f*p),v=J(u*p),g=J(y*f);return new x(d,w,g,v)}add(t){E(t);const{x:e,y:r,z:n,t:i}=this,{x:o,y:a,z:c,t:s}=t,f=J((r-e)*(a+o)),y=J((r+e)*(a-o)),p=J(y-f);if(p===u)return this.double();const h=J(n*l*s),d=J(i*l*c),w=d+h,v=y+f,g=d-h,b=J(w*p),m=J(v*g),K=J(w*g),k=J(p*v);return new x(b,m,k,K)}subtract(t){return this.add(t.negate())}precomputeWindow(t){const e=1+256/t,r=[];let n=this,i=n;for(let o=0;o<e;o++){i=n,r.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(t,e){!e&&this.equals(x.BASE)&&(e=U.BASE);const r=e&&e._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=e&&P.get(e);n||(n=this.precomputeWindow(r),e&&1!==r&&(n=x.normalizeZ(n),P.set(e,n)));let i=x.ZERO,o=x.BASE;const a=1+256/r,c=2**(r-1),s=BigInt(2**r-1),u=2**r,l=BigInt(r);for(let e=0;e<a;e++){const r=e*c;let a=Number(t&s);t>>=l,a>c&&(a-=u,t+=f);const y=r,p=r+Math.abs(a)-1,h=e%2!=0,d=a<0;0===a?o=o.add(K(h,n[y])):i=i.add(K(d,n[p]))}return x.normalizeZ([i,o])[0]}multiply(t,e){return this.wNAF(q(t,h.l),e)}multiplyUnsafe(t){let e=q(t,h.l,!1);const r=x.BASE,n=x.ZERO;if(e===u)return n;if(this.equals(n)||e===f)return this;if(this.equals(r))return this.wNAF(e);let i=n,o=this;for(;e>u;)e&f&&(i=i.add(o)),o=o.double(),e>>=f;return i}isSmallOrder(){return this.multiplyUnsafe(h.h).equals(x.ZERO)}isTorsionFree(){let t=this.multiplyUnsafe(h.l/l).double();return h.l%l&&(t=t.add(this)),t.equals(x.ZERO)}toAffine(t){const{x:e,y:r,z:n}=this,i=this.equals(x.ZERO);null==t&&(t=i?y:F(n));const o=J(e*t),a=J(r*t),c=J(n*t);if(i)return U.ZERO;if(c!==f)throw new Error("invZ was invalid");return new U(o,a)}fromRistrettoBytes(){A()}toRistrettoBytes(){A()}fromRistrettoHash(){A()}}function K(t,e){const r=e.negate();return t?r:e}function E(t){if(!(t instanceof x))throw new TypeError("ExtendedPoint expected")}function k(t){if(!(t instanceof B))throw new TypeError("RistrettoPoint expected")}function A(){throw new Error("Legacy method: switch to RistrettoPoint")}x.BASE=new x(h.Gx,h.Gy,f,J(h.Gx*h.Gy)),x.ZERO=new x(u,f,f,u);class B{constructor(t){this.ep=t}static calcElligatorRistrettoMap(t){const{d:e}=h,r=J(w*t*t),n=J((r+f)*b);let i=BigInt(-1);const o=J((i-e*r)*J(r+e));let{isValid:a,value:c}=G(n,o),s=J(c*t);T(s)||(s=J(-s)),a||(c=s),a||(i=r);const u=J(i*(r-f)*m-o),l=c*c,y=J((c+c)*o),p=J(u*v),d=J(f-l),g=J(f+l);return new x(J(y*g),J(d*p),J(p*g),J(y*d))}static hashToCurve(t){const e=z((t=H(t,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(e),n=z(t.slice(32,64)),i=this.calcElligatorRistrettoMap(n);return new B(r.add(i))}static fromHex(t){t=H(t,32);const{a:e,d:r}=h,n="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",i=z(t);if(!function(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}(I(i),t)||T(i))throw new Error(n);const o=J(i*i),a=J(f+e*o),c=J(f-e*o),s=J(a*a),l=J(c*c),y=J(e*r*s-l),{isValid:p,value:d}=Z(J(y*l)),w=J(d*c),v=J(d*w*y);let g=J((i+i)*w);T(g)&&(g=J(-g));const b=J(a*v),m=J(g*b);if(!p||T(m)||b===u)throw new Error(n);return new B(new x(g,b,f,m))}toRawBytes(){let{x:t,y:e,z:r,t:n}=this.ep;const i=J(J(r+e)*J(r-e)),o=J(t*e),a=J(o*o),{value:c}=Z(J(i*a)),s=J(c*i),u=J(c*o),f=J(s*u*n);let l;if(T(n*f)){let r=J(e*w),n=J(t*w);t=r,e=n,l=J(s*g)}else l=u;T(t*f)&&(e=J(-e));let y=J((r-e)*l);return T(y)&&(y=J(-y)),I(y)}toHex(){return j(this.toRawBytes())}toString(){return this.toHex()}equals(t){k(t);const e=this.ep,r=t.ep,n=J(e.x*r.y)===J(e.y*r.x),i=J(e.y*r.y)===J(e.x*r.x);return n||i}add(t){return k(t),new B(this.ep.add(t.ep))}subtract(t){return k(t),new B(this.ep.subtract(t.ep))}multiply(t){return new B(this.ep.multiply(t))}multiplyUnsafe(t){return new B(this.ep.multiplyUnsafe(t))}}B.BASE=new B(x.BASE),B.ZERO=new B(x.ZERO);const P=new WeakMap;class U{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,P.delete(this)}static fromHex(t,e=!0){const{d:r,P:n}=h,i=(t=H(t,32)).slice();i[31]=-129&t[31];const o=R(i);if(e&&o>=n)throw new Error("Expected 0 < hex < P");if(!e&&o>=d)throw new Error("Expected 0 < hex < 2**256");const a=J(o*o),c=J(a-f),s=J(r*a+f);let{isValid:u,value:l}=G(c,s);if(!u)throw new Error("Point.fromHex: invalid y coordinate");const y=(l&f)===f;return!!(128&t[31])!==y&&(l=J(-l)),new U(l,o)}static async fromPrivateKey(t){return(await $(t)).point}toRawBytes(){const t=I(this.y);return t[31]|=this.x&f?128:0,t}toHex(){return j(this.toRawBytes())}toX25519(){const{y:t}=this;return I(J((f+t)*F(f-t)))}isTorsionFree(){return x.fromAffine(this).isTorsionFree()}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new U(J(-this.x),this.y)}add(t){return x.fromAffine(this).add(x.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return x.fromAffine(this).multiply(t,this).toAffine()}}U.BASE=new U(h.Gx,h.Gy),U.ZERO=new U(u,f);class L{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromHex(t){const e=H(t,64),r=U.fromHex(e.slice(0,32),!1),n=R(e.slice(32,64));return new L(r,n)}assertValidity(){const{r:t,s:e}=this;if(!(t instanceof U))throw new Error("Expected Point instance");return q(e,h.l,!1),this}toRawBytes(){const t=new Uint8Array(64);return t.set(this.r.toRawBytes()),t.set(I(this.s),32),t}toHex(){return j(this.toRawBytes())}}function O(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Expected Uint8Array list");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}const S=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function j(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=S[t[r]];return e}function _(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=2*r,i=t.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[r]=o}return e}function M(t){return _(t.toString(16).padStart(64,"0"))}function I(t){return M(t).reverse()}function T(t){return(J(t)&f)===f}function R(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+j(Uint8Array.from(t).reverse()))}const N=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function z(t){return J(R(t)&N)}function J(t,e=h.P){const r=t%e;return r>=u?r:e+r}function F(t,e=h.P){if(t===u||e<=u)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=J(t,e),n=e,i=u,o=f;for(;r!==u;){const t=n%r,e=i-o*(n/r);n=r,r=t,i=o,o=e}if(n!==f)throw new Error("invert: does not exist");return J(i,e)}function W(t,e){const{P:r}=h;let n=t;for(;e-- >u;)n*=n,n%=r;return n}function G(t,e){const r=J(e*e*e),n=function(t){const{P:e}=h,r=BigInt(5),n=BigInt(10),i=BigInt(20),o=BigInt(40),a=BigInt(80),c=t*t%e*t%e,s=W(c,l)*c%e,u=W(s,f)*t%e,y=W(u,r)*u%e,p=W(y,n)*y%e,d=W(p,i)*p%e,w=W(d,o)*d%e,v=W(w,a)*w%e,g=W(v,a)*w%e,b=W(g,n)*y%e;return{pow_p_5_8:W(b,l)*t%e,b2:c}}(t*J(r*r*e)).pow_p_5_8;let i=J(t*r*n);const o=J(e*i*i),a=i,c=J(i*w),s=o===t,u=o===J(-t),y=o===J(-t*w);return s&&(i=a),(u||y)&&(i=c),T(i)&&(i=J(-i)),{isValid:s||u,value:i}}function Z(t){return G(f,t)}function V(t){return J(R(t),h.l)}function H(t,e){const r=t instanceof Uint8Array?Uint8Array.from(t):_(t);if("number"==typeof e&&r.length!==e)throw new Error(`Expected ${e} bytes`);return r}function q(t,e,r=!0){if(!e)throw new TypeError("Specify max value");if("number"==typeof t&&Number.isSafeInteger(t)&&(t=BigInt(t)),"bigint"==typeof t&&t<e)if(r){if(u<t)return t}else if(u<=t)return t;throw new TypeError("Expected valid scalar: 0 < scalar < max")}let C;async function $(t){return function(t){const e=((r=t.slice(0,32))[0]&=248,r[31]&=127,r[31]|=64,r);var r;const n=t.slice(32,64),i=V(e),o=U.BASE.multiply(i),a=o.toRawBytes();return{head:e,prefix:n,scalar:i,point:o,pointBytes:a}}(await tt.sha512(function(t){if(32!==(t="bigint"==typeof t||"number"==typeof t?M(q(t,d)):H(t)).length)throw new Error("Expected 32 bytes");return t}(t)))}async function X(t){return(await $(t)).pointBytes}async function D(t,e){t=H(t);const{prefix:r,scalar:n,pointBytes:i}=await $(e),o=V(await tt.sha512(r,t)),a=U.BASE.multiply(o),c=J(o+V(await tt.sha512(a.toRawBytes(),i,t))*n,h.l);return new L(a,c).toRawBytes()}async function Y(t,e,r){const{r:n,SB:i,msg:o,pub:a}=function(t,e,r){e=H(e),r instanceof U||(r=U.fromHex(r,!1));const{r:n,s:i}=t instanceof L?t.assertValidity():L.fromHex(t);return{r:n,s:i,SB:x.BASE.multiplyUnsafe(i),pub:r,msg:e}}(t,e,r),c=await tt.sha512(n.toRawBytes(),a.toRawBytes(),o);return function(t,e,r,n){const i=V(n),o=x.fromAffine(t).multiplyUnsafe(i);return x.fromAffine(e).add(o).subtract(r).multiplyUnsafe(h.h).equals(x.ZERO)}(a,n,i,c)}U.BASE._setWindowSize(8);const Q={node:t,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},tt={bytesToHex:j,hexToBytes:_,concatBytes:O,getExtendedPublicKey:$,mod:J,invert:F,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:t=>{if((t=H(t)).length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return J(R(t),h.l-f)+f},randomBytes:(t=32)=>{if(Q.web)return Q.web.getRandomValues(new Uint8Array(t));if(Q.node){const{randomBytes:e}=Q.node;return new Uint8Array(e(t).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>tt.randomBytes(32),sha512:async(...t)=>{const e=O(...t);if(Q.web){const t=await Q.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(Q.node)return Uint8Array.from(Q.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")},precompute(t=8,e=U.BASE){const r=e.equals(U.BASE)?e:new U(e.x,e.y);return r._setWindowSize(t),r.multiply(l),r},sha512Sync:void 0};Object.defineProperties(tt,{sha512Sync:{configurable:!1,get:()=>C,set(t){C||(C=t)}}});if(!globalThis.crypto.getRandomValues)throw new Error('Browser does not provide "crypto.getRandomValues".');
|
|
3
|
+
/*!
|
|
4
|
+
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
const et="Ed25519";function rt({id:t,secretKey:e}){if(!e)throw new Error("A secret key is not available for signing.");return{algorithm:et,id:t,sign:async({data:t})=>async function(t,e){return D(e,t.slice(0,32))}(e,t)}}function nt({id:t,publicKey:e}){if(!e)throw new Error("A public key is not available for verifying.");return{algorithm:et,id:t,verify:async({data:t,signature:r})=>async function(t,e,r){return Y(r,e,t)}(e,t,r)}}
|
|
7
|
+
/*!
|
|
8
|
+
* Copyright (c) 2022-2024 Digital Bazaar, Inc. All rights reserved.
|
|
9
|
+
*/const it=new Uint8Array([237,1]),ot=new Uint8Array([128,38]),at="https://w3id.org/security/multikey/v1",ct=32,st=32;
|
|
10
|
+
/*!
|
|
11
|
+
* Copyright (c) 2020-2024 Digital Bazaar, Inc. All rights reserved.
|
|
12
|
+
*/
|
|
13
|
+
function ut({keyPair:t}){const e={};return t.publicKey&&(e.publicKeyMultibase=ft(it,t.publicKey)),t.secretKey&&(e.secretKeyMultibase=ft(ot,t.secretKey)),e}function ft(t,e){const r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),"z"+o(r)}
|
|
14
|
+
/*!
|
|
15
|
+
* Copyright (c) 2022-2024 Digital Bazaar, Inc. All rights reserved.
|
|
16
|
+
*/async function lt({keyPair:t,secretKey:e,publicKey:r,includeContext:n,canonicalize:i=!1}={}){if(!r&&!e)throw new TypeError('Export requires specifying either "publicKey" or "secretKey".');const o=e&&!!t.secretKey,a={};return n&&(a["@context"]=at),a.id=t.id,a.type="Multikey",a.controller=t.controller,r&&(a.publicKeyMultibase=function({publicKey:t}={}){if(t.length!==ct)throw new Error(`Invalid public key size (${t.length}); expected 32.`);const{publicKeyMultibase:e}=ut({keyPair:{publicKey:t}});return e}(t)),o&&(a.secretKeyMultibase=function({secretKey:t,canonicalize:e=!1}={}){if(t.length!==st){if(64!==t.length)throw new Error(`Invalid secret key size (${t.length}); expected 32.`);e&&(t=t.subarray(0,st))}const{secretKeyMultibase:r}=ut({keyPair:{secretKey:t}});return r}
|
|
17
|
+
/*!
|
|
18
|
+
* Copyright (c) 2022-2024 Digital Bazaar, Inc. All rights reserved.
|
|
19
|
+
*/({...t,canonicalize:i})),t.revoked&&(a.revoked=t.revoked),a}async function yt({id:t,controller:e,secretKeyMultibase:r,publicKeyMultibase:n,revoked:o}){if(!n)throw new TypeError('The "publicKeyMultibase" property is required.');const{publicKey:a,secretKey:c}=function({publicKeyMultibase:t,secretKeyMultibase:e}){if(!t||"string"!=typeof t||"z"!==t[0])throw new Error('"publicKeyMultibase" must be a multibase, base58-encoded string.');const r=i(t.substr(1)).slice(it.length);let n;if(e){if("string"!=typeof e||"z"!==e[0])throw new Error('"secretKeyMultibase" must be a multibase, base58-encoded string.');n=i(e.substr(1)).slice(ot.length)}return{publicKey:r,secretKey:n}}({publicKeyMultibase:n,secretKeyMultibase:r});return e&&!t&&(t=`${e}#${n}`),{id:t,controller:e,publicKey:a,secretKey:c,publicKeyMultibase:n,secretKeyMultibase:r,revoked:o}}function pt({jwk:t}={}){const e=function({jwk:t}={}){const{kty:e,crv:r,x:i}=t;if("OKP"!==e)throw new TypeError('"jwk.kty" must be "OKP".');if("Ed25519"!==r)throw new TypeError('"jwk.crv" must be "Ed25519".');if("string"!=typeof i)throw new TypeError('"jwk.x" must be a string.');const o=n(t.x);if(o.length!==ct)throw new Error(`Invalid public key size (${o.length}); expected 32.`);return o}({jwk:t}),{publicKeyMultibase:r}=ut({keyPair:{publicKey:e}});return r}function ht({jwk:t}={}){const e=function({jwk:t}={}){const{kty:e,crv:r,d:i}=t;if("OKP"!==e)throw new TypeError('"jwk.kty" must be "OKP".');if("Ed25519"!==r)throw new TypeError('"jwk.crv" must be "Ed25519".');if("string"!=typeof i)throw new TypeError('"jwk.d" must be a string.');const o=Uint8Array.from(n(t.d));if(o.length!==st)throw new Error(`Invalid secret key size (${o.length}); expected 32.`);return o}({jwk:t}),{secretKeyMultibase:r}=ut({keyPair:{secretKey:e}});return r}const dt=new Map([["Ed25519VerificationKey2020",{contextUrl:"https://w3id.org/security/suites/ed25519-2020/v1",translationFn:async function({keyPair:t}){return{...t,type:"Multikey","@context":at,secretKeyMultibase:t.privateKeyMultibase}}}],["Ed25519VerificationKey2018",{contextUrl:"https://w3id.org/security/suites/ed25519-2018/v1",translationFn:async function({keyPair:t}){const e={publicKey:i(t.publicKeyBase58),secretKey:void 0};t.privateKeyBase58&&(e.secretKey=i(t.privateKeyBase58));const{publicKeyMultibase:r,secretKeyMultibase:n}=ut({keyPair:e});return{"@context":at,id:t.id,type:"Multikey",controller:t.controller,revoked:t.revoked,publicKeyMultibase:r,secretKeyMultibase:n}}
|
|
20
|
+
/*!
|
|
21
|
+
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
|
|
22
|
+
*/}]]);async function wt({keyPair:t}){const e=dt.get(t.type);if(!e)throw new Error(`Unsupported key type "${t.type}".`);const{contextUrl:r,translationFn:n}=e;if(t["@context"]||(t["@context"]=r),!function({document:t,contextUrl:e}){const r=t["@context"];return r===e||Array.isArray(r)&&r.includes(e)}
|
|
23
|
+
/*!
|
|
24
|
+
* Copyright (c) 2020-2023 Digital Bazaar, Inc. All rights reserved.
|
|
25
|
+
*/({document:t,contextUrl:r}))throw new Error(`Context not supported "${t["@context"]}".`);return n({keyPair:t})}async function vt(t){let e={...t};if("Multikey"!==e.type){if(e.publicKeyJwk){let t,r;return"JsonWebKey"!==e.type&&"JsonWebKey2020"!==e.type||({id:t,controller:r}=e),async function({jwk:t,secretKey:e=!1,id:r,controller:n}={}){const i={"@context":at,type:"Multikey",publicKeyMultibase:pt({jwk:t})};"string"==typeof r&&(i.id=r);"string"==typeof n&&(i.controller=n);e&&t.d&&(i.secretKeyMultibase=ht({jwk:t}));return vt(i)}({jwk:e.publicKeyJwk,secretKey:!1,id:t,controller:r})}if(e.type)return e=await wt({keyPair:e}),gt({keyPair:e})}return e.type||(e.type="Multikey"),e["@context"]||(e["@context"]=at),function(t){if(!t||"object"!=typeof t)throw new TypeError('"key" must be an object.');if("Multikey"!==t.type)throw new Error('"key" must be a Multikey with type "Multikey".');if(!(t["@context"]===at||Array.isArray(t["@context"])&&t["@context"].includes(at)))throw new TypeError(`"key" must be a Multikey with context "${at}".`)}(e),gt({keyPair:e})}async function gt({keyPair:t}){return t.publicKey||(t=await yt(t)),t={...t,async export({publicKey:e=!0,secretKey:r=!1,includeContext:n=!0,raw:i=!1,canonicalize:o=!1}={}){if(i){const{publicKey:e,secretKey:r}=t,n={};return e&&(n.publicKey=e.slice()),r&&(o&&r.length>st?n.secretKey=r.subarray(0,st).slice():n.secretKey=r),n}return lt({keyPair:t,publicKey:e,secretKey:r,includeContext:n,canonicalize:o})},signer(){const{id:e,secretKey:r}=t;return rt({id:e,secretKey:r})},verifier(){const{id:e,publicKey:r}=t;return nt({id:e,publicKey:r})}}}var bt,mt,xt={exports:{}},Kt={};var Et,kt,At,Bt=(mt||(mt=1,xt.exports=(bt||(bt=1,Et=Kt,Object.defineProperty(Et,"__esModule",{value:!0}),Et.staticImplements=function(){return function(t){}}),Kt)),xt.exports),Pt={exports:{}},Ut={};var Lt=(At||(At=1,Pt.exports=(kt||(kt=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.staticImplements=function(){return function(t){}}}(Ut)),Ut)),Pt.exports);function Ot(t,e,r,n,i,o,a){try{var c=t[o](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,i)}function St(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){Ot(o,n,i,a,c,"next",t)}function c(t){Ot(o,n,i,a,c,"throw",t)}a(void 0)}))}}function jt(){return jt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},jt.apply(this,arguments)}var _t,Mt,It=(_t=function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var i=e&&e.prototype instanceof w?e:w,o=Object.create(i.prototype),a=new U(n||[]);return o._invoke=function(t,e,r){var n=l;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===h){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var c=A(a,r);if(c){if(c===d)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var s=f(t,e,r);if("normal"===s.type){if(n=r.done?h:y,s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=h,r.method="throw",r.arg=s.arg)}}}(t,r,a),o}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l="suspendedStart",y="suspendedYield",p="executing",h="completed",d={};function w(){}function v(){}function g(){}var b={};b[o]=function(){return this};var m=Object.getPrototypeOf,x=m&&m(m(L([])));x&&x!==r&&n.call(x,o)&&(b=x);var K=g.prototype=w.prototype=Object.create(b);function E(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(i,o,a,c){var s=f(t[i],t,o);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function A(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,A(t,r),"throw"===r.method))return d;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var i=f(n,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,d):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function B(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function U(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(B,this),this.reset(!0)}function L(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:O}}function O(){return{value:e,done:!0}}return v.prototype=K.constructor=g,g.constructor=v,v.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,s(t,c,"GeneratorFunction")),t.prototype=Object.create(K),t},t.awrap=function(t){return{__await:t}},E(k.prototype),k.prototype[a]=function(){return this},t.AsyncIterator=k,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new k(u(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(K),s(K,c,"Generator"),K[o]=function(){return this},K.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=L,U.prototype={constructor:U,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(n,i){return c.type="throw",c.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;P(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),d}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},_t(Mt={exports:{}},Mt.exports),Mt.exports);function Tt(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),i=0;i<n.length;i++)n[i]=255;for(var o=0;o<t.length;o++){var a=t.charAt(o),c=a.charCodeAt(0);if(255!==n[c])throw new TypeError(a+" is ambiguous");n[c]=o}var s=t.length,u=t.charAt(0),f=Math.log(s)/Math.log(256),l=Math.log(256)/Math.log(s);function y(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return e.alloc(0);var r=0;if(" "!==t[r]){for(var i=0,o=0;t[r]===u;)i++,r++;for(var a=(t.length-r)*f+1>>>0,c=new Uint8Array(a);t[r];){var l=n[t.charCodeAt(r)];if(255===l)return;for(var y=0,p=a-1;(0!==l||y<o)&&-1!==p;p--,y++)l+=s*c[p]>>>0,c[p]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=y,r++}if(" "!==t[r]){for(var h=a-o;h!==a&&0===c[h];)h++;var d=e.allocUnsafe(i+(a-h));d.fill(0,0,i);for(var w=i;h!==a;)d[w++]=c[h++];return d}}}return{encode:function(n){if((Array.isArray(n)||n instanceof Uint8Array)&&(n=e.from(n)),!r(n))throw new TypeError("Expected Buffer");if(0===n.length)return"";for(var i=0,o=0,a=0,c=n.length;a!==c&&0===n[a];)a++,i++;for(var f=(c-a)*l+1>>>0,y=new Uint8Array(f);a!==c;){for(var p=n[a],h=0,d=f-1;(0!==p||h<o)&&-1!==d;d--,h++)p+=256*y[d]>>>0,y[d]=p%s>>>0,p=p/s>>>0;if(0!==p)throw new Error("Non-zero carry");o=h,a++}for(var w=f-o;w!==f&&0===y[w];)w++;for(var v=u.repeat(i);w<f;++w)v+=t.charAt(y[w]);return v},decodeUnsafe:y,decode:function(t){var e=y(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}var Rt,Nt=Tt("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),zt=function(t){return e.from(t||"").toString("base64")},Jt=function(t){return zt(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},Ft=function(t,e){void 0===e&&(e="base58btc");var r=new Uint8Array(2+t.length);if(r[0]=236,r[1]=1,r.set(t,2),"base58btc"===e)return"z"+Nt.encode(r);if("base64url"===e)return"u"+Jt(r);throw new Error("Unsupported encoding: "+e)},Wt=function(t){return Uint8Array.from(e.from(t.x,"base64"))},Gt={JsonWebKey2020:function(t){var r,n=Wt(t.publicKeyJwk),i=void 0;t.privateKeyJwk&&(i=(r=t.privateKeyJwk,{publicKey:Wt(r),privateKey:Uint8Array.from(e.from(r.d,"base64"))}).privateKey);return{publicKey:n,privateKey:i}},X25519KeyAgreementKey2019:function(t){var e=Nt.decode(t.publicKeyBase58),r=void 0;return t.privateKeyBase58&&(r=Uint8Array.from(Nt.decode(t.privateKeyBase58))),{publicKey:e,privateKey:r}}},Zt={JsonWebKey2020:function(t,e,r,n){var i={kty:"OKP",crv:"X25519",x:Jt(r)},o={id:t,type:"JsonWebKey2020",controller:e,publicKeyJwk:i};return n&&(o.privateKeyJwk=jt({},i,{d:Jt(n)})),o},X25519KeyAgreementKey2019:function(t,e,r,n){var i={id:t,type:"X25519KeyAgreementKey2019",controller:e,publicKeyBase58:Nt.encode(r)};return n&&(i.privateKeyBase58=Nt.encode(n)),i}},Vt=Rt=function(){function t(t){this.type="JsonWebKey2020",this.id=t.id,this.type=t.type||"JsonWebKey2020",this.controller=t.controller,this.publicKey=t.publicKey,this.privateKey=t.privateKey}t.fingerprintFromPublicKey=function(){var t=St(It.mark((function t(e){var r,n;return It.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Rt.from(e);case 2:return r=t.sent,n=r.publicKey,t.abrupt("return",Ft(n));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),t.fromFingerprint=function(){var t=St(It.mark((function t(e){var r,n,i,o;return It.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.fingerprint,236!==(n=Nt.decode(r.substring(1)))[0]||1!==n[1]){t.next=12;break}return t.next=5,Rt.from({id:"",controller:"",type:"X25519KeyAgreementKey2019",publicKeyBase58:Nt.encode(n.slice(2))});case 5:return i=t.sent,t.next=8,i.fingerprint();case 8:return o=t.sent,i.id="did:key:"+o+"#"+o,i.controller="did:key:"+o,t.abrupt("return",i);case 12:throw new Error("Unsupported fingerprint type: "+r);case 13:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();var e=t.prototype;return e.fingerprint=function(){var t=St(It.mark((function t(){return It.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Ft(this.publicKey));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.export=function(){var t=St(It.mark((function t(e){return It.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===e&&(e={privateKey:!1,type:"JsonWebKey2020"}),!Zt[e.type]){t.next=3;break}return t.abrupt("return",Zt[e.type](this.id,this.controller,this.publicKey,e.privateKey?this.privateKey:void 0));case 3:throw new Error("Unsupported export options: "+JSON.stringify(e));case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.deriveSecret=function(){var t=St(It.mark((function t(e){var r,n,i;return It.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.publicKey,t.next=3,Rt.from(r);case 3:if(n=t.sent,this.privateKey){t.next=6;break}throw new Error("No private key available for deriveSecret");case 6:return i=s.sharedKey(this.privateKey,n.publicKey,!0),t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}();function Ht(t,e,r,n,i,o,a){try{var c=t[o](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,i)}function qt(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){Ht(o,n,i,a,c,"next",t)}function c(t){Ht(o,n,i,a,c,"throw",t)}a(void 0)}))}}function Ct(){return Ct=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ct.apply(this,arguments)}Vt.generate=function(){var t=St(It.mark((function t(e){var r,n,i,o,a;return It.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.secureRandom,n=s.generateKeyPair({isAvailable:!0,randomBytes:r}),i=Ft(n.publicKey),a=(o="did:key:"+i)+"#"+i,t.abrupt("return",new Rt({id:a,type:"JsonWebKey2020",controller:o,publicKey:n.publicKey,privateKey:n.secretKey}));case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Vt.from=function(){var t=St(It.mark((function t(e){var r,n,i;return It.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Gt[e.type](e),n=r.publicKey,i=r.privateKey,t.abrupt("return",new Rt({id:e.id,type:e.type,controller:e.controller,publicKey:n,privateKey:i}));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Vt=Rt=a([Lt.staticImplements()],Vt);var $t=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var i=e&&e.prototype instanceof w?e:w,o=Object.create(i.prototype),a=new U(n||[]);return o._invoke=function(t,e,r){var n=l;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===h){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var c=A(a,r);if(c){if(c===d)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var s=f(t,e,r);if("normal"===s.type){if(n=r.done?h:y,s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=h,r.method="throw",r.arg=s.arg)}}}(t,r,a),o}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l="suspendedStart",y="suspendedYield",p="executing",h="completed",d={};function w(){}function v(){}function g(){}var b={};b[o]=function(){return this};var m=Object.getPrototypeOf,x=m&&m(m(L([])));x&&x!==r&&n.call(x,o)&&(b=x);var K=g.prototype=w.prototype=Object.create(b);function E(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(i,o,a,c){var s=f(t[i],t,o);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function A(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,A(t,r),"throw"===r.method))return d;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var i=f(n,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,d):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function B(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function U(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(B,this),this.reset(!0)}function L(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:O}}function O(){return{value:e,done:!0}}return v.prototype=K.constructor=g,g.constructor=v,v.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,s(t,c,"GeneratorFunction")),t.prototype=Object.create(K),t},t.awrap=function(t){return{__await:t}},E(k.prototype),k.prototype[a]=function(){return this},t.AsyncIterator=k,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new k(u(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(K),s(K,c,"Generator"),K[o]=function(){return this},K.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=L,U.prototype={constructor:U,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(n,i){return c.type="throw",c.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;P(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),d}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));function Xt(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),i=0;i<n.length;i++)n[i]=255;for(var o=0;o<t.length;o++){var a=t.charAt(o),c=a.charCodeAt(0);if(255!==n[c])throw new TypeError(a+" is ambiguous");n[c]=o}var s=t.length,u=t.charAt(0),f=Math.log(s)/Math.log(256),l=Math.log(256)/Math.log(s);function y(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return e.alloc(0);var r=0;if(" "!==t[r]){for(var i=0,o=0;t[r]===u;)i++,r++;for(var a=(t.length-r)*f+1>>>0,c=new Uint8Array(a);t[r];){var l=n[t.charCodeAt(r)];if(255===l)return;for(var y=0,p=a-1;(0!==l||y<o)&&-1!==p;p--,y++)l+=s*c[p]>>>0,c[p]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=y,r++}if(" "!==t[r]){for(var h=a-o;h!==a&&0===c[h];)h++;var d=e.allocUnsafe(i+(a-h));d.fill(0,0,i);for(var w=i;h!==a;)d[w++]=c[h++];return d}}}return{encode:function(n){if((Array.isArray(n)||n instanceof Uint8Array)&&(n=e.from(n)),!r(n))throw new TypeError("Expected Buffer");if(0===n.length)return"";for(var i=0,o=0,a=0,c=n.length;a!==c&&0===n[a];)a++,i++;for(var f=(c-a)*l+1>>>0,y=new Uint8Array(f);a!==c;){for(var p=n[a],h=0,d=f-1;(0!==p||h<o)&&-1!==d;d--,h++)p+=256*y[d]>>>0,y[d]=p%s>>>0,p=p/s>>>0;if(0!==p)throw new Error("Non-zero carry");o=h,a++}for(var w=f-o;w!==f&&0===y[w];)w++;for(var v=u.repeat(i);w<f;++w)v+=t.charAt(y[w]);return v},decodeUnsafe:y,decode:function(t){var e=y(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}var Dt,Yt=Xt("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Qt=function(t){return e.from(t||"").toString("base64")},te=function(t){return Qt(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},ee=function(t,e){void 0===e&&(e="base58btc");var r=new Uint8Array(2+t.length);if(r[0]=237,r[1]=1,r.set(t,2),"base58btc"===e)return"z"+Yt.encode(r);if("base64url"===e)return"u"+te(r);throw new Error("Unsupported encoding: "+e)},re=function(t){return Uint8Array.from(e.from(t.x,"base64"))},ne={JsonWebKey2020:function(t){var r,n=re(t.publicKeyJwk),i=void 0;t.privateKeyJwk&&(i=(r=t.privateKeyJwk,{publicKey:re(r),privateKey:Uint8Array.from(e.concat([e.from(r.d,"base64"),e.from(r.x,"base64")]))}).privateKey);return{publicKey:n,privateKey:i}},Ed25519VerificationKey2018:function(t){var e=Yt.decode(t.publicKeyBase58),r=void 0;return t.privateKeyBase58&&(r=Uint8Array.from(Yt.decode(t.privateKeyBase58))),{publicKey:e,privateKey:r}}},ie=function(t){if(!ne[t.type])throw new Error("Cannot import from unsupported type: "+JSON.stringify(t,null,2));return ne[t.type](t)},oe={JsonWebKey2020:function(t,e,r,n){var i={kty:"OKP",crv:"Ed25519",x:te(r)},o={id:t,type:"JsonWebKey2020",controller:e,publicKeyJwk:i};return n&&(o.privateKeyJwk=Ct({},i,{d:te(n.slice(0,n.length/2))})),o},Ed25519VerificationKey2018:function(t,e,r,n){var i={id:t,type:"Ed25519VerificationKey2018",controller:e,publicKeyBase58:Yt.encode(r)};return n&&(i.privateKeyBase58=Yt.encode(n)),i}},ae={EdDsa:{__proto__:null,signer:function(t){return{sign:function(e){return qt($t.mark((function r(){var n;return $t.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=e.data,r.abrupt("return",c.sign(t,n));case 2:case"end":return r.stop()}}),r)})))()}}},verifier:function(t){return{verify:function(e){return qt($t.mark((function r(){var n,i,o;return $t.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:n=e.data,i=e.signature,o=!1;try{o=c.verify(t,n,i)}catch(t){}return r.abrupt("return",o);case 4:case"end":return r.stop()}}),r)})))()}}}}},ce=Dt=function(){function t(t){this.type="JsonWebKey2020",this.id=t.id,this.type=t.type||"JsonWebKey2020",this.controller=t.controller,this.publicKey=t.publicKey,this.privateKey=t.privateKey}t.fingerprintFromPublicKey=function(){var t=qt($t.mark((function t(e){var r,n;return $t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Dt.from(e);case 2:return r=t.sent,n=r.publicKey,t.abrupt("return",ee(n));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),t.toX25519KeyPair=function(){var t=qt($t.mark((function t(e){var r,n,i;return $t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=c.convertPublicKeyToX25519(e.publicKey),n=void 0,e.privateKey&&(n=c.convertSecretKeyToX25519(e.privateKey)),i=new Vt({id:"",type:"X25519KeyAgreementKey2019",controller:e.controller,publicKey:r,privateKey:n}),t.t0=e.controller+"#",t.next=7,i.fingerprint();case 7:return t.t1=t.sent,i.id=t.t0+t.t1,t.abrupt("return",i);case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),t.fromFingerprint=function(){var t=qt($t.mark((function t(e){var r,n,i,o;return $t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.fingerprint,237!==(n=Yt.decode(r.substring(1)))[0]||1!==n[1]){t.next=12;break}return t.next=5,Dt.from({id:"",controller:"",type:"Ed25519VerificationKey2018",publicKeyBase58:Yt.encode(n.slice(2))});case 5:return i=t.sent,t.next=8,i.fingerprint();case 8:return o=t.sent,i.id="did:key:"+o+"#"+o,i.controller="did:key:"+o,t.abrupt("return",i);case 12:throw new Error("Unsupported fingerprint type: "+r);case 13:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();var e=t.prototype;return e.fingerprint=function(){var t=qt($t.mark((function t(){return $t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",ee(this.publicKey));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.export=function(){var t=qt($t.mark((function t(e){return $t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===e&&(e={privateKey:!1,type:"JsonWebKey2020"}),!oe[e.type]){t.next=3;break}return t.abrupt("return",oe[e.type](this.id,this.controller,this.publicKey,e.privateKey?this.privateKey:void 0));case 3:throw new Error("Unsupported export options: "+JSON.stringify(e));case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.signer=function(t){if(void 0===t&&(t="EdDsa"),!this.privateKey)throw new Error("No private key to sign with.");if(ae[t])return ae[t].signer(this.privateKey);throw new Error("Unsupported suite type "+t)},e.verifier=function(t){if(void 0===t&&(t="EdDsa"),!this.publicKey)throw new Error("No public key to verify with.");if(ae[t])return ae[t].verifier(this.publicKey);throw new Error("Unsupported suite type "+t)},e.getDerivedKeyPairs=function(){var t=qt($t.mark((function t(){return $t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,Dt.toX25519KeyPair(this);case 3:return t.t1=t.sent,t.abrupt("return",[t.t0,t.t1]);case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),t}();ce.generate=function(){var t=qt($t.mark((function t(e){var r,n,i,o,a;return $t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.secureRandom,n=c.generateKeyPair({isAvailable:!0,randomBytes:r}),i=ee(n.publicKey),a=(o="did:key:"+i)+"#"+i,t.abrupt("return",new Dt({id:a,type:"JsonWebKey2020",controller:o,publicKey:n.publicKey,privateKey:n.secretKey}));case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),ce.from=function(){var t=qt($t.mark((function t(e){var r,n,i;return $t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=ie(e),n=r.publicKey,i=r.privateKey,t.abrupt("return",new Dt({id:e.id,type:e.type,controller:e.controller,publicKey:n,privateKey:i}));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),ce=Dt=a([Bt.staticImplements()],ce);export{ce as E,vt as f,X as g,D as s,Y as v};
|