@blockcerts/blockcerts-verifier 1.69.0 → 1.70.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 +2229 -2122
- package/dist/{EcdsaSd2023-Bf8oG6yE-DXSfendb.js → EcdsaSd2023-DcsELLJj-DreWzXlX.js} +8 -8
- package/dist/EcdsaSecp256k1Signature2019-Cy1mIkjt-DJmj4ZAc.js +1 -0
- package/dist/{Ed25519Signature2020-B6Av-H9i-Bi3NyI0E.js → Ed25519Signature2020-B-CFC9WC-DJkVVmwk.js} +6 -6
- package/dist/{MerkleProof2017-Dy-NSqLc-DHQ59Wvo.js → MerkleProof2017-DqA3Y12J-D6qS7nCf.js} +1 -1
- package/dist/{MerkleProof2019-0fhn8kLR-C2H_q6nV.js → MerkleProof2019-B4HSvmJo-Cwc-hu-Y.js} +2 -2
- package/dist/checkCredentialSchemaConformity-ChaCRIqw-7U54o8BA.js +1 -0
- package/dist/{controlVerificationMethod-suRC0MnA-D4JcJT1N.js → controlVerificationMethod-qY02GU_H-B-4U8WJQ.js} +1 -1
- package/dist/{did-key-common.esm-C8HA3Pjo-CSneo-V8.js → did-key-common.esm-nDfdwcKN-BTWid9-w.js} +3 -3
- package/dist/{did-key-ed25519.esm-DysNS-Zl-DSKpuDIg.js → did-key-ed25519.esm-DNra0jwE-CTwAEzy6.js} +1 -1
- package/dist/{did-key-secp256k1.esm-CLndQyAu-BYDTpSgR.js → did-key-secp256k1.esm-Dv1NXpDw-_M-qRy-N.js} +1 -1
- package/dist/{downloadPDF-DzV0Jwr0.js → downloadPDF-DQVfeIBI.js} +7 -7
- package/dist/{index-BEHg4rC3-AHOWkvj-.js → index-BM3knvQR-D4vxi3Vi.js} +3 -3
- package/dist/{index-CKc12B0M-CY2IlTam.js → index-Bi-O7G4n-Bgz40JYf.js} +7 -7
- package/dist/{index-BC_5sEeg-CEsb2-mf.js → index-ButIU7pZ-Djl5IfSw.js} +1 -1
- package/dist/{index.es-D_fMtNlx.js → index.es-BqQdvz5C.js} +2 -2
- package/dist/main.js +52 -52
- package/dist/purify.es-DJj7iNgQ.js +2 -0
- package/dist/{retrieveVerificationMethodPublicKey-CogYoUma-CqFMEtDL.js → retrieveVerificationMethodPublicKey-6-rH9LB2-DvFOhdlW.js} +1 -1
- package/dist/verifyIssuerProfile-DnjbDuXe-BVFzyjSL.js +1 -0
- package/package.json +4 -4
- package/dist/EcdsaSecp256k1Signature2019-BALmC57B-DCQW1A4n.js +0 -1
- package/dist/checkCredentialSchemaConformity-D70pJ-aV-ziU-1LIq.js +0 -1
- package/dist/purify-mEiDmpQD.js +0 -2
- package/dist/verifyIssuerProfile-2DvLibZC-DDE-mATS.js +0 -1
- /package/dist/{HashlinkVerifier-CUj0d9D3-dg5WNZnc.js → HashlinkVerifier-hQgVXluZ-dg5WNZnc.js} +0 -0
- /package/dist/{checkRevocationStatusList2021-u7qIPszJ-XCu3zkCJ.js → checkRevocationStatusList2021-CPFaTtUR-XCu3zkCJ.js} +0 -0
- /package/dist/{elliptic-e2d4_kYF-DQmYEk-8.js → elliptic-D-ZnlFdt-DQmYEk-8.js} +0 -0
- /package/dist/{ensureNotRevoked-D2jnsCd0-DvMIgM4L.js → ensureNotRevoked-D9FFjDJd-DvMIgM4L.js} +0 -0
- /package/dist/{ensureValidIssuingKey-LBboe5mO-wu9SdYxL.js → ensureValidIssuingKey-Cz0isOdi-wu9SdYxL.js} +0 -0
- /package/dist/{index-qLsUsSDH-C0eXpZGn.js → index-0q2-1l6i-C0eXpZGn.js} +0 -0
- /package/dist/{index-DuuEF8T4-Dgus2xdV.js → index-ZJb8DPW9-Dgus2xdV.js} +0 -0
- /package/dist/{jsonld-Cuz6c95c-CQeQQNYP.js → jsonld-CQCA9cVk-CQeQQNYP.js} +0 -0
- /package/dist/{sha256-mf0I6iCn-C1PUWFZm.js → sha256-BIUNvBZY-C1PUWFZm.js} +0 -0
- /package/dist/{webcrypto.es-CGaF2VaX-TCzLuarM.js → webcrypto.es-BxABHF-B-TCzLuarM.js} +0 -0
- /package/dist/{x25519-DrRZ9GHv-NSl6svWQ.js → x25519-CEFq6uo8-NSl6svWQ.js} +0 -0
package/dist/{did-key-ed25519.esm-DysNS-Zl-DSKpuDIg.js → did-key-ed25519.esm-DNra0jwE-CTwAEzy6.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as r,a as t}from"./did-key-common.esm-C8HA3Pjo-CSneo-V8.js";import{B as e,i as n}from"./main.js";import{_ as o}from"./tslib.es6--gQC4x5c-CmLYFWVC.js";import{x as i,e as a}from"./x25519-DrRZ9GHv-NSl6svWQ.js";import"./jsonld-Cuz6c95c-CQeQQNYP.js";import"./_commonjs-dynamic-modules-COweQ1RR-BHR_E30J.js";var c,u,s={exports:{}},f={};var p,l=(u||(u=1,s.exports=(c||(c=1,p=f,Object.defineProperty(p,"__esModule",{value:!0}),p.staticImplements=function(){return function(r){}}),f)),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 y(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 v(){return v=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},v.apply(this,arguments)}var d,w,g=(d=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===h)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return P()}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 _(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 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:P}}function P(){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,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: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)}},d(w={exports:{}},w.exports),w.exports);function m(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 b,K=m("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),x=function(r){return e.from(r||"").toString("base64")},E=function(r){return x(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},k=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"+K.encode(e);if("base64url"===t)return"u"+E(e);throw new Error("Unsupported encoding: "+t)},L=function(r){return Uint8Array.from(e.from(r.x,"base64"))},A={JsonWebKey2020:function(r){var t,n=L(r.publicKeyJwk),o=void 0;r.privateKeyJwk&&(o=(t=r.privateKeyJwk,{publicKey:L(t),privateKey:Uint8Array.from(e.from(t.d,"base64"))}).privateKey);return{publicKey:n,privateKey:o}},X25519KeyAgreementKey2019:function(r){var t=K.decode(r.publicKeyBase58),e=void 0;return r.privateKeyBase58&&(e=Uint8Array.from(K.decode(r.privateKeyBase58))),{publicKey:t,privateKey:e}}},_={JsonWebKey2020:function(r,t,e,n){var o={kty:"OKP",crv:"X25519",x:E(e)},i={id:r,type:"JsonWebKey2020",controller:t,publicKeyJwk:o};return n&&(i.privateKeyJwk=v({},o,{d:E(n)})),i},X25519KeyAgreementKey2019:function(r,t,e,n){var o={id:r,type:"X25519KeyAgreementKey2019",controller:t,publicKeyBase58:K.encode(e)};return n&&(o.privateKeyBase58=K.encode(n)),o}},O=b=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=y(g.mark((function r(t){var e,n;return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,b.from(t);case 2:return e=r.sent,n=e.publicKey,r.abrupt("return",k(n));case 5:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),r.fromFingerprint=function(){var r=y(g.mark((function r(t){var e,n,o,i;return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.fingerprint,236!==(n=K.decode(e.substring(1)))[0]||1!==n[1]){r.next=12;break}return r.next=5,b.from({id:"",controller:"",type:"X25519KeyAgreementKey2019",publicKeyBase58:K.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=y(g.mark((function r(){return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",k(this.publicKey));case 1:case"end":return r.stop()}}),r,this)})));return function(){return r.apply(this,arguments)}}(),t.export=function(){var r=y(g.mark((function r(t){return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===t&&(t={privateKey:!1,type:"JsonWebKey2020"}),!_[t.type]){r.next=3;break}return r.abrupt("return",_[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=y(g.mark((function r(t){var e,n,o;return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.publicKey,r.next=3,b.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=y(g.mark((function r(t){return g.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",_.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 j(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){j(i,n,o,a,c,"next",r)}function c(r){j(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=y(g.mark((function r(t){var e,n,o,a,c;return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.secureRandom,n=i.generateKeyPair({isAvailable:!0,randomBytes:e}),o=k(n.publicKey),c=(a="did:key:"+o)+"#"+o,r.abrupt("return",new b({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=y(g.mark((function r(t){var e,n,o;return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=A[t.type](t),n=e.publicKey,o=e.privateKey,r.abrupt("return",new b({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=b=o([l.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 O(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 P()}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 _(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 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:P}}function P(){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,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: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 U(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 W,S=U("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),T=function(r){return e.from(r||"").toString("base64")},G=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"+S.encode(e);if("base64url"===t)return"u"+G(e);throw new Error("Unsupported encoding: "+t)},F=function(r){return Uint8Array.from(e.from(r.x,"base64"))},R={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=S.decode(r.publicKeyBase58),e=void 0;return r.privateKeyBase58&&(e=Uint8Array.from(S.decode(r.privateKeyBase58))),{publicKey:t,privateKey:e}}},C=function(r){if(!R[r.type])throw new Error("Cannot import from unsupported type: "+JSON.stringify(r,null,2));return R[r.type](r)},I={JsonWebKey2020:function(r,t,e,n){var o={kty:"OKP",crv:"Ed25519",x:G(e)},i={id:r,type:"JsonWebKey2020",controller:t,publicKeyJwk:o};return n&&(i.privateKeyJwk=J({},o,{d:G(n.slice(0,n.length/2))})),i},Ed25519VerificationKey2018:function(r,t,e,n){var o={id:r,type:"Ed25519VerificationKey2018",controller:t,publicKeyBase58:S.encode(e)};return n&&(o.privateKeyBase58=S.encode(n)),o}},X={EdDsa:{__proto__:null,signer:function(r){return{sign:function(t){return P(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 P(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)})))()}}}}},M=W=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(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,W.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(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=P(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=S.decode(e.substring(1)))[0]||1!==n[1]){r.next=12;break}return r.next=5,W.from({id:"",controller:"",type:"Ed25519VerificationKey2018",publicKeyBase58:S.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(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=P(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"}),!I[t.type]){r.next=3;break}return r.abrupt("return",I[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(X[r])return X[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(X[r])return X[r].verifier(this.publicKey);throw new Error("Unsupported suite type "+r)},t.getDerivedKeyPairs=function(){var r=P(N.mark((function r(){return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.t0=this,r.next=3,W.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(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",I.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}();M.generate=function(){var r=P(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 W({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)}}(),M.from=function(){var r=P(N.mark((function r(t){var e,n,o;return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=C(t),n=e.publicKey,o=e.privateKey,r.abrupt("return",new W({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 z=r(M=W=o([l.staticImplements()],M)),D=t(M);export{M as Ed25519KeyPair,z as generate,D as resolve};
|
|
1
|
+
import{g as r,a as t}from"./did-key-common.esm-nDfdwcKN-BTWid9-w.js";import{B as e,i as n}from"./main.js";import{_ as o}from"./tslib.es6--gQC4x5c-CmLYFWVC.js";import{x as i,e as a}from"./x25519-CEFq6uo8-NSl6svWQ.js";import"./jsonld-CQCA9cVk-CQeQQNYP.js";import"./_commonjs-dynamic-modules-COweQ1RR-BHR_E30J.js";var c,u,s={exports:{}},f={};var p,l=(u||(u=1,s.exports=(c||(c=1,p=f,Object.defineProperty(p,"__esModule",{value:!0}),p.staticImplements=function(){return function(r){}}),f)),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 y(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 v(){return v=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},v.apply(this,arguments)}var d,w,g=(d=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===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 _(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 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,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: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)}},d(w={exports:{}},w.exports),w.exports);function m(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 b,K=m("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),x=function(r){return e.from(r||"").toString("base64")},E=function(r){return x(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},k=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"+K.encode(e);if("base64url"===t)return"u"+E(e);throw new Error("Unsupported encoding: "+t)},L=function(r){return Uint8Array.from(e.from(r.x,"base64"))},A={JsonWebKey2020:function(r){var t,n=L(r.publicKeyJwk),o=void 0;r.privateKeyJwk&&(o=(t=r.privateKeyJwk,{publicKey:L(t),privateKey:Uint8Array.from(e.from(t.d,"base64"))}).privateKey);return{publicKey:n,privateKey:o}},X25519KeyAgreementKey2019:function(r){var t=K.decode(r.publicKeyBase58),e=void 0;return r.privateKeyBase58&&(e=Uint8Array.from(K.decode(r.privateKeyBase58))),{publicKey:t,privateKey:e}}},_={JsonWebKey2020:function(r,t,e,n){var o={kty:"OKP",crv:"X25519",x:E(e)},i={id:r,type:"JsonWebKey2020",controller:t,publicKeyJwk:o};return n&&(i.privateKeyJwk=v({},o,{d:E(n)})),i},X25519KeyAgreementKey2019:function(r,t,e,n){var o={id:r,type:"X25519KeyAgreementKey2019",controller:t,publicKeyBase58:K.encode(e)};return n&&(o.privateKeyBase58=K.encode(n)),o}},O=b=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=y(g.mark((function r(t){var e,n;return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,b.from(t);case 2:return e=r.sent,n=e.publicKey,r.abrupt("return",k(n));case 5:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}(),r.fromFingerprint=function(){var r=y(g.mark((function r(t){var e,n,o,i;return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.fingerprint,236!==(n=K.decode(e.substring(1)))[0]||1!==n[1]){r.next=12;break}return r.next=5,b.from({id:"",controller:"",type:"X25519KeyAgreementKey2019",publicKeyBase58:K.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=y(g.mark((function r(){return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",k(this.publicKey));case 1:case"end":return r.stop()}}),r,this)})));return function(){return r.apply(this,arguments)}}(),t.export=function(){var r=y(g.mark((function r(t){return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===t&&(t={privateKey:!1,type:"JsonWebKey2020"}),!_[t.type]){r.next=3;break}return r.abrupt("return",_[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=y(g.mark((function r(t){var e,n,o;return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.publicKey,r.next=3,b.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=y(g.mark((function r(t){return g.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",_.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 j(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){j(i,n,o,a,c,"next",r)}function c(r){j(i,n,o,a,c,"throw",r)}a(void 0)}))}}function N(){return N=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},N.apply(this,arguments)}O.generate=function(){var r=y(g.mark((function r(t){var e,n,o,a,c;return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.secureRandom,n=i.generateKeyPair({isAvailable:!0,randomBytes:e}),o=k(n.publicKey),c=(a="did:key:"+o)+"#"+o,r.abrupt("return",new b({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=y(g.mark((function r(t){var e,n,o;return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=A[t.type](t),n=e.publicKey,o=e.privateKey,r.abrupt("return",new b({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=b=o([l.staticImplements()],O);var P=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===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 _(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 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,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: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 U(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 W,S=U("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),T=function(r){return e.from(r||"").toString("base64")},G=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"+S.encode(e);if("base64url"===t)return"u"+G(e);throw new Error("Unsupported encoding: "+t)},F=function(r){return Uint8Array.from(e.from(r.x,"base64"))},C={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=S.decode(r.publicKeyBase58),e=void 0;return r.privateKeyBase58&&(e=Uint8Array.from(S.decode(r.privateKeyBase58))),{publicKey:t,privateKey:e}}},R=function(r){if(!C[r.type])throw new Error("Cannot import from unsupported type: "+JSON.stringify(r,null,2));return C[r.type](r)},I={JsonWebKey2020:function(r,t,e,n){var o={kty:"OKP",crv:"Ed25519",x:G(e)},i={id:r,type:"JsonWebKey2020",controller:t,publicKeyJwk:o};return n&&(i.privateKeyJwk=N({},o,{d:G(n.slice(0,n.length/2))})),i},Ed25519VerificationKey2018:function(r,t,e,n){var o={id:r,type:"Ed25519VerificationKey2018",controller:t,publicKeyBase58:S.encode(e)};return n&&(o.privateKeyBase58=S.encode(n)),o}},X={EdDsa:{__proto__:null,signer:function(r){return{sign:function(t){return J(P.mark((function e(){var n;return P.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(P.mark((function e(){var n,o,i;return P.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)})))()}}}}},M=W=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(P.mark((function r(t){var e,n;return P.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,W.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(P.mark((function r(t){var e,n,o;return P.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(P.mark((function r(t){var e,n,o,i;return P.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.fingerprint,237!==(n=S.decode(e.substring(1)))[0]||1!==n[1]){r.next=12;break}return r.next=5,W.from({id:"",controller:"",type:"Ed25519VerificationKey2018",publicKeyBase58:S.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(P.mark((function r(){return P.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(P.mark((function r(t){return P.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===t&&(t={privateKey:!1,type:"JsonWebKey2020"}),!I[t.type]){r.next=3;break}return r.abrupt("return",I[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(X[r])return X[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(X[r])return X[r].verifier(this.publicKey);throw new Error("Unsupported suite type "+r)},t.getDerivedKeyPairs=function(){var r=J(P.mark((function r(){return P.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.t0=this,r.next=3,W.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(P.mark((function r(t){return P.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",I.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}();M.generate=function(){var r=J(P.mark((function r(t){var e,n,o,i,c;return P.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 W({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)}}(),M.from=function(){var r=J(P.mark((function r(t){var e,n,o;return P.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 W({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 D=r(M=W=o([l.staticImplements()],M)),z=t(M);export{M as Ed25519KeyPair,D as generate,z as resolve};
|