@blockcerts/blockcerts-verifier 1.65.0 → 1.67.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/{EcdsaSd2023-CFEOfg7w-mH0iTn_o.js → EcdsaSd2023-pKawgefE-BjAwvHAC.js} +2 -2
- package/dist/{EcdsaSecp256k1Signature2019-ubMolKKG--XgmQozH.js → EcdsaSecp256k1Signature2019-CRRIiHFR-CvD31J8J.js} +1 -1
- package/dist/{Ed25519Signature2020-BZ-qRxuK-BYYEQJGi.js → Ed25519Signature2020-DjL_FhDh-CA1Qf5Gf.js} +3 -3
- package/dist/{MerkleProof2017-8DlLs_7g-DQaM2JIJ.js → MerkleProof2017-DUjdbiQD-cvAJLFQa.js} +1 -1
- package/dist/{MerkleProof2019-Cv-l9BBE-DWMqt_64.js → MerkleProof2019-FYgdlZOm-D01-ewqk.js} +1 -1
- package/dist/checkCredentialSchemaConformity-BAaThQfx-B48ozDA8.js +1 -0
- package/dist/{controlVerificationMethod-CXY1HfP3-B24OCl2R.js → controlVerificationMethod-Dup4teK9-DYo4OJRU.js} +1 -1
- package/dist/{did-key-common.esm-B-c4r5DX-DkFupqKN.js → did-key-common.esm-DBOb9N8j-DNcrFCWj.js} +1 -1
- package/dist/{did-key-ed25519.esm-BcBjidXA-DBqZ-FkQ.js → did-key-ed25519.esm-Br9nZmXw-D_gjmUgP.js} +1 -1
- package/dist/{did-key-secp256k1.esm-6buyKG_l-BMESYfmC.js → did-key-secp256k1.esm-777F8mD3-BaGBNoUc.js} +1 -1
- package/dist/{index-D-CbTXp7-DPOLY-Lt.js → index-DVormXBF-B-pGO0d3.js} +1 -1
- package/dist/{index-hjoL_SpB-ntvlvLOE.js → index-WJXe0QUW-DmXFAWKQ.js} +7 -7
- package/dist/{index-CUYLWUzw-Bvbn47Hw.js → index-m_ndwqCF-CkZbwhan.js} +7 -7
- package/dist/main.js +151 -116
- package/dist/{retrieveVerificationMethodPublicKey-DVFc1aT7-B_qGml2q.js → retrieveVerificationMethodPublicKey-CqAYJ2Jj-0nfxll3J.js} +1 -1
- package/package.json +2 -2
- package/dist/checkCredentialSchemaConformity-jTrYEW-3-Dd-TT_aS.js +0 -1
- /package/dist/{HashlinkVerifier-_iTrfpkJ-dg5WNZnc.js → HashlinkVerifier-B5AIxwF--dg5WNZnc.js} +0 -0
- /package/dist/{checkRevocationStatusList2021-BnjtBDNQ-XCu3zkCJ.js → checkRevocationStatusList2021-BhUc-vna-XCu3zkCJ.js} +0 -0
- /package/dist/{elliptic-C4nnFoxE-BRLTdj5Y.js → elliptic-BIvJGowH-BRLTdj5Y.js} +0 -0
- /package/dist/{ensureNotRevoked-DWOMZyzg-DvMIgM4L.js → ensureNotRevoked-DtC0S-17-DvMIgM4L.js} +0 -0
- /package/dist/{ensureValidIssuingKey-CCMYu_4t-wu9SdYxL.js → ensureValidIssuingKey-CST0cCIj-wu9SdYxL.js} +0 -0
- /package/dist/{index-DO31KEg9-C0eXpZGn.js → index-CPeLwMJp-C0eXpZGn.js} +0 -0
- /package/dist/{index-DGqgobGj-Dgus2xdV.js → index-D6zPgx9c-Dgus2xdV.js} +0 -0
- /package/dist/{jsonld-B5Vzncdv-C61cS9xX.js → jsonld-GvjJx4Wj-C61cS9xX.js} +0 -0
- /package/dist/{sha256-D1k1uYHq-C1PUWFZm.js → sha256-BmHSm4R7-C1PUWFZm.js} +0 -0
- /package/dist/{webcrypto.es-DlDhx8-u-B87Lqr9a.js → webcrypto.es-tAywRHzi-B87Lqr9a.js} +0 -0
- /package/dist/{x25519-BTjd7-6X-NSl6svWQ.js → x25519-fnqXrhwD-NSl6svWQ.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r}from"./index-CPeLwMJp-C0eXpZGn.js";import{D as o,V as a,A as e,b as t}from"./main.js";var s=r();async function c(r,c){Array.isArray(c)||(c=[c]),Array.isArray(r)||(r=[r]);for(const i of c){const c=await o({url:i.id});let n;try{n=JSON.parse(c)}catch(r){throw console.error(r),new Error(`Specified schema at url: ${i.id} could not be parsed`)}const f=s.validator(n);for(const o of r){if(!f(o))throw new a(e.checkCredentialSchemaConformity,t("errors","checkCredentialSchemaConformity"))}}}export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{V as o,A as t,d as i}from"./main.js";import{b as r}from"./index-
|
|
1
|
+
import{V as o,A as t,d as i}from"./main.js";import{b as r}from"./index-D6zPgx9c-Dgus2xdV.js";function n(n,e=""){const s=function(o){return o.id}(n);if(s!==e.split("#")[0])throw new o(t.controlVerificationMethod,`${r} - ${i.i18n.getText("errors","controlVerificationMethod")}`)}export{n as default};
|
package/dist/{did-key-common.esm-B-c4r5DX-DkFupqKN.js → did-key-common.esm-DBOb9N8j-DNcrFCWj.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as t,B as e}from"./main.js";import{j as r}from"./jsonld-
|
|
1
|
+
import{p as t,B as e}from"./main.js";import{j as r}from"./jsonld-GvjJx4Wj-C61cS9xX.js";var i,o={},n={},c={};function s(){if(i)return c;function t(t){const e=[];for(const r of t)e.indexOf(r)<0&&e.push(r);return e}return i=1,Object.defineProperty(c,"__esModule",{value:!0}),c.uniq=c.recursivePartialOverride=void 0,c.recursivePartialOverride=function e(r,i){if(null==i)return r;const o=Object.getPrototypeOf({});if(Object.getPrototypeOf(i)!=o)return i;let n=Object.assign({},r),c=Object.keys(i);const s=t(Object.keys(n).concat(c));for(const t of s)if(c.indexOf(t)>=0){const r=i[t];if(null!=r&&"object"==typeof r){const i=n[t];n[t]=e(i,r)}else n[t]=r}return n},c.uniq=t,c}var a,d,p,u,y,h,l,g,w,f,v,m,b={};function x(){if(d)return a;d=1;var t=Object.prototype.toString;function e(t){return"function"==typeof t.constructor?t.constructor.name:null}return a=function(r){if(void 0===r)return"undefined";if(null===r)return"null";var i=typeof r;if("boolean"===i)return"boolean";if("string"===i)return"string";if("number"===i)return"number";if("symbol"===i)return"symbol";if("function"===i)return"GeneratorFunction"===e(r)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(r))return"array";if(function(t){if(t.constructor&&"function"==typeof t.constructor.isBuffer)return t.constructor.isBuffer(t);return!1}(r))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(t){if(-1!==t.message.indexOf("callee"))return!0}return!1}(r))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(r))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(r))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(r))return"regexp";switch(e(r)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(r))return"generator";switch(i=t.call(r)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return i.slice(8,-1).toLowerCase().replace(/\s/g,"")}}function _(){if(u)return p;u=1;const t=Symbol.prototype.valueOf,r=x();return p=function(i,o){switch(r(i)){case"array":return i.slice();case"object":return Object.assign({},i);case"date":return new i.constructor(Number(i));case"map":return new Map(i);case"set":return new Set(i);case"buffer":return function(t){const r=t.length,i=e.allocUnsafe?e.allocUnsafe(r):e.from(r);return t.copy(i),i}(i);case"symbol":return function(e){return t?Object(t.call(e)):{}}(i);case"arraybuffer":return function(t){const e=new t.constructor(t.byteLength);return new Uint8Array(e).set(new Uint8Array(t)),e}(i);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return function(t){return new t.constructor(t.buffer,t.byteOffset,t.length)}(i);case"regexp":return function(t){const e=void 0!==t.flags?t.flags:/\w+$/.exec(t)||void 0,r=new t.constructor(t.source,e);return r.lastIndex=t.lastIndex,r}(i);case"error":return Object.create(i);default:return i}}}
|
|
2
2
|
/*!
|
|
3
3
|
* isobject <https://github.com/jonschlinkert/isobject>
|
|
4
4
|
*
|
package/dist/{did-key-ed25519.esm-BcBjidXA-DBqZ-FkQ.js → did-key-ed25519.esm-Br9nZmXw-D_gjmUgP.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as r,a as t}from"./did-key-common.esm-B-c4r5DX-DkFupqKN.js";import{B as e,i as n}from"./main.js";import{_ as o}from"./tslib.es6-CNEFicEt-CmLYFWVC.js";import{x as i,e as a}from"./x25519-BTjd7-6X-NSl6svWQ.js";import"./jsonld-B5Vzncdv-C61cS9xX.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,T=U("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),S=function(r){return e.from(r||"").toString("base64")},B=function(r){return S(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"+T.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=T.decode(r.publicKeyBase58),e=void 0;return r.privateKeyBase58&&(e=Uint8Array.from(T.decode(r.privateKeyBase58))),{publicKey:t,privateKey:e}}},X=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:B(e)},i={id:r,type:"JsonWebKey2020",controller:t,publicKeyJwk:o};return n&&(i.privateKeyJwk=N({},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:T.encode(e)};return n&&(o.privateKeyBase58=T.encode(n)),o}},C={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",G(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=T.decode(e.substring(1)))[0]||1!==n[1]){r.next=12;break}return r.next=5,W.from({id:"",controller:"",type:"Ed25519VerificationKey2018",publicKeyBase58:T.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",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(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(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(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=G(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=X(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-DBOb9N8j-DNcrFCWj.js";import{B as e,i as n}from"./main.js";import{_ as o}from"./tslib.es6-CNEFicEt-CmLYFWVC.js";import{x as i,e as a}from"./x25519-fnqXrhwD-NSl6svWQ.js";import"./jsonld-GvjJx4Wj-C61cS9xX.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(_([])));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 j(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 _(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.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(j),!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),j(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;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:_(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}}},j={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"}),!j[t.type]){r.next=3;break}return r.abrupt("return",j[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",j.JsonWebKey2020(this.id,this.controller,this.publicKey,t?this.privateKey:void 0));case 3:case"end":return r.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),r}();function _(r,t,e,n,o,i,a){try{var c=r[i](a),u=c.value}catch(r){return void e(r)}c.done?t(u):Promise.resolve(u).then(n,o)}function J(r){return function(){var t=this,e=arguments;return new Promise((function(n,o){var i=r.apply(t,e);function a(r){_(i,n,o,a,c,"next",r)}function c(r){_(i,n,o,a,c,"throw",r)}a(void 0)}))}}function 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(_([])));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 j(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 _(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.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(j),!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),j(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;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:_(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}}},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)},X={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}},C={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"}),!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(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",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(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=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 D=r(M=W=o([l.staticImplements()],M)),z=t(M);export{M as Ed25519KeyPair,D as generate,z as resolve};
|