@blockcerts/blockcerts-verifier 1.71.0 → 1.72.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 +1 -1
- package/dist/{DataIntegrityProof-elCNKq16-DBDuaDNt.js → DataIntegrityProof-CsicZNrL-BkSRjzkI.js} +1 -1
- package/dist/{EcdsaSd2023-B0XPAIp6-K61axvBA.js → EcdsaSd2023-DN9HBdgh-Bc0hVwTd.js} +4 -4
- package/dist/EcdsaSecp256k1Signature2019-C3F03t_M-DAJeMTpu.js +1 -0
- package/dist/{Ed25519Signature2020-BQsESRnS-TKZI_1AX.js → Ed25519Signature2020-CglkQLKN-CQ6lMzyG.js} +2 -2
- package/dist/{EddsaRdfc2022-DQKzWHK4-BILzDBp-.js → EddsaRdfc2022-CfoLi-PP-l7ITLQQT.js} +2 -2
- package/dist/{MerkleProof2017-CYM8CJHB-FYpMvld0.js → MerkleProof2017-B_EJmYja-CYd4dJc1.js} +1 -1
- package/dist/{MerkleProof2019-BLrywo8h-Bo9rH2Eq.js → MerkleProof2019-B7t13hOo-D8n9YrUw.js} +1 -1
- package/dist/{checkCredentialSchemaConformity-CKNtOu_t-B9iaCRUE.js → checkCredentialSchemaConformity-BiggGGMP-Dx992E4t.js} +1 -1
- package/dist/{controlVerificationMethod-B4TgLED0-BGpxLjMq.js → controlVerificationMethod-Bh_-e0Fd-BUCC8ctY.js} +1 -1
- package/dist/{did-key-common.esm-BIftA62j-hVrUMxjy.js → did-key-common.esm-BELyYVSE-Cqrpf7cy.js} +3 -3
- package/dist/{did-key-ed25519.esm-Drn3Y7PF-CqD0ifNk.js → did-key-ed25519.esm-C3GUddDp-BJdBgNDg.js} +1 -1
- package/dist/{did-key-secp256k1.esm-DH-f3o5q-C66E7IxB.js → did-key-secp256k1.esm-D-R266jM-BTxlD5VW.js} +1 -1
- package/dist/downloadPDF-D2qwT_DJ.js +297 -0
- package/dist/{ed25519-key-pair.esm-DPOFpdJ2-BrwuS0Ia.js → ed25519-key-pair.esm-DQF2kkXh-XX5BXBcl.js} +3 -3
- package/dist/{elliptic-BYqApR8Y-CKp7atgR.js → elliptic-6I21PEnR-CsYseRX1.js} +1 -1
- package/dist/{index-BgTFEYQ4-DMaz98iZ.js → index-DXh-XAic-B2gT500V.js} +5 -5
- package/dist/{index-lyuTDW_o-nyi7dklX.js → index-fQcSLZgh-DpptYyN8.js} +1 -1
- package/dist/{index.es-B7xY76Pb.js → index.es-BIiEi3w5.js} +1 -1
- package/dist/{jsonld-signatures-BbILf-Q7-DTp6__ud.js → jsonld-signatures-BbHr1fSN-BSospRuX.js} +5 -5
- package/dist/{keyUtils-ExMI0fmg-NVOmd8LH.js → keyUtils-ue8EY3Op-DoHdKWgN.js} +1 -1
- package/dist/main.js +45 -45
- package/dist/{retrieveVerificationMethodPublicKey-C5Gafl1E-Lv4waRy7.js → retrieveVerificationMethodPublicKey-CLBY4G8P-CagFGnNt.js} +1 -1
- package/dist/verifyIssuerProfile-BaiZaU2c-Zcu1X0PY.js +1 -0
- package/package.json +5 -5
- package/dist/EcdsaSecp256k1Signature2019-BHgoxmKI-DT2qHZod.js +0 -1
- package/dist/downloadPDF-eGAsbwF0.js +0 -346
- package/dist/verifyIssuerProfile-DCJyz3ho-BwuCK9F3.js +0 -1
- /package/dist/{HashlinkVerifier-BsVlaml5-B4Niv2-b.js → HashlinkVerifier-CTG-OS14-B4Niv2-b.js} +0 -0
- /package/dist/{checkRevocationStatusList2021-CMAVXAVE-BEBD8TO8.js → checkRevocationStatusList2021-BDBFhnz6-BEBD8TO8.js} +0 -0
- /package/dist/{elliptic-4aZS_cwf-BpaNaVm0.js → elliptic-mDX7fQQx-BpaNaVm0.js} +0 -0
- /package/dist/{ensureNotRevoked-hGps0prO-DvMIgM4L.js → ensureNotRevoked-Dc6VA2bO-DvMIgM4L.js} +0 -0
- /package/dist/{ensureValidIssuingKey-BMVCi2T2-BdV46XBb.js → ensureValidIssuingKey-wTUvNuDH-BdV46XBb.js} +0 -0
- /package/dist/{index-CQYVZlSE-C0eXpZGn.js → index-BrurC4Vt-C0eXpZGn.js} +0 -0
- /package/dist/{index-BS134367-Dgus2xdV.js → index-Gr4i_Ned-Dgus2xdV.js} +0 -0
- /package/dist/{jsonld-B_Q2jvnp-BJ5uVeOU.js → jsonld-BAMY2WqE-BJ5uVeOU.js} +0 -0
- /package/dist/{sha256-u2xsd4MQ-C1PUWFZm.js → sha256-Bwge_vjI-C1PUWFZm.js} +0 -0
- /package/dist/{webcrypto.es-DpqeDikX-BnVhHKeM.js → webcrypto.es-DptGOl2T-BnVhHKeM.js} +0 -0
- /package/dist/{x25519-Kp6t9B5a-Dh8L0KYb.js → x25519-hG3WOzPe-Dh8L0KYb.js} +0 -0
package/dist/{did-key-ed25519.esm-Drn3Y7PF-CqD0ifNk.js → did-key-ed25519.esm-C3GUddDp-BJdBgNDg.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as r,a as t}from"./did-key-common.esm-BIftA62j-hVrUMxjy.js";import{B as e,i as n}from"./main.js";import{_ as o}from"./tslib.es6--gQC4x5c-CmLYFWVC.js";import{e as i,x as a}from"./x25519-Kp6t9B5a-Dh8L0KYb.js";import"./jsonld-B_Q2jvnp-BJ5uVeOU.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 j(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(O([])));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 j(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(A,this),this.reset(!0)}function O(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=O,j.prototype={constructor:j,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:O(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}},j=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=a.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 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 J(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 P(){return P=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},P.apply(this,arguments)}j.generate=function(){var r=y(g.mark((function r(t){var e,n,o,i,c;return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.secureRandom,n=a.generateKeyPair({isAvailable:!0,randomBytes:e}),o=k(n.publicKey),c=(i="did:key:"+o)+"#"+o,r.abrupt("return",new b({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)}}(),j.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)}}(),j=b=o([l.staticImplements()],j);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 j(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(O([])));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 j(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(A,this),this.reset(!0)}function O(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=O,j.prototype={constructor:j,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:O(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")},B=function(r){return T(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},G=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"+B(e);throw new Error("Unsupported encoding: "+t)},F=function(r){return Uint8Array.from(e.from(r.x,"base64"))},I={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(!I[r.type])throw new Error("Cannot import from unsupported type: "+JSON.stringify(r,null,2));return I[r.type](r)},X={JsonWebKey2020:function(r,t,e,n){var o={kty:"OKP",crv:"Ed25519",x:B(e)},i={id:r,type:"JsonWebKey2020",controller:t,publicKeyJwk:o};return n&&(i.privateKeyJwk=P({},o,{d:B(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}},C={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",i.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,a;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.data,o=t.signature,a=!1;try{a=i.verify(r,n,o)}catch(r){}return e.abrupt("return",a);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(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",G(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=i.convertPublicKeyToX25519(t.publicKey),n=void 0,t.privateKey&&(n=i.convertSecretKeyToX25519(t.privateKey)),o=new j({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=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(N.mark((function r(){return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",G(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"}),!X[t.type]){r.next=3;break}return r.abrupt("return",X[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=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,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(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",X.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(N.mark((function r(t){var e,n,o,a,c;return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.secureRandom,n=i.generateKeyPair({isAvailable:!0,randomBytes:e}),o=G(n.publicKey),c=(a="did:key:"+o)+"#"+o,r.abrupt("return",new W({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)}}(),M.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 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-BELyYVSE-Cqrpf7cy.js";import{B as e,i as n}from"./main.js";import{_ as o}from"./tslib.es6--gQC4x5c-CmLYFWVC.js";import{e as i,x as a}from"./x25519-hG3WOzPe-Dh8L0KYb.js";import"./jsonld-BAMY2WqE-BJ5uVeOU.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 _(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(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 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 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,_.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: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)}},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}}},O={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}},_=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"}),!O[t.type]){r.next=3;break}return r.abrupt("return",O[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=a.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",O.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 P(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){P(i,n,o,a,c,"next",r)}function c(r){P(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=y(g.mark((function r(t){var e,n,o,i,c;return g.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.secureRandom,n=a.generateKeyPair({isAvailable:!0,randomBytes:e}),o=k(n.publicKey),c=(i="did:key:"+o)+"#"+o,r.abrupt("return",new b({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)}}(),_.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)}}(),_=b=o([l.staticImplements()],_);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(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 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 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,_.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: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 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")},B=function(r){return T(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},G=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"+B(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}}},I=function(r){if(!R[r.type])throw new Error("Cannot import from unsupported type: "+JSON.stringify(r,null,2));return R[r.type](r)},M={JsonWebKey2020:function(r,t,e,n){var o={kty:"OKP",crv:"Ed25519",x:B(e)},i={id:r,type:"JsonWebKey2020",controller:t,publicKeyJwk:o};return n&&(i.privateKeyJwk=J({},o,{d:B(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(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",i.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,a;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.data,o=t.signature,a=!1;try{a=i.verify(r,n,o)}catch(r){}return e.abrupt("return",a);case 4:case"end":return e.stop()}}),e)})))()}}}}},C=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(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",G(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=i.convertPublicKeyToX25519(t.publicKey),n=void 0,t.privateKey&&(n=i.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=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=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(N.mark((function r(){return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",G(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"}),!M[t.type]){r.next=3;break}return r.abrupt("return",M[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(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=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",M.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}();C.generate=function(){var r=j(N.mark((function r(t){var e,n,o,a,c;return N.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=t.secureRandom,n=i.generateKeyPair({isAvailable:!0,randomBytes:e}),o=G(n.publicKey),c=(a="did:key:"+o)+"#"+o,r.abrupt("return",new W({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)}}(),C.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=I(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(C=W=o([l.staticImplements()],C)),D=t(C);export{C as Ed25519KeyPair,z as generate,D as resolve};
|