@blockcerts/blockcerts-verifier 1.72.0 → 1.72.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/.husky/commit-msg +0 -3
  2. package/.husky/pre-commit +0 -3
  3. package/.husky/pre-push +0 -3
  4. package/bundle-stats.html +33 -32
  5. package/coverage/lcov-report/base.css +224 -0
  6. package/coverage/lcov-report/block-navigation.js +87 -0
  7. package/coverage/lcov-report/favicon.png +0 -0
  8. package/coverage/lcov-report/prettify.css +1 -0
  9. package/coverage/lcov-report/prettify.js +2 -0
  10. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  11. package/coverage/lcov-report/sorter.js +210 -0
  12. package/coverage/lcov.info +7030 -0
  13. package/dist/{DataIntegrityProof-CsicZNrL-BkSRjzkI.js → DataIntegrityProof-BhL7Kkhm-affsdujn.js} +2 -2
  14. package/dist/EcdsaSd2023-CUjrjGzC-Cx7ejHu-.js +30 -0
  15. package/dist/EcdsaSecp256k1Signature2019-D90cAynb-Bf5kILPF.js +1 -0
  16. package/dist/{Ed25519Signature2020-CglkQLKN-CQ6lMzyG.js → Ed25519Signature2020-fJGvlbIp-B6XhFwr4.js} +4 -4
  17. package/dist/EddsaRdfc2022-XufziFi3-D5IoKiRE.js +14 -0
  18. package/dist/HashlinkVerifier-udsj5z09-BTqOkVoD.js +8 -0
  19. package/dist/MerkleProof2017-C0RhRNNx-zjQMRSQY.js +1 -0
  20. package/dist/MerkleProof2017-C499XBV8-l50m9izr.js +74 -0
  21. package/dist/MerkleProof2019-B7f1hhem-CjLDyx6Q.js +5 -0
  22. package/dist/Suite-Bu3gszvt-Dmvbh142.js +33 -0
  23. package/dist/_polyfill-node.crypto-DGISCHrB-C5-OOGc0.js +1 -0
  24. package/dist/checkCredentialSchemaConformity-CgpOS3eC-AjSPoJub.js +1 -0
  25. package/dist/{checkRevocationStatusList2021-BDBFhnz6-BEBD8TO8.js → checkRevocationStatusList2021-D4VNDRlW-DgNfOAoI.js} +2 -2
  26. package/dist/controlVerificationMethod-CSwPoUL8-CvUADmjg.js +1 -0
  27. package/dist/downloadPDF-UAsY-nU_.js +297 -0
  28. package/dist/ed25519-key-pair.esm-DxoBwwVJ-D8j8wFfG.js +1 -0
  29. package/dist/ensureNotRevoked-ByWaYoog-BheL-ZKZ.js +1 -0
  30. package/dist/ensureNotRevoked-C1kT3A6R-oFUZltl3.js +1 -0
  31. package/dist/{ensureValidIssuingKey-wTUvNuDH-BdV46XBb.js → ensureValidIssuingKey-DEV9E0Ph-DY8BTObG.js} +1 -1
  32. package/dist/index-DZ7aUhT_-D0G2DVsh.js +29 -0
  33. package/dist/index-DjD0A6uJ-BdFUkPCF.js +33 -0
  34. package/dist/index-RfFwckcH.js +1 -0
  35. package/dist/index-tlZQQ_rg-CYTlxhyY.js +1 -0
  36. package/dist/index.es-CnYWLNZV.js +56 -0
  37. package/dist/jsonld-signatures-D4X_Irzi-D_wBqxSl.js +56 -0
  38. package/dist/main.js +142 -133
  39. package/dist/pako.esm-BGRKTPxS-Bodm4Eha.js +2 -0
  40. package/dist/purify.es-Om653OSQ.js +2 -0
  41. package/dist/retrieveVerificationMethodPublicKey-D_autuwE-DGbK-RPm.js +1 -0
  42. package/dist/sha2-JcCWfgvE-By1_saxP.js +2 -0
  43. package/dist/verifyIssuerProfile-2PhdMtQZ-CfqcAkBL.js +1 -0
  44. package/dist/webcrypto.es-BOyMRPOj-CAxP3jJR.js +40 -0
  45. package/package.json +15 -16
  46. package/vitest.config.ts +4 -1
  47. package/dist/EcdsaSd2023-DN9HBdgh-Bc0hVwTd.js +0 -30
  48. package/dist/EcdsaSecp256k1Signature2019-C3F03t_M-DAJeMTpu.js +0 -1
  49. package/dist/EddsaRdfc2022-CfoLi-PP-l7ITLQQT.js +0 -14
  50. package/dist/HashlinkVerifier-CTG-OS14-B4Niv2-b.js +0 -8
  51. package/dist/MerkleProof2017-B_EJmYja-CYd4dJc1.js +0 -1
  52. package/dist/MerkleProof2017-MZJbBTpc-Cwfnte6F.js +0 -75
  53. package/dist/MerkleProof2019-B7t13hOo-D8n9YrUw.js +0 -13
  54. package/dist/Suite-BmP2Qu19-D1ucdMDB.js +0 -1
  55. package/dist/_commonjs-dynamic-modules-COweQ1RR-BHR_E30J.js +0 -1
  56. package/dist/base64url-Cy03LJLt-vkTPfQOh.js +0 -4
  57. package/dist/checkCredentialSchemaConformity-BiggGGMP-Dx992E4t.js +0 -1
  58. package/dist/controlVerificationMethod-Bh_-e0Fd-BUCC8ctY.js +0 -1
  59. package/dist/did-key-common.esm-BELyYVSE-Cqrpf7cy.js +0 -9
  60. package/dist/did-key-ed25519.esm-C3GUddDp-BJdBgNDg.js +0 -1
  61. package/dist/did-key-secp256k1.esm-D-R266jM-BTxlD5VW.js +0 -1
  62. package/dist/downloadPDF-D2qwT_DJ.js +0 -297
  63. package/dist/ed25519-key-pair.esm-DQF2kkXh-XX5BXBcl.js +0 -25
  64. package/dist/elliptic-6I21PEnR-CsYseRX1.js +0 -1
  65. package/dist/elliptic-mDX7fQQx-BpaNaVm0.js +0 -1
  66. package/dist/ensureNotRevoked-Dc6VA2bO-DvMIgM4L.js +0 -1
  67. package/dist/ensureNotRevoked-gui-UMnE-o08xNOvL.js +0 -1
  68. package/dist/index-BrurC4Vt-C0eXpZGn.js +0 -1
  69. package/dist/index-CEj3k9G6.js +0 -2
  70. package/dist/index-DXh-XAic-B2gT500V.js +0 -22
  71. package/dist/index-DZLKRa_V-D_IQzjvG.js +0 -5
  72. package/dist/index-fQcSLZgh-DpptYyN8.js +0 -1
  73. package/dist/index.es-BIiEi3w5.js +0 -56
  74. package/dist/jsonld-BAMY2WqE-BJ5uVeOU.js +0 -36
  75. package/dist/jsonld-signatures-BbHr1fSN-BSospRuX.js +0 -74
  76. package/dist/keyUtils-ue8EY3Op-DoHdKWgN.js +0 -1
  77. package/dist/pako.esm-BGRKTPxS-UdHShO7y.js +0 -2
  78. package/dist/purify.es-CkKsfeyH.js +0 -2
  79. package/dist/retrieveVerificationMethodPublicKey-CLBY4G8P-CagFGnNt.js +0 -1
  80. package/dist/sha256-Bwge_vjI-C1PUWFZm.js +0 -1
  81. package/dist/verifyIssuerProfile-BaiZaU2c-Zcu1X0PY.js +0 -1
  82. package/dist/webcrypto.es-DptGOl2T-BnVhHKeM.js +0 -40
  83. package/dist/x25519-hG3WOzPe-Dh8L0KYb.js +0 -1
  84. /package/dist/{index-Gr4i_Ned-Dgus2xdV.js → index-CyNtT_1q-Dgus2xdV.js} +0 -0
@@ -0,0 +1 @@
1
+ import{y as t,m as r,B as e}from"./main.js";import{_ as n}from"./tslib.es6--gQC4x5c-CmLYFWVC.js";import{_ as o}from"./_polyfill-node.crypto-DGISCHrB-C5-OOGc0.js";var i,a={},u={},s={},c={};function f(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var h,l={},p={};function y(){if(h)return p;return h=1,Object.defineProperty(p,"__esModule",{value:!0}),p.wipe=function(t){for(var r=0;r<t.length;r++)t[r]=0;return t},p}var d,v,w=t(o);function g(){if(d)return l;d=1,Object.defineProperty(l,"__esModule",{value:!0}),l.NodeRandomSource=void 0;const t=y();return l.NodeRandomSource=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,void 0!==f){const t=w;t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let e=this._crypto.randomBytes(r);if(e.length!==r)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(r);for(let t=0;t<n.length;t++)n[t]=e[t];return(0,t.wipe)(e),n}},l}function b(){if(v)return s;v=1,Object.defineProperty(s,"__esModule",{value:!0}),s.SystemRandomSource=void 0;const t=(i||(i=1,Object.defineProperty(c,"__esModule",{value:!0}),c.BrowserRandomSource=void 0,c.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t="undefined"!=typeof self?self.crypto||self.msCrypto:null;t&&void 0!==t.getRandomValues&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(t);for(let t=0;t<r.length;t+=65536)this._crypto.getRandomValues(r.subarray(t,t+Math.min(r.length-t,65536)));return r}}),c),r=g();return s.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new t.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new r.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}},s}var m,E,_,L={},K={};function A(){if(E)return L;E=1,Object.defineProperty(L,"__esModule",{value:!0});var t,r=(m||(m=1,t=K,Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(t,r){var e=65535&t,n=65535&r;return e*n+((t>>>16&65535)*n+e*(r>>>16&65535)<<16>>>0)|0},t.add=function(t,r){return t+r|0},t.sub=function(t,r){return t-r|0},t.rotl=function(t,r){return t<<r|t>>>32-r},t.rotr=function(t,r){return t<<32-r|t>>>r},t.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(r){return t.isInteger(r)&&r>=-t.MAX_SAFE_INTEGER&&r<=t.MAX_SAFE_INTEGER}),K);function e(t,r,e){return void 0===r&&(r=new Uint8Array(2)),void 0===e&&(e=0),r[e+0]=t>>>8,r[e+1]=t>>>0,r}function n(t,r,e){return void 0===r&&(r=new Uint8Array(2)),void 0===e&&(e=0),r[e+0]=t>>>0,r[e+1]=t>>>8,r}function o(t,r){return void 0===r&&(r=0),t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3]}function i(t,r){return void 0===r&&(r=0),(t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3])>>>0}function a(t,r){return void 0===r&&(r=0),t[r+3]<<24|t[r+2]<<16|t[r+1]<<8|t[r]}function u(t,r){return void 0===r&&(r=0),(t[r+3]<<24|t[r+2]<<16|t[r+1]<<8|t[r])>>>0}function s(t,r,e){return void 0===r&&(r=new Uint8Array(4)),void 0===e&&(e=0),r[e+0]=t>>>24,r[e+1]=t>>>16,r[e+2]=t>>>8,r[e+3]=t>>>0,r}function c(t,r,e){return void 0===r&&(r=new Uint8Array(4)),void 0===e&&(e=0),r[e+0]=t>>>0,r[e+1]=t>>>8,r[e+2]=t>>>16,r[e+3]=t>>>24,r}function f(t,r,e){return void 0===r&&(r=new Uint8Array(8)),void 0===e&&(e=0),s(t/4294967296>>>0,r,e),s(t>>>0,r,e+4),r}function h(t,r,e){return void 0===r&&(r=new Uint8Array(8)),void 0===e&&(e=0),c(t>>>0,r,e),c(t/4294967296>>>0,r,e+4),r}return L.readInt16BE=function(t,r){return void 0===r&&(r=0),(t[r+0]<<8|t[r+1])<<16>>16},L.readUint16BE=function(t,r){return void 0===r&&(r=0),(t[r+0]<<8|t[r+1])>>>0},L.readInt16LE=function(t,r){return void 0===r&&(r=0),(t[r+1]<<8|t[r])<<16>>16},L.readUint16LE=function(t,r){return void 0===r&&(r=0),(t[r+1]<<8|t[r])>>>0},L.writeUint16BE=e,L.writeInt16BE=e,L.writeUint16LE=n,L.writeInt16LE=n,L.readInt32BE=o,L.readUint32BE=i,L.readInt32LE=a,L.readUint32LE=u,L.writeUint32BE=s,L.writeInt32BE=s,L.writeUint32LE=c,L.writeInt32LE=c,L.readInt64BE=function(t,r){void 0===r&&(r=0);var e=o(t,r),n=o(t,r+4);return 4294967296*e+n-4294967296*(n>>31)},L.readUint64BE=function(t,r){return void 0===r&&(r=0),4294967296*i(t,r)+i(t,r+4)},L.readInt64LE=function(t,r){void 0===r&&(r=0);var e=a(t,r);return 4294967296*a(t,r+4)+e-4294967296*(e>>31)},L.readUint64LE=function(t,r){void 0===r&&(r=0);var e=u(t,r);return 4294967296*u(t,r+4)+e},L.writeUint64BE=f,L.writeInt64BE=f,L.writeUint64LE=h,L.writeInt64LE=h,L.readUintBE=function(t,r,e){if(void 0===e&&(e=0),t%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>r.length-e)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,o=1,i=t/8+e-1;i>=e;i--)n+=r[i]*o,o*=256;return n},L.readUintLE=function(t,r,e){if(void 0===e&&(e=0),t%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>r.length-e)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,o=1,i=e;i<e+t/8;i++)n+=r[i]*o,o*=256;return n},L.writeUintBE=function(t,e,n,o){if(void 0===n&&(n=new Uint8Array(t/8)),void 0===o&&(o=0),t%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!r.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,a=t/8+o-1;a>=o;a--)n[a]=e/i&255,i*=256;return n},L.writeUintLE=function(t,e,n,o){if(void 0===n&&(n=new Uint8Array(t/8)),void 0===o&&(o=0),t%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!r.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,a=o;a<o+t/8;a++)n[a]=e/i&255,i*=256;return n},L.readFloat32BE=function(t,r){return void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(r)},L.readFloat32LE=function(t,r){return void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(r,!0)},L.readFloat64BE=function(t,r){return void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(r)},L.readFloat64LE=function(t,r){return void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(r,!0)},L.writeFloat32BE=function(t,r,e){return void 0===r&&(r=new Uint8Array(4)),void 0===e&&(e=0),new DataView(r.buffer,r.byteOffset,r.byteLength).setFloat32(e,t),r},L.writeFloat32LE=function(t,r,e){return void 0===r&&(r=new Uint8Array(4)),void 0===e&&(e=0),new DataView(r.buffer,r.byteOffset,r.byteLength).setFloat32(e,t,!0),r},L.writeFloat64BE=function(t,r,e){return void 0===r&&(r=new Uint8Array(8)),void 0===e&&(e=0),new DataView(r.buffer,r.byteOffset,r.byteLength).setFloat64(e,t),r},L.writeFloat64LE=function(t,r,e){return void 0===r&&(r=new Uint8Array(8)),void 0===e&&(e=0),new DataView(r.buffer,r.byteOffset,r.byteLength).setFloat64(e,t,!0),r},L}function x(){return _||(_=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const r=b(),e=A(),n=y();function o(r,e=t.defaultRandomSource){return e.randomBytes(r)}t.defaultRandomSource=new r.SystemRandomSource,t.randomBytes=o,t.randomUint32=function(r=t.defaultRandomSource){const i=o(4,r),a=(0,e.readUint32LE)(i);return(0,n.wipe)(i),a};const i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(r,e=i,a=t.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let u="";const s=e.length,c=256-256%s;for(;r>0;){const t=o(Math.ceil(256*r/c),a);for(let n=0;n<t.length&&r>0;n++){const o=t[n];o<c&&(u+=e.charAt(o%s),r--)}(0,n.wipe)(t)}return u}t.randomString=a,t.randomStringForEntropy=function(r,e=i,n=t.defaultRandomSource){return a(Math.ceil(r/(Math.log(e.length)/Math.LN2)),e,n)}}(u)),u}var M,U,S={};var B,N=(U||(U=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const r=x(),e=(M||(M=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=A(),e=y();t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var n=function(){function n(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return n.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},n.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},n.prototype.clean=function(){e.wipe(this._buffer),e.wipe(this._tempHi),e.wipe(this._tempLo),this.reset()},n.prototype.update=function(r,e){if(void 0===e&&(e=r.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=e,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&e>0;)this._buffer[this._bufferLength++]=r[n++],e--;this._bufferLength===this.blockSize&&(i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(e>=this.blockSize&&(n=i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,r,n,e),e%=this.blockSize);e>0;)this._buffer[this._bufferLength++]=r[n++],e--;return this},n.prototype.finish=function(t){if(!this._finished){var e=this._bytesHashed,n=this._bufferLength,o=e/536870912|0,a=e<<3,u=e%128<112?128:256;this._buffer[n]=128;for(var s=n+1;s<u-8;s++)this._buffer[s]=0;r.writeUint32BE(o,this._buffer,u-8),r.writeUint32BE(a,this._buffer,u-4),i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,u),this._finished=!0}for(s=0;s<this.digestLength/8;s++)r.writeUint32BE(this._stateHi[s],t,8*s),r.writeUint32BE(this._stateLo[s],t,8*s+4);return this},n.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},n.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},n.prototype.restoreState=function(t){return this._stateHi.set(t.stateHi),this._stateLo.set(t.stateLo),this._bufferLength=t.bufferLength,t.buffer&&this._buffer.set(t.buffer),this._bytesHashed=t.bytesHashed,this._finished=!1,this},n.prototype.cleanSavedState=function(t){e.wipe(t.stateHi),e.wipe(t.stateLo),t.buffer&&e.wipe(t.buffer),t.bufferLength=0,t.bytesHashed=0},n}();t.SHA512=n;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function i(t,e,n,i,a,u,s){for(var c,f,h,l,p,y,d,v,w=n[0],g=n[1],b=n[2],m=n[3],E=n[4],_=n[5],L=n[6],K=n[7],A=i[0],x=i[1],M=i[2],U=i[3],S=i[4],B=i[5],N=i[6],k=i[7];s>=128;){for(var T=0;T<16;T++){var H=8*T+u;t[T]=r.readUint32BE(a,H),e[T]=r.readUint32BE(a,H+4)}for(T=0;T<80;T++){var P,O,I=w,G=g,F=b,j=m,R=E,J=_,C=L,D=A,X=x,Y=M,V=U,W=S,z=B,q=N;if(p=65535&(f=k),y=f>>>16,d=65535&(c=K),v=c>>>16,p+=65535&(f=(S>>>14|E<<18)^(S>>>18|E<<14)^(E>>>9|S<<23)),y+=f>>>16,d+=65535&(c=(E>>>14|S<<18)^(E>>>18|S<<14)^(S>>>9|E<<23)),v+=c>>>16,p+=65535&(f=S&B^~S&N),y+=f>>>16,d+=65535&(c=E&_^~E&L),v+=c>>>16,c=o[2*T],p+=65535&(f=o[2*T+1]),y+=f>>>16,d+=65535&c,v+=c>>>16,c=t[T%16],y+=(f=e[T%16])>>>16,d+=65535&c,v+=c>>>16,d+=(y+=(p+=65535&f)>>>16)>>>16,p=65535&(f=l=65535&p|y<<16),y=f>>>16,d=65535&(c=h=65535&d|(v+=d>>>16)<<16),v=c>>>16,p+=65535&(f=(A>>>28|w<<4)^(w>>>2|A<<30)^(w>>>7|A<<25)),y+=f>>>16,d+=65535&(c=(w>>>28|A<<4)^(A>>>2|w<<30)^(A>>>7|w<<25)),v+=c>>>16,y+=(f=A&x^A&M^x&M)>>>16,d+=65535&(c=w&g^w&b^g&b),v+=c>>>16,P=65535&(d+=(y+=(p+=65535&f)>>>16)>>>16)|(v+=d>>>16)<<16,O=65535&p|y<<16,p=65535&(f=V),y=f>>>16,d=65535&(c=j),v=c>>>16,y+=(f=l)>>>16,d+=65535&(c=h),v+=c>>>16,g=I,b=G,m=F,E=j=65535&(d+=(y+=(p+=65535&f)>>>16)>>>16)|(v+=d>>>16)<<16,_=R,L=J,K=C,w=P,x=D,M=X,U=Y,S=V=65535&p|y<<16,B=W,N=z,k=q,A=O,T%16==15)for(H=0;H<16;H++)c=t[H],p=65535&(f=e[H]),y=f>>>16,d=65535&c,v=c>>>16,c=t[(H+9)%16],p+=65535&(f=e[(H+9)%16]),y+=f>>>16,d+=65535&c,v+=c>>>16,h=t[(H+1)%16],p+=65535&(f=((l=e[(H+1)%16])>>>1|h<<31)^(l>>>8|h<<24)^(l>>>7|h<<25)),y+=f>>>16,d+=65535&(c=(h>>>1|l<<31)^(h>>>8|l<<24)^h>>>7),v+=c>>>16,h=t[(H+14)%16],y+=(f=((l=e[(H+14)%16])>>>19|h<<13)^(h>>>29|l<<3)^(l>>>6|h<<26))>>>16,d+=65535&(c=(h>>>19|l<<13)^(l>>>29|h<<3)^h>>>6),v+=c>>>16,v+=(d+=(y+=(p+=65535&f)>>>16)>>>16)>>>16,t[H]=65535&d|v<<16,e[H]=65535&p|y<<16}p=65535&(f=A),y=f>>>16,d=65535&(c=w),v=c>>>16,c=n[0],y+=(f=i[0])>>>16,d+=65535&c,v+=c>>>16,v+=(d+=(y+=(p+=65535&f)>>>16)>>>16)>>>16,n[0]=w=65535&d|v<<16,i[0]=A=65535&p|y<<16,p=65535&(f=x),y=f>>>16,d=65535&(c=g),v=c>>>16,c=n[1],y+=(f=i[1])>>>16,d+=65535&c,v+=c>>>16,v+=(d+=(y+=(p+=65535&f)>>>16)>>>16)>>>16,n[1]=g=65535&d|v<<16,i[1]=x=65535&p|y<<16,p=65535&(f=M),y=f>>>16,d=65535&(c=b),v=c>>>16,c=n[2],y+=(f=i[2])>>>16,d+=65535&c,v+=c>>>16,v+=(d+=(y+=(p+=65535&f)>>>16)>>>16)>>>16,n[2]=b=65535&d|v<<16,i[2]=M=65535&p|y<<16,p=65535&(f=U),y=f>>>16,d=65535&(c=m),v=c>>>16,c=n[3],y+=(f=i[3])>>>16,d+=65535&c,v+=c>>>16,v+=(d+=(y+=(p+=65535&f)>>>16)>>>16)>>>16,n[3]=m=65535&d|v<<16,i[3]=U=65535&p|y<<16,p=65535&(f=S),y=f>>>16,d=65535&(c=E),v=c>>>16,c=n[4],y+=(f=i[4])>>>16,d+=65535&c,v+=c>>>16,v+=(d+=(y+=(p+=65535&f)>>>16)>>>16)>>>16,n[4]=E=65535&d|v<<16,i[4]=S=65535&p|y<<16,p=65535&(f=B),y=f>>>16,d=65535&(c=_),v=c>>>16,c=n[5],y+=(f=i[5])>>>16,d+=65535&c,v+=c>>>16,v+=(d+=(y+=(p+=65535&f)>>>16)>>>16)>>>16,n[5]=_=65535&d|v<<16,i[5]=B=65535&p|y<<16,p=65535&(f=N),y=f>>>16,d=65535&(c=L),v=c>>>16,c=n[6],y+=(f=i[6])>>>16,d+=65535&c,v+=c>>>16,v+=(d+=(y+=(p+=65535&f)>>>16)>>>16)>>>16,n[6]=L=65535&d|v<<16,i[6]=N=65535&p|y<<16,p=65535&(f=k),y=f>>>16,d=65535&(c=K),v=c>>>16,c=n[7],y+=(f=i[7])>>>16,d+=65535&c,v+=c>>>16,v+=(d+=(y+=(p+=65535&f)>>>16)>>>16)>>>16,n[7]=K=65535&d|v<<16,i[7]=k=65535&p|y<<16,u+=128,s-=128}return u}t.hash=function(t){var r=new n;r.update(t);var e=r.digest();return r.clean(),e}}(S)),S),n=y();function o(t){const r=new Float64Array(16);if(t)for(let e=0;e<t.length;e++)r[e]=t[e];return r}t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32,new Uint8Array(32)[0]=9;const i=o(),a=o([1]),u=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),s=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),c=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),f=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),h=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function l(t,r){for(let e=0;e<16;e++)t[e]=0|r[e]}function p(t){let r=1;for(let e=0;e<16;e++){let n=t[e]+r+65535;r=Math.floor(n/65536),t[e]=n-65536*r}t[0]+=r-1+37*(r-1)}function d(t,r,e){const n=~(e-1);for(let e=0;e<16;e++){const o=n&(t[e]^r[e]);t[e]^=o,r[e]^=o}}function v(t,r){const e=o(),n=o();for(let t=0;t<16;t++)n[t]=r[t];p(n),p(n),p(n);for(let t=0;t<2;t++){e[0]=n[0]-65517;for(let t=1;t<15;t++)e[t]=n[t]-65535-(e[t-1]>>16&1),e[t-1]&=65535;e[15]=n[15]-32767-(e[14]>>16&1);const t=e[15]>>16&1;e[14]&=65535,d(n,e,1-t)}for(let r=0;r<16;r++)t[2*r]=255&n[r],t[2*r+1]=n[r]>>8}function w(t,r){let e=0;for(let n=0;n<32;n++)e|=t[n]^r[n];return(1&e-1>>>8)-1}function g(t,r){const e=new Uint8Array(32),n=new Uint8Array(32);return v(e,t),v(n,r),w(e,n)}function b(t){const r=new Uint8Array(32);return v(r,t),1&r[0]}function m(t,r,e){for(let n=0;n<16;n++)t[n]=r[n]+e[n]}function E(t,r,e){for(let n=0;n<16;n++)t[n]=r[n]-e[n]}function _(t,r,e){let n,o,i=0,a=0,u=0,s=0,c=0,f=0,h=0,l=0,p=0,y=0,d=0,v=0,w=0,g=0,b=0,m=0,E=0,_=0,L=0,K=0,A=0,x=0,M=0,U=0,S=0,B=0,N=0,k=0,T=0,H=0,P=0,O=e[0],I=e[1],G=e[2],F=e[3],j=e[4],R=e[5],J=e[6],C=e[7],D=e[8],X=e[9],Y=e[10],V=e[11],W=e[12],z=e[13],q=e[14],Z=e[15];n=r[0],i+=n*O,a+=n*I,u+=n*G,s+=n*F,c+=n*j,f+=n*R,h+=n*J,l+=n*C,p+=n*D,y+=n*X,d+=n*Y,v+=n*V,w+=n*W,g+=n*z,b+=n*q,m+=n*Z,n=r[1],a+=n*O,u+=n*I,s+=n*G,c+=n*F,f+=n*j,h+=n*R,l+=n*J,p+=n*C,y+=n*D,d+=n*X,v+=n*Y,w+=n*V,g+=n*W,b+=n*z,m+=n*q,E+=n*Z,n=r[2],u+=n*O,s+=n*I,c+=n*G,f+=n*F,h+=n*j,l+=n*R,p+=n*J,y+=n*C,d+=n*D,v+=n*X,w+=n*Y,g+=n*V,b+=n*W,m+=n*z,E+=n*q,_+=n*Z,n=r[3],s+=n*O,c+=n*I,f+=n*G,h+=n*F,l+=n*j,p+=n*R,y+=n*J,d+=n*C,v+=n*D,w+=n*X,g+=n*Y,b+=n*V,m+=n*W,E+=n*z,_+=n*q,L+=n*Z,n=r[4],c+=n*O,f+=n*I,h+=n*G,l+=n*F,p+=n*j,y+=n*R,d+=n*J,v+=n*C,w+=n*D,g+=n*X,b+=n*Y,m+=n*V,E+=n*W,_+=n*z,L+=n*q,K+=n*Z,n=r[5],f+=n*O,h+=n*I,l+=n*G,p+=n*F,y+=n*j,d+=n*R,v+=n*J,w+=n*C,g+=n*D,b+=n*X,m+=n*Y,E+=n*V,_+=n*W,L+=n*z,K+=n*q,A+=n*Z,n=r[6],h+=n*O,l+=n*I,p+=n*G,y+=n*F,d+=n*j,v+=n*R,w+=n*J,g+=n*C,b+=n*D,m+=n*X,E+=n*Y,_+=n*V,L+=n*W,K+=n*z,A+=n*q,x+=n*Z,n=r[7],l+=n*O,p+=n*I,y+=n*G,d+=n*F,v+=n*j,w+=n*R,g+=n*J,b+=n*C,m+=n*D,E+=n*X,_+=n*Y,L+=n*V,K+=n*W,A+=n*z,x+=n*q,M+=n*Z,n=r[8],p+=n*O,y+=n*I,d+=n*G,v+=n*F,w+=n*j,g+=n*R,b+=n*J,m+=n*C,E+=n*D,_+=n*X,L+=n*Y,K+=n*V,A+=n*W,x+=n*z,M+=n*q,U+=n*Z,n=r[9],y+=n*O,d+=n*I,v+=n*G,w+=n*F,g+=n*j,b+=n*R,m+=n*J,E+=n*C,_+=n*D,L+=n*X,K+=n*Y,A+=n*V,x+=n*W,M+=n*z,U+=n*q,S+=n*Z,n=r[10],d+=n*O,v+=n*I,w+=n*G,g+=n*F,b+=n*j,m+=n*R,E+=n*J,_+=n*C,L+=n*D,K+=n*X,A+=n*Y,x+=n*V,M+=n*W,U+=n*z,S+=n*q,B+=n*Z,n=r[11],v+=n*O,w+=n*I,g+=n*G,b+=n*F,m+=n*j,E+=n*R,_+=n*J,L+=n*C,K+=n*D,A+=n*X,x+=n*Y,M+=n*V,U+=n*W,S+=n*z,B+=n*q,N+=n*Z,n=r[12],w+=n*O,g+=n*I,b+=n*G,m+=n*F,E+=n*j,_+=n*R,L+=n*J,K+=n*C,A+=n*D,x+=n*X,M+=n*Y,U+=n*V,S+=n*W,B+=n*z,N+=n*q,k+=n*Z,n=r[13],g+=n*O,b+=n*I,m+=n*G,E+=n*F,_+=n*j,L+=n*R,K+=n*J,A+=n*C,x+=n*D,M+=n*X,U+=n*Y,S+=n*V,B+=n*W,N+=n*z,k+=n*q,T+=n*Z,n=r[14],b+=n*O,m+=n*I,E+=n*G,_+=n*F,L+=n*j,K+=n*R,A+=n*J,x+=n*C,M+=n*D,U+=n*X,S+=n*Y,B+=n*V,N+=n*W,k+=n*z,T+=n*q,H+=n*Z,n=r[15],m+=n*O,E+=n*I,_+=n*G,L+=n*F,K+=n*j,A+=n*R,x+=n*J,M+=n*C,U+=n*D,S+=n*X,B+=n*Y,N+=n*V,k+=n*W,T+=n*z,H+=n*q,P+=n*Z,i+=38*E,a+=38*_,u+=38*L,s+=38*K,c+=38*A,f+=38*x,h+=38*M,l+=38*U,p+=38*S,y+=38*B,d+=38*N,v+=38*k,w+=38*T,g+=38*H,b+=38*P,o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=p+o+65535,o=Math.floor(n/65536),p=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,n=g+o+65535,o=Math.floor(n/65536),g=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=m+o+65535,o=Math.floor(n/65536),m=n-65536*o,i+=o-1+37*(o-1),o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=p+o+65535,o=Math.floor(n/65536),p=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,n=g+o+65535,o=Math.floor(n/65536),g=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=m+o+65535,o=Math.floor(n/65536),m=n-65536*o,i+=o-1+37*(o-1),t[0]=i,t[1]=a,t[2]=u,t[3]=s,t[4]=c,t[5]=f,t[6]=h,t[7]=l,t[8]=p,t[9]=y,t[10]=d,t[11]=v,t[12]=w,t[13]=g,t[14]=b,t[15]=m}function L(t,r){_(t,r,r)}function K(t,r){const e=o();let n;for(n=0;n<16;n++)e[n]=r[n];for(n=253;n>=0;n--)L(e,e),2!==n&&4!==n&&_(e,e,r);for(n=0;n<16;n++)t[n]=e[n]}function U(t,r){const e=o(),n=o(),i=o(),a=o(),u=o(),c=o(),f=o(),h=o(),l=o();E(e,t[1],t[0]),E(l,r[1],r[0]),_(e,e,l),m(n,t[0],t[1]),m(l,r[0],r[1]),_(n,n,l),_(i,t[3],r[3]),_(i,i,s),_(a,t[2],r[2]),m(a,a,a),E(u,n,e),E(c,a,i),m(f,a,i),m(h,n,e),_(t[0],u,c),_(t[1],h,f),_(t[2],f,c),_(t[3],u,h)}function B(t,r,e){for(let n=0;n<4;n++)d(t[n],r[n],e)}function N(t,r){const e=o(),n=o(),i=o();K(i,r[2]),_(e,r[0],i),_(n,r[1],i),v(t,n),t[31]^=b(e)<<7}function k(t,r,e){l(t[0],i),l(t[1],a),l(t[2],a),l(t[3],i);for(let n=255;n>=0;--n){const o=e[n/8|0]>>(7&n)&1;B(t,r,o),U(r,t),U(t,t),B(t,r,o)}}function T(t,r){const e=[o(),o(),o(),o()];l(e[0],c),l(e[1],f),l(e[2],a),_(e[3],c,f),k(t,e,r)}function H(r){if(r.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const n=(0,e.hash)(r);n[0]&=248,n[31]&=127,n[31]|=64;const i=new Uint8Array(32),a=[o(),o(),o(),o()];T(a,n),N(i,a);const u=new Uint8Array(64);return u.set(r),u.set(i,32),{publicKey:i,secretKey:u}}t.generateKeyPairFromSeed=H,t.generateKeyPair=function(t){const e=(0,r.randomBytes)(32,t),o=H(e);return(0,n.wipe)(e),o},t.extractPublicKeyFromSecretKey=function(r){if(r.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(r.subarray(32))};const P=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function O(t,r){let e,n,o,i;for(n=63;n>=32;--n){for(e=0,o=n-32,i=n-12;o<i;++o)r[o]+=e-16*r[n]*P[o-(n-32)],e=Math.floor((r[o]+128)/256),r[o]-=256*e;r[o]+=e,r[n]=0}for(e=0,o=0;o<32;o++)r[o]+=e-(r[31]>>4)*P[o],e=r[o]>>8,r[o]&=255;for(o=0;o<32;o++)r[o]-=e*P[o];for(n=0;n<32;n++)r[n+1]+=r[n]>>8,t[n]=255&r[n]}function I(t){const r=new Float64Array(64);for(let e=0;e<64;e++)r[e]=t[e];for(let r=0;r<64;r++)t[r]=0;O(t,r)}function G(t,r){const e=o(),n=o(),s=o(),c=o(),f=o(),p=o(),y=o();return l(t[2],a),function(t,r){for(let e=0;e<16;e++)t[e]=r[2*e]+(r[2*e+1]<<8);t[15]&=32767}(t[1],r),L(s,t[1]),_(c,s,u),E(s,s,t[2]),m(c,t[2],c),L(f,c),L(p,f),_(y,p,f),_(e,y,s),_(e,e,c),function(t,r){const e=o();let n;for(n=0;n<16;n++)e[n]=r[n];for(n=250;n>=0;n--)L(e,e),1!==n&&_(e,e,r);for(n=0;n<16;n++)t[n]=e[n]}(e,e),_(e,e,s),_(e,e,c),_(e,e,c),_(t[0],e,c),L(n,t[0]),_(n,n,c),g(n,s)&&_(t[0],t[0],h),L(n,t[0]),_(n,n,c),g(n,s)?-1:(b(t[0])===r[31]>>7&&E(t[0],i,t[0]),_(t[3],t[0],t[1]),0)}t.sign=function(t,r){const n=new Float64Array(64),i=[o(),o(),o(),o()],a=(0,e.hash)(t.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const u=new Uint8Array(64);u.set(a.subarray(32),32);const s=new e.SHA512;s.update(u.subarray(32)),s.update(r);const c=s.digest();s.clean(),I(c),T(i,c),N(u,i),s.reset(),s.update(u.subarray(0,32)),s.update(t.subarray(32)),s.update(r);const f=s.digest();I(f);for(let t=0;t<32;t++)n[t]=c[t];for(let t=0;t<32;t++)for(let r=0;r<32;r++)n[t+r]+=f[t]*a[r];return O(u.subarray(32),n),u},t.verify=function(r,n,i){const a=new Uint8Array(32),u=[o(),o(),o(),o()],s=[o(),o(),o(),o()];if(i.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(G(s,r))return!1;const c=new e.SHA512;c.update(i.subarray(0,32)),c.update(r),c.update(n);const f=c.digest();return I(f),k(u,s,f),T(s,i.subarray(32)),U(u,s),N(a,u),!w(i,a)},t.convertPublicKeyToX25519=function(t){let r=[o(),o(),o(),o()];if(G(r,t))throw new Error("Ed25519: invalid public key");let e=o(),n=o(),i=r[1];m(e,a,i),E(n,a,i),K(n,n),_(e,e,n);let u=new Uint8Array(32);return v(u,e),u},t.convertSecretKeyToX25519=function(t){const r=(0,e.hash)(t.subarray(0,32));r[0]&=248,r[31]&=127,r[31]|=64;const o=new Uint8Array(r.subarray(0,32));return(0,n.wipe)(r),o}}(a)),a),k={exports:{}},T={};var H,P,O={};var I,G,F=(P||(P=1,"production"===r.env.NODE_ENV?k.exports=(B||(B=1,I=T,Object.defineProperty(I,"__esModule",{value:!0}),I.staticImplements=function(){return function(t){}}),T):k.exports=(H||(H=1,Object.defineProperty(O,"__esModule",{value:!0}),O.staticImplements=function(){return function(t){}}),O)),k.exports),j={};var R,J=(G||(G=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const r=x(),e=y();function n(t){const r=new Float64Array(16);if(t)for(let e=0;e<t.length;e++)r[e]=t[e];return r}t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;const o=new Uint8Array(32);o[0]=9;const i=n([56129,1]);function a(t){let r=1;for(let e=0;e<16;e++){let n=t[e]+r+65535;r=Math.floor(n/65536),t[e]=n-65536*r}t[0]+=r-1+37*(r-1)}function u(t,r,e){const n=~(e-1);for(let e=0;e<16;e++){const o=n&(t[e]^r[e]);t[e]^=o,r[e]^=o}}function s(t,r,e){for(let n=0;n<16;n++)t[n]=r[n]+e[n]}function c(t,r,e){for(let n=0;n<16;n++)t[n]=r[n]-e[n]}function f(t,r,e){let n,o,i=0,a=0,u=0,s=0,c=0,f=0,h=0,l=0,p=0,y=0,d=0,v=0,w=0,g=0,b=0,m=0,E=0,_=0,L=0,K=0,A=0,x=0,M=0,U=0,S=0,B=0,N=0,k=0,T=0,H=0,P=0,O=e[0],I=e[1],G=e[2],F=e[3],j=e[4],R=e[5],J=e[6],C=e[7],D=e[8],X=e[9],Y=e[10],V=e[11],W=e[12],z=e[13],q=e[14],Z=e[15];n=r[0],i+=n*O,a+=n*I,u+=n*G,s+=n*F,c+=n*j,f+=n*R,h+=n*J,l+=n*C,p+=n*D,y+=n*X,d+=n*Y,v+=n*V,w+=n*W,g+=n*z,b+=n*q,m+=n*Z,n=r[1],a+=n*O,u+=n*I,s+=n*G,c+=n*F,f+=n*j,h+=n*R,l+=n*J,p+=n*C,y+=n*D,d+=n*X,v+=n*Y,w+=n*V,g+=n*W,b+=n*z,m+=n*q,E+=n*Z,n=r[2],u+=n*O,s+=n*I,c+=n*G,f+=n*F,h+=n*j,l+=n*R,p+=n*J,y+=n*C,d+=n*D,v+=n*X,w+=n*Y,g+=n*V,b+=n*W,m+=n*z,E+=n*q,_+=n*Z,n=r[3],s+=n*O,c+=n*I,f+=n*G,h+=n*F,l+=n*j,p+=n*R,y+=n*J,d+=n*C,v+=n*D,w+=n*X,g+=n*Y,b+=n*V,m+=n*W,E+=n*z,_+=n*q,L+=n*Z,n=r[4],c+=n*O,f+=n*I,h+=n*G,l+=n*F,p+=n*j,y+=n*R,d+=n*J,v+=n*C,w+=n*D,g+=n*X,b+=n*Y,m+=n*V,E+=n*W,_+=n*z,L+=n*q,K+=n*Z,n=r[5],f+=n*O,h+=n*I,l+=n*G,p+=n*F,y+=n*j,d+=n*R,v+=n*J,w+=n*C,g+=n*D,b+=n*X,m+=n*Y,E+=n*V,_+=n*W,L+=n*z,K+=n*q,A+=n*Z,n=r[6],h+=n*O,l+=n*I,p+=n*G,y+=n*F,d+=n*j,v+=n*R,w+=n*J,g+=n*C,b+=n*D,m+=n*X,E+=n*Y,_+=n*V,L+=n*W,K+=n*z,A+=n*q,x+=n*Z,n=r[7],l+=n*O,p+=n*I,y+=n*G,d+=n*F,v+=n*j,w+=n*R,g+=n*J,b+=n*C,m+=n*D,E+=n*X,_+=n*Y,L+=n*V,K+=n*W,A+=n*z,x+=n*q,M+=n*Z,n=r[8],p+=n*O,y+=n*I,d+=n*G,v+=n*F,w+=n*j,g+=n*R,b+=n*J,m+=n*C,E+=n*D,_+=n*X,L+=n*Y,K+=n*V,A+=n*W,x+=n*z,M+=n*q,U+=n*Z,n=r[9],y+=n*O,d+=n*I,v+=n*G,w+=n*F,g+=n*j,b+=n*R,m+=n*J,E+=n*C,_+=n*D,L+=n*X,K+=n*Y,A+=n*V,x+=n*W,M+=n*z,U+=n*q,S+=n*Z,n=r[10],d+=n*O,v+=n*I,w+=n*G,g+=n*F,b+=n*j,m+=n*R,E+=n*J,_+=n*C,L+=n*D,K+=n*X,A+=n*Y,x+=n*V,M+=n*W,U+=n*z,S+=n*q,B+=n*Z,n=r[11],v+=n*O,w+=n*I,g+=n*G,b+=n*F,m+=n*j,E+=n*R,_+=n*J,L+=n*C,K+=n*D,A+=n*X,x+=n*Y,M+=n*V,U+=n*W,S+=n*z,B+=n*q,N+=n*Z,n=r[12],w+=n*O,g+=n*I,b+=n*G,m+=n*F,E+=n*j,_+=n*R,L+=n*J,K+=n*C,A+=n*D,x+=n*X,M+=n*Y,U+=n*V,S+=n*W,B+=n*z,N+=n*q,k+=n*Z,n=r[13],g+=n*O,b+=n*I,m+=n*G,E+=n*F,_+=n*j,L+=n*R,K+=n*J,A+=n*C,x+=n*D,M+=n*X,U+=n*Y,S+=n*V,B+=n*W,N+=n*z,k+=n*q,T+=n*Z,n=r[14],b+=n*O,m+=n*I,E+=n*G,_+=n*F,L+=n*j,K+=n*R,A+=n*J,x+=n*C,M+=n*D,U+=n*X,S+=n*Y,B+=n*V,N+=n*W,k+=n*z,T+=n*q,H+=n*Z,n=r[15],m+=n*O,E+=n*I,_+=n*G,L+=n*F,K+=n*j,A+=n*R,x+=n*J,M+=n*C,U+=n*D,S+=n*X,B+=n*Y,N+=n*V,k+=n*W,T+=n*z,H+=n*q,P+=n*Z,i+=38*E,a+=38*_,u+=38*L,s+=38*K,c+=38*A,f+=38*x,h+=38*M,l+=38*U,p+=38*S,y+=38*B,d+=38*N,v+=38*k,w+=38*T,g+=38*H,b+=38*P,o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=p+o+65535,o=Math.floor(n/65536),p=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,n=g+o+65535,o=Math.floor(n/65536),g=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=m+o+65535,o=Math.floor(n/65536),m=n-65536*o,i+=o-1+37*(o-1),o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=p+o+65535,o=Math.floor(n/65536),p=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,n=g+o+65535,o=Math.floor(n/65536),g=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=m+o+65535,o=Math.floor(n/65536),m=n-65536*o,i+=o-1+37*(o-1),t[0]=i,t[1]=a,t[2]=u,t[3]=s,t[4]=c,t[5]=f,t[6]=h,t[7]=l,t[8]=p,t[9]=y,t[10]=d,t[11]=v,t[12]=w,t[13]=g,t[14]=b,t[15]=m}function h(t,r){f(t,r,r)}function l(t,r){const e=new Uint8Array(32),o=new Float64Array(80),l=n(),p=n(),y=n(),d=n(),v=n(),w=n();for(let r=0;r<31;r++)e[r]=t[r];e[31]=127&t[31]|64,e[0]&=248,function(t,r){for(let e=0;e<16;e++)t[e]=r[2*e]+(r[2*e+1]<<8);t[15]&=32767}(o,r);for(let t=0;t<16;t++)p[t]=o[t];l[0]=d[0]=1;for(let t=254;t>=0;--t){const r=e[t>>>3]>>>(7&t)&1;u(l,p,r),u(y,d,r),s(v,l,y),c(l,l,y),s(y,p,d),c(p,p,d),h(d,v),h(w,l),f(l,y,l),f(y,p,v),s(v,l,y),c(l,l,y),h(p,l),c(y,d,w),f(l,y,i),s(l,l,d),f(y,y,l),f(l,d,w),f(d,p,o),h(p,v),u(l,p,r),u(y,d,r)}for(let t=0;t<16;t++)o[t+16]=l[t],o[t+32]=y[t],o[t+48]=p[t],o[t+64]=d[t];const g=o.subarray(32),b=o.subarray(16);!function(t,r){const e=n();for(let t=0;t<16;t++)e[t]=r[t];for(let t=253;t>=0;t--)h(e,e),2!==t&&4!==t&&f(e,e,r);for(let r=0;r<16;r++)t[r]=e[r]}(g,g),f(b,b,g);const m=new Uint8Array(32);return function(t,r){const e=n(),o=n();for(let t=0;t<16;t++)o[t]=r[t];a(o),a(o),a(o);for(let t=0;t<2;t++){e[0]=o[0]-65517;for(let t=1;t<15;t++)e[t]=o[t]-65535-(e[t-1]>>16&1),e[t-1]&=65535;e[15]=o[15]-32767-(e[14]>>16&1);const t=e[15]>>16&1;e[14]&=65535,u(o,e,1-t)}for(let r=0;r<16;r++)t[2*r]=255&o[r],t[2*r+1]=o[r]>>8}(m,b),m}function p(t){return l(t,o)}function d(r){if(r.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const e=new Uint8Array(r);return{publicKey:p(e),secretKey:e}}t.scalarMult=l,t.scalarMultBase=p,t.generateKeyPairFromSeed=d,t.generateKeyPair=function(t){const n=(0,r.randomBytes)(32,t),o=d(n);return(0,e.wipe)(n),o},t.sharedKey=function(r,e,n=!1){if(r.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const o=l(r,e);if(n){let t=0;for(let r=0;r<o.length;r++)t|=o[r];if(0===t)throw new Error("X25519: invalid shared key")}return o}}(j)),j),C={exports:{}},D={};var X,Y,V={};var W=(Y||(Y=1,"production"===r.env.NODE_ENV?C.exports=(R||(R=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.staticImplements=function(){return function(t){}}}(D)),D):C.exports=(X||(X=1,Object.defineProperty(V,"__esModule",{value:!0}),V.staticImplements=function(){return function(t){}}),V)),C.exports);function z(t,r,e,n,o,i,a){try{var u=t[i](a),s=u.value}catch(t){return void e(t)}u.done?r(s):Promise.resolve(s).then(n,o)}function q(t){return function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){z(i,n,o,a,u,"next",t)}function u(t){z(i,n,o,a,u,"throw",t)}a(void 0)})}}function Z(){return Z=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},Z.apply(this,arguments)}var $,Q,tt=($=function(t){var r=function(t){var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function s(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{s({},"")}catch(t){s=function(t,r,e){return t[r]=e}}function c(t,r,e,n){var o=r&&r.prototype instanceof v?r:v,i=Object.create(o.prototype),a=new U(n||[]);return i._invoke=function(t,r,e){var n=h;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return B()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var u=A(a,e);if(u){if(u===d)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===h)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=p;var s=f(t,r,e);if("normal"===s.type){if(n=e.done?y:l,s.arg===d)continue;return{value:s.arg,done:e.done}}"throw"===s.type&&(n=y,e.method="throw",e.arg=s.arg)}}}(t,e,a),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h="suspendedStart",l="suspendedYield",p="executing",y="completed",d={};function v(){}function w(){}function g(){}var b={};b[i]=function(){return this};var m=Object.getPrototypeOf,E=m&&m(m(S([])));E&&E!==e&&n.call(E,i)&&(b=E);var _=g.prototype=v.prototype=Object.create(b);function L(t){["next","throw","return"].forEach(function(r){s(t,r,function(t){return this._invoke(r,t)})})}function K(t,r){function e(o,i,a,u){var s=f(t[o],t,i);if("throw"!==s.type){var c=s.arg,h=c.value;return h&&"object"==typeof h&&n.call(h,"__await")?r.resolve(h.__await).then(function(t){e("next",t,a,u)},function(t){e("throw",t,a,u)}):r.resolve(h).then(function(t){c.value=t,a(c)},function(t){return e("throw",t,a,u)})}u(s.arg)}var o;this._invoke=function(t,n){function i(){return new r(function(r,o){e(t,n,r,o)})}return o=o?o.then(i,i):i()}}function A(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,A(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function x(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function M(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function U(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function S(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:B}}function B(){return{value:r,done:!0}}return w.prototype=_.constructor=g,g.constructor=w,w.displayName=s(g,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===w||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,s(t,u,"GeneratorFunction")),t.prototype=Object.create(_),t},t.awrap=function(t){return{__await:t}},L(K.prototype),K.prototype[a]=function(){return this},t.AsyncIterator=K,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new K(c(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},L(_),s(_,u,"Generator"),_[i]=function(){return this},_.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=S,U.prototype={constructor:U,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(M),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return u.type="throw",u.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){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"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),M(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;M(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),d}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}},$(Q={exports:{}},Q.exports),Q.exports);function rt(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var i=t.charAt(o),a=i.charCodeAt(0);if(255!==r[a])throw new TypeError(i+" is ambiguous");r[a]=o}var u=t.length,s=t.charAt(0),c=Math.log(u)/Math.log(256),f=Math.log(256)/Math.log(u);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return e.alloc(0);var n=0;if(" "!==t[n]){for(var o=0,i=0;t[n]===s;)o++,n++;for(var a=(t.length-n)*c+1>>>0,f=new Uint8Array(a);t[n];){var h=r[t.charCodeAt(n)];if(255===h)return;for(var l=0,p=a-1;(0!==h||l<i)&&-1!==p;p--,l++)h+=u*f[p]>>>0,f[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=l,n++}if(" "!==t[n]){for(var y=a-i;y!==a&&0===f[y];)y++;var d=e.allocUnsafe(o+(a-y));d.fill(0,0,o);for(var v=o;y!==a;)d[v++]=f[y++];return d}}}return{encode:function(r){if((Array.isArray(r)||r instanceof Uint8Array)&&(r=e.from(r)),!e.isBuffer(r))throw new TypeError("Expected Buffer");if(0===r.length)return"";for(var n=0,o=0,i=0,a=r.length;i!==a&&0===r[i];)i++,n++;for(var c=(a-i)*f+1>>>0,h=new Uint8Array(c);i!==a;){for(var l=r[i],p=0,y=c-1;(0!==l||p<o)&&-1!==y;y--,p++)l+=256*h[y]>>>0,h[y]=l%u>>>0,l=l/u>>>0;if(0!==l)throw new Error("Non-zero carry");o=p,i++}for(var d=c-o;d!==c&&0===h[d];)d++;for(var v=s.repeat(n);d<c;++d)v+=t.charAt(h[d]);return v},decodeUnsafe:h,decode:function(t){var r=h(t);if(r)return r;throw new Error("Non-base"+u+" character")}}}var et,nt=rt("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),ot=function(t){return e.from(t||"").toString("base64")},it=function(t){return ot(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},at=function(t,r){void 0===r&&(r="base58btc");var e=new Uint8Array(2+t.length);if(e[0]=236,e[1]=1,e.set(t,2),"base58btc"===r)return"z"+nt.encode(e);if("base64url"===r)return"u"+it(e);throw new Error("Unsupported encoding: "+r)},ut=function(t){return Uint8Array.from(e.from(t.x,"base64"))},st={JsonWebKey2020:function(t){var r,n=ut(t.publicKeyJwk),o=void 0;t.privateKeyJwk&&(o=(r=t.privateKeyJwk,{publicKey:ut(r),privateKey:Uint8Array.from(e.from(r.d,"base64"))}).privateKey);return{publicKey:n,privateKey:o}},X25519KeyAgreementKey2019:function(t){var r=nt.decode(t.publicKeyBase58),e=void 0;return t.privateKeyBase58&&(e=Uint8Array.from(nt.decode(t.privateKeyBase58))),{publicKey:r,privateKey:e}}},ct={JsonWebKey2020:function(t,r,e,n){var o={kty:"OKP",crv:"X25519",x:it(e)},i={id:t,type:"JsonWebKey2020",controller:r,publicKeyJwk:o};return n&&(i.privateKeyJwk=Z({},o,{d:it(n)})),i},X25519KeyAgreementKey2019:function(t,r,e,n){var o={id:t,type:"X25519KeyAgreementKey2019",controller:r,publicKeyBase58:nt.encode(e)};return n&&(o.privateKeyBase58=nt.encode(n)),o}},ft=et=function(){function t(t){this.type="JsonWebKey2020",this.id=t.id,this.type=t.type||"JsonWebKey2020",this.controller=t.controller,this.publicKey=t.publicKey,this.privateKey=t.privateKey}t.fingerprintFromPublicKey=function(){var t=q(tt.mark(function t(r){var e,n;return tt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,et.from(r);case 2:return e=t.sent,n=e.publicKey,t.abrupt("return",at(n));case 5:case"end":return t.stop()}},t)}));return function(r){return t.apply(this,arguments)}}(),t.fromFingerprint=function(){var t=q(tt.mark(function t(r){var e,n,o,i;return tt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e=r.fingerprint,236!==(n=nt.decode(e.substring(1)))[0]||1!==n[1]){t.next=12;break}return t.next=5,et.from({id:"",controller:"",type:"X25519KeyAgreementKey2019",publicKeyBase58:nt.encode(n.slice(2))});case 5:return o=t.sent,t.next=8,o.fingerprint();case 8:return i=t.sent,o.id="did:key:"+i+"#"+i,o.controller="did:key:"+i,t.abrupt("return",o);case 12:throw new Error("Unsupported fingerprint type: "+e);case 13:case"end":return t.stop()}},t)}));return function(r){return t.apply(this,arguments)}}();var r=t.prototype;return r.fingerprint=function(){var t=q(tt.mark(function t(){return tt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",at(this.publicKey));case 1:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),r.export=function(){var t=q(tt.mark(function t(r){return tt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===r&&(r={privateKey:!1,type:"JsonWebKey2020"}),!ct[r.type]){t.next=3;break}return t.abrupt("return",ct[r.type](this.id,this.controller,this.publicKey,r.privateKey?this.privateKey:void 0));case 3:throw new Error("Unsupported export options: "+JSON.stringify(r));case 4:case"end":return t.stop()}},t,this)}));return function(r){return t.apply(this,arguments)}}(),r.deriveSecret=function(){var t=q(tt.mark(function t(r){var e,n,o;return tt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=r.publicKey,t.next=3,et.from(e);case 3:if(n=t.sent,this.privateKey){t.next=6;break}throw new Error("No private key available for deriveSecret");case 6:return o=J.sharedKey(this.privateKey,n.publicKey,!0),t.abrupt("return",o);case 8:case"end":return t.stop()}},t,this)}));return function(r){return t.apply(this,arguments)}}(),t}();function ht(t,r,e,n,o,i,a){try{var u=t[i](a),s=u.value}catch(t){return void e(t)}u.done?r(s):Promise.resolve(s).then(n,o)}function lt(t){return function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){ht(i,n,o,a,u,"next",t)}function u(t){ht(i,n,o,a,u,"throw",t)}a(void 0)})}}function pt(){return pt=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},pt.apply(this,arguments)}ft.generate=function(){var t=q(tt.mark(function t(r){var e,n,o,i,a;return tt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=r.secureRandom,n=J.generateKeyPair({isAvailable:!0,randomBytes:e}),o=at(n.publicKey),a=(i="did:key:"+o)+"#"+o,t.abrupt("return",new et({id:a,type:"JsonWebKey2020",controller:i,publicKey:n.publicKey,privateKey:n.secretKey}));case 6:case"end":return t.stop()}},t)}));return function(r){return t.apply(this,arguments)}}(),ft.from=function(){var t=q(tt.mark(function t(r){var e,n,o;return tt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=st[r.type](r),n=e.publicKey,o=e.privateKey,t.abrupt("return",new et({id:r.id,type:r.type,controller:r.controller,publicKey:n,privateKey:o}));case 2:case"end":return t.stop()}},t)}));return function(r){return t.apply(this,arguments)}}(),ft=et=n([W.staticImplements()],ft);var yt=function(t,r){return t(r={exports:{}},r.exports),r.exports}(function(t){var r=function(t){var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function s(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{s({},"")}catch(t){s=function(t,r,e){return t[r]=e}}function c(t,r,e,n){var o=r&&r.prototype instanceof v?r:v,i=Object.create(o.prototype),a=new U(n||[]);return i._invoke=function(t,r,e){var n=h;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return B()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var u=A(a,e);if(u){if(u===d)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===h)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=p;var s=f(t,r,e);if("normal"===s.type){if(n=e.done?y:l,s.arg===d)continue;return{value:s.arg,done:e.done}}"throw"===s.type&&(n=y,e.method="throw",e.arg=s.arg)}}}(t,e,a),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h="suspendedStart",l="suspendedYield",p="executing",y="completed",d={};function v(){}function w(){}function g(){}var b={};b[i]=function(){return this};var m=Object.getPrototypeOf,E=m&&m(m(S([])));E&&E!==e&&n.call(E,i)&&(b=E);var _=g.prototype=v.prototype=Object.create(b);function L(t){["next","throw","return"].forEach(function(r){s(t,r,function(t){return this._invoke(r,t)})})}function K(t,r){function e(o,i,a,u){var s=f(t[o],t,i);if("throw"!==s.type){var c=s.arg,h=c.value;return h&&"object"==typeof h&&n.call(h,"__await")?r.resolve(h.__await).then(function(t){e("next",t,a,u)},function(t){e("throw",t,a,u)}):r.resolve(h).then(function(t){c.value=t,a(c)},function(t){return e("throw",t,a,u)})}u(s.arg)}var o;this._invoke=function(t,n){function i(){return new r(function(r,o){e(t,n,r,o)})}return o=o?o.then(i,i):i()}}function A(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,A(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function x(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function M(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function U(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function S(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:B}}function B(){return{value:r,done:!0}}return w.prototype=_.constructor=g,g.constructor=w,w.displayName=s(g,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===w||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,s(t,u,"GeneratorFunction")),t.prototype=Object.create(_),t},t.awrap=function(t){return{__await:t}},L(K.prototype),K.prototype[a]=function(){return this},t.AsyncIterator=K,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new K(c(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},L(_),s(_,u,"Generator"),_[i]=function(){return this},_.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=S,U.prototype={constructor:U,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(M),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return u.type="throw",u.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){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"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),M(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;M(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),d}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}});function dt(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var i=t.charAt(o),a=i.charCodeAt(0);if(255!==r[a])throw new TypeError(i+" is ambiguous");r[a]=o}var u=t.length,s=t.charAt(0),c=Math.log(u)/Math.log(256),f=Math.log(256)/Math.log(u);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return e.alloc(0);var n=0;if(" "!==t[n]){for(var o=0,i=0;t[n]===s;)o++,n++;for(var a=(t.length-n)*c+1>>>0,f=new Uint8Array(a);t[n];){var h=r[t.charCodeAt(n)];if(255===h)return;for(var l=0,p=a-1;(0!==h||l<i)&&-1!==p;p--,l++)h+=u*f[p]>>>0,f[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=l,n++}if(" "!==t[n]){for(var y=a-i;y!==a&&0===f[y];)y++;var d=e.allocUnsafe(o+(a-y));d.fill(0,0,o);for(var v=o;y!==a;)d[v++]=f[y++];return d}}}return{encode:function(r){if((Array.isArray(r)||r instanceof Uint8Array)&&(r=e.from(r)),!e.isBuffer(r))throw new TypeError("Expected Buffer");if(0===r.length)return"";for(var n=0,o=0,i=0,a=r.length;i!==a&&0===r[i];)i++,n++;for(var c=(a-i)*f+1>>>0,h=new Uint8Array(c);i!==a;){for(var l=r[i],p=0,y=c-1;(0!==l||p<o)&&-1!==y;y--,p++)l+=256*h[y]>>>0,h[y]=l%u>>>0,l=l/u>>>0;if(0!==l)throw new Error("Non-zero carry");o=p,i++}for(var d=c-o;d!==c&&0===h[d];)d++;for(var v=s.repeat(n);d<c;++d)v+=t.charAt(h[d]);return v},decodeUnsafe:h,decode:function(t){var r=h(t);if(r)return r;throw new Error("Non-base"+u+" character")}}}var vt,wt=dt("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),gt=function(t){return e.from(t||"").toString("base64")},bt=function(t){return gt(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},mt=function(t,r){void 0===r&&(r="base58btc");var e=new Uint8Array(2+t.length);if(e[0]=237,e[1]=1,e.set(t,2),"base58btc"===r)return"z"+wt.encode(e);if("base64url"===r)return"u"+bt(e);throw new Error("Unsupported encoding: "+r)},Et=function(t){return Uint8Array.from(e.from(t.x,"base64"))},_t={JsonWebKey2020:function(t){var r,n=Et(t.publicKeyJwk),o=void 0;t.privateKeyJwk&&(o=(r=t.privateKeyJwk,{publicKey:Et(r),privateKey:Uint8Array.from(e.concat([e.from(r.d,"base64"),e.from(r.x,"base64")]))}).privateKey);return{publicKey:n,privateKey:o}},Ed25519VerificationKey2018:function(t){var r=wt.decode(t.publicKeyBase58),e=void 0;return t.privateKeyBase58&&(e=Uint8Array.from(wt.decode(t.privateKeyBase58))),{publicKey:r,privateKey:e}}},Lt=function(t){if(!_t[t.type])throw new Error("Cannot import from unsupported type: "+JSON.stringify(t,null,2));return _t[t.type](t)},Kt={JsonWebKey2020:function(t,r,e,n){var o={kty:"OKP",crv:"Ed25519",x:bt(e)},i={id:t,type:"JsonWebKey2020",controller:r,publicKeyJwk:o};return n&&(i.privateKeyJwk=pt({},o,{d:bt(n.slice(0,n.length/2))})),i},Ed25519VerificationKey2018:function(t,r,e,n){var o={id:t,type:"Ed25519VerificationKey2018",controller:r,publicKeyBase58:wt.encode(e)};return n&&(o.privateKeyBase58=wt.encode(n)),o}},At={EdDsa:{__proto__:null,signer:function(t){return{sign:function(r){return lt(yt.mark(function e(){var n;return yt.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.data,e.abrupt("return",N.sign(t,n));case 2:case"end":return e.stop()}},e)}))()}}},verifier:function(t){return{verify:function(r){return lt(yt.mark(function e(){var n,o,i;return yt.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=r.data,o=r.signature,i=!1;try{i=N.verify(t,n,o)}catch(t){}return e.abrupt("return",i);case 4:case"end":return e.stop()}},e)}))()}}}}},xt=vt=function(){function t(t){this.type="JsonWebKey2020",this.id=t.id,this.type=t.type||"JsonWebKey2020",this.controller=t.controller,this.publicKey=t.publicKey,this.privateKey=t.privateKey}t.fingerprintFromPublicKey=function(){var t=lt(yt.mark(function t(r){var e,n;return yt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,vt.from(r);case 2:return e=t.sent,n=e.publicKey,t.abrupt("return",mt(n));case 5:case"end":return t.stop()}},t)}));return function(r){return t.apply(this,arguments)}}(),t.toX25519KeyPair=function(){var t=lt(yt.mark(function t(r){var e,n,o;return yt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=N.convertPublicKeyToX25519(r.publicKey),n=void 0,r.privateKey&&(n=N.convertSecretKeyToX25519(r.privateKey)),o=new ft({id:"",type:"X25519KeyAgreementKey2019",controller:r.controller,publicKey:e,privateKey:n}),t.t0=r.controller+"#",t.next=7,o.fingerprint();case 7:return t.t1=t.sent,o.id=t.t0+t.t1,t.abrupt("return",o);case 10:case"end":return t.stop()}},t)}));return function(r){return t.apply(this,arguments)}}(),t.fromFingerprint=function(){var t=lt(yt.mark(function t(r){var e,n,o,i;return yt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e=r.fingerprint,237!==(n=wt.decode(e.substring(1)))[0]||1!==n[1]){t.next=12;break}return t.next=5,vt.from({id:"",controller:"",type:"Ed25519VerificationKey2018",publicKeyBase58:wt.encode(n.slice(2))});case 5:return o=t.sent,t.next=8,o.fingerprint();case 8:return i=t.sent,o.id="did:key:"+i+"#"+i,o.controller="did:key:"+i,t.abrupt("return",o);case 12:throw new Error("Unsupported fingerprint type: "+e);case 13:case"end":return t.stop()}},t)}));return function(r){return t.apply(this,arguments)}}();var r=t.prototype;return r.fingerprint=function(){var t=lt(yt.mark(function t(){return yt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mt(this.publicKey));case 1:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),r.export=function(){var t=lt(yt.mark(function t(r){return yt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===r&&(r={privateKey:!1,type:"JsonWebKey2020"}),!Kt[r.type]){t.next=3;break}return t.abrupt("return",Kt[r.type](this.id,this.controller,this.publicKey,r.privateKey?this.privateKey:void 0));case 3:throw new Error("Unsupported export options: "+JSON.stringify(r));case 4:case"end":return t.stop()}},t,this)}));return function(r){return t.apply(this,arguments)}}(),r.signer=function(t){if(void 0===t&&(t="EdDsa"),!this.privateKey)throw new Error("No private key to sign with.");if(At[t])return At[t].signer(this.privateKey);throw new Error("Unsupported suite type "+t)},r.verifier=function(t){if(void 0===t&&(t="EdDsa"),!this.publicKey)throw new Error("No public key to verify with.");if(At[t])return At[t].verifier(this.publicKey);throw new Error("Unsupported suite type "+t)},r.getDerivedKeyPairs=function(){var t=lt(yt.mark(function t(){return yt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,vt.toX25519KeyPair(this);case 3:return t.t1=t.sent,t.abrupt("return",[t.t0,t.t1]);case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),t}();xt.generate=function(){var t=lt(yt.mark(function t(r){var e,n,o,i,a;return yt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=r.secureRandom,n=N.generateKeyPair({isAvailable:!0,randomBytes:e}),o=mt(n.publicKey),a=(i="did:key:"+o)+"#"+o,t.abrupt("return",new vt({id:a,type:"JsonWebKey2020",controller:i,publicKey:n.publicKey,privateKey:n.secretKey}));case 6:case"end":return t.stop()}},t)}));return function(r){return t.apply(this,arguments)}}(),xt.from=function(){var t=lt(yt.mark(function t(r){var e,n,o;return yt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=Lt(r),n=e.publicKey,o=e.privateKey,t.abrupt("return",new vt({id:r.id,type:r.type,controller:r.controller,publicKey:n,privateKey:o}));case 2:case"end":return t.stop()}},t)}));return function(r){return t.apply(this,arguments)}}(),xt=vt=n([F.staticImplements()],xt);export{xt as E};
@@ -0,0 +1 @@
1
+ import{G as e,V as a,z as t,d as n}from"./main.js";function i(i,o){if(!i||!o)return;Array.isArray(o)||(o=[o]),o=o.filter(e=>null!=e);const r=e(o,i.map(e=>e.id));if(r.length>0){const e=i.findIndex(e=>e.id===r[0]);if(e>-1)throw new a(t.checkRevokedStatus,n.certificates.generateRevocationReason(i[e].revocationReason))}}export{i as default};
@@ -0,0 +1 @@
1
+ import{e,V as t,S as a,d as n}from"./index-RfFwckcH.js";function i(i,o){if(!i||!o)return;Array.isArray(o)||(o=[o]),o=o.filter(e=>null!=e);const r=e(o,i.map(e=>e.id));if(r.length>0){const e=i.findIndex(e=>e.id===r[0]);if(e>-1)throw new t(a.checkRevokedStatus,n.certificates.generateRevocationReason(i[e].revocationReason))}}export{i as default};
@@ -1 +1 @@
1
- import{o as e,V as s,a as r}from"./main.js";function i(i,n,o){let t="";const d=function(e,s){let r=null;for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&i.toLowerCase()===s.toLowerCase()&&(r=i);return e[r]}(i,n),a=e(o);if(d?(d.created&&a<=d.created&&(t="invalidIssuingAddressCreationTime"),d.revoked&&a>=d.revoked&&(t="invalidIssuingAddressRevoked"),d.expires&&a>=d.expires&&(t="invalidIssuingAddressExpired")):t="invalidIssuingAddressUnknown",t)throw new s("checkAuthenticity",r("errors",t))}export{i as e};
1
+ import{q as e,V as s,g as r}from"./main.js";function i(i,n,o){let t="";const d=function(e,s){let r=null;for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&i.toLowerCase()===s.toLowerCase()&&(r=i);return e[r]}(i,n),a=e(o);if(d?(d.created&&a<=d.created&&(t="invalidIssuingAddressCreationTime"),d.revoked&&a>=d.revoked&&(t="invalidIssuingAddressRevoked"),d.expires&&a>=d.expires&&(t="invalidIssuingAddressExpired")):t="invalidIssuingAddressUnknown",t)throw new s("checkAuthenticity",r("errors",t))}export{i as e};
@@ -0,0 +1,29 @@
1
+ import{s as e,f as t,u as r}from"./main.js";import{a as n,r as i,b as o,c as s,h as c,d as u,i as a,e as f,f as l,g as d,s as y}from"./sha2-JcCWfgvE-By1_saxP.js";
2
+ /*!
3
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
4
+ */
5
+ const h="ECDSA",p=!0,w="https://w3id.org/security/suites/ecdsa-2019/v1",b="https://w3id.org/security/multikey/v1",g="z",m=new Uint8Array([231,1]),E=new Uint8Array([128,36]),v=new Uint8Array([129,36]),B=new Uint8Array([130,36]),k=new Uint8Array([129,38]),x=new Uint8Array([134,38]),K=new Uint8Array([135,38]),O=new Uint8Array([136,38]),R="P-256",A="P-384",S="P-521",U="K-256",I="SHA-256",M="SHA-384",q="SHA-512",j=globalThis.crypto,C=globalThis.CryptoKey??j.CryptoKey;function N({curve:e}){if(e===R||e===U)return I;if(e===A)return M;if(e===S)return q;throw new TypeError(`Unsupported curve "${e}".`)}
6
+ /*!
7
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
8
+ */function P({publicMultikey:e}){if(e[0]===E[0]&&e[1]===E[1])return R;if(e[0]===v[0]&&e[1]===v[1])return A;if(e[0]===B[0]&&e[1]===B[1])return S;if(e[0]===m[0]&&e[1]===m[1])return U;throw new TypeError("Unsupported public multikey header.")}function T({secretMultikey:e}){if(e[0]===x[0]&&e[1]===x[1])return R;if(e[0]===K[0]&&e[1]===K[1])return A;if(e[0]===O[0]&&e[1]===O[1])return S;if(e[0]===k[0]&&e[1]===k[1])return U;throw new TypeError("Unsupported secret multikey header.")}function F({curve:e}){if(e===R||e===U)return 32;if(e===A)return 48;if(e===S)return 66;throw new TypeError(`Unsupported curve "${e}".`)}
9
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
10
+ const H=BigInt(0),Z=BigInt(1);function V(e,t=""){if("boolean"!=typeof e){throw new Error((t&&`"${t}" `)+"expected boolean, got type="+typeof e)}return e}function D(e){if("bigint"==typeof e){if(!G(e))throw new Error("positive bigint expected, got "+e)}else d(e);return e}function L(e){const t=D(e).toString(16);return 1&t.length?"0"+t:t}function _(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?H:BigInt("0x"+e)}function $(e){return _(o(e))}function Y(e){return _(o(function(e){return Uint8Array.from(e)}(s(e)).reverse()))}function z(e,t){d(t),e=D(e);const r=c(e.toString(16).padStart(2*t,"0"));if(r.length!==t)throw new Error("number too large");return r}function X(e,t){return z(e,t).reverse()}const G=e=>"bigint"==typeof e&&H<=e;function W(e,t,r,n){if(!function(e,t,r){return G(e)&&G(t)&&G(r)&&t<=e&&e<r}(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}const J=e=>(Z<<BigInt(e))-Z;function Q(e,t={},r={}){if(!e||"object"!=typeof e)throw new Error("expected valid options object");const n=(t,r)=>Object.entries(t).forEach(([t,n])=>function(t,r,n){const i=e[t];if(n&&void 0===i)return;const o=typeof i;if(o!==r||null===i)throw new Error(`param "${t}" is invalid: expected ${r}, got ${o}`)}(t,n,r));n(t,!1),n(r,!0)}function ee(e){const t=new WeakMap;return(r,...n)=>{const i=t.get(r);if(void 0!==i)return i;const o=e(r,...n);return t.set(r,o),o}}
11
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const te=BigInt(0),re=BigInt(1),ne=BigInt(2),ie=BigInt(3),oe=BigInt(4),se=BigInt(5),ce=BigInt(7),ue=BigInt(8),ae=BigInt(9),fe=BigInt(16);function le(e,t){const r=e%t;return r>=te?r:t+r}function de(e,t,r){let n=e;for(;t-- >te;)n*=n,n%=r;return n}function ye(e,t){if(e===te)throw new Error("invert: expected non-zero number");if(t<=te)throw new Error("invert: expected positive modulus, got "+t);let r=le(e,t),n=t,i=te,o=re;for(;r!==te;){const e=n%r,t=i-o*(n/r);n=r,r=e,i=o,o=t}if(n!==re)throw new Error("invert: does not exist");return le(i,t)}function he(e,t,r){if(!e.eql(e.sqr(t),r))throw new Error("Cannot find square root")}function pe(e,t){const r=(e.ORDER+re)/oe,n=e.pow(t,r);return he(e,n,t),n}function we(e,t){const r=(e.ORDER-se)/ue,n=e.mul(t,ne),i=e.pow(n,r),o=e.mul(t,i),s=e.mul(e.mul(o,ne),i),c=e.mul(o,e.sub(s,e.ONE));return he(e,c,t),c}function be(e){if(e<ie)throw new Error("sqrt is not defined for small field");let t=e-re,r=0;for(;t%ne===te;)t/=ne,r++;let n=ne;const i=ke(e);for(;1===ve(i,n);)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===r)return pe;let o=i.pow(n,t);const s=(t+re)/ne;return function(e,n){if(e.is0(n))return n;if(1!==ve(e,n))throw new Error("Cannot find square root");let i=r,c=e.mul(e.ONE,o),u=e.pow(n,t),a=e.pow(n,s);for(;!e.eql(u,e.ONE);){if(e.is0(u))return e.ZERO;let t=1,r=e.sqr(u);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===i)throw new Error("Cannot find square root");const n=re<<BigInt(i-t-1),o=e.pow(c,n);i=t,c=e.sqr(o),u=e.mul(u,c),a=e.mul(a,o)}return a}}function ge(e){return e%oe===ie?pe:e%ue===se?we:e%fe===ae?function(e){const t=ke(e),r=be(e),n=r(t,t.neg(t.ONE)),i=r(t,n),o=r(t,t.neg(n)),s=(e+ce)/fe;return(e,t)=>{let r=e.pow(t,s),c=e.mul(r,n);const u=e.mul(r,i),a=e.mul(r,o),f=e.eql(e.sqr(c),t),l=e.eql(e.sqr(u),t);r=e.cmov(r,c,f),c=e.cmov(a,u,l);const d=e.eql(e.sqr(c),t),y=e.cmov(r,c,d);return he(e,y,t),y}}(e):be(e)}const me=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ee(e,t,r=!1){const n=new Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),o=e.inv(i);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),o),n}function ve(e,t){const r=(e.ORDER-re)/ne,n=e.pow(t,r),i=e.eql(n,e.ONE),o=e.eql(n,e.ZERO),s=e.eql(n,e.neg(e.ONE));if(!i&&!o&&!s)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}class Be{ORDER;BITS;BYTES;isLE;ZERO=te;ONE=re;_lengths;_sqrt;_mod;constructor(e,t={}){if(e<=te)throw new Error("invalid field: expected ORDER > 0, got "+e);let r;this.isLE=!1,null!=t&&"object"==typeof t&&("number"==typeof t.BITS&&(r=t.BITS),"function"==typeof t.sqrt&&(this.sqrt=t.sqrt),"boolean"==typeof t.isLE&&(this.isLE=t.isLE),t.allowedLengths&&(this._lengths=t.allowedLengths?.slice()),"boolean"==typeof t.modFromBytes&&(this._mod=t.modFromBytes));const{nBitLength:n,nByteLength:i}=function(e,t){void 0!==t&&d(t);const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}(e,r);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=n,this.BYTES=i,this._sqrt=void 0,Object.preventExtensions(this)}create(e){return le(e,this.ORDER)}isValid(e){if("bigint"!=typeof e)throw new Error("invalid field element: expected bigint, got "+typeof e);return te<=e&&e<this.ORDER}is0(e){return e===te}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&re)===re}neg(e){return le(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return le(e*e,this.ORDER)}add(e,t){return le(e+t,this.ORDER)}sub(e,t){return le(e-t,this.ORDER)}mul(e,t){return le(e*t,this.ORDER)}pow(e,t){return function(e,t,r){if(r<te)throw new Error("invalid exponent, negatives unsupported");if(r===te)return e.ONE;if(r===re)return t;let n=e.ONE,i=t;for(;r>te;)r&re&&(n=e.mul(n,i)),i=e.sqr(i),r>>=re;return n}(this,e,t)}div(e,t){return le(e*ye(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return ye(e,this.ORDER)}sqrt(e){return this._sqrt||(this._sqrt=ge(this.ORDER)),this._sqrt(this,e)}toBytes(e){return this.isLE?X(e,this.BYTES):z(e,this.BYTES)}fromBytes(e,t=!1){s(e);const{_lengths:r,BYTES:n,isLE:i,ORDER:o,_mod:c}=this;if(r){if(!r.includes(e.length)||e.length>n)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+e.length);const t=new Uint8Array(n);t.set(e,i?0:t.length-e.length),e=t}if(e.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+e.length);let u=i?Y(e):$(e);if(c&&(u=le(u,o)),!t&&!this.isValid(u))throw new Error("invalid field element: outside of range 0..ORDER");return u}invertBatch(e){return Ee(this,e)}cmov(e,t,r){return r?t:e}}function ke(e,t={}){return new Be(e,t)}function xe(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Ke(e){const t=xe(e);return t+Math.ceil(t/2)}
12
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
13
+ const Oe=BigInt(0),Re=BigInt(1);function Ae(e,t){const r=t.negate();return e?r:t}function Se(e,t){const r=Ee(e.Fp,t.map(e=>e.Z));return t.map((t,n)=>e.fromAffine(t.toAffine(r[n])))}function Ue(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Ie(e,t){Ue(e,t);const r=2**e;return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1),mask:J(e),maxNumber:r,shiftBy:BigInt(e)}}function Me(e,t,r){const{windowSize:n,mask:i,maxNumber:o,shiftBy:s}=r;let c=Number(e&i),u=e>>s;c>n&&(c-=o,u+=Re);const a=t*n;return{nextN:u,offset:a+Math.abs(c)-1,isZero:0===c,isNeg:c<0,isNegF:t%2!=0,offsetF:a}}const qe=new WeakMap,je=new WeakMap;function Ce(e){return je.get(e)||1}function Ne(e){if(e!==Oe)throw new Error("invalid wNAF")}class Pe{BASE;ZERO;Fn;bits;constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let n=e;for(;t>Oe;)t&Re&&(r=r.add(n)),n=n.double(),t>>=Re;return r}precomputeWindow(e,t){const{windows:r,windowSize:n}=Ie(t,this.bits),i=[];let o=e,s=o;for(let e=0;e<r;e++){s=o,i.push(s);for(let e=1;e<n;e++)s=s.add(o),i.push(s);o=s.double()}return i}wNAF(e,t,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let n=this.ZERO,i=this.BASE;const o=Ie(e,this.bits);for(let e=0;e<o.windows;e++){const{nextN:s,offset:c,isZero:u,isNeg:a,isNegF:f,offsetF:l}=Me(r,e,o);r=s,u?i=i.add(Ae(f,t[l])):n=n.add(Ae(a,t[c]))}return Ne(r),{p:n,f:i}}wNAFUnsafe(e,t,r,n=this.ZERO){const i=Ie(e,this.bits);for(let e=0;e<i.windows&&r!==Oe;e++){const{nextN:o,offset:s,isZero:c,isNeg:u}=Me(r,e,i);if(r=o,!c){const e=t[s];n=n.add(u?e.negate():e)}}return Ne(r),n}getPrecomputes(e,t,r){let n=qe.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&("function"==typeof r&&(n=r(n)),qe.set(t,n))),n}cached(e,t,r){const n=Ce(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)}unsafe(e,t,r,n){const i=Ce(e);return 1===i?this._unsafeLadder(e,t,n):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),t,n)}createCache(e,t){Ue(t,this.bits),je.set(e,t),qe.delete(e)}hasCache(e){return 1!==Ce(e)}}function Te(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return function(e){Q(e,me.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",BYTES:"number",BITS:"number"}))}(t),t}return ke(e,{isLE:r})}class Fe{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){if(n(e),s(t,void 0,"key"),this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(t.length>r?e.create().update(t).digest():t);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),f(i)}update(e){return l(this),this.iHash.update(e),this}digestInto(e){l(this),s(e,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});const{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=n,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const He=(e,t,r)=>new Fe(e,t).update(r).digest();He.create=(e,t)=>new Fe(e,t);
14
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
15
+ const Ze=(e,t)=>(e+(e>=0?t:-t)/Xe)/t;function Ve(e,t,r){const[[n,i],[o,s]]=t,c=Ze(s*e,r),u=Ze(-i*e,r);let a=e-c*n-u*o,f=-c*i-u*s;const l=a<Ye,d=f<Ye;l&&(a=-a),d&&(f=-f);const y=J(Math.ceil(function(e){let t;for(t=0;e>H;e>>=Z,t+=1);return t}(r)/2))+ze;if(a<Ye||a>=y||f<Ye||f>=y)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:l,k1:a,k2neg:d,k2:f}}function De(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Le(e,t){const r={};for(let n of Object.keys(t))r[n]=void 0===e[n]?t[n]:e[n];return V(r.lowS,"lowS"),V(r.prehash,"prehash"),void 0!==r.format&&De(r.format),r}class _e extends Error{constructor(e=""){super(e)}}const $e={Err:_e,_tlv:{encode:(e,t)=>{const{Err:r}=$e;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");const n=t.length/2,i=L(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const o=n>127?L(i.length/2|128):"";return L(e)+o+i+t},decode(e,t){const{Err:r}=$e;let n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");const i=t[n++];let o=0;if(!!(128&i)){const e=127&i;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");const s=t.subarray(n,n+e);if(s.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===s[0])throw new r("tlv.decode(long): zero leftmost byte");for(const e of s)o=o<<8|e;if(n+=e,o<128)throw new r("tlv.decode(long): not minimal encoding")}else o=i;const s=t.subarray(n,n+o);if(s.length!==o)throw new r("tlv.decode: wrong value length");return{v:s,l:t.subarray(n+o)}}},_int:{encode(e){const{Err:t}=$e;if(e<Ye)throw new t("integer: negative integers are not allowed");let r=L(e);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){const{Err:t}=$e;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return $(e)}},toSig(e){const{Err:t,_int:r,_tlv:n}=$e,i=s(e,void 0,"signature"),{v:o,l:c}=n.decode(48,i);if(c.length)throw new t("invalid signature: left bytes after parsing");const{v:u,l:a}=n.decode(2,o),{v:f,l:l}=n.decode(2,a);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(u),s:r.decode(f)}},hexFromSig(e){const{_tlv:t,_int:r}=$e,n=t.encode(2,r.encode(e.r))+t.encode(2,r.encode(e.s));return t.encode(48,n)}},Ye=BigInt(0),ze=BigInt(1),Xe=BigInt(2),Ge=BigInt(3),We=BigInt(4);function Je(e,t={}){const r=function(e,t,r={},n){if(void 0===n&&(n="edwards"===e),!t||"object"!=typeof t)throw new Error(`expected valid ${e} CURVE object`);for(const e of["p","n","h"]){const r=t[e];if(!("bigint"==typeof r&&r>Oe))throw new Error(`CURVE.${e} must be positive bigint`)}const i=Te(t.p,r.Fp,n),o=Te(t.n,r.Fn,n),s=["Gx","Gy","a","b"];for(const e of s)if(!i.isValid(t[e]))throw new Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:i,Fn:o}}("weierstrass",e,t),{Fp:n,Fn:i}=r;let a=r.CURVE;const{h:f,n:l}=a;Q(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:d}=t;if(d&&(!n.is0(a.a)||"bigint"!=typeof d.beta||!Array.isArray(d.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const y=et(n,i);function h(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}const p=t.toBytes||function(e,t,r){const{x:i,y:o}=t.toAffine(),s=n.toBytes(i);if(V(r,"isCompressed"),r){h();const e=!n.isOdd(o);return u(Qe(e),s)}return u(Uint8Array.of(4),s,n.toBytes(o))},w=t.fromBytes||function(e){s(e,void 0,"Point");const{publicKey:t,publicKeyUncompressed:r}=y,i=e.length,o=e[0],c=e.subarray(1);if(i!==t||2!==o&&3!==o){if(i===r&&4===o){const e=n.BYTES,t=n.fromBytes(c.subarray(0,e)),r=n.fromBytes(c.subarray(e,2*e));if(!g(t,r))throw new Error("bad point: is not on curve");return{x:t,y:r}}throw new Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${r}`)}{const e=n.fromBytes(c);if(!n.isValid(e))throw new Error("bad point: is not on curve, wrong x");const t=b(e);let r;try{r=n.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("bad point: is not on curve, sqrt error"+t)}h();return!(1&~o)!==n.isOdd(r)&&(r=n.neg(r)),{x:e,y:r}}};function b(e){const t=n.sqr(e),r=n.mul(t,e);return n.add(n.add(r,n.mul(e,a.a)),a.b)}function g(e,t){const r=n.sqr(t),i=b(e);return n.eql(r,i)}if(!g(a.Gx,a.Gy))throw new Error("bad curve params: generator point");const m=n.mul(n.pow(a.a,Ge),We),E=n.mul(n.sqr(a.b),BigInt(27));if(n.is0(n.add(m,E)))throw new Error("bad curve params: a or b");function v(e,t,r=!1){if(!n.isValid(t)||r&&n.is0(t))throw new Error(`bad point coordinate ${e}`);return t}function B(e){if(!(e instanceof R))throw new Error("Weierstrass Point expected")}function k(e){if(!d||!d.basises)throw new Error("no endo");return Ve(e,d.basises,i.ORDER)}const x=ee((e,t)=>{const{X:r,Y:i,Z:o}=e;if(n.eql(o,n.ONE))return{x:r,y:i};const s=e.is0();null==t&&(t=s?n.ONE:n.inv(o));const c=n.mul(r,t),u=n.mul(i,t),a=n.mul(o,t);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(a,n.ONE))throw new Error("invZ was invalid");return{x:c,y:u}}),K=ee(e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.Y))return;throw new Error("bad point: ZERO")}const{x:r,y:i}=e.toAffine();if(!n.isValid(r)||!n.isValid(i))throw new Error("bad point: x or y not field elements");if(!g(r,i))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function O(e,t,r,i,o){return r=new R(n.mul(r.X,e),r.Y,r.Z),t=Ae(i,t),r=Ae(o,r),t.add(r)}class R{static BASE=new R(a.Gx,a.Gy,n.ONE);static ZERO=new R(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=i;X;Y;Z;constructor(e,t,r){this.X=v("x",e),this.Y=v("y",t,!0),this.Z=v("z",r),Object.freeze(this)}static CURVE(){return a}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw new Error("invalid affine point");if(e instanceof R)throw new Error("projective point not allowed");return n.is0(t)&&n.is0(r)?R.ZERO:new R(t,r,n.ONE)}static fromBytes(e){const t=R.fromAffine(w(s(e,void 0,"point")));return t.assertValidity(),t}static fromHex(e){return R.fromBytes(c(e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return S.createCache(this,e),t||this.multiply(Ge),this}assertValidity(){K(this)}hasEvenY(){const{y:e}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(e)}equals(e){B(e);const{X:t,Y:r,Z:i}=this,{X:o,Y:s,Z:c}=e,u=n.eql(n.mul(t,c),n.mul(o,i)),a=n.eql(n.mul(r,c),n.mul(s,i));return u&&a}negate(){return new R(this.X,n.neg(this.Y),this.Z)}double(){const{a:e,b:t}=a,r=n.mul(t,Ge),{X:i,Y:o,Z:s}=this;let c=n.ZERO,u=n.ZERO,f=n.ZERO,l=n.mul(i,i),d=n.mul(o,o),y=n.mul(s,s),h=n.mul(i,o);return h=n.add(h,h),f=n.mul(i,s),f=n.add(f,f),c=n.mul(e,f),u=n.mul(r,y),u=n.add(c,u),c=n.sub(d,u),u=n.add(d,u),u=n.mul(c,u),c=n.mul(h,c),f=n.mul(r,f),y=n.mul(e,y),h=n.sub(l,y),h=n.mul(e,h),h=n.add(h,f),f=n.add(l,l),l=n.add(f,l),l=n.add(l,y),l=n.mul(l,h),u=n.add(u,l),y=n.mul(o,s),y=n.add(y,y),l=n.mul(y,h),c=n.sub(c,l),f=n.mul(y,d),f=n.add(f,f),f=n.add(f,f),new R(c,u,f)}add(e){B(e);const{X:t,Y:r,Z:i}=this,{X:o,Y:s,Z:c}=e;let u=n.ZERO,f=n.ZERO,l=n.ZERO;const d=a.a,y=n.mul(a.b,Ge);let h=n.mul(t,o),p=n.mul(r,s),w=n.mul(i,c),b=n.add(t,r),g=n.add(o,s);b=n.mul(b,g),g=n.add(h,p),b=n.sub(b,g),g=n.add(t,i);let m=n.add(o,c);return g=n.mul(g,m),m=n.add(h,w),g=n.sub(g,m),m=n.add(r,i),u=n.add(s,c),m=n.mul(m,u),u=n.add(p,w),m=n.sub(m,u),l=n.mul(d,g),u=n.mul(y,w),l=n.add(u,l),u=n.sub(p,l),l=n.add(p,l),f=n.mul(u,l),p=n.add(h,h),p=n.add(p,h),w=n.mul(d,w),g=n.mul(y,g),p=n.add(p,w),w=n.sub(h,w),w=n.mul(d,w),g=n.add(g,w),h=n.mul(p,g),f=n.add(f,h),h=n.mul(m,g),u=n.mul(b,u),u=n.sub(u,h),h=n.mul(b,p),l=n.mul(m,l),l=n.add(l,h),new R(u,f,l)}subtract(e){return this.add(e.negate())}is0(){return this.equals(R.ZERO)}multiply(e){const{endo:r}=t;if(!i.isValidNot0(e))throw new Error("invalid scalar: out of range");let n,o;const s=e=>S.cached(this,e,e=>Se(R,e));if(r){const{k1neg:t,k1:i,k2neg:c,k2:u}=k(e),{p:a,f:f}=s(i),{p:l,f:d}=s(u);o=f.add(d),n=O(r.beta,a,l,t,c)}else{const{p:t,f:r}=s(e);n=t,o=r}return Se(R,[n,o])[0]}multiplyUnsafe(e){const{endo:r}=t,n=this;if(!i.isValid(e))throw new Error("invalid scalar: out of range");if(e===Ye||n.is0())return R.ZERO;if(e===ze)return n;if(S.hasCache(this))return this.multiply(e);if(r){const{k1neg:t,k1:i,k2neg:o,k2:s}=k(e),{p1:c,p2:u}=function(e,t,r,n){let i=t,o=e.ZERO,s=e.ZERO;for(;r>Oe||n>Oe;)r&Re&&(o=o.add(i)),n&Re&&(s=s.add(i)),i=i.double(),r>>=Re,n>>=Re;return{p1:o,p2:s}}(R,n,i,s);return O(r.beta,c,u,t,o)}return S.unsafe(n,e)}toAffine(e){return x(this,e)}isTorsionFree(){const{isTorsionFree:e}=t;return f===ze||(e?e(R,this):S.unsafe(this,l).is0())}clearCofactor(){const{clearCofactor:e}=t;return f===ze?this:e?e(R,this):this.multiplyUnsafe(f)}isSmallOrder(){return this.multiplyUnsafe(f).is0()}toBytes(e=!0){return V(e,"isCompressed"),this.assertValidity(),p(R,this,e)}toHex(e=!0){return o(this.toBytes(e))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const A=i.BITS,S=new Pe(R,t.endo?Math.ceil(A/2):A);return R.BASE.precompute(8),R}function Qe(e){return Uint8Array.of(e?2:3)}function et(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function tt(e,t={}){const{Fn:r}=e,n=t.randomBytes||i,o=Object.assign(et(e.Fp,r),{seed:Ke(r.ORDER)});function c(e=n(o.seed)){return function(e,t,r=!1){s(e);const n=e.length,i=xe(t),o=Ke(t);if(n<16||n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);const c=le(r?Y(e):$(e),t-re)+re;return r?X(c,i):z(c,i)}(s(e,o.seed,"seed"),r.ORDER)}function u(t,n=!0){return e.BASE.multiply(r.fromBytes(t)).toBytes(n)}function f(e){const{secretKey:t,publicKey:n,publicKeyUncompressed:i}=o;if(!a(e))return;if("_lengths"in r&&r._lengths||t===n)return;const c=s(e,void 0,"key").length;return c===n||c===i}const l={isValidSecretKey:function(e){try{const t=r.fromBytes(e);return r.isValidNot0(t)}catch(e){return!1}},isValidPublicKey:function(t,r){const{publicKey:n,publicKeyUncompressed:i}=o;try{const o=t.length;return(!0!==r||o===n)&&((!1!==r||o===i)&&!!e.fromBytes(t))}catch(e){return!1}},randomSecretKey:c},d=function(e,t){return function(r){const n=e(r);return{secretKey:n,publicKey:t(n)}}}(c,u);return Object.freeze({getPublicKey:u,getSharedSecret:function(t,n,i=!0){if(!0===f(t))throw new Error("first arg must be private key");if(!1===f(n))throw new Error("second arg must be public key");const o=r.fromBytes(t);return e.fromBytes(n).multiply(o).toBytes(i)},keygen:d,Point:e,utils:l,lengths:o})}function rt(e,t,r={}){n(t),Q(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const f=(r=Object.assign({},r)).randomBytes||i,l=r.hmac||((e,r)=>He(t,e,r)),{Fp:y,Fn:h}=e,{ORDER:p,BITS:w}=h,{keygen:b,getPublicKey:g,getSharedSecret:m,utils:E,lengths:v}=tt(e,r),B={prehash:!0,lowS:"boolean"!=typeof r.lowS||r.lowS,format:"compact",extraEntropy:!1},k=p*Xe<y.ORDER;function x(e){return e>p>>ze}function K(e,t){if(!h.isValidNot0(t))throw new Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}function O(){if(k)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function R(e,t){De(t);const r=v.signature;return s(e,"compact"===t?r:"recovered"===t?r+1:void 0)}class A{r;s;recovery;constructor(e,t,r){if(this.r=K("r",e),this.s=K("s",t),null!=r){if(O(),![0,1,2,3].includes(r))throw new Error("invalid recovery id");this.recovery=r}Object.freeze(this)}static fromBytes(e,t=B.format){let r;if(R(e,t),"der"===t){const{r:t,s:r}=$e.toSig(s(e));return new A(t,r)}"recovered"===t&&(r=e[0],t="compact",e=e.subarray(1));const n=v.signature/2,i=e.subarray(0,n),o=e.subarray(n,2*n);return new A(h.fromBytes(i),h.fromBytes(o),r)}static fromHex(e,t){return this.fromBytes(c(e),t)}assertRecovery(){const{recovery:e}=this;if(null==e)throw new Error("invalid recovery id: must be present");return e}addRecoveryBit(e){return new A(this.r,this.s,e)}recoverPublicKey(t){const{r:r,s:n}=this,i=this.assertRecovery(),o=2===i||3===i?r+p:r;if(!y.isValid(o))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const c=y.toBytes(o),a=e.fromBytes(u(Qe(!(1&i)),c)),f=h.inv(o),l=U(s(t,void 0,"msgHash")),d=h.create(-l*f),w=h.create(n*f),b=e.BASE.multiplyUnsafe(d).add(a.multiplyUnsafe(w));if(b.is0())throw new Error("invalid recovery: point at infinify");return b.assertValidity(),b}hasHighS(){return x(this.s)}toBytes(e=B.format){if(De(e),"der"===e)return c($e.hexFromSig(this));const{r:t,s:r}=this,n=h.toBytes(t),i=h.toBytes(r);return"recovered"===e?(O(),u(Uint8Array.of(this.assertRecovery()),n,i)):u(n,i)}toHex(e){return o(this.toBytes(e))}}const S=r.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const t=$(e),r=8*e.length-w;return r>0?t>>BigInt(r):t},U=r.bits2int_modN||function(e){return h.create(S(e))},I=J(w);function M(e){return W("num < 2^"+w,e,Ye,I),h.toBytes(e)}function q(e,r){return s(e,void 0,"message"),r?s(t(e),void 0,"prehashed message"):e}return Object.freeze({keygen:b,getPublicKey:g,getSharedSecret:m,utils:E,lengths:v,Point:e,sign:function(r,n,i={}){const{seed:o,k2sig:c}=function(t,r,n){const{lowS:i,prehash:o,extraEntropy:c}=Le(n,B);t=q(t,o);const a=U(t),l=h.fromBytes(r);if(!h.isValidNot0(l))throw new Error("invalid private key");const d=[M(l),M(a)];if(null!=c&&!1!==c){const e=!0===c?f(v.secretKey):c;d.push(s(e,void 0,"extraEntropy"))}const y=u(...d),p=a;return{seed:y,k2sig:function(t){const r=S(t);if(!h.isValidNot0(r))return;const n=h.inv(r),o=e.BASE.multiply(r).toAffine(),s=h.create(o.x);if(s===Ye)return;const c=h.create(n*h.create(p+s*l));if(c===Ye)return;let u=(o.x===s?0:2)|Number(o.y&ze),a=c;return i&&x(c)&&(a=h.neg(c),u^=1),new A(s,a,k?void 0:u)}}}(r,n,i);return function(e,t,r){if(d(e,"hashLen"),d(t,"qByteLen"),"function"!=typeof r)throw new Error("hmacFn must be a function");const n=e=>new Uint8Array(e),i=Uint8Array.of(),o=Uint8Array.of(0),s=Uint8Array.of(1);let c=n(e),a=n(e),f=0;const l=()=>{c.fill(1),a.fill(0),f=0},y=(...e)=>r(a,u(c,...e)),h=(e=i)=>{a=y(o,e),c=y(),0!==e.length&&(a=y(s,e),c=y())},p=()=>{if(f++>=1e3)throw new Error("drbg: tried max amount of iterations");let e=0;const r=[];for(;e<t;){c=y();const t=c.slice();r.push(t),e+=c.length}return u(...r)};return(e,t)=>{let r;for(l(),h(e);!(r=t(p()));)h();return l(),r}}(t.outputLen,h.BYTES,l)(o,c).toBytes(i.format)},verify:function(t,r,n,i={}){const{lowS:o,prehash:c,format:u}=Le(i,B);if(n=s(n,void 0,"publicKey"),r=q(r,c),!a(t)){throw new Error("verify expects Uint8Array signature"+(t instanceof A?", use sig.toBytes()":""))}R(t,u);try{const i=A.fromBytes(t,u),s=e.fromBytes(n);if(o&&i.hasHighS())return!1;const{r:c,s:a}=i,f=U(r),l=h.inv(a),d=h.create(f*l),y=h.create(c*l),p=e.BASE.multiplyUnsafe(d).add(s.multiplyUnsafe(y));if(p.is0())return!1;return h.create(p.x)===c}catch(e){return!1}},recoverPublicKey:function(e,t,r={}){const{prehash:n}=Le(r,B);return t=q(t,n),A.fromBytes(e,"recovered").recoverPublicKey(t).toBytes()},Signature:A,hash:t})}
16
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const nt={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},it={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},ot=BigInt(2);const st=ke(nt.p,{sqrt:function(e){const t=nt.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),c=BigInt(44),u=BigInt(88),a=e*e*e%t,f=a*a*e%t,l=de(f,r,t)*f%t,d=de(l,r,t)*f%t,y=de(d,ot,t)*a%t,h=de(y,i,t)*y%t,p=de(h,o,t)*h%t,w=de(p,c,t)*p%t,b=de(w,u,t)*w%t,g=de(b,c,t)*p%t,m=de(g,r,t)*f%t,E=de(m,s,t)*h%t,v=de(E,n,t)*a%t,B=de(v,ot,t);if(!st.eql(st.sqr(B),e))throw new Error("Cannot find square root");return B}}),ct=rt(Je(nt,{Fp:st,endo:it}),y);class ut{constructor(e){this.ec={...ct},null!=e.priv&&(this.priv=e.priv),null!=e.pub&&(this.pub=e.pub)}static hexToBytes(e){if("string"!=typeof e)throw new Error("hex string expected");if(e.length%2)throw new Error("hex string must have even length");const t=e.length/2,r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=parseInt(e.substr(2*n,2),16);return r}static bytesToHex(e){return Array.from(e||[]).map(e=>e.toString(16).padStart(2,"0")).join("")}static keyFromPublic(e,t="hex"){const r="hex"===t?ut.hexToBytes(e):e;return new ut({pub:r})}getPublic(e=!0,t="hex"){this.pub||(this.pub=this.ec.getPublicKey(this.priv,!1));let r=this.pub;const n=this.ec.Point.fromHex(ut.bytesToHex(r)).toHex(e);return r=ut.hexToBytes(n),"hex"===t?ut.bytesToHex(r):r}}
17
+ /*!
18
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
19
+ */const at=new Map([[R,{secret:new Uint8Array([48,103,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,77,48,75,2,1,1,4,32]),public:new Uint8Array([161,36,3,34,0])}],[A,{secret:new Uint8Array([48,129,132,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,109,48,107,2,1,1,4,48]),public:new Uint8Array([161,52,3,50,0])}],[S,{secret:new Uint8Array([48,129,170,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,129,146,48,129,143,2,1,1,4,66]),public:new Uint8Array([161,70,3,68,0])}],[U,{secret:new Uint8Array([48,129,132,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10,4,109,48,107,2,1,1,4,32]),public:new Uint8Array([161,68,3,66,0])}]]),ft=new Map([[R,new Uint8Array([48,57,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,34,0])],[A,new Uint8Array([48,70,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,3,50,0])],[S,new Uint8Array([48,88,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,3,68,0])],[U,new Uint8Array([48,86,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10,3,66,0])]]);function lt(e){return Uint8Array.from(ut.keyFromPublic(e,"bytes").getPublic(!1,"array"))}async function dt({id:e,controller:r,secretKeyMultibase:n,publicKeyMultibase:i,keyAgreement:o=!1}){if(!i)throw new TypeError('The "publicKeyMultibase" property is required.');const s={id:e,controller:r};if(!i||"string"!=typeof i||i[0]!==g)throw new TypeError('"publicKeyMultibase" must be a multibase, base58-encoded string.');const c=t(i.slice(1)),u={name:o?"ECDH":h,namedCurve:P({publicMultikey:c})},a=function({publicMultikey:e}){const t=P({publicMultikey:e});let r=e.subarray(2);t===U&&(r=lt(r));return function({curve:e,publicKey:t}){const r=ft.get(e),n=new Uint8Array(r.length+t.length);let i=0;return n.set(r,i),i+=r.length,n.set(t,i),n}
20
+ /*!
21
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
22
+ */({curve:t,publicKey:r})}({publicMultikey:c}),f=o?[]:["verify"];if(u.namedCurve===U){const{Crypto:e}=await import("./webcrypto.es-BOyMRPOj-CAxP3jJR.js"),t=new e;s.publicKey=await t.subtle.importKey("spki",a,u,p,f)}else s.publicKey=await j.subtle.importKey("spki",a,u,p,f);if(n){if("string"!=typeof n||n[0]!==g)throw new TypeError('"secretKeyMultibase" must be a multibase, base58-encoded string.');const e=t(n.slice(1));!function({secretMultikey:e,publicMultikey:t}){const r=P({publicMultikey:t}),n=T({secretMultikey:e});if(r!==n)throw new Error(`Public key curve ('${r}') does not match secret key curve ('${n}').`)}({secretMultikey:e,publicMultikey:c});const r=function({secretMultikey:e,publicMultikey:t}){const r=T({secretMultikey:e}),n=e.subarray(2),i=t.subarray(2);return function({curve:e,secretKey:t,publicKey:r}){const n=at.get(e);if(!n)throw new Error(`Unsupported curve "${e}".`);e===U&&(r=lt(r));const i=new Uint8Array(n.secret.length+t.length+n.public.length+r.length);let o=0;return i.set(n.secret,o),o+=n.secret.length,i.set(t,o),o+=t.length,i.set(n.public,o),o+=n.public.length,i.set(r,o),i}({curve:r,secretKey:n,publicKey:i})}({secretMultikey:e,publicMultikey:c}),i=o?["deriveBits"]:["sign"];if(u.namedCurve===U){const{Crypto:e}=await import("./webcrypto.es-BOyMRPOj-CAxP3jJR.js"),t=new e;s.secretKey=await t.subtle.importKey("pkcs8",r,u,p,i)}else s.secretKey=await j.subtle.importKey("pkcs8",r,u,p,i)}return s}function yt({jwk:t}={}){if("EC"!==t?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:r}=t,n=F({curve:r}),i=e(t.x),o=e(t.y),s=new Uint8Array(n+1),c=o[o.length-1]%2==0;return s[0]=c?2:3,s.set(i,s.length-i.length),s}function ht({jwk:t}={}){if("EC"!==t?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:n}=t,i=F({curve:n}),o=e(t.x),s=e(t.y),c=new Uint8Array(2+(i+1));!function({curve:e,buffer:t}){if(e===R)t[0]=E[0],t[1]=E[1];else if(e===A)t[0]=v[0],t[1]=v[1];else if(e===S)t[0]=B[0],t[1]=B[1];else{if(e!==U)throw new TypeError(`Unsupported curve "${e}".`);t[0]=m[0],t[1]=m[1]}}({curve:n,buffer:c});const u=s[s.length-1]%2==0;c[2]=u?2:3,c.set(o,c.length-o.length);return g+r(c)}function pt({jwk:t}={}){if("EC"!==t?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:n}=t,i=F({curve:n}),o=e(t.d),s=new Uint8Array(2+i);!function({curve:e,buffer:t}){if(e===R)t[0]=x[0],t[1]=x[1];else if(e===A)t[0]=K[0],t[1]=K[1];else if(e===S)t[0]=O[0],t[1]=O[1];else{if(e!==U)throw new TypeError(`Unsupported curve "${e}".`);t[0]=k[0],t[1]=k[1]}}({curve:t.crv,buffer:s}),s.set(o,s.length-o.length);return g+r(s)}const wt=new Set(["EcdsaSecp256r1VerificationKey2019","EcdsaSecp384r1VerificationKey2019","EcdsaSecp521r1VerificationKey2019","EcdsaSecp256k1VerificationKey2019"]);async function bt({keyPair:e}){if(!wt.has(e.type))throw new TypeError(`Unsupported key type "${e.type}".`);if(e["@context"]||(e["@context"]=w),!function({document:e,contextUrl:t}){const r=e["@context"];return r===t||Array.isArray(r)&&r.includes(t)}
23
+ /*!
24
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
25
+ */({document:e,contextUrl:w}))throw new TypeError(`Context not supported "${e["@context"]}".`);return{"@context":b,id:e.id,type:"Multikey",controller:e.controller,publicKeyMultibase:e.publicKeyMultibase,secretKeyMultibase:e.secretKeyMultibase}}async function gt(e,t={}){"boolean"==typeof t&&(t={keyAgreement:t});const{keyAgreement:r}=t;let n={...e};if("Multikey"!==n.type){if(n.publicKeyJwk)return async function({jwk:e,secretKey:t=!1}={}){const r={"@context":b,type:"Multikey",publicKeyMultibase:ht({jwk:e})};t&&e.d&&(r.secretKeyMultibase=pt({jwk:e}));const n=!e.key_ops||e.key_ops.includes("deriveBits");return gt(r,n)}({jwk:n.publicKeyJwk,secretKey:!1});if(n.type)return n=await bt({keyPair:n}),Et({keyPair:n,keyAgreement:r})}return n.type||(n.type="Multikey"),n["@context"]||(n["@context"]=b),n.controller&&!n.id&&(n.id=`${e.controller}#${e.publicKeyMultibase}`),function(e){if(!e||"object"!=typeof e)throw new TypeError('"key" must be an object.');if("Multikey"!==e.type)throw new TypeError('"key" must be a Multikey with type "Multikey".');if(!(e["@context"]===b||Array.isArray(e["@context"])&&e["@context"].includes(b)))throw new TypeError(`"key" must be a Multikey with context "${b}".`)}(n),Et({keyPair:n,keyAgreement:r})}async function mt({keyPair:e,secretKey:t=!1}={}){e?.publicKey instanceof C||(e=await dt(e));const r=t&&!!e.secretKey?e.secretKey:e.publicKey;let n;if(e.publicKey.algorithm.namedCurve===U){const{Crypto:e}=await import("./webcrypto.es-BOyMRPOj-CAxP3jJR.js"),t=new e;n=await t.subtle.exportKey("jwk",r)}else n=await j.subtle.exportKey("jwk",r);return n}async function Et({keyPair:t,keyAgreement:r=!1}){t?.publicKey instanceof C||t.publicKey?.algorithm.namedCurve===U||(t=await dt(t));const n=async({publicKey:r=!0,secretKey:n=!1,includeContext:i=!0,raw:o=!1}={})=>{if(o){const i=await mt({keyPair:t,secretKey:n}),o={};return r&&(o.publicKey=yt({jwk:i})),n&&(o.secretKey=function({jwk:t}={}){if("EC"!==t?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:r}=t,n=F({curve:r}),i=e(t.d),o=new Uint8Array(n);return o.set(i,o.length-i.length),o}({jwk:i})),o}return async function({keyPair:e,secretKey:t,publicKey:r,includeContext:n}={}){if(!r&&!t)throw new TypeError('Export requires specifying either "publicKey" or "secretKey".');const i=t&&!!e.secretKey,o=i?e.secretKey:e.publicKey;let s;if(o.algorithm.namedCurve===U){const{Crypto:e}=await import("./webcrypto.es-BOyMRPOj-CAxP3jJR.js"),t=new e;s=await t.subtle.exportKey("jwk",o)}else s=await j.subtle.exportKey("jwk",o);const c={};return n&&(c["@context"]=b),c.id=e.id,c.type="Multikey",c.controller=e.controller,r&&(c.publicKeyMultibase=ht({jwk:s})),i&&(c.secretKeyMultibase=pt({jwk:s})),c}({keyPair:t,publicKey:r,secretKey:n,includeContext:i})},{publicKeyMultibase:i,secretKeyMultibase:o}=await n({publicKey:!0,secretKey:!0,includeContext:!0});return t={...t,publicKeyMultibase:i,secretKeyMultibase:o,keyAgreement:r,export:n,signer(){const{id:e,secretKey:r}=t;
26
+ /*!
27
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
28
+ */
29
+ return function({id:e,secretKey:t}){if(!t)throw new Error('"secretKey" is required for signing.');const{namedCurve:r}=t.algorithm,n={name:h,hash:{name:N({curve:r})}};return{algorithm:r,id:e,async sign({data:e}={}){if(r===U){const{Crypto:r}=await import("./webcrypto.es-BOyMRPOj-CAxP3jJR.js"),i=new r;return new Uint8Array(await i.subtle.sign(n,t,e))}return new Uint8Array(await j.subtle.sign(n,t,e))}}}({id:e,secretKey:r})},verifier(){const{id:e,publicKey:r}=t;return function({id:e,publicKey:t}){if(!t)throw new Error('"publicKey" is required for verifying.');const{namedCurve:r}=t.algorithm,n={name:h,hash:{name:N({curve:r})}};return{algorithm:r,id:e,async verify({data:e,signature:i}={}){if(r===U){const{Crypto:r}=await import("./webcrypto.es-BOyMRPOj-CAxP3jJR.js");return(new r).subtle.verify(n,t,i,e)}return j.subtle.verify(n,t,i,e)}}}({id:e,publicKey:r})},async deriveSecret({publicKey:e,remotePublicKey:r}={}){if(r&&e)throw new Error('Only one of "remotePublicKey" and "publicKey" must be given.');if(!t.keyAgreement){const e=Error('"keyAgreement" is not supported by this keypair.');throw e.name="NotSupportedError",e}return async function({localKeyPair:e,remoteKeyPair:t}){if(!e.secretKey){const e=Error('"secretKey" required to derive secret.');throw e.name="NotSupportedError",e}e=await dt({...e,keyAgreement:!0}),t=await dt({...t,keyAgreement:!0});const{namedCurve:r}=e.secretKey.algorithm,n=F({curve:r});if(r===U){const{Crypto:i}=await import("./webcrypto.es-BOyMRPOj-CAxP3jJR.js"),o=new i,s=await o.subtle.deriveBits({name:"ECDH",namedCurve:r,public:t.publicKey},e.secretKey,8*n);return new Uint8Array(s,0,n)}const i=await j.subtle.deriveBits({name:"ECDH",namedCurve:r,public:t.publicKey},e.secretKey,8*n);return new Uint8Array(i,0,n)}({localKeyPair:this,remoteKeyPair:r||e})}}}export{yt as a,gt as f,mt as t};
@@ -0,0 +1,33 @@
1
+ import{t as e,u as t,s as r,f as n}from"./main.js";import{_ as i}from"./_polyfill-node.crypto-DGISCHrB-C5-OOGc0.js";
2
+ /*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */const o=BigInt(0),s=BigInt(1),c=BigInt(2),a=BigInt(8),f=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),u=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:f,n:f,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),l=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),y=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742");const d=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),w=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),p=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),h=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class b{constructor(e,t,r,n){this.x=e,this.y=t,this.z=r,this.t=n}static fromAffine(e){if(!(e instanceof k))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(k.ZERO)?b.ZERO:new b(e.x,e.y,s,j(e.x*e.y))}static toAffineBatch(e){const t=function(e,t=u.P){const r=new Array(e.length),n=_(e.reduce((e,n,i)=>n===o?e:(r[i]=e,j(e*n,t)),s),t);return e.reduceRight((e,n,i)=>n===o?e:(r[i]=j(e*r[i],t),j(e*n,t)),n),r}(e.map(e=>e.z));return e.map((e,r)=>e.toAffine(t[r]))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){x(e);const{x:t,y:r,z:n}=this,{x:i,y:o,z:s}=e,c=j(t*s),a=j(i*n),f=j(r*s),u=j(o*n);return c===a&&f===u}negate(){return new b(j(-this.x),this.y,this.z,j(-this.t))}double(){const{x:e,y:t,z:r}=this,{a:n}=u,i=j(e*e),o=j(t*t),s=j(c*j(r*r)),a=j(n*i),f=e+t,l=j(j(f*f)-i-o),y=a+o,d=y-s,w=a-o,p=j(l*d),h=j(y*w),g=j(l*w),x=j(d*y);return new b(p,h,x,g)}add(e){x(e);const{x:t,y:r,z:n,t:i}=this,{x:s,y:a,z:f,t:u}=e,l=j((r-t)*(a+s)),y=j((r+t)*(a-s)),d=j(y-l);if(d===o)return this.double();const w=j(n*c*u),p=j(i*c*f),h=p+w,g=y+l,m=p-w,E=j(h*d),K=j(g*m),B=j(h*m),k=j(d*g);return new b(E,K,k,B)}subtract(e){return this.add(e.negate())}precomputeWindow(e){const t=1+256/e,r=[];let n=this,i=n;for(let o=0;o<t;o++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(b.BASE)&&(t=k.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=t&&B.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=b.normalizeZ(n),B.set(t,n)));let i=b.ZERO,o=b.BASE;const c=1+256/r,a=2**(r-1),f=BigInt(2**r-1),u=2**r,l=BigInt(r);for(let t=0;t<c;t++){const r=t*a;let c=Number(e&f);e>>=l,c>a&&(c-=u,e+=s);const y=r,d=r+Math.abs(c)-1,w=t%2!=0,p=c<0;0===c?o=o.add(g(w,n[y])):i=i.add(g(p,n[d]))}return b.normalizeZ([i,o])[0]}multiply(e,t){return this.wNAF(V(e,u.l),t)}multiplyUnsafe(e){let t=V(e,u.l,!1);const r=b.BASE,n=b.ZERO;if(t===o)return n;if(this.equals(n)||t===s)return this;if(this.equals(r))return this.wNAF(t);let i=n,c=this;for(;t>o;)t&s&&(i=i.add(c)),c=c.double(),t>>=s;return i}isSmallOrder(){return this.multiplyUnsafe(u.h).equals(b.ZERO)}isTorsionFree(){let e=this.multiplyUnsafe(u.l/c).double();return u.l%c&&(e=e.add(this)),e.equals(b.ZERO)}toAffine(e){const{x:t,y:r,z:n}=this,i=this.equals(b.ZERO);null==e&&(e=i?a:_(n));const o=j(t*e),c=j(r*e),f=j(n*e);if(i)return k.ZERO;if(f!==s)throw new Error("invZ was invalid");return new k(o,c)}fromRistrettoBytes(){E()}toRistrettoBytes(){E()}fromRistrettoHash(){E()}}function g(e,t){const r=t.negate();return e?r:t}function x(e){if(!(e instanceof b))throw new TypeError("ExtendedPoint expected")}function m(e){if(!(e instanceof K))throw new TypeError("RistrettoPoint expected")}function E(){throw new Error("Legacy method: switch to RistrettoPoint")}b.BASE=new b(u.Gx,u.Gy,s,j(u.Gx*u.Gy)),b.ZERO=new b(o,s,s,o);class K{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){const{d:t}=u,r=j(y*e*e),n=j((r+s)*p);let i=BigInt(-1);const o=j((i-t*r)*j(r+t));let{isValid:c,value:a}=H(n,o),f=j(a*e);S(f)||(f=j(-f)),c||(a=f),c||(i=r);const l=j(i*(r-s)*h-o),w=a*a,g=j((a+a)*o),x=j(l*d),m=j(s-w),E=j(s+w);return new b(j(g*E),j(m*x),j(x*E),j(g*m))}static hashToCurve(e){const t=O((e=N(e,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(t),n=O(e.slice(32,64)),i=this.calcElligatorRistrettoMap(n);return new K(r.add(i))}static fromHex(e){e=N(e,32);const{a:t,d:r}=u,n="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",i=O(e);if(!function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(U(i),e)||S(i))throw new Error(n);const c=j(i*i),a=j(s+t*c),f=j(s-t*c),l=j(a*a),y=j(f*f),d=j(t*r*l-y),{isValid:w,value:p}=q(j(d*y)),h=j(p*f),g=j(p*h*d);let x=j((i+i)*h);S(x)&&(x=j(-x));const m=j(a*g),E=j(x*m);if(!w||S(E)||m===o)throw new Error(n);return new K(new b(x,m,s,E))}toRawBytes(){let{x:e,y:t,z:r,t:n}=this.ep;const i=j(j(r+t)*j(r-t)),o=j(e*t),s=j(o*o),{value:c}=q(j(i*s)),a=j(c*i),f=j(c*o),u=j(a*f*n);let l;if(S(n*u)){let r=j(t*y),n=j(e*y);e=r,t=n,l=j(a*w)}else l=f;S(e*u)&&(t=j(-t));let d=j((r-t)*l);return S(d)&&(d=j(-d)),U(d)}toHex(){return M(this.toRawBytes())}toString(){return this.toHex()}equals(e){m(e);const t=this.ep,r=e.ep,n=j(t.x*r.y)===j(t.y*r.x),i=j(t.y*r.y)===j(t.x*r.x);return n||i}add(e){return m(e),new K(this.ep.add(e.ep))}subtract(e){return m(e),new K(this.ep.subtract(e.ep))}multiply(e){return new K(this.ep.multiply(e))}multiplyUnsafe(e){return new K(this.ep.multiplyUnsafe(e))}}K.BASE=new K(b.BASE),K.ZERO=new K(b.ZERO);const B=new WeakMap;class k{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,B.delete(this)}static fromHex(e,t=!0){const{d:r,P:n}=u,i=(e=N(e,32)).slice();i[31]=-129&e[31];const o=T(i);if(t&&o>=n)throw new Error("Expected 0 < hex < P");if(!t&&o>=l)throw new Error("Expected 0 < hex < 2**256");const c=j(o*o),a=j(c-s),f=j(r*c+s);let{isValid:y,value:d}=H(a,f);if(!y)throw new Error("Point.fromHex: invalid y coordinate");const w=(d&s)===s;return!!(128&e[31])!==w&&(d=j(-d)),new k(d,o)}static async fromPrivateKey(e){return(await F(e)).point}toRawBytes(){const e=U(this.y);return e[31]|=this.x&s?128:0,e}toHex(){return M(this.toRawBytes())}toX25519(){const{y:e}=this;return U(j((s+e)*_(s-e)))}isTorsionFree(){return b.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new k(j(-this.x),this.y)}add(e){return b.fromAffine(this).add(b.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return b.fromAffine(this).multiply(e,this).toAffine()}}k.BASE=new k(u.Gx,u.Gy),k.ZERO=new k(o,s);class A{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=N(e,64),r=k.fromHex(t.slice(0,32),!1),n=T(t.slice(32,64));return new A(r,n)}assertValidity(){const{r:e,s:t}=this;if(!(e instanceof k))throw new Error("Expected Point instance");return V(t,u.l,!1),this}toRawBytes(){const e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(U(this.s),32),e}toHex(){return M(this.toRawBytes())}}function v(...e){if(!e.every(e=>e instanceof Uint8Array))throw new Error("Expected Uint8Array list");if(1===e.length)return e[0];const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r}const P=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function M(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=P[e[r]];return t}function I(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function R(e){return I(e.toString(16).padStart(64,"0"))}function U(e){return R(e).reverse()}function S(e){return(j(e)&s)===s}function T(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+M(Uint8Array.from(e).reverse()))}const z=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function O(e){return j(T(e)&z)}function j(e,t=u.P){const r=e%t;return r>=o?r:t+r}function _(e,t=u.P){if(e===o||t<=o)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=j(e,t),n=t,i=o,c=s;for(;r!==o;){const e=n%r,t=i-c*(n/r);n=r,r=e,i=c,c=t}if(n!==s)throw new Error("invert: does not exist");return j(i,t)}function Z(e,t){const{P:r}=u;let n=e;for(;t-- >o;)n*=n,n%=r;return n}function H(e,t){const r=j(t*t*t),n=function(e){const{P:t}=u,r=BigInt(5),n=BigInt(10),i=BigInt(20),o=BigInt(40),a=BigInt(80),f=e*e%t*e%t,l=Z(f,c)*f%t,y=Z(l,s)*e%t,d=Z(y,r)*y%t,w=Z(d,n)*d%t,p=Z(w,i)*w%t,h=Z(p,o)*p%t,b=Z(h,a)*h%t,g=Z(b,a)*h%t,x=Z(g,n)*d%t;return{pow_p_5_8:Z(x,c)*e%t,b2:f}}(e*j(r*r*t)).pow_p_5_8;let i=j(e*r*n);const o=j(t*i*i),a=i,f=j(i*y),l=o===e,d=o===j(-e),w=o===j(-e*y);return l&&(i=a),(d||w)&&(i=f),S(i)&&(i=j(-i)),{isValid:l||d,value:i}}function q(e){return H(s,e)}function $(e){return j(T(e),u.l)}function N(e,t){const r=e instanceof Uint8Array?Uint8Array.from(e):I(e);if("number"==typeof t&&r.length!==t)throw new Error(`Expected ${t} bytes`);return r}function V(e,t,r=!0){if(!t)throw new TypeError("Specify max value");if("number"==typeof e&&Number.isSafeInteger(e)&&(e=BigInt(e)),"bigint"==typeof e&&e<t)if(r){if(o<e)return e}else if(o<=e)return e;throw new TypeError("Expected valid scalar: 0 < scalar < max")}let W;async function F(e){return function(e){const t=((r=e.slice(0,32))[0]&=248,r[31]&=127,r[31]|=64,r);var r;const n=e.slice(32,64),i=$(t),o=k.BASE.multiply(i),s=o.toRawBytes();return{head:t,prefix:n,scalar:i,point:o,pointBytes:s}}(await L.sha512(function(e){if(32!==(e="bigint"==typeof e||"number"==typeof e?R(V(e,l)):N(e)).length)throw new Error("Expected 32 bytes");return e}(e)))}async function G(e){return(await F(e)).pointBytes}async function C(e,t){e=N(e);const{prefix:r,scalar:n,pointBytes:i}=await F(t),o=$(await L.sha512(r,e)),s=k.BASE.multiply(o),c=j(o+$(await L.sha512(s.toRawBytes(),i,e))*n,u.l);return new A(s,c).toRawBytes()}async function J(e,t,r){const{r:n,SB:i,msg:o,pub:s}=function(e,t,r){t=N(t),r instanceof k||(r=k.fromHex(r,!1));const{r:n,s:i}=e instanceof A?e.assertValidity():A.fromHex(e);return{r:n,s:i,SB:b.BASE.multiplyUnsafe(i),pub:r,msg:t}}(e,t,r),c=await L.sha512(n.toRawBytes(),s.toRawBytes(),o);return function(e,t,r,n){const i=$(n),o=b.fromAffine(e).multiplyUnsafe(i);return b.fromAffine(t).add(o).subtract(r).multiplyUnsafe(u.h).equals(b.ZERO)}(s,n,i,c)}k.BASE._setWindowSize(8);const D={node:i,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},L={bytesToHex:M,hexToBytes:I,concatBytes:v,getExtendedPublicKey:F,mod:j,invert:_,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:e=>{if((e=N(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return j(T(e),u.l-s)+s},randomBytes:(e=32)=>{if(D.web)return D.web.getRandomValues(new Uint8Array(e));if(D.node){const{randomBytes:t}=D.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>L.randomBytes(32),sha512:async(...e)=>{const t=v(...e);if(D.web){const e=await D.web.subtle.digest("SHA-512",t.buffer);return new Uint8Array(e)}if(D.node)return Uint8Array.from(D.node.createHash("sha512").update(t).digest());throw new Error("The environment doesn't have sha512 function")},precompute(e=8,t=k.BASE){const r=t.equals(k.BASE)?t:new k(t.x,t.y);return r._setWindowSize(e),r.multiply(c),r},sha512Sync:void 0};Object.defineProperties(L,{sha512Sync:{configurable:!1,get:()=>W,set(e){W||(W=e)}}});
3
+ /*!
4
+ * Copyright (c) 2020-2022 Digital Bazaar, Inc. All rights reserved.
5
+ */
6
+ const X=globalThis.crypto;if(!X.getRandomValues)throw new Error('Browser does not provide "crypto.getRandomValues".');async function Q(e){!
7
+ /*!
8
+ * Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
9
+ */
10
+ function({bytes:e,expectedLength:t=32,code:r}){if(!(e instanceof Uint8Array))throw new TypeError('"bytes" must be a Uint8Array.');if(e.length!==t){const e=new Error(`"bytes" must be a ${t}-byte Uint8Array.`);throw e.name="DataError",r&&(e.code=r),e}}({bytes:e,expectedLength:32});const t=await G(e),r=new Uint8Array(64);return r.set(e),r.set(t,e.length),{publicKey:t,secretKey:r}}
11
+ /*!
12
+ * Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
13
+ */
14
+ const Y="Ed25519";function ee({id:e,secretKey:t}){if(!t)throw new Error("A secret key is not available for signing.");return{algorithm:Y,id:e,sign:async({data:e})=>async function(e,t){return C(t,e.slice(0,32))}(t,e)}}function te({id:e,publicKey:t}){if(!t)throw new Error("A public key is not available for verifying.");return{algorithm:Y,id:e,verify:async({data:e,signature:r})=>async function(e,t,r){return J(r,t,e)}(t,e,r)}}
15
+ /*!
16
+ * Copyright (c) 2022-2024 Digital Bazaar, Inc. All rights reserved.
17
+ */const re=new Uint8Array([237,1]),ne=new Uint8Array([128,38]),ie="https://w3id.org/security/multikey/v1",oe=32,se=32;
18
+ /*!
19
+ * Copyright (c) 2020-2024 Digital Bazaar, Inc. All rights reserved.
20
+ */
21
+ function ce({keyPair:e}){const t={};return e.publicKey&&(t.publicKeyMultibase=ae(re,e.publicKey)),e.secretKey&&(t.secretKeyMultibase=ae(ne,e.secretKey)),t}function ae(e,r){const n=new Uint8Array(e.length+r.length);return n.set(e),n.set(r,e.length),"z"+t(n)}
22
+ /*!
23
+ * Copyright (c) 2022-2024 Digital Bazaar, Inc. All rights reserved.
24
+ */async function fe({keyPair:e,secretKey:t,publicKey:r,includeContext:n,canonicalize:i=!1}={}){if(!r&&!t)throw new TypeError('Export requires specifying either "publicKey" or "secretKey".');const o=t&&!!e.secretKey,s={};return n&&(s["@context"]=ie),s.id=e.id,s.type="Multikey",s.controller=e.controller,r&&(s.publicKeyMultibase=function({publicKey:e}={}){if(e.length!==oe)throw new Error(`Invalid public key size (${e.length}); expected 32.`);const{publicKeyMultibase:t}=ce({keyPair:{publicKey:e}});return t}(e)),o&&(s.secretKeyMultibase=function({secretKey:e,canonicalize:t=!1}={}){if(e.length!==se){if(64!==e.length)throw new Error(`Invalid secret key size (${e.length}); expected 32.`);t&&(e=e.subarray(0,se))}const{secretKeyMultibase:r}=ce({keyPair:{secretKey:e}});return r}
25
+ /*!
26
+ * Copyright (c) 2022-2024 Digital Bazaar, Inc. All rights reserved.
27
+ */({...e,canonicalize:i})),e.revoked&&(s.revoked=e.revoked),s}async function ue({id:e,controller:t,secretKeyMultibase:r,publicKeyMultibase:i,revoked:o}){if(!i)throw new TypeError('The "publicKeyMultibase" property is required.');const{publicKey:s,secretKey:c}=function({publicKeyMultibase:e,secretKeyMultibase:t}){if(!e||"string"!=typeof e||"z"!==e[0])throw new Error('"publicKeyMultibase" must be a multibase, base58-encoded string.');const r=n(e.substr(1)).slice(re.length);let i;if(t){if("string"!=typeof t||"z"!==t[0])throw new Error('"secretKeyMultibase" must be a multibase, base58-encoded string.');i=n(t.substr(1)).slice(ne.length)}return{publicKey:r,secretKey:i}}({publicKeyMultibase:i,secretKeyMultibase:r});return t&&!e&&(e=`${t}#${i}`),{id:e,controller:t,publicKey:s,secretKey:c,publicKeyMultibase:i,secretKeyMultibase:r,revoked:o}}function le({jwk:e}={}){const t=function({jwk:e}={}){const{kty:t,crv:n,x:i}=e;if("OKP"!==t)throw new TypeError('"jwk.kty" must be "OKP".');if("Ed25519"!==n)throw new TypeError('"jwk.crv" must be "Ed25519".');if("string"!=typeof i)throw new TypeError('"jwk.x" must be a string.');const o=r(e.x);if(o.length!==oe)throw new Error(`Invalid public key size (${o.length}); expected 32.`);return o}({jwk:e}),{publicKeyMultibase:n}=ce({keyPair:{publicKey:t}});return n}function ye({jwk:e}={}){const t=function({jwk:e}={}){const{kty:t,crv:n,d:i}=e;if("OKP"!==t)throw new TypeError('"jwk.kty" must be "OKP".');if("Ed25519"!==n)throw new TypeError('"jwk.crv" must be "Ed25519".');if("string"!=typeof i)throw new TypeError('"jwk.d" must be a string.');const o=Uint8Array.from(r(e.d));if(o.length!==se)throw new Error(`Invalid secret key size (${o.length}); expected 32.`);return o}({jwk:e}),{secretKeyMultibase:n}=ce({keyPair:{secretKey:t}});return n}const de=new Map([["Ed25519VerificationKey2020",{contextUrl:"https://w3id.org/security/suites/ed25519-2020/v1",translationFn:async function({keyPair:e}){return{...e,type:"Multikey","@context":ie,secretKeyMultibase:e.privateKeyMultibase}}}],["Ed25519VerificationKey2018",{contextUrl:"https://w3id.org/security/suites/ed25519-2018/v1",translationFn:async function({keyPair:e}){const t={publicKey:n(e.publicKeyBase58),secretKey:void 0};e.privateKeyBase58&&(t.secretKey=n(e.privateKeyBase58));const{publicKeyMultibase:r,secretKeyMultibase:i}=ce({keyPair:t});return{"@context":ie,id:e.id,type:"Multikey",controller:e.controller,revoked:e.revoked,publicKeyMultibase:r,secretKeyMultibase:i}}
28
+ /*!
29
+ * Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
30
+ */}]]);async function we({keyPair:e}){const t=de.get(e.type);if(!t)throw new Error(`Unsupported key type "${e.type}".`);const{contextUrl:r,translationFn:n}=t;if(e["@context"]||(e["@context"]=r),!function({document:e,contextUrl:t}){const r=e["@context"];return r===t||Array.isArray(r)&&r.includes(t)}
31
+ /*!
32
+ * Copyright (c) 2020-2023 Digital Bazaar, Inc. All rights reserved.
33
+ */({document:e,contextUrl:r}))throw new Error(`Context not supported "${e["@context"]}".`);return n({keyPair:e})}async function pe(e){let t={...e};if("Multikey"!==t.type){if(t.publicKeyJwk){let e,r;return"JsonWebKey"!==t.type&&"JsonWebKey2020"!==t.type||({id:e,controller:r}=t),he({jwk:t.publicKeyJwk,secretKey:!1,id:e,controller:r})}if(t.type)return t=await we({keyPair:t}),be({keyPair:t})}return t.type||(t.type="Multikey"),t["@context"]||(t["@context"]=ie),function(e){if(!e||"object"!=typeof e)throw new TypeError('"key" must be an object.');if("Multikey"!==e.type)throw new Error('"key" must be a Multikey with type "Multikey".');if(!(e["@context"]===ie||Array.isArray(e["@context"])&&e["@context"].includes(ie)))throw new TypeError(`"key" must be a Multikey with context "${ie}".`)}(t),be({keyPair:t})}async function he({jwk:e,secretKey:t=!1,id:r,controller:n}={}){const i={"@context":ie,type:"Multikey",publicKeyMultibase:le({jwk:e})};return"string"==typeof r&&(i.id=r),"string"==typeof n&&(i.controller=n),t&&e.d&&(i.secretKeyMultibase=ye({jwk:e})),pe(i)}async function be({keyPair:e}){return e.publicKey||(e=await ue(e)),e={...e,async export({publicKey:t=!0,secretKey:r=!1,includeContext:n=!0,raw:i=!1,canonicalize:o=!1}={}){if(i){const{publicKey:t,secretKey:r}=e,n={};return t&&(n.publicKey=t.slice()),r&&(o&&r.length>se?n.secretKey=r.subarray(0,se).slice():n.secretKey=r),n}return fe({keyPair:e,publicKey:t,secretKey:r,includeContext:n,canonicalize:o})},signer(){const{id:t,secretKey:r}=e;return ee({id:t,secretKey:r})},verifier(){const{id:t,publicKey:r}=e;return te({id:t,publicKey:r})}}}var ge=Object.freeze({__proto__:null,from:pe,fromJwk:he,generate:async function({id:e,controller:t,seed:r}={}){let n;n=r?await Q(r):await async function(){const e=new Uint8Array(32);X.getRandomValues(e);const t=await Q(e);return e.fill(0),t}();const{publicKeyMultibase:i,secretKeyMultibase:o}=ce({keyPair:n});return t&&!e&&(e=`${t}#${i}`),be({keyPair:{id:e,controller:t,publicKeyMultibase:i,secretKeyMultibase:o,...n}})},toJwk:async function({keyPair:t,secretKey:r=!1}={}){const n={kty:"OKP",crv:"Ed25519",x:e(t.publicKey)};return r&&!!t.secretKey&&(n.d=e(t.secretKey)),n}});export{pe as f,G as g,ge as i,C as s,J as v};