solid-logic 4.0.8-3 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/README.md +4 -3
  2. package/dist/2729812e0bfc062ee77a.js +1 -0
  3. package/dist/a9c30b64ceaae48b72f0.js +2045 -0
  4. package/dist/acl/aclLogic.d.ts +5 -0
  5. package/dist/acl/aclLogic.d.ts.map +1 -0
  6. package/dist/authSession/authSession.d.ts +42 -0
  7. package/dist/authSession/authSession.d.ts.map +1 -0
  8. package/dist/authSession/events.d.ts +24 -0
  9. package/dist/authSession/events.d.ts.map +1 -0
  10. package/dist/authSession/issuer.d.ts +8 -0
  11. package/dist/authSession/issuer.d.ts.map +1 -0
  12. package/dist/authSession/session.d.ts +45 -0
  13. package/dist/authSession/session.d.ts.map +1 -0
  14. package/dist/authn/SolidAuthnLogic.d.ts +42 -0
  15. package/dist/authn/SolidAuthnLogic.d.ts.map +1 -0
  16. package/dist/authn/authUtil.d.ts +17 -0
  17. package/dist/authn/authUtil.d.ts.map +1 -0
  18. package/dist/authn/serverLogout.d.ts +6 -0
  19. package/dist/authn/serverLogout.d.ts.map +1 -0
  20. package/dist/chat/chatLogic.d.ts +3 -0
  21. package/dist/chat/chatLogic.d.ts.map +1 -0
  22. package/dist/inbox/inboxLogic.d.ts +3 -0
  23. package/dist/inbox/inboxLogic.d.ts.map +1 -0
  24. package/dist/index.d.ts +14 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/issuer/issuerLogic.d.ts +8 -0
  27. package/dist/issuer/issuerLogic.d.ts.map +1 -0
  28. package/dist/logic/CustomError.d.ts +21 -0
  29. package/dist/logic/CustomError.d.ts.map +1 -0
  30. package/dist/logic/solidLogic.d.ts +6 -0
  31. package/dist/logic/solidLogic.d.ts.map +1 -0
  32. package/dist/logic/solidLogicSingleton.d.ts +4 -0
  33. package/dist/logic/solidLogicSingleton.d.ts.map +1 -0
  34. package/dist/profile/profileAclDocuments.d.ts +2 -0
  35. package/dist/profile/profileAclDocuments.d.ts.map +1 -0
  36. package/dist/profile/profileDocuments.d.ts +2 -0
  37. package/dist/profile/profileDocuments.d.ts.map +1 -0
  38. package/dist/profile/profileLogic.d.ts +3 -0
  39. package/dist/profile/profileLogic.d.ts.map +1 -0
  40. package/dist/solid-logic.esm.js +2358 -0
  41. package/dist/solid-logic.esm.js.map +1 -0
  42. package/dist/solid-logic.esm.min.js +2 -0
  43. package/dist/solid-logic.esm.min.js.map +1 -0
  44. package/dist/solid-logic.js +7548 -0
  45. package/dist/solid-logic.js.map +1 -0
  46. package/dist/solid-logic.min.js +2 -0
  47. package/dist/solid-logic.min.js.map +1 -0
  48. package/dist/typeIndex/typeIndexAclDocuments.d.ts +2 -0
  49. package/dist/typeIndex/typeIndexAclDocuments.d.ts.map +1 -0
  50. package/dist/typeIndex/typeIndexDocuments.d.ts +3 -0
  51. package/dist/typeIndex/typeIndexDocuments.d.ts.map +1 -0
  52. package/dist/typeIndex/typeIndexLogic.d.ts +3 -0
  53. package/dist/typeIndex/typeIndexLogic.d.ts.map +1 -0
  54. package/dist/types.d.ts +113 -0
  55. package/dist/types.d.ts.map +1 -0
  56. package/dist/util/containerLogic.d.ts +11 -0
  57. package/dist/util/containerLogic.d.ts.map +1 -0
  58. package/dist/util/debug.d.ts +5 -0
  59. package/dist/util/debug.d.ts.map +1 -0
  60. package/dist/util/ns.d.ts +2 -0
  61. package/dist/util/ns.d.ts.map +1 -0
  62. package/dist/util/utilityLogic.d.ts +17 -0
  63. package/dist/util/utilityLogic.d.ts.map +1 -0
  64. package/dist/util/utils.d.ts +8 -0
  65. package/dist/util/utils.d.ts.map +1 -0
  66. package/package.json +33 -27
  67. package/dist/_virtual/_rolldown/runtime.cjs.js +0 -1
  68. package/dist/acl/aclLogic.cjs.js +0 -2
  69. package/dist/acl/aclLogic.cjs.js.map +0 -1
  70. package/dist/acl/aclLogic.esm.js +0 -56
  71. package/dist/acl/aclLogic.esm.js.map +0 -1
  72. package/dist/authSession/authSession.cjs.js +0 -2
  73. package/dist/authSession/authSession.cjs.js.map +0 -1
  74. package/dist/authSession/authSession.esm.js +0 -22
  75. package/dist/authSession/authSession.esm.js.map +0 -1
  76. package/dist/authSession/events.cjs.js +0 -2
  77. package/dist/authSession/events.cjs.js.map +0 -1
  78. package/dist/authSession/events.esm.js +0 -19
  79. package/dist/authSession/events.esm.js.map +0 -1
  80. package/dist/authSession/issuer.cjs.js +0 -2
  81. package/dist/authSession/issuer.cjs.js.map +0 -1
  82. package/dist/authSession/issuer.esm.js +0 -18
  83. package/dist/authSession/issuer.esm.js.map +0 -1
  84. package/dist/authSession/session.cjs.js +0 -2
  85. package/dist/authSession/session.cjs.js.map +0 -1
  86. package/dist/authSession/session.esm.js +0 -102
  87. package/dist/authSession/session.esm.js.map +0 -1
  88. package/dist/authn/SolidAuthnLogic.cjs.js +0 -2
  89. package/dist/authn/SolidAuthnLogic.cjs.js.map +0 -1
  90. package/dist/authn/SolidAuthnLogic.esm.js +0 -116
  91. package/dist/authn/SolidAuthnLogic.esm.js.map +0 -1
  92. package/dist/authn/authUtil.cjs.js +0 -2
  93. package/dist/authn/authUtil.cjs.js.map +0 -1
  94. package/dist/authn/authUtil.esm.js +0 -33
  95. package/dist/authn/authUtil.esm.js.map +0 -1
  96. package/dist/authn/serverLogout.cjs.js +0 -2
  97. package/dist/authn/serverLogout.cjs.js.map +0 -1
  98. package/dist/authn/serverLogout.esm.js +0 -25
  99. package/dist/authn/serverLogout.esm.js.map +0 -1
  100. package/dist/chat/chatLogic.cjs.js +0 -21
  101. package/dist/chat/chatLogic.cjs.js.map +0 -1
  102. package/dist/chat/chatLogic.esm.js +0 -116
  103. package/dist/chat/chatLogic.esm.js.map +0 -1
  104. package/dist/inbox/inboxLogic.cjs.js +0 -2
  105. package/dist/inbox/inboxLogic.cjs.js.map +0 -1
  106. package/dist/inbox/inboxLogic.esm.js +0 -37
  107. package/dist/inbox/inboxLogic.esm.js.map +0 -1
  108. package/dist/index.cjs.js +0 -2
  109. package/dist/index.cjs.js.map +0 -1
  110. package/dist/index.esm.js +0 -13
  111. package/dist/index.esm.js.map +0 -1
  112. package/dist/issuer/issuerLogic.cjs.js +0 -2
  113. package/dist/issuer/issuerLogic.cjs.js.map +0 -1
  114. package/dist/issuer/issuerLogic.esm.js +0 -30
  115. package/dist/issuer/issuerLogic.esm.js.map +0 -1
  116. package/dist/logic/CustomError.cjs.js +0 -2
  117. package/dist/logic/CustomError.cjs.js.map +0 -1
  118. package/dist/logic/CustomError.esm.js +0 -14
  119. package/dist/logic/CustomError.esm.js.map +0 -1
  120. package/dist/logic/solidLogic.cjs.js +0 -2
  121. package/dist/logic/solidLogic.cjs.js.map +0 -1
  122. package/dist/logic/solidLogic.esm.js +0 -47
  123. package/dist/logic/solidLogic.esm.js.map +0 -1
  124. package/dist/logic/solidLogicSingleton.cjs.js +0 -2
  125. package/dist/logic/solidLogicSingleton.cjs.js.map +0 -1
  126. package/dist/logic/solidLogicSingleton.esm.js +0 -19
  127. package/dist/logic/solidLogicSingleton.esm.js.map +0 -1
  128. package/dist/profile/profileAclDocuments.cjs.js +0 -3
  129. package/dist/profile/profileAclDocuments.cjs.js.map +0 -1
  130. package/dist/profile/profileAclDocuments.esm.js +0 -17
  131. package/dist/profile/profileAclDocuments.esm.js.map +0 -1
  132. package/dist/profile/profileDocuments.cjs.js +0 -3
  133. package/dist/profile/profileDocuments.cjs.js.map +0 -1
  134. package/dist/profile/profileDocuments.esm.js +0 -15
  135. package/dist/profile/profileDocuments.esm.js.map +0 -1
  136. package/dist/profile/profileLogic.cjs.js +0 -2
  137. package/dist/profile/profileLogic.cjs.js.map +0 -1
  138. package/dist/profile/profileLogic.esm.js +0 -184
  139. package/dist/profile/profileLogic.esm.js.map +0 -1
  140. package/dist/typeIndex/typeIndexAclDocuments.cjs.js +0 -3
  141. package/dist/typeIndex/typeIndexAclDocuments.cjs.js.map +0 -1
  142. package/dist/typeIndex/typeIndexAclDocuments.esm.js +0 -35
  143. package/dist/typeIndex/typeIndexAclDocuments.esm.js.map +0 -1
  144. package/dist/typeIndex/typeIndexDocuments.cjs.js +0 -4
  145. package/dist/typeIndex/typeIndexDocuments.cjs.js.map +0 -1
  146. package/dist/typeIndex/typeIndexDocuments.esm.js +0 -21
  147. package/dist/typeIndex/typeIndexDocuments.esm.js.map +0 -1
  148. package/dist/typeIndex/typeIndexLogic.cjs.js +0 -2
  149. package/dist/typeIndex/typeIndexLogic.cjs.js.map +0 -1
  150. package/dist/typeIndex/typeIndexLogic.esm.js +0 -185
  151. package/dist/typeIndex/typeIndexLogic.esm.js.map +0 -1
  152. package/dist/util/containerLogic.cjs.js +0 -2
  153. package/dist/util/containerLogic.cjs.js.map +0 -1
  154. package/dist/util/containerLogic.esm.js +0 -37
  155. package/dist/util/containerLogic.esm.js.map +0 -1
  156. package/dist/util/debug.cjs.js +0 -2
  157. package/dist/util/debug.cjs.js.map +0 -1
  158. package/dist/util/debug.esm.js +0 -11
  159. package/dist/util/debug.esm.js.map +0 -1
  160. package/dist/util/ns.cjs.js +0 -2
  161. package/dist/util/ns.cjs.js.map +0 -1
  162. package/dist/util/ns.esm.js +0 -8
  163. package/dist/util/ns.esm.js.map +0 -1
  164. package/dist/util/utilityLogic.cjs.js +0 -6
  165. package/dist/util/utilityLogic.cjs.js.map +0 -1
  166. package/dist/util/utilityLogic.esm.js +0 -149
  167. package/dist/util/utilityLogic.esm.js.map +0 -1
  168. package/dist/util/utils.cjs.js +0 -2
  169. package/dist/util/utils.cjs.js.map +0 -1
  170. package/dist/util/utils.esm.js +0 -22
  171. package/dist/util/utils.esm.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solid-logic.min.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,EAAAG,QAAA,SACA,mBAAAC,QAAAA,OAAAC,IACAD,OAAA,sBAAAJ,GACA,iBAAAC,QACAA,QAAA,WAAAD,EA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EAAaz3B,WAAY,CAAEgjB,YAAa,YAE5E,GAA+B,MAA3B0U,EAAgBzqB,OAAgB,CAClC,MAAM0qB,QAA4BD,EAAgBxqB,OAC9CyqB,GAAuBA,EAAoBC,4BACvCjrB,MAAMgrB,EAAoBC,qBAAsB,CAAE5U,YAAa,WAEzE,CACF,CACF,CAAE,MAAOE,GAET,CAGA,IACE,MAAM2U,QAAuBlrB,MAAM,4BAA6B,CAAEqW,YAAa,YAC/E,GAAI6U,EAAe3nB,IAAM2nB,EAAeC,WAEtC,OADAhgC,OAAOe,SAAS0rB,OAAOiT,IAChB,CAEX,CAAE,MAAOtU,GAET,CAEA,OAAO,CACT,CC1CA,MAAM6U,GAAkB,CACtB,CACEr7B,KAAM,kBACN2pB,IAAK,8BAEP,CACE3pB,KAAM,YACN2pB,IAAK,wBAEP,CACE3pB,KAAM,eACN2pB,IAAK,uBAEP,CACE3pB,KAAM,aACN2pB,IAAK,6BAOF,SAAS2R,KAEZ,MAAMC,EAAU,IAAIF,KAGdxV,KAAEA,EAAI1S,OAAEA,GAAW,IAAIrC,IAAI3U,SAASC,MAM1C,OALcm/B,EAAQ5W,IAAI,EAAGgF,SAAU,IAAI7Y,IAAI6Y,GAAK9D,MACzC9jB,SAAS8jB,IAClB0V,EAAQC,QAAQ,CAAEx7B,KAAM6lB,EAAM8D,IAAKxW,IAG9BooB,CACT,CC9BF,MAAMhI,GAAQqH,GAAoBrH,MAC5BkI,GAAcb,GAAoBrH,MAAM3L,YACxC5C,GAAQ4V,GAAoB5V","sources":["webpack://SolidLogic/webpack/universalModuleDefinition","webpack://SolidLogic/./node_modules/solid-namespace/index.js","webpack://SolidLogic/external umd \"$rdf\"","webpack://SolidLogic/webpack/bootstrap","webpack://SolidLogic/webpack/runtime/compat get default export","webpack://SolidLogic/webpack/runtime/define property getters","webpack://SolidLogic/webpack/runtime/global","webpack://SolidLogic/webpack/runtime/hasOwnProperty shorthand","webpack://SolidLogic/webpack/runtime/make namespace object","webpack://SolidLogic/webpack/runtime/publicPath","webpack://SolidLogic/webpack/runtime/jsonp chunk loading","webpack://SolidLogic/./src/util/debug.ts","webpack://SolidLogic/./node_modules/@uvdsl/solid-oidc-client-browser/dist/esm/web/index.js","webpack://SolidLogic/./node_modules/@uvdsl/solid-oidc-client-browser/dist/esm/core/index.js","webpack://SolidLogic/./src/authSession/session.ts","webpack://SolidLogic/./src/authSession/issuer.ts","webpack://SolidLogic/./src/authSession/authSession.ts","webpack://SolidLogic/./src/authSession/events.ts","webpack://SolidLogic/./src/util/ns.ts","webpack://SolidLogic/./src/acl/aclLogic.ts","webpack://SolidLogic/./src/authn/authUtil.ts","webpack://SolidLogic/./src/authn/SolidAuthnLogic.ts","webpack://SolidLogic/./src/util/utils.ts","webpack://SolidLogic/./src/chat/chatLogic.ts","webpack://SolidLogic/./src/inbox/inboxLogic.ts","webpack://SolidLogic/./src/logic/CustomError.ts","webpack://SolidLogic/./src/typeIndex/typeIndexDocuments.ts","webpack://SolidLogic/./src/typeIndex/typeIndexAclDocuments.ts","webpack://SolidLogic/./src/util/containerLogic.ts","webpack://SolidLogic/./src/profile/profileLogic.ts","webpack://SolidLogic/./src/profile/profileAclDocuments.ts","webpack://SolidLogic/./src/profile/profileDocuments.ts","webpack://SolidLogic/./src/typeIndex/typeIndexLogic.ts","webpack://SolidLogic/./src/logic/solidLogic.ts","webpack://SolidLogic/./src/util/utilityLogic.ts","webpack://SolidLogic/./src/logic/solidLogicSingleton.ts","webpack://SolidLogic/./src/authn/serverLogout.ts","webpack://SolidLogic/./src/issuer/issuerLogic.ts","webpack://SolidLogic/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"$rdf\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"SolidLogic\", [\"$rdf\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SolidLogic\"] = factory(require(\"$rdf\"));\n\telse\n\t\troot[\"SolidLogic\"] = factory(root[\"$rdf\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE__264__) => {\nreturn ","/**\n * Provides a way to access commonly used namespaces\n *\n * Usage:\n *\n * ```\n * const $rdf = require('rdflib'); //or any other RDF/JS-compatible library\n * const ns = require('solid-namespace')($rdf);\n * const store = $rdf.graph();\n *\n * let me = ...;\n * let name = store.any(me, ns.vcard(‘fn’)) || store.any(me, ns.foaf(‘name’));\n * ```\n * @module vocab\n */\nconst aliases = {\n acl: 'http://www.w3.org/ns/auth/acl#',\n arg: 'http://www.w3.org/ns/pim/arg#',\n as: 'https://www.w3.org/ns/activitystreams#',\n bookmark: 'http://www.w3.org/2002/01/bookmark#',\n cal: 'http://www.w3.org/2002/12/cal/ical#',\n cco: 'http://www.ontologyrepository.com/CommonCoreOntologies/',\n cert: 'http://www.w3.org/ns/auth/cert#',\n contact: 'http://www.w3.org/2000/10/swap/pim/contact#',\n dc: 'http://purl.org/dc/elements/1.1/',\n dct: 'http://purl.org/dc/terms/',\n doap: 'http://usefulinc.com/ns/doap#',\n foaf: 'http://xmlns.com/foaf/0.1/',\n geo: 'http://www.w3.org/2003/01/geo/wgs84_pos#',\n gpx: 'http://www.w3.org/ns/pim/gpx#',\n gr: 'http://purl.org/goodrelations/v1#',\n http: 'http://www.w3.org/2007/ont/http#',\n httph: 'http://www.w3.org/2007/ont/httph#',\n icalTZ: 'http://www.w3.org/2002/12/cal/icaltzd#', // Beware: not cal:\n ldp: 'http://www.w3.org/ns/ldp#',\n link: 'http://www.w3.org/2007/ont/link#',\n log: 'http://www.w3.org/2000/10/swap/log#',\n meeting: 'http://www.w3.org/ns/pim/meeting#',\n mo: 'http://purl.org/ontology/mo/',\n org: 'http://www.w3.org/ns/org#',\n owl: 'http://www.w3.org/2002/07/owl#',\n pad: 'http://www.w3.org/ns/pim/pad#',\n patch: 'http://www.w3.org/ns/pim/patch#',\n prov: 'http://www.w3.org/ns/prov#',\n pto: 'http://www.productontology.org/id/',\n qu: 'http://www.w3.org/2000/10/swap/pim/qif#',\n trip: 'http://www.w3.org/ns/pim/trip#',\n rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n rdfs: 'http://www.w3.org/2000/01/rdf-schema#',\n rss: 'http://purl.org/rss/1.0/',\n sched: 'http://www.w3.org/ns/pim/schedule#',\n schema: 'http://schema.org/', // @@ beware confusion with documents no 303\n sioc: 'http://rdfs.org/sioc/ns#',\n skos: 'http://www.w3.org/2004/02/skos/core#',\n solid: 'http://www.w3.org/ns/solid/terms#',\n space: 'http://www.w3.org/ns/pim/space#',\n stat: 'http://www.w3.org/ns/posix/stat#',\n tab: 'http://www.w3.org/2007/ont/link#',\n tabont: 'http://www.w3.org/2007/ont/link#',\n ui: 'http://www.w3.org/ns/ui#',\n vann: 'http://purl.org/vocab/vann/',\n vcard: 'http://www.w3.org/2006/vcard/ns#',\n wf: 'http://www.w3.org/2005/01/wf/flow#',\n xsd: 'http://www.w3.org/2001/XMLSchema#',\n}\n\n/**\n * @param [rdflib] {RDF} Optional RDF Library (such as rdflib.js or rdf-ext) to inject\n */\nfunction vocab (rdf = { namedNode: u => u }) {\n const namespaces = {}\n for (const alias in aliases) {\n const expansion = aliases[alias]\n namespaces[alias] = function (localName = '') {\n return rdf.namedNode(expansion + localName)\n }\n };\n\n return namespaces\n};\n\nmodule.exports = vocab\n","module.exports = __WEBPACK_EXTERNAL_MODULE__264__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.p = \"\";","__webpack_require__.b = (typeof document !== 'undefined' && document.baseURI) || self.location.href;\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t792: 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n// no on chunks loaded\n\n// no jsonp function","\nexport function log(...args: any[]): void {\n console.log(...args)\n}\n\nexport function warn(...args: any[]): void {\n console.warn(...args)\n}\n\nexport function error(...args: any[]): void {\n console.error(...args)\n}\n\nexport function trace(...args: any[]): void {\n console.trace(...args)\n}\n","var crypto$1 = crypto;\nconst isCryptoKey = (key) => key instanceof CryptoKey;\n\nconst digest = async (algorithm, data) => {\n const subtleDigest = `SHA-${algorithm.slice(-3)}`;\n return new Uint8Array(await crypto$1.subtle.digest(subtleDigest, data));\n};\nvar digest$1 = digest;\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\nfunction concat(...buffers) {\n const size = buffers.reduce((acc, { length }) => acc + length, 0);\n const buf = new Uint8Array(size);\n let i = 0;\n for (const buffer of buffers) {\n buf.set(buffer, i);\n i += buffer.length;\n }\n return buf;\n}\n\nconst encodeBase64 = (input) => {\n let unencoded = input;\n if (typeof unencoded === 'string') {\n unencoded = encoder.encode(unencoded);\n }\n const CHUNK_SIZE = 0x8000;\n const arr = [];\n for (let i = 0; i < unencoded.length; i += CHUNK_SIZE) {\n arr.push(String.fromCharCode.apply(null, unencoded.subarray(i, i + CHUNK_SIZE)));\n }\n return btoa(arr.join(''));\n};\nconst encode = (input) => {\n return encodeBase64(input).replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n};\nconst decodeBase64 = (encoded) => {\n const binary = atob(encoded);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return bytes;\n};\nconst decode$1 = (input) => {\n let encoded = input;\n if (encoded instanceof Uint8Array) {\n encoded = decoder.decode(encoded);\n }\n encoded = encoded.replace(/-/g, '+').replace(/_/g, '/').replace(/\\s/g, '');\n try {\n return decodeBase64(encoded);\n }\n catch {\n throw new TypeError('The input to be decoded is not correctly encoded.');\n }\n};\n\nclass JOSEError extends Error {\n constructor(message, options) {\n super(message, options);\n this.code = 'ERR_JOSE_GENERIC';\n this.name = this.constructor.name;\n Error.captureStackTrace?.(this, this.constructor);\n }\n}\nJOSEError.code = 'ERR_JOSE_GENERIC';\nclass JWTClaimValidationFailed extends JOSEError {\n constructor(message, payload, claim = 'unspecified', reason = 'unspecified') {\n super(message, { cause: { claim, reason, payload } });\n this.code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';\n this.claim = claim;\n this.reason = reason;\n this.payload = payload;\n }\n}\nJWTClaimValidationFailed.code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';\nclass JWTExpired extends JOSEError {\n constructor(message, payload, claim = 'unspecified', reason = 'unspecified') {\n super(message, { cause: { claim, reason, payload } });\n this.code = 'ERR_JWT_EXPIRED';\n this.claim = claim;\n this.reason = reason;\n this.payload = payload;\n }\n}\nJWTExpired.code = 'ERR_JWT_EXPIRED';\nclass JOSEAlgNotAllowed extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JOSE_ALG_NOT_ALLOWED';\n }\n}\nJOSEAlgNotAllowed.code = 'ERR_JOSE_ALG_NOT_ALLOWED';\nclass JOSENotSupported extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JOSE_NOT_SUPPORTED';\n }\n}\nJOSENotSupported.code = 'ERR_JOSE_NOT_SUPPORTED';\nclass JWEDecryptionFailed extends JOSEError {\n constructor(message = 'decryption operation failed', options) {\n super(message, options);\n this.code = 'ERR_JWE_DECRYPTION_FAILED';\n }\n}\nJWEDecryptionFailed.code = 'ERR_JWE_DECRYPTION_FAILED';\nclass JWEInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWE_INVALID';\n }\n}\nJWEInvalid.code = 'ERR_JWE_INVALID';\nclass JWSInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWS_INVALID';\n }\n}\nJWSInvalid.code = 'ERR_JWS_INVALID';\nclass JWTInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWT_INVALID';\n }\n}\nJWTInvalid.code = 'ERR_JWT_INVALID';\nclass JWKInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWK_INVALID';\n }\n}\nJWKInvalid.code = 'ERR_JWK_INVALID';\nclass JWKSInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWKS_INVALID';\n }\n}\nJWKSInvalid.code = 'ERR_JWKS_INVALID';\nclass JWKSNoMatchingKey extends JOSEError {\n constructor(message = 'no applicable key found in the JSON Web Key Set', options) {\n super(message, options);\n this.code = 'ERR_JWKS_NO_MATCHING_KEY';\n }\n}\nJWKSNoMatchingKey.code = 'ERR_JWKS_NO_MATCHING_KEY';\nclass JWKSMultipleMatchingKeys extends JOSEError {\n constructor(message = 'multiple matching keys found in the JSON Web Key Set', options) {\n super(message, options);\n this.code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';\n }\n}\nJWKSMultipleMatchingKeys.code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';\nclass JWKSTimeout extends JOSEError {\n constructor(message = 'request timed out', options) {\n super(message, options);\n this.code = 'ERR_JWKS_TIMEOUT';\n }\n}\nJWKSTimeout.code = 'ERR_JWKS_TIMEOUT';\nclass JWSSignatureVerificationFailed extends JOSEError {\n constructor(message = 'signature verification failed', options) {\n super(message, options);\n this.code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';\n }\n}\nJWSSignatureVerificationFailed.code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';\n\nfunction unusable(name, prop = 'algorithm.name') {\n return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);\n}\nfunction isAlgorithm(algorithm, name) {\n return algorithm.name === name;\n}\nfunction getHashLength(hash) {\n return parseInt(hash.name.slice(4), 10);\n}\nfunction getNamedCurve(alg) {\n switch (alg) {\n case 'ES256':\n return 'P-256';\n case 'ES384':\n return 'P-384';\n case 'ES512':\n return 'P-521';\n default:\n throw new Error('unreachable');\n }\n}\nfunction checkUsage(key, usages) {\n if (usages.length && !usages.some((expected) => key.usages.includes(expected))) {\n let msg = 'CryptoKey does not support this operation, its usages must include ';\n if (usages.length > 2) {\n const last = usages.pop();\n msg += `one of ${usages.join(', ')}, or ${last}.`;\n }\n else if (usages.length === 2) {\n msg += `one of ${usages[0]} or ${usages[1]}.`;\n }\n else {\n msg += `${usages[0]}.`;\n }\n throw new TypeError(msg);\n }\n}\nfunction checkSigCryptoKey(key, alg, ...usages) {\n switch (alg) {\n case 'HS256':\n case 'HS384':\n case 'HS512': {\n if (!isAlgorithm(key.algorithm, 'HMAC'))\n throw unusable('HMAC');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'RS256':\n case 'RS384':\n case 'RS512': {\n if (!isAlgorithm(key.algorithm, 'RSASSA-PKCS1-v1_5'))\n throw unusable('RSASSA-PKCS1-v1_5');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'PS256':\n case 'PS384':\n case 'PS512': {\n if (!isAlgorithm(key.algorithm, 'RSA-PSS'))\n throw unusable('RSA-PSS');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'EdDSA': {\n if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') {\n throw unusable('Ed25519 or Ed448');\n }\n break;\n }\n case 'Ed25519': {\n if (!isAlgorithm(key.algorithm, 'Ed25519'))\n throw unusable('Ed25519');\n break;\n }\n case 'ES256':\n case 'ES384':\n case 'ES512': {\n if (!isAlgorithm(key.algorithm, 'ECDSA'))\n throw unusable('ECDSA');\n const expected = getNamedCurve(alg);\n const actual = key.algorithm.namedCurve;\n if (actual !== expected)\n throw unusable(expected, 'algorithm.namedCurve');\n break;\n }\n default:\n throw new TypeError('CryptoKey does not support this operation');\n }\n checkUsage(key, usages);\n}\n\nfunction message(msg, actual, ...types) {\n types = types.filter(Boolean);\n if (types.length > 2) {\n const last = types.pop();\n msg += `one of type ${types.join(', ')}, or ${last}.`;\n }\n else if (types.length === 2) {\n msg += `one of type ${types[0]} or ${types[1]}.`;\n }\n else {\n msg += `of type ${types[0]}.`;\n }\n if (actual == null) {\n msg += ` Received ${actual}`;\n }\n else if (typeof actual === 'function' && actual.name) {\n msg += ` Received function ${actual.name}`;\n }\n else if (typeof actual === 'object' && actual != null) {\n if (actual.constructor?.name) {\n msg += ` Received an instance of ${actual.constructor.name}`;\n }\n }\n return msg;\n}\nvar invalidKeyInput = (actual, ...types) => {\n return message('Key must be ', actual, ...types);\n};\nfunction withAlg(alg, actual, ...types) {\n return message(`Key for the ${alg} algorithm must be `, actual, ...types);\n}\n\nvar isKeyLike = (key) => {\n if (isCryptoKey(key)) {\n return true;\n }\n return key?.[Symbol.toStringTag] === 'KeyObject';\n};\nconst types = ['CryptoKey'];\n\nconst isDisjoint = (...headers) => {\n const sources = headers.filter(Boolean);\n if (sources.length === 0 || sources.length === 1) {\n return true;\n }\n let acc;\n for (const header of sources) {\n const parameters = Object.keys(header);\n if (!acc || acc.size === 0) {\n acc = new Set(parameters);\n continue;\n }\n for (const parameter of parameters) {\n if (acc.has(parameter)) {\n return false;\n }\n acc.add(parameter);\n }\n }\n return true;\n};\nvar isDisjoint$1 = isDisjoint;\n\nfunction isObjectLike(value) {\n return typeof value === 'object' && value !== null;\n}\nfunction isObject(input) {\n if (!isObjectLike(input) || Object.prototype.toString.call(input) !== '[object Object]') {\n return false;\n }\n if (Object.getPrototypeOf(input) === null) {\n return true;\n }\n let proto = input;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(input) === proto;\n}\n\nvar checkKeyLength = (alg, key) => {\n if (alg.startsWith('RS') || alg.startsWith('PS')) {\n const { modulusLength } = key.algorithm;\n if (typeof modulusLength !== 'number' || modulusLength < 2048) {\n throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);\n }\n }\n};\n\nfunction isJWK(key) {\n return isObject(key) && typeof key.kty === 'string';\n}\nfunction isPrivateJWK(key) {\n return key.kty !== 'oct' && typeof key.d === 'string';\n}\nfunction isPublicJWK(key) {\n return key.kty !== 'oct' && typeof key.d === 'undefined';\n}\nfunction isSecretJWK(key) {\n return isJWK(key) && key.kty === 'oct' && typeof key.k === 'string';\n}\n\nfunction subtleMapping(jwk) {\n let algorithm;\n let keyUsages;\n switch (jwk.kty) {\n case 'RSA': {\n switch (jwk.alg) {\n case 'PS256':\n case 'PS384':\n case 'PS512':\n algorithm = { name: 'RSA-PSS', hash: `SHA-${jwk.alg.slice(-3)}` };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'RS256':\n case 'RS384':\n case 'RS512':\n algorithm = { name: 'RSASSA-PKCS1-v1_5', hash: `SHA-${jwk.alg.slice(-3)}` };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'RSA-OAEP':\n case 'RSA-OAEP-256':\n case 'RSA-OAEP-384':\n case 'RSA-OAEP-512':\n algorithm = {\n name: 'RSA-OAEP',\n hash: `SHA-${parseInt(jwk.alg.slice(-3), 10) || 1}`,\n };\n keyUsages = jwk.d ? ['decrypt', 'unwrapKey'] : ['encrypt', 'wrapKey'];\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n break;\n }\n case 'EC': {\n switch (jwk.alg) {\n case 'ES256':\n algorithm = { name: 'ECDSA', namedCurve: 'P-256' };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'ES384':\n algorithm = { name: 'ECDSA', namedCurve: 'P-384' };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'ES512':\n algorithm = { name: 'ECDSA', namedCurve: 'P-521' };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'ECDH-ES':\n case 'ECDH-ES+A128KW':\n case 'ECDH-ES+A192KW':\n case 'ECDH-ES+A256KW':\n algorithm = { name: 'ECDH', namedCurve: jwk.crv };\n keyUsages = jwk.d ? ['deriveBits'] : [];\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n break;\n }\n case 'OKP': {\n switch (jwk.alg) {\n case 'Ed25519':\n algorithm = { name: 'Ed25519' };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'EdDSA':\n algorithm = { name: jwk.crv };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'ECDH-ES':\n case 'ECDH-ES+A128KW':\n case 'ECDH-ES+A192KW':\n case 'ECDH-ES+A256KW':\n algorithm = { name: jwk.crv };\n keyUsages = jwk.d ? ['deriveBits'] : [];\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n break;\n }\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"kty\" (Key Type) Parameter value');\n }\n return { algorithm, keyUsages };\n}\nconst parse = async (jwk) => {\n if (!jwk.alg) {\n throw new TypeError('\"alg\" argument is required when \"jwk.alg\" is not present');\n }\n const { algorithm, keyUsages } = subtleMapping(jwk);\n const rest = [\n algorithm,\n jwk.ext ?? false,\n jwk.key_ops ?? keyUsages,\n ];\n const keyData = { ...jwk };\n delete keyData.alg;\n delete keyData.use;\n return crypto$1.subtle.importKey('jwk', keyData, ...rest);\n};\nvar asKeyObject = parse;\n\nconst exportKeyValue = (k) => decode$1(k);\nlet privCache;\nlet pubCache;\nconst isKeyObject = (key) => {\n return key?.[Symbol.toStringTag] === 'KeyObject';\n};\nconst importAndCache = async (cache, key, jwk, alg, freeze = false) => {\n let cached = cache.get(key);\n if (cached?.[alg]) {\n return cached[alg];\n }\n const cryptoKey = await asKeyObject({ ...jwk, alg });\n if (freeze)\n Object.freeze(key);\n if (!cached) {\n cache.set(key, { [alg]: cryptoKey });\n }\n else {\n cached[alg] = cryptoKey;\n }\n return cryptoKey;\n};\nconst normalizePublicKey = (key, alg) => {\n if (isKeyObject(key)) {\n let jwk = key.export({ format: 'jwk' });\n delete jwk.d;\n delete jwk.dp;\n delete jwk.dq;\n delete jwk.p;\n delete jwk.q;\n delete jwk.qi;\n if (jwk.k) {\n return exportKeyValue(jwk.k);\n }\n pubCache || (pubCache = new WeakMap());\n return importAndCache(pubCache, key, jwk, alg);\n }\n if (isJWK(key)) {\n if (key.k)\n return decode$1(key.k);\n pubCache || (pubCache = new WeakMap());\n const cryptoKey = importAndCache(pubCache, key, key, alg, true);\n return cryptoKey;\n }\n return key;\n};\nconst normalizePrivateKey = (key, alg) => {\n if (isKeyObject(key)) {\n let jwk = key.export({ format: 'jwk' });\n if (jwk.k) {\n return exportKeyValue(jwk.k);\n }\n privCache || (privCache = new WeakMap());\n return importAndCache(privCache, key, jwk, alg);\n }\n if (isJWK(key)) {\n if (key.k)\n return decode$1(key.k);\n privCache || (privCache = new WeakMap());\n const cryptoKey = importAndCache(privCache, key, key, alg, true);\n return cryptoKey;\n }\n return key;\n};\nvar normalize = { normalizePublicKey, normalizePrivateKey };\n\nasync function importJWK(jwk, alg) {\n if (!isObject(jwk)) {\n throw new TypeError('JWK must be an object');\n }\n alg || (alg = jwk.alg);\n switch (jwk.kty) {\n case 'oct':\n if (typeof jwk.k !== 'string' || !jwk.k) {\n throw new TypeError('missing \"k\" (Key Value) Parameter value');\n }\n return decode$1(jwk.k);\n case 'RSA':\n if ('oth' in jwk && jwk.oth !== undefined) {\n throw new JOSENotSupported('RSA JWK \"oth\" (Other Primes Info) Parameter value is not supported');\n }\n case 'EC':\n case 'OKP':\n return asKeyObject({ ...jwk, alg });\n default:\n throw new JOSENotSupported('Unsupported \"kty\" (Key Type) Parameter value');\n }\n}\n\nconst tag = (key) => key?.[Symbol.toStringTag];\nconst jwkMatchesOp = (alg, key, usage) => {\n if (key.use !== undefined && key.use !== 'sig') {\n throw new TypeError('Invalid key for this operation, when present its use must be sig');\n }\n if (key.key_ops !== undefined && key.key_ops.includes?.(usage) !== true) {\n throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage}`);\n }\n if (key.alg !== undefined && key.alg !== alg) {\n throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);\n }\n return true;\n};\nconst symmetricTypeCheck = (alg, key, usage, allowJwk) => {\n if (key instanceof Uint8Array)\n return;\n if (allowJwk && isJWK(key)) {\n if (isSecretJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK \"kty\" (Key Type) equal to \"oct\" and the JWK \"k\" (Key Value) present`);\n }\n if (!isKeyLike(key)) {\n throw new TypeError(withAlg(alg, key, ...types, 'Uint8Array', allowJwk ? 'JSON Web Key' : null));\n }\n if (key.type !== 'secret') {\n throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type \"secret\"`);\n }\n};\nconst asymmetricTypeCheck = (alg, key, usage, allowJwk) => {\n if (allowJwk && isJWK(key)) {\n switch (usage) {\n case 'sign':\n if (isPrivateJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for this operation be a private JWK`);\n case 'verify':\n if (isPublicJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for this operation be a public JWK`);\n }\n }\n if (!isKeyLike(key)) {\n throw new TypeError(withAlg(alg, key, ...types, allowJwk ? 'JSON Web Key' : null));\n }\n if (key.type === 'secret') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type \"secret\"`);\n }\n if (usage === 'sign' && key.type === 'public') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type \"private\"`);\n }\n if (usage === 'decrypt' && key.type === 'public') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type \"private\"`);\n }\n if (key.algorithm && usage === 'verify' && key.type === 'private') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type \"public\"`);\n }\n if (key.algorithm && usage === 'encrypt' && key.type === 'private') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type \"public\"`);\n }\n};\nfunction checkKeyType(allowJwk, alg, key, usage) {\n const symmetric = alg.startsWith('HS') ||\n alg === 'dir' ||\n alg.startsWith('PBES2') ||\n /^A\\d{3}(?:GCM)?KW$/.test(alg);\n if (symmetric) {\n symmetricTypeCheck(alg, key, usage, allowJwk);\n }\n else {\n asymmetricTypeCheck(alg, key, usage, allowJwk);\n }\n}\ncheckKeyType.bind(undefined, false);\nconst checkKeyTypeWithJwk = checkKeyType.bind(undefined, true);\n\nfunction validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {\n if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) {\n throw new Err('\"crit\" (Critical) Header Parameter MUST be integrity protected');\n }\n if (!protectedHeader || protectedHeader.crit === undefined) {\n return new Set();\n }\n if (!Array.isArray(protectedHeader.crit) ||\n protectedHeader.crit.length === 0 ||\n protectedHeader.crit.some((input) => typeof input !== 'string' || input.length === 0)) {\n throw new Err('\"crit\" (Critical) Header Parameter MUST be an array of non-empty strings when present');\n }\n let recognized;\n if (recognizedOption !== undefined) {\n recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);\n }\n else {\n recognized = recognizedDefault;\n }\n for (const parameter of protectedHeader.crit) {\n if (!recognized.has(parameter)) {\n throw new JOSENotSupported(`Extension Header Parameter \"${parameter}\" is not recognized`);\n }\n if (joseHeader[parameter] === undefined) {\n throw new Err(`Extension Header Parameter \"${parameter}\" is missing`);\n }\n if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {\n throw new Err(`Extension Header Parameter \"${parameter}\" MUST be integrity protected`);\n }\n }\n return new Set(protectedHeader.crit);\n}\n\nconst validateAlgorithms = (option, algorithms) => {\n if (algorithms !== undefined &&\n (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== 'string'))) {\n throw new TypeError(`\"${option}\" option must be an array of strings`);\n }\n if (!algorithms) {\n return undefined;\n }\n return new Set(algorithms);\n};\nvar validateAlgorithms$1 = validateAlgorithms;\n\nconst keyToJWK = async (key) => {\n if (key instanceof Uint8Array) {\n return {\n kty: 'oct',\n k: encode(key),\n };\n }\n if (!isCryptoKey(key)) {\n throw new TypeError(invalidKeyInput(key, ...types, 'Uint8Array'));\n }\n if (!key.extractable) {\n throw new TypeError('non-extractable CryptoKey cannot be exported as a JWK');\n }\n const { ext, key_ops, alg, use, ...jwk } = await crypto$1.subtle.exportKey('jwk', key);\n return jwk;\n};\nvar keyToJWK$1 = keyToJWK;\n\nasync function exportJWK(key) {\n return keyToJWK$1(key);\n}\n\nfunction subtleDsa(alg, algorithm) {\n const hash = `SHA-${alg.slice(-3)}`;\n switch (alg) {\n case 'HS256':\n case 'HS384':\n case 'HS512':\n return { hash, name: 'HMAC' };\n case 'PS256':\n case 'PS384':\n case 'PS512':\n return { hash, name: 'RSA-PSS', saltLength: alg.slice(-3) >> 3 };\n case 'RS256':\n case 'RS384':\n case 'RS512':\n return { hash, name: 'RSASSA-PKCS1-v1_5' };\n case 'ES256':\n case 'ES384':\n case 'ES512':\n return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve };\n case 'Ed25519':\n return { name: 'Ed25519' };\n case 'EdDSA':\n return { name: algorithm.name };\n default:\n throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);\n }\n}\n\nasync function getCryptoKey(alg, key, usage) {\n if (usage === 'sign') {\n key = await normalize.normalizePrivateKey(key, alg);\n }\n if (usage === 'verify') {\n key = await normalize.normalizePublicKey(key, alg);\n }\n if (isCryptoKey(key)) {\n checkSigCryptoKey(key, alg, usage);\n return key;\n }\n if (key instanceof Uint8Array) {\n if (!alg.startsWith('HS')) {\n throw new TypeError(invalidKeyInput(key, ...types));\n }\n return crypto$1.subtle.importKey('raw', key, { hash: `SHA-${alg.slice(-3)}`, name: 'HMAC' }, false, [usage]);\n }\n throw new TypeError(invalidKeyInput(key, ...types, 'Uint8Array', 'JSON Web Key'));\n}\n\nconst verify = async (alg, key, signature, data) => {\n const cryptoKey = await getCryptoKey(alg, key, 'verify');\n checkKeyLength(alg, cryptoKey);\n const algorithm = subtleDsa(alg, cryptoKey.algorithm);\n try {\n return await crypto$1.subtle.verify(algorithm, cryptoKey, signature, data);\n }\n catch {\n return false;\n }\n};\nvar verify$1 = verify;\n\nasync function flattenedVerify(jws, key, options) {\n if (!isObject(jws)) {\n throw new JWSInvalid('Flattened JWS must be an object');\n }\n if (jws.protected === undefined && jws.header === undefined) {\n throw new JWSInvalid('Flattened JWS must have either of the \"protected\" or \"header\" members');\n }\n if (jws.protected !== undefined && typeof jws.protected !== 'string') {\n throw new JWSInvalid('JWS Protected Header incorrect type');\n }\n if (jws.payload === undefined) {\n throw new JWSInvalid('JWS Payload missing');\n }\n if (typeof jws.signature !== 'string') {\n throw new JWSInvalid('JWS Signature missing or incorrect type');\n }\n if (jws.header !== undefined && !isObject(jws.header)) {\n throw new JWSInvalid('JWS Unprotected Header incorrect type');\n }\n let parsedProt = {};\n if (jws.protected) {\n try {\n const protectedHeader = decode$1(jws.protected);\n parsedProt = JSON.parse(decoder.decode(protectedHeader));\n }\n catch {\n throw new JWSInvalid('JWS Protected Header is invalid');\n }\n }\n if (!isDisjoint$1(parsedProt, jws.header)) {\n throw new JWSInvalid('JWS Protected and JWS Unprotected Header Parameter names must be disjoint');\n }\n const joseHeader = {\n ...parsedProt,\n ...jws.header,\n };\n const extensions = validateCrit(JWSInvalid, new Map([['b64', true]]), options?.crit, parsedProt, joseHeader);\n let b64 = true;\n if (extensions.has('b64')) {\n b64 = parsedProt.b64;\n if (typeof b64 !== 'boolean') {\n throw new JWSInvalid('The \"b64\" (base64url-encode payload) Header Parameter must be a boolean');\n }\n }\n const { alg } = joseHeader;\n if (typeof alg !== 'string' || !alg) {\n throw new JWSInvalid('JWS \"alg\" (Algorithm) Header Parameter missing or invalid');\n }\n const algorithms = options && validateAlgorithms$1('algorithms', options.algorithms);\n if (algorithms && !algorithms.has(alg)) {\n throw new JOSEAlgNotAllowed('\"alg\" (Algorithm) Header Parameter value not allowed');\n }\n if (b64) {\n if (typeof jws.payload !== 'string') {\n throw new JWSInvalid('JWS Payload must be a string');\n }\n }\n else if (typeof jws.payload !== 'string' && !(jws.payload instanceof Uint8Array)) {\n throw new JWSInvalid('JWS Payload must be a string or an Uint8Array instance');\n }\n let resolvedKey = false;\n if (typeof key === 'function') {\n key = await key(parsedProt, jws);\n resolvedKey = true;\n checkKeyTypeWithJwk(alg, key, 'verify');\n if (isJWK(key)) {\n key = await importJWK(key, alg);\n }\n }\n else {\n checkKeyTypeWithJwk(alg, key, 'verify');\n }\n const data = concat(encoder.encode(jws.protected ?? ''), encoder.encode('.'), typeof jws.payload === 'string' ? encoder.encode(jws.payload) : jws.payload);\n let signature;\n try {\n signature = decode$1(jws.signature);\n }\n catch {\n throw new JWSInvalid('Failed to base64url decode the signature');\n }\n const verified = await verify$1(alg, key, signature, data);\n if (!verified) {\n throw new JWSSignatureVerificationFailed();\n }\n let payload;\n if (b64) {\n try {\n payload = decode$1(jws.payload);\n }\n catch {\n throw new JWSInvalid('Failed to base64url decode the payload');\n }\n }\n else if (typeof jws.payload === 'string') {\n payload = encoder.encode(jws.payload);\n }\n else {\n payload = jws.payload;\n }\n const result = { payload };\n if (jws.protected !== undefined) {\n result.protectedHeader = parsedProt;\n }\n if (jws.header !== undefined) {\n result.unprotectedHeader = jws.header;\n }\n if (resolvedKey) {\n return { ...result, key };\n }\n return result;\n}\n\nasync function compactVerify(jws, key, options) {\n if (jws instanceof Uint8Array) {\n jws = decoder.decode(jws);\n }\n if (typeof jws !== 'string') {\n throw new JWSInvalid('Compact JWS must be a string or Uint8Array');\n }\n const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split('.');\n if (length !== 3) {\n throw new JWSInvalid('Invalid Compact JWS');\n }\n const verified = await flattenedVerify({ payload, protected: protectedHeader, signature }, key, options);\n const result = { payload: verified.payload, protectedHeader: verified.protectedHeader };\n if (typeof key === 'function') {\n return { ...result, key: verified.key };\n }\n return result;\n}\n\nvar epoch = (date) => Math.floor(date.getTime() / 1000);\n\nconst minute = 60;\nconst hour = minute * 60;\nconst day = hour * 24;\nconst week = day * 7;\nconst year = day * 365.25;\nconst REGEX = /^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;\nvar secs = (str) => {\n const matched = REGEX.exec(str);\n if (!matched || (matched[4] && matched[1])) {\n throw new TypeError('Invalid time period format');\n }\n const value = parseFloat(matched[2]);\n const unit = matched[3].toLowerCase();\n let numericDate;\n switch (unit) {\n case 'sec':\n case 'secs':\n case 'second':\n case 'seconds':\n case 's':\n numericDate = Math.round(value);\n break;\n case 'minute':\n case 'minutes':\n case 'min':\n case 'mins':\n case 'm':\n numericDate = Math.round(value * minute);\n break;\n case 'hour':\n case 'hours':\n case 'hr':\n case 'hrs':\n case 'h':\n numericDate = Math.round(value * hour);\n break;\n case 'day':\n case 'days':\n case 'd':\n numericDate = Math.round(value * day);\n break;\n case 'week':\n case 'weeks':\n case 'w':\n numericDate = Math.round(value * week);\n break;\n default:\n numericDate = Math.round(value * year);\n break;\n }\n if (matched[1] === '-' || matched[4] === 'ago') {\n return -numericDate;\n }\n return numericDate;\n};\n\nconst normalizeTyp = (value) => value.toLowerCase().replace(/^application\\//, '');\nconst checkAudiencePresence = (audPayload, audOption) => {\n if (typeof audPayload === 'string') {\n return audOption.includes(audPayload);\n }\n if (Array.isArray(audPayload)) {\n return audOption.some(Set.prototype.has.bind(new Set(audPayload)));\n }\n return false;\n};\nvar jwtPayload = (protectedHeader, encodedPayload, options = {}) => {\n let payload;\n try {\n payload = JSON.parse(decoder.decode(encodedPayload));\n }\n catch {\n }\n if (!isObject(payload)) {\n throw new JWTInvalid('JWT Claims Set must be a top-level JSON object');\n }\n const { typ } = options;\n if (typ &&\n (typeof protectedHeader.typ !== 'string' ||\n normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {\n throw new JWTClaimValidationFailed('unexpected \"typ\" JWT header value', payload, 'typ', 'check_failed');\n }\n const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;\n const presenceCheck = [...requiredClaims];\n if (maxTokenAge !== undefined)\n presenceCheck.push('iat');\n if (audience !== undefined)\n presenceCheck.push('aud');\n if (subject !== undefined)\n presenceCheck.push('sub');\n if (issuer !== undefined)\n presenceCheck.push('iss');\n for (const claim of new Set(presenceCheck.reverse())) {\n if (!(claim in payload)) {\n throw new JWTClaimValidationFailed(`missing required \"${claim}\" claim`, payload, claim, 'missing');\n }\n }\n if (issuer &&\n !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {\n throw new JWTClaimValidationFailed('unexpected \"iss\" claim value', payload, 'iss', 'check_failed');\n }\n if (subject && payload.sub !== subject) {\n throw new JWTClaimValidationFailed('unexpected \"sub\" claim value', payload, 'sub', 'check_failed');\n }\n if (audience &&\n !checkAudiencePresence(payload.aud, typeof audience === 'string' ? [audience] : audience)) {\n throw new JWTClaimValidationFailed('unexpected \"aud\" claim value', payload, 'aud', 'check_failed');\n }\n let tolerance;\n switch (typeof options.clockTolerance) {\n case 'string':\n tolerance = secs(options.clockTolerance);\n break;\n case 'number':\n tolerance = options.clockTolerance;\n break;\n case 'undefined':\n tolerance = 0;\n break;\n default:\n throw new TypeError('Invalid clockTolerance option type');\n }\n const { currentDate } = options;\n const now = epoch(currentDate || new Date());\n if ((payload.iat !== undefined || maxTokenAge) && typeof payload.iat !== 'number') {\n throw new JWTClaimValidationFailed('\"iat\" claim must be a number', payload, 'iat', 'invalid');\n }\n if (payload.nbf !== undefined) {\n if (typeof payload.nbf !== 'number') {\n throw new JWTClaimValidationFailed('\"nbf\" claim must be a number', payload, 'nbf', 'invalid');\n }\n if (payload.nbf > now + tolerance) {\n throw new JWTClaimValidationFailed('\"nbf\" claim timestamp check failed', payload, 'nbf', 'check_failed');\n }\n }\n if (payload.exp !== undefined) {\n if (typeof payload.exp !== 'number') {\n throw new JWTClaimValidationFailed('\"exp\" claim must be a number', payload, 'exp', 'invalid');\n }\n if (payload.exp <= now - tolerance) {\n throw new JWTExpired('\"exp\" claim timestamp check failed', payload, 'exp', 'check_failed');\n }\n }\n if (maxTokenAge) {\n const age = now - payload.iat;\n const max = typeof maxTokenAge === 'number' ? maxTokenAge : secs(maxTokenAge);\n if (age - tolerance > max) {\n throw new JWTExpired('\"iat\" claim timestamp check failed (too far in the past)', payload, 'iat', 'check_failed');\n }\n if (age < 0 - tolerance) {\n throw new JWTClaimValidationFailed('\"iat\" claim timestamp check failed (it should be in the past)', payload, 'iat', 'check_failed');\n }\n }\n return payload;\n};\n\nasync function jwtVerify(jwt, key, options) {\n const verified = await compactVerify(jwt, key, options);\n if (verified.protectedHeader.crit?.includes('b64') && verified.protectedHeader.b64 === false) {\n throw new JWTInvalid('JWTs MUST NOT use unencoded payload');\n }\n const payload = jwtPayload(verified.protectedHeader, verified.payload, options);\n const result = { payload, protectedHeader: verified.protectedHeader };\n if (typeof key === 'function') {\n return { ...result, key: verified.key };\n }\n return result;\n}\n\nconst sign = async (alg, key, data) => {\n const cryptoKey = await getCryptoKey(alg, key, 'sign');\n checkKeyLength(alg, cryptoKey);\n const signature = await crypto$1.subtle.sign(subtleDsa(alg, cryptoKey.algorithm), cryptoKey, data);\n return new Uint8Array(signature);\n};\nvar sign$1 = sign;\n\nclass FlattenedSign {\n constructor(payload) {\n if (!(payload instanceof Uint8Array)) {\n throw new TypeError('payload must be an instance of Uint8Array');\n }\n this._payload = payload;\n }\n setProtectedHeader(protectedHeader) {\n if (this._protectedHeader) {\n throw new TypeError('setProtectedHeader can only be called once');\n }\n this._protectedHeader = protectedHeader;\n return this;\n }\n setUnprotectedHeader(unprotectedHeader) {\n if (this._unprotectedHeader) {\n throw new TypeError('setUnprotectedHeader can only be called once');\n }\n this._unprotectedHeader = unprotectedHeader;\n return this;\n }\n async sign(key, options) {\n if (!this._protectedHeader && !this._unprotectedHeader) {\n throw new JWSInvalid('either setProtectedHeader or setUnprotectedHeader must be called before #sign()');\n }\n if (!isDisjoint$1(this._protectedHeader, this._unprotectedHeader)) {\n throw new JWSInvalid('JWS Protected and JWS Unprotected Header Parameter names must be disjoint');\n }\n const joseHeader = {\n ...this._protectedHeader,\n ...this._unprotectedHeader,\n };\n const extensions = validateCrit(JWSInvalid, new Map([['b64', true]]), options?.crit, this._protectedHeader, joseHeader);\n let b64 = true;\n if (extensions.has('b64')) {\n b64 = this._protectedHeader.b64;\n if (typeof b64 !== 'boolean') {\n throw new JWSInvalid('The \"b64\" (base64url-encode payload) Header Parameter must be a boolean');\n }\n }\n const { alg } = joseHeader;\n if (typeof alg !== 'string' || !alg) {\n throw new JWSInvalid('JWS \"alg\" (Algorithm) Header Parameter missing or invalid');\n }\n checkKeyTypeWithJwk(alg, key, 'sign');\n let payload = this._payload;\n if (b64) {\n payload = encoder.encode(encode(payload));\n }\n let protectedHeader;\n if (this._protectedHeader) {\n protectedHeader = encoder.encode(encode(JSON.stringify(this._protectedHeader)));\n }\n else {\n protectedHeader = encoder.encode('');\n }\n const data = concat(protectedHeader, encoder.encode('.'), payload);\n const signature = await sign$1(alg, key, data);\n const jws = {\n signature: encode(signature),\n payload: '',\n };\n if (b64) {\n jws.payload = decoder.decode(payload);\n }\n if (this._unprotectedHeader) {\n jws.header = this._unprotectedHeader;\n }\n if (this._protectedHeader) {\n jws.protected = decoder.decode(protectedHeader);\n }\n return jws;\n }\n}\n\nclass CompactSign {\n constructor(payload) {\n this._flattened = new FlattenedSign(payload);\n }\n setProtectedHeader(protectedHeader) {\n this._flattened.setProtectedHeader(protectedHeader);\n return this;\n }\n async sign(key, options) {\n const jws = await this._flattened.sign(key, options);\n if (jws.payload === undefined) {\n throw new TypeError('use the flattened module for creating JWS with b64: false');\n }\n return `${jws.protected}.${jws.payload}.${jws.signature}`;\n }\n}\n\nfunction validateInput(label, input) {\n if (!Number.isFinite(input)) {\n throw new TypeError(`Invalid ${label} input`);\n }\n return input;\n}\nclass ProduceJWT {\n constructor(payload = {}) {\n if (!isObject(payload)) {\n throw new TypeError('JWT Claims Set MUST be an object');\n }\n this._payload = payload;\n }\n setIssuer(issuer) {\n this._payload = { ...this._payload, iss: issuer };\n return this;\n }\n setSubject(subject) {\n this._payload = { ...this._payload, sub: subject };\n return this;\n }\n setAudience(audience) {\n this._payload = { ...this._payload, aud: audience };\n return this;\n }\n setJti(jwtId) {\n this._payload = { ...this._payload, jti: jwtId };\n return this;\n }\n setNotBefore(input) {\n if (typeof input === 'number') {\n this._payload = { ...this._payload, nbf: validateInput('setNotBefore', input) };\n }\n else if (input instanceof Date) {\n this._payload = { ...this._payload, nbf: validateInput('setNotBefore', epoch(input)) };\n }\n else {\n this._payload = { ...this._payload, nbf: epoch(new Date()) + secs(input) };\n }\n return this;\n }\n setExpirationTime(input) {\n if (typeof input === 'number') {\n this._payload = { ...this._payload, exp: validateInput('setExpirationTime', input) };\n }\n else if (input instanceof Date) {\n this._payload = { ...this._payload, exp: validateInput('setExpirationTime', epoch(input)) };\n }\n else {\n this._payload = { ...this._payload, exp: epoch(new Date()) + secs(input) };\n }\n return this;\n }\n setIssuedAt(input) {\n if (typeof input === 'undefined') {\n this._payload = { ...this._payload, iat: epoch(new Date()) };\n }\n else if (input instanceof Date) {\n this._payload = { ...this._payload, iat: validateInput('setIssuedAt', epoch(input)) };\n }\n else if (typeof input === 'string') {\n this._payload = {\n ...this._payload,\n iat: validateInput('setIssuedAt', epoch(new Date()) + secs(input)),\n };\n }\n else {\n this._payload = { ...this._payload, iat: validateInput('setIssuedAt', input) };\n }\n return this;\n }\n}\n\nclass SignJWT extends ProduceJWT {\n setProtectedHeader(protectedHeader) {\n this._protectedHeader = protectedHeader;\n return this;\n }\n async sign(key, options) {\n const sig = new CompactSign(encoder.encode(JSON.stringify(this._payload)));\n sig.setProtectedHeader(this._protectedHeader);\n if (Array.isArray(this._protectedHeader?.crit) &&\n this._protectedHeader.crit.includes('b64') &&\n this._protectedHeader.b64 === false) {\n throw new JWTInvalid('JWTs MUST NOT use unencoded payload');\n }\n return sig.sign(key, options);\n }\n}\n\nconst check = (value, description) => {\n if (typeof value !== 'string' || !value) {\n throw new JWKInvalid(`${description} missing or invalid`);\n }\n};\nasync function calculateJwkThumbprint(jwk, digestAlgorithm) {\n if (!isObject(jwk)) {\n throw new TypeError('JWK must be an object');\n }\n digestAlgorithm ?? (digestAlgorithm = 'sha256');\n if (digestAlgorithm !== 'sha256' &&\n digestAlgorithm !== 'sha384' &&\n digestAlgorithm !== 'sha512') {\n throw new TypeError('digestAlgorithm must one of \"sha256\", \"sha384\", or \"sha512\"');\n }\n let components;\n switch (jwk.kty) {\n case 'EC':\n check(jwk.crv, '\"crv\" (Curve) Parameter');\n check(jwk.x, '\"x\" (X Coordinate) Parameter');\n check(jwk.y, '\"y\" (Y Coordinate) Parameter');\n components = { crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y };\n break;\n case 'OKP':\n check(jwk.crv, '\"crv\" (Subtype of Key Pair) Parameter');\n check(jwk.x, '\"x\" (Public Key) Parameter');\n components = { crv: jwk.crv, kty: jwk.kty, x: jwk.x };\n break;\n case 'RSA':\n check(jwk.e, '\"e\" (Exponent) Parameter');\n check(jwk.n, '\"n\" (Modulus) Parameter');\n components = { e: jwk.e, kty: jwk.kty, n: jwk.n };\n break;\n case 'oct':\n check(jwk.k, '\"k\" (Key Value) Parameter');\n components = { k: jwk.k, kty: jwk.kty };\n break;\n default:\n throw new JOSENotSupported('\"kty\" (Key Type) Parameter missing or unsupported');\n }\n const data = encoder.encode(JSON.stringify(components));\n return encode(await digest$1(digestAlgorithm, data));\n}\n\nfunction getKtyFromAlg(alg) {\n switch (typeof alg === 'string' && alg.slice(0, 2)) {\n case 'RS':\n case 'PS':\n return 'RSA';\n case 'ES':\n return 'EC';\n case 'Ed':\n return 'OKP';\n default:\n throw new JOSENotSupported('Unsupported \"alg\" value for a JSON Web Key Set');\n }\n}\nfunction isJWKSLike(jwks) {\n return (jwks &&\n typeof jwks === 'object' &&\n Array.isArray(jwks.keys) &&\n jwks.keys.every(isJWKLike));\n}\nfunction isJWKLike(key) {\n return isObject(key);\n}\nfunction clone(obj) {\n if (typeof structuredClone === 'function') {\n return structuredClone(obj);\n }\n return JSON.parse(JSON.stringify(obj));\n}\nclass LocalJWKSet {\n constructor(jwks) {\n this._cached = new WeakMap();\n if (!isJWKSLike(jwks)) {\n throw new JWKSInvalid('JSON Web Key Set malformed');\n }\n this._jwks = clone(jwks);\n }\n async getKey(protectedHeader, token) {\n const { alg, kid } = { ...protectedHeader, ...token?.header };\n const kty = getKtyFromAlg(alg);\n const candidates = this._jwks.keys.filter((jwk) => {\n let candidate = kty === jwk.kty;\n if (candidate && typeof kid === 'string') {\n candidate = kid === jwk.kid;\n }\n if (candidate && typeof jwk.alg === 'string') {\n candidate = alg === jwk.alg;\n }\n if (candidate && typeof jwk.use === 'string') {\n candidate = jwk.use === 'sig';\n }\n if (candidate && Array.isArray(jwk.key_ops)) {\n candidate = jwk.key_ops.includes('verify');\n }\n if (candidate) {\n switch (alg) {\n case 'ES256':\n candidate = jwk.crv === 'P-256';\n break;\n case 'ES256K':\n candidate = jwk.crv === 'secp256k1';\n break;\n case 'ES384':\n candidate = jwk.crv === 'P-384';\n break;\n case 'ES512':\n candidate = jwk.crv === 'P-521';\n break;\n case 'Ed25519':\n candidate = jwk.crv === 'Ed25519';\n break;\n case 'EdDSA':\n candidate = jwk.crv === 'Ed25519' || jwk.crv === 'Ed448';\n break;\n }\n }\n return candidate;\n });\n const { 0: jwk, length } = candidates;\n if (length === 0) {\n throw new JWKSNoMatchingKey();\n }\n if (length !== 1) {\n const error = new JWKSMultipleMatchingKeys();\n const { _cached } = this;\n error[Symbol.asyncIterator] = async function* () {\n for (const jwk of candidates) {\n try {\n yield await importWithAlgCache(_cached, jwk, alg);\n }\n catch { }\n }\n };\n throw error;\n }\n return importWithAlgCache(this._cached, jwk, alg);\n }\n}\nasync function importWithAlgCache(cache, jwk, alg) {\n const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);\n if (cached[alg] === undefined) {\n const key = await importJWK({ ...jwk, ext: true }, alg);\n if (key instanceof Uint8Array || key.type !== 'public') {\n throw new JWKSInvalid('JSON Web Key Set members must be public keys');\n }\n cached[alg] = key;\n }\n return cached[alg];\n}\nfunction createLocalJWKSet(jwks) {\n const set = new LocalJWKSet(jwks);\n const localJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);\n Object.defineProperties(localJWKSet, {\n jwks: {\n value: () => clone(set._jwks),\n enumerable: true,\n configurable: false,\n writable: false,\n },\n });\n return localJWKSet;\n}\n\nconst fetchJwks = async (url, timeout, options) => {\n let controller;\n let id;\n let timedOut = false;\n if (typeof AbortController === 'function') {\n controller = new AbortController();\n id = setTimeout(() => {\n timedOut = true;\n controller.abort();\n }, timeout);\n }\n const response = await fetch(url.href, {\n signal: controller ? controller.signal : undefined,\n redirect: 'manual',\n headers: options.headers,\n }).catch((err) => {\n if (timedOut)\n throw new JWKSTimeout();\n throw err;\n });\n if (id !== undefined)\n clearTimeout(id);\n if (response.status !== 200) {\n throw new JOSEError('Expected 200 OK from the JSON Web Key Set HTTP response');\n }\n try {\n return await response.json();\n }\n catch {\n throw new JOSEError('Failed to parse the JSON Web Key Set HTTP response as JSON');\n }\n};\nvar fetchJwks$1 = fetchJwks;\n\nfunction isCloudflareWorkers() {\n return (typeof WebSocketPair !== 'undefined' ||\n (typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') ||\n (typeof EdgeRuntime !== 'undefined' && EdgeRuntime === 'vercel'));\n}\nlet USER_AGENT;\nif (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {\n const NAME = 'jose';\n const VERSION = 'v5.10.0';\n USER_AGENT = `${NAME}/${VERSION}`;\n}\nconst jwksCache = Symbol();\nfunction isFreshJwksCache(input, cacheMaxAge) {\n if (typeof input !== 'object' || input === null) {\n return false;\n }\n if (!('uat' in input) || typeof input.uat !== 'number' || Date.now() - input.uat >= cacheMaxAge) {\n return false;\n }\n if (!('jwks' in input) ||\n !isObject(input.jwks) ||\n !Array.isArray(input.jwks.keys) ||\n !Array.prototype.every.call(input.jwks.keys, isObject)) {\n return false;\n }\n return true;\n}\nclass RemoteJWKSet {\n constructor(url, options) {\n if (!(url instanceof URL)) {\n throw new TypeError('url must be an instance of URL');\n }\n this._url = new URL(url.href);\n this._options = { agent: options?.agent, headers: options?.headers };\n this._timeoutDuration =\n typeof options?.timeoutDuration === 'number' ? options?.timeoutDuration : 5000;\n this._cooldownDuration =\n typeof options?.cooldownDuration === 'number' ? options?.cooldownDuration : 30000;\n this._cacheMaxAge = typeof options?.cacheMaxAge === 'number' ? options?.cacheMaxAge : 600000;\n if (options?.[jwksCache] !== undefined) {\n this._cache = options?.[jwksCache];\n if (isFreshJwksCache(options?.[jwksCache], this._cacheMaxAge)) {\n this._jwksTimestamp = this._cache.uat;\n this._local = createLocalJWKSet(this._cache.jwks);\n }\n }\n }\n coolingDown() {\n return typeof this._jwksTimestamp === 'number'\n ? Date.now() < this._jwksTimestamp + this._cooldownDuration\n : false;\n }\n fresh() {\n return typeof this._jwksTimestamp === 'number'\n ? Date.now() < this._jwksTimestamp + this._cacheMaxAge\n : false;\n }\n async getKey(protectedHeader, token) {\n if (!this._local || !this.fresh()) {\n await this.reload();\n }\n try {\n return await this._local(protectedHeader, token);\n }\n catch (err) {\n if (err instanceof JWKSNoMatchingKey) {\n if (this.coolingDown() === false) {\n await this.reload();\n return this._local(protectedHeader, token);\n }\n }\n throw err;\n }\n }\n async reload() {\n if (this._pendingFetch && isCloudflareWorkers()) {\n this._pendingFetch = undefined;\n }\n const headers = new Headers(this._options.headers);\n if (USER_AGENT && !headers.has('User-Agent')) {\n headers.set('User-Agent', USER_AGENT);\n this._options.headers = Object.fromEntries(headers.entries());\n }\n this._pendingFetch || (this._pendingFetch = fetchJwks$1(this._url, this._timeoutDuration, this._options)\n .then((json) => {\n this._local = createLocalJWKSet(json);\n if (this._cache) {\n this._cache.uat = Date.now();\n this._cache.jwks = json;\n }\n this._jwksTimestamp = Date.now();\n this._pendingFetch = undefined;\n })\n .catch((err) => {\n this._pendingFetch = undefined;\n throw err;\n }));\n await this._pendingFetch;\n }\n}\nfunction createRemoteJWKSet(url, options) {\n const set = new RemoteJWKSet(url, options);\n const remoteJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);\n Object.defineProperties(remoteJWKSet, {\n coolingDown: {\n get: () => set.coolingDown(),\n enumerable: true,\n configurable: false,\n },\n fresh: {\n get: () => set.fresh(),\n enumerable: true,\n configurable: false,\n },\n reload: {\n value: () => set.reload(),\n enumerable: true,\n configurable: false,\n writable: false,\n },\n reloading: {\n get: () => !!set._pendingFetch,\n enumerable: true,\n configurable: false,\n },\n jwks: {\n value: () => set._local?.jwks(),\n enumerable: true,\n configurable: false,\n writable: false,\n },\n });\n return remoteJWKSet;\n}\n\nconst decode = decode$1;\n\nfunction decodeJwt(jwt) {\n if (typeof jwt !== 'string')\n throw new JWTInvalid('JWTs must use Compact JWS serialization, JWT must be a string');\n const { 1: payload, length } = jwt.split('.');\n if (length === 5)\n throw new JWTInvalid('Only JWTs using Compact JWS serialization can be decoded');\n if (length !== 3)\n throw new JWTInvalid('Invalid JWT');\n if (!payload)\n throw new JWTInvalid('JWTs must contain a payload');\n let decoded;\n try {\n decoded = decode(payload);\n }\n catch {\n throw new JWTInvalid('Failed to base64url decode the payload');\n }\n let result;\n try {\n result = JSON.parse(decoder.decode(decoded));\n }\n catch {\n throw new JWTInvalid('Failed to parse the decoded payload as JSON');\n }\n if (!isObject(result))\n throw new JWTInvalid('Invalid JWT Claims Set');\n return result;\n}\n\nfunction getModulusLengthOption(options) {\n const modulusLength = options?.modulusLength ?? 2048;\n if (typeof modulusLength !== 'number' || modulusLength < 2048) {\n throw new JOSENotSupported('Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used');\n }\n return modulusLength;\n}\nasync function generateKeyPair$1(alg, options) {\n let algorithm;\n let keyUsages;\n switch (alg) {\n case 'PS256':\n case 'PS384':\n case 'PS512':\n algorithm = {\n name: 'RSA-PSS',\n hash: `SHA-${alg.slice(-3)}`,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n modulusLength: getModulusLengthOption(options),\n };\n keyUsages = ['sign', 'verify'];\n break;\n case 'RS256':\n case 'RS384':\n case 'RS512':\n algorithm = {\n name: 'RSASSA-PKCS1-v1_5',\n hash: `SHA-${alg.slice(-3)}`,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n modulusLength: getModulusLengthOption(options),\n };\n keyUsages = ['sign', 'verify'];\n break;\n case 'RSA-OAEP':\n case 'RSA-OAEP-256':\n case 'RSA-OAEP-384':\n case 'RSA-OAEP-512':\n algorithm = {\n name: 'RSA-OAEP',\n hash: `SHA-${parseInt(alg.slice(-3), 10) || 1}`,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n modulusLength: getModulusLengthOption(options),\n };\n keyUsages = ['decrypt', 'unwrapKey', 'encrypt', 'wrapKey'];\n break;\n case 'ES256':\n algorithm = { name: 'ECDSA', namedCurve: 'P-256' };\n keyUsages = ['sign', 'verify'];\n break;\n case 'ES384':\n algorithm = { name: 'ECDSA', namedCurve: 'P-384' };\n keyUsages = ['sign', 'verify'];\n break;\n case 'ES512':\n algorithm = { name: 'ECDSA', namedCurve: 'P-521' };\n keyUsages = ['sign', 'verify'];\n break;\n case 'Ed25519':\n algorithm = { name: 'Ed25519' };\n keyUsages = ['sign', 'verify'];\n break;\n case 'EdDSA': {\n keyUsages = ['sign', 'verify'];\n const crv = options?.crv ?? 'Ed25519';\n switch (crv) {\n case 'Ed25519':\n case 'Ed448':\n algorithm = { name: crv };\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported crv option provided');\n }\n break;\n }\n case 'ECDH-ES':\n case 'ECDH-ES+A128KW':\n case 'ECDH-ES+A192KW':\n case 'ECDH-ES+A256KW': {\n keyUsages = ['deriveKey', 'deriveBits'];\n const crv = options?.crv ?? 'P-256';\n switch (crv) {\n case 'P-256':\n case 'P-384':\n case 'P-521': {\n algorithm = { name: 'ECDH', namedCurve: crv };\n break;\n }\n case 'X25519':\n case 'X448':\n algorithm = { name: crv };\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448');\n }\n break;\n }\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n return crypto$1.subtle.generateKey(algorithm, options?.extractable ?? false, keyUsages);\n}\n\nasync function generateKeyPair(alg, options) {\n return generateKeyPair$1(alg, options);\n}\n\n/**\n * When the client does not have a webid profile document, use this.\n *\n * @param registration_endpoint\n * @param redirect__uris\n * @returns\n */\nconst requestDynamicClientRegistration = async (registration_endpoint, client_details) => {\n // prepare dynamic client registration\n const client_registration_request_body = {\n ...client_details,\n grant_types: [\"authorization_code\", \"refresh_token\"],\n // id_token_signed_response_alg: \"ES256\", // omitting as NSS does not support ES256 while CSS does not support RS256\n token_endpoint_auth_method: \"none\",\n application_type: \"web\",\n subject_type: \"public\",\n };\n // register\n return fetch(registration_endpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(client_registration_request_body),\n });\n};\n\n/**\n * Login with the idp, using a provided `client_id` or dynamic client registration if none provided.\n *\n * @param idp\n * @param redirect_uri\n */\nconst redirectForLogin = async (idp, redirect_uri, client_details) => {\n // RFC 6749 - Section 3.1.2 - sanitize redirect_uri\n const redirect_uri_ = new URL(redirect_uri);\n const redirect_uri_sane = redirect_uri_.origin + redirect_uri_.pathname + redirect_uri_.search;\n // lookup openid configuration of idp\n const idp_origin = new URL(idp).origin;\n const openid_configuration = await fetch(`${idp_origin}/.well-known/openid-configuration`)\n .then((response) => {\n if (!response.ok) {\n throw new Error(`HTTP error! Status: ${response.status}`);\n }\n return response.json();\n });\n // RFC 9207 iss check: remember the identity provider (idp) / issuer (iss) - relaxing for trailing slash\n const issuer = openid_configuration[\"issuer\"];\n const trim_trailing_slash = (url) => (url.endsWith('/') ? url.slice(0, -1) : url);\n if (trim_trailing_slash(idp) !== trim_trailing_slash(issuer)) { // expected idp matches received issuer mod trailing slash?\n throw new Error(\"RFC 9207 - iss !== idp - \" + issuer + \" !== \" + idp);\n }\n sessionStorage.setItem(\"idp\", issuer);\n // remember token endpoint\n sessionStorage.setItem(\"token_endpoint\", openid_configuration[\"token_endpoint\"]);\n // remember jwks_uri for later token verification\n sessionStorage.setItem(\"jwks_uri\", openid_configuration[\"jwks_uri\"]);\n let client_id = client_details?.client_id;\n // no client_id => attempt dynamic registration\n if (!client_id) {\n // use registration endpoint\n const registration_endpoint = openid_configuration[\"registration_endpoint\"];\n // get client registration\n const client_registration = await requestDynamicClientRegistration(registration_endpoint, client_details ?? { redirect_uris: [redirect_uri_sane] })\n .then((response) => {\n if (!response.ok) {\n throw new Error(`HTTP error! Status: ${response.status}`);\n }\n return response.json();\n });\n client_id = client_registration[\"client_id\"];\n }\n // remember client_id if not URL\n try {\n new URL(client_id);\n }\n catch {\n sessionStorage.setItem(\"client_id\", client_id);\n }\n // RFC 7636 PKCE, remember code verifer\n const { pkce_code_verifier, pkce_code_challenge } = await getPKCEcode();\n sessionStorage.setItem(\"pkce_code_verifier\", pkce_code_verifier);\n // RFC 6749 OAuth 2.0 - CSRF token\n const csrf_token = window.crypto.randomUUID();\n sessionStorage.setItem(\"csrf_token\", csrf_token);\n // redirect to idp\n const redirect_to_idp = openid_configuration[\"authorization_endpoint\"] +\n `?response_type=code` +\n `&redirect_uri=${encodeURIComponent(redirect_uri_sane)}` +\n `&scope=openid offline_access webid` +\n `&client_id=${encodeURIComponent(client_id)}` +\n `&code_challenge_method=S256` +\n `&code_challenge=${pkce_code_challenge}` +\n `&state=${csrf_token}` +\n `&prompt=consent`; // this query parameter value MUST be present for CSS v7 to issue a refresh token ( // TODO open issue because prompting is the default behaviour but without this query param no refresh token is provided despite the \"remember this client\" box being checked)\n window.location.href = redirect_to_idp;\n};\n/**\n * RFC 7636 PKCE\n * @returns PKCE code verifier and PKCE code challenge\n */\nconst getPKCEcode = async () => {\n // create random string as PKCE code verifier\n const pkce_code_verifier = window.crypto.randomUUID() + \"-\" + window.crypto.randomUUID();\n // hash the verifier and base64URL encode as PKCE code challenge\n const digest = new Uint8Array(await window.crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(pkce_code_verifier)));\n const pkce_code_challenge = btoa(String.fromCharCode(...digest))\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=+$/, \"\");\n return { pkce_code_verifier, pkce_code_challenge };\n};\n/**\n * On incoming redirect from OpenID provider (idp/iss),\n * URL contains authrization code, issuer (idp) and state (csrf token),\n * get an access token for the authrization code.\n */\nconst onIncomingRedirect = async (client_details, database) => {\n const url = new URL(window.location.href);\n // authorization code\n const authorization_code = url.searchParams.get(\"code\");\n // if no code, session remains unauthenticated at this point\n if (authorization_code === null) {\n return { clientDetails: client_details };\n }\n // RFC 9207 issuer check\n const idp = sessionStorage.getItem(\"idp\");\n if (idp === null || url.searchParams.get(\"iss\") !== idp) {\n throw new Error(\"RFC 9207 - iss !== idp - \" + url.searchParams.get(\"iss\") + \" !== \" + idp);\n }\n // RFC 6749 OAuth 2.0\n if (url.searchParams.get(\"state\") !== sessionStorage.getItem(\"csrf_token\")) {\n throw new Error(\"RFC 6749 - state !== csrf_token - \" + url.searchParams.get(\"state\") + \" !== \" + sessionStorage.getItem(\"csrf_token\"));\n }\n // remove redirect query parameters from URL\n url.searchParams.delete(\"iss\");\n url.searchParams.delete(\"state\");\n url.searchParams.delete(\"code\");\n window.history.pushState({}, document.title, url.toString());\n // prepare token request\n const pkce_code_verifier = sessionStorage.getItem(\"pkce_code_verifier\");\n if (pkce_code_verifier === null) {\n throw new Error(\"Access Token Request preparation - Could not find in sessionStorage: pkce_code_verifier\");\n }\n const client_id = client_details?.client_id || sessionStorage.getItem(\"client_id\");\n if (!client_id) {\n throw new Error(\"Access Token Request preparation - Could not find in sessionStorage: client_id (dynamic registration)\");\n }\n const token_endpoint = sessionStorage.getItem(\"token_endpoint\");\n if (token_endpoint === null) {\n throw new Error(\"Access Token Request preparation - Could not find in sessionStorage: token_endpoint\");\n }\n // RFC 9449 DPoP\n const key_pair = await generateKeyPair(\"ES256\");\n // get access token\n const token_response = await requestAccessToken(authorization_code, pkce_code_verifier, url.toString(), client_id, token_endpoint, key_pair)\n .then((response) => {\n if (!response.ok) {\n throw new Error(`HTTP error! Status: ${response.status}`);\n }\n return response.json();\n });\n // verify access_token // ! Solid-OIDC specification says it should be a dpop-bound `id token` but implementations provide a dpop-bound `access token`\n const accessToken = token_response[\"access_token\"];\n const jwks_uri = sessionStorage.getItem(\"jwks_uri\");\n if (jwks_uri === null) {\n throw new Error(\"Access Token validation preparation - Could not find in sessionStorage: jwks_uri\");\n }\n const jwks = createRemoteJWKSet(new URL(jwks_uri));\n const { payload } = await jwtVerify(accessToken, jwks, {\n issuer: idp, // RFC 9207\n audience: \"solid\", // RFC 7519 // ! \"solid\" as per implementations ...\n // exp, nbf, iat - handled automatically\n });\n // check dpop thumbprint\n const dpopThumbprint = await calculateJwkThumbprint(await exportJWK(key_pair.publicKey));\n if (payload[\"cnf\"][\"jkt\"] !== dpopThumbprint) {\n throw new Error(\"Access Token validation failed on `jkt`: jkt !== DPoP thumbprint - \" + payload[\"cnf\"][\"jkt\"] + \" !== \" + dpopThumbprint);\n }\n // check client_id\n if (payload[\"client_id\"] !== client_id) {\n throw new Error(\"Access Token validation failed on `client_id`: JWT payload !== client_id - \" + payload[\"client_id\"] + \" !== \" + client_id);\n }\n // summarise session info\n const token_details = { ...token_response, dpop_key_pair: key_pair };\n const idp_details = { idp, jwks_uri, token_endpoint };\n if (!client_details)\n client_details = { redirect_uris: [url.toString()] };\n client_details.client_id = client_id;\n // and persist refresh token details\n if (database) {\n await database.init();\n await Promise.all([\n database.setItem(\"idp\", idp),\n database.setItem(\"jwks_uri\", jwks_uri),\n database.setItem(\"token_endpoint\", token_endpoint),\n database.setItem(\"client_id\", client_id),\n database.setItem(\"dpop_keypair\", key_pair),\n database.setItem(\"refresh_token\", token_response[\"refresh_token\"])\n ]);\n database.close();\n }\n // clean session storage\n sessionStorage.removeItem(\"csrf_token\");\n sessionStorage.removeItem(\"pkce_code_verifier\");\n sessionStorage.removeItem(\"idp\");\n sessionStorage.removeItem(\"jwks_uri\");\n sessionStorage.removeItem(\"token_endpoint\");\n sessionStorage.removeItem(\"client_id\");\n // return session information\n return {\n clientDetails: client_details,\n idpDetails: idp_details,\n tokenDetails: token_details\n };\n};\n/**\n * Request an dpop-bound access token from a token endpoint\n * @param authorization_code\n * @param pkce_code_verifier\n * @param redirect_uri\n * @param client_id\n * @param token_endpoint\n * @param key_pair\n * @returns\n */\nconst requestAccessToken = async (authorization_code, pkce_code_verifier, redirect_uri, client_id, token_endpoint, key_pair) => {\n // prepare public key to bind access token to\n const jwk_public_key = await exportJWK(key_pair.publicKey);\n jwk_public_key.alg = \"ES256\";\n // sign the access token request DPoP token\n const dpop = await new SignJWT({\n htu: token_endpoint,\n htm: \"POST\",\n })\n .setIssuedAt()\n .setJti(window.crypto.randomUUID())\n .setProtectedHeader({\n alg: \"ES256\",\n typ: \"dpop+jwt\",\n jwk: jwk_public_key,\n })\n .sign(key_pair.privateKey);\n return fetch(token_endpoint, {\n method: \"POST\",\n headers: {\n dpop,\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams({\n grant_type: \"authorization_code\",\n code: authorization_code,\n code_verifier: pkce_code_verifier,\n redirect_uri: redirect_uri,\n client_id: client_id,\n }),\n });\n};\n\nconst renewTokens = async (sessionDatabase) => {\n // remember session details\n try {\n await sessionDatabase.init();\n const client_id = await sessionDatabase.getItem(\"client_id\");\n const token_endpoint = await sessionDatabase.getItem(\"token_endpoint\");\n const key_pair = await sessionDatabase.getItem(\"dpop_keypair\");\n const refresh_token = await sessionDatabase.getItem(\"refresh_token\");\n if (client_id === null || token_endpoint === null || key_pair === null || refresh_token === null) {\n // we can not restore the old session\n throw new Error(\"Could not refresh tokens: details missing from database.\");\n }\n const token_response = await requestFreshTokens(refresh_token, client_id, token_endpoint, key_pair)\n .then((response) => {\n if (!response.ok) {\n throw new Error(`HTTP error! Status: ${response.status}`);\n }\n return response.json();\n });\n // verify access_token // ! Solid-OIDC specification says it should be a dpop-bound `id token` but implementations provide a dpop-bound `access token`\n const accessToken = token_response[\"access_token\"];\n const idp = await sessionDatabase.getItem(\"idp\");\n if (idp === null) {\n throw new Error(\"Access Token validation preparation - Could not find in sessionDatabase: idp\");\n }\n const jwks_uri = await sessionDatabase.getItem(\"jwks_uri\");\n if (jwks_uri === null) {\n throw new Error(\"Access Token validation preparation - Could not find in sessionDatabase: jwks_uri\");\n }\n const jwks = createRemoteJWKSet(new URL(jwks_uri));\n const { payload } = await jwtVerify(accessToken, jwks, {\n issuer: idp, // RFC 9207\n audience: \"solid\", // RFC 7519 // ! \"solid\" as per implementations ...\n // exp, nbf, iat - handled automatically\n });\n // check dpop thumbprint\n const dpopThumbprint = await calculateJwkThumbprint(await exportJWK(key_pair.publicKey));\n if (payload[\"cnf\"][\"jkt\"] !== dpopThumbprint) {\n throw new Error(\"Access Token validation failed on `jkt`: jkt !== DPoP thumbprint - \" + payload[\"cnf\"][\"jkt\"] + \" !== \" + dpopThumbprint);\n }\n // check client_id\n if (payload[\"client_id\"] !== client_id) {\n throw new Error(\"Access Token validation failed on `client_id`: JWT payload !== client_id - \" + payload[\"client_id\"] + \" !== \" + client_id);\n }\n // set new refresh token for token rotation\n await sessionDatabase.setItem(\"refresh_token\", token_response[\"refresh_token\"]);\n return {\n ...token_response,\n dpop_key_pair: key_pair,\n };\n }\n finally {\n sessionDatabase.close();\n }\n};\n/**\n * Request an dpop-bound access token from a token endpoint using a refresh token\n * @param authorization_code\n * @param pkce_code_verifier\n * @param redirect_uri\n * @param client_id\n * @param token_endpoint\n * @param key_pair\n * @returns\n */\nconst requestFreshTokens = async (refresh_token, client_id, token_endpoint, key_pair) => {\n // prepare public key to bind access token to\n const jwk_public_key = await exportJWK(key_pair.publicKey);\n jwk_public_key.alg = \"ES256\";\n // sign the access token request DPoP token\n const dpop = await new SignJWT({\n htu: token_endpoint,\n htm: \"POST\",\n })\n .setIssuedAt()\n .setJti(self.crypto.randomUUID())\n .setProtectedHeader({\n alg: \"ES256\",\n typ: \"dpop+jwt\",\n jwk: jwk_public_key,\n })\n .sign(key_pair.privateKey);\n return fetch(token_endpoint, {\n method: \"POST\",\n headers: {\n dpop,\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams({\n grant_type: \"refresh_token\",\n refresh_token,\n client_id\n }),\n });\n};\n\nvar SessionEvents;\n(function (SessionEvents) {\n SessionEvents[\"STATE_CHANGE\"] = \"sessionStateChange\";\n SessionEvents[\"EXPIRATION_WARNING\"] = \"sessionExpirationWarning\";\n SessionEvents[\"EXPIRATION\"] = \"sessionExpiration\";\n})(SessionEvents || (SessionEvents = {}));\n//\n//\n// Basic implementation\n//\n//\n/**\n * The SessionCore class manages session state and core logic but does not handle the refresh lifecycle.\n * It receives {@link SessionOptions} with a database to be able to restore a session.\n * That database can be re-used by (your!) surrounding implementation to handle the refresh lifecycle.\n * If no database was provided, refresh information cannot be stored, and thus token refresh (via the refresh token grant) is not possible in this case.\n *\n * If you are building a web app, use the Session implementation provided in the default `/web` version of this library.\n */\nclass SessionCore extends EventTarget {\n isActive_ = false;\n exp_;\n webId_ = undefined;\n currentAth_ = undefined;\n information;\n database;\n refreshPromise;\n resolveRefresh;\n rejectRefresh;\n constructor(clientDetails, sessionOptions) {\n super();\n this.authFetch = this.authFetch.bind(this);\n this.information = { clientDetails };\n this.database = sessionOptions?.database;\n if (sessionOptions?.onSessionStateChange)\n this.addEventListener(SessionEvents.STATE_CHANGE, (event) => sessionOptions.onSessionStateChange?.(event));\n if (sessionOptions?.onSessionExpirationWarning)\n this.addEventListener(SessionEvents.EXPIRATION_WARNING, (event) => sessionOptions?.onSessionExpirationWarning?.(event));\n if (sessionOptions?.onSessionExpiration)\n this.addEventListener(SessionEvents.EXPIRATION, (event) => sessionOptions?.onSessionExpiration?.(event));\n }\n async login(idp, redirect_uri) {\n await redirectForLogin(idp, redirect_uri, this.information.clientDetails);\n }\n /**\n * Handles the redirect from the identity provider after a login attempt.\n * It attempts to retrieve tokens using the authorization code.\n * Upon success, it tries to persist information to refresh tokens in the session database.\n * If no database was provided, no information is persisted.\n */\n async handleRedirectFromLogin() {\n // Redirect after Authorization Code Grant // memory via sessionStorage\n const newSessionInfo = await onIncomingRedirect(this.information.clientDetails, this.database);\n // no session - we remain unauthenticated\n if (!newSessionInfo.tokenDetails)\n return;\n // we got a session\n this.information.clientDetails = newSessionInfo.clientDetails;\n this.information.idpDetails = newSessionInfo.idpDetails;\n await this.setTokenDetails(newSessionInfo.tokenDetails);\n // callback state change \n this.dispatchStateChangeEvent(); // we logged in\n }\n /**\n * Handles session restoration using the refresh token grant.\n */\n async restore() {\n if (!this.database) {\n throw new Error(\"Could not refresh tokens: missing database. Provide database in sessionOption.\");\n }\n if (this.refreshPromise) {\n return this.refreshPromise;\n }\n this.refreshPromise = new Promise((resolve, reject) => {\n this.resolveRefresh = resolve;\n this.rejectRefresh = reject;\n });\n // Restore session using Refresh Token Grant \n const wasActive = this.isActive;\n renewTokens(this.database)\n .then(tokenDetails => this.setTokenDetails(tokenDetails))\n .then(() => this.resolveRefresh())\n .catch(error => {\n if (this.isActive) {\n this.rejectRefresh(new Error(error || 'Token refresh failed'));\n // do not change state (yet), let the app decide if they want to logout or if they just want to retry.\n if (!this.isExpired()) {\n this.dispatchExpirationWarningEvent();\n }\n else {\n this.dispatchExpirationEvent();\n }\n }\n else {\n this.rejectRefresh(new Error(\"No session to restore.\"));\n }\n }).finally(() => {\n this.clearRefreshPromise();\n if (wasActive !== this.isActive)\n this.dispatchStateChangeEvent();\n });\n return this.refreshPromise;\n }\n /**\n * This logs the user out.\n * Clears all session-related information, including IDP details and tokens.\n * Client ID is preserved if it is a URI.\n */\n async logout() {\n // clean session data\n this.isActive_ = false;\n this.exp_ = undefined;\n this.webId_ = undefined;\n this.currentAth_ = undefined;\n this.information.idpDetails = undefined;\n this.information.tokenDetails = undefined;\n // client details are preserved\n if (this.refreshPromise && this.rejectRefresh) {\n this.rejectRefresh(new Error('Logout during token refresh.'));\n this.clearRefreshPromise();\n }\n // clean session database\n if (this.database) {\n await this.database.init();\n await this.database.clear();\n this.database.close();\n }\n // callback state change\n this.dispatchStateChangeEvent(); // we logged out\n }\n /**\n * Makes an HTTP fetch request.\n * If a session is active, it includes the DPoP token and the access token in the `Authorization` header.\n *\n * @param input The URL or Request object to fetch.\n * @param init Optional fetch request options (RequestInit). Headers for `Authorization` and `DPoP` will be overwritten if a session is active.\n * @param dpopPayload Optional payload for the DPoP token. If provided, it overrides the default `htu` and `htm` claims.\n * @returns A promise that resolves to the fetch Response.\n */\n async authFetch(input, init, dpopPayload) {\n // if there is not session established, just delegate to the default fetch\n if (!this.isActive) {\n return fetch(input, init);\n }\n // TODO\n // TODO do HEAD request to check if authentication is actually required, only then include tokens\n // TODO\n // prepare authenticated call using a DPoP token (either provided payload, or default)\n let url;\n let method;\n let headers;\n // wrangle fetch input parameters into place\n if (input instanceof Request) {\n url = new URL(input.url);\n method = init?.method || input?.method || 'GET';\n headers = new Headers(input.headers);\n }\n else {\n init = init || {};\n url = new URL(input.toString());\n method = init.method || 'GET';\n headers = init.headers ? new Headers(init.headers) : new Headers();\n }\n // create DPoP token, and add tokens to request\n await this._renewTokensIfExpired();\n dpopPayload = dpopPayload ?? {\n htu: `${url.origin}${url.pathname}`,\n htm: method.toUpperCase()\n };\n const dpop = await this._createSignedDPoPToken(dpopPayload);\n // overwrite headers: authorization, dpop\n headers.set(\"dpop\", dpop);\n headers.set(\"authorization\", `DPoP ${this.information.tokenDetails.access_token}`);\n // check explicitly; to avoid unexpected behaviour\n if (input instanceof Request) { // clone the provided request, and override the headers\n return fetch(new Request(input, { ...init, headers }));\n }\n // just override the headers\n return fetch(url, { ...init, headers });\n }\n // \n // Setters\n //\n async setTokenDetails(tokenDetails) {\n this.information.tokenDetails = tokenDetails;\n await this._updateSessionDetailsFromToken(tokenDetails.access_token);\n }\n clearRefreshPromise() {\n this.refreshPromise = undefined;\n this.resolveRefresh = undefined;\n this.rejectRefresh = undefined;\n }\n //\n // Getters\n //\n get isActive() {\n return this.isActive_;\n }\n get webId() {\n return this.webId_;\n }\n isExpired() {\n if (!this.exp_)\n return true;\n return this._isTokenExpired(this.exp_);\n }\n getExpiresIn() {\n if (!this.exp_)\n return -1;\n return this._getTokenTTL(this.exp_);\n }\n getTokenDetails() {\n return this.information.tokenDetails;\n }\n //\n // Helpers\n //\n /**\n * Check if the current token is expired (which may happen during device/browser/tab hibernation),\n * and if expired, restore the session.\n */\n async _renewTokensIfExpired() {\n if (this.isExpired()) {\n if (!this.refreshPromise) {\n await this.restore(); // Initiate and wait\n }\n else {\n await this.refreshPromise; // Wait for already pending\n }\n }\n }\n /**\n * RFC 9449 - Hash of the access token\n */\n async _computeAth(accessToken) {\n // Convert the ASCII string of the token to a Uint8Array\n const encoder = new TextEncoder();\n const data = encoder.encode(accessToken); // ASCII by default\n // Compute SHA-256 hash\n const hashBuffer = await crypto.subtle.digest('SHA-256', data);\n // Convert ArrayBuffer to base64url string\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const base64 = btoa(String.fromCharCode(...hashArray));\n // Convert base64 to base64url\n const base64url = base64\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n return base64url;\n }\n /**\n * Creates a signed DPoP (Demonstration of Proof-of-Possession) token.\n *\n * @param payload The payload to include in the DPoP token. By default, it includes `htu` (HTTP target URI) and `htm` (HTTP method).\n * @returns A promise that resolves to the signed DPoP token string.\n * @throws Error if the session has not been initialized - if no token details are available.\n */\n async _createSignedDPoPToken(payload) {\n if (!this.information.tokenDetails || !this.currentAth_) {\n throw new Error(\"Session not established.\");\n }\n payload.ath = this.currentAth_;\n const jwk_public_key = await exportJWK(this.information.tokenDetails.dpop_key_pair.publicKey);\n return new SignJWT(payload)\n .setIssuedAt()\n .setJti(window.crypto.randomUUID())\n .setProtectedHeader({\n alg: \"ES256\",\n typ: \"dpop+jwt\",\n jwk: jwk_public_key,\n })\n .sign(this.information.tokenDetails.dpop_key_pair.privateKey);\n }\n async _updateSessionDetailsFromToken(access_token) {\n if (!access_token) {\n await this.logout();\n return;\n }\n try {\n const decodedToken = decodeJwt(access_token);\n const webId = decodedToken.webid;\n if (!webId) {\n throw new Error('Missing webid claim in access token');\n }\n const exp = decodedToken.exp;\n if (!exp) {\n throw new Error('Missing exp claim in access token');\n }\n this.currentAth_ = await this._computeAth(access_token); // must be done before session set to active\n this.webId_ = webId;\n this.exp_ = exp;\n this.isActive_ = true;\n }\n catch (error) {\n await this.logout();\n }\n }\n /**\n * Checks if a JWT expiration timestamp ('exp') has passed.\n */\n _isTokenExpired(exp, bufferSeconds = 0) {\n if (typeof exp !== 'number' || isNaN(exp)) {\n return true;\n }\n return this._getTokenTTL(exp, bufferSeconds) < 0;\n }\n _getTokenTTL(exp, bufferSeconds = 0) {\n const currentTimeSeconds = Math.floor(Date.now() / 1000);\n return exp - (currentTimeSeconds + bufferSeconds);\n }\n // \n // Events\n //\n dispatchStateChangeEvent() {\n this.dispatchEvent(new CustomEvent(SessionEvents.STATE_CHANGE, { detail: { isActive: this.isActive, webId: this.webId } }));\n }\n dispatchExpirationWarningEvent() {\n this.dispatchEvent(new CustomEvent(SessionEvents.EXPIRATION_WARNING, { detail: { expires_in: this.getExpiresIn() } }));\n }\n dispatchExpirationEvent() {\n this.dispatchEvent(new CustomEvent(SessionEvents.EXPIRATION));\n }\n}\n\n// extracting this from Session.ts such that the jest tests would compile :)\nconst getWorkerUrl = () => new URL('./RefreshWorker.js', import.meta.url);\n\nvar RefreshMessageTypes;\n(function (RefreshMessageTypes) {\n RefreshMessageTypes[\"SCHEDULE\"] = \"SCHEDULE\";\n RefreshMessageTypes[\"REFRESH\"] = \"REFRESH\";\n RefreshMessageTypes[\"STOP\"] = \"STOP\";\n RefreshMessageTypes[\"DISCONNECT\"] = \"DISCONNECT\";\n RefreshMessageTypes[\"TOKEN_DETAILS\"] = \"TOKEN_DETAILS\";\n RefreshMessageTypes[\"ERROR_ON_REFRESH\"] = \"ERROR_ON_REFRESH\";\n RefreshMessageTypes[\"EXPIRED\"] = \"EXPIRED\";\n})(RefreshMessageTypes || (RefreshMessageTypes = {}));\n\n/**\n * A simple IndexedDB wrapper.\n */\nclass SessionIDB {\n dbName;\n storeName;\n dbVersion;\n db = null;\n /**\n * Creates a new instance\n * @param dbName The name of the IndexedDB database\n * @param storeName The name of the object store\n * @param dbVersion The database version\n */\n constructor(dbName = 'soidc', storeName = 'session', dbVersion = 1) {\n this.dbName = dbName;\n this.storeName = storeName;\n this.dbVersion = dbVersion;\n }\n /**\n * Initializes the IndexedDB database\n * @returns Promise that resolves when the database is ready\n */\n async init() {\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(this.dbName, this.dbVersion);\n request.onerror = (event) => {\n reject(new Error(`Database error: ${event.target.error}`));\n };\n request.onsuccess = (event) => {\n this.db = event.target.result;\n resolve(this);\n };\n request.onupgradeneeded = (event) => {\n const db = event.target.result;\n // Check if the object store already exists, if not create it\n if (!db.objectStoreNames.contains(this.storeName)) {\n db.createObjectStore(this.storeName);\n }\n };\n });\n }\n /**\n * Stores any value in the database with the given ID as key\n * @param id The identifier/key for the value\n * @param value The value to store\n */\n async setItem(id, value) {\n if (!this.db) {\n await this.init();\n }\n return new Promise((resolve, reject) => {\n const transaction = this.db.transaction(this.storeName, 'readwrite');\n // Handle transation\n transaction.oncomplete = () => {\n resolve();\n };\n transaction.onerror = (event) => {\n reject(new Error(`Transaction error for setItem(${id},...): ${event.target.error}`));\n };\n transaction.onabort = (event) => {\n reject(new Error(`Transaction aborted for setItem(${id},...): ${event.target.error}`));\n };\n // Perform the request within the transaction\n const store = transaction.objectStore(this.storeName);\n store.put(value, id);\n });\n }\n /**\n * Retrieves a value from the database by ID\n * @param id The identifier/key for the value\n * @returns The stored value or null if not found\n */\n async getItem(id) {\n if (!this.db) {\n await this.init();\n }\n return new Promise((resolve, reject) => {\n const transaction = this.db.transaction(this.storeName, 'readonly');\n // Handle transation\n transaction.onerror = (event) => {\n reject(new Error(`Transaction error for getItem(${id}): ${event.target.error}`));\n };\n transaction.onabort = (event) => {\n reject(new Error(`Transaction aborted for getItem(${id}): ${event.target.error}`));\n };\n // Perform the request within the transaction\n const store = transaction.objectStore(this.storeName);\n const request = store.get(id);\n request.onsuccess = () => {\n resolve(request.result || null);\n };\n });\n }\n /**\n * Removes an item from the database\n * @param id The identifier of the item to remove\n */\n async deleteItem(id) {\n if (!this.db) {\n await this.init();\n }\n return new Promise((resolve, reject) => {\n const transaction = this.db.transaction(this.storeName, 'readwrite');\n // Handle transation\n transaction.oncomplete = () => {\n resolve();\n };\n transaction.onerror = (event) => {\n reject(new Error(`Transaction error for deleteItem(${id}): ${event.target.error}`));\n };\n transaction.onabort = (event) => {\n reject(new Error(`Transaction aborted for deleteItem(${id}): ${event.target.error}`));\n };\n // Perform the request within the transaction\n const store = transaction.objectStore(this.storeName);\n store.delete(id);\n });\n }\n /**\n * Clears all items from the database\n */\n async clear() {\n if (!this.db) {\n await this.init();\n }\n return new Promise((resolve, reject) => {\n const transaction = this.db.transaction(this.storeName, 'readwrite');\n // Handle transation\n transaction.oncomplete = () => {\n resolve();\n };\n transaction.onerror = (event) => {\n reject(new Error(`Transaction error for clear(): ${event.target.error}`));\n };\n transaction.onabort = (event) => {\n reject(new Error(`Transaction aborted for clear(): ${event.target.error}`));\n };\n // Perform the request within the transaction\n const store = transaction.objectStore(this.storeName);\n store.clear();\n });\n }\n /**\n * Closes the database connection\n */\n close() {\n if (this.db) {\n this.db.close();\n this.db = null;\n }\n }\n}\n\n/**\n * This Session provides background token refreshing using a Web Worker.\n */\nclass WebWorkerSession extends SessionCore {\n worker;\n constructor(clientDetails, sessionOptions) {\n const database = new SessionIDB();\n const options = { ...sessionOptions, database };\n super(clientDetails, options);\n // Allow consumer to provide worker URL, or use default\n const workerUrl = sessionOptions?.workerUrl ?? getWorkerUrl();\n this.worker = new SharedWorker(workerUrl, { type: 'module' });\n this.worker.port.onmessage = (event) => {\n this.handleWorkerMessage(event.data).catch(console.error);\n };\n window.addEventListener('beforeunload', () => {\n this.worker.port.postMessage({ type: RefreshMessageTypes.DISCONNECT });\n });\n }\n async handleWorkerMessage(data) {\n const { type, payload, error } = data;\n switch (type) {\n case RefreshMessageTypes.TOKEN_DETAILS:\n const wasActive = this.isActive;\n await this.setTokenDetails(payload.tokenDetails);\n if (wasActive !== this.isActive)\n this.dispatchStateChangeEvent();\n if (this.refreshPromise && this.resolveRefresh) {\n this.resolveRefresh();\n this.clearRefreshPromise();\n }\n break;\n case RefreshMessageTypes.ERROR_ON_REFRESH:\n if (this.isActive)\n this.dispatchExpirationWarningEvent();\n if (this.refreshPromise && this.rejectRefresh) {\n if (this.isActive) {\n this.rejectRefresh(new Error(error || 'Token refresh failed'));\n }\n else {\n this.rejectRefresh(new Error(\"No session to restore\"));\n }\n this.clearRefreshPromise();\n }\n break;\n case RefreshMessageTypes.EXPIRED:\n if (this.isActive) {\n this.dispatchExpirationEvent();\n await this.logout();\n }\n if (this.refreshPromise && this.rejectRefresh) {\n this.rejectRefresh(new Error(error || 'Token refresh failed'));\n this.clearRefreshPromise();\n }\n break;\n }\n }\n ;\n async handleRedirectFromLogin() {\n await super.handleRedirectFromLogin();\n if (this.isActive) { // If login was successful, tell the worker to schedule refreshing\n this.worker.port.postMessage({\n type: RefreshMessageTypes.SCHEDULE,\n payload: { ...this.getTokenDetails(), expires_in: this.getExpiresIn() }\n });\n }\n }\n async restore() {\n if (this.refreshPromise) {\n return this.refreshPromise;\n }\n this.refreshPromise = new Promise((resolve, reject) => {\n this.resolveRefresh = resolve;\n this.rejectRefresh = reject;\n });\n this.worker.port.postMessage({ type: RefreshMessageTypes.REFRESH });\n return this.refreshPromise;\n }\n async logout() {\n this.worker.port.postMessage({ type: RefreshMessageTypes.STOP });\n await super.logout();\n }\n}\n\nexport { WebWorkerSession as Session, SessionEvents, SessionIDB };\n//# sourceMappingURL=index.js.map\n","var crypto$1 = crypto;\nconst isCryptoKey = (key) => key instanceof CryptoKey;\n\nconst digest = async (algorithm, data) => {\n const subtleDigest = `SHA-${algorithm.slice(-3)}`;\n return new Uint8Array(await crypto$1.subtle.digest(subtleDigest, data));\n};\nvar digest$1 = digest;\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\nfunction concat(...buffers) {\n const size = buffers.reduce((acc, { length }) => acc + length, 0);\n const buf = new Uint8Array(size);\n let i = 0;\n for (const buffer of buffers) {\n buf.set(buffer, i);\n i += buffer.length;\n }\n return buf;\n}\n\nconst encodeBase64 = (input) => {\n let unencoded = input;\n if (typeof unencoded === 'string') {\n unencoded = encoder.encode(unencoded);\n }\n const CHUNK_SIZE = 0x8000;\n const arr = [];\n for (let i = 0; i < unencoded.length; i += CHUNK_SIZE) {\n arr.push(String.fromCharCode.apply(null, unencoded.subarray(i, i + CHUNK_SIZE)));\n }\n return btoa(arr.join(''));\n};\nconst encode = (input) => {\n return encodeBase64(input).replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n};\nconst decodeBase64 = (encoded) => {\n const binary = atob(encoded);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return bytes;\n};\nconst decode$1 = (input) => {\n let encoded = input;\n if (encoded instanceof Uint8Array) {\n encoded = decoder.decode(encoded);\n }\n encoded = encoded.replace(/-/g, '+').replace(/_/g, '/').replace(/\\s/g, '');\n try {\n return decodeBase64(encoded);\n }\n catch {\n throw new TypeError('The input to be decoded is not correctly encoded.');\n }\n};\n\nclass JOSEError extends Error {\n constructor(message, options) {\n super(message, options);\n this.code = 'ERR_JOSE_GENERIC';\n this.name = this.constructor.name;\n Error.captureStackTrace?.(this, this.constructor);\n }\n}\nJOSEError.code = 'ERR_JOSE_GENERIC';\nclass JWTClaimValidationFailed extends JOSEError {\n constructor(message, payload, claim = 'unspecified', reason = 'unspecified') {\n super(message, { cause: { claim, reason, payload } });\n this.code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';\n this.claim = claim;\n this.reason = reason;\n this.payload = payload;\n }\n}\nJWTClaimValidationFailed.code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';\nclass JWTExpired extends JOSEError {\n constructor(message, payload, claim = 'unspecified', reason = 'unspecified') {\n super(message, { cause: { claim, reason, payload } });\n this.code = 'ERR_JWT_EXPIRED';\n this.claim = claim;\n this.reason = reason;\n this.payload = payload;\n }\n}\nJWTExpired.code = 'ERR_JWT_EXPIRED';\nclass JOSEAlgNotAllowed extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JOSE_ALG_NOT_ALLOWED';\n }\n}\nJOSEAlgNotAllowed.code = 'ERR_JOSE_ALG_NOT_ALLOWED';\nclass JOSENotSupported extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JOSE_NOT_SUPPORTED';\n }\n}\nJOSENotSupported.code = 'ERR_JOSE_NOT_SUPPORTED';\nclass JWEDecryptionFailed extends JOSEError {\n constructor(message = 'decryption operation failed', options) {\n super(message, options);\n this.code = 'ERR_JWE_DECRYPTION_FAILED';\n }\n}\nJWEDecryptionFailed.code = 'ERR_JWE_DECRYPTION_FAILED';\nclass JWEInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWE_INVALID';\n }\n}\nJWEInvalid.code = 'ERR_JWE_INVALID';\nclass JWSInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWS_INVALID';\n }\n}\nJWSInvalid.code = 'ERR_JWS_INVALID';\nclass JWTInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWT_INVALID';\n }\n}\nJWTInvalid.code = 'ERR_JWT_INVALID';\nclass JWKInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWK_INVALID';\n }\n}\nJWKInvalid.code = 'ERR_JWK_INVALID';\nclass JWKSInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWKS_INVALID';\n }\n}\nJWKSInvalid.code = 'ERR_JWKS_INVALID';\nclass JWKSNoMatchingKey extends JOSEError {\n constructor(message = 'no applicable key found in the JSON Web Key Set', options) {\n super(message, options);\n this.code = 'ERR_JWKS_NO_MATCHING_KEY';\n }\n}\nJWKSNoMatchingKey.code = 'ERR_JWKS_NO_MATCHING_KEY';\nclass JWKSMultipleMatchingKeys extends JOSEError {\n constructor(message = 'multiple matching keys found in the JSON Web Key Set', options) {\n super(message, options);\n this.code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';\n }\n}\nJWKSMultipleMatchingKeys.code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';\nclass JWKSTimeout extends JOSEError {\n constructor(message = 'request timed out', options) {\n super(message, options);\n this.code = 'ERR_JWKS_TIMEOUT';\n }\n}\nJWKSTimeout.code = 'ERR_JWKS_TIMEOUT';\nclass JWSSignatureVerificationFailed extends JOSEError {\n constructor(message = 'signature verification failed', options) {\n super(message, options);\n this.code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';\n }\n}\nJWSSignatureVerificationFailed.code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';\n\nfunction unusable(name, prop = 'algorithm.name') {\n return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);\n}\nfunction isAlgorithm(algorithm, name) {\n return algorithm.name === name;\n}\nfunction getHashLength(hash) {\n return parseInt(hash.name.slice(4), 10);\n}\nfunction getNamedCurve(alg) {\n switch (alg) {\n case 'ES256':\n return 'P-256';\n case 'ES384':\n return 'P-384';\n case 'ES512':\n return 'P-521';\n default:\n throw new Error('unreachable');\n }\n}\nfunction checkUsage(key, usages) {\n if (usages.length && !usages.some((expected) => key.usages.includes(expected))) {\n let msg = 'CryptoKey does not support this operation, its usages must include ';\n if (usages.length > 2) {\n const last = usages.pop();\n msg += `one of ${usages.join(', ')}, or ${last}.`;\n }\n else if (usages.length === 2) {\n msg += `one of ${usages[0]} or ${usages[1]}.`;\n }\n else {\n msg += `${usages[0]}.`;\n }\n throw new TypeError(msg);\n }\n}\nfunction checkSigCryptoKey(key, alg, ...usages) {\n switch (alg) {\n case 'HS256':\n case 'HS384':\n case 'HS512': {\n if (!isAlgorithm(key.algorithm, 'HMAC'))\n throw unusable('HMAC');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'RS256':\n case 'RS384':\n case 'RS512': {\n if (!isAlgorithm(key.algorithm, 'RSASSA-PKCS1-v1_5'))\n throw unusable('RSASSA-PKCS1-v1_5');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'PS256':\n case 'PS384':\n case 'PS512': {\n if (!isAlgorithm(key.algorithm, 'RSA-PSS'))\n throw unusable('RSA-PSS');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'EdDSA': {\n if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') {\n throw unusable('Ed25519 or Ed448');\n }\n break;\n }\n case 'Ed25519': {\n if (!isAlgorithm(key.algorithm, 'Ed25519'))\n throw unusable('Ed25519');\n break;\n }\n case 'ES256':\n case 'ES384':\n case 'ES512': {\n if (!isAlgorithm(key.algorithm, 'ECDSA'))\n throw unusable('ECDSA');\n const expected = getNamedCurve(alg);\n const actual = key.algorithm.namedCurve;\n if (actual !== expected)\n throw unusable(expected, 'algorithm.namedCurve');\n break;\n }\n default:\n throw new TypeError('CryptoKey does not support this operation');\n }\n checkUsage(key, usages);\n}\n\nfunction message(msg, actual, ...types) {\n types = types.filter(Boolean);\n if (types.length > 2) {\n const last = types.pop();\n msg += `one of type ${types.join(', ')}, or ${last}.`;\n }\n else if (types.length === 2) {\n msg += `one of type ${types[0]} or ${types[1]}.`;\n }\n else {\n msg += `of type ${types[0]}.`;\n }\n if (actual == null) {\n msg += ` Received ${actual}`;\n }\n else if (typeof actual === 'function' && actual.name) {\n msg += ` Received function ${actual.name}`;\n }\n else if (typeof actual === 'object' && actual != null) {\n if (actual.constructor?.name) {\n msg += ` Received an instance of ${actual.constructor.name}`;\n }\n }\n return msg;\n}\nvar invalidKeyInput = (actual, ...types) => {\n return message('Key must be ', actual, ...types);\n};\nfunction withAlg(alg, actual, ...types) {\n return message(`Key for the ${alg} algorithm must be `, actual, ...types);\n}\n\nvar isKeyLike = (key) => {\n if (isCryptoKey(key)) {\n return true;\n }\n return key?.[Symbol.toStringTag] === 'KeyObject';\n};\nconst types = ['CryptoKey'];\n\nconst isDisjoint = (...headers) => {\n const sources = headers.filter(Boolean);\n if (sources.length === 0 || sources.length === 1) {\n return true;\n }\n let acc;\n for (const header of sources) {\n const parameters = Object.keys(header);\n if (!acc || acc.size === 0) {\n acc = new Set(parameters);\n continue;\n }\n for (const parameter of parameters) {\n if (acc.has(parameter)) {\n return false;\n }\n acc.add(parameter);\n }\n }\n return true;\n};\nvar isDisjoint$1 = isDisjoint;\n\nfunction isObjectLike(value) {\n return typeof value === 'object' && value !== null;\n}\nfunction isObject(input) {\n if (!isObjectLike(input) || Object.prototype.toString.call(input) !== '[object Object]') {\n return false;\n }\n if (Object.getPrototypeOf(input) === null) {\n return true;\n }\n let proto = input;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(input) === proto;\n}\n\nvar checkKeyLength = (alg, key) => {\n if (alg.startsWith('RS') || alg.startsWith('PS')) {\n const { modulusLength } = key.algorithm;\n if (typeof modulusLength !== 'number' || modulusLength < 2048) {\n throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);\n }\n }\n};\n\nfunction isJWK(key) {\n return isObject(key) && typeof key.kty === 'string';\n}\nfunction isPrivateJWK(key) {\n return key.kty !== 'oct' && typeof key.d === 'string';\n}\nfunction isPublicJWK(key) {\n return key.kty !== 'oct' && typeof key.d === 'undefined';\n}\nfunction isSecretJWK(key) {\n return isJWK(key) && key.kty === 'oct' && typeof key.k === 'string';\n}\n\nfunction subtleMapping(jwk) {\n let algorithm;\n let keyUsages;\n switch (jwk.kty) {\n case 'RSA': {\n switch (jwk.alg) {\n case 'PS256':\n case 'PS384':\n case 'PS512':\n algorithm = { name: 'RSA-PSS', hash: `SHA-${jwk.alg.slice(-3)}` };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'RS256':\n case 'RS384':\n case 'RS512':\n algorithm = { name: 'RSASSA-PKCS1-v1_5', hash: `SHA-${jwk.alg.slice(-3)}` };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'RSA-OAEP':\n case 'RSA-OAEP-256':\n case 'RSA-OAEP-384':\n case 'RSA-OAEP-512':\n algorithm = {\n name: 'RSA-OAEP',\n hash: `SHA-${parseInt(jwk.alg.slice(-3), 10) || 1}`,\n };\n keyUsages = jwk.d ? ['decrypt', 'unwrapKey'] : ['encrypt', 'wrapKey'];\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n break;\n }\n case 'EC': {\n switch (jwk.alg) {\n case 'ES256':\n algorithm = { name: 'ECDSA', namedCurve: 'P-256' };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'ES384':\n algorithm = { name: 'ECDSA', namedCurve: 'P-384' };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'ES512':\n algorithm = { name: 'ECDSA', namedCurve: 'P-521' };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'ECDH-ES':\n case 'ECDH-ES+A128KW':\n case 'ECDH-ES+A192KW':\n case 'ECDH-ES+A256KW':\n algorithm = { name: 'ECDH', namedCurve: jwk.crv };\n keyUsages = jwk.d ? ['deriveBits'] : [];\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n break;\n }\n case 'OKP': {\n switch (jwk.alg) {\n case 'Ed25519':\n algorithm = { name: 'Ed25519' };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'EdDSA':\n algorithm = { name: jwk.crv };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'ECDH-ES':\n case 'ECDH-ES+A128KW':\n case 'ECDH-ES+A192KW':\n case 'ECDH-ES+A256KW':\n algorithm = { name: jwk.crv };\n keyUsages = jwk.d ? ['deriveBits'] : [];\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n break;\n }\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"kty\" (Key Type) Parameter value');\n }\n return { algorithm, keyUsages };\n}\nconst parse = async (jwk) => {\n if (!jwk.alg) {\n throw new TypeError('\"alg\" argument is required when \"jwk.alg\" is not present');\n }\n const { algorithm, keyUsages } = subtleMapping(jwk);\n const rest = [\n algorithm,\n jwk.ext ?? false,\n jwk.key_ops ?? keyUsages,\n ];\n const keyData = { ...jwk };\n delete keyData.alg;\n delete keyData.use;\n return crypto$1.subtle.importKey('jwk', keyData, ...rest);\n};\nvar asKeyObject = parse;\n\nconst exportKeyValue = (k) => decode$1(k);\nlet privCache;\nlet pubCache;\nconst isKeyObject = (key) => {\n return key?.[Symbol.toStringTag] === 'KeyObject';\n};\nconst importAndCache = async (cache, key, jwk, alg, freeze = false) => {\n let cached = cache.get(key);\n if (cached?.[alg]) {\n return cached[alg];\n }\n const cryptoKey = await asKeyObject({ ...jwk, alg });\n if (freeze)\n Object.freeze(key);\n if (!cached) {\n cache.set(key, { [alg]: cryptoKey });\n }\n else {\n cached[alg] = cryptoKey;\n }\n return cryptoKey;\n};\nconst normalizePublicKey = (key, alg) => {\n if (isKeyObject(key)) {\n let jwk = key.export({ format: 'jwk' });\n delete jwk.d;\n delete jwk.dp;\n delete jwk.dq;\n delete jwk.p;\n delete jwk.q;\n delete jwk.qi;\n if (jwk.k) {\n return exportKeyValue(jwk.k);\n }\n pubCache || (pubCache = new WeakMap());\n return importAndCache(pubCache, key, jwk, alg);\n }\n if (isJWK(key)) {\n if (key.k)\n return decode$1(key.k);\n pubCache || (pubCache = new WeakMap());\n const cryptoKey = importAndCache(pubCache, key, key, alg, true);\n return cryptoKey;\n }\n return key;\n};\nconst normalizePrivateKey = (key, alg) => {\n if (isKeyObject(key)) {\n let jwk = key.export({ format: 'jwk' });\n if (jwk.k) {\n return exportKeyValue(jwk.k);\n }\n privCache || (privCache = new WeakMap());\n return importAndCache(privCache, key, jwk, alg);\n }\n if (isJWK(key)) {\n if (key.k)\n return decode$1(key.k);\n privCache || (privCache = new WeakMap());\n const cryptoKey = importAndCache(privCache, key, key, alg, true);\n return cryptoKey;\n }\n return key;\n};\nvar normalize = { normalizePublicKey, normalizePrivateKey };\n\nasync function importJWK(jwk, alg) {\n if (!isObject(jwk)) {\n throw new TypeError('JWK must be an object');\n }\n alg || (alg = jwk.alg);\n switch (jwk.kty) {\n case 'oct':\n if (typeof jwk.k !== 'string' || !jwk.k) {\n throw new TypeError('missing \"k\" (Key Value) Parameter value');\n }\n return decode$1(jwk.k);\n case 'RSA':\n if ('oth' in jwk && jwk.oth !== undefined) {\n throw new JOSENotSupported('RSA JWK \"oth\" (Other Primes Info) Parameter value is not supported');\n }\n case 'EC':\n case 'OKP':\n return asKeyObject({ ...jwk, alg });\n default:\n throw new JOSENotSupported('Unsupported \"kty\" (Key Type) Parameter value');\n }\n}\n\nconst tag = (key) => key?.[Symbol.toStringTag];\nconst jwkMatchesOp = (alg, key, usage) => {\n if (key.use !== undefined && key.use !== 'sig') {\n throw new TypeError('Invalid key for this operation, when present its use must be sig');\n }\n if (key.key_ops !== undefined && key.key_ops.includes?.(usage) !== true) {\n throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage}`);\n }\n if (key.alg !== undefined && key.alg !== alg) {\n throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);\n }\n return true;\n};\nconst symmetricTypeCheck = (alg, key, usage, allowJwk) => {\n if (key instanceof Uint8Array)\n return;\n if (allowJwk && isJWK(key)) {\n if (isSecretJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK \"kty\" (Key Type) equal to \"oct\" and the JWK \"k\" (Key Value) present`);\n }\n if (!isKeyLike(key)) {\n throw new TypeError(withAlg(alg, key, ...types, 'Uint8Array', allowJwk ? 'JSON Web Key' : null));\n }\n if (key.type !== 'secret') {\n throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type \"secret\"`);\n }\n};\nconst asymmetricTypeCheck = (alg, key, usage, allowJwk) => {\n if (allowJwk && isJWK(key)) {\n switch (usage) {\n case 'sign':\n if (isPrivateJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for this operation be a private JWK`);\n case 'verify':\n if (isPublicJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for this operation be a public JWK`);\n }\n }\n if (!isKeyLike(key)) {\n throw new TypeError(withAlg(alg, key, ...types, allowJwk ? 'JSON Web Key' : null));\n }\n if (key.type === 'secret') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type \"secret\"`);\n }\n if (usage === 'sign' && key.type === 'public') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type \"private\"`);\n }\n if (usage === 'decrypt' && key.type === 'public') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type \"private\"`);\n }\n if (key.algorithm && usage === 'verify' && key.type === 'private') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type \"public\"`);\n }\n if (key.algorithm && usage === 'encrypt' && key.type === 'private') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type \"public\"`);\n }\n};\nfunction checkKeyType(allowJwk, alg, key, usage) {\n const symmetric = alg.startsWith('HS') ||\n alg === 'dir' ||\n alg.startsWith('PBES2') ||\n /^A\\d{3}(?:GCM)?KW$/.test(alg);\n if (symmetric) {\n symmetricTypeCheck(alg, key, usage, allowJwk);\n }\n else {\n asymmetricTypeCheck(alg, key, usage, allowJwk);\n }\n}\ncheckKeyType.bind(undefined, false);\nconst checkKeyTypeWithJwk = checkKeyType.bind(undefined, true);\n\nfunction validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {\n if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) {\n throw new Err('\"crit\" (Critical) Header Parameter MUST be integrity protected');\n }\n if (!protectedHeader || protectedHeader.crit === undefined) {\n return new Set();\n }\n if (!Array.isArray(protectedHeader.crit) ||\n protectedHeader.crit.length === 0 ||\n protectedHeader.crit.some((input) => typeof input !== 'string' || input.length === 0)) {\n throw new Err('\"crit\" (Critical) Header Parameter MUST be an array of non-empty strings when present');\n }\n let recognized;\n if (recognizedOption !== undefined) {\n recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);\n }\n else {\n recognized = recognizedDefault;\n }\n for (const parameter of protectedHeader.crit) {\n if (!recognized.has(parameter)) {\n throw new JOSENotSupported(`Extension Header Parameter \"${parameter}\" is not recognized`);\n }\n if (joseHeader[parameter] === undefined) {\n throw new Err(`Extension Header Parameter \"${parameter}\" is missing`);\n }\n if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {\n throw new Err(`Extension Header Parameter \"${parameter}\" MUST be integrity protected`);\n }\n }\n return new Set(protectedHeader.crit);\n}\n\nconst validateAlgorithms = (option, algorithms) => {\n if (algorithms !== undefined &&\n (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== 'string'))) {\n throw new TypeError(`\"${option}\" option must be an array of strings`);\n }\n if (!algorithms) {\n return undefined;\n }\n return new Set(algorithms);\n};\nvar validateAlgorithms$1 = validateAlgorithms;\n\nconst keyToJWK = async (key) => {\n if (key instanceof Uint8Array) {\n return {\n kty: 'oct',\n k: encode(key),\n };\n }\n if (!isCryptoKey(key)) {\n throw new TypeError(invalidKeyInput(key, ...types, 'Uint8Array'));\n }\n if (!key.extractable) {\n throw new TypeError('non-extractable CryptoKey cannot be exported as a JWK');\n }\n const { ext, key_ops, alg, use, ...jwk } = await crypto$1.subtle.exportKey('jwk', key);\n return jwk;\n};\nvar keyToJWK$1 = keyToJWK;\n\nasync function exportJWK(key) {\n return keyToJWK$1(key);\n}\n\nfunction subtleDsa(alg, algorithm) {\n const hash = `SHA-${alg.slice(-3)}`;\n switch (alg) {\n case 'HS256':\n case 'HS384':\n case 'HS512':\n return { hash, name: 'HMAC' };\n case 'PS256':\n case 'PS384':\n case 'PS512':\n return { hash, name: 'RSA-PSS', saltLength: alg.slice(-3) >> 3 };\n case 'RS256':\n case 'RS384':\n case 'RS512':\n return { hash, name: 'RSASSA-PKCS1-v1_5' };\n case 'ES256':\n case 'ES384':\n case 'ES512':\n return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve };\n case 'Ed25519':\n return { name: 'Ed25519' };\n case 'EdDSA':\n return { name: algorithm.name };\n default:\n throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);\n }\n}\n\nasync function getCryptoKey(alg, key, usage) {\n if (usage === 'sign') {\n key = await normalize.normalizePrivateKey(key, alg);\n }\n if (usage === 'verify') {\n key = await normalize.normalizePublicKey(key, alg);\n }\n if (isCryptoKey(key)) {\n checkSigCryptoKey(key, alg, usage);\n return key;\n }\n if (key instanceof Uint8Array) {\n if (!alg.startsWith('HS')) {\n throw new TypeError(invalidKeyInput(key, ...types));\n }\n return crypto$1.subtle.importKey('raw', key, { hash: `SHA-${alg.slice(-3)}`, name: 'HMAC' }, false, [usage]);\n }\n throw new TypeError(invalidKeyInput(key, ...types, 'Uint8Array', 'JSON Web Key'));\n}\n\nconst verify = async (alg, key, signature, data) => {\n const cryptoKey = await getCryptoKey(alg, key, 'verify');\n checkKeyLength(alg, cryptoKey);\n const algorithm = subtleDsa(alg, cryptoKey.algorithm);\n try {\n return await crypto$1.subtle.verify(algorithm, cryptoKey, signature, data);\n }\n catch {\n return false;\n }\n};\nvar verify$1 = verify;\n\nasync function flattenedVerify(jws, key, options) {\n if (!isObject(jws)) {\n throw new JWSInvalid('Flattened JWS must be an object');\n }\n if (jws.protected === undefined && jws.header === undefined) {\n throw new JWSInvalid('Flattened JWS must have either of the \"protected\" or \"header\" members');\n }\n if (jws.protected !== undefined && typeof jws.protected !== 'string') {\n throw new JWSInvalid('JWS Protected Header incorrect type');\n }\n if (jws.payload === undefined) {\n throw new JWSInvalid('JWS Payload missing');\n }\n if (typeof jws.signature !== 'string') {\n throw new JWSInvalid('JWS Signature missing or incorrect type');\n }\n if (jws.header !== undefined && !isObject(jws.header)) {\n throw new JWSInvalid('JWS Unprotected Header incorrect type');\n }\n let parsedProt = {};\n if (jws.protected) {\n try {\n const protectedHeader = decode$1(jws.protected);\n parsedProt = JSON.parse(decoder.decode(protectedHeader));\n }\n catch {\n throw new JWSInvalid('JWS Protected Header is invalid');\n }\n }\n if (!isDisjoint$1(parsedProt, jws.header)) {\n throw new JWSInvalid('JWS Protected and JWS Unprotected Header Parameter names must be disjoint');\n }\n const joseHeader = {\n ...parsedProt,\n ...jws.header,\n };\n const extensions = validateCrit(JWSInvalid, new Map([['b64', true]]), options?.crit, parsedProt, joseHeader);\n let b64 = true;\n if (extensions.has('b64')) {\n b64 = parsedProt.b64;\n if (typeof b64 !== 'boolean') {\n throw new JWSInvalid('The \"b64\" (base64url-encode payload) Header Parameter must be a boolean');\n }\n }\n const { alg } = joseHeader;\n if (typeof alg !== 'string' || !alg) {\n throw new JWSInvalid('JWS \"alg\" (Algorithm) Header Parameter missing or invalid');\n }\n const algorithms = options && validateAlgorithms$1('algorithms', options.algorithms);\n if (algorithms && !algorithms.has(alg)) {\n throw new JOSEAlgNotAllowed('\"alg\" (Algorithm) Header Parameter value not allowed');\n }\n if (b64) {\n if (typeof jws.payload !== 'string') {\n throw new JWSInvalid('JWS Payload must be a string');\n }\n }\n else if (typeof jws.payload !== 'string' && !(jws.payload instanceof Uint8Array)) {\n throw new JWSInvalid('JWS Payload must be a string or an Uint8Array instance');\n }\n let resolvedKey = false;\n if (typeof key === 'function') {\n key = await key(parsedProt, jws);\n resolvedKey = true;\n checkKeyTypeWithJwk(alg, key, 'verify');\n if (isJWK(key)) {\n key = await importJWK(key, alg);\n }\n }\n else {\n checkKeyTypeWithJwk(alg, key, 'verify');\n }\n const data = concat(encoder.encode(jws.protected ?? ''), encoder.encode('.'), typeof jws.payload === 'string' ? encoder.encode(jws.payload) : jws.payload);\n let signature;\n try {\n signature = decode$1(jws.signature);\n }\n catch {\n throw new JWSInvalid('Failed to base64url decode the signature');\n }\n const verified = await verify$1(alg, key, signature, data);\n if (!verified) {\n throw new JWSSignatureVerificationFailed();\n }\n let payload;\n if (b64) {\n try {\n payload = decode$1(jws.payload);\n }\n catch {\n throw new JWSInvalid('Failed to base64url decode the payload');\n }\n }\n else if (typeof jws.payload === 'string') {\n payload = encoder.encode(jws.payload);\n }\n else {\n payload = jws.payload;\n }\n const result = { payload };\n if (jws.protected !== undefined) {\n result.protectedHeader = parsedProt;\n }\n if (jws.header !== undefined) {\n result.unprotectedHeader = jws.header;\n }\n if (resolvedKey) {\n return { ...result, key };\n }\n return result;\n}\n\nasync function compactVerify(jws, key, options) {\n if (jws instanceof Uint8Array) {\n jws = decoder.decode(jws);\n }\n if (typeof jws !== 'string') {\n throw new JWSInvalid('Compact JWS must be a string or Uint8Array');\n }\n const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split('.');\n if (length !== 3) {\n throw new JWSInvalid('Invalid Compact JWS');\n }\n const verified = await flattenedVerify({ payload, protected: protectedHeader, signature }, key, options);\n const result = { payload: verified.payload, protectedHeader: verified.protectedHeader };\n if (typeof key === 'function') {\n return { ...result, key: verified.key };\n }\n return result;\n}\n\nvar epoch = (date) => Math.floor(date.getTime() / 1000);\n\nconst minute = 60;\nconst hour = minute * 60;\nconst day = hour * 24;\nconst week = day * 7;\nconst year = day * 365.25;\nconst REGEX = /^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;\nvar secs = (str) => {\n const matched = REGEX.exec(str);\n if (!matched || (matched[4] && matched[1])) {\n throw new TypeError('Invalid time period format');\n }\n const value = parseFloat(matched[2]);\n const unit = matched[3].toLowerCase();\n let numericDate;\n switch (unit) {\n case 'sec':\n case 'secs':\n case 'second':\n case 'seconds':\n case 's':\n numericDate = Math.round(value);\n break;\n case 'minute':\n case 'minutes':\n case 'min':\n case 'mins':\n case 'm':\n numericDate = Math.round(value * minute);\n break;\n case 'hour':\n case 'hours':\n case 'hr':\n case 'hrs':\n case 'h':\n numericDate = Math.round(value * hour);\n break;\n case 'day':\n case 'days':\n case 'd':\n numericDate = Math.round(value * day);\n break;\n case 'week':\n case 'weeks':\n case 'w':\n numericDate = Math.round(value * week);\n break;\n default:\n numericDate = Math.round(value * year);\n break;\n }\n if (matched[1] === '-' || matched[4] === 'ago') {\n return -numericDate;\n }\n return numericDate;\n};\n\nconst normalizeTyp = (value) => value.toLowerCase().replace(/^application\\//, '');\nconst checkAudiencePresence = (audPayload, audOption) => {\n if (typeof audPayload === 'string') {\n return audOption.includes(audPayload);\n }\n if (Array.isArray(audPayload)) {\n return audOption.some(Set.prototype.has.bind(new Set(audPayload)));\n }\n return false;\n};\nvar jwtPayload = (protectedHeader, encodedPayload, options = {}) => {\n let payload;\n try {\n payload = JSON.parse(decoder.decode(encodedPayload));\n }\n catch {\n }\n if (!isObject(payload)) {\n throw new JWTInvalid('JWT Claims Set must be a top-level JSON object');\n }\n const { typ } = options;\n if (typ &&\n (typeof protectedHeader.typ !== 'string' ||\n normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {\n throw new JWTClaimValidationFailed('unexpected \"typ\" JWT header value', payload, 'typ', 'check_failed');\n }\n const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;\n const presenceCheck = [...requiredClaims];\n if (maxTokenAge !== undefined)\n presenceCheck.push('iat');\n if (audience !== undefined)\n presenceCheck.push('aud');\n if (subject !== undefined)\n presenceCheck.push('sub');\n if (issuer !== undefined)\n presenceCheck.push('iss');\n for (const claim of new Set(presenceCheck.reverse())) {\n if (!(claim in payload)) {\n throw new JWTClaimValidationFailed(`missing required \"${claim}\" claim`, payload, claim, 'missing');\n }\n }\n if (issuer &&\n !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {\n throw new JWTClaimValidationFailed('unexpected \"iss\" claim value', payload, 'iss', 'check_failed');\n }\n if (subject && payload.sub !== subject) {\n throw new JWTClaimValidationFailed('unexpected \"sub\" claim value', payload, 'sub', 'check_failed');\n }\n if (audience &&\n !checkAudiencePresence(payload.aud, typeof audience === 'string' ? [audience] : audience)) {\n throw new JWTClaimValidationFailed('unexpected \"aud\" claim value', payload, 'aud', 'check_failed');\n }\n let tolerance;\n switch (typeof options.clockTolerance) {\n case 'string':\n tolerance = secs(options.clockTolerance);\n break;\n case 'number':\n tolerance = options.clockTolerance;\n break;\n case 'undefined':\n tolerance = 0;\n break;\n default:\n throw new TypeError('Invalid clockTolerance option type');\n }\n const { currentDate } = options;\n const now = epoch(currentDate || new Date());\n if ((payload.iat !== undefined || maxTokenAge) && typeof payload.iat !== 'number') {\n throw new JWTClaimValidationFailed('\"iat\" claim must be a number', payload, 'iat', 'invalid');\n }\n if (payload.nbf !== undefined) {\n if (typeof payload.nbf !== 'number') {\n throw new JWTClaimValidationFailed('\"nbf\" claim must be a number', payload, 'nbf', 'invalid');\n }\n if (payload.nbf > now + tolerance) {\n throw new JWTClaimValidationFailed('\"nbf\" claim timestamp check failed', payload, 'nbf', 'check_failed');\n }\n }\n if (payload.exp !== undefined) {\n if (typeof payload.exp !== 'number') {\n throw new JWTClaimValidationFailed('\"exp\" claim must be a number', payload, 'exp', 'invalid');\n }\n if (payload.exp <= now - tolerance) {\n throw new JWTExpired('\"exp\" claim timestamp check failed', payload, 'exp', 'check_failed');\n }\n }\n if (maxTokenAge) {\n const age = now - payload.iat;\n const max = typeof maxTokenAge === 'number' ? maxTokenAge : secs(maxTokenAge);\n if (age - tolerance > max) {\n throw new JWTExpired('\"iat\" claim timestamp check failed (too far in the past)', payload, 'iat', 'check_failed');\n }\n if (age < 0 - tolerance) {\n throw new JWTClaimValidationFailed('\"iat\" claim timestamp check failed (it should be in the past)', payload, 'iat', 'check_failed');\n }\n }\n return payload;\n};\n\nasync function jwtVerify(jwt, key, options) {\n const verified = await compactVerify(jwt, key, options);\n if (verified.protectedHeader.crit?.includes('b64') && verified.protectedHeader.b64 === false) {\n throw new JWTInvalid('JWTs MUST NOT use unencoded payload');\n }\n const payload = jwtPayload(verified.protectedHeader, verified.payload, options);\n const result = { payload, protectedHeader: verified.protectedHeader };\n if (typeof key === 'function') {\n return { ...result, key: verified.key };\n }\n return result;\n}\n\nconst sign = async (alg, key, data) => {\n const cryptoKey = await getCryptoKey(alg, key, 'sign');\n checkKeyLength(alg, cryptoKey);\n const signature = await crypto$1.subtle.sign(subtleDsa(alg, cryptoKey.algorithm), cryptoKey, data);\n return new Uint8Array(signature);\n};\nvar sign$1 = sign;\n\nclass FlattenedSign {\n constructor(payload) {\n if (!(payload instanceof Uint8Array)) {\n throw new TypeError('payload must be an instance of Uint8Array');\n }\n this._payload = payload;\n }\n setProtectedHeader(protectedHeader) {\n if (this._protectedHeader) {\n throw new TypeError('setProtectedHeader can only be called once');\n }\n this._protectedHeader = protectedHeader;\n return this;\n }\n setUnprotectedHeader(unprotectedHeader) {\n if (this._unprotectedHeader) {\n throw new TypeError('setUnprotectedHeader can only be called once');\n }\n this._unprotectedHeader = unprotectedHeader;\n return this;\n }\n async sign(key, options) {\n if (!this._protectedHeader && !this._unprotectedHeader) {\n throw new JWSInvalid('either setProtectedHeader or setUnprotectedHeader must be called before #sign()');\n }\n if (!isDisjoint$1(this._protectedHeader, this._unprotectedHeader)) {\n throw new JWSInvalid('JWS Protected and JWS Unprotected Header Parameter names must be disjoint');\n }\n const joseHeader = {\n ...this._protectedHeader,\n ...this._unprotectedHeader,\n };\n const extensions = validateCrit(JWSInvalid, new Map([['b64', true]]), options?.crit, this._protectedHeader, joseHeader);\n let b64 = true;\n if (extensions.has('b64')) {\n b64 = this._protectedHeader.b64;\n if (typeof b64 !== 'boolean') {\n throw new JWSInvalid('The \"b64\" (base64url-encode payload) Header Parameter must be a boolean');\n }\n }\n const { alg } = joseHeader;\n if (typeof alg !== 'string' || !alg) {\n throw new JWSInvalid('JWS \"alg\" (Algorithm) Header Parameter missing or invalid');\n }\n checkKeyTypeWithJwk(alg, key, 'sign');\n let payload = this._payload;\n if (b64) {\n payload = encoder.encode(encode(payload));\n }\n let protectedHeader;\n if (this._protectedHeader) {\n protectedHeader = encoder.encode(encode(JSON.stringify(this._protectedHeader)));\n }\n else {\n protectedHeader = encoder.encode('');\n }\n const data = concat(protectedHeader, encoder.encode('.'), payload);\n const signature = await sign$1(alg, key, data);\n const jws = {\n signature: encode(signature),\n payload: '',\n };\n if (b64) {\n jws.payload = decoder.decode(payload);\n }\n if (this._unprotectedHeader) {\n jws.header = this._unprotectedHeader;\n }\n if (this._protectedHeader) {\n jws.protected = decoder.decode(protectedHeader);\n }\n return jws;\n }\n}\n\nclass CompactSign {\n constructor(payload) {\n this._flattened = new FlattenedSign(payload);\n }\n setProtectedHeader(protectedHeader) {\n this._flattened.setProtectedHeader(protectedHeader);\n return this;\n }\n async sign(key, options) {\n const jws = await this._flattened.sign(key, options);\n if (jws.payload === undefined) {\n throw new TypeError('use the flattened module for creating JWS with b64: false');\n }\n return `${jws.protected}.${jws.payload}.${jws.signature}`;\n }\n}\n\nfunction validateInput(label, input) {\n if (!Number.isFinite(input)) {\n throw new TypeError(`Invalid ${label} input`);\n }\n return input;\n}\nclass ProduceJWT {\n constructor(payload = {}) {\n if (!isObject(payload)) {\n throw new TypeError('JWT Claims Set MUST be an object');\n }\n this._payload = payload;\n }\n setIssuer(issuer) {\n this._payload = { ...this._payload, iss: issuer };\n return this;\n }\n setSubject(subject) {\n this._payload = { ...this._payload, sub: subject };\n return this;\n }\n setAudience(audience) {\n this._payload = { ...this._payload, aud: audience };\n return this;\n }\n setJti(jwtId) {\n this._payload = { ...this._payload, jti: jwtId };\n return this;\n }\n setNotBefore(input) {\n if (typeof input === 'number') {\n this._payload = { ...this._payload, nbf: validateInput('setNotBefore', input) };\n }\n else if (input instanceof Date) {\n this._payload = { ...this._payload, nbf: validateInput('setNotBefore', epoch(input)) };\n }\n else {\n this._payload = { ...this._payload, nbf: epoch(new Date()) + secs(input) };\n }\n return this;\n }\n setExpirationTime(input) {\n if (typeof input === 'number') {\n this._payload = { ...this._payload, exp: validateInput('setExpirationTime', input) };\n }\n else if (input instanceof Date) {\n this._payload = { ...this._payload, exp: validateInput('setExpirationTime', epoch(input)) };\n }\n else {\n this._payload = { ...this._payload, exp: epoch(new Date()) + secs(input) };\n }\n return this;\n }\n setIssuedAt(input) {\n if (typeof input === 'undefined') {\n this._payload = { ...this._payload, iat: epoch(new Date()) };\n }\n else if (input instanceof Date) {\n this._payload = { ...this._payload, iat: validateInput('setIssuedAt', epoch(input)) };\n }\n else if (typeof input === 'string') {\n this._payload = {\n ...this._payload,\n iat: validateInput('setIssuedAt', epoch(new Date()) + secs(input)),\n };\n }\n else {\n this._payload = { ...this._payload, iat: validateInput('setIssuedAt', input) };\n }\n return this;\n }\n}\n\nclass SignJWT extends ProduceJWT {\n setProtectedHeader(protectedHeader) {\n this._protectedHeader = protectedHeader;\n return this;\n }\n async sign(key, options) {\n const sig = new CompactSign(encoder.encode(JSON.stringify(this._payload)));\n sig.setProtectedHeader(this._protectedHeader);\n if (Array.isArray(this._protectedHeader?.crit) &&\n this._protectedHeader.crit.includes('b64') &&\n this._protectedHeader.b64 === false) {\n throw new JWTInvalid('JWTs MUST NOT use unencoded payload');\n }\n return sig.sign(key, options);\n }\n}\n\nconst check = (value, description) => {\n if (typeof value !== 'string' || !value) {\n throw new JWKInvalid(`${description} missing or invalid`);\n }\n};\nasync function calculateJwkThumbprint(jwk, digestAlgorithm) {\n if (!isObject(jwk)) {\n throw new TypeError('JWK must be an object');\n }\n digestAlgorithm ?? (digestAlgorithm = 'sha256');\n if (digestAlgorithm !== 'sha256' &&\n digestAlgorithm !== 'sha384' &&\n digestAlgorithm !== 'sha512') {\n throw new TypeError('digestAlgorithm must one of \"sha256\", \"sha384\", or \"sha512\"');\n }\n let components;\n switch (jwk.kty) {\n case 'EC':\n check(jwk.crv, '\"crv\" (Curve) Parameter');\n check(jwk.x, '\"x\" (X Coordinate) Parameter');\n check(jwk.y, '\"y\" (Y Coordinate) Parameter');\n components = { crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y };\n break;\n case 'OKP':\n check(jwk.crv, '\"crv\" (Subtype of Key Pair) Parameter');\n check(jwk.x, '\"x\" (Public Key) Parameter');\n components = { crv: jwk.crv, kty: jwk.kty, x: jwk.x };\n break;\n case 'RSA':\n check(jwk.e, '\"e\" (Exponent) Parameter');\n check(jwk.n, '\"n\" (Modulus) Parameter');\n components = { e: jwk.e, kty: jwk.kty, n: jwk.n };\n break;\n case 'oct':\n check(jwk.k, '\"k\" (Key Value) Parameter');\n components = { k: jwk.k, kty: jwk.kty };\n break;\n default:\n throw new JOSENotSupported('\"kty\" (Key Type) Parameter missing or unsupported');\n }\n const data = encoder.encode(JSON.stringify(components));\n return encode(await digest$1(digestAlgorithm, data));\n}\n\nfunction getKtyFromAlg(alg) {\n switch (typeof alg === 'string' && alg.slice(0, 2)) {\n case 'RS':\n case 'PS':\n return 'RSA';\n case 'ES':\n return 'EC';\n case 'Ed':\n return 'OKP';\n default:\n throw new JOSENotSupported('Unsupported \"alg\" value for a JSON Web Key Set');\n }\n}\nfunction isJWKSLike(jwks) {\n return (jwks &&\n typeof jwks === 'object' &&\n Array.isArray(jwks.keys) &&\n jwks.keys.every(isJWKLike));\n}\nfunction isJWKLike(key) {\n return isObject(key);\n}\nfunction clone(obj) {\n if (typeof structuredClone === 'function') {\n return structuredClone(obj);\n }\n return JSON.parse(JSON.stringify(obj));\n}\nclass LocalJWKSet {\n constructor(jwks) {\n this._cached = new WeakMap();\n if (!isJWKSLike(jwks)) {\n throw new JWKSInvalid('JSON Web Key Set malformed');\n }\n this._jwks = clone(jwks);\n }\n async getKey(protectedHeader, token) {\n const { alg, kid } = { ...protectedHeader, ...token?.header };\n const kty = getKtyFromAlg(alg);\n const candidates = this._jwks.keys.filter((jwk) => {\n let candidate = kty === jwk.kty;\n if (candidate && typeof kid === 'string') {\n candidate = kid === jwk.kid;\n }\n if (candidate && typeof jwk.alg === 'string') {\n candidate = alg === jwk.alg;\n }\n if (candidate && typeof jwk.use === 'string') {\n candidate = jwk.use === 'sig';\n }\n if (candidate && Array.isArray(jwk.key_ops)) {\n candidate = jwk.key_ops.includes('verify');\n }\n if (candidate) {\n switch (alg) {\n case 'ES256':\n candidate = jwk.crv === 'P-256';\n break;\n case 'ES256K':\n candidate = jwk.crv === 'secp256k1';\n break;\n case 'ES384':\n candidate = jwk.crv === 'P-384';\n break;\n case 'ES512':\n candidate = jwk.crv === 'P-521';\n break;\n case 'Ed25519':\n candidate = jwk.crv === 'Ed25519';\n break;\n case 'EdDSA':\n candidate = jwk.crv === 'Ed25519' || jwk.crv === 'Ed448';\n break;\n }\n }\n return candidate;\n });\n const { 0: jwk, length } = candidates;\n if (length === 0) {\n throw new JWKSNoMatchingKey();\n }\n if (length !== 1) {\n const error = new JWKSMultipleMatchingKeys();\n const { _cached } = this;\n error[Symbol.asyncIterator] = async function* () {\n for (const jwk of candidates) {\n try {\n yield await importWithAlgCache(_cached, jwk, alg);\n }\n catch { }\n }\n };\n throw error;\n }\n return importWithAlgCache(this._cached, jwk, alg);\n }\n}\nasync function importWithAlgCache(cache, jwk, alg) {\n const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);\n if (cached[alg] === undefined) {\n const key = await importJWK({ ...jwk, ext: true }, alg);\n if (key instanceof Uint8Array || key.type !== 'public') {\n throw new JWKSInvalid('JSON Web Key Set members must be public keys');\n }\n cached[alg] = key;\n }\n return cached[alg];\n}\nfunction createLocalJWKSet(jwks) {\n const set = new LocalJWKSet(jwks);\n const localJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);\n Object.defineProperties(localJWKSet, {\n jwks: {\n value: () => clone(set._jwks),\n enumerable: true,\n configurable: false,\n writable: false,\n },\n });\n return localJWKSet;\n}\n\nconst fetchJwks = async (url, timeout, options) => {\n let controller;\n let id;\n let timedOut = false;\n if (typeof AbortController === 'function') {\n controller = new AbortController();\n id = setTimeout(() => {\n timedOut = true;\n controller.abort();\n }, timeout);\n }\n const response = await fetch(url.href, {\n signal: controller ? controller.signal : undefined,\n redirect: 'manual',\n headers: options.headers,\n }).catch((err) => {\n if (timedOut)\n throw new JWKSTimeout();\n throw err;\n });\n if (id !== undefined)\n clearTimeout(id);\n if (response.status !== 200) {\n throw new JOSEError('Expected 200 OK from the JSON Web Key Set HTTP response');\n }\n try {\n return await response.json();\n }\n catch {\n throw new JOSEError('Failed to parse the JSON Web Key Set HTTP response as JSON');\n }\n};\nvar fetchJwks$1 = fetchJwks;\n\nfunction isCloudflareWorkers() {\n return (typeof WebSocketPair !== 'undefined' ||\n (typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') ||\n (typeof EdgeRuntime !== 'undefined' && EdgeRuntime === 'vercel'));\n}\nlet USER_AGENT;\nif (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {\n const NAME = 'jose';\n const VERSION = 'v5.10.0';\n USER_AGENT = `${NAME}/${VERSION}`;\n}\nconst jwksCache = Symbol();\nfunction isFreshJwksCache(input, cacheMaxAge) {\n if (typeof input !== 'object' || input === null) {\n return false;\n }\n if (!('uat' in input) || typeof input.uat !== 'number' || Date.now() - input.uat >= cacheMaxAge) {\n return false;\n }\n if (!('jwks' in input) ||\n !isObject(input.jwks) ||\n !Array.isArray(input.jwks.keys) ||\n !Array.prototype.every.call(input.jwks.keys, isObject)) {\n return false;\n }\n return true;\n}\nclass RemoteJWKSet {\n constructor(url, options) {\n if (!(url instanceof URL)) {\n throw new TypeError('url must be an instance of URL');\n }\n this._url = new URL(url.href);\n this._options = { agent: options?.agent, headers: options?.headers };\n this._timeoutDuration =\n typeof options?.timeoutDuration === 'number' ? options?.timeoutDuration : 5000;\n this._cooldownDuration =\n typeof options?.cooldownDuration === 'number' ? options?.cooldownDuration : 30000;\n this._cacheMaxAge = typeof options?.cacheMaxAge === 'number' ? options?.cacheMaxAge : 600000;\n if (options?.[jwksCache] !== undefined) {\n this._cache = options?.[jwksCache];\n if (isFreshJwksCache(options?.[jwksCache], this._cacheMaxAge)) {\n this._jwksTimestamp = this._cache.uat;\n this._local = createLocalJWKSet(this._cache.jwks);\n }\n }\n }\n coolingDown() {\n return typeof this._jwksTimestamp === 'number'\n ? Date.now() < this._jwksTimestamp + this._cooldownDuration\n : false;\n }\n fresh() {\n return typeof this._jwksTimestamp === 'number'\n ? Date.now() < this._jwksTimestamp + this._cacheMaxAge\n : false;\n }\n async getKey(protectedHeader, token) {\n if (!this._local || !this.fresh()) {\n await this.reload();\n }\n try {\n return await this._local(protectedHeader, token);\n }\n catch (err) {\n if (err instanceof JWKSNoMatchingKey) {\n if (this.coolingDown() === false) {\n await this.reload();\n return this._local(protectedHeader, token);\n }\n }\n throw err;\n }\n }\n async reload() {\n if (this._pendingFetch && isCloudflareWorkers()) {\n this._pendingFetch = undefined;\n }\n const headers = new Headers(this._options.headers);\n if (USER_AGENT && !headers.has('User-Agent')) {\n headers.set('User-Agent', USER_AGENT);\n this._options.headers = Object.fromEntries(headers.entries());\n }\n this._pendingFetch || (this._pendingFetch = fetchJwks$1(this._url, this._timeoutDuration, this._options)\n .then((json) => {\n this._local = createLocalJWKSet(json);\n if (this._cache) {\n this._cache.uat = Date.now();\n this._cache.jwks = json;\n }\n this._jwksTimestamp = Date.now();\n this._pendingFetch = undefined;\n })\n .catch((err) => {\n this._pendingFetch = undefined;\n throw err;\n }));\n await this._pendingFetch;\n }\n}\nfunction createRemoteJWKSet(url, options) {\n const set = new RemoteJWKSet(url, options);\n const remoteJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);\n Object.defineProperties(remoteJWKSet, {\n coolingDown: {\n get: () => set.coolingDown(),\n enumerable: true,\n configurable: false,\n },\n fresh: {\n get: () => set.fresh(),\n enumerable: true,\n configurable: false,\n },\n reload: {\n value: () => set.reload(),\n enumerable: true,\n configurable: false,\n writable: false,\n },\n reloading: {\n get: () => !!set._pendingFetch,\n enumerable: true,\n configurable: false,\n },\n jwks: {\n value: () => set._local?.jwks(),\n enumerable: true,\n configurable: false,\n writable: false,\n },\n });\n return remoteJWKSet;\n}\n\nconst decode = decode$1;\n\nfunction decodeJwt(jwt) {\n if (typeof jwt !== 'string')\n throw new JWTInvalid('JWTs must use Compact JWS serialization, JWT must be a string');\n const { 1: payload, length } = jwt.split('.');\n if (length === 5)\n throw new JWTInvalid('Only JWTs using Compact JWS serialization can be decoded');\n if (length !== 3)\n throw new JWTInvalid('Invalid JWT');\n if (!payload)\n throw new JWTInvalid('JWTs must contain a payload');\n let decoded;\n try {\n decoded = decode(payload);\n }\n catch {\n throw new JWTInvalid('Failed to base64url decode the payload');\n }\n let result;\n try {\n result = JSON.parse(decoder.decode(decoded));\n }\n catch {\n throw new JWTInvalid('Failed to parse the decoded payload as JSON');\n }\n if (!isObject(result))\n throw new JWTInvalid('Invalid JWT Claims Set');\n return result;\n}\n\nfunction getModulusLengthOption(options) {\n const modulusLength = options?.modulusLength ?? 2048;\n if (typeof modulusLength !== 'number' || modulusLength < 2048) {\n throw new JOSENotSupported('Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used');\n }\n return modulusLength;\n}\nasync function generateKeyPair$1(alg, options) {\n let algorithm;\n let keyUsages;\n switch (alg) {\n case 'PS256':\n case 'PS384':\n case 'PS512':\n algorithm = {\n name: 'RSA-PSS',\n hash: `SHA-${alg.slice(-3)}`,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n modulusLength: getModulusLengthOption(options),\n };\n keyUsages = ['sign', 'verify'];\n break;\n case 'RS256':\n case 'RS384':\n case 'RS512':\n algorithm = {\n name: 'RSASSA-PKCS1-v1_5',\n hash: `SHA-${alg.slice(-3)}`,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n modulusLength: getModulusLengthOption(options),\n };\n keyUsages = ['sign', 'verify'];\n break;\n case 'RSA-OAEP':\n case 'RSA-OAEP-256':\n case 'RSA-OAEP-384':\n case 'RSA-OAEP-512':\n algorithm = {\n name: 'RSA-OAEP',\n hash: `SHA-${parseInt(alg.slice(-3), 10) || 1}`,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n modulusLength: getModulusLengthOption(options),\n };\n keyUsages = ['decrypt', 'unwrapKey', 'encrypt', 'wrapKey'];\n break;\n case 'ES256':\n algorithm = { name: 'ECDSA', namedCurve: 'P-256' };\n keyUsages = ['sign', 'verify'];\n break;\n case 'ES384':\n algorithm = { name: 'ECDSA', namedCurve: 'P-384' };\n keyUsages = ['sign', 'verify'];\n break;\n case 'ES512':\n algorithm = { name: 'ECDSA', namedCurve: 'P-521' };\n keyUsages = ['sign', 'verify'];\n break;\n case 'Ed25519':\n algorithm = { name: 'Ed25519' };\n keyUsages = ['sign', 'verify'];\n break;\n case 'EdDSA': {\n keyUsages = ['sign', 'verify'];\n const crv = options?.crv ?? 'Ed25519';\n switch (crv) {\n case 'Ed25519':\n case 'Ed448':\n algorithm = { name: crv };\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported crv option provided');\n }\n break;\n }\n case 'ECDH-ES':\n case 'ECDH-ES+A128KW':\n case 'ECDH-ES+A192KW':\n case 'ECDH-ES+A256KW': {\n keyUsages = ['deriveKey', 'deriveBits'];\n const crv = options?.crv ?? 'P-256';\n switch (crv) {\n case 'P-256':\n case 'P-384':\n case 'P-521': {\n algorithm = { name: 'ECDH', namedCurve: crv };\n break;\n }\n case 'X25519':\n case 'X448':\n algorithm = { name: crv };\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448');\n }\n break;\n }\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n return crypto$1.subtle.generateKey(algorithm, options?.extractable ?? false, keyUsages);\n}\n\nasync function generateKeyPair(alg, options) {\n return generateKeyPair$1(alg, options);\n}\n\n/**\n * When the client does not have a webid profile document, use this.\n *\n * @param registration_endpoint\n * @param redirect__uris\n * @returns\n */\nconst requestDynamicClientRegistration = async (registration_endpoint, client_details) => {\n // prepare dynamic client registration\n const client_registration_request_body = {\n ...client_details,\n grant_types: [\"authorization_code\", \"refresh_token\"],\n // id_token_signed_response_alg: \"ES256\", // omitting as NSS does not support ES256 while CSS does not support RS256\n token_endpoint_auth_method: \"none\",\n application_type: \"web\",\n subject_type: \"public\",\n };\n // register\n return fetch(registration_endpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(client_registration_request_body),\n });\n};\n\n/**\n * Login with the idp, using a provided `client_id` or dynamic client registration if none provided.\n *\n * @param idp\n * @param redirect_uri\n */\nconst redirectForLogin = async (idp, redirect_uri, client_details) => {\n // RFC 6749 - Section 3.1.2 - sanitize redirect_uri\n const redirect_uri_ = new URL(redirect_uri);\n const redirect_uri_sane = redirect_uri_.origin + redirect_uri_.pathname + redirect_uri_.search;\n // lookup openid configuration of idp\n const idp_origin = new URL(idp).origin;\n const openid_configuration = await fetch(`${idp_origin}/.well-known/openid-configuration`)\n .then((response) => {\n if (!response.ok) {\n throw new Error(`HTTP error! Status: ${response.status}`);\n }\n return response.json();\n });\n // RFC 9207 iss check: remember the identity provider (idp) / issuer (iss) - relaxing for trailing slash\n const issuer = openid_configuration[\"issuer\"];\n const trim_trailing_slash = (url) => (url.endsWith('/') ? url.slice(0, -1) : url);\n if (trim_trailing_slash(idp) !== trim_trailing_slash(issuer)) { // expected idp matches received issuer mod trailing slash?\n throw new Error(\"RFC 9207 - iss !== idp - \" + issuer + \" !== \" + idp);\n }\n sessionStorage.setItem(\"idp\", issuer);\n // remember token endpoint\n sessionStorage.setItem(\"token_endpoint\", openid_configuration[\"token_endpoint\"]);\n // remember jwks_uri for later token verification\n sessionStorage.setItem(\"jwks_uri\", openid_configuration[\"jwks_uri\"]);\n let client_id = client_details?.client_id;\n // no client_id => attempt dynamic registration\n if (!client_id) {\n // use registration endpoint\n const registration_endpoint = openid_configuration[\"registration_endpoint\"];\n // get client registration\n const client_registration = await requestDynamicClientRegistration(registration_endpoint, client_details ?? { redirect_uris: [redirect_uri_sane] })\n .then((response) => {\n if (!response.ok) {\n throw new Error(`HTTP error! Status: ${response.status}`);\n }\n return response.json();\n });\n client_id = client_registration[\"client_id\"];\n }\n // remember client_id if not URL\n try {\n new URL(client_id);\n }\n catch {\n sessionStorage.setItem(\"client_id\", client_id);\n }\n // RFC 7636 PKCE, remember code verifer\n const { pkce_code_verifier, pkce_code_challenge } = await getPKCEcode();\n sessionStorage.setItem(\"pkce_code_verifier\", pkce_code_verifier);\n // RFC 6749 OAuth 2.0 - CSRF token\n const csrf_token = window.crypto.randomUUID();\n sessionStorage.setItem(\"csrf_token\", csrf_token);\n // redirect to idp\n const redirect_to_idp = openid_configuration[\"authorization_endpoint\"] +\n `?response_type=code` +\n `&redirect_uri=${encodeURIComponent(redirect_uri_sane)}` +\n `&scope=openid offline_access webid` +\n `&client_id=${encodeURIComponent(client_id)}` +\n `&code_challenge_method=S256` +\n `&code_challenge=${pkce_code_challenge}` +\n `&state=${csrf_token}` +\n `&prompt=consent`; // this query parameter value MUST be present for CSS v7 to issue a refresh token ( // TODO open issue because prompting is the default behaviour but without this query param no refresh token is provided despite the \"remember this client\" box being checked)\n window.location.href = redirect_to_idp;\n};\n/**\n * RFC 7636 PKCE\n * @returns PKCE code verifier and PKCE code challenge\n */\nconst getPKCEcode = async () => {\n // create random string as PKCE code verifier\n const pkce_code_verifier = window.crypto.randomUUID() + \"-\" + window.crypto.randomUUID();\n // hash the verifier and base64URL encode as PKCE code challenge\n const digest = new Uint8Array(await window.crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(pkce_code_verifier)));\n const pkce_code_challenge = btoa(String.fromCharCode(...digest))\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=+$/, \"\");\n return { pkce_code_verifier, pkce_code_challenge };\n};\n/**\n * On incoming redirect from OpenID provider (idp/iss),\n * URL contains authrization code, issuer (idp) and state (csrf token),\n * get an access token for the authrization code.\n */\nconst onIncomingRedirect = async (client_details, database) => {\n const url = new URL(window.location.href);\n // authorization code\n const authorization_code = url.searchParams.get(\"code\");\n // if no code, session remains unauthenticated at this point\n if (authorization_code === null) {\n return { clientDetails: client_details };\n }\n // RFC 9207 issuer check\n const idp = sessionStorage.getItem(\"idp\");\n if (idp === null || url.searchParams.get(\"iss\") !== idp) {\n throw new Error(\"RFC 9207 - iss !== idp - \" + url.searchParams.get(\"iss\") + \" !== \" + idp);\n }\n // RFC 6749 OAuth 2.0\n if (url.searchParams.get(\"state\") !== sessionStorage.getItem(\"csrf_token\")) {\n throw new Error(\"RFC 6749 - state !== csrf_token - \" + url.searchParams.get(\"state\") + \" !== \" + sessionStorage.getItem(\"csrf_token\"));\n }\n // remove redirect query parameters from URL\n url.searchParams.delete(\"iss\");\n url.searchParams.delete(\"state\");\n url.searchParams.delete(\"code\");\n window.history.pushState({}, document.title, url.toString());\n // prepare token request\n const pkce_code_verifier = sessionStorage.getItem(\"pkce_code_verifier\");\n if (pkce_code_verifier === null) {\n throw new Error(\"Access Token Request preparation - Could not find in sessionStorage: pkce_code_verifier\");\n }\n const client_id = client_details?.client_id || sessionStorage.getItem(\"client_id\");\n if (!client_id) {\n throw new Error(\"Access Token Request preparation - Could not find in sessionStorage: client_id (dynamic registration)\");\n }\n const token_endpoint = sessionStorage.getItem(\"token_endpoint\");\n if (token_endpoint === null) {\n throw new Error(\"Access Token Request preparation - Could not find in sessionStorage: token_endpoint\");\n }\n // RFC 9449 DPoP\n const key_pair = await generateKeyPair(\"ES256\");\n // get access token\n const token_response = await requestAccessToken(authorization_code, pkce_code_verifier, url.toString(), client_id, token_endpoint, key_pair)\n .then((response) => {\n if (!response.ok) {\n throw new Error(`HTTP error! Status: ${response.status}`);\n }\n return response.json();\n });\n // verify access_token // ! Solid-OIDC specification says it should be a dpop-bound `id token` but implementations provide a dpop-bound `access token`\n const accessToken = token_response[\"access_token\"];\n const jwks_uri = sessionStorage.getItem(\"jwks_uri\");\n if (jwks_uri === null) {\n throw new Error(\"Access Token validation preparation - Could not find in sessionStorage: jwks_uri\");\n }\n const jwks = createRemoteJWKSet(new URL(jwks_uri));\n const { payload } = await jwtVerify(accessToken, jwks, {\n issuer: idp, // RFC 9207\n audience: \"solid\", // RFC 7519 // ! \"solid\" as per implementations ...\n // exp, nbf, iat - handled automatically\n });\n // check dpop thumbprint\n const dpopThumbprint = await calculateJwkThumbprint(await exportJWK(key_pair.publicKey));\n if (payload[\"cnf\"][\"jkt\"] !== dpopThumbprint) {\n throw new Error(\"Access Token validation failed on `jkt`: jkt !== DPoP thumbprint - \" + payload[\"cnf\"][\"jkt\"] + \" !== \" + dpopThumbprint);\n }\n // check client_id\n if (payload[\"client_id\"] !== client_id) {\n throw new Error(\"Access Token validation failed on `client_id`: JWT payload !== client_id - \" + payload[\"client_id\"] + \" !== \" + client_id);\n }\n // summarise session info\n const token_details = { ...token_response, dpop_key_pair: key_pair };\n const idp_details = { idp, jwks_uri, token_endpoint };\n if (!client_details)\n client_details = { redirect_uris: [url.toString()] };\n client_details.client_id = client_id;\n // and persist refresh token details\n if (database) {\n await database.init();\n await Promise.all([\n database.setItem(\"idp\", idp),\n database.setItem(\"jwks_uri\", jwks_uri),\n database.setItem(\"token_endpoint\", token_endpoint),\n database.setItem(\"client_id\", client_id),\n database.setItem(\"dpop_keypair\", key_pair),\n database.setItem(\"refresh_token\", token_response[\"refresh_token\"])\n ]);\n database.close();\n }\n // clean session storage\n sessionStorage.removeItem(\"csrf_token\");\n sessionStorage.removeItem(\"pkce_code_verifier\");\n sessionStorage.removeItem(\"idp\");\n sessionStorage.removeItem(\"jwks_uri\");\n sessionStorage.removeItem(\"token_endpoint\");\n sessionStorage.removeItem(\"client_id\");\n // return session information\n return {\n clientDetails: client_details,\n idpDetails: idp_details,\n tokenDetails: token_details\n };\n};\n/**\n * Request an dpop-bound access token from a token endpoint\n * @param authorization_code\n * @param pkce_code_verifier\n * @param redirect_uri\n * @param client_id\n * @param token_endpoint\n * @param key_pair\n * @returns\n */\nconst requestAccessToken = async (authorization_code, pkce_code_verifier, redirect_uri, client_id, token_endpoint, key_pair) => {\n // prepare public key to bind access token to\n const jwk_public_key = await exportJWK(key_pair.publicKey);\n jwk_public_key.alg = \"ES256\";\n // sign the access token request DPoP token\n const dpop = await new SignJWT({\n htu: token_endpoint,\n htm: \"POST\",\n })\n .setIssuedAt()\n .setJti(window.crypto.randomUUID())\n .setProtectedHeader({\n alg: \"ES256\",\n typ: \"dpop+jwt\",\n jwk: jwk_public_key,\n })\n .sign(key_pair.privateKey);\n return fetch(token_endpoint, {\n method: \"POST\",\n headers: {\n dpop,\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams({\n grant_type: \"authorization_code\",\n code: authorization_code,\n code_verifier: pkce_code_verifier,\n redirect_uri: redirect_uri,\n client_id: client_id,\n }),\n });\n};\n\nconst renewTokens = async (sessionDatabase) => {\n // remember session details\n try {\n await sessionDatabase.init();\n const client_id = await sessionDatabase.getItem(\"client_id\");\n const token_endpoint = await sessionDatabase.getItem(\"token_endpoint\");\n const key_pair = await sessionDatabase.getItem(\"dpop_keypair\");\n const refresh_token = await sessionDatabase.getItem(\"refresh_token\");\n if (client_id === null || token_endpoint === null || key_pair === null || refresh_token === null) {\n // we can not restore the old session\n throw new Error(\"Could not refresh tokens: details missing from database.\");\n }\n const token_response = await requestFreshTokens(refresh_token, client_id, token_endpoint, key_pair)\n .then((response) => {\n if (!response.ok) {\n throw new Error(`HTTP error! Status: ${response.status}`);\n }\n return response.json();\n });\n // verify access_token // ! Solid-OIDC specification says it should be a dpop-bound `id token` but implementations provide a dpop-bound `access token`\n const accessToken = token_response[\"access_token\"];\n const idp = await sessionDatabase.getItem(\"idp\");\n if (idp === null) {\n throw new Error(\"Access Token validation preparation - Could not find in sessionDatabase: idp\");\n }\n const jwks_uri = await sessionDatabase.getItem(\"jwks_uri\");\n if (jwks_uri === null) {\n throw new Error(\"Access Token validation preparation - Could not find in sessionDatabase: jwks_uri\");\n }\n const jwks = createRemoteJWKSet(new URL(jwks_uri));\n const { payload } = await jwtVerify(accessToken, jwks, {\n issuer: idp, // RFC 9207\n audience: \"solid\", // RFC 7519 // ! \"solid\" as per implementations ...\n // exp, nbf, iat - handled automatically\n });\n // check dpop thumbprint\n const dpopThumbprint = await calculateJwkThumbprint(await exportJWK(key_pair.publicKey));\n if (payload[\"cnf\"][\"jkt\"] !== dpopThumbprint) {\n throw new Error(\"Access Token validation failed on `jkt`: jkt !== DPoP thumbprint - \" + payload[\"cnf\"][\"jkt\"] + \" !== \" + dpopThumbprint);\n }\n // check client_id\n if (payload[\"client_id\"] !== client_id) {\n throw new Error(\"Access Token validation failed on `client_id`: JWT payload !== client_id - \" + payload[\"client_id\"] + \" !== \" + client_id);\n }\n // set new refresh token for token rotation\n await sessionDatabase.setItem(\"refresh_token\", token_response[\"refresh_token\"]);\n return {\n ...token_response,\n dpop_key_pair: key_pair,\n };\n }\n finally {\n sessionDatabase.close();\n }\n};\n/**\n * Request an dpop-bound access token from a token endpoint using a refresh token\n * @param authorization_code\n * @param pkce_code_verifier\n * @param redirect_uri\n * @param client_id\n * @param token_endpoint\n * @param key_pair\n * @returns\n */\nconst requestFreshTokens = async (refresh_token, client_id, token_endpoint, key_pair) => {\n // prepare public key to bind access token to\n const jwk_public_key = await exportJWK(key_pair.publicKey);\n jwk_public_key.alg = \"ES256\";\n // sign the access token request DPoP token\n const dpop = await new SignJWT({\n htu: token_endpoint,\n htm: \"POST\",\n })\n .setIssuedAt()\n .setJti(self.crypto.randomUUID())\n .setProtectedHeader({\n alg: \"ES256\",\n typ: \"dpop+jwt\",\n jwk: jwk_public_key,\n })\n .sign(key_pair.privateKey);\n return fetch(token_endpoint, {\n method: \"POST\",\n headers: {\n dpop,\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams({\n grant_type: \"refresh_token\",\n refresh_token,\n client_id\n }),\n });\n};\n\nvar SessionEvents;\n(function (SessionEvents) {\n SessionEvents[\"STATE_CHANGE\"] = \"sessionStateChange\";\n SessionEvents[\"EXPIRATION_WARNING\"] = \"sessionExpirationWarning\";\n SessionEvents[\"EXPIRATION\"] = \"sessionExpiration\";\n})(SessionEvents || (SessionEvents = {}));\n//\n//\n// Basic implementation\n//\n//\n/**\n * The SessionCore class manages session state and core logic but does not handle the refresh lifecycle.\n * It receives {@link SessionOptions} with a database to be able to restore a session.\n * That database can be re-used by (your!) surrounding implementation to handle the refresh lifecycle.\n * If no database was provided, refresh information cannot be stored, and thus token refresh (via the refresh token grant) is not possible in this case.\n *\n * If you are building a web app, use the Session implementation provided in the default `/web` version of this library.\n */\nclass SessionCore extends EventTarget {\n isActive_ = false;\n exp_;\n webId_ = undefined;\n currentAth_ = undefined;\n information;\n database;\n refreshPromise;\n resolveRefresh;\n rejectRefresh;\n constructor(clientDetails, sessionOptions) {\n super();\n this.authFetch = this.authFetch.bind(this);\n this.information = { clientDetails };\n this.database = sessionOptions?.database;\n if (sessionOptions?.onSessionStateChange)\n this.addEventListener(SessionEvents.STATE_CHANGE, (event) => sessionOptions.onSessionStateChange?.(event));\n if (sessionOptions?.onSessionExpirationWarning)\n this.addEventListener(SessionEvents.EXPIRATION_WARNING, (event) => sessionOptions?.onSessionExpirationWarning?.(event));\n if (sessionOptions?.onSessionExpiration)\n this.addEventListener(SessionEvents.EXPIRATION, (event) => sessionOptions?.onSessionExpiration?.(event));\n }\n async login(idp, redirect_uri) {\n await redirectForLogin(idp, redirect_uri, this.information.clientDetails);\n }\n /**\n * Handles the redirect from the identity provider after a login attempt.\n * It attempts to retrieve tokens using the authorization code.\n * Upon success, it tries to persist information to refresh tokens in the session database.\n * If no database was provided, no information is persisted.\n */\n async handleRedirectFromLogin() {\n // Redirect after Authorization Code Grant // memory via sessionStorage\n const newSessionInfo = await onIncomingRedirect(this.information.clientDetails, this.database);\n // no session - we remain unauthenticated\n if (!newSessionInfo.tokenDetails)\n return;\n // we got a session\n this.information.clientDetails = newSessionInfo.clientDetails;\n this.information.idpDetails = newSessionInfo.idpDetails;\n await this.setTokenDetails(newSessionInfo.tokenDetails);\n // callback state change \n this.dispatchStateChangeEvent(); // we logged in\n }\n /**\n * Handles session restoration using the refresh token grant.\n */\n async restore() {\n if (!this.database) {\n throw new Error(\"Could not refresh tokens: missing database. Provide database in sessionOption.\");\n }\n if (this.refreshPromise) {\n return this.refreshPromise;\n }\n this.refreshPromise = new Promise((resolve, reject) => {\n this.resolveRefresh = resolve;\n this.rejectRefresh = reject;\n });\n // Restore session using Refresh Token Grant \n const wasActive = this.isActive;\n renewTokens(this.database)\n .then(tokenDetails => this.setTokenDetails(tokenDetails))\n .then(() => this.resolveRefresh())\n .catch(error => {\n if (this.isActive) {\n this.rejectRefresh(new Error(error || 'Token refresh failed'));\n // do not change state (yet), let the app decide if they want to logout or if they just want to retry.\n if (!this.isExpired()) {\n this.dispatchExpirationWarningEvent();\n }\n else {\n this.dispatchExpirationEvent();\n }\n }\n else {\n this.rejectRefresh(new Error(\"No session to restore.\"));\n }\n }).finally(() => {\n this.clearRefreshPromise();\n if (wasActive !== this.isActive)\n this.dispatchStateChangeEvent();\n });\n return this.refreshPromise;\n }\n /**\n * This logs the user out.\n * Clears all session-related information, including IDP details and tokens.\n * Client ID is preserved if it is a URI.\n */\n async logout() {\n // clean session data\n this.isActive_ = false;\n this.exp_ = undefined;\n this.webId_ = undefined;\n this.currentAth_ = undefined;\n this.information.idpDetails = undefined;\n this.information.tokenDetails = undefined;\n // client details are preserved\n if (this.refreshPromise && this.rejectRefresh) {\n this.rejectRefresh(new Error('Logout during token refresh.'));\n this.clearRefreshPromise();\n }\n // clean session database\n if (this.database) {\n await this.database.init();\n await this.database.clear();\n this.database.close();\n }\n // callback state change\n this.dispatchStateChangeEvent(); // we logged out\n }\n /**\n * Makes an HTTP fetch request.\n * If a session is active, it includes the DPoP token and the access token in the `Authorization` header.\n *\n * @param input The URL or Request object to fetch.\n * @param init Optional fetch request options (RequestInit). Headers for `Authorization` and `DPoP` will be overwritten if a session is active.\n * @param dpopPayload Optional payload for the DPoP token. If provided, it overrides the default `htu` and `htm` claims.\n * @returns A promise that resolves to the fetch Response.\n */\n async authFetch(input, init, dpopPayload) {\n // if there is not session established, just delegate to the default fetch\n if (!this.isActive) {\n return fetch(input, init);\n }\n // TODO\n // TODO do HEAD request to check if authentication is actually required, only then include tokens\n // TODO\n // prepare authenticated call using a DPoP token (either provided payload, or default)\n let url;\n let method;\n let headers;\n // wrangle fetch input parameters into place\n if (input instanceof Request) {\n url = new URL(input.url);\n method = init?.method || input?.method || 'GET';\n headers = new Headers(input.headers);\n }\n else {\n init = init || {};\n url = new URL(input.toString());\n method = init.method || 'GET';\n headers = init.headers ? new Headers(init.headers) : new Headers();\n }\n // create DPoP token, and add tokens to request\n await this._renewTokensIfExpired();\n dpopPayload = dpopPayload ?? {\n htu: `${url.origin}${url.pathname}`,\n htm: method.toUpperCase()\n };\n const dpop = await this._createSignedDPoPToken(dpopPayload);\n // overwrite headers: authorization, dpop\n headers.set(\"dpop\", dpop);\n headers.set(\"authorization\", `DPoP ${this.information.tokenDetails.access_token}`);\n // check explicitly; to avoid unexpected behaviour\n if (input instanceof Request) { // clone the provided request, and override the headers\n return fetch(new Request(input, { ...init, headers }));\n }\n // just override the headers\n return fetch(url, { ...init, headers });\n }\n // \n // Setters\n //\n async setTokenDetails(tokenDetails) {\n this.information.tokenDetails = tokenDetails;\n await this._updateSessionDetailsFromToken(tokenDetails.access_token);\n }\n clearRefreshPromise() {\n this.refreshPromise = undefined;\n this.resolveRefresh = undefined;\n this.rejectRefresh = undefined;\n }\n //\n // Getters\n //\n get isActive() {\n return this.isActive_;\n }\n get webId() {\n return this.webId_;\n }\n isExpired() {\n if (!this.exp_)\n return true;\n return this._isTokenExpired(this.exp_);\n }\n getExpiresIn() {\n if (!this.exp_)\n return -1;\n return this._getTokenTTL(this.exp_);\n }\n getTokenDetails() {\n return this.information.tokenDetails;\n }\n //\n // Helpers\n //\n /**\n * Check if the current token is expired (which may happen during device/browser/tab hibernation),\n * and if expired, restore the session.\n */\n async _renewTokensIfExpired() {\n if (this.isExpired()) {\n if (!this.refreshPromise) {\n await this.restore(); // Initiate and wait\n }\n else {\n await this.refreshPromise; // Wait for already pending\n }\n }\n }\n /**\n * RFC 9449 - Hash of the access token\n */\n async _computeAth(accessToken) {\n // Convert the ASCII string of the token to a Uint8Array\n const encoder = new TextEncoder();\n const data = encoder.encode(accessToken); // ASCII by default\n // Compute SHA-256 hash\n const hashBuffer = await crypto.subtle.digest('SHA-256', data);\n // Convert ArrayBuffer to base64url string\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const base64 = btoa(String.fromCharCode(...hashArray));\n // Convert base64 to base64url\n const base64url = base64\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n return base64url;\n }\n /**\n * Creates a signed DPoP (Demonstration of Proof-of-Possession) token.\n *\n * @param payload The payload to include in the DPoP token. By default, it includes `htu` (HTTP target URI) and `htm` (HTTP method).\n * @returns A promise that resolves to the signed DPoP token string.\n * @throws Error if the session has not been initialized - if no token details are available.\n */\n async _createSignedDPoPToken(payload) {\n if (!this.information.tokenDetails || !this.currentAth_) {\n throw new Error(\"Session not established.\");\n }\n payload.ath = this.currentAth_;\n const jwk_public_key = await exportJWK(this.information.tokenDetails.dpop_key_pair.publicKey);\n return new SignJWT(payload)\n .setIssuedAt()\n .setJti(window.crypto.randomUUID())\n .setProtectedHeader({\n alg: \"ES256\",\n typ: \"dpop+jwt\",\n jwk: jwk_public_key,\n })\n .sign(this.information.tokenDetails.dpop_key_pair.privateKey);\n }\n async _updateSessionDetailsFromToken(access_token) {\n if (!access_token) {\n await this.logout();\n return;\n }\n try {\n const decodedToken = decodeJwt(access_token);\n const webId = decodedToken.webid;\n if (!webId) {\n throw new Error('Missing webid claim in access token');\n }\n const exp = decodedToken.exp;\n if (!exp) {\n throw new Error('Missing exp claim in access token');\n }\n this.currentAth_ = await this._computeAth(access_token); // must be done before session set to active\n this.webId_ = webId;\n this.exp_ = exp;\n this.isActive_ = true;\n }\n catch (error) {\n await this.logout();\n }\n }\n /**\n * Checks if a JWT expiration timestamp ('exp') has passed.\n */\n _isTokenExpired(exp, bufferSeconds = 0) {\n if (typeof exp !== 'number' || isNaN(exp)) {\n return true;\n }\n return this._getTokenTTL(exp, bufferSeconds) < 0;\n }\n _getTokenTTL(exp, bufferSeconds = 0) {\n const currentTimeSeconds = Math.floor(Date.now() / 1000);\n return exp - (currentTimeSeconds + bufferSeconds);\n }\n // \n // Events\n //\n dispatchStateChangeEvent() {\n this.dispatchEvent(new CustomEvent(SessionEvents.STATE_CHANGE, { detail: { isActive: this.isActive, webId: this.webId } }));\n }\n dispatchExpirationWarningEvent() {\n this.dispatchEvent(new CustomEvent(SessionEvents.EXPIRATION_WARNING, { detail: { expires_in: this.getExpiresIn() } }));\n }\n dispatchExpirationEvent() {\n this.dispatchEvent(new CustomEvent(SessionEvents.EXPIRATION));\n }\n}\n\nexport { SessionCore, SessionEvents };\n//# sourceMappingURL=index.js.map\n","/**\n * OIDC session factory.\n *\n * Everything needed to create and configure the underlying auth session:\n * - Session database backends (in-memory and IndexedDB)\n * - Session instantiation (WebSession or SessionCore, with local-dev\n * fallbacks for environments where the service worker can't load)\n * - Login compatibility shim that normalises legacy call-site signatures\n * and resolves the canonical issuer through /.well-known discovery\n *\n * The raw session instance (_session) is consumed by authSession.ts where\n * the legacy event layer and logout listener are attached.\n *\n * DO NOT import _session directly — always go through authSession.ts so\n * the event wiring is guaranteed to run.\n */\n\nimport {\n Session as WebSession,\n} from '@uvdsl/solid-oidc-client-browser'\nimport * as OidcCore from '@uvdsl/solid-oidc-client-browser/core'\nimport type { Session as OidcSession, SessionDatabase } from '@uvdsl/solid-oidc-client-browser/core'\n\n// ---------------------------------------------------------------------------\n// Session databases\n// ---------------------------------------------------------------------------\n\nexport class MemorySessionDatabase implements SessionDatabase {\n private readonly map = new Map<string, any>()\n\n private shouldPreserveExistingRefreshToken(id: string, value: any): boolean {\n return id === 'refresh_token' && (value == null || value === '') && this.map.has(id)\n }\n\n async init (): Promise<SessionDatabase> {\n return this\n }\n\n async setItem (id: string, value: any): Promise<void> {\n // Some Solid IdPs do not include refresh_token on refresh responses.\n // Keep the previous token instead of overwriting it with null/undefined.\n if (this.shouldPreserveExistingRefreshToken(id, value)) {\n return\n }\n this.map.set(id, value)\n }\n\n async getItem (id: string): Promise<any> {\n return this.map.has(id) ? this.map.get(id) : null\n }\n\n async deleteItem (id: string): Promise<void> {\n this.map.delete(id)\n }\n\n async clear (): Promise<void> {\n this.map.clear()\n }\n\n close (): void {\n // No-op for in-memory database\n }\n}\n\nexport class IndexedDbSessionDatabase implements SessionDatabase {\n private db: IDBDatabase | null = null\n private readonly dbName = 'soidc'\n private readonly storeName = 'session'\n private readonly dbVersion = 1\n\n private async shouldPreserveExistingRefreshToken(id: string, value: any): Promise<boolean> {\n if (id !== 'refresh_token' || !(value == null || value === '')) {\n return false\n }\n const existing = await this.getItem(id)\n return existing != null && existing !== ''\n }\n\n async init (): Promise<SessionDatabase> {\n if (this.db) return this\n if (typeof indexedDB === 'undefined') {\n throw new Error('IndexedDB is not available in this environment')\n }\n\n await new Promise<void>((resolve, reject) => {\n const request = indexedDB.open(this.dbName, this.dbVersion)\n\n request.onerror = () => reject(request.error)\n request.onsuccess = () => {\n this.db = request.result\n resolve()\n }\n request.onupgradeneeded = () => {\n const db = request.result\n if (!db.objectStoreNames.contains(this.storeName)) {\n db.createObjectStore(this.storeName)\n }\n }\n })\n\n return this\n }\n\n async setItem (id: string, value: any): Promise<void> {\n await this.init()\n // Some Solid IdPs do not include refresh_token on refresh responses.\n // Keep the previous token instead of overwriting it with null/undefined.\n if (await this.shouldPreserveExistingRefreshToken(id, value)) {\n return\n }\n await this.withStore('readwrite', store => store.put(value, id))\n }\n\n async getItem (id: string): Promise<any> {\n await this.init()\n return this.withStore('readonly', store => store.get(id))\n }\n\n async deleteItem (id: string): Promise<void> {\n await this.init()\n await this.withStore('readwrite', store => store.delete(id))\n }\n\n async clear (): Promise<void> {\n await this.init()\n await this.withStore('readwrite', store => store.clear())\n }\n\n close (): void {\n if (this.db) {\n this.db.close()\n this.db = null\n }\n }\n\n private withStore(mode: IDBTransactionMode, op: (store: IDBObjectStore) => IDBRequest<any>): Promise<any> {\n return new Promise<any>((resolve, reject) => {\n if (!this.db) {\n reject(new Error('Session database not initialized'))\n return\n }\n\n const tx = this.db.transaction(this.storeName, mode)\n const store = tx.objectStore(this.storeName)\n const request = op(store)\n let result: any = null\n\n tx.onerror = () => reject(tx.error ?? request.error)\n tx.onabort = () => reject(tx.error ?? request.error ?? new Error('IndexedDB transaction aborted'))\n tx.oncomplete = () => resolve(result)\n\n request.onerror = () => reject(request.error)\n request.onsuccess = () => {\n result = request.result ?? null\n }\n })\n }\n}\n\n// ---------------------------------------------------------------------------\n// Session instantiation\n// ---------------------------------------------------------------------------\n\nfunction getSessionCoreCtor (): (new (...args: any[]) => OidcSession) | null {\n const coreAny = OidcCore as any\n const candidate = coreAny.SessionCore ?? coreAny.default?.SessionCore ?? coreAny.default\n\n if (typeof candidate !== 'function') {\n return null\n }\n\n return candidate as new (...args: any[]) => OidcSession\n}\n\nconst SessionCoreCtor = getSessionCoreCtor()\n\nfunction createSession (): OidcSession {\n const shouldSkipWorkerInLocalDev = typeof window !== 'undefined' && (() => {\n const host = window.location.hostname\n // In local NSS setups (including subdomain mode like alice.localhost),\n // worker-based session storage can be brittle and lose state on reload.\n // Prefer SessionCore + IndexedDB for deterministic persistence.\n return host === 'localhost' || host === '127.0.0.1' || host.endsWith('.localhost')\n })()\n\n if (shouldSkipWorkerInLocalDev) {\n if (SessionCoreCtor) {\n return new SessionCoreCtor(undefined, { database: new IndexedDbSessionDatabase() })\n }\n return new WebSession()\n }\n\n try {\n return new WebSession()\n } catch (error) {\n // In some deployments, worker URL resolution can become file:// and fail cross-origin.\n // Fall back to SessionCore so auth still works without background refresh worker.\n // Use IndexedDB to keep refresh-token persistence across page reloads.\n console.warn('solid-logic: falling back to non-worker auth session:', error)\n try {\n if (SessionCoreCtor) {\n return new SessionCoreCtor(undefined, { database: new IndexedDbSessionDatabase() })\n }\n return new WebSession()\n } catch (dbError) {\n console.warn('solid-logic: IndexedDB unavailable, using in-memory session database:', dbError)\n if (SessionCoreCtor) {\n return new SessionCoreCtor(undefined, { database: new MemorySessionDatabase() })\n }\n return new WebSession()\n }\n }\n}\n\n// ---------------------------------------------------------------------------\n// Singleton session\n// ---------------------------------------------------------------------------\n\nconst _session = createSession()\n\nexport { _session }\n","/**\n * Issuer discovery utilities.\n *\n * Resolves OIDC issuer endpoints from /.well-known/openid-configuration\n * so that login can use the canonical issuer host.\n */\n\nasync function discoverIssuerFromWellKnown (issuer: string): Promise<string | null> {\n try {\n const issuerUrl = new URL(issuer)\n const wellKnownUrl = new URL('/.well-known/openid-configuration', issuerUrl.origin)\n const wellKnownResponse = await fetch(wellKnownUrl.toString(), { credentials: 'include' })\n if (!wellKnownResponse.ok) {\n return null\n }\n\n const wellKnownPayload = await wellKnownResponse.json()\n if (typeof wellKnownPayload?.issuer !== 'string' || !wellKnownPayload.issuer) {\n return null\n }\n\n return wellKnownPayload.issuer.replace(/\\/$/, '')\n } catch (_err) {\n return null\n }\n}\n\nexport async function resolveIssuerForLogin (issuer: string): Promise<string> {\n // Prefer the issuer advertised by discovery; if app and issuer hosts still differ,\n // redirecting to the canonical issuer host is cleaner than rewriting the issuer here.\n const discoveredIssuer = await discoverIssuerFromWellKnown(issuer)\n if (discoveredIssuer) {\n return discoveredIssuer\n }\n return issuer\n}\n","/**\n * Auth session wiring.\n *\n * Takes the raw OIDC session from session.ts and layers on:\n * - Login compatibility shim (normalises legacy call-site signatures\n * and resolves the canonical issuer)\n * - SessionEvents shim (legacy EventEmitter-style API)\n * - Logout listener (emits 'logout' on session deactivation)\n *\n * Exports the fully assembled authSession.\n */\n\nimport type { Session as OidcSession } from '@uvdsl/solid-oidc-client-browser/core'\nimport { _session } from './session'\nimport { resolveIssuerForLogin } from './issuer'\nimport { SessionEvents } from './events'\n\ntype SessionCompatibilityShape = {\n webId?: string\n isActive?: boolean\n info?: {\n webId?: string\n isLoggedIn?: boolean\n }\n fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>\n authFetch?: (input: string | URL | Request, init?: RequestInit, dpopPayload?: any) => Promise<Response>\n}\n\ntype LoginOptionsLegacy = {\n oidcIssuer?: string\n idp?: string\n issuer?: string\n redirectUrl?: string\n redirect_uri?: string\n redirectUri?: string\n}\n\ntype LoginCompat = {\n (issuer: string, redirectUrl: string): Promise<unknown>\n (options: LoginOptionsLegacy): Promise<unknown>\n}\n\nexport type SessionWithLegacyEvents = Omit<OidcSession, 'login'> & SessionCompatibilityShape & {\n login: LoginCompat\n events: SessionEvents\n}\n\n// ---------------------------------------------------------------------------\n// Login compatibility shim\n// ---------------------------------------------------------------------------\n// Wraps _session.login() so that call sites with different calling\n// conventions all work. The underlying session expects:\n// login(issuer: string, redirectUrl: string)\n//\n// idpOrOptions can be:\n// - a string (issuer URL) — passed through with less resolution\n// - an options object with any of these field-name variants:\n// issuer: oidcIssuer | idp | issuer\n// redirect: redirectUrl | redirect_uri | redirectUri\n// (all redirect field names map to the same value: the URL the IdP\n// should send the browser back to after authentication)\n// - anything else — passed through to the underlying session as-is\n//\n// In all cases the issuer is resolved through\n// /.well-known/openid-configuration before redirect so the canonical\n// issuer host is used.\n\nconst sessionAny = _session as any\nconst originalLogin = typeof sessionAny.login === 'function'\n ? sessionAny.login.bind(_session)\n : undefined\n\nif (originalLogin) {\n const compatLogin = async (idpOrOptions: any, redirectUri?: string): Promise<unknown> => {\n if (idpOrOptions && typeof idpOrOptions === 'object' && !Array.isArray(idpOrOptions)) {\n const oidcIssuer = idpOrOptions.oidcIssuer ?? idpOrOptions.idp ?? idpOrOptions.issuer\n const redirectUrl = idpOrOptions.redirectUrl ?? idpOrOptions.redirect_uri ?? idpOrOptions.redirectUri\n if (typeof oidcIssuer === 'string' && typeof redirectUrl === 'string') {\n return originalLogin(await resolveIssuerForLogin(oidcIssuer), redirectUrl)\n }\n }\n if (typeof idpOrOptions === 'string') {\n return originalLogin(await resolveIssuerForLogin(idpOrOptions), redirectUri)\n }\n return originalLogin(idpOrOptions, redirectUri)\n }\n sessionAny.login = compatLogin as LoginCompat\n}\n\n// ---------------------------------------------------------------------------\n// Legacy event layer\n// ---------------------------------------------------------------------------\n\nconst events = new SessionEvents()\n\n// Emit the legacy 'logout' event when the session transitions from active to inactive.\n// 'login' and 'sessionRestore' are emitted in SolidAuthnLogic.checkUser()\n// because only that call site knows which path activated the session.\nlet _wasActive = (_session as any).isActive ?? Boolean((_session as any).webId)\nif (typeof (_session as unknown as EventTarget).addEventListener === 'function') {\n ;(_session as unknown as EventTarget).addEventListener('sessionStateChange', () => {\n const isNowActive = (_session as any).isActive ?? Boolean((_session as any).webId)\n if (_wasActive && !isNowActive) {\n events.emit('logout')\n }\n _wasActive = isNowActive\n })\n}\n\nexport const authSession: SessionWithLegacyEvents = Object.assign(\n _session as Omit<OidcSession, 'login'> & { login: LoginCompat },\n { events }\n)\n\n// Legacy `info` compatibility shape.\n// The uvdsl session stores state on `webId_`/`isActive_` and exposes them via\n// `webId`/`isActive` getters, but legacy consumers (e.g. solid-ui's\n// `loginStatusBox` widget, `SolidAuthnLogic.currentUser()`'s fallback path)\n// read `authSession.info.webId` / `authSession.info.isLoggedIn`. Expose those\n// as a derived getter so legacy login/logout UI renders the correct state\n// (logout button instead of a mislabelled login button).\nObject.defineProperty(authSession, 'info', {\n enumerable: true,\n configurable: true,\n get (): { webId?: string; isLoggedIn?: boolean } {\n const sessionAny = _session as any\n const isActive = sessionAny.isActive === true || Boolean(sessionAny.webId)\n return {\n webId: sessionAny.webId,\n isLoggedIn: isActive\n }\n }\n})\n ","/**\n * Legacy event compatibility layer.\n *\n * Pure EventEmitter-style shim — no side effects, no uvdsl dependencies.\n * Wired into the auth session by authSession.ts.\n */\n\ntype LegacyEventName = 'login' | 'logout' | 'sessionRestore'\ntype LegacyEventHandler = (...args: unknown[]) => void\n\n/**\n * Minimal EventEmitter-style shim so that existing consumers using\n * `authSession.events.on('login' | 'logout' | 'sessionRestore', handler)`\n * continue working without modification.\n *\n * Events are emitted by SolidAuthnLogic.checkUser() (login/sessionRestore)\n * and by the sessionStateChange listener in authSession.ts (logout).\n */\nexport class SessionEvents {\n private readonly listeners: Map<string, Set<LegacyEventHandler>> = new Map()\n\n on (event: LegacyEventName, handler: LegacyEventHandler): void {\n if (!this.listeners.has(event)) this.listeners.set(event, new Set())\n this.listeners.get(event)!.add(handler)\n }\n\n off (event: LegacyEventName, handler: LegacyEventHandler): void {\n this.listeners.get(event)?.delete(handler)\n }\n\n emit (event: LegacyEventName, ...args: unknown[]): void {\n this.listeners.get(event)?.forEach(h => h(...args))\n }\n}\n\n","// Namespaces we commonly use and have common prefixes for around Solid\nimport solidNamespace from 'solid-namespace' // Delegate to this which takes RDFlib as param.\nimport * as $rdf from 'rdflib'\n\nexport const ns = solidNamespace($rdf)","import { graph, NamedNode, Namespace, serialize, sym } from 'rdflib'\nimport { AclLogic } from '../types'\nimport { ns as namespace } from '../util/ns'\n\n\nexport const ACL_LINK = sym(\n 'http://www.iana.org/assignments/link-relations/acl'\n)\n\nexport function createAclLogic(store): AclLogic {\n\n const ns = namespace\n \n async function findAclDocUrl(url: NamedNode) {\n await store.fetcher.load(url)\n const docNode = store.any(url, ACL_LINK)\n if (!docNode) {\n throw new Error(`No ACL link discovered for ${url}`)\n }\n return docNode.value\n }\n /**\n * Simple Access Control\n *\n * This function sets up a simple default ACL for a resource, with\n * RWC for the owner, and a specified access (default none) for the public.\n * In all cases owner has read write control.\n * Parameter lists modes allowed to public\n *\n * @param options\n * @param options.public eg ['Read', 'Write']\n *\n * @returns Resolves with aclDoc uri on successful write\n */\n function setACLUserPublic ( \n docURI: string,\n me: NamedNode,\n options: {\n defaultForNew?: boolean,\n public?: []\n }\n ): Promise<NamedNode> {\n const aclDoc = store.any(\n store.sym(docURI),\n ACL_LINK\n )\n\n return Promise.resolve()\n .then(() => {\n if (aclDoc) {\n return aclDoc as NamedNode\n }\n\n return fetchACLRel(docURI).catch(err => {\n throw new Error(`Error fetching rel=ACL header for ${docURI}: ${err}`)\n })\n })\n .then(aclDoc => {\n const aclText = genACLText(docURI, me, aclDoc.uri, options)\n if (!store.fetcher) {\n throw new Error('Cannot PUT this, store has no fetcher')\n }\n return store.fetcher\n .webOperation('PUT', aclDoc.uri, {\n data: aclText,\n contentType: 'text/turtle'\n })\n .then(result => {\n if (!result.ok) {\n throw new Error('Error writing ACL text: ' + result.error)\n }\n\n return aclDoc\n })\n })\n }\n\n /**\n * @param docURI\n * @returns\n */\n function fetchACLRel (docURI: string): Promise<NamedNode> {\n const fetcher = store.fetcher\n if (!fetcher) {\n throw new Error('Cannot fetch ACL rel, store has no fetcher')\n }\n\n return fetcher.load(docURI).then(result => {\n if (!result.ok) {\n throw new Error('fetchACLRel: While loading:' + (result as any).error)\n }\n\n const aclDoc = store.any(\n store.sym(docURI),\n ACL_LINK\n )\n\n if (!aclDoc) {\n throw new Error('fetchACLRel: No Link rel=ACL header for ' + docURI)\n }\n\n return aclDoc as NamedNode\n })\n }\n\n /**\n * @param docURI\n * @param me\n * @param aclURI\n * @param options\n *\n * @returns Serialized ACL\n */\n function genACLText (\n docURI: string,\n me: NamedNode,\n aclURI: string,\n options: {\n defaultForNew?: boolean,\n public?: []\n } = {}\n ): string | undefined {\n const optPublic = options.public || []\n const g = graph()\n const auth = Namespace('http://www.w3.org/ns/auth/acl#')\n let a = g.sym(`${aclURI}#a1`)\n const acl = g.sym(aclURI)\n const doc = g.sym(docURI)\n g.add(a, ns.rdf('type'), auth('Authorization'), acl)\n g.add(a, auth('accessTo'), doc, acl)\n if (options.defaultForNew) {\n g.add(a, auth('default'), doc, acl)\n }\n g.add(a, auth('agent'), me, acl)\n g.add(a, auth('mode'), auth('Read'), acl)\n g.add(a, auth('mode'), auth('Write'), acl)\n g.add(a, auth('mode'), auth('Control'), acl)\n\n if (optPublic.length) {\n a = g.sym(`${aclURI}#a2`)\n g.add(a, ns.rdf('type'), auth('Authorization'), acl)\n g.add(a, auth('accessTo'), doc, acl)\n g.add(a, auth('agentClass'), ns.foaf('Agent'), acl)\n for (let p = 0; p < optPublic.length; p++) {\n g.add(a, auth('mode'), auth(optPublic[p]), acl) // Like 'Read' etc\n }\n }\n return serialize(acl, g, aclURI)\n }\n return {\n findAclDocUrl,\n setACLUserPublic,\n genACLText\n }\n}","import { NamedNode, sym } from 'rdflib'\nimport * as debug from '../util/debug'\n\n/**\n * find a user or app's context as set in window.SolidAppContext\n * this is a const, not a function, because we have problems to jest mock it otherwise\n * see: https://github.com/facebook/jest/issues/936#issuecomment-545080082 for more\n * @return {any} - an appContext object\n */\nexport const appContext = ():any => {\n let { SolidAppContext }: any = window\n SolidAppContext ||= {}\n SolidAppContext.viewingNoAuthPage = false\n if (SolidAppContext.noAuth && window.document) {\n const currentPage = window.document.location.href\n if (currentPage.startsWith(SolidAppContext.noAuth)) {\n SolidAppContext.viewingNoAuthPage = true\n const params = new URLSearchParams(window.document.location.search)\n if (params) {\n let viewedPage = SolidAppContext.viewedPage = params.get('uri') || null\n if (viewedPage) {\n viewedPage = decodeURI(viewedPage)\n if (!viewedPage.startsWith(SolidAppContext.noAuth)) {\n const ary = viewedPage.split(/\\//)\n SolidAppContext.idp = ary[0] + '//' + ary[2]\n SolidAppContext.viewingNoAuthPage = false\n }\n }\n }\n }\n }\n return SolidAppContext\n}\n\n/**\n * Returns `sym($SolidTestEnvironment.username)` if\n * `$SolidTestEnvironment.username` is defined as a global\n * or \n * returns testID defined in the HTML page\n * @returns {NamedNode|null}\n */\nexport function offlineTestID (): NamedNode | null {\n const { $SolidTestEnvironment }: any = window\n if (\n typeof $SolidTestEnvironment !== 'undefined' &&\n $SolidTestEnvironment.username\n ) {\n // Test setup\n debug.log('Assuming the user is ' + $SolidTestEnvironment.username)\n return sym($SolidTestEnvironment.username)\n }\n // hack that makes SolidOS work in offline mode by adding the webId directly in html\n // example usage: https://github.com/solidos/mashlib/blob/29b8b53c46bf02e0e219f0bacd51b0e9951001dd/test/contact/local.html#L37\n if (\n typeof document !== 'undefined' &&\n document.location &&\n ('' + document.location).slice(0, 16) === 'http://localhost'\n ) {\n const div = document.getElementById('appTarget')\n if (!div) return null\n const id = div.getAttribute('testID')\n if (!id) return null\n debug.log('Assuming user is ' + id)\n return sym(id)\n }\n return null\n}\n","import { namedNode, NamedNode, sym } from 'rdflib'\nimport { appContext, offlineTestID } from './authUtil'\nimport * as debug from '../util/debug'\nimport type { SessionWithLegacyEvents } from '../authSession/authSession'\nimport type { AuthenticationContext, AuthnLogic } from '../types'\n\nexport class SolidAuthnLogic implements AuthnLogic {\n private session: SessionWithLegacyEvents\n private checkUserInFlight: Promise<NamedNode | null> | null = null\n private sessionRestoreHookAttached = false\n private fallbackWebId: string | null = null\n\n constructor(solidAuthSession: SessionWithLegacyEvents) {\n this.session = solidAuthSession\n }\n\n // we created authSession getter because we want to access it as authn.authSession externally\n get authSession(): SessionWithLegacyEvents { return this.session }\n\n currentUser(): NamedNode | null {\n const app = appContext()\n if (app.viewingNoAuthPage) {\n return sym(app.webId)\n }\n const sessionAny = this.session as any\n const infoWebId = sessionAny?.info?.webId\n const sessionWebId = sessionAny?.webId\n const webId = infoWebId || sessionWebId || this.fallbackWebId\n const infoLoggedIn = sessionAny?.info?.isLoggedIn\n const sessionActive = sessionAny?.isActive\n const isLoggedIn = infoLoggedIn === true || sessionActive === true ||\n ((infoLoggedIn == null && sessionActive == null) ? Boolean(webId) : false) ||\n Boolean(this.fallbackWebId)\n if (this && this.session && webId && isLoggedIn) {\n return sym(webId)\n }\n return offlineTestID() // null unless testing\n }\n\n /**\n * Retrieves currently logged in webId from either\n * defaultTestUser or SolidAuth\n * Also activates a session after login\n * @param [setUserCallback] Optional callback\n * @returns Resolves with webId uri, if no callback provided\n */\n async checkUser<T> (\n setUserCallback?: (me: NamedNode | null) => T\n ): Promise<NamedNode | T | null> {\n // Save hash for \"restorePreviousSession\"\n const preLoginRedirectHash = new URL(window.location.href).hash\n if (preLoginRedirectHash) {\n window.localStorage.setItem('preLoginRedirectHash', preLoginRedirectHash)\n }\n const sessionAny = this.session as any\n if (!this.sessionRestoreHookAttached && typeof sessionAny?.events?.on === 'function') {\n // Backward-compatible hook for auth clients exposing an EventEmitter-style API.\n sessionAny.events.on('sessionRestore', (url: string) => {\n debug.log(`Session restored to ${url}`)\n if (document.location.toString() !== url) history.replaceState(null, '', url)\n })\n this.sessionRestoreHookAttached = true\n }\n\n if (!this.checkUserInFlight) {\n this.checkUserInFlight = this.resolveCurrentUser()\n }\n\n const inFlight = this.checkUserInFlight\n let me: NamedNode | null\n try {\n me = await inFlight\n } finally {\n if (this.checkUserInFlight === inFlight) {\n this.checkUserInFlight = null\n }\n }\n\n return Promise.resolve(setUserCallback ? setUserCallback(me) : me)\n }\n\n private async resolveCurrentUser (): Promise<NamedNode | null> {\n const sessionAny = this.session as any\n\n /**\n * Handle a successful authentication redirect\n */\n const redirectUrl = new URL(window.location.href)\n redirectUrl.hash = ''\n if (typeof sessionAny?.handleIncomingRedirect === 'function') {\n await sessionAny.handleIncomingRedirect({\n restorePreviousSession: true,\n url: redirectUrl.href\n })\n } else {\n if (typeof sessionAny?.restore === 'function') {\n const wasActive = sessionAny?.isActive ?? Boolean(sessionAny?.webId)\n try {\n await sessionAny.restore()\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n if (!/no session to restore/i.test(message)) {\n throw error\n }\n debug.log('No previous session to restore')\n }\n const isNowActive = sessionAny?.isActive ?? Boolean(sessionAny?.webId)\n if (!wasActive && isNowActive) {\n sessionAny.events?.emit('sessionRestore', window.location.href)\n }\n }\n if (typeof sessionAny?.handleRedirectFromLogin === 'function') {\n const wasActive = sessionAny?.isActive ?? Boolean(sessionAny?.webId)\n await sessionAny.handleRedirectFromLogin()\n const isNowActive = sessionAny?.isActive ?? Boolean(sessionAny?.webId)\n if (!wasActive && isNowActive) {\n sessionAny.events?.emit('login')\n }\n }\n }\n\n // Check to see if a hash was stored in local storage\n const postLoginRedirectHash = window.localStorage.getItem('preLoginRedirectHash')\n if (postLoginRedirectHash) {\n const curUrl = new URL(window.location.href)\n if (curUrl.hash !== postLoginRedirectHash) {\n if (history.pushState) {\n // debug.log('Setting window.location.has using pushState')\n history.pushState(null, document.title, postLoginRedirectHash)\n } else {\n // debug.warn('Setting window.location.has using location.hash')\n location.hash = postLoginRedirectHash\n }\n curUrl.hash = postLoginRedirectHash\n }\n // See https://stackoverflow.com/questions/3870057/how-can-i-update-window-location-hash-without-jumping-the-document\n // window.location.href = curUrl.toString()// @@ See https://developer.mozilla.org/en-US/docs/Web/API/Window/location\n window.localStorage.setItem('preLoginRedirectHash', '')\n }\n\n // Check to see if already logged in / have the WebID\n let me = offlineTestID()\n if (me) {\n return me\n }\n\n let webId = this.webIdFromSession(sessionAny?.info, sessionAny)\n if (!webId) {\n // NSS-specific fallback: recover WebID from NSS cookie session when client restore is empty.\n webId = await this.probeNssCookieBackedWebId()\n }\n\n if (webId) {\n this.fallbackWebId = webId\n } else {\n this.fallbackWebId = null\n }\n\n if (webId) {\n me = this.saveUser(webId)\n }\n\n if (me) {\n debug.log(`(Logged in as ${me} by authentication)`)\n }\n\n return me\n }\n\n private async probeNssCookieBackedWebId (): Promise<string | null> {\n if (typeof window === 'undefined') {\n return null\n }\n\n const { hostname, port, protocol } = window.location\n const localhostSuffix = '.localhost'\n // NSS local pods use subdomains like alice.localhost.\n if (!hostname.endsWith(localhostSuffix)) {\n return null\n }\n\n const podName = hostname.slice(0, -localhostSuffix.length)\n if (!podName || podName === 'localhost' || podName.includes('.')) {\n return null\n }\n\n try {\n // NSS returns 403 on this account page when the cookie session is valid.\n const probeResponse = await fetch('/account/password/change', {\n credentials: 'include',\n redirect: 'manual',\n cache: 'no-store'\n })\n if (probeResponse.status !== 403) {\n return null\n }\n const origin = `${protocol}//${hostname}${port ? `:${port}` : ''}`\n return `${origin}/profile/card#me`\n } catch (_error) {\n return null\n }\n }\n\n /**\n * Saves `webId` in `context.me`\n * @param webId\n * @param context\n *\n * @returns Returns the WebID, after setting it\n */\n saveUser (\n webId: NamedNode | string | null,\n context?: AuthenticationContext\n ): NamedNode | null {\n let webIdUri: string\n if (webId) {\n webIdUri = (typeof webId === 'string') ? webId : webId.uri\n const me = namedNode(webIdUri)\n if (context) {\n context.me = me\n }\n return me\n }\n return null\n }\n\n /**\n * @returns {Promise<string|null>} Resolves with WebID URI or null\n */\n webIdFromSession (\n sessionInfo?: { webId?: string, isLoggedIn?: boolean },\n sessionRoot?: { webId?: string, isLoggedIn?: boolean, isActive?: boolean }\n ): string | null {\n const webId = sessionInfo?.webId || sessionRoot?.webId\n if (!webId) {\n return null\n }\n const infoLoggedIn = sessionInfo?.isLoggedIn\n const rootLoggedIn = sessionRoot?.isLoggedIn\n const rootActive = sessionRoot?.isActive\n if (infoLoggedIn === true || rootLoggedIn === true || rootActive === true) {\n return webId\n }\n if (infoLoggedIn === false && rootLoggedIn === false && rootActive === false) {\n return null\n }\n return webId\n }\n\n}\n","import { NamedNode, sym } from 'rdflib'\n\nexport function newThing(doc: NamedNode): NamedNode {\n return sym(doc.uri + '#' + 'id' + ('' + Date.now()))\n}\n\nexport function uniqueNodes (arr: NamedNode[]): NamedNode[] {\n const uris = arr.map(x => x.uri)\n const set = new Set(uris)\n const uris2 = Array.from(set)\n const arr2 = uris2.map(u => new NamedNode(u))\n return arr2 // Array.from(new Set(arr.map(x => x.uri))).map(u => sym(u))\n}\n\nexport function getArchiveUrl(baseUrl: string, date: Date) {\n const year = date.getUTCFullYear()\n const month = ('0' + (date.getUTCMonth()+1)).slice(-2)\n const day = ('0' + (date.getUTCDate())).slice(-2)\n const parts = baseUrl.split('/')\n const filename = parts[parts.length -1 ]\n return new URL(`./archive/${year}/${month}/${day}/${filename}`, baseUrl).toString()\n}\n\nexport function differentOrigin(doc): boolean {\n if (!doc) {\n return true\n }\n return (\n `${window.location.origin}/` !== new URL(doc.value).origin\n )\n}\n\nexport function suggestPreferencesFile (me:NamedNode) {\n const stripped = me.uri.replace('/profile/', '/').replace('/public/', '/')\n // const stripped = me.uri.replace(\\/[p|P]rofile/\\g, '/').replace(\\/[p|P]ublic/\\g, '/')\n const folderURI = stripped.split('/').slice(0,-1).join('/') + '/settings/'\n const fileURI = folderURI + 'prefs.ttl'\n return sym(fileURI)\n}\n\nexport function determineChatContainer(\n invitee: NamedNode,\n podRoot: NamedNode\n): NamedNode {\n // Create chat\n // See https://gitter.im/solid/chat-app?at=5f3c800f855be416a23ae74a\n const chatContainerStr = new URL(\n `IndividualChats/${new URL(invitee.value).host}/`,\n podRoot.value\n ).toString()\n return new NamedNode(chatContainerStr)\n}\n","import { NamedNode, Node, st, term } from 'rdflib'\nimport { ChatLogic, CreatedPaneOptions, NewPaneOptions, Chat } from '../types'\nimport { ns as namespace } from '../util/ns'\nimport { determineChatContainer, newThing } from '../util/utils'\n\nconst CHAT_LOCATION_IN_CONTAINER = 'index.ttl#this'\n\nexport function createChatLogic(store, profileLogic): ChatLogic {\n const ns = namespace\n\n async function setAcl(\n chatContainer: NamedNode,\n me: NamedNode,\n invitee: NamedNode\n ): Promise<void> {\n // Some servers don't present a Link http response header\n // if the container doesn't exist yet, so refetch the container\n // now that it has been created:\n await store.fetcher.load(chatContainer)\n\n // FIXME: check the Why value on this quad:\n const chatAclDoc = store.any(\n chatContainer,\n new NamedNode('http://www.iana.org/assignments/link-relations/acl')\n )\n if (!chatAclDoc) {\n throw new Error('Chat ACL doc not found!')\n }\n\n const aclBody = `\n @prefix acl: <http://www.w3.org/ns/auth/acl#>.\n <#owner>\n a acl:Authorization;\n acl:agent <${me.value}>;\n acl:accessTo <.>;\n acl:default <.>;\n acl:mode\n acl:Read, acl:Write, acl:Control.\n <#invitee>\n a acl:Authorization;\n acl:agent <${invitee.value}>;\n acl:accessTo <.>;\n acl:default <.>;\n acl:mode\n acl:Read, acl:Append.\n `\n await store.fetcher.webOperation('PUT', chatAclDoc.value, {\n data: aclBody,\n contentType: 'text/turtle',\n })\n }\n\n async function addToPrivateTypeIndex(chatThing, me) {\n // Add to private type index\n const privateTypeIndex = store.any(\n me,\n ns.solid('privateTypeIndex')\n ) as NamedNode | null\n if (!privateTypeIndex) {\n throw new Error('Private type index not found!')\n }\n await store.fetcher.load(privateTypeIndex)\n const reg = newThing(privateTypeIndex)\n const ins = [\n st(\n reg,\n ns.rdf('type'),\n ns.solid('TypeRegistration'),\n privateTypeIndex.doc()\n ),\n st(\n reg,\n ns.solid('forClass'),\n ns.meeting('LongChat'),\n privateTypeIndex.doc()\n ),\n st(reg, ns.solid('instance'), chatThing, privateTypeIndex.doc()),\n ]\n await new Promise((resolve, reject) => {\n store.updater.update([], ins, function (_uri, ok, errm) {\n if (!ok) {\n reject(new Error(errm))\n } else {\n resolve(null)\n }\n })\n })\n }\n\n async function findChat(invitee: NamedNode): Promise<Chat> {\n const me = await profileLogic.loadMe()\n const podRoot = await profileLogic.getPodRoot(me)\n const chatContainer = determineChatContainer(invitee, podRoot)\n let exists = true\n try {\n await store.fetcher.load(\n new NamedNode(chatContainer.value + 'index.ttl#this')\n )\n } catch (e) {\n exists = false\n }\n return { me, chatContainer, exists }\n }\n\n async function createChatThing(\n chatContainer: NamedNode,\n me: NamedNode\n ): Promise<NamedNode> {\n const created = await mintNew({\n me,\n newBase: chatContainer.value,\n })\n return created.newInstance\n }\n\n function mintNew(newPaneOptions: NewPaneOptions): Promise<CreatedPaneOptions> {\n const kb = store\n const updater = kb.updater\n if (newPaneOptions.me && !newPaneOptions.me.uri) {\n throw new Error('chat mintNew: Invalid userid ' + newPaneOptions.me)\n }\n\n const newInstance = (newPaneOptions.newInstance =\n newPaneOptions.newInstance ||\n kb.sym(newPaneOptions.newBase + CHAT_LOCATION_IN_CONTAINER))\n const newChatDoc = newInstance.doc()\n\n kb.add(\n newInstance,\n ns.rdf('type'),\n ns.meeting('LongChat'),\n newChatDoc\n )\n kb.add(newInstance, ns.dc('title'), 'Chat channel', newChatDoc)\n kb.add(\n newInstance,\n ns.dc('created'),\n term<Node>(new Date(Date.now())),\n newChatDoc\n )\n if (newPaneOptions.me) {\n kb.add(newInstance, ns.dc('author'), newPaneOptions.me, newChatDoc)\n }\n\n return new Promise(function (resolve, reject) {\n updater?.put(\n newChatDoc,\n kb.statementsMatching(undefined, undefined, undefined, newChatDoc),\n 'text/turtle',\n function (uri2, ok, message) {\n if (ok) {\n resolve({\n ...newPaneOptions,\n newInstance,\n })\n } else {\n reject(\n new Error(\n 'FAILED to save new chat channel at: ' + uri2 + ' : ' + message\n )\n )\n }\n }\n )\n })\n }\n\n /**\n * Find (and optionally create) an individual chat between the current user and the given invitee\n * @param invitee - The person to chat with\n * @param createIfMissing - Whether the chat should be created, if missing\n * @returns null if missing, or a node referring to an already existing chat, or the newly created chat\n */\n async function getChat(\n invitee: NamedNode,\n createIfMissing = true\n ): Promise<NamedNode | null> {\n const { me, chatContainer, exists } = await findChat(invitee)\n if (exists) {\n return new NamedNode(chatContainer.value + CHAT_LOCATION_IN_CONTAINER)\n }\n\n if (createIfMissing) {\n const chatThing = await createChatThing(chatContainer, me)\n await sendInvite(invitee, chatThing)\n await setAcl(chatContainer, me, invitee)\n await addToPrivateTypeIndex(chatThing, me)\n return chatThing\n }\n return null\n }\n\n async function sendInvite(invitee: NamedNode, chatThing: NamedNode) {\n await store.fetcher.load(invitee.doc())\n const inviteeInbox = store.any(\n invitee,\n ns.ldp('inbox'),\n undefined,\n invitee.doc()\n )\n if (!inviteeInbox) {\n throw new Error(`Invitee inbox not found! ${invitee.value}`)\n }\n const inviteBody = `\n <> a <http://www.w3.org/ns/pim/meeting#LongChatInvite> ;\n ${ns.rdf('seeAlso')} <${chatThing.value}> .\n `\n\n const inviteResponse = await store.fetcher?.webOperation(\n 'POST',\n inviteeInbox.value,\n {\n data: inviteBody,\n contentType: 'text/turtle',\n }\n )\n const locationStr = inviteResponse?.headers.get('location')\n if (!locationStr) {\n throw new Error(`Invite sending returned a ${inviteResponse?.status}`)\n }\n }\n return {\n setAcl, addToPrivateTypeIndex, findChat, createChatThing, getChat, sendInvite, mintNew\n }\n}\n","import { NamedNode } from 'rdflib'\nimport { InboxLogic } from '../types'\nimport { getArchiveUrl } from '../util/utils'\n\nexport function createInboxLogic(store, profileLogic, utilityLogic, containerLogic, aclLogic): InboxLogic {\n\n async function createInboxFor(peerWebId: string, nick: string) {\n const myWebId: NamedNode = await profileLogic.loadMe()\n const podRoot: NamedNode = await profileLogic.getPodRoot(myWebId)\n const ourInbox = `${podRoot.value}p2p-inboxes/${encodeURIComponent(nick)}/`\n await containerLogic.createContainer(ourInbox)\n // const aclDocUrl = await aclLogic.findAclDocUrl(ourInbox);\n await utilityLogic.setSinglePeerAccess({\n ownerWebId: myWebId.value,\n peerWebId,\n accessToModes: 'acl:Append',\n target: ourInbox\n })\n return ourInbox\n }\n\n async function getNewMessages(\n user?: NamedNode\n ): Promise<NamedNode[]> {\n if (!user) {\n user = await profileLogic.loadMe()\n }\n const inbox = await profileLogic.getMainInbox(user)\n const urls = await containerLogic.getContainerMembers(inbox)\n return urls.filter(url => !containerLogic.isContainer(url))\n }\n\n async function markAsRead(url: string, date: Date) {\n const downloaded = await store.fetcher._fetch(url)\n if (downloaded.status !== 200) {\n throw new Error(`Not OK! ${url}`)\n }\n const archiveUrl = getArchiveUrl(url, date)\n const options = {\n method: 'PUT',\n body: await downloaded.text(),\n headers: [\n ['Content-Type', downloaded.headers.get('Content-Type') || 'application/octet-stream']\n ]\n }\n const uploaded = await store.fetcher._fetch(archiveUrl, options)\n if (uploaded.status.toString()[0] === '2') {\n await store.fetcher._fetch(url, {\n method: 'DELETE'\n })\n }\n }\n return {\n createInboxFor,\n getNewMessages,\n markAsRead\n }\n}\n","class CustomError extends Error {\n constructor(message?: string) {\n super(message)\n // see: typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html\n Object.setPrototypeOf(this, new.target.prototype) // restore prototype chain\n this.name = new.target.name // stack traces display correctly now\n }\n}\n\nexport class UnauthorizedError extends CustomError {}\n\nexport class CrossOriginForbiddenError extends CustomError {}\n\nexport class SameOriginForbiddenError extends CustomError {}\n\nexport class NotFoundError extends CustomError {}\n\nexport class NotEditableError extends CustomError { }\n\nexport class WebOperationError extends CustomError {}\n\nexport class FetchError extends CustomError {\n status: number\n\n constructor(status: number, message?: string) {\n super(message)\n this.status = status\n }\n}","export function publicTypeIndexDocument(): string {\n return [\n '@prefix solid: <http://www.w3.org/ns/solid/terms#>.',\n '<>',\n ' a solid:TypeIndex ;',\n ' a solid:ListedDocument.'\n ].join('\\n')\n}\n\nexport function privateTypeIndexDocument(): string {\n return [\n '@prefix solid: <http://www.w3.org/ns/solid/terms#>.',\n '<>',\n ' a solid:TypeIndex ;',\n ' a solid:UnlistedDocument.'\n ].join('\\n')\n}","export function publicTypeIndexAclDocument(webId: string, publicTypeIndexUri: string): string {\n const fileName = new URL(publicTypeIndexUri).pathname.split('/').pop() || 'publicTypeIndex.ttl'\n return [\n '# ACL resource for the Public Type Index',\n '',\n '@prefix acl: <http://www.w3.org/ns/auth/acl#>.',\n '@prefix foaf: <http://xmlns.com/foaf/0.1/>.',\n '',\n '<#owner>',\n ' a acl:Authorization;',\n '',\n ' acl:agent',\n ` <${webId}>;`,\n '',\n ` acl:accessTo <./${fileName}>;`,\n '',\n ' acl:mode',\n ' acl:Read, acl:Write, acl:Control.',\n '',\n '# Public-readable',\n '<#public>',\n ' a acl:Authorization;',\n '',\n ' acl:agentClass foaf:Agent;',\n '',\n ` acl:accessTo <./${fileName}>;`,\n '',\n ' acl:mode acl:Read.'\n ].join('\\n')\n}\n","import { NamedNode, Statement, sym } from 'rdflib'\n\n/**\n * Container-related class\n */\nexport function createContainerLogic(store) {\n\n function getContainerElements(containerNode: NamedNode): NamedNode[] {\n return store\n .statementsMatching(\n containerNode,\n sym('http://www.w3.org/ns/ldp#contains'),\n undefined\n )\n .map((st: Statement) => st.object as NamedNode)\n }\n\n function isContainer(url: NamedNode) {\n const nodeToString = url.value\n return nodeToString.charAt(nodeToString.length - 1) === '/'\n }\n\n async function createContainer(url: string) {\n const stringToNode = sym(url)\n if (!isContainer(stringToNode)) {\n throw new Error(`Not a container URL ${url}`)\n }\n // Copied from https://github.com/solidos/solid-crud-tests/blob/v3.1.0/test/surface/create-container.test.ts#L56-L64\n const result = await store.fetcher._fetch(url, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'text/turtle',\n 'If-None-Match': '*',\n Link: '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"', // See https://github.com/solidos/node-solid-server/issues/1465\n },\n body: ' ', // work around https://github.com/michielbdejong/community-server/issues/4#issuecomment-776222863\n })\n // Treat 409 as idempotent success: another process/request already created the container.\n if (result.status === 409) {\n return\n }\n if (result.status.toString()[0] !== '2') {\n throw new Error(`Not OK: got ${result.status} response while creating container at ${url}`)\n }\n }\n\n async function getContainerMembers(containerUrl: NamedNode): Promise<NamedNode[]> {\n await store.fetcher.load(containerUrl)\n return getContainerElements(containerUrl)\n }\n return {\n isContainer,\n createContainer,\n getContainerElements,\n getContainerMembers\n }\n}","import { literal, NamedNode, st, sym } from 'rdflib'\nimport { ACL_LINK } from '../acl/aclLogic'\nimport { CrossOriginForbiddenError, FetchError, NotEditableError, SameOriginForbiddenError, UnauthorizedError, WebOperationError } from '../logic/CustomError'\nimport * as debug from '../util/debug'\nimport { ns as namespace } from '../util/ns'\nimport { privateTypeIndexDocument, publicTypeIndexDocument } from '../typeIndex/typeIndexDocuments'\nimport { publicTypeIndexAclDocument } from '../typeIndex/typeIndexAclDocuments'\nimport { preferencesFileDocument } from './profileDocuments'\nimport { ownerOnlyContainerAclDocument } from './profileAclDocuments'\nimport { createContainerLogic } from '../util/containerLogic'\nimport { differentOrigin, suggestPreferencesFile } from '../util/utils'\nimport { ProfileLogic } from '../types'\n\nexport function createProfileLogic(store, authn, utilityLogic): ProfileLogic {\n const ns = namespace\n const containerLogic = createContainerLogic(store)\n const loadPreferencesInFlight = new Map<string, Promise<NamedNode>>()\n const cachedPreferencesFileByWebId = new Map<string, NamedNode>()\n\n function isAbsoluteHttpUri(uri: string | null | undefined): boolean {\n return !!uri && (uri.startsWith('https://') || uri.startsWith('http://'))\n }\n\n function docDirUri(node: NamedNode): string | null {\n const doc = node.doc()\n const dir = doc.dir()\n if (dir?.uri && isAbsoluteHttpUri(dir.uri)) return dir.uri\n const docUri = doc.uri\n if (!docUri || !isAbsoluteHttpUri(docUri)) return null\n const withoutFragment = docUri.split('#')[0]\n const lastSlash = withoutFragment.lastIndexOf('/')\n if (lastSlash === -1) return null\n return withoutFragment.slice(0, lastSlash + 1)\n }\n\n function suggestTypeIndexInPreferences(preferencesFile: NamedNode, filename: string): NamedNode {\n const dirUri = docDirUri(preferencesFile)\n if (!dirUri) throw new Error(`Cannot derive directory for preferences file ${preferencesFile.uri}`)\n return sym(dirUri + filename)\n }\n\n function isNotFoundError(err: any): boolean {\n if (err?.response?.status === 404) return true\n const text = `${err?.message || err || ''}`\n return text.includes('404') || text.includes('Not Found')\n }\n\n async function ensureContainerExists(containerUri: string): Promise<void> {\n const containerNode = sym(containerUri)\n try {\n await store.fetcher.load(containerNode)\n return\n } catch (err) {\n if (!isNotFoundError(err)) throw err\n }\n await containerLogic.createContainer(containerUri)\n }\n\n async function ensureOwnerOnlyAclForSettings(user: NamedNode, preferencesFile: NamedNode): Promise<void> {\n const dirUri = docDirUri(preferencesFile)\n if (!dirUri) throw new Error(`Cannot derive settings directory from ${preferencesFile.uri}`)\n await ensureContainerExists(dirUri)\n\n const containerNode = sym(dirUri)\n let aclDocUri: string | undefined\n try {\n await store.fetcher.load(containerNode)\n aclDocUri = store.any(containerNode, ACL_LINK)?.value\n } catch (err) {\n if (!isNotFoundError(err)) throw err\n }\n if (!aclDocUri) {\n // Fallback for servers/tests where rel=acl is not exposed in mocked headers.\n aclDocUri = `${dirUri}.acl`\n }\n const aclDoc = sym(aclDocUri)\n try {\n await store.fetcher.load(aclDoc)\n return\n } catch (err) {\n if (!isNotFoundError(err)) throw err\n }\n\n await store.fetcher.webOperation('PUT', aclDoc.uri, {\n data: ownerOnlyContainerAclDocument(user.uri),\n contentType: 'text/turtle'\n })\n }\n\n async function ensurePublicTypeIndexAclOnCreate(user: NamedNode, publicTypeIndex: NamedNode, ensureAcl = false): Promise<void> {\n const created = await utilityLogic.loadOrCreateWithContentOnCreate(publicTypeIndex, publicTypeIndexDocument())\n if (!created && !ensureAcl) return\n\n let aclDocUri: string | undefined\n try {\n await store.fetcher.load(publicTypeIndex)\n aclDocUri = store.any(publicTypeIndex, ACL_LINK)?.value\n } catch (err) {\n if (!isNotFoundError(err)) throw err\n }\n if (!aclDocUri) {\n aclDocUri = `${publicTypeIndex.uri}.acl`\n }\n\n const aclDoc = sym(aclDocUri)\n try {\n await store.fetcher.webOperation('PUT', aclDoc.uri, {\n data: publicTypeIndexAclDocument(user.uri, publicTypeIndex.uri),\n contentType: 'text/turtle',\n headers: { 'If-None-Match': '*' }\n })\n } catch (err: any) {\n const status = err?.response?.status ?? err?.status\n if (status !== 412) throw err\n }\n }\n\n async function ensurePrivateTypeIndexOnCreate(privateTypeIndex: NamedNode): Promise<void> {\n await utilityLogic.loadOrCreateWithContentOnCreate(privateTypeIndex, privateTypeIndexDocument())\n }\n\n async function initializePreferencesDefaults(user: NamedNode, preferencesFile: NamedNode): Promise<void> {\n const preferencesDoc = preferencesFile.doc() as NamedNode\n const profileDoc = user.doc() as NamedNode\n await store.fetcher.load(preferencesDoc)\n\n const profilePublicTypeIndex =\n (store.any(user, ns.solid('publicTypeIndex'), null, profileDoc) as NamedNode | null)\n const preferencesPublicTypeIndex =\n (store.any(user, ns.solid('publicTypeIndex'), null, preferencesDoc) as NamedNode | null)\n const publicTypeIndex =\n profilePublicTypeIndex ||\n preferencesPublicTypeIndex ||\n suggestTypeIndexInPreferences(preferencesFile, 'publicTypeIndex.ttl')\n const privateTypeIndex =\n (store.any(user, ns.solid('privateTypeIndex'), null, preferencesDoc) as NamedNode | null) ||\n suggestTypeIndexInPreferences(preferencesFile, 'privateTypeIndex.ttl')\n\n // Keep discovery consistent with typeIndexLogic, which resolves publicTypeIndex from the profile doc.\n const createdProfilePublicTypeIndexLink = !profilePublicTypeIndex\n if (createdProfilePublicTypeIndexLink) {\n await utilityLogic.followOrCreateLinkWithContentOnCreate(\n user,\n ns.solid('publicTypeIndex') as NamedNode,\n publicTypeIndex,\n profileDoc,\n publicTypeIndexDocument()\n )\n }\n\n const toInsert: any[] = []\n if (!store.holds(preferencesDoc, ns.rdf('type'), ns.space('ConfigurationFile'), preferencesDoc)) {\n toInsert.push(st(preferencesDoc, ns.rdf('type'), ns.space('ConfigurationFile'), preferencesDoc))\n }\n if (!store.holds(preferencesDoc, ns.dct('title'), undefined, preferencesDoc)) {\n toInsert.push(st(preferencesDoc, ns.dct('title'), literal('Preferences file'), preferencesDoc))\n }\n if (!store.holds(user, ns.solid('publicTypeIndex'), publicTypeIndex, preferencesDoc)) {\n toInsert.push(st(user, ns.solid('publicTypeIndex'), publicTypeIndex, preferencesDoc))\n }\n if (!store.holds(user, ns.solid('privateTypeIndex'), privateTypeIndex, preferencesDoc)) {\n toInsert.push(st(user, ns.solid('privateTypeIndex'), privateTypeIndex, preferencesDoc))\n }\n\n if (toInsert.length > 0) {\n await store.updater.update([], toInsert)\n await store.fetcher.load(preferencesDoc)\n }\n\n await ensurePublicTypeIndexAclOnCreate(user, publicTypeIndex, createdProfilePublicTypeIndexLink)\n await ensurePrivateTypeIndexOnCreate(privateTypeIndex)\n }\n\n async function ensurePreferencesDocExists(preferencesFile: NamedNode): Promise<boolean> {\n try {\n const created = await utilityLogic.loadOrCreateWithContentOnCreate(preferencesFile, preferencesFileDocument())\n if (created) {\n return true\n }\n return false\n } catch (err) {\n if (err.response?.status === 401) {\n throw new UnauthorizedError()\n }\n if (err.response?.status === 403) {\n if (differentOrigin(preferencesFile)) {\n throw new CrossOriginForbiddenError()\n }\n throw new SameOriginForbiddenError()\n }\n throw err\n }\n }\n\n /**\n * loads the preference without throwing errors - if it can create it it does so.\n * remark: it still throws error if it cannot load profile.\n * @param user\n * @returns undefined if preferenceFile cannot be returned or NamedNode if it can find it or create it\n */\n async function silencedLoadPreferences(user: NamedNode): Promise <NamedNode | undefined> {\n try {\n return await loadPreferences(user)\n } catch (err) {\n return undefined\n }\n }\n\n /**\n * loads the preference without returning different errors if it cannot create or load it.\n * remark: it also throws error if it cannot load profile.\n * @param user\n * @returns undefined if preferenceFile cannot be an Error or NamedNode if it can find it or create it\n */\n async function loadPreferences (user: NamedNode): Promise <NamedNode> {\n const cachedPreferencesFile = cachedPreferencesFileByWebId.get(user.uri)\n if (cachedPreferencesFile) {\n return cachedPreferencesFile\n }\n\n const inFlight = loadPreferencesInFlight.get(user.uri)\n if (inFlight) {\n return inFlight\n }\n\n const run = (async (): Promise<NamedNode> => {\n await loadProfile(user)\n\n const possiblePreferencesFile = suggestPreferencesFile(user)\n let preferencesFile\n try {\n const existingPreferencesFile = store.any(user, ns.space('preferencesFile'), null, user.doc()) as NamedNode | null\n if (existingPreferencesFile) {\n preferencesFile = existingPreferencesFile\n } else {\n preferencesFile = await utilityLogic.followOrCreateLink(user, ns.space('preferencesFile') as NamedNode, possiblePreferencesFile, user.doc())\n }\n\n await ensureOwnerOnlyAclForSettings(user, preferencesFile as NamedNode)\n await ensurePreferencesDocExists(preferencesFile as NamedNode)\n await initializePreferencesDefaults(user, preferencesFile as NamedNode)\n } catch (err) {\n const message = `User ${user} has no pointer in profile to preferences file.`\n debug.warn(message)\n // we are listing the possible errors\n if (err instanceof NotEditableError) { throw err }\n if (err instanceof WebOperationError) { throw err }\n if (err instanceof UnauthorizedError) { throw err }\n if (err instanceof CrossOriginForbiddenError) { throw err }\n if (err instanceof SameOriginForbiddenError) { throw err }\n if (err instanceof FetchError) { throw err }\n throw err\n }\n\n try {\n await store.fetcher.load(preferencesFile as NamedNode)\n } catch (err) { // Maybe a permission problem or origin problem\n const msg = `Unable to load preference of user ${user}: ${err}`\n if (err.response?.status === 404) {\n // Self-heal when a stale profile pointer references a missing preferences file.\n await ensureOwnerOnlyAclForSettings(user, preferencesFile as NamedNode)\n await ensurePreferencesDocExists(preferencesFile as NamedNode)\n await initializePreferencesDefaults(user, preferencesFile as NamedNode)\n await store.fetcher.load(preferencesFile as NamedNode)\n return preferencesFile as NamedNode\n }\n debug.warn(msg)\n if (err.response.status === 401) {\n throw new UnauthorizedError()\n }\n if (err.response.status === 403) {\n if (differentOrigin(preferencesFile)) {\n throw new CrossOriginForbiddenError()\n }\n throw new SameOriginForbiddenError()\n }\n /*if (err.response.status === 404) {\n throw new NotFoundError();\n }*/\n throw new Error(msg)\n }\n cachedPreferencesFileByWebId.set(user.uri, preferencesFile as NamedNode)\n return preferencesFile as NamedNode\n })()\n\n loadPreferencesInFlight.set(user.uri, run)\n try {\n return await run\n } finally {\n if (loadPreferencesInFlight.get(user.uri) === run) {\n loadPreferencesInFlight.delete(user.uri)\n }\n }\n }\n\n async function loadProfile (user: NamedNode):Promise <NamedNode> {\n if (!user) {\n throw new Error('loadProfile: no user given.')\n }\n try {\n await store.fetcher.load(user.doc())\n } catch (err) {\n throw new Error(`Unable to load profile of user ${user}: ${err}`)\n }\n return user.doc()\n }\n\n async function loadMe(): Promise<NamedNode> {\n const me = authn.currentUser()\n if (me === null) {\n throw new Error('Current user not found! Not logged in?')\n }\n await store.fetcher.load(me.doc())\n return me\n }\n\n function getPodRoot(user: NamedNode): NamedNode {\n const podRoot = findStorage(user)\n if (!podRoot) {\n throw new Error('User pod root not found!')\n }\n return podRoot as NamedNode\n }\n\n async function getMainInbox(user: NamedNode): Promise<NamedNode> {\n await store.fetcher.load(user)\n const mainInbox = store.any(user, ns.ldp('inbox'), undefined, user.doc())\n if (!mainInbox) {\n throw new Error('User main inbox not found!')\n }\n return mainInbox as NamedNode\n }\n\n function findStorage(me: NamedNode) {\n return store.any(me, ns.space('storage'), undefined, me.doc())\n }\n\n return {\n loadMe,\n getPodRoot,\n getMainInbox,\n findStorage,\n loadPreferences,\n loadProfile,\n silencedLoadPreferences\n }\n}\n","export function ownerOnlyContainerAclDocument(webId: string): string {\n return [\n '@prefix acl: <http://www.w3.org/ns/auth/acl#>.',\n '',\n '<#owner>',\n 'a acl:Authorization;',\n `acl:agent <${webId}>;`,\n 'acl:accessTo <./>;',\n 'acl:default <./>;',\n 'acl:mode acl:Read, acl:Write, acl:Control.'\n ].join('\\n')\n}\n","export function preferencesFileDocument(): string {\n return [\n '@prefix dct: <http://purl.org/dc/terms/>.',\n '@prefix pim: <http://www.w3.org/ns/pim/space#>.',\n '@prefix solid: <http://www.w3.org/ns/solid/terms#>.',\n '<>',\n ' a pim:ConfigurationFile ;',\n ' dct:title \"Preferences file\".'\n ].join('\\n')\n}\n","import { NamedNode, st, sym } from 'rdflib'\nimport { ScopedApp, TypeIndexLogic, TypeIndexScope } from '../types'\nimport * as debug from '../util/debug'\nimport { ns as namespace } from '../util/ns'\nimport { newThing } from '../util/utils'\nimport { privateTypeIndexDocument, publicTypeIndexDocument } from './typeIndexDocuments'\n\nexport function createTypeIndexLogic(store, authn, profileLogic, utilityLogic): TypeIndexLogic {\n const ns = namespace\n\n function isAbsoluteHttpUri(uri: string | null | undefined): boolean {\n return !!uri && (uri.startsWith('https://') || uri.startsWith('http://'))\n }\n\n function getRegistrations(instance, theClass) {\n return store\n .each(undefined, ns.solid('instance'), instance)\n .filter((r) => {\n return store.holds(r, ns.solid('forClass'), theClass)\n })\n }\n\n async function loadTypeIndexesFor(user: NamedNode): Promise<Array<TypeIndexScope>> {\n if (!user) throw new Error('loadTypeIndexesFor: No user given')\n const profile = await profileLogic.loadProfile(user)\n\n let suggestion: NamedNode | null = null\n try {\n suggestion = suggestPublicTypeIndex(user)\n } catch (err) {\n const message = `User ${user} has no usable profile document directory for publicTypeIndex.`\n debug.warn(message)\n }\n let publicTypeIndex\n try {\n const existingPublicTypeIndex = store.any(user, ns.solid('publicTypeIndex'), undefined, profile)\n if (existingPublicTypeIndex) {\n publicTypeIndex = existingPublicTypeIndex\n } else if (suggestion) {\n publicTypeIndex = await utilityLogic.followOrCreateLinkWithContentOnCreate(\n user,\n ns.solid('publicTypeIndex') as NamedNode,\n suggestion,\n profile,\n publicTypeIndexDocument()\n )\n } else {\n publicTypeIndex = null\n }\n } catch (err) {\n const message = `User ${user} has no pointer in profile to publicTypeIndex file: ${err}`\n debug.warn(message)\n }\n const publicScopes = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex as NamedNode, agent: user }] : []\n\n let preferencesFile\n try {\n preferencesFile = await profileLogic.silencedLoadPreferences(user)\n } catch (err) {\n preferencesFile = null\n }\n\n let privateScopes\n if (preferencesFile) { // watch out - can be in either as spec was not clear. Legacy is profile.\n // If there is a legacy one linked from the profile, use that.\n // Otherwiae use or make one linked from Preferences\n let suggestedPrivateTypeIndex: NamedNode | null = null\n try {\n suggestedPrivateTypeIndex = suggestPrivateTypeIndex(preferencesFile)\n } catch (err) {\n const message = `User ${user} has no usable preferences document directory for privateTypeIndex.`\n debug.warn(message)\n }\n let privateTypeIndex\n try {\n const existingPrivateTypeIndex = store.any(user, ns.solid('privateTypeIndex'), undefined, profile)\n if (existingPrivateTypeIndex) {\n privateTypeIndex = existingPrivateTypeIndex\n } else if (suggestedPrivateTypeIndex) {\n privateTypeIndex = await utilityLogic.followOrCreateLinkWithContentOnCreate(\n user,\n ns.solid('privateTypeIndex') as NamedNode,\n suggestedPrivateTypeIndex,\n preferencesFile,\n privateTypeIndexDocument()\n )\n } else {\n privateTypeIndex = null\n }\n } catch (err) {\n const message = `User ${user} has no pointer in preference file to privateTypeIndex file: ${err}`\n debug.warn(message)\n }\n privateScopes = privateTypeIndex ? [{ label: 'private', index: privateTypeIndex as NamedNode, agent: user }] : []\n } else {\n privateScopes = []\n }\n const scopes = publicScopes.concat(privateScopes)\n if (scopes.length === 0) return scopes\n const files = scopes.map(scope => scope.index)\n try {\n await store.fetcher.load(files)\n } catch (err) {\n debug.warn('Problems loading type index: ', err)\n }\n return scopes\n }\n\n async function loadCommunityTypeIndexes(user: NamedNode): Promise<TypeIndexScope[]> {\n let preferencesFile\n try {\n preferencesFile = await profileLogic.silencedLoadPreferences(user)\n } catch (err) {\n const message = `User ${user} has no pointer in profile to preferences file.`\n debug.warn(message)\n }\n if (preferencesFile) { // For now, pick up communities as simple links from the preferences file.\n const communities = store.each(user, ns.solid('community'), undefined, preferencesFile as NamedNode).concat(\n store.each(user, ns.solid('community'), undefined, user.doc() as NamedNode)\n )\n let result = []\n for (const org of communities) {\n if (org.termType !== 'NamedNode' || !isAbsoluteHttpUri((org as NamedNode).uri)) {\n debug.warn(`Skipping malformed community node for ${user}: ${org}`)\n continue\n }\n try {\n result = result.concat(await loadTypeIndexesFor(org as NamedNode) as any)\n } catch (err) {\n debug.warn(`Skipping community type indexes for ${(org as NamedNode).uri}: ${err}`)\n }\n }\n return result\n }\n return [] // No communities\n }\n\n async function loadAllTypeIndexes(user: NamedNode) {\n return (await loadTypeIndexesFor(user)).concat(await loadCommunityTypeIndexes(user))\n }\n\n async function getScopedAppInstances(klass: NamedNode, user: NamedNode): Promise<ScopedApp[]> {\n const scopes = await loadAllTypeIndexes(user)\n let scopedApps = []\n for (const scope of scopes) {\n const scopedApps0 = await getScopedAppsFromIndex(scope, klass) as any\n scopedApps = scopedApps.concat(scopedApps0)\n }\n return scopedApps\n }\n\n // This is the function signature which used to be in solid-ui/logic\n // Recommended to use getScopedAppInstances instead as it provides more information.\n //\n async function getAppInstances(klass: NamedNode): Promise<NamedNode[]> {\n const user = authn.currentUser()\n if (!user) throw new Error('getAppInstances: Must be logged in to find apps.')\n const scopedAppInstances = await getScopedAppInstances(klass, user)\n return scopedAppInstances.map(scoped => scoped.instance)\n }\n\n function docDirUri(node: NamedNode): string | null {\n const doc = node.doc()\n const dir = doc.dir()\n if (dir?.uri && isAbsoluteHttpUri(dir.uri)) return dir.uri\n const docUri = doc.uri\n if (!docUri || !isAbsoluteHttpUri(docUri)) {\n debug.log(`docDirUri: missing or non-http(s) doc uri for ${node?.uri}`)\n return null\n }\n const withoutFragment = docUri.split('#')[0]\n const lastSlash = withoutFragment.lastIndexOf('/')\n if (lastSlash === -1) {\n debug.log(`docDirUri: no slash in doc uri ${docUri}`)\n return null\n }\n return withoutFragment.slice(0, lastSlash + 1)\n }\n\n function suggestPublicTypeIndex(me: NamedNode) {\n const dirUri = docDirUri(me)\n if (!dirUri) throw new Error(`suggestPublicTypeIndex: Cannot derive directory for ${me.uri}`)\n return sym(dirUri + 'publicTypeIndex.ttl')\n }\n // Note this one is based off the pref file not the profile\n\n function suggestPrivateTypeIndex(preferencesFile: NamedNode) {\n const dirUri = docDirUri(preferencesFile)\n if (!dirUri) throw new Error(`suggestPrivateTypeIndex: Cannot derive directory for ${preferencesFile.uri}`)\n return sym(dirUri + 'privateTypeIndex.ttl')\n }\n\n /*\n * Register a new app in a type index\n * used in chat in bookmark.js (solid-ui)\n * Returns the registration object if successful else null\n */\n async function registerInTypeIndex(\n instance: NamedNode,\n index: NamedNode,\n theClass: NamedNode,\n // agent: NamedNode\n ): Promise<NamedNode | null> {\n const registration = newThing(index)\n const ins = [\n // See https://github.com/solid/solid/blob/main/proposals/data-discovery.md\n st(registration, ns.rdf('type'), ns.solid('TypeRegistration'), index),\n st(registration, ns.solid('forClass'), theClass, index),\n st(registration, ns.solid('instance'), instance, index)\n ]\n try {\n await store.updater.update([], ins)\n } catch (err) {\n const msg = `Unable to register ${instance} in index ${index}: ${err}`\n console.warn(msg)\n return null\n }\n return registration\n }\n\n async function deleteTypeIndexRegistration(item) {\n const reg = store.the(null, ns.solid('instance'), item.instance, item.scope.index) as NamedNode\n if (!reg) throw new Error(`deleteTypeIndexRegistration: No registration found for ${item.instance}`)\n const statements = store.statementsMatching(reg, null, null, item.scope.index)\n await store.updater.update(statements, [])\n }\n\n async function getScopedAppsFromIndex(scope: TypeIndexScope, theClass: NamedNode | null): Promise<ScopedApp[]> {\n const index = scope.index\n const results: ScopedApp[] = []\n const registrations = store.statementsMatching(null, ns.solid('instance'), null, index)\n .concat(store.statementsMatching(null, ns.solid('instanceContainer'), null, index))\n .map(st => st.subject)\n for (const reg of registrations) {\n const klass = store.any(reg, ns.solid('forClass'), null, index)\n if (!theClass || klass.sameTerm(theClass)) {\n const instances = store.each(reg, ns.solid('instance'), null, index)\n for (const instance of instances) {\n results.push({ instance, type: klass, scope })\n }\n const containers = store.each(reg, ns.solid('instanceContainer'), null, index)\n for (const instance of containers) {\n await store.fetcher.load(instance)\n results.push({ instance: sym(instance.value), type: klass, scope })\n }\n }\n }\n return results\n }\n\n return {\n registerInTypeIndex,\n getRegistrations,\n loadTypeIndexesFor,\n loadCommunityTypeIndexes,\n loadAllTypeIndexes,\n getScopedAppInstances,\n getAppInstances,\n suggestPublicTypeIndex,\n suggestPrivateTypeIndex,\n deleteTypeIndexRegistration,\n getScopedAppsFromIndex\n }\n}\n","import * as rdf from 'rdflib'\nimport { LiveStore, NamedNode, Statement } from 'rdflib'\nimport { createAclLogic } from '../acl/aclLogic'\nimport { SolidAuthnLogic } from '../authn/SolidAuthnLogic'\nimport type { SessionWithLegacyEvents } from '../authSession/authSession'\nimport { createChatLogic } from '../chat/chatLogic'\nimport { createInboxLogic } from '../inbox/inboxLogic'\nimport { createProfileLogic } from '../profile/profileLogic'\nimport { createTypeIndexLogic } from '../typeIndex/typeIndexLogic'\nimport { createContainerLogic } from '../util/containerLogic'\nimport { createUtilityLogic } from '../util/utilityLogic'\nimport type { AuthnLogic, SolidLogic } from '../types'\nimport * as debug from '../util/debug'\n/*\n** It is important to distinquish `fetch`, a function provided by the browser\n** and `Fetcher`, a helper object for the rdflib Store which turns it\n** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is\n** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,\n*/\nexport function createSolidLogic(specialFetch: { fetch: (url: any, requestInit: any) => any }, session: SessionWithLegacyEvents): SolidLogic {\n\n debug.log('SolidLogic: Unique instance created. There should only be one of these.')\n const store: LiveStore = rdf.graph() as LiveStore\n rdf.fetcher(store, {fetch: specialFetch.fetch}) // Attach a web I/O module, store.fetcher\n store.updater = new rdf.UpdateManager(store) // Add real-time live updates store.updater\n store.features = [] // disable automatic node merging on store load\n\n const authn: AuthnLogic = new SolidAuthnLogic(session)\n \n const acl = createAclLogic(store)\n const containerLogic = createContainerLogic(store)\n const utilityLogic = createUtilityLogic(store, acl, containerLogic)\n const profile = createProfileLogic(store, authn, utilityLogic)\n const chat = createChatLogic(store, profile)\n const inbox = createInboxLogic(store, profile, utilityLogic, containerLogic, acl)\n const typeIndex = createTypeIndexLogic(store, authn, profile, utilityLogic)\n debug.log('SolidAuthnLogic initialized')\n\n function load(doc: NamedNode | NamedNode[] | string) {\n return store.fetcher.load(doc)\n }\n\n // @@@@ use the one in rdflib.js when it is available and delete this\n function updatePromise(\n del: Array<Statement>,\n ins: Array<Statement> = []\n ): Promise<void> {\n return new Promise((resolve, reject) => {\n store.updater.update(del, ins, function (_uri, ok, errorBody) {\n if (!ok) {\n reject(new Error(errorBody))\n } else {\n resolve()\n }\n }) // callback\n }) // promise\n }\n\n function clearStore() {\n store.statements.slice().forEach(store.remove.bind(store))\n }\n\n return {\n store,\n authn,\n acl,\n inbox,\n chat,\n profile,\n typeIndex,\n load,\n updatePromise,\n clearStore\n }\n}\n","import { NamedNode, st, sym } from 'rdflib'\nimport {\n CrossOriginForbiddenError,\n FetchError,\n NotEditableError,\n SameOriginForbiddenError,\n UnauthorizedError,\n WebOperationError\n} from '../logic/CustomError'\nimport * as debug from '../util/debug'\nimport { differentOrigin } from './utils'\n\nexport function createUtilityLogic(store, aclLogic, containerLogic) {\n async function recursiveDelete(containerNode: NamedNode) {\n try {\n if (containerLogic.isContainer(containerNode)) {\n const aclDocUrl = await aclLogic.findAclDocUrl(containerNode)\n await store.fetcher._fetch(aclDocUrl, { method: 'DELETE' })\n const containerMembers = await containerLogic.getContainerMembers(containerNode)\n await Promise.all(containerMembers.map((url) => recursiveDelete(url)))\n }\n return store.fetcher._fetch(containerNode.value, { method: 'DELETE' })\n } catch (e) {\n debug.log(`Please manually remove ${containerNode.value} from your system.`, e)\n }\n }\n\n /**\n * Create a resource if it really does not exist.\n * Be absolutely sure something does not exist before creating a new empty file,\n * as otherwise existing content could be deleted.\n */\n async function loadOrCreateIfNotExists(doc: NamedNode) {\n try {\n return await store.fetcher.load(doc)\n } catch (err: any) {\n if (err?.response?.status === 404) {\n try {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data: '',\n contentType: 'text/turtle',\n headers: { 'If-None-Match': '*' }\n })\n } catch (putErr: any) {\n const status = putErr?.response?.status ?? putErr?.status\n if (status !== 412) {\n const msg = `createIfNotExists: PUT FAILED: ${doc}: ${putErr}`\n throw new WebOperationError(msg)\n }\n }\n return await store.fetcher.load(doc)\n }\n if (err?.response?.status === 401) {\n throw new UnauthorizedError()\n }\n if (err?.response?.status === 403) {\n if (differentOrigin(doc)) {\n throw new CrossOriginForbiddenError()\n }\n throw new SameOriginForbiddenError()\n }\n const msg = `createIfNotExists doc load error: ${doc}: ${err}`\n throw new FetchError(err?.status, `${err?.message || ''}${msg}`)\n }\n }\n\n async function loadOrCreateWithContentOnCreate(doc: NamedNode, data: string): Promise<boolean> {\n try {\n await store.fetcher.load(doc)\n return false\n } catch (err: any) {\n const status = err?.response?.status ?? err?.status\n if (status !== 404) {\n throw err\n }\n }\n\n try {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data,\n contentType: 'text/turtle',\n headers: { 'If-None-Match': '*' }\n })\n return true\n } catch (err: any) {\n const status = err?.response?.status ?? err?.status\n if (status === 412) {\n // Another client created the resource between our 404 check and PUT.\n return false\n }\n throw err\n }\n }\n\n /*\n * Follow link from this doc to another thing, or else make a new link.\n * Returns existing object, or creates it if non-existent.\n */\n async function followOrCreateLink(\n subject: NamedNode,\n predicate: NamedNode,\n object: NamedNode,\n doc: NamedNode\n ): Promise<NamedNode | null> {\n await store.fetcher.load(doc)\n const result = store.any(subject, predicate, null, doc)\n\n if (result) return result as NamedNode\n if (!store.updater.editable(doc)) {\n const msg = `followOrCreateLink: cannot edit ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n\n try {\n await store.updater.update([], [st(subject, predicate, object, doc)])\n } catch (err) {\n const msg = `followOrCreateLink: Error making link in ${doc} to ${object}: ${err}`\n debug.warn(msg)\n throw new WebOperationError(err)\n }\n\n try {\n await loadOrCreateIfNotExists(object)\n } catch (err) {\n debug.warn(`followOrCreateLink: Error loading or saving new linked document: ${object}: ${err}`)\n throw err\n }\n return object\n }\n\n async function followOrCreateLinkWithContentOnCreate(\n subject: NamedNode,\n predicate: NamedNode,\n object: NamedNode,\n doc: NamedNode,\n data: string\n ): Promise<NamedNode | null> {\n await store.fetcher.load(doc)\n const result = store.any(subject, predicate, null, doc)\n\n if (result) return result as NamedNode\n if (!store.updater.editable(doc)) {\n const msg = `followOrCreateLinkWithContentOnCreate: cannot edit ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n\n try {\n await store.updater.update([], [st(subject, predicate, object, doc)])\n } catch (err) {\n const msg = `followOrCreateLinkWithContentOnCreate: Error making link in ${doc} to ${object}: ${err}`\n debug.warn(msg)\n throw new WebOperationError(msg)\n }\n\n try {\n await loadOrCreateWithContentOnCreate(object, data)\n } catch (err) {\n debug.warn(`followOrCreateLinkWithContentOnCreate: Error loading or saving new linked document: ${object}: ${err}`)\n throw err\n }\n return object\n }\n\n // Copied from\n // https://github.com/solidos/web-access-control-tests/blob/v3.0.0/test/surface/delete.test.ts#L5\n async function setSinglePeerAccess(options: {\n ownerWebId: string,\n peerWebId: string,\n accessToModes?: string,\n defaultModes?: string,\n target: string\n }) {\n let str = [\n '@prefix acl: <http://www.w3.org/ns/auth/acl#>.',\n '',\n '<#alice> a acl:Authorization;\\n acl:agent <' + options.ownerWebId + '>;',\n ` acl:accessTo <${options.target}>;`,\n ` acl:default <${options.target}>;`,\n ' acl:mode acl:Read, acl:Write, acl:Control.',\n ''\n ].join('\\n')\n\n if (options.accessToModes) {\n str += [\n '<#bobAccessTo> a acl:Authorization;',\n ` acl:agent <${options.peerWebId}>;`,\n ` acl:accessTo <${options.target}>;`,\n ` acl:mode ${options.accessToModes}.`,\n ''\n ].join('\\n')\n }\n\n if (options.defaultModes) {\n str += [\n '<#bobDefault> a acl:Authorization;',\n ` acl:agent <${options.peerWebId}>;`,\n ` acl:default <${options.target}>;`,\n ` acl:mode ${options.defaultModes}.`,\n ''\n ].join('\\n')\n }\n\n const aclDocUrl = await aclLogic.findAclDocUrl(sym(options.target))\n return store.fetcher._fetch(aclDocUrl, {\n method: 'PUT',\n body: str,\n headers: [['Content-Type', 'text/turtle']]\n })\n }\n\n async function createEmptyRdfDoc(doc: NamedNode, comment: string) {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data: `# ${new Date()} ${comment}\\n`,\n contentType: 'text/turtle'\n })\n }\n\n return {\n recursiveDelete,\n setSinglePeerAccess,\n createEmptyRdfDoc,\n followOrCreateLink,\n followOrCreateLinkWithContentOnCreate,\n loadOrCreateIfNotExists,\n loadOrCreateWithContentOnCreate\n }\n}\n","import * as debug from '../util/debug'\nimport { authSession } from '../authSession/authSession'\nimport { createSolidLogic } from './solidLogic'\nimport { SolidLogic } from '../types'\n\nconst _fetch = async (url, requestInit) => {\n const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'\n const sessionAny = authSession as any\n const sessionWebId = sessionAny?.info?.webId || sessionAny?.webId\n if (sessionWebId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114\n // In fact fetch should respect credentials omit itself\n const authenticatedFetch = (typeof sessionAny.fetch === 'function')\n ? sessionAny.fetch.bind(sessionAny)\n : (typeof sessionAny.authFetch === 'function' ? sessionAny.authFetch.bind(sessionAny) : null)\n if (authenticatedFetch) {\n return authenticatedFetch(url, requestInit)\n }\n return window.fetch(url, requestInit)\n } else {\n return window.fetch(url, requestInit)\n }\n}\n\n// Global singleton pattern to ensure unique store across library versions\nconst SINGLETON_SYMBOL = Symbol.for('solid-logic-singleton')\n\n// Type the global object properly with the singleton\ninterface GlobalWithSingleton {\n [SINGLETON_SYMBOL]?: SolidLogic\n}\n\nconst globalTarget = (typeof window !== 'undefined' ? window : global) as GlobalWithSingleton\n\nfunction getOrCreateSingleton(): SolidLogic {\n if (!globalTarget[SINGLETON_SYMBOL]) {\n debug.log('SolidLogic: Creating new global singleton instance.')\n globalTarget[SINGLETON_SYMBOL] = createSolidLogic({ fetch: _fetch }, authSession)\n debug.log('Unique quadstore initialized.')\n } else {\n debug.log('SolidLogic: Using existing global singleton instance.')\n }\n return globalTarget[SINGLETON_SYMBOL]!\n}\n//this const makes solidLogicSingleton global accessible in mashlib\nconst solidLogicSingleton = getOrCreateSingleton()\n\nexport { solidLogicSingleton }","export type ServerLogoutOptions = {\n issuer?: string\n postLogoutRedirectPath?: string\n}\n\nexport async function performServerSideLogout (options: ServerLogoutOptions = {}): Promise<boolean> {\n if (typeof window === 'undefined') {\n return false\n }\n const issuer = options.issuer || ''\n const postLogoutRedirectPath = options.postLogoutRedirectPath || '/'\n\n // Provider-specific logout endpoint discovery (OIDC end_session_endpoint).\n try {\n if (issuer) {\n const wellKnownUri = new URL(issuer)\n wellKnownUri.pathname = '/.well-known/openid-configuration'\n const wellKnownResult = await fetch(wellKnownUri.toString(), { credentials: 'include' })\n\n if (wellKnownResult.status === 200) {\n const openidConfiguration = await wellKnownResult.json()\n if (openidConfiguration && openidConfiguration.end_session_endpoint) {\n await fetch(openidConfiguration.end_session_endpoint, { credentials: 'include' })\n }\n }\n }\n } catch (_err) {\n // Continue with local logout even if provider logout is unavailable.\n }\n\n // NSS well-known logout endpoint clears cookie-backed server sessions.\n try {\n const logoutResponse = await fetch('/.well-known/solid/logout', { credentials: 'include' })\n if (logoutResponse.ok || logoutResponse.redirected) {\n window.location.assign(postLogoutRedirectPath)\n return true\n }\n } catch (_err) {\n // Not all deployments expose this endpoint.\n }\n\n return false\n}","const DEFAULT_ISSUERS = [\n {\n name: 'Solid Community',\n uri: 'https://solidcommunity.net'\n },\n {\n name: 'Solid Web',\n uri: 'https://solidweb.org'\n },\n {\n name: 'Solid Web ME',\n uri: 'https://solidweb.me'\n },\n {\n name: 'Inrupt.com',\n uri: 'https://login.inrupt.com'\n }\n]\n\n/**\n * @returns - A list of suggested OIDC issuers\n */\nexport function getSuggestedIssuers (): { name: string, uri: string }[] {\n // Suggest a default list of OIDC issuers\n const issuers = [...DEFAULT_ISSUERS]\n \n // Suggest the current host if not already included\n const { host, origin } = new URL(location.href)\n const hosts = issuers.map(({ uri }) => new URL(uri).host)\n if (!hosts.includes(host)) {\n issuers.unshift({ name: host, uri: origin })\n }\n \n return issuers\n }","// Make these variables directly accessible as it is what you need most of the time\n// This also makes these variable globaly accesible in mashlib\nimport { solidLogicSingleton } from './logic/solidLogicSingleton'\n\nconst authn = solidLogicSingleton.authn\nconst authSession = solidLogicSingleton.authn.authSession\nconst store = solidLogicSingleton.store\n\nexport { ACL_LINK } from './acl/aclLogic'\nexport { offlineTestID, appContext } from './authn/authUtil'\nexport { performServerSideLogout } from './authn/serverLogout'\nexport { getSuggestedIssuers } from './issuer/issuerLogic'\nexport { createTypeIndexLogic } from './typeIndex/typeIndexLogic'\nexport type { AppDetails, SolidNamespace, AuthenticationContext, SolidLogic, ChatLogic } from './types'\nexport { UnauthorizedError, CrossOriginForbiddenError, SameOriginForbiddenError, NotFoundError, FetchError, NotEditableError, WebOperationError } from './logic/CustomError'\n\nexport {\n solidLogicSingleton, // solidLogicSingleton is exported entirely because it is used in solid-panes\n store,\n authn,\n authSession\n}\n\n"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE__264__","aliases","acl","arg","as","bookmark","cal","cco","cert","contact","dc","dct","doap","foaf","geo","gpx","gr","http","httph","icalTZ","ldp","link","log","meeting","mo","org","owl","pad","patch","prov","pto","qu","trip","rdf","rdfs","rss","sched","schema","sioc","skos","solid","space","stat","tab","tabont","ui","vann","vcard","wf","xsd","namedNode","u","namespaces","alias","expansion","localName","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","m","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","g","globalThis","Function","e","window","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","p","b","document","baseURI","self","location","href","args","console","warn","crypto$1","crypto","isCryptoKey","CryptoKey","digest$1","async","algorithm","data","subtleDigest","slice","Uint8Array","subtle","digest","encoder","TextEncoder","decoder","TextDecoder","concat","buffers","size","reduce","acc","length","buf","i","buffer","set","encode","input","unencoded","arr","push","String","fromCharCode","apply","subarray","btoa","join","encodeBase64","replace","decode$1","encoded","decode","binary","atob","bytes","charCodeAt","decodeBase64","TypeError","JOSEError","Error","constructor","message","options","super","code","name","captureStackTrace","JWTClaimValidationFailed","payload","claim","reason","cause","JWTExpired","JOSEAlgNotAllowed","arguments","JOSENotSupported","JWSInvalid","JWTInvalid","JWKInvalid","JWKSInvalid","JWKSNoMatchingKey","JWKSMultipleMatchingKeys","JWKSTimeout","JWSSignatureVerificationFailed","unusable","isAlgorithm","getHashLength","hash","parseInt","checkSigCryptoKey","alg","usages","expected","getNamedCurve","namedCurve","some","includes","msg","last","pop","checkUsage","actual","types","filter","Boolean","invalidKeyInput","withAlg","isKeyLike","isDisjoint$1","headers","sources","header","parameters","keys","parameter","has","add","Set","isObject","toString","getPrototypeOf","proto","checkKeyLength","startsWith","modulusLength","isJWK","kty","asKeyObject","jwk","keyUsages","crv","subtleMapping","rest","ext","key_ops","keyData","use","importKey","exportKeyValue","k","privCache","pubCache","isKeyObject","importAndCache","cache","freeze","cached","cryptoKey","normalize","export","format","dp","dq","q","qi","WeakMap","importJWK","oth","tag","jwkMatchesOp","usage","symmetricTypeCheck","allowJwk","isSecretJWK","type","checkKeyType","test","isPrivateJWK","isPublicJWK","asymmetricTypeCheck","bind","checkKeyTypeWithJwk","validateCrit","Err","recognizedDefault","recognizedOption","protectedHeader","joseHeader","crit","Array","isArray","recognized","Map","entries","validateAlgorithms$1","option","algorithms","s","keyToJWK$1","extractable","exportKey","exportJWK","subtleDsa","saltLength","getCryptoKey","verify$1","signature","verify","compactVerify","jws","split","verified","protected","parsedProt","JSON","parse","b64","resolvedKey","result","unprotectedHeader","flattenedVerify","epoch","date","Math","floor","getTime","day","hour","REGEX","secs","str","matched","exec","parseFloat","numericDate","toLowerCase","round","minute","normalizeTyp","jwtPayload","encodedPayload","typ","requiredClaims","issuer","subject","audience","maxTokenAge","presenceCheck","reverse","iss","sub","audPayload","aud","audOption","tolerance","clockTolerance","currentDate","now","Date","iat","nbf","exp","age","jwtVerify","jwt","sign$1","sign","FlattenedSign","_payload","setProtectedHeader","_protectedHeader","setUnprotectedHeader","_unprotectedHeader","stringify","CompactSign","_flattened","validateInput","label","Number","isFinite","ProduceJWT","setIssuer","setSubject","setAudience","setJti","jwtId","jti","setNotBefore","setExpirationTime","setIssuedAt","SignJWT","sig","check","description","calculateJwkThumbprint","digestAlgorithm","components","x","y","isJWKLike","clone","structuredClone","LocalJWKSet","jwks","_cached","every","isJWKSLike","_jwks","getKey","token","kid","getKtyFromAlg","candidates","candidate","error","asyncIterator","importWithAlgCache","createLocalJWKSet","localJWKSet","defineProperties","configurable","writable","fetchJwks$1","url","timeout","controller","id","timedOut","AbortController","setTimeout","abort","response","fetch","signal","redirect","catch","err","clearTimeout","status","json","USER_AGENT","navigator","userAgent","jwksCache","RemoteJWKSet","URL","cacheMaxAge","_url","_options","agent","_timeoutDuration","timeoutDuration","_cooldownDuration","cooldownDuration","_cacheMaxAge","_cache","uat","_jwksTimestamp","_local","coolingDown","fresh","reload","_pendingFetch","WebSocketPair","EdgeRuntime","Headers","fromEntries","then","createRemoteJWKSet","remoteJWKSet","reloading","getModulusLengthOption","generateKeyPair","publicExponent","generateKey","generateKeyPair$1","redirectForLogin","idp","redirect_uri","client_details","redirect_uri_","redirect_uri_sane","origin","pathname","search","idp_origin","openid_configuration","ok","trim_trailing_slash","endsWith","sessionStorage","setItem","client_id","registration_endpoint","client_registration","client_registration_request_body","grant_types","token_endpoint_auth_method","application_type","subject_type","method","body","requestDynamicClientRegistration","redirect_uris","pkce_code_verifier","pkce_code_challenge","getPKCEcode","csrf_token","randomUUID","redirect_to_idp","encodeURIComponent","requestAccessToken","authorization_code","token_endpoint","key_pair","jwk_public_key","publicKey","dpop","htu","htm","privateKey","URLSearchParams","grant_type","code_verifier","requestFreshTokens","refresh_token","SessionEvents","SessionCore","EventTarget","isActive_","exp_","webId_","currentAth_","information","database","refreshPromise","resolveRefresh","rejectRefresh","clientDetails","sessionOptions","authFetch","onSessionStateChange","addEventListener","STATE_CHANGE","event","onSessionExpirationWarning","EXPIRATION_WARNING","onSessionExpiration","EXPIRATION","login","handleRedirectFromLogin","newSessionInfo","searchParams","getItem","delete","history","pushState","title","token_response","accessToken","jwks_uri","dpopThumbprint","token_details","dpop_key_pair","idp_details","init","Promise","all","close","removeItem","idpDetails","tokenDetails","onIncomingRedirect","setTokenDetails","dispatchStateChangeEvent","restore","resolve","reject","wasActive","isActive","sessionDatabase","renewTokens","isExpired","dispatchExpirationEvent","dispatchExpirationWarningEvent","finally","clearRefreshPromise","logout","clear","dpopPayload","Request","_renewTokensIfExpired","toUpperCase","_createSignedDPoPToken","access_token","_updateSessionDetailsFromToken","webId","_isTokenExpired","getExpiresIn","_getTokenTTL","getTokenDetails","_computeAth","hashBuffer","hashArray","from","ath","decodedToken","decoded","decodeJwt","webid","bufferSeconds","isNaN","dispatchEvent","CustomEvent","detail","expires_in","RefreshMessageTypes","SessionIDB","dbName","storeName","dbVersion","db","request","indexedDB","open","onerror","target","onsuccess","onupgradeneeded","objectStoreNames","contains","createObjectStore","transaction","oncomplete","onabort","objectStore","put","deleteItem","WebWorkerSession","worker","workerUrl","SharedWorker","port","onmessage","handleWorkerMessage","postMessage","DISCONNECT","TOKEN_DETAILS","ERROR_ON_REFRESH","EXPIRED","SCHEDULE","REFRESH","STOP","core_crypto$1","core_isCryptoKey","core_digest$1","core_encoder","core_decoder","core_concat","core_encode","core_encodeBase64","core_decode$1","core_decodeBase64","core_JOSEError","core_JWTClaimValidationFailed","core_JWTExpired","core_JOSEAlgNotAllowed","core_JOSENotSupported","core_JWSInvalid","core_JWTInvalid","core_JWKInvalid","core_JWKSInvalid","core_JWKSNoMatchingKey","core_JWKSMultipleMatchingKeys","core_JWKSTimeout","core_JWSSignatureVerificationFailed","core_unusable","core_isAlgorithm","core_getHashLength","core_checkSigCryptoKey","core_getNamedCurve","core_checkUsage","core_message","core_invalidKeyInput","core_withAlg","core_isKeyLike","core_types","core_isDisjoint$1","core_isObject","core_checkKeyLength","core_isJWK","core_asKeyObject","core_subtleMapping","core_exportKeyValue","core_privCache","core_pubCache","core_isKeyObject","core_importAndCache","core_normalize","core_importJWK","core_tag","core_jwkMatchesOp","core_symmetricTypeCheck","core_isSecretJWK","core_checkKeyType","core_isPrivateJWK","core_isPublicJWK","core_asymmetricTypeCheck","core_checkKeyTypeWithJwk","core_validateCrit","core_validateAlgorithms$1","core_keyToJWK$1","core_exportJWK","core_subtleDsa","core_getCryptoKey","core_verify$1","core_compactVerify","core_flattenedVerify","core_epoch","core_day","core_hour","core_REGEX","core_secs","core_minute","core_normalizeTyp","core_jwtPayload","core_jwtVerify","core_sign$1","core_FlattenedSign","core_CompactSign","core_validateInput","core_ProduceJWT","core_SignJWT","core_check","core_calculateJwkThumbprint","core_isJWKLike","core_clone","core_LocalJWKSet","core_isJWKSLike","core_getKtyFromAlg","core_importWithAlgCache","core_createLocalJWKSet","core_fetchJwks$1","core_USER_AGENT","core_jwksCache","core_RemoteJWKSet","core_createRemoteJWKSet","core_decode","core_getModulusLengthOption","core_generateKeyPair","core_generateKeyPair$1","core_redirectForLogin","core_requestDynamicClientRegistration","core_getPKCEcode","core_requestAccessToken","core_requestFreshTokens","core_SessionEvents","core_SessionCore","core_onIncomingRedirect","core_renewTokens","core_decodeJwt","MemorySessionDatabase","map","shouldPreserveExistingRefreshToken","IndexedDbSessionDatabase","existing","withStore","store","mode","op","tx","_a","_b","SessionCoreCtor","coreAny","core_namespaceObject","_c","default","getSessionCoreCtor","_session","host","hostname","dbError","createSession","resolveIssuerForLogin","discoveredIssuer","issuerUrl","wellKnownUrl","wellKnownResponse","credentials","wellKnownPayload","_err","discoverIssuerFromWellKnown","sessionAny","originalLogin","compatLogin","idpOrOptions","redirectUri","oidcIssuer","redirectUrl","_d","events","listeners","on","handler","off","emit","forEach","h","_wasActive","isNowActive","authSession","assign","isLoggedIn","ns_ns","solid_namespace_default","external_$rdf_","ACL_LINK","sym","createAclLogic","ns","genACLText","docURI","me","aclURI","optPublic","public","graph","auth","Namespace","doc","defaultForNew","serialize","findAclDocUrl","fetcher","load","docNode","any","setACLUserPublic","aclDoc","fetchACLRel","aclText","uri","webOperation","contentType","appContext","SolidAppContext","viewingNoAuthPage","noAuth","params","viewedPage","decodeURI","ary","offlineTestID","$SolidTestEnvironment","username","div","getElementById","getAttribute","SolidAuthnLogic","solidAuthSession","checkUserInFlight","sessionRestoreHookAttached","fallbackWebId","session","currentUser","app","infoWebId","info","sessionWebId","infoLoggedIn","sessionActive","checkUser","setUserCallback","preLoginRedirectHash","localStorage","replaceState","resolveCurrentUser","inFlight","handleIncomingRedirect","restorePreviousSession","_e","_f","postLoginRedirectHash","curUrl","webIdFromSession","probeNssCookieBackedWebId","saveUser","protocol","localhostSuffix","podName","_error","context","webIdUri","sessionInfo","sessionRoot","rootLoggedIn","rootActive","newThing","differentOrigin","CHAT_LOCATION_IN_CONTAINER","createChatLogic","profileLogic","setAcl","chatContainer","invitee","chatAclDoc","NamedNode","aclBody","addToPrivateTypeIndex","chatThing","privateTypeIndex","reg","ins","st","updater","update","_uri","errm","findChat","loadMe","podRoot","chatContainerStr","determineChatContainer","getPodRoot","exists","createChatThing","mintNew","newBase","newInstance","newPaneOptions","kb","newChatDoc","term","statementsMatching","uri2","sendInvite","inviteeInbox","inviteBody","inviteResponse","getChat","createIfMissing","createInboxLogic","utilityLogic","containerLogic","aclLogic","createInboxFor","peerWebId","nick","myWebId","ourInbox","createContainer","setSinglePeerAccess","ownerWebId","accessToModes","getNewMessages","user","inbox","getMainInbox","getContainerMembers","isContainer","markAsRead","downloaded","_fetch","archiveUrl","baseUrl","year","getUTCFullYear","month","getUTCMonth","getUTCDate","parts","filename","getArchiveUrl","text","CustomError","setPrototypeOf","UnauthorizedError","CrossOriginForbiddenError","SameOriginForbiddenError","NotFoundError","NotEditableError","WebOperationError","FetchError","publicTypeIndexDocument","privateTypeIndexDocument","publicTypeIndexAclDocument","publicTypeIndexUri","fileName","createContainerLogic","getContainerElements","containerNode","object","nodeToString","charAt","Link","containerUrl","createProfileLogic","authn","loadPreferencesInFlight","cachedPreferencesFileByWebId","isAbsoluteHttpUri","docDirUri","node","dir","docUri","withoutFragment","lastSlash","lastIndexOf","suggestTypeIndexInPreferences","preferencesFile","dirUri","isNotFoundError","ensureOwnerOnlyAclForSettings","containerUri","ensureContainerExists","aclDocUri","initializePreferencesDefaults","preferencesDoc","profileDoc","profilePublicTypeIndex","preferencesPublicTypeIndex","publicTypeIndex","createdProfilePublicTypeIndexLink","followOrCreateLinkWithContentOnCreate","toInsert","holds","literal","ensureAcl","loadOrCreateWithContentOnCreate","ensurePublicTypeIndexAclOnCreate","ensurePrivateTypeIndexOnCreate","ensurePreferencesDocExists","loadPreferences","cachedPreferencesFile","run","loadProfile","possiblePreferencesFile","fileURI","folderURI","suggestPreferencesFile","existingPreferencesFile","followOrCreateLink","findStorage","mainInbox","silencedLoadPreferences","createTypeIndexLogic","loadTypeIndexesFor","profile","suggestion","suggestPublicTypeIndex","existingPublicTypeIndex","publicScopes","index","privateScopes","suggestedPrivateTypeIndex","suggestPrivateTypeIndex","existingPrivateTypeIndex","scopes","files","scope","loadCommunityTypeIndexes","communities","each","termType","loadAllTypeIndexes","getScopedAppInstances","klass","scopedApps","scopedApps0","getScopedAppsFromIndex","theClass","results","registrations","sameTerm","instances","instance","containers","registerInTypeIndex","registration","getRegistrations","getAppInstances","scoped","deleteTypeIndexRegistration","item","the","statements","createSolidLogic","specialFetch","UpdateManager","features","loadOrCreateIfNotExists","putErr","recursiveDelete","aclDocUrl","containerMembers","defaultModes","createEmptyRdfDoc","comment","predicate","editable","createUtilityLogic","chat","typeIndex","updatePromise","del","errorBody","clearStore","remove","requestInit","omitCreds","authenticatedFetch","SINGLETON_SYMBOL","for","globalTarget","solidLogicSingleton","performServerSideLogout","postLogoutRedirectPath","wellKnownUri","wellKnownResult","openidConfiguration","end_session_endpoint","logoutResponse","redirected","DEFAULT_ISSUERS","getSuggestedIssuers","issuers","unshift","src_authSession"],"sourceRoot":""}