@toa.io/extensions.exposition 1.0.0-alpha.282 → 1.0.0-alpha.283

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 (312) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/components/exposition.octets/manifest.toa.yaml +11 -0
  3. package/components/exposition.octets/types/index.d.ts +3 -0
  4. package/components/exposition.octets/types/toa.d.ts +41 -0
  5. package/components/identity.bans/types/index.d.ts +3 -0
  6. package/components/identity.bans/types/toa.d.ts +34 -0
  7. package/components/identity.basic/manifest.toa.yaml +13 -2
  8. package/components/identity.basic/operations/add.d.ts +3 -3
  9. package/components/identity.basic/operations/authenticate.d.ts +2 -2
  10. package/components/identity.basic/operations/check.d.ts +1 -1
  11. package/components/identity.basic/operations/delete.d.ts +2 -2
  12. package/components/identity.basic/operations/incept.d.ts +2 -2
  13. package/components/identity.basic/operations/info.d.ts +1 -1
  14. package/components/identity.basic/operations/transit.d.ts +4 -3
  15. package/components/identity.basic/operations/transit.js +2 -1
  16. package/components/identity.basic/operations/transit.js.map +1 -1
  17. package/components/identity.basic/source/add.ts +3 -3
  18. package/components/identity.basic/source/authenticate.ts +2 -2
  19. package/components/identity.basic/source/check.ts +1 -1
  20. package/components/identity.basic/source/delete.ts +2 -2
  21. package/components/identity.basic/source/incept.ts +2 -2
  22. package/components/identity.basic/source/info.ts +1 -1
  23. package/components/identity.basic/source/transit.ts +6 -4
  24. package/components/identity.basic/tsconfig.tsbuildinfo +1 -1
  25. package/components/identity.basic/types/index.d.ts +21 -0
  26. package/components/identity.basic/types/toa.d.ts +121 -0
  27. package/components/identity.clients/manifest.toa.yaml +243 -0
  28. package/components/identity.clients/operations/describe.d.ts +27 -0
  29. package/components/identity.clients/operations/describe.js +44 -0
  30. package/components/identity.clients/operations/describe.js.map +1 -0
  31. package/components/identity.clients/operations/lib/Context.d.ts +29 -0
  32. package/components/identity.clients/operations/lib/Context.js +2 -0
  33. package/components/identity.clients/operations/lib/Context.js.map +1 -0
  34. package/components/identity.clients/operations/lib/Entity.d.ts +29 -0
  35. package/components/identity.clients/operations/lib/Entity.js +2 -0
  36. package/components/identity.clients/operations/lib/Entity.js.map +1 -0
  37. package/components/identity.clients/operations/lib/canonical.d.ts +11 -0
  38. package/components/identity.clients/operations/lib/canonical.js +24 -0
  39. package/components/identity.clients/operations/lib/canonical.js.map +1 -0
  40. package/components/identity.clients/operations/lib/cimd.d.ts +8 -0
  41. package/components/identity.clients/operations/lib/cimd.js +86 -0
  42. package/components/identity.clients/operations/lib/cimd.js.map +1 -0
  43. package/components/identity.clients/operations/lib/errors.d.ts +7 -0
  44. package/components/identity.clients/operations/lib/errors.js +5 -0
  45. package/components/identity.clients/operations/lib/errors.js.map +1 -0
  46. package/components/identity.clients/operations/lib/index.d.ts +6 -0
  47. package/components/identity.clients/operations/lib/index.js +7 -0
  48. package/components/identity.clients/operations/lib/index.js.map +1 -0
  49. package/components/identity.clients/operations/lib/redirect.d.ts +10 -0
  50. package/components/identity.clients/operations/lib/redirect.js +32 -0
  51. package/components/identity.clients/operations/lib/redirect.js.map +1 -0
  52. package/components/identity.clients/operations/register.d.ts +37 -0
  53. package/components/identity.clients/operations/register.js +84 -0
  54. package/components/identity.clients/operations/register.js.map +1 -0
  55. package/components/identity.clients/source/describe.ts +65 -0
  56. package/components/identity.clients/source/lib/Context.ts +38 -0
  57. package/components/identity.clients/source/lib/Entity.ts +31 -0
  58. package/components/identity.clients/source/lib/canonical.test.ts +43 -0
  59. package/components/identity.clients/source/lib/canonical.ts +27 -0
  60. package/components/identity.clients/source/lib/cimd.test.ts +120 -0
  61. package/components/identity.clients/source/lib/cimd.ts +107 -0
  62. package/components/identity.clients/source/lib/errors.ts +4 -0
  63. package/components/identity.clients/source/lib/index.ts +6 -0
  64. package/components/identity.clients/source/lib/redirect.test.ts +41 -0
  65. package/components/identity.clients/source/lib/redirect.ts +35 -0
  66. package/components/identity.clients/source/register.ts +125 -0
  67. package/components/identity.clients/tsconfig.json +10 -0
  68. package/components/identity.clients/tsconfig.tsbuildinfo +1 -0
  69. package/components/identity.clients/types/index.d.ts +3 -0
  70. package/components/identity.clients/types/toa.d.ts +109 -0
  71. package/components/identity.credentials/operations/list.d.ts +2 -1
  72. package/components/identity.credentials/operations/list.js.map +1 -1
  73. package/components/identity.credentials/source/list.ts +2 -1
  74. package/components/identity.credentials/tsconfig.tsbuildinfo +1 -1
  75. package/components/identity.credentials/types/index.d.ts +3 -0
  76. package/components/identity.credentials/types/toa.d.ts +30 -0
  77. package/components/identity.federation/manifest.toa.yaml +37 -1
  78. package/components/identity.federation/operations/authenticate.d.ts +1 -1
  79. package/components/identity.federation/operations/lib/Ctx.d.ts +2 -2
  80. package/components/identity.federation/operations/lib/decode.js +22 -8
  81. package/components/identity.federation/operations/lib/decode.js.map +1 -1
  82. package/components/identity.federation/operations/lib/errors.d.ts +7 -0
  83. package/components/identity.federation/operations/lib/errors.js +4 -0
  84. package/components/identity.federation/operations/lib/errors.js.map +1 -1
  85. package/components/identity.federation/operations/lib/exchange.js +11 -6
  86. package/components/identity.federation/operations/lib/exchange.js.map +1 -1
  87. package/components/identity.federation/operations/types/configuration.d.ts +1 -1
  88. package/components/identity.federation/operations/types/context.d.ts +3 -2
  89. package/components/identity.federation/source/authenticate.ts +1 -1
  90. package/components/identity.federation/source/lib/Ctx.ts +2 -2
  91. package/components/identity.federation/source/lib/decode.ts +25 -9
  92. package/components/identity.federation/source/lib/errors.ts +5 -0
  93. package/components/identity.federation/source/lib/exchange.ts +11 -7
  94. package/components/identity.federation/source/types/configuration.ts +1 -1
  95. package/components/identity.federation/source/types/context.ts +3 -2
  96. package/components/identity.federation/tsconfig.tsbuildinfo +1 -1
  97. package/components/identity.federation/types/index.d.ts +3 -0
  98. package/components/identity.federation/types/toa.d.ts +127 -0
  99. package/components/identity.grants/manifest.toa.yaml +245 -0
  100. package/components/identity.grants/operations/authorize.d.ts +35 -0
  101. package/components/identity.grants/operations/authorize.js +54 -0
  102. package/components/identity.grants/operations/authorize.js.map +1 -0
  103. package/components/identity.grants/operations/exchange.d.ts +37 -0
  104. package/components/identity.grants/operations/exchange.js +89 -0
  105. package/components/identity.grants/operations/exchange.js.map +1 -0
  106. package/components/identity.grants/operations/lib/code.d.ts +15 -0
  107. package/components/identity.grants/operations/lib/code.js +30 -0
  108. package/components/identity.grants/operations/lib/code.js.map +1 -0
  109. package/components/identity.grants/operations/lib/identify.d.ts +6 -0
  110. package/components/identity.grants/operations/lib/identify.js +15 -0
  111. package/components/identity.grants/operations/lib/identify.js.map +1 -0
  112. package/components/identity.grants/operations/lib/index.d.ts +3 -0
  113. package/components/identity.grants/operations/lib/index.js +3 -0
  114. package/components/identity.grants/operations/lib/index.js.map +1 -0
  115. package/components/identity.grants/operations/list.d.ts +13 -0
  116. package/components/identity.grants/operations/list.js +18 -0
  117. package/components/identity.grants/operations/list.js.map +1 -0
  118. package/components/identity.grants/operations/revoke.d.ts +18 -0
  119. package/components/identity.grants/operations/revoke.js +25 -0
  120. package/components/identity.grants/operations/revoke.js.map +1 -0
  121. package/components/identity.grants/source/authorize.ts +90 -0
  122. package/components/identity.grants/source/exchange.ts +130 -0
  123. package/components/identity.grants/source/lib/code.ts +39 -0
  124. package/components/identity.grants/source/lib/identify.ts +16 -0
  125. package/components/identity.grants/source/lib/index.ts +3 -0
  126. package/components/identity.grants/source/list.ts +28 -0
  127. package/components/identity.grants/source/revoke.ts +38 -0
  128. package/components/identity.grants/tsconfig.json +10 -0
  129. package/components/identity.grants/tsconfig.tsbuildinfo +1 -0
  130. package/components/identity.grants/types/index.d.ts +60 -0
  131. package/components/identity.grants/types/toa.d.ts +108 -0
  132. package/components/identity.keys/manifest.toa.yaml +1 -0
  133. package/components/identity.keys/operations/create.d.ts +1 -1
  134. package/components/identity.keys/operations/revoke.d.ts +1 -1
  135. package/components/identity.keys/source/create.ts +1 -1
  136. package/components/identity.keys/source/revoke.ts +1 -1
  137. package/components/identity.keys/tsconfig.tsbuildinfo +1 -1
  138. package/components/identity.keys/types/index.d.ts +3 -0
  139. package/components/identity.keys/types/toa.d.ts +47 -0
  140. package/components/identity.otp/operations/lib/Context.d.ts +4 -2
  141. package/components/identity.otp/source/lib/Context.ts +4 -2
  142. package/components/identity.otp/tsconfig.tsbuildinfo +1 -1
  143. package/components/identity.otp/types/index.d.ts +3 -0
  144. package/components/identity.otp/types/toa.d.ts +56 -0
  145. package/components/identity.passkeys/manifest.toa.yaml +3 -0
  146. package/components/identity.passkeys/operations/authenticate.d.ts +1 -1
  147. package/components/identity.passkeys/operations/challenge.d.ts +1 -1
  148. package/components/identity.passkeys/operations/create.d.ts +1 -1
  149. package/components/identity.passkeys/operations/types/Context.d.ts +2 -1
  150. package/components/identity.passkeys/operations/use.d.ts +1 -1
  151. package/components/identity.passkeys/source/authenticate.ts +1 -1
  152. package/components/identity.passkeys/source/challenge.ts +1 -1
  153. package/components/identity.passkeys/source/create.ts +1 -1
  154. package/components/identity.passkeys/source/types/Context.ts +2 -1
  155. package/components/identity.passkeys/source/use.ts +1 -1
  156. package/components/identity.passkeys/tsconfig.tsbuildinfo +1 -1
  157. package/components/identity.passkeys/types/index.d.ts +3 -0
  158. package/components/identity.passkeys/types/toa.d.ts +120 -0
  159. package/components/identity.roles/operations/principal.d.ts +1 -1
  160. package/components/identity.roles/source/principal.ts +1 -1
  161. package/components/identity.roles/tsconfig.tsbuildinfo +1 -1
  162. package/components/identity.roles/types/index.d.ts +3 -0
  163. package/components/identity.roles/types/toa.d.ts +43 -0
  164. package/components/identity.tokens/manifest.toa.yaml +34 -3
  165. package/components/identity.tokens/operations/authenticate.d.ts +2 -1
  166. package/components/identity.tokens/operations/authenticate.js +8 -0
  167. package/components/identity.tokens/operations/authenticate.js.map +1 -1
  168. package/components/identity.tokens/operations/decrypt.d.ts +2 -1
  169. package/components/identity.tokens/operations/decrypt.js +2 -2
  170. package/components/identity.tokens/operations/decrypt.js.map +1 -1
  171. package/components/identity.tokens/operations/encrypt.d.ts +2 -1
  172. package/components/identity.tokens/operations/encrypt.js.map +1 -1
  173. package/components/identity.tokens/operations/issue.d.ts +2 -1
  174. package/components/identity.tokens/operations/issue.js +2 -1
  175. package/components/identity.tokens/operations/issue.js.map +1 -1
  176. package/components/identity.tokens/operations/lib/form.d.ts +8 -0
  177. package/components/identity.tokens/operations/lib/form.js +24 -0
  178. package/components/identity.tokens/operations/lib/form.js.map +1 -0
  179. package/components/identity.tokens/operations/lib/index.d.ts +2 -1
  180. package/components/identity.tokens/operations/lib/index.js +1 -1
  181. package/components/identity.tokens/operations/lib/index.js.map +1 -1
  182. package/components/identity.tokens/source/authenticate.test.ts +8 -5
  183. package/components/identity.tokens/source/authenticate.ts +12 -1
  184. package/components/identity.tokens/source/decrypt.test.ts +1 -1
  185. package/components/identity.tokens/source/decrypt.ts +4 -3
  186. package/components/identity.tokens/source/encrypt.test.ts +1 -1
  187. package/components/identity.tokens/source/encrypt.ts +2 -1
  188. package/components/identity.tokens/source/issue.test.ts +71 -0
  189. package/components/identity.tokens/source/issue.ts +4 -2
  190. package/components/identity.tokens/source/lib/form.test.ts +25 -0
  191. package/components/identity.tokens/source/lib/form.ts +31 -0
  192. package/components/identity.tokens/source/lib/index.ts +2 -1
  193. package/components/identity.tokens/tsconfig.tsbuildinfo +1 -1
  194. package/components/identity.tokens/types/index.d.ts +61 -0
  195. package/components/identity.tokens/types/toa.d.ts +113 -0
  196. package/documentation/cache.md +10 -1
  197. package/documentation/consent.md +101 -0
  198. package/documentation/identity.md +3 -1
  199. package/documentation/io.md +36 -2
  200. package/documentation/oauth.md +179 -0
  201. package/documentation/protocol.md +4 -0
  202. package/features/auth.bearer.feature +120 -0
  203. package/features/cache.feature +46 -0
  204. package/features/oauth.clients.feature +195 -0
  205. package/features/oauth.discovery.feature +165 -0
  206. package/features/oauth.grants.feature +286 -0
  207. package/features/steps/Gateway.ts +6 -1
  208. package/features/steps/Parameters.ts +4 -0
  209. package/features/steps/components/echo/manifest.toa.yaml +2 -0
  210. package/features/steps/components/octets.tester/manifest.toa.yaml +2 -0
  211. package/features/steps/components/octets.tester/operations/redirect.js +6 -1
  212. package/features/steps/components/users/manifest.toa.yaml +1 -0
  213. package/package.json +8 -6
  214. package/readme.md +3 -0
  215. package/schemas/annotation.cos.yaml +30 -0
  216. package/source/Annotation.ts +23 -0
  217. package/source/Factory.ts +1 -1
  218. package/source/HTTP/Server.ts +9 -5
  219. package/source/HTTP/formats/form.ts +21 -0
  220. package/source/HTTP/formats/index.ts +17 -2
  221. package/source/HTTP/messages.test.ts +25 -1
  222. package/source/HTTP/messages.ts +10 -3
  223. package/source/Interception.ts +8 -2
  224. package/source/deployment.ts +4 -1
  225. package/source/directives/auth/Authorization.ts +46 -19
  226. package/source/directives/auth/Incept.ts +14 -9
  227. package/source/directives/auth/schemes.test.ts +8 -4
  228. package/source/directives/auth/schemes.ts +22 -9
  229. package/source/directives/auth/types.ts +5 -2
  230. package/source/directives/cache/Cache.ts +13 -4
  231. package/source/directives/cache/Control.ts +0 -3
  232. package/source/directives/flow/Fetch.ts +1 -1
  233. package/source/directives/index.ts +2 -1
  234. package/source/directives/io/IO.ts +2 -0
  235. package/source/directives/io/Output.ts +4 -1
  236. package/source/directives/io/Status.test.ts +84 -0
  237. package/source/directives/io/Status.ts +46 -0
  238. package/source/directives/oauth/Discovery.ts +76 -0
  239. package/source/directives/oauth/documents.ts +113 -0
  240. package/source/directives/oauth/index.ts +3 -0
  241. package/source/directives/octets/Delete.ts +1 -1
  242. package/source/directives/octets/Get.ts +1 -1
  243. package/source/directives/octets/Workflow.ts +1 -1
  244. package/source/directives/octets/workflows/Execution.ts +1 -1
  245. package/source/index.ts +6 -0
  246. package/source/octets.d.ts +17 -0
  247. package/source/userland.ts +47 -0
  248. package/transpiled/Annotation.d.ts +17 -0
  249. package/transpiled/Factory.js +1 -1
  250. package/transpiled/Factory.js.map +1 -1
  251. package/transpiled/HTTP/Server.d.ts +4 -1
  252. package/transpiled/HTTP/Server.js +4 -3
  253. package/transpiled/HTTP/Server.js.map +1 -1
  254. package/transpiled/HTTP/formats/form.d.ts +9 -0
  255. package/transpiled/HTTP/formats/form.js +18 -0
  256. package/transpiled/HTTP/formats/form.js.map +1 -0
  257. package/transpiled/HTTP/formats/index.d.ts +10 -2
  258. package/transpiled/HTTP/formats/index.js +10 -0
  259. package/transpiled/HTTP/formats/index.js.map +1 -1
  260. package/transpiled/HTTP/messages.d.ts +6 -0
  261. package/transpiled/HTTP/messages.js +3 -3
  262. package/transpiled/HTTP/messages.js.map +1 -1
  263. package/transpiled/Interception.d.ts +4 -1
  264. package/transpiled/Interception.js +4 -2
  265. package/transpiled/Interception.js.map +1 -1
  266. package/transpiled/deployment.js +2 -0
  267. package/transpiled/deployment.js.map +1 -1
  268. package/transpiled/directives/auth/Authorization.d.ts +1 -1
  269. package/transpiled/directives/auth/Authorization.js +38 -18
  270. package/transpiled/directives/auth/Authorization.js.map +1 -1
  271. package/transpiled/directives/auth/Incept.d.ts +1 -1
  272. package/transpiled/directives/auth/Incept.js +11 -7
  273. package/transpiled/directives/auth/Incept.js.map +1 -1
  274. package/transpiled/directives/auth/schemes.d.ts +16 -4
  275. package/transpiled/directives/auth/schemes.js +20 -8
  276. package/transpiled/directives/auth/schemes.js.map +1 -1
  277. package/transpiled/directives/auth/types.d.ts +4 -2
  278. package/transpiled/directives/cache/Cache.js +9 -2
  279. package/transpiled/directives/cache/Cache.js.map +1 -1
  280. package/transpiled/directives/cache/Control.js +0 -2
  281. package/transpiled/directives/cache/Control.js.map +1 -1
  282. package/transpiled/directives/index.js +2 -1
  283. package/transpiled/directives/index.js.map +1 -1
  284. package/transpiled/directives/io/IO.js +2 -0
  285. package/transpiled/directives/io/IO.js.map +1 -1
  286. package/transpiled/directives/io/Output.js +4 -1
  287. package/transpiled/directives/io/Output.js.map +1 -1
  288. package/transpiled/directives/io/Status.d.ts +19 -0
  289. package/transpiled/directives/io/Status.js +34 -0
  290. package/transpiled/directives/io/Status.js.map +1 -0
  291. package/transpiled/directives/oauth/Discovery.d.ts +23 -0
  292. package/transpiled/directives/oauth/Discovery.js +58 -0
  293. package/transpiled/directives/oauth/Discovery.js.map +1 -0
  294. package/transpiled/directives/oauth/documents.d.ts +9 -0
  295. package/transpiled/directives/oauth/documents.js +82 -0
  296. package/transpiled/directives/oauth/documents.js.map +1 -0
  297. package/transpiled/directives/oauth/index.d.ts +2 -0
  298. package/transpiled/directives/oauth/index.js +3 -0
  299. package/transpiled/directives/oauth/index.js.map +1 -0
  300. package/transpiled/index.d.ts +2 -0
  301. package/transpiled/userland.d.ts +39 -0
  302. package/transpiled/userland.js +7 -0
  303. package/transpiled/userland.js.map +1 -0
  304. package/tsconfig.tsbuildinfo +1 -1
  305. package/components/identity.basic/operations/types.d.ts +0 -61
  306. package/components/identity.basic/operations/types.js +0 -2
  307. package/components/identity.basic/operations/types.js.map +0 -1
  308. package/components/identity.basic/source/types.ts +0 -69
  309. package/components/identity.tokens/operations/lib/types.d.ts +0 -88
  310. package/components/identity.tokens/operations/lib/types.js +0 -2
  311. package/components/identity.tokens/operations/lib/types.js.map +0 -1
  312. package/components/identity.tokens/source/lib/types.ts +0 -102
@@ -1 +1 @@
1
- {"version":3,"file":"issue.js","sourceRoot":"","sources":["../source/issue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAIvC,MAAM,OAAO,MAAM;IACT,IAAI,CAAwC;IAC5C,KAAK,CAAyC;IAC9C,OAAO,CAA8B;IACrC,QAAQ,CAAS;IAElB,KAAK,CAAE,OAAgB;QAC5B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA;QACxC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAA;QAC1C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAA;QACpC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,aAAa,CA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,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;gBAC9C,KAAK,EAAE,IAAI;aACZ;SACF,CAAC,CAAA;QAEF,MAAM,QAAQ,GAAa;YACzB,EAAE,EAAE,KAAK,CAAC,QAAQ;YAClB,KAAK;SACN,CAAA;QAED,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAA;QAEhD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAC/B,KAAK,EAAE;gBACL,SAAS;gBACT,QAAQ;gBACR,QAAQ;gBACR,MAAM;gBACN,WAAW;gBACX,GAAG;aACJ;SACF,CAAC,CAAA;QAEF,IAAI,KAAK,YAAY,KAAK;YACxB,OAAO,KAAK,CAAA;QAEd,OAAO;YACL,GAAG,EAAE,GAAG,CAAC,EAAE;YACX,iDAAiD;YACjD,GAAG,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;YAC9C,KAAK;SACN,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The form of a token this component issues, or nothing for a credential it did not:
3
+ * a compact JWE has five segments, where a JWS — an OpenID `id_token`, say — has three.
4
+ * Read without decrypting, and without trusting: a credential that lies about its form
5
+ * only reaches a verifier that rejects it.
6
+ */
7
+ export declare function form(token: string): Form | null;
8
+ export type Form = 'paseto' | 'jwe';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The form of a token this component issues, or nothing for a credential it did not:
3
+ * a compact JWE has five segments, where a JWS — an OpenID `id_token`, say — has three.
4
+ * Read without decrypting, and without trusting: a credential that lies about its form
5
+ * only reaches a verifier that rejects it.
6
+ */
7
+ export function form(token) {
8
+ if (token.startsWith(PASETO))
9
+ return 'paseto';
10
+ if (segments(token) === JWE_SEGMENTS)
11
+ return 'jwe';
12
+ return null;
13
+ }
14
+ function segments(token) {
15
+ let count = 1;
16
+ for (let i = 0; i < token.length; i++)
17
+ if (token.charCodeAt(i) === DOT)
18
+ count++;
19
+ return count;
20
+ }
21
+ const PASETO = 'v3.local.';
22
+ const JWE_SEGMENTS = 5;
23
+ const DOT = 46;
24
+ //# sourceMappingURL=form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.js","sourceRoot":"","sources":["../../source/lib/form.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAE,KAAa;IACjC,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC;QAC1B,OAAO,QAAQ,CAAA;IAEjB,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,YAAY;QAClC,OAAO,KAAK,CAAA;IAEd,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,QAAQ,CAAE,KAAa;IAC9B,IAAI,KAAK,GAAG,CAAC,CAAA;IAEb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE;QACnC,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,GAAG;YAC7B,KAAK,EAAE,CAAA;IAEX,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,MAAM,GAAG,WAAW,CAAA;AAC1B,MAAM,YAAY,GAAG,CAAC,CAAA;AACtB,MAAM,GAAG,GAAG,EAAE,CAAA"}
@@ -1,3 +1,4 @@
1
+ export * from './form.js';
1
2
  export * from './pad.js';
2
- export * from './types.js';
3
+ export type * from '../../types/index.js';
3
4
  export { jweKey } from './key.js';
@@ -1,4 +1,4 @@
1
+ export * from './form.js';
1
2
  export * from './pad.js';
2
- export * from './types.js';
3
3
  export { jweKey } from './key.js';
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
@@ -4,7 +4,7 @@ import assert from 'node:assert/strict'
4
4
  import { generate } from 'randomstring'
5
5
  import { Computation as Authenticate } from './authenticate.js'
6
6
  import type { Configuration, Context, DecryptOutput, Identity } from './lib/index.js'
7
- import type { Secret } from '@toa.io/types'
7
+ import type { Secret } from '@toa.io/extensions.configuration'
8
8
 
9
9
  let configuration: Configuration
10
10
  let context: Context
@@ -14,6 +14,9 @@ let authenticate: Authenticate
14
14
  const identity: Identity = { id: generate(), roles: [] }
15
15
  const authority = generate()
16
16
 
17
+ /** Compact JWE shape: `authenticate` reads it before decrypting, and `decrypt` is mocked. */
18
+ const credentials = 'header.key.iv.ciphertext.tag'
19
+
17
20
  beforeEach(() => {
18
21
  configuration = {
19
22
  keys: [
@@ -53,7 +56,7 @@ for (const [expected, shift] of [
53
56
 
54
57
  const result = await authenticate.execute({
55
58
  authority,
56
- credentials: ''
59
+ credentials
57
60
  })
58
61
 
59
62
  assert.deepStrictEqual(result, { identity, refresh: expected })
@@ -68,7 +71,7 @@ for (const refresh of [true, false])
68
71
 
69
72
  const result = await authenticate.execute({
70
73
  authority,
71
- credentials: ''
74
+ credentials
72
75
  })
73
76
 
74
77
  assert.deepStrictEqual(result, { identity, refresh })
@@ -80,7 +83,7 @@ it('should not refresh an aged custom token', async () => {
80
83
 
81
84
  output = { iss: authority, identity, exp, iat, refresh: false, custom: true }
82
85
 
83
- const result = await authenticate.execute({ authority, credentials: '' })
86
+ const result = await authenticate.execute({ authority, credentials })
84
87
 
85
88
  assert.deepStrictEqual(result, { identity, refresh: false })
86
89
  })
@@ -93,7 +96,7 @@ it('should check revocation of an aged custom token', async () => {
93
96
  context.local.observe = mock.fn(async () => ({ revokedAt: Date.now() })) as unknown as Context['local']['observe']
94
97
  authenticate.mount(context)
95
98
 
96
- const result: any = await authenticate.execute({ authority, credentials: '' })
99
+ const result: any = await authenticate.execute({ authority, credentials })
97
100
 
98
101
  assert.deepStrictEqual(result.code, 'TOKEN_REVOKED')
99
102
  })
@@ -1,4 +1,6 @@
1
- import type { Maybe, Operation } from '@toa.io/types'
1
+ import type { Maybe } from '@toa.io/core'
2
+ import type { Operation } from '@toa.io/bridges.node'
3
+ import { form } from './lib/index.js'
2
4
  import type { AuthenticateInput, AuthenticateOutput, Context } from './lib/index.js'
3
5
 
4
6
  export class Computation implements Operation {
@@ -13,6 +15,11 @@ export class Computation implements Operation {
13
15
  }
14
16
 
15
17
  public async execute (input: AuthenticateInput): Promise<Maybe<AuthenticateOutput>> {
18
+ // `Bearer` is presented by an OpenID id_token too, and the gateway asks each provider
19
+ // in turn: a credential this component did not issue is declined, not rejected
20
+ if (form(input.credentials) === null)
21
+ return ERR_UNRECOGNIZED
22
+
16
23
  const claims = await this.decrypt({ input: input.credentials })
17
24
 
18
25
  if (claims instanceof Error)
@@ -43,6 +50,10 @@ export class Computation implements Operation {
43
50
  }
44
51
  }
45
52
 
53
+ const ERR_UNRECOGNIZED = new (class UnrecognizedError extends Error {
54
+ public readonly code = 'UNRECOGNIZED'
55
+ })()
56
+
46
57
  const ERR_AUTHORITY = new (class AuthorityMismatchError extends Error {
47
58
  public readonly code = 'AUTHORITY_MISMATCH'
48
59
  })()
@@ -6,7 +6,7 @@ import { EncryptFactory, ImportKeyFactory } from 'paseto/v3/local'
6
6
  import { Effect as Encrypt } from './encrypt.js'
7
7
  import { Computation as Decrypt } from './decrypt.js'
8
8
  import { type Configuration, type Context, type Identity } from './lib/index.js'
9
- import type { Secret } from '@toa.io/types'
9
+ import type { Secret } from '@toa.io/extensions.configuration'
10
10
 
11
11
  let configuration: Configuration
12
12
  let context: Context
@@ -1,8 +1,9 @@
1
1
  import { DecryptFactory, ImportKeyFactory } from 'paseto/v3/local'
2
2
  import { LRUCache } from 'lru-cache'
3
- import { jweKey } from './lib/index.js'
3
+ import { form, jweKey } from './lib/index.js'
4
4
  import { load } from './lib/jose.js'
5
- import type { Maybe, Operation } from '@toa.io/types'
5
+ import type { Maybe } from '@toa.io/core'
6
+ import type { Operation } from '@toa.io/bridges.node'
6
7
  import type { Context, Claims, DecryptOutput, JWEClaims } from './lib/index.js'
7
8
 
8
9
  export class Computation implements Operation {
@@ -32,7 +33,7 @@ export class Computation implements Operation {
32
33
  }
33
34
 
34
35
  public async execute (token: string): Promise<Maybe<DecryptOutput>> {
35
- const legacy = token.startsWith('v3.local.')
36
+ const legacy = form(token) === 'paseto'
36
37
  const kid = legacy ? this.pasetoKid(token) : await this.jweKid(token)
37
38
 
38
39
  if (kid instanceof Error)
@@ -6,7 +6,7 @@ import { timeout } from '@toa.io/generic'
6
6
  import { Effect as Encrypt } from './encrypt.js'
7
7
  import { Computation as Decrypt } from './decrypt.js'
8
8
  import { type Context, type Identity } from './lib/index.js'
9
- import type { Secret } from '@toa.io/types'
9
+ import type { Secret } from '@toa.io/extensions.configuration'
10
10
 
11
11
  let encrypt: Encrypt
12
12
  let decrypt: Decrypt
@@ -1,6 +1,7 @@
1
1
  import { jweKey } from './lib/index.js'
2
2
  import { load } from './lib/jose.js'
3
- import type { Operation, Maybe } from '@toa.io/types'
3
+ import type { Operation } from '@toa.io/bridges.node'
4
+ import type { Maybe } from '@toa.io/core'
4
5
  import type { Identity, Context, EncryptInput, Key } from './lib/index.js'
5
6
 
6
7
  export class Effect implements Operation {
@@ -0,0 +1,71 @@
1
+ import { it, beforeEach, mock } from 'node:test'
2
+ import assert from 'node:assert/strict'
3
+
4
+ import { generate } from 'randomstring'
5
+ import { Effect as Issue } from './issue.js'
6
+ import type { Context, EncryptInput } from './lib/index.js'
7
+
8
+ const LIFETIME = 2592000 // seconds, the configured default
9
+ const identity = generate()
10
+ const authority = generate()
11
+ const label = generate()
12
+
13
+ let issue: Issue
14
+ let encrypted: EncryptInput
15
+
16
+ beforeEach(() => {
17
+ const context = {
18
+ configuration: { lifetime: LIFETIME },
19
+ remote: {
20
+ identity: {
21
+ keys: { create: mock.fn(async () => ({ id: 'kid0', key: 'secret' })) },
22
+ roles: { list: mock.fn(async () => []) }
23
+ }
24
+ },
25
+ local: {
26
+ encrypt: mock.fn(async ({ input }: { input: EncryptInput }) => {
27
+ encrypted = input
28
+
29
+ return 'token'
30
+ })
31
+ }
32
+ } as unknown as Context
33
+
34
+ issue = new Issue()
35
+ issue.mount(context)
36
+ })
37
+
38
+ /**
39
+ * The configured lifetime is seconds, as the schema says and as `encrypt` reads it. Storing
40
+ * it as milliseconds and then multiplying again put the expiration some eighty thousand years
41
+ * out, and only on this path — every scenario passes a lifetime of its own.
42
+ */
43
+ it('should expire a token issued without a lifetime as the configuration says', async () => {
44
+ const now = Date.now()
45
+ const reply: any = await issue.execute({ authority, identity, label })
46
+
47
+ const seconds = (reply.exp - now) / 1000
48
+
49
+ assert.ok(Math.abs(seconds - LIFETIME) < 10,
50
+ `expected to expire in about ${LIFETIME} seconds, got ${seconds}`)
51
+ })
52
+
53
+ it('should hand the lifetime to `encrypt` in the seconds it reads', async () => {
54
+ await issue.execute({ authority, identity, label })
55
+
56
+ assert.equal(encrypted.lifetime, LIFETIME)
57
+ })
58
+
59
+ it('should expire a token as its own lifetime says', async () => {
60
+ const now = Date.now()
61
+ const reply: any = await issue.execute({ authority, identity, label, lifetime: 600 })
62
+
63
+ assert.ok(Math.abs((reply.exp - now) / 1000 - 600) < 10)
64
+ assert.equal(encrypted.lifetime, 600)
65
+ })
66
+
67
+ it('should issue a token that does not expire INSECURE', async () => {
68
+ const reply: any = await issue.execute({ authority, identity, label, lifetime: 0 })
69
+
70
+ assert.equal(reply.exp, undefined)
71
+ })
@@ -1,5 +1,6 @@
1
1
  import { quote } from '@toa.io/generic'
2
- import type { Maybe, Operation } from '@toa.io/types'
2
+ import type { Maybe } from '@toa.io/core'
3
+ import type { Operation } from '@toa.io/bridges.node'
3
4
  import type { Context, Identity } from './lib/index.js'
4
5
 
5
6
  export class Effect implements Operation {
@@ -12,7 +13,8 @@ export class Effect implements Operation {
12
13
  this.keys = context.remote.identity.keys
13
14
  this.roles = context.remote.identity.roles
14
15
  this.encrypt = context.local.encrypt
15
- this.lifetime = context.configuration.lifetime * 1000
16
+ // seconds, as `input.lifetime` and `encrypt` both are
17
+ this.lifetime = context.configuration.lifetime
16
18
  }
17
19
 
18
20
  public async execute (input: Input): Promise<Maybe<Output>> {
@@ -0,0 +1,25 @@
1
+ import { it } from 'node:test'
2
+ import assert from 'node:assert/strict'
3
+
4
+ import { form } from './form.js'
5
+
6
+ it('should recognize a compact JWE by its five segments', () => {
7
+ assert.equal(form('header.key.iv.ciphertext.tag'), 'jwe')
8
+ })
9
+
10
+ it('should recognize a legacy PASETO by its prefix', () => {
11
+ assert.equal(form('v3.local.payload'), 'paseto')
12
+ })
13
+
14
+ it('should not recognize a JWS, which is what an id_token is', () => {
15
+ assert.equal(form('header.payload.signature'), null)
16
+ })
17
+
18
+ it('should not recognize what is not a token at all', () => {
19
+ for (const value of ['', 'token', 'header.key.iv.ciphertext.tag.extra'])
20
+ assert.equal(form(value), null)
21
+ })
22
+
23
+ it('should read the shape and nothing else, leaving the rest to the verifier', () => {
24
+ assert.equal(form('....'), 'jwe')
25
+ })
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The form of a token this component issues, or nothing for a credential it did not:
3
+ * a compact JWE has five segments, where a JWS — an OpenID `id_token`, say — has three.
4
+ * Read without decrypting, and without trusting: a credential that lies about its form
5
+ * only reaches a verifier that rejects it.
6
+ */
7
+ export function form (token: string): Form | null {
8
+ if (token.startsWith(PASETO))
9
+ return 'paseto'
10
+
11
+ if (segments(token) === JWE_SEGMENTS)
12
+ return 'jwe'
13
+
14
+ return null
15
+ }
16
+
17
+ function segments (token: string): number {
18
+ let count = 1
19
+
20
+ for (let i = 0; i < token.length; i++)
21
+ if (token.charCodeAt(i) === DOT)
22
+ count++
23
+
24
+ return count
25
+ }
26
+
27
+ const PASETO = 'v3.local.'
28
+ const JWE_SEGMENTS = 5
29
+ const DOT = 46
30
+
31
+ export type Form = 'paseto' | 'jwe'
@@ -1,3 +1,4 @@
1
+ export * from './form.js'
1
2
  export * from './pad.js'
2
- export * from './types.js'
3
+ export type * from '../../types/index.js'
3
4
  export { jweKey } from './key.js'