@blockcerts/blockcerts-verifier 1.62.0 → 1.62.1

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.
Files changed (25) hide show
  1. package/bundle-stats.html +1 -1
  2. package/dist/{EcdsaSecp256k1Signature2019-aV3C41Ue-_mP0Wq_n.js → EcdsaSecp256k1Signature2019-D8D2kh2C-D_9G-pvc.js} +1 -1
  3. package/dist/{Ed25519Signature2020-CL2yKnJW-NRYSGvkI.js → Ed25519Signature2020-ksyyWByQ-DJfkuzPo.js} +5 -5
  4. package/dist/{MerkleProof2017-CNSx436a-FBaGRIN1.js → MerkleProof2017-DJkEKNm5-DslQLgIV.js} +1 -1
  5. package/dist/{MerkleProof2019-DnbP3r0f-Cp4GWjQh.js → MerkleProof2019-CNv70A45-NTmYz6kF.js} +2 -2
  6. package/dist/checkCredentialSchemaConformity-DTqaxENC-DVWS3_Eh.js +1 -0
  7. package/dist/{checkRevocationStatusList2021-Cy-rWyh7-CVOeAbdp.js → checkRevocationStatusList2021-gJ08HuL8-BycWMYXc.js} +4 -4
  8. package/dist/{controlVerificationMethod-CXzAI0QS-b45qIaR4.js → controlVerificationMethod-1mtI3EJp-wABQpqsl.js} +1 -1
  9. package/dist/{did-key-common.esm-CJj7pea6-Er8YwHoJ.js → did-key-common.esm-C8caUy6x-CUGnGiom.js} +3 -3
  10. package/dist/{did-key-ed25519.esm-hEATvNhJ-CHAq7sf1.js → did-key-ed25519.esm-CmW3tWKP-Y6ZSpFNY.js} +1 -1
  11. package/dist/{did-key-secp256k1.esm-CIEM56eq-EQahxyFZ.js → did-key-secp256k1.esm-DzS1X49n-DBt648mN.js} +1 -1
  12. package/dist/{index-DWAZG7Ja-CBt_boC3.js → index-DCloIN9Y-xgvZvTQb.js} +2 -2
  13. package/dist/{jsonld-signatures-zDEkNjYR-D3vK8GYH.js → jsonld-signatures-BGggIvjB-DXkWdXeB.js} +4 -4
  14. package/dist/main.js +1 -1
  15. package/package.json +2 -2
  16. package/dist/checkCredentialSchemaConformity-QPmIWPLG-De1kKyvF.js +0 -1
  17. /package/dist/{HashlinkVerifier-MEwSZe4T-BdYYAALa.js → HashlinkVerifier-DsOipQXP-BdYYAALa.js} +0 -0
  18. /package/dist/{elliptic-DVE5q-l5-D-NH8siB.js → elliptic-Bnve3wuI-D-NH8siB.js} +0 -0
  19. /package/dist/{ensureNotRevoked-bD_ITwQb-DvMIgM4L.js → ensureNotRevoked-4-MbmLBE-DvMIgM4L.js} +0 -0
  20. /package/dist/{ensureValidIssuingKey-wRebznsK-frafTbMl.js → ensureValidIssuingKey-Chj896Xe-frafTbMl.js} +0 -0
  21. /package/dist/{index-CcA_A5fd-Dgus2xdV.js → index-BcoFZOIG-Dgus2xdV.js} +0 -0
  22. /package/dist/{index-yP42zfkJ-CHN5LgUq.js → index-RPby1iUS-CHN5LgUq.js} +0 -0
  23. /package/dist/{jsonld-Pr6hPH-i-D_C9ciG_.js → jsonld-Cm7t2ORw-D_C9ciG_.js} +0 -0
  24. /package/dist/{sha256-wKiO0px2-BYFBxJ7m.js → sha256-BU_-grHj-BYFBxJ7m.js} +0 -0
  25. /package/dist/{x25519-BzvT3haI-DcUk09rC.js → x25519-BmUS3FQ1-DcUk09rC.js} +0 -0
@@ -1 +1 @@
1
- import{g as r,a as t}from"./did-key-common.esm-CJj7pea6-Er8YwHoJ.js";import{B as e,i as n}from"./main.js";import{_ as o}from"./tslib.es6-CNEFicEt-CmLYFWVC.js";import{x as i,e as a}from"./x25519-BzvT3haI-DcUk09rC.js";import"./jsonld-Pr6hPH-i-D_C9ciG_.js";import"./_commonjs-dynamic-modules-COweQ1RR-BHR_E30J.js";var c,u,s={exports:{}},f={};s.exports=(c||(c=1,u=f,Object.defineProperty(u,"__esModule",{value:!0}),u.staticImplements=function(){return function(r){}}),f);var p=s.exports;function h(r,t,e,n,o,i,a){try{var c=r[i](a),u=c.value}catch(r){return void e(r)}c.done?t(u):Promise.resolve(u).then(n,o)}function l(r){return function(){var t=this,e=arguments;return new Promise((function(n,o){var i=r.apply(t,e);function a(r){h(i,n,o,a,c,"next",r)}function c(r){h(i,n,o,a,c,"throw",r)}a(void 0)}))}}function y(){return y=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},y.apply(this,arguments)}var v,d,w=(v=function(r){var t=function(r){var t,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(r,t,e){return Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{u({},"")}catch(r){u=function(r,t,e){return r[t]=e}}function s(r,t,e,n){var o=t&&t.prototype instanceof d?t:d,i=Object.create(o.prototype),a=new O(n||[]);return i._invoke=function(r,t,e){var n=p;return function(o,i){if(n===l)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return j()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=L(a,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===p)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=l;var u=f(r,t,e);if("normal"===u.type){if(n=e.done?y:h,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(r,e,a),i}function f(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(r){return{type:"throw",arg:r}}}r.wrap=s;var p="suspendedStart",h="suspendedYield",l="executing",y="completed",v={};function d(){}function w(){}function g(){}var m={};m[i]=function(){return this};var b=Object.getPrototypeOf,K=b&&b(b(P([])));K&&K!==e&&n.call(K,i)&&(m=K);var x=g.prototype=d.prototype=Object.create(m);function E(r){["next","throw","return"].forEach((function(t){u(r,t,(function(r){return this._invoke(t,r)}))}))}function k(r,t){function e(o,i,a,c){var u=f(r[o],r,i);if("throw"!==u.type){var s=u.arg,p=s.value;return p&&"object"==typeof p&&n.call(p,"__await")?t.resolve(p.__await).then((function(r){e("next",r,a,c)}),(function(r){e("throw",r,a,c)})):t.resolve(p).then((function(r){s.value=r,a(s)}),(function(r){return e("throw",r,a,c)}))}c(u.arg)}var o;this._invoke=function(r,n){function i(){return new t((function(t,o){e(r,n,t,o)}))}return o=o?o.then(i,i):i()}}function L(r,e){var n=r.iterator[e.method];if(n===t){if(e.delegate=null,"throw"===e.method){if(r.iterator.return&&(e.method="return",e.arg=t,L(r,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,r.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[r.resultName]=i.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function A(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function _(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function O(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(A,this),this.reset(!0)}function P(r){if(r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}return{next:j}}function j(){return{value:t,done:!0}}return w.prototype=x.constructor=g,g.constructor=w,w.displayName=u(g,c,"GeneratorFunction"),r.isGeneratorFunction=function(r){var t="function"==typeof r&&r.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,g):(r.__proto__=g,u(r,c,"GeneratorFunction")),r.prototype=Object.create(x),r},r.awrap=function(r){return{__await:r}},E(k.prototype),k.prototype[a]=function(){return this},r.AsyncIterator=k,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new k(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(r){return r.done?r.value:a.next()}))},E(x),u(x,c,"Generator"),x[i]=function(){return this},x.toString=function(){return"[object Generator]"},r.keys=function(r){var t=[];for(var e in r)t.push(e);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=P,O.prototype={constructor:O,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(_),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var r=this.tryEntries[0].completion;if("throw"===r.type)throw r.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(r,t){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===r||"continue"===r)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=r,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(r,t){if("throw"===r.type)throw r.arg;return"break"===r.type||"continue"===r.type?this.next=r.arg:"return"===r.type?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):"normal"===r.type&&t&&(this.next=t),v},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.finallyLoc===r)return this.complete(e.completion,e.afterLoc),_(e),v}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.tryLoc===r){var n=e.completion;if("throw"===n.type){var o=n.arg;_(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:P(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),v}},r}(r.exports);try{regeneratorRuntime=t}catch(r){Function("r","regeneratorRuntime = r")(t)}},v(d={exports:{}},d.exports),d.exports);function g(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),o=0;o<t.length;o++)t[o]=255;for(var i=0;i<r.length;i++){var a=r.charAt(i),c=a.charCodeAt(0);if(255!==t[c])throw new TypeError(a+" is ambiguous");t[c]=i}var u=r.length,s=r.charAt(0),f=Math.log(u)/Math.log(256),p=Math.log(256)/Math.log(u);function h(r){if("string"!=typeof r)throw new TypeError("Expected String");if(0===r.length)return e.alloc(0);var n=0;if(" "!==r[n]){for(var o=0,i=0;r[n]===s;)o++,n++;for(var a=(r.length-n)*f+1>>>0,c=new Uint8Array(a);r[n];){var p=t[r.charCodeAt(n)];if(255===p)return;for(var h=0,l=a-1;(0!==p||h<i)&&-1!==l;l--,h++)p+=u*c[l]>>>0,c[l]=p%256>>>0,p=p/256>>>0;if(0!==p)throw new Error("Non-zero carry");i=h,n++}if(" "!==r[n]){for(var y=a-i;y!==a&&0===c[y];)y++;var v=e.allocUnsafe(o+(a-y));v.fill(0,0,o);for(var d=o;y!==a;)v[d++]=c[y++];return v}}}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=e.from(t)),!n(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var o=0,i=0,a=0,c=t.length;a!==c&&0===t[a];)a++,o++;for(var f=(c-a)*p+1>>>0,h=new Uint8Array(f);a!==c;){for(var l=t[a],y=0,v=f-1;(0!==l||y<i)&&-1!==v;v--,y++)l+=256*h[v]>>>0,h[v]=l%u>>>0,l=l/u>>>0;if(0!==l)throw new Error("Non-zero carry");i=y,a++}for(var d=f-i;d!==f&&0===h[d];)d++;for(var w=s.repeat(o);d<f;++d)w+=r.charAt(h[d]);return w},decodeUnsafe:h,decode:function(r){var t=h(r);if(t)return t;throw new Error("Non-base"+u+" character")}}}var m,b=g("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),K=function(r){return e.from(r||"").toString("base64")},x=function(r){return K(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},E=function(r,t){void 0===t&&(t="base58btc");var e=new Uint8Array(2+r.length);if(e[0]=236,e[1]=1,e.set(r,2),"base58btc"===t)return"z"+b.encode(e);if("base64url"===t)return"u"+x(e);throw new Error("Unsupported encoding: "+t)},k=function(r){return Uint8Array.from(e.from(r.x,"base64"))},L={JsonWebKey2020:function(r){var t,n=k(r.publicKeyJwk),o=void 0;r.privateKeyJwk&&(o=(t=r.privateKeyJwk,{publicKey:k(t),privateKey:Uint8Array.from(e.from(t.d,"base64"))}).privateKey);return{publicKey:n,privateKey:o}},X25519KeyAgreementKey2019:function(r){var t=b.decode(r.publicKeyBase58),e=void 0;return r.privateKeyBase58&&(e=Uint8Array.from(b.decode(r.privateKeyBase58))),{publicKey:t,privateKey:e}}},A={JsonWebKey2020:function(r,t,e,n){var o={kty:"OKP",crv:"X25519",x:x(e)},i={id:r,type:"JsonWebKey2020",controller:t,publicKeyJwk:o};return n&&(i.privateKeyJwk=y({},o,{d:x(n)})),i},X25519KeyAgreementKey2019:function(r,t,e,n){var o={id:r,type:"X25519KeyAgreementKey2019",controller:t,publicKeyBase58:b.encode(e)};return n&&(o.privateKeyBase58=b.encode(n)),o}},_=m=function(){function r(r){this.type="JsonWebKey2020",this.id=r.id,this.type=r.type||"JsonWebKey2020",this.controller=r.controller,this.publicKey=r.publicKey,this.privateKey=r.privateKey}r.fingerprintFromPublicKey=function(){var r=l(w.mark((function r(t){var e,n;return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,m.from(t);case 2:return e=r.sent,n=e.publicKey,r.abrupt("return",E(n));case 5:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),r.fromFingerprint=function(){var r=l(w.mark((function r(t){var e,n,o,i;return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.fingerprint,236!==(n=b.decode(e.substring(1)))[0]||1!==n[1]){r.next=12;break}return r.next=5,m.from({id:"",controller:"",type:"X25519KeyAgreementKey2019",publicKeyBase58:b.encode(n.slice(2))});case 5:return o=r.sent,r.next=8,o.fingerprint();case 8:return i=r.sent,o.id="did:key:"+i+"#"+i,o.controller="did:key:"+i,r.abrupt("return",o);case 12:throw new Error("Unsupported fingerprint type: "+e);case 13:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}();var t=r.prototype;return t.fingerprint=function(){var r=l(w.mark((function r(){return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",E(this.publicKey));case 1:case"end":return r.stop()}}),r,this)})));return function(){return r.apply(this,arguments)}}(),t.export=function(){var r=l(w.mark((function r(t){return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===t&&(t={privateKey:!1,type:"JsonWebKey2020"}),!A[t.type]){r.next=3;break}return r.abrupt("return",A[t.type](this.id,this.controller,this.publicKey,t.privateKey?this.privateKey:void 0));case 3:throw new Error("Unsupported export options: "+JSON.stringify(t));case 4:case"end":return r.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),t.deriveSecret=function(){var r=l(w.mark((function r(t){var e,n,o;return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.publicKey,r.next=3,m.from(e);case 3:if(n=r.sent,this.privateKey){r.next=6;break}throw new Error("No private key available for deriveSecret");case 6:return o=i.sharedKey(this.privateKey,n.publicKey,!0),r.abrupt("return",o);case 8:case"end":return r.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),t.toJsonWebKeyPair=function(){var r=l(w.mark((function r(t){return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return void 0===t&&(t=!1),console.warn("DEPRECATION WARNING: .toJsonWebKeyPair should be replaced with .export({type:'JsonWebKey2020'})."),r.abrupt("return",A.JsonWebKey2020(this.id,this.controller,this.publicKey,t?this.privateKey:void 0));case 3:case"end":return r.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),r}();function O(r,t,e,n,o,i,a){try{var c=r[i](a),u=c.value}catch(r){return void e(r)}c.done?t(u):Promise.resolve(u).then(n,o)}function P(r){return function(){var t=this,e=arguments;return new Promise((function(n,o){var i=r.apply(t,e);function a(r){O(i,n,o,a,c,"next",r)}function c(r){O(i,n,o,a,c,"throw",r)}a(void 0)}))}}function j(){return j=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},j.apply(this,arguments)}_.generate=function(){var r=l(w.mark((function r(t){var e,n,o,a,c;return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.secureRandom,n=i.generateKeyPair({isAvailable:!0,randomBytes:e}),o=E(n.publicKey),c=(a="did:key:"+o)+"#"+o,r.abrupt("return",new m({id:c,type:"JsonWebKey2020",controller:a,publicKey:n.publicKey,privateKey:n.secretKey}));case 6:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),_.from=function(){var r=l(w.mark((function r(t){var e,n,o;return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=L[t.type](t),n=e.publicKey,o=e.privateKey,r.abrupt("return",new m({id:t.id,type:t.type,controller:t.controller,publicKey:n,privateKey:o}));case 2:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),_=m=o([p.staticImplements()],_);var J=function(r,t){return r(t={exports:{}},t.exports),t.exports}((function(r){var t=function(r){var t,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(r,t,e){return Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{u({},"")}catch(r){u=function(r,t,e){return r[t]=e}}function s(r,t,e,n){var o=t&&t.prototype instanceof d?t:d,i=Object.create(o.prototype),a=new O(n||[]);return i._invoke=function(r,t,e){var n=p;return function(o,i){if(n===l)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return j()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=L(a,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===p)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=l;var u=f(r,t,e);if("normal"===u.type){if(n=e.done?y:h,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(r,e,a),i}function f(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(r){return{type:"throw",arg:r}}}r.wrap=s;var p="suspendedStart",h="suspendedYield",l="executing",y="completed",v={};function d(){}function w(){}function g(){}var m={};m[i]=function(){return this};var b=Object.getPrototypeOf,K=b&&b(b(P([])));K&&K!==e&&n.call(K,i)&&(m=K);var x=g.prototype=d.prototype=Object.create(m);function E(r){["next","throw","return"].forEach((function(t){u(r,t,(function(r){return this._invoke(t,r)}))}))}function k(r,t){function e(o,i,a,c){var u=f(r[o],r,i);if("throw"!==u.type){var s=u.arg,p=s.value;return p&&"object"==typeof p&&n.call(p,"__await")?t.resolve(p.__await).then((function(r){e("next",r,a,c)}),(function(r){e("throw",r,a,c)})):t.resolve(p).then((function(r){s.value=r,a(s)}),(function(r){return e("throw",r,a,c)}))}c(u.arg)}var o;this._invoke=function(r,n){function i(){return new t((function(t,o){e(r,n,t,o)}))}return o=o?o.then(i,i):i()}}function L(r,e){var n=r.iterator[e.method];if(n===t){if(e.delegate=null,"throw"===e.method){if(r.iterator.return&&(e.method="return",e.arg=t,L(r,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,r.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[r.resultName]=i.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function A(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function _(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function O(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(A,this),this.reset(!0)}function P(r){if(r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}return{next:j}}function j(){return{value:t,done:!0}}return w.prototype=x.constructor=g,g.constructor=w,w.displayName=u(g,c,"GeneratorFunction"),r.isGeneratorFunction=function(r){var t="function"==typeof r&&r.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,g):(r.__proto__=g,u(r,c,"GeneratorFunction")),r.prototype=Object.create(x),r},r.awrap=function(r){return{__await:r}},E(k.prototype),k.prototype[a]=function(){return this},r.AsyncIterator=k,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new k(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(r){return r.done?r.value:a.next()}))},E(x),u(x,c,"Generator"),x[i]=function(){return this},x.toString=function(){return"[object Generator]"},r.keys=function(r){var t=[];for(var e in r)t.push(e);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=P,O.prototype={constructor:O,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(_),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var r=this.tryEntries[0].completion;if("throw"===r.type)throw r.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(r,t){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===r||"continue"===r)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=r,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(r,t){if("throw"===r.type)throw r.arg;return"break"===r.type||"continue"===r.type?this.next=r.arg:"return"===r.type?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):"normal"===r.type&&t&&(this.next=t),v},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.finallyLoc===r)return this.complete(e.completion,e.afterLoc),_(e),v}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.tryLoc===r){var n=e.completion;if("throw"===n.type){var o=n.arg;_(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:P(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),v}},r}(r.exports);try{regeneratorRuntime=t}catch(r){Function("r","regeneratorRuntime = r")(t)}}));function N(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),o=0;o<t.length;o++)t[o]=255;for(var i=0;i<r.length;i++){var a=r.charAt(i),c=a.charCodeAt(0);if(255!==t[c])throw new TypeError(a+" is ambiguous");t[c]=i}var u=r.length,s=r.charAt(0),f=Math.log(u)/Math.log(256),p=Math.log(256)/Math.log(u);function h(r){if("string"!=typeof r)throw new TypeError("Expected String");if(0===r.length)return e.alloc(0);var n=0;if(" "!==r[n]){for(var o=0,i=0;r[n]===s;)o++,n++;for(var a=(r.length-n)*f+1>>>0,c=new Uint8Array(a);r[n];){var p=t[r.charCodeAt(n)];if(255===p)return;for(var h=0,l=a-1;(0!==p||h<i)&&-1!==l;l--,h++)p+=u*c[l]>>>0,c[l]=p%256>>>0,p=p/256>>>0;if(0!==p)throw new Error("Non-zero carry");i=h,n++}if(" "!==r[n]){for(var y=a-i;y!==a&&0===c[y];)y++;var v=e.allocUnsafe(o+(a-y));v.fill(0,0,o);for(var d=o;y!==a;)v[d++]=c[y++];return v}}}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=e.from(t)),!n(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var o=0,i=0,a=0,c=t.length;a!==c&&0===t[a];)a++,o++;for(var f=(c-a)*p+1>>>0,h=new Uint8Array(f);a!==c;){for(var l=t[a],y=0,v=f-1;(0!==l||y<i)&&-1!==v;v--,y++)l+=256*h[v]>>>0,h[v]=l%u>>>0,l=l/u>>>0;if(0!==l)throw new Error("Non-zero carry");i=y,a++}for(var d=f-i;d!==f&&0===h[d];)d++;for(var w=s.repeat(o);d<f;++d)w+=r.charAt(h[d]);return w},decodeUnsafe:h,decode:function(r){var t=h(r);if(t)return t;throw new Error("Non-base"+u+" character")}}}var U,W=N("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),T=function(r){return e.from(r||"").toString("base64")},S=function(r){return T(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},B=function(r,t){void 0===t&&(t="base58btc");var e=new Uint8Array(2+r.length);if(e[0]=237,e[1]=1,e.set(r,2),"base58btc"===t)return"z"+W.encode(e);if("base64url"===t)return"u"+S(e);throw new Error("Unsupported encoding: "+t)},G=function(r){return Uint8Array.from(e.from(r.x,"base64"))},F={JsonWebKey2020:function(r){var t,n=G(r.publicKeyJwk),o=void 0;r.privateKeyJwk&&(o=(t=r.privateKeyJwk,{publicKey:G(t),privateKey:Uint8Array.from(e.concat([e.from(t.d,"base64"),e.from(t.x,"base64")]))}).privateKey);return{publicKey:n,privateKey:o}},Ed25519VerificationKey2018:function(r){var t=W.decode(r.publicKeyBase58),e=void 0;return r.privateKeyBase58&&(e=Uint8Array.from(W.decode(r.privateKeyBase58))),{publicKey:t,privateKey:e}}},I=function(r){if(!F[r.type])throw new Error("Cannot import from unsupported type: "+JSON.stringify(r,null,2));return F[r.type](r)},R={JsonWebKey2020:function(r,t,e,n){var o={kty:"OKP",crv:"Ed25519",x:S(e)},i={id:r,type:"JsonWebKey2020",controller:t,publicKeyJwk:o};return n&&(i.privateKeyJwk=j({},o,{d:S(n.slice(0,n.length/2))})),i},Ed25519VerificationKey2018:function(r,t,e,n){var o={id:r,type:"Ed25519VerificationKey2018",controller:t,publicKeyBase58:W.encode(e)};return n&&(o.privateKeyBase58=W.encode(n)),o}},C={EdDsa:{__proto__:null,signer:function(r){return{sign:function(t){return P(J.mark((function e(){var n;return J.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.data,e.abrupt("return",a.sign(r,n));case 2:case"end":return e.stop()}}),e)})))()}}},verifier:function(r){return{verify:function(t){return P(J.mark((function e(){var n,o,i;return J.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.data,o=t.signature,i=!1;try{i=a.verify(r,n,o)}catch(r){}return e.abrupt("return",i);case 4:case"end":return e.stop()}}),e)})))()}}}}},X=U=function(){function r(r){this.type="JsonWebKey2020",this.id=r.id,this.type=r.type||"JsonWebKey2020",this.controller=r.controller,this.publicKey=r.publicKey,this.privateKey=r.privateKey}r.fingerprintFromPublicKey=function(){var r=P(J.mark((function r(t){var e,n;return J.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,U.from(t);case 2:return e=r.sent,n=e.publicKey,r.abrupt("return",B(n));case 5:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),r.toX25519KeyPair=function(){var r=P(J.mark((function r(t){var e,n,o;return J.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=a.convertPublicKeyToX25519(t.publicKey),n=void 0,t.privateKey&&(n=a.convertSecretKeyToX25519(t.privateKey)),o=new _({id:"",type:"X25519KeyAgreementKey2019",controller:t.controller,publicKey:e,privateKey:n}),r.t0=t.controller+"#",r.next=7,o.fingerprint();case 7:return r.t1=r.sent,o.id=r.t0+r.t1,r.abrupt("return",o);case 10:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),r.fromFingerprint=function(){var r=P(J.mark((function r(t){var e,n,o,i;return J.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.fingerprint,237!==(n=W.decode(e.substring(1)))[0]||1!==n[1]){r.next=12;break}return r.next=5,U.from({id:"",controller:"",type:"Ed25519VerificationKey2018",publicKeyBase58:W.encode(n.slice(2))});case 5:return o=r.sent,r.next=8,o.fingerprint();case 8:return i=r.sent,o.id="did:key:"+i+"#"+i,o.controller="did:key:"+i,r.abrupt("return",o);case 12:throw new Error("Unsupported fingerprint type: "+e);case 13:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}();var t=r.prototype;return t.fingerprint=function(){var r=P(J.mark((function r(){return J.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",B(this.publicKey));case 1:case"end":return r.stop()}}),r,this)})));return function(){return r.apply(this,arguments)}}(),t.export=function(){var r=P(J.mark((function r(t){return J.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===t&&(t={privateKey:!1,type:"JsonWebKey2020"}),!R[t.type]){r.next=3;break}return r.abrupt("return",R[t.type](this.id,this.controller,this.publicKey,t.privateKey?this.privateKey:void 0));case 3:throw new Error("Unsupported export options: "+JSON.stringify(t));case 4:case"end":return r.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),t.signer=function(r){if(void 0===r&&(r="EdDsa"),!this.privateKey)throw new Error("No private key to sign with.");if(C[r])return C[r].signer(this.privateKey);throw new Error("Unsupported suite type "+r)},t.verifier=function(r){if(void 0===r&&(r="EdDsa"),!this.publicKey)throw new Error("No public key to verify with.");if(C[r])return C[r].verifier(this.publicKey);throw new Error("Unsupported suite type "+r)},t.getDerivedKeyPairs=function(){var r=P(J.mark((function r(){return J.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.t0=this,r.next=3,U.toX25519KeyPair(this);case 3:return r.t1=r.sent,r.abrupt("return",[r.t0,r.t1]);case 5:case"end":return r.stop()}}),r,this)})));return function(){return r.apply(this,arguments)}}(),t.toJsonWebKeyPair=function(){var r=P(J.mark((function r(t){return J.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return void 0===t&&(t=!1),console.warn("DEPRECATION WARNING: .toJsonWebKeyPair should be replaced with .export({type:'JsonWebKey2020'})."),r.abrupt("return",R.JsonWebKey2020(this.id,this.controller,this.publicKey,t?this.privateKey:void 0));case 3:case"end":return r.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),r}();X.generate=function(){var r=P(J.mark((function r(t){var e,n,o,i,c;return J.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.secureRandom,n=a.generateKeyPair({isAvailable:!0,randomBytes:e}),o=B(n.publicKey),c=(i="did:key:"+o)+"#"+o,r.abrupt("return",new U({id:c,type:"JsonWebKey2020",controller:i,publicKey:n.publicKey,privateKey:n.secretKey}));case 6:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),X.from=function(){var r=P(J.mark((function r(t){var e,n,o;return J.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=I(t),n=e.publicKey,o=e.privateKey,r.abrupt("return",new U({id:t.id,type:t.type,controller:t.controller,publicKey:n,privateKey:o}));case 2:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}();var M=r(X=U=o([p.staticImplements()],X)),z=t(X);export{X as Ed25519KeyPair,M as generate,z as resolve};
1
+ import{g as r,a as t}from"./did-key-common.esm-C8caUy6x-CUGnGiom.js";import{B as e,i as n}from"./main.js";import{_ as o}from"./tslib.es6-CNEFicEt-CmLYFWVC.js";import{x as i,e as a}from"./x25519-BmUS3FQ1-DcUk09rC.js";import"./jsonld-Cm7t2ORw-D_C9ciG_.js";import"./_commonjs-dynamic-modules-COweQ1RR-BHR_E30J.js";var c,u,s={exports:{}},f={};s.exports=(c||(c=1,u=f,Object.defineProperty(u,"__esModule",{value:!0}),u.staticImplements=function(){return function(r){}}),f);var p=s.exports;function l(r,t,e,n,o,i,a){try{var c=r[i](a),u=c.value}catch(r){return void e(r)}c.done?t(u):Promise.resolve(u).then(n,o)}function h(r){return function(){var t=this,e=arguments;return new Promise((function(n,o){var i=r.apply(t,e);function a(r){l(i,n,o,a,c,"next",r)}function c(r){l(i,n,o,a,c,"throw",r)}a(void 0)}))}}function y(){return y=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},y.apply(this,arguments)}var v,d,w=(v=function(r){var t=function(r){var t,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(r,t,e){return Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{u({},"")}catch(r){u=function(r,t,e){return r[t]=e}}function s(r,t,e,n){var o=t&&t.prototype instanceof d?t:d,i=Object.create(o.prototype),a=new _(n||[]);return i._invoke=function(r,t,e){var n=p;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return J()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=L(a,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===p)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=h;var u=f(r,t,e);if("normal"===u.type){if(n=e.done?y:l,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(r,e,a),i}function f(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(r){return{type:"throw",arg:r}}}r.wrap=s;var p="suspendedStart",l="suspendedYield",h="executing",y="completed",v={};function d(){}function w(){}function g(){}var m={};m[i]=function(){return this};var b=Object.getPrototypeOf,K=b&&b(b(j([])));K&&K!==e&&n.call(K,i)&&(m=K);var x=g.prototype=d.prototype=Object.create(m);function E(r){["next","throw","return"].forEach((function(t){u(r,t,(function(r){return this._invoke(t,r)}))}))}function k(r,t){function e(o,i,a,c){var u=f(r[o],r,i);if("throw"!==u.type){var s=u.arg,p=s.value;return p&&"object"==typeof p&&n.call(p,"__await")?t.resolve(p.__await).then((function(r){e("next",r,a,c)}),(function(r){e("throw",r,a,c)})):t.resolve(p).then((function(r){s.value=r,a(s)}),(function(r){return e("throw",r,a,c)}))}c(u.arg)}var o;this._invoke=function(r,n){function i(){return new t((function(t,o){e(r,n,t,o)}))}return o=o?o.then(i,i):i()}}function L(r,e){var n=r.iterator[e.method];if(n===t){if(e.delegate=null,"throw"===e.method){if(r.iterator.return&&(e.method="return",e.arg=t,L(r,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,r.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[r.resultName]=i.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function A(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function O(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function _(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(A,this),this.reset(!0)}function j(r){if(r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}return{next:J}}function J(){return{value:t,done:!0}}return w.prototype=x.constructor=g,g.constructor=w,w.displayName=u(g,c,"GeneratorFunction"),r.isGeneratorFunction=function(r){var t="function"==typeof r&&r.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,g):(r.__proto__=g,u(r,c,"GeneratorFunction")),r.prototype=Object.create(x),r},r.awrap=function(r){return{__await:r}},E(k.prototype),k.prototype[a]=function(){return this},r.AsyncIterator=k,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new k(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(r){return r.done?r.value:a.next()}))},E(x),u(x,c,"Generator"),x[i]=function(){return this},x.toString=function(){return"[object Generator]"},r.keys=function(r){var t=[];for(var e in r)t.push(e);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=j,_.prototype={constructor:_,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var r=this.tryEntries[0].completion;if("throw"===r.type)throw r.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(r,t){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===r||"continue"===r)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=r,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(r,t){if("throw"===r.type)throw r.arg;return"break"===r.type||"continue"===r.type?this.next=r.arg:"return"===r.type?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):"normal"===r.type&&t&&(this.next=t),v},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.finallyLoc===r)return this.complete(e.completion,e.afterLoc),O(e),v}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.tryLoc===r){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:j(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),v}},r}(r.exports);try{regeneratorRuntime=t}catch(r){Function("r","regeneratorRuntime = r")(t)}},v(d={exports:{}},d.exports),d.exports);function g(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),o=0;o<t.length;o++)t[o]=255;for(var i=0;i<r.length;i++){var a=r.charAt(i),c=a.charCodeAt(0);if(255!==t[c])throw new TypeError(a+" is ambiguous");t[c]=i}var u=r.length,s=r.charAt(0),f=Math.log(u)/Math.log(256),p=Math.log(256)/Math.log(u);function l(r){if("string"!=typeof r)throw new TypeError("Expected String");if(0===r.length)return e.alloc(0);var n=0;if(" "!==r[n]){for(var o=0,i=0;r[n]===s;)o++,n++;for(var a=(r.length-n)*f+1>>>0,c=new Uint8Array(a);r[n];){var p=t[r.charCodeAt(n)];if(255===p)return;for(var l=0,h=a-1;(0!==p||l<i)&&-1!==h;h--,l++)p+=u*c[h]>>>0,c[h]=p%256>>>0,p=p/256>>>0;if(0!==p)throw new Error("Non-zero carry");i=l,n++}if(" "!==r[n]){for(var y=a-i;y!==a&&0===c[y];)y++;var v=e.allocUnsafe(o+(a-y));v.fill(0,0,o);for(var d=o;y!==a;)v[d++]=c[y++];return v}}}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=e.from(t)),!n(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var o=0,i=0,a=0,c=t.length;a!==c&&0===t[a];)a++,o++;for(var f=(c-a)*p+1>>>0,l=new Uint8Array(f);a!==c;){for(var h=t[a],y=0,v=f-1;(0!==h||y<i)&&-1!==v;v--,y++)h+=256*l[v]>>>0,l[v]=h%u>>>0,h=h/u>>>0;if(0!==h)throw new Error("Non-zero carry");i=y,a++}for(var d=f-i;d!==f&&0===l[d];)d++;for(var w=s.repeat(o);d<f;++d)w+=r.charAt(l[d]);return w},decodeUnsafe:l,decode:function(r){var t=l(r);if(t)return t;throw new Error("Non-base"+u+" character")}}}var m,b=g("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),K=function(r){return e.from(r||"").toString("base64")},x=function(r){return K(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},E=function(r,t){void 0===t&&(t="base58btc");var e=new Uint8Array(2+r.length);if(e[0]=236,e[1]=1,e.set(r,2),"base58btc"===t)return"z"+b.encode(e);if("base64url"===t)return"u"+x(e);throw new Error("Unsupported encoding: "+t)},k=function(r){return Uint8Array.from(e.from(r.x,"base64"))},L={JsonWebKey2020:function(r){var t,n=k(r.publicKeyJwk),o=void 0;r.privateKeyJwk&&(o=(t=r.privateKeyJwk,{publicKey:k(t),privateKey:Uint8Array.from(e.from(t.d,"base64"))}).privateKey);return{publicKey:n,privateKey:o}},X25519KeyAgreementKey2019:function(r){var t=b.decode(r.publicKeyBase58),e=void 0;return r.privateKeyBase58&&(e=Uint8Array.from(b.decode(r.privateKeyBase58))),{publicKey:t,privateKey:e}}},A={JsonWebKey2020:function(r,t,e,n){var o={kty:"OKP",crv:"X25519",x:x(e)},i={id:r,type:"JsonWebKey2020",controller:t,publicKeyJwk:o};return n&&(i.privateKeyJwk=y({},o,{d:x(n)})),i},X25519KeyAgreementKey2019:function(r,t,e,n){var o={id:r,type:"X25519KeyAgreementKey2019",controller:t,publicKeyBase58:b.encode(e)};return n&&(o.privateKeyBase58=b.encode(n)),o}},O=m=function(){function r(r){this.type="JsonWebKey2020",this.id=r.id,this.type=r.type||"JsonWebKey2020",this.controller=r.controller,this.publicKey=r.publicKey,this.privateKey=r.privateKey}r.fingerprintFromPublicKey=function(){var r=h(w.mark((function r(t){var e,n;return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,m.from(t);case 2:return e=r.sent,n=e.publicKey,r.abrupt("return",E(n));case 5:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),r.fromFingerprint=function(){var r=h(w.mark((function r(t){var e,n,o,i;return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.fingerprint,236!==(n=b.decode(e.substring(1)))[0]||1!==n[1]){r.next=12;break}return r.next=5,m.from({id:"",controller:"",type:"X25519KeyAgreementKey2019",publicKeyBase58:b.encode(n.slice(2))});case 5:return o=r.sent,r.next=8,o.fingerprint();case 8:return i=r.sent,o.id="did:key:"+i+"#"+i,o.controller="did:key:"+i,r.abrupt("return",o);case 12:throw new Error("Unsupported fingerprint type: "+e);case 13:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}();var t=r.prototype;return t.fingerprint=function(){var r=h(w.mark((function r(){return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",E(this.publicKey));case 1:case"end":return r.stop()}}),r,this)})));return function(){return r.apply(this,arguments)}}(),t.export=function(){var r=h(w.mark((function r(t){return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===t&&(t={privateKey:!1,type:"JsonWebKey2020"}),!A[t.type]){r.next=3;break}return r.abrupt("return",A[t.type](this.id,this.controller,this.publicKey,t.privateKey?this.privateKey:void 0));case 3:throw new Error("Unsupported export options: "+JSON.stringify(t));case 4:case"end":return r.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),t.deriveSecret=function(){var r=h(w.mark((function r(t){var e,n,o;return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.publicKey,r.next=3,m.from(e);case 3:if(n=r.sent,this.privateKey){r.next=6;break}throw new Error("No private key available for deriveSecret");case 6:return o=i.sharedKey(this.privateKey,n.publicKey,!0),r.abrupt("return",o);case 8:case"end":return r.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),t.toJsonWebKeyPair=function(){var r=h(w.mark((function r(t){return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return void 0===t&&(t=!1),console.warn("DEPRECATION WARNING: .toJsonWebKeyPair should be replaced with .export({type:'JsonWebKey2020'})."),r.abrupt("return",A.JsonWebKey2020(this.id,this.controller,this.publicKey,t?this.privateKey:void 0));case 3:case"end":return r.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),r}();function _(r,t,e,n,o,i,a){try{var c=r[i](a),u=c.value}catch(r){return void e(r)}c.done?t(u):Promise.resolve(u).then(n,o)}function j(r){return function(){var t=this,e=arguments;return new Promise((function(n,o){var i=r.apply(t,e);function a(r){_(i,n,o,a,c,"next",r)}function c(r){_(i,n,o,a,c,"throw",r)}a(void 0)}))}}function J(){return J=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},J.apply(this,arguments)}O.generate=function(){var r=h(w.mark((function r(t){var e,n,o,a,c;return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.secureRandom,n=i.generateKeyPair({isAvailable:!0,randomBytes:e}),o=E(n.publicKey),c=(a="did:key:"+o)+"#"+o,r.abrupt("return",new m({id:c,type:"JsonWebKey2020",controller:a,publicKey:n.publicKey,privateKey:n.secretKey}));case 6:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),O.from=function(){var r=h(w.mark((function r(t){var e,n,o;return w.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=L[t.type](t),n=e.publicKey,o=e.privateKey,r.abrupt("return",new m({id:t.id,type:t.type,controller:t.controller,publicKey:n,privateKey:o}));case 2:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),O=m=o([p.staticImplements()],O);var N=function(r,t){return r(t={exports:{}},t.exports),t.exports}((function(r){var t=function(r){var t,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(r,t,e){return Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{u({},"")}catch(r){u=function(r,t,e){return r[t]=e}}function s(r,t,e,n){var o=t&&t.prototype instanceof d?t:d,i=Object.create(o.prototype),a=new _(n||[]);return i._invoke=function(r,t,e){var n=p;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return J()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=L(a,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===p)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=h;var u=f(r,t,e);if("normal"===u.type){if(n=e.done?y:l,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(r,e,a),i}function f(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(r){return{type:"throw",arg:r}}}r.wrap=s;var p="suspendedStart",l="suspendedYield",h="executing",y="completed",v={};function d(){}function w(){}function g(){}var m={};m[i]=function(){return this};var b=Object.getPrototypeOf,K=b&&b(b(j([])));K&&K!==e&&n.call(K,i)&&(m=K);var x=g.prototype=d.prototype=Object.create(m);function E(r){["next","throw","return"].forEach((function(t){u(r,t,(function(r){return this._invoke(t,r)}))}))}function k(r,t){function e(o,i,a,c){var u=f(r[o],r,i);if("throw"!==u.type){var s=u.arg,p=s.value;return p&&"object"==typeof p&&n.call(p,"__await")?t.resolve(p.__await).then((function(r){e("next",r,a,c)}),(function(r){e("throw",r,a,c)})):t.resolve(p).then((function(r){s.value=r,a(s)}),(function(r){return e("throw",r,a,c)}))}c(u.arg)}var o;this._invoke=function(r,n){function i(){return new t((function(t,o){e(r,n,t,o)}))}return o=o?o.then(i,i):i()}}function L(r,e){var n=r.iterator[e.method];if(n===t){if(e.delegate=null,"throw"===e.method){if(r.iterator.return&&(e.method="return",e.arg=t,L(r,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,r.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[r.resultName]=i.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function A(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function O(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function _(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(A,this),this.reset(!0)}function j(r){if(r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}return{next:J}}function J(){return{value:t,done:!0}}return w.prototype=x.constructor=g,g.constructor=w,w.displayName=u(g,c,"GeneratorFunction"),r.isGeneratorFunction=function(r){var t="function"==typeof r&&r.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,g):(r.__proto__=g,u(r,c,"GeneratorFunction")),r.prototype=Object.create(x),r},r.awrap=function(r){return{__await:r}},E(k.prototype),k.prototype[a]=function(){return this},r.AsyncIterator=k,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new k(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(r){return r.done?r.value:a.next()}))},E(x),u(x,c,"Generator"),x[i]=function(){return this},x.toString=function(){return"[object Generator]"},r.keys=function(r){var t=[];for(var e in r)t.push(e);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=j,_.prototype={constructor:_,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var r=this.tryEntries[0].completion;if("throw"===r.type)throw r.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(r,t){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===r||"continue"===r)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=r,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(r,t){if("throw"===r.type)throw r.arg;return"break"===r.type||"continue"===r.type?this.next=r.arg:"return"===r.type?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):"normal"===r.type&&t&&(this.next=t),v},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.finallyLoc===r)return this.complete(e.completion,e.afterLoc),O(e),v}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.tryLoc===r){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:j(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),v}},r}(r.exports);try{regeneratorRuntime=t}catch(r){Function("r","regeneratorRuntime = r")(t)}}));function P(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),o=0;o<t.length;o++)t[o]=255;for(var i=0;i<r.length;i++){var a=r.charAt(i),c=a.charCodeAt(0);if(255!==t[c])throw new TypeError(a+" is ambiguous");t[c]=i}var u=r.length,s=r.charAt(0),f=Math.log(u)/Math.log(256),p=Math.log(256)/Math.log(u);function l(r){if("string"!=typeof r)throw new TypeError("Expected String");if(0===r.length)return e.alloc(0);var n=0;if(" "!==r[n]){for(var o=0,i=0;r[n]===s;)o++,n++;for(var a=(r.length-n)*f+1>>>0,c=new Uint8Array(a);r[n];){var p=t[r.charCodeAt(n)];if(255===p)return;for(var l=0,h=a-1;(0!==p||l<i)&&-1!==h;h--,l++)p+=u*c[h]>>>0,c[h]=p%256>>>0,p=p/256>>>0;if(0!==p)throw new Error("Non-zero carry");i=l,n++}if(" "!==r[n]){for(var y=a-i;y!==a&&0===c[y];)y++;var v=e.allocUnsafe(o+(a-y));v.fill(0,0,o);for(var d=o;y!==a;)v[d++]=c[y++];return v}}}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=e.from(t)),!n(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var o=0,i=0,a=0,c=t.length;a!==c&&0===t[a];)a++,o++;for(var f=(c-a)*p+1>>>0,l=new Uint8Array(f);a!==c;){for(var h=t[a],y=0,v=f-1;(0!==h||y<i)&&-1!==v;v--,y++)h+=256*l[v]>>>0,l[v]=h%u>>>0,h=h/u>>>0;if(0!==h)throw new Error("Non-zero carry");i=y,a++}for(var d=f-i;d!==f&&0===l[d];)d++;for(var w=s.repeat(o);d<f;++d)w+=r.charAt(l[d]);return w},decodeUnsafe:l,decode:function(r){var t=l(r);if(t)return t;throw new Error("Non-base"+u+" character")}}}var U,W=P("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),S=function(r){return e.from(r||"").toString("base64")},T=function(r){return S(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},B=function(r,t){void 0===t&&(t="base58btc");var e=new Uint8Array(2+r.length);if(e[0]=237,e[1]=1,e.set(r,2),"base58btc"===t)return"z"+W.encode(e);if("base64url"===t)return"u"+T(e);throw new Error("Unsupported encoding: "+t)},F=function(r){return Uint8Array.from(e.from(r.x,"base64"))},G={JsonWebKey2020:function(r){var t,n=F(r.publicKeyJwk),o=void 0;r.privateKeyJwk&&(o=(t=r.privateKeyJwk,{publicKey:F(t),privateKey:Uint8Array.from(e.concat([e.from(t.d,"base64"),e.from(t.x,"base64")]))}).privateKey);return{publicKey:n,privateKey:o}},Ed25519VerificationKey2018:function(r){var t=W.decode(r.publicKeyBase58),e=void 0;return r.privateKeyBase58&&(e=Uint8Array.from(W.decode(r.privateKeyBase58))),{publicKey:t,privateKey:e}}},R=function(r){if(!G[r.type])throw new Error("Cannot import from unsupported type: "+JSON.stringify(r,null,2));return G[r.type](r)},C={JsonWebKey2020:function(r,t,e,n){var o={kty:"OKP",crv:"Ed25519",x:T(e)},i={id:r,type:"JsonWebKey2020",controller:t,publicKeyJwk:o};return n&&(i.privateKeyJwk=J({},o,{d:T(n.slice(0,n.length/2))})),i},Ed25519VerificationKey2018:function(r,t,e,n){var o={id:r,type:"Ed25519VerificationKey2018",controller:t,publicKeyBase58:W.encode(e)};return n&&(o.privateKeyBase58=W.encode(n)),o}},I={EdDsa:{__proto__:null,signer:function(r){return{sign:function(t){return j(N.mark((function e(){var n;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.data,e.abrupt("return",a.sign(r,n));case 2:case"end":return e.stop()}}),e)})))()}}},verifier:function(r){return{verify:function(t){return j(N.mark((function e(){var n,o,i;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.data,o=t.signature,i=!1;try{i=a.verify(r,n,o)}catch(r){}return e.abrupt("return",i);case 4:case"end":return e.stop()}}),e)})))()}}}}},X=U=function(){function r(r){this.type="JsonWebKey2020",this.id=r.id,this.type=r.type||"JsonWebKey2020",this.controller=r.controller,this.publicKey=r.publicKey,this.privateKey=r.privateKey}r.fingerprintFromPublicKey=function(){var r=j(N.mark((function r(t){var e,n;return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,U.from(t);case 2:return e=r.sent,n=e.publicKey,r.abrupt("return",B(n));case 5:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),r.toX25519KeyPair=function(){var r=j(N.mark((function r(t){var e,n,o;return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=a.convertPublicKeyToX25519(t.publicKey),n=void 0,t.privateKey&&(n=a.convertSecretKeyToX25519(t.privateKey)),o=new O({id:"",type:"X25519KeyAgreementKey2019",controller:t.controller,publicKey:e,privateKey:n}),r.t0=t.controller+"#",r.next=7,o.fingerprint();case 7:return r.t1=r.sent,o.id=r.t0+r.t1,r.abrupt("return",o);case 10:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),r.fromFingerprint=function(){var r=j(N.mark((function r(t){var e,n,o,i;return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.fingerprint,237!==(n=W.decode(e.substring(1)))[0]||1!==n[1]){r.next=12;break}return r.next=5,U.from({id:"",controller:"",type:"Ed25519VerificationKey2018",publicKeyBase58:W.encode(n.slice(2))});case 5:return o=r.sent,r.next=8,o.fingerprint();case 8:return i=r.sent,o.id="did:key:"+i+"#"+i,o.controller="did:key:"+i,r.abrupt("return",o);case 12:throw new Error("Unsupported fingerprint type: "+e);case 13:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}();var t=r.prototype;return t.fingerprint=function(){var r=j(N.mark((function r(){return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",B(this.publicKey));case 1:case"end":return r.stop()}}),r,this)})));return function(){return r.apply(this,arguments)}}(),t.export=function(){var r=j(N.mark((function r(t){return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===t&&(t={privateKey:!1,type:"JsonWebKey2020"}),!C[t.type]){r.next=3;break}return r.abrupt("return",C[t.type](this.id,this.controller,this.publicKey,t.privateKey?this.privateKey:void 0));case 3:throw new Error("Unsupported export options: "+JSON.stringify(t));case 4:case"end":return r.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),t.signer=function(r){if(void 0===r&&(r="EdDsa"),!this.privateKey)throw new Error("No private key to sign with.");if(I[r])return I[r].signer(this.privateKey);throw new Error("Unsupported suite type "+r)},t.verifier=function(r){if(void 0===r&&(r="EdDsa"),!this.publicKey)throw new Error("No public key to verify with.");if(I[r])return I[r].verifier(this.publicKey);throw new Error("Unsupported suite type "+r)},t.getDerivedKeyPairs=function(){var r=j(N.mark((function r(){return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.t0=this,r.next=3,U.toX25519KeyPair(this);case 3:return r.t1=r.sent,r.abrupt("return",[r.t0,r.t1]);case 5:case"end":return r.stop()}}),r,this)})));return function(){return r.apply(this,arguments)}}(),t.toJsonWebKeyPair=function(){var r=j(N.mark((function r(t){return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return void 0===t&&(t=!1),console.warn("DEPRECATION WARNING: .toJsonWebKeyPair should be replaced with .export({type:'JsonWebKey2020'})."),r.abrupt("return",C.JsonWebKey2020(this.id,this.controller,this.publicKey,t?this.privateKey:void 0));case 3:case"end":return r.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),r}();X.generate=function(){var r=j(N.mark((function r(t){var e,n,o,i,c;return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.secureRandom,n=a.generateKeyPair({isAvailable:!0,randomBytes:e}),o=B(n.publicKey),c=(i="did:key:"+o)+"#"+o,r.abrupt("return",new U({id:c,type:"JsonWebKey2020",controller:i,publicKey:n.publicKey,privateKey:n.secretKey}));case 6:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),X.from=function(){var r=j(N.mark((function r(t){var e,n,o;return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=R(t),n=e.publicKey,o=e.privateKey,r.abrupt("return",new U({id:t.id,type:t.type,controller:t.controller,publicKey:n,privateKey:o}));case 2:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}();var M=r(X=U=o([p.staticImplements()],X)),z=t(X);export{X as Ed25519KeyPair,M as generate,z as resolve};