@rocket.chat/houston 0.27.0-next.3 → 2.1.8

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 (293) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +108 -15
  3. package/bin/houston +62 -0
  4. package/data/docs/ARCHITECTURE.md +387 -0
  5. package/data/docs/automation.md +107 -0
  6. package/data/docs/e2ee.md +76 -0
  7. package/data/docs/eks.md +258 -0
  8. package/data/docs/gui.md +282 -0
  9. package/data/docs/guide.md +669 -0
  10. package/data/docs/kubernetes.md +138 -0
  11. package/data/docs/troubleshooting.md +193 -0
  12. package/data/docs/upgrading.md +84 -0
  13. package/data/docs/voice.md +253 -0
  14. package/data/iam/engineer-policy.json +11 -0
  15. package/data/iam/engineer-rbac.yaml +42 -0
  16. package/data/iam/operator-policy.json +211 -0
  17. package/data/loadtest/badbot.js +22 -0
  18. package/data/loadtest/common.js +168 -0
  19. package/data/loadtest/custom.js +20 -0
  20. package/data/loadtest/journey.js +58 -0
  21. package/data/loadtest/login.js +18 -0
  22. package/data/loadtest/messages.js +13 -0
  23. package/data/loadtest/mixed.js +39 -0
  24. package/data/loadtest/read.js +12 -0
  25. package/data/loadtest/webhook.js +20 -0
  26. package/data/monitoring/houston-logs.json +98 -0
  27. package/data/monitoring/k6-loadtest.json +610 -0
  28. package/data/monitoring/mongodb-exporter.json +3007 -0
  29. package/data/monitoring/node-exporter-full.json +16114 -0
  30. package/data/monitoring/rocketchat-metrics.json +6471 -0
  31. package/data/presets/airgapped.yaml +16 -0
  32. package/data/presets/default.yaml +9 -0
  33. package/data/seed/avatar-0.png +0 -0
  34. package/data/seed/avatar-1.png +0 -0
  35. package/data/seed/avatar-2.png +0 -0
  36. package/data/seed/avatar-3.png +0 -0
  37. package/data/seed/avatar-4.png +0 -0
  38. package/data/seed/avatar-5.png +0 -0
  39. package/data/seed/avatar-6.png +0 -0
  40. package/data/seed/avatar-7.png +0 -0
  41. package/data/seed/seed-metrics.csv +3 -0
  42. package/data/seed/seed-preview.png +0 -0
  43. package/data/seed/seed-report.pdf +32 -0
  44. package/data/seed/seed-runbook.txt +3 -0
  45. package/data/skill/SKILL.md +399 -0
  46. package/data/versions.yaml +55 -0
  47. package/data/voice/freeswitch/drachtio.xml +52 -0
  48. package/data/voice/freeswitch/public.xml +87 -0
  49. package/data/webui/app.css +2003 -0
  50. package/data/webui/index.html +678 -0
  51. package/data/webui/js/api.js +561 -0
  52. package/data/webui/js/boot.js +44 -0
  53. package/data/webui/js/clusters-tail.js +1377 -0
  54. package/data/webui/js/clusters.js +896 -0
  55. package/data/webui/js/create.js +276 -0
  56. package/data/webui/js/detail.js +507 -0
  57. package/data/webui/js/jobs.js +636 -0
  58. package/data/webui/js/logs.js +634 -0
  59. package/data/webui/js/main.js +14 -0
  60. package/data/webui/js/options.js +408 -0
  61. package/data/webui/js/people.js +438 -0
  62. package/data/webui/js/perf.js +303 -0
  63. package/data/webui/js/render.js +438 -0
  64. package/data/webui/js/shared.js +3 -0
  65. package/data/webui/js/state.js +583 -0
  66. package/data/webui/js/theme.js +123 -0
  67. package/data/webui/js/util.js +584 -0
  68. package/dist/cli/app.js +593 -0
  69. package/dist/cli/capabilities.js +76 -0
  70. package/dist/cli/cell-widths.js +495 -0
  71. package/dist/cli/entry.js +10 -0
  72. package/dist/cli/error-panel.js +492 -0
  73. package/dist/cli/handlers/actor.js +84 -0
  74. package/dist/cli/handlers/https.js +614 -0
  75. package/dist/cli/handlers/prompt.js +299 -0
  76. package/dist/cli/handlers/users.js +226 -0
  77. package/dist/cli/handlers.js +3678 -0
  78. package/dist/cli/help.js +183 -0
  79. package/dist/cli/index.js +15 -0
  80. package/dist/cli/perf.js +810 -0
  81. package/dist/cli/render.js +254 -0
  82. package/dist/cli/serve.js +858 -0
  83. package/dist/cli/spec-data.js +2593 -0
  84. package/dist/cli/spec-types.js +8 -0
  85. package/dist/cli/usage-error.js +520 -0
  86. package/dist/cli/wire.js +70 -0
  87. package/dist/core/audit.js +346 -0
  88. package/dist/core/backup-compat.js +85 -0
  89. package/dist/core/backup.js +1639 -0
  90. package/dist/core/cluster.js +1398 -0
  91. package/dist/core/configimport.js +344 -0
  92. package/dist/core/data.js +267 -0
  93. package/dist/core/database-of.js +82 -0
  94. package/dist/core/diagnose.js +159 -0
  95. package/dist/core/doctor.js +1518 -0
  96. package/dist/core/edge/acme.js +338 -0
  97. package/dist/core/edge/engine.js +500 -0
  98. package/dist/core/edge/networks.js +174 -0
  99. package/dist/core/edge/paths.js +107 -0
  100. package/dist/core/edge/routes.js +251 -0
  101. package/dist/core/edge/routeyml.js +195 -0
  102. package/dist/core/edge/runtime.js +493 -0
  103. package/dist/core/edge/spec.js +305 -0
  104. package/dist/core/edge/types.js +202 -0
  105. package/dist/core/eks-docs.js +135 -0
  106. package/dist/core/eks.js +2240 -0
  107. package/dist/core/envvars.js +562 -0
  108. package/dist/core/eventlog.js +541 -0
  109. package/dist/core/firstrun.js +153 -0
  110. package/dist/core/journal.js +691 -0
  111. package/dist/core/kube/ask.js +231 -0
  112. package/dist/core/kube/capabilities.js +269 -0
  113. package/dist/core/kube/certmanager.js +452 -0
  114. package/dist/core/kube/chart.js +413 -0
  115. package/dist/core/kube/cluster.js +196 -0
  116. package/dist/core/kube/context.js +545 -0
  117. package/dist/core/kube/endpoints.js +448 -0
  118. package/dist/core/kube/exec.js +195 -0
  119. package/dist/core/kube/forward.js +732 -0
  120. package/dist/core/kube/grafana-ingress.js +110 -0
  121. package/dist/core/kube/ingress.js +218 -0
  122. package/dist/core/kube/manifests.js +361 -0
  123. package/dist/core/kube/monitoring.js +768 -0
  124. package/dist/core/kube/names.js +237 -0
  125. package/dist/core/kube/namespace.js +678 -0
  126. package/dist/core/kube/operator.js +941 -0
  127. package/dist/core/kube/probe.js +202 -0
  128. package/dist/core/kube/reachability.js +163 -0
  129. package/dist/core/kube/release.js +439 -0
  130. package/dist/core/kube/replicaset.js +180 -0
  131. package/dist/core/kube/scale.js +398 -0
  132. package/dist/core/kube/status.js +633 -0
  133. package/dist/core/kube/tools.js +238 -0
  134. package/dist/core/kube/transfer.js +173 -0
  135. package/dist/core/kube/workspace.js +423 -0
  136. package/dist/core/lifecycle/admin.js +64 -0
  137. package/dist/core/lifecycle/create-docker.js +1533 -0
  138. package/dist/core/lifecycle/create-k8s.js +939 -0
  139. package/dist/core/lifecycle/destroy.js +339 -0
  140. package/dist/core/lifecycle/inspect.js +635 -0
  141. package/dist/core/lifecycle/naming.js +298 -0
  142. package/dist/core/lifecycle/notes.js +726 -0
  143. package/dist/core/lifecycle/ownership.js +313 -0
  144. package/dist/core/lifecycle/payload.js +401 -0
  145. package/dist/core/lifecycle/ports.js +388 -0
  146. package/dist/core/lifecycle/preconditions.js +367 -0
  147. package/dist/core/lifecycle/pruning.js +551 -0
  148. package/dist/core/lifecycle/ready.js +753 -0
  149. package/dist/core/lifecycle/request.js +525 -0
  150. package/dist/core/lifecycle/seeding.js +281 -0
  151. package/dist/core/lifecycle/sizing.js +392 -0
  152. package/dist/core/lifecycle/state.js +286 -0
  153. package/dist/core/lifecycle/tlsplan.js +704 -0
  154. package/dist/core/lifecycle/types.js +232 -0
  155. package/dist/core/loadtest.js +995 -0
  156. package/dist/core/migrate.js +612 -0
  157. package/dist/core/monitor.js +494 -0
  158. package/dist/core/postready.js +969 -0
  159. package/dist/core/promote.js +804 -0
  160. package/dist/core/rcapi.js +1285 -0
  161. package/dist/core/recovery.js +75 -0
  162. package/dist/core/runner/engine.js +394 -0
  163. package/dist/core/runner/host.js +298 -0
  164. package/dist/core/runner/locks.js +129 -0
  165. package/dist/core/runner/paths.js +173 -0
  166. package/dist/core/runner/ports.js +172 -0
  167. package/dist/core/runner/queries.js +612 -0
  168. package/dist/core/runner/record.js +563 -0
  169. package/dist/core/scaleseed.js +271 -0
  170. package/dist/core/seed-db.js +208 -0
  171. package/dist/core/sessions.js +472 -0
  172. package/dist/core/skill.js +326 -0
  173. package/dist/core/sso-identities.js +172 -0
  174. package/dist/core/sso.js +703 -0
  175. package/dist/core/tls-local.js +311 -0
  176. package/dist/core/tls.js +878 -0
  177. package/dist/core/topology.js +482 -0
  178. package/dist/core/upgrade.js +868 -0
  179. package/dist/core/users.js +739 -0
  180. package/dist/lib/audit.js +100 -0
  181. package/dist/lib/close-matches.js +238 -0
  182. package/dist/lib/compose.js +672 -0
  183. package/dist/lib/config.js +1398 -0
  184. package/dist/lib/context.js +18 -0
  185. package/dist/lib/errors.js +305 -0
  186. package/dist/lib/events.js +208 -0
  187. package/dist/lib/float-text.js +126 -0
  188. package/dist/lib/format.js +1320 -0
  189. package/dist/lib/home.js +325 -0
  190. package/dist/lib/journal.js +122 -0
  191. package/dist/lib/json-text.js +733 -0
  192. package/dist/lib/jsonout.js +382 -0
  193. package/dist/lib/lock.js +516 -0
  194. package/dist/lib/login-name.js +202 -0
  195. package/dist/lib/map-limit.js +29 -0
  196. package/dist/lib/mkdir-parents.js +90 -0
  197. package/dist/lib/mongo-kernel.js +67 -0
  198. package/dist/lib/monitoring.js +492 -0
  199. package/dist/lib/platform-name.js +59 -0
  200. package/dist/lib/presets/common.js +390 -0
  201. package/dist/lib/presets/composite.js +326 -0
  202. package/dist/lib/presets/e2ee.js +143 -0
  203. package/dist/lib/presets/email.js +172 -0
  204. package/dist/lib/presets/guides.js +27 -0
  205. package/dist/lib/presets/index.js +490 -0
  206. package/dist/lib/presets/keycloak.js +369 -0
  207. package/dist/lib/presets/ldap.js +1285 -0
  208. package/dist/lib/presets/livechat.js +220 -0
  209. package/dist/lib/presets/multi-instance.js +124 -0
  210. package/dist/lib/presets/oidc.js +161 -0
  211. package/dist/lib/presets/public.js +496 -0
  212. package/dist/lib/presets/registry.js +64 -0
  213. package/dist/lib/presets/s3-minio.js +300 -0
  214. package/dist/lib/presets/saml.js +149 -0
  215. package/dist/lib/presets/scenario.js +51 -0
  216. package/dist/lib/presets/types.js +86 -0
  217. package/dist/lib/presets/voice-pbx.js +320 -0
  218. package/dist/lib/presets/voice.js +345 -0
  219. package/dist/lib/presets/webhooks.js +182 -0
  220. package/dist/lib/redact.js +106 -0
  221. package/dist/lib/seed-options.js +68 -0
  222. package/dist/lib/seed-profiles.js +59 -0
  223. package/dist/lib/targz.js +1383 -0
  224. package/dist/lib/teammode.js +25 -0
  225. package/dist/lib/tempdir.js +162 -0
  226. package/dist/lib/unicode-tables.js +2335 -0
  227. package/dist/lib/version-spec.js +357 -0
  228. package/dist/lib/versions.js +463 -0
  229. package/dist/lib/yaml-dump.js +1361 -0
  230. package/dist/perf/baseline.js +168 -0
  231. package/dist/perf/constrain.js +296 -0
  232. package/dist/perf/k6.js +235 -0
  233. package/dist/perf/mongoprof.js +171 -0
  234. package/dist/perf/rcmetrics.js +178 -0
  235. package/dist/perf/report.js +386 -0
  236. package/dist/perf/resources.js +224 -0
  237. package/dist/perf/slo.js +111 -0
  238. package/dist/perf/timeline.js +187 -0
  239. package/dist/perf/timings.js +85 -0
  240. package/dist/perf/verdict.js +201 -0
  241. package/dist/seams/aws-cli.js +126 -0
  242. package/dist/seams/docker-cli.js +280 -0
  243. package/dist/seams/exec.js +861 -0
  244. package/dist/seams/fs/lock.js +528 -0
  245. package/dist/seams/kubectl.js +83 -0
  246. package/dist/seams/rc-http.js +921 -0
  247. package/dist/seed/apply.js +190 -0
  248. package/dist/seed/assets.js +76 -0
  249. package/dist/seed/check.js +391 -0
  250. package/dist/seed/client.js +172 -0
  251. package/dist/seed/executor.js +726 -0
  252. package/dist/seed/history.js +281 -0
  253. package/dist/seed/kinds.js +91 -0
  254. package/dist/seed/plan.js +432 -0
  255. package/dist/seed/receipt.js +339 -0
  256. package/dist/seed/repairs.js +75 -0
  257. package/dist/seed/verification.js +363 -0
  258. package/dist/seed/wording.js +248 -0
  259. package/dist/web/app.js +326 -0
  260. package/dist/web/jobs.js +510 -0
  261. package/dist/web/route-deps.js +211 -0
  262. package/dist/web/route-table.js +213 -0
  263. package/dist/web/routes/backup.js +244 -0
  264. package/dist/web/routes/clusters.js +303 -0
  265. package/dist/web/routes/data.js +187 -0
  266. package/dist/web/routes/edge.js +82 -0
  267. package/dist/web/routes/index.js +63 -0
  268. package/dist/web/routes/jobs.js +95 -0
  269. package/dist/web/routes/logs.js +297 -0
  270. package/dist/web/routes/meta.js +191 -0
  271. package/dist/web/routes/people.js +151 -0
  272. package/dist/web/routes/perf.js +95 -0
  273. package/dist/web/routes/repros.js +550 -0
  274. package/dist/web/routes/session.js +361 -0
  275. package/dist/web/routes/spa.js +198 -0
  276. package/dist/web/security.js +475 -0
  277. package/dist/web/signin.js +246 -0
  278. package/package.json +67 -32
  279. package/.eslintrc +0 -94
  280. package/.swcrc +0 -18
  281. package/dist/bin.js +0 -3
  282. package/dist/cli.js +0 -184
  283. package/dist/commands/createBranch.js +0 -194
  284. package/dist/outputCI.js +0 -59
  285. package/src/bin.js +0 -4
  286. package/src/cli.ts +0 -25
  287. package/src/commands/createBranch.ts +0 -28
  288. package/src/outputCI.ts +0 -12
  289. package/src-old/logs.js +0 -323
  290. package/src-old/md.js +0 -191
  291. package/src-old/release-table.js +0 -60
  292. package/src-old/set-version.js +0 -614
  293. package/src-old/utils.js +0 -15
@@ -0,0 +1,703 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PENDING_MS = exports.PENDING_MAX = exports.MAX_BYTES = exports.Refusal = exports.SETTING_KEYS = exports.PROVISION_CHOICES = exports.SECRET_FILE = exports.SECRET_ENV = void 0;
37
+ exports.checkSetting = checkSetting;
38
+ exports.requireReadyForIssuer = requireReadyForIssuer;
39
+ exports.readiness = readiness;
40
+ exports.newBrowserId = newBrowserId;
41
+ exports.isBrowserId = isBrowserId;
42
+ exports.start = start;
43
+ exports.forgetBrowser = forgetBrowser;
44
+ exports.resetForTests = resetForTests;
45
+ exports.finish = finish;
46
+ exports.approveLink = approveLink;
47
+ exports.unlink = unlink;
48
+ /**
49
+ * Okta sign-in for the web GUI: OpenID Connect, authorization code with PKCE, as a
50
+ * confidential client.
51
+ *
52
+ * A person who opens houston from the Okta tile or the "Sign in with Okta" button lands on
53
+ * the dashboard as the right houston account, without a houston password. Password sign-in
54
+ * stays as the way back in when the provider is down or misconfigured, and nothing here can
55
+ * stop `serve`, a password sign-in, a live session or the API: every failure is a `Refusal`
56
+ * carrying a fixed reason code, which the sign-in page turns into a fixed sentence.
57
+ *
58
+ * ## Who becomes which account
59
+ *
60
+ * After the ID token and `/userinfo` are verified, with a verified email in an allowed domain:
61
+ *
62
+ * 1. A binding for `(issuer, sub)` exists: active and the account is there -> that account,
63
+ * with its current role (Okta never changes a role). Disabled -> refused, unless an admin
64
+ * approved the name again with `users link-sso`.
65
+ * 2. The handle -- the local part of `preferred_username` (else of the email), normalised as
66
+ * every account name is, so `first.last` is `first-last` -- names an existing account:
67
+ * a member or readonly one is linked on first sign-in; an admin one only after `users
68
+ * link-sso <name>`; one bound to another person, or tombstoned, is refused.
69
+ * 3. No such account: created with that handle and the configured role (never admin), with
70
+ * a minted password nobody is shown, when `sso.provision` allows it and the box has a
71
+ * local admin.
72
+ *
73
+ * Any OTHER account is never considered: houston `lovekesh` and Okta `lovekesh.kumar` are two
74
+ * accounts, by the owner's decision. No email mapping, and no override that links a different
75
+ * name; `houston chown` hands workspaces over if that is ever wanted.
76
+ *
77
+ * ## The protocol, and what is checked
78
+ *
79
+ * Discovery from the configured issuer only, whose document must name the same issuer and
80
+ * HTTPS endpoints on its origin; metadata and keys cached for an hour, the keys fetched again
81
+ * once (at most once a minute) for an unknown `kid`. The ID token is RS256 only, verified with
82
+ * `node:crypto` against the JWKS key its `kid` names (`jose` is ESM-only, and this build and
83
+ * its tests are CommonJS); then `iss`, `aud` (this client alone), `azp` when present, `exp`,
84
+ * `iat` and the `nonce`. Profile claims come from `/userinfo`, whose `sub` must be the token's,
85
+ * because Okta's ID token "may not include all claims". Every call goes through the HTTP seam
86
+ * without following a redirect, under a deadline and a 256 KiB cap; the code exchange is never
87
+ * retried. Tokens are dropped once read and never logged.
88
+ *
89
+ * Pending sign-ins live in this process's memory -- one `houston serve` per home -- single
90
+ * use, ten minutes, at most 512, each tied to the browser that started it by a cookie.
91
+ */
92
+ const node_crypto_1 = require("node:crypto");
93
+ const fs = __importStar(require("node:fs"));
94
+ const config = __importStar(require("../lib/config"));
95
+ const errors_1 = require("../lib/errors");
96
+ const format_1 = require("../lib/format");
97
+ const home_1 = require("../lib/home");
98
+ const rc_http_1 = require("../seams/rc-http");
99
+ const audit_1 = require("./audit");
100
+ const sessions_1 = require("./sessions");
101
+ const identities = __importStar(require("./sso-identities"));
102
+ const users = __importStar(require("./users"));
103
+ // --- settings -----------------------------------------------------------------------
104
+ exports.SECRET_ENV = 'HOUSTON_SSO_CLIENT_SECRET';
105
+ exports.SECRET_FILE = 'sso.env';
106
+ exports.PROVISION_CHOICES = Object.freeze(['off', 'member', 'readonly']);
107
+ /** The `config` keys, stored under these names in config.yaml. */
108
+ exports.SETTING_KEYS = Object.freeze([
109
+ 'sso.issuer',
110
+ 'sso.client_id',
111
+ 'sso.public_url',
112
+ 'sso.email_domains',
113
+ 'sso.provision',
114
+ ]);
115
+ /** What setting `sso.issuer` needs first: setting the issuer last is what turns Okta on. */
116
+ const NEEDED_FIRST = ['sso.client_id', 'sso.public_url', 'sso.email_domains'];
117
+ const DOMAIN_RE = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)+$/u;
118
+ const LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]']);
119
+ function parsedUrl(key, given) {
120
+ let url;
121
+ try {
122
+ url = new URL(given);
123
+ }
124
+ catch {
125
+ throw new errors_1.ValidationError(`${key} must be a URL (got ${(0, format_1.quotedText)(given)})`);
126
+ }
127
+ if (url.username !== '' || url.password !== '' || url.search !== '' || url.hash !== '') {
128
+ throw new errors_1.ValidationError(`${key} takes no user, query or fragment (got ${(0, format_1.quotedText)(given)})`);
129
+ }
130
+ return url;
131
+ }
132
+ /**
133
+ * The value `config set <key> <given>` stores, or a `ValidationError` saying why not.
134
+ *
135
+ * The issuer is stored EXACTLY as given, because discovery compares it byte for byte with
136
+ * the provider's own; the public URL is reduced to its origin.
137
+ */
138
+ function checkSetting(key, given) {
139
+ if (given !== given.trim() || /\s/u.test(given)) {
140
+ throw new errors_1.ValidationError(`${key} takes no spaces (got ${(0, format_1.quotedText)(given)})`);
141
+ }
142
+ switch (key) {
143
+ case 'sso.issuer': {
144
+ if (parsedUrl(key, given).protocol !== 'https:') {
145
+ throw new errors_1.ValidationError(`${key} must be an https URL (got ${(0, format_1.quotedText)(given)})`);
146
+ }
147
+ return given;
148
+ }
149
+ case 'sso.public_url': {
150
+ const url = parsedUrl(key, given);
151
+ const local = url.protocol === 'http:' && LOOPBACK_HOSTS.has(url.hostname);
152
+ if ((url.protocol !== 'https:' && !local) || url.pathname !== '/') {
153
+ throw new errors_1.ValidationError(`${key} is the origin people open houston at, https://<host>[:port] (http only ` +
154
+ `on localhost) (got ${(0, format_1.quotedText)(given)})`);
155
+ }
156
+ return url.origin;
157
+ }
158
+ case 'sso.client_id':
159
+ if (!/^[\x21-\x7e]{1,255}$/u.test(given)) {
160
+ throw new errors_1.ValidationError(`${key} must be the Okta app's client ID`);
161
+ }
162
+ return given;
163
+ case 'sso.email_domains': {
164
+ const domains = given.toLowerCase().split(',');
165
+ if (!domains.every((domain) => DOMAIN_RE.test(domain))) {
166
+ throw new errors_1.ValidationError(`${key} takes domains separated by commas, e.g. rocket.chat (got ${(0, format_1.quotedText)(given)})`);
167
+ }
168
+ return domains.join(',');
169
+ }
170
+ case 'sso.provision':
171
+ if (!exports.PROVISION_CHOICES.includes(given)) {
172
+ throw new errors_1.ValidationError(`${key} takes ${exports.PROVISION_CHOICES.join(', ')} -- never admin (got ${(0, format_1.quotedText)(given)})`);
173
+ }
174
+ return given;
175
+ default:
176
+ throw new errors_1.ValidationError(`unknown key ${(0, format_1.quotedText)(key)}`);
177
+ }
178
+ }
179
+ /** Refuse `config set sso.issuer` while a setting it needs is missing. */
180
+ function requireReadyForIssuer(stored) {
181
+ const missing = NEEDED_FIRST.filter((key) => String(stored[key] ?? '') === '');
182
+ if (missing.length > 0) {
183
+ throw new errors_1.ValidationError(`set ${missing.join(', ')} first: setting sso.issuer is what turns Okta sign-in on`);
184
+ }
185
+ }
186
+ /**
187
+ * The client secret: `HOUSTON_SSO_CLIENT_SECRET` from the environment, else `<home>/sso.env`.
188
+ *
189
+ * Never config.yaml, which `config list` prints. The file is read strictly: a regular file
190
+ * this user owns with no access for anyone else, holding exactly one
191
+ * `HOUSTON_SSO_CLIENT_SECRET=<secret>` line (blank and `#` lines aside), taken literally.
192
+ */
193
+ function clientSecret() {
194
+ const fromEnv = process.env[exports.SECRET_ENV];
195
+ if (fromEnv !== undefined && fromEnv !== '')
196
+ return fromEnv;
197
+ const file = (0, home_1.joinPath)(config.home(), exports.SECRET_FILE);
198
+ let stat;
199
+ try {
200
+ stat = fs.lstatSync(file);
201
+ }
202
+ catch {
203
+ throw new errors_1.ValidationError(`no client secret: put ${exports.SECRET_ENV}=<secret> in ${file} (mode 0600), or set ${exports.SECRET_ENV}`);
204
+ }
205
+ if (!stat.isFile())
206
+ throw new errors_1.ValidationError(`${file} is not a regular file`);
207
+ if ((stat.mode & 0o077) !== 0)
208
+ throw new errors_1.ValidationError(`${file} must be mode 0600`);
209
+ if (typeof process.getuid === 'function' && stat.uid !== process.getuid()) {
210
+ throw new errors_1.ValidationError(`${file} must be owned by the user running houston`);
211
+ }
212
+ const lines = fs
213
+ .readFileSync(file, 'utf8')
214
+ .split('\n')
215
+ .map((line) => (line.endsWith('\r') ? line.slice(0, -1) : line))
216
+ .filter((line) => line !== '' && !line.startsWith('#'));
217
+ const secret = lines.length === 1 ? (lines[0] ?? '').slice(exports.SECRET_ENV.length + 1) : '';
218
+ if (!(lines[0] ?? '').startsWith(`${exports.SECRET_ENV}=`) ||
219
+ !/^[\x21-\x7e]+$/u.test(secret) ||
220
+ /^["']/u.test(secret)) {
221
+ throw new errors_1.ValidationError(`${file} must hold exactly one line, ${exports.SECRET_ENV}=<secret>, unquoted and without spaces`);
222
+ }
223
+ return secret;
224
+ }
225
+ /** Whether Okta sign-in is off, set up but unusable (and why), or ready. Never throws. */
226
+ function readiness() {
227
+ try {
228
+ const stored = config.loadConfig();
229
+ const value = (key) => {
230
+ const raw = stored[key];
231
+ return raw === undefined || raw === null ? '' : String(raw);
232
+ };
233
+ if (value('sso.issuer') === '')
234
+ return { state: 'off' };
235
+ const checked = (key) => {
236
+ if (value(key) === '')
237
+ throw new errors_1.ValidationError(`${key} is not set`);
238
+ return checkSetting(key, value(key));
239
+ };
240
+ return {
241
+ state: 'ready',
242
+ settings: {
243
+ issuer: checked('sso.issuer'),
244
+ clientId: checked('sso.client_id'),
245
+ publicUrl: checked('sso.public_url'),
246
+ emailDomains: checked('sso.email_domains').split(','),
247
+ provision: value('sso.provision') === '' ? 'off' : checked('sso.provision'),
248
+ secret: clientSecret(),
249
+ },
250
+ };
251
+ }
252
+ catch (error) {
253
+ return { state: 'broken', why: error instanceof Error ? error.message : String(error) };
254
+ }
255
+ }
256
+ // --- talking to the provider --------------------------------------------------------
257
+ /** Why a sign-in did not complete: a fixed code the sign-in page turns into a sentence. */
258
+ class Refusal extends Error {
259
+ constructor(code) {
260
+ super(`Okta sign-in refused: ${code}`);
261
+ this.code = code;
262
+ this.name = 'Refusal';
263
+ }
264
+ }
265
+ exports.Refusal = Refusal;
266
+ exports.MAX_BYTES = 256 * 1024;
267
+ const LOOKUP_MS = 5000;
268
+ const TOKEN_MS = 10000;
269
+ const TOTAL_MS = 25000;
270
+ const CACHE_MS = 3600000;
271
+ const KEY_REFRESH_MS = 60000;
272
+ const SKEW_SECONDS = 60;
273
+ let provider = null;
274
+ let keys = null;
275
+ let keysFetchedAt = 0;
276
+ function isRecord(value) {
277
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
278
+ }
279
+ /** One JSON answer from the provider, or a Refusal: `down` unanswered, `provider` refused. */
280
+ async function fetchJson(url, until, timeoutMs, options = {}) {
281
+ const left = until - Date.now();
282
+ if (left <= 0)
283
+ throw new Refusal('down');
284
+ let answer;
285
+ try {
286
+ answer = await rc_http_1.rcHttp.request(url, {
287
+ ...options,
288
+ headers: { Accept: 'application/json', 'Accept-Encoding': 'identity', ...options.headers },
289
+ timeoutMs: Math.min(timeoutMs, left),
290
+ followRedirects: false,
291
+ maxBytes: exports.MAX_BYTES,
292
+ });
293
+ }
294
+ catch {
295
+ throw new Refusal('down');
296
+ }
297
+ if (answer.status !== 200)
298
+ throw new Refusal('provider');
299
+ let doc;
300
+ try {
301
+ doc = answer.json();
302
+ }
303
+ catch {
304
+ throw new Refusal('provider');
305
+ }
306
+ if (!isRecord(doc))
307
+ throw new Refusal('provider');
308
+ return doc;
309
+ }
310
+ async function discover(issuer, until) {
311
+ if (provider?.issuer === issuer && Date.now() - provider.at < CACHE_MS)
312
+ return provider;
313
+ const doc = await fetchJson(`${issuer.replace(/\/$/u, '')}/.well-known/openid-configuration`, until, LOOKUP_MS);
314
+ if (doc.issuer !== issuer)
315
+ throw new Refusal('provider');
316
+ const origin = new URL(issuer).origin;
317
+ const endpoint = (key) => {
318
+ const value = doc[key];
319
+ let url;
320
+ try {
321
+ url = typeof value === 'string' ? new URL(value) : null;
322
+ }
323
+ catch {
324
+ url = null;
325
+ }
326
+ if (url === null || url.protocol !== 'https:' || url.origin !== origin) {
327
+ throw new Refusal('provider');
328
+ }
329
+ return url.href;
330
+ };
331
+ provider = {
332
+ issuer,
333
+ authorize: endpoint('authorization_endpoint'),
334
+ token: endpoint('token_endpoint'),
335
+ userinfo: endpoint('userinfo_endpoint'),
336
+ jwks: endpoint('jwks_uri'),
337
+ at: Date.now(),
338
+ };
339
+ return provider;
340
+ }
341
+ async function signingKey(found, kid, until) {
342
+ const fresh = keys?.issuer === found.issuer && Date.now() - keys.at < CACHE_MS;
343
+ const known = fresh ? keys?.byKid.get(kid) : undefined;
344
+ if (known !== undefined)
345
+ return known;
346
+ if (fresh && Date.now() - keysFetchedAt < KEY_REFRESH_MS)
347
+ throw new Refusal('token');
348
+ keysFetchedAt = Date.now();
349
+ const doc = await fetchJson(found.jwks, until, LOOKUP_MS);
350
+ const byKid = new Map();
351
+ for (const jwk of Array.isArray(doc.keys) ? doc.keys : []) {
352
+ if (!isRecord(jwk) ||
353
+ jwk.kty !== 'RSA' ||
354
+ typeof jwk.kid !== 'string' ||
355
+ typeof jwk.n !== 'string' ||
356
+ typeof jwk.e !== 'string' ||
357
+ (jwk.use !== undefined && jwk.use !== 'sig') ||
358
+ (jwk.alg !== undefined && jwk.alg !== 'RS256')) {
359
+ continue;
360
+ }
361
+ try {
362
+ const key = (0, node_crypto_1.createPublicKey)({ key: { kty: 'RSA', n: jwk.n, e: jwk.e }, format: 'jwk' });
363
+ if ((key.asymmetricKeyDetails?.modulusLength ?? 0) >= 2048)
364
+ byKid.set(jwk.kid, key);
365
+ }
366
+ catch {
367
+ // A key that does not parse is a key nobody signed with.
368
+ }
369
+ }
370
+ keys = { issuer: found.issuer, at: Date.now(), byKid };
371
+ const key = byKid.get(kid);
372
+ if (key === undefined)
373
+ throw new Refusal('token');
374
+ return key;
375
+ }
376
+ function sameText(left, right) {
377
+ const a = Buffer.from(left);
378
+ const b = Buffer.from(right);
379
+ return a.length === b.length && (0, node_crypto_1.timingSafeEqual)(a, b);
380
+ }
381
+ function jsonPart(part) {
382
+ let value;
383
+ try {
384
+ value = JSON.parse(Buffer.from(part, 'base64url').toString('utf8'));
385
+ }
386
+ catch {
387
+ throw new Refusal('token');
388
+ }
389
+ if (!isRecord(value))
390
+ throw new Refusal('token');
391
+ return value;
392
+ }
393
+ /** The ID token's claims once its signature and every claim this client relies on hold. */
394
+ async function verifiedClaims(token, found, settings, nonce, until) {
395
+ const parts = token.split('.');
396
+ if (parts.length !== 3 || !parts.every((part) => /^[A-Za-z0-9_-]+$/u.test(part))) {
397
+ throw new Refusal('token');
398
+ }
399
+ const [head = '', body = '', signature = ''] = parts;
400
+ const header = jsonPart(head);
401
+ if (header.alg !== 'RS256' || typeof header.kid !== 'string' || header.crit !== undefined) {
402
+ throw new Refusal('token');
403
+ }
404
+ const key = await signingKey(found, header.kid, until);
405
+ const signed = Buffer.from(`${head}.${body}`);
406
+ if (!(0, node_crypto_1.verify)('RSA-SHA256', signed, key, Buffer.from(signature, 'base64url'))) {
407
+ throw new Refusal('token');
408
+ }
409
+ const claims = jsonPart(body);
410
+ const now = Date.now() / 1000;
411
+ const audience = claims.aud;
412
+ const forUs = audience === settings.clientId ||
413
+ (Array.isArray(audience) && audience.length === 1 && audience[0] === settings.clientId);
414
+ if (claims.iss !== found.issuer ||
415
+ !forUs ||
416
+ (claims.azp !== undefined && claims.azp !== settings.clientId) ||
417
+ typeof claims.exp !== 'number' ||
418
+ claims.exp + SKEW_SECONDS < now ||
419
+ typeof claims.iat !== 'number' ||
420
+ claims.iat > now + SKEW_SECONDS ||
421
+ typeof claims.nonce !== 'string' ||
422
+ !sameText(claims.nonce, nonce) ||
423
+ typeof claims.sub !== 'string' ||
424
+ claims.sub === '') {
425
+ throw new Refusal('token');
426
+ }
427
+ return claims;
428
+ }
429
+ // --- pending sign-ins ---------------------------------------------------------------
430
+ exports.PENDING_MAX = 512;
431
+ exports.PENDING_MS = 600000;
432
+ const pending = new Map();
433
+ function token() {
434
+ return (0, node_crypto_1.randomBytes)(32).toString('base64url');
435
+ }
436
+ /** A new id for the browser cookie that ties a callback to the browser that started it. */
437
+ function newBrowserId() {
438
+ return token();
439
+ }
440
+ /** Whether `value` is an id `newBrowserId` could have made. */
441
+ function isBrowserId(value) {
442
+ return /^[A-Za-z0-9_-]{43}$/u.test(value);
443
+ }
444
+ /**
445
+ * Begin a sign-in: remember it, and return the provider URL to send the browser to.
446
+ *
447
+ * Over the cap, the OLDEST pending sign-in goes. Refusing the newest instead would let
448
+ * anyone who can reach the page block every sign-in for ten minutes.
449
+ */
450
+ async function start(settings, browser, next) {
451
+ const found = await discover(settings.issuer, Date.now() + TOTAL_MS);
452
+ const now = Date.now();
453
+ for (const [state, entry] of pending)
454
+ if (now - entry.at > exports.PENDING_MS)
455
+ pending.delete(state);
456
+ while (pending.size >= exports.PENDING_MAX)
457
+ pending.delete(pending.keys().next().value ?? '');
458
+ const state = token();
459
+ const entry = {
460
+ browser,
461
+ nonce: token(),
462
+ verifier: token(),
463
+ next,
464
+ issuer: settings.issuer,
465
+ clientId: settings.clientId,
466
+ redirectUri: `${settings.publicUrl}/signin`,
467
+ at: now,
468
+ };
469
+ pending.set(state, entry);
470
+ const url = new URL(found.authorize);
471
+ for (const [name, value] of Object.entries({
472
+ response_type: 'code',
473
+ client_id: settings.clientId,
474
+ redirect_uri: entry.redirectUri,
475
+ scope: 'openid profile email',
476
+ state,
477
+ nonce: entry.nonce,
478
+ code_challenge: (0, node_crypto_1.createHash)('sha256').update(entry.verifier).digest('base64url'),
479
+ code_challenge_method: 'S256',
480
+ })) {
481
+ url.searchParams.set(name, value);
482
+ }
483
+ return url.href;
484
+ }
485
+ /** Drop this browser's pending sign-ins, at sign-out. */
486
+ function forgetBrowser(browser) {
487
+ if (!isBrowserId(browser))
488
+ return;
489
+ for (const [state, entry] of pending)
490
+ if (entry.browser === browser)
491
+ pending.delete(state);
492
+ }
493
+ /** For tests: no pending sign-in, nothing cached. */
494
+ function resetForTests() {
495
+ pending.clear();
496
+ provider = null;
497
+ keys = null;
498
+ keysFetchedAt = 0;
499
+ }
500
+ function formEncoded(value) {
501
+ return encodeURIComponent(value).replaceAll('%20', '+');
502
+ }
503
+ function localPart(value) {
504
+ const at = value.lastIndexOf('@');
505
+ return at === -1 ? value : value.slice(0, at);
506
+ }
507
+ /**
508
+ * Complete a sign-in from the provider's redirect: the account to sign in as, or a Refusal.
509
+ *
510
+ * The pending entry is spent first, whatever happens next, so a callback cannot be replayed.
511
+ */
512
+ async function finish(settings, callback, browser) {
513
+ const entry = pending.get(callback.state);
514
+ pending.delete(callback.state);
515
+ if (entry === undefined ||
516
+ !sameText(entry.browser, browser) ||
517
+ Date.now() - entry.at > exports.PENDING_MS ||
518
+ entry.issuer !== settings.issuer ||
519
+ entry.clientId !== settings.clientId) {
520
+ throw new Refusal('expired');
521
+ }
522
+ if (callback.error !== '' || callback.code === '')
523
+ throw new Refusal('denied');
524
+ const until = Date.now() + TOTAL_MS;
525
+ const found = await discover(settings.issuer, until);
526
+ const basic = Buffer.from(`${formEncoded(settings.clientId)}:${formEncoded(settings.secret)}`).toString('base64');
527
+ const tokens = await fetchJson(found.token, until, TOKEN_MS, {
528
+ method: 'POST',
529
+ headers: {
530
+ Authorization: `Basic ${basic}`,
531
+ 'Content-Type': 'application/x-www-form-urlencoded',
532
+ },
533
+ body: new URLSearchParams({
534
+ grant_type: 'authorization_code',
535
+ code: callback.code,
536
+ redirect_uri: entry.redirectUri,
537
+ code_verifier: entry.verifier,
538
+ }).toString(),
539
+ });
540
+ if (typeof tokens.id_token !== 'string' ||
541
+ typeof tokens.access_token !== 'string' ||
542
+ String(tokens.token_type).toLowerCase() !== 'bearer') {
543
+ throw new Refusal('provider');
544
+ }
545
+ const claims = await verifiedClaims(tokens.id_token, found, settings, entry.nonce, until);
546
+ const info = await fetchJson(found.userinfo, until, LOOKUP_MS, {
547
+ headers: { Authorization: `Bearer ${tokens.access_token}` },
548
+ });
549
+ if (info.sub !== claims.sub)
550
+ throw new Refusal('token');
551
+ const email = typeof info.email === 'string' ? info.email.toLowerCase() : '';
552
+ if (info.email_verified !== true || email.split('@').length !== 2)
553
+ throw new Refusal('email');
554
+ if (!settings.emailDomains.includes(email.split('@')[1] ?? ''))
555
+ throw new Refusal('domain');
556
+ const username = typeof info.preferred_username === 'string' ? info.preferred_username : '';
557
+ const name = await resolveAccount({
558
+ issuer: found.issuer,
559
+ sub: claims.sub,
560
+ email,
561
+ username,
562
+ provision: settings.provision,
563
+ });
564
+ return { name, next: entry.next };
565
+ }
566
+ /**
567
+ * The account a verified person signs in as, linking or creating it when the rules allow.
568
+ *
569
+ * Under `users.lock`, so the users file and the bindings change together and two first
570
+ * sign-ins of one person cannot both create the account. The new account's hash is derived
571
+ * before the lock, as `users.add` does, because scrypt is slow on purpose.
572
+ */
573
+ async function resolveAccount(person) {
574
+ const handle = users.normalizeName(localPart(person.username) || localPart(person.email));
575
+ const hashed = await users.hashPassword(users.mintPassword());
576
+ const at = new Date().toISOString();
577
+ return await users.withUsersLock(() => {
578
+ let doc;
579
+ try {
580
+ doc = identities.read();
581
+ }
582
+ catch {
583
+ throw new Refusal('store');
584
+ }
585
+ const accounts = users.readAll();
586
+ const approved = (name) => doc.approvals.some((item) => item.name === name);
587
+ const linkAs = (binding, kind) => {
588
+ doc.approvals = doc.approvals.filter((item) => item.name !== binding.name);
589
+ identities.write(doc);
590
+ (0, audit_1.audit)(binding.name, kind, `${binding.name} ${binding.email}`, { origin: 'sso' });
591
+ return binding.name;
592
+ };
593
+ const fresh = (name) => ({
594
+ issuer: person.issuer,
595
+ sub: person.sub,
596
+ name,
597
+ email: person.email,
598
+ display: person.username,
599
+ status: 'active',
600
+ at,
601
+ });
602
+ const bound = doc.bindings.find((item) => item.issuer === person.issuer && item.sub === person.sub);
603
+ if (bound !== undefined) {
604
+ const otherActive = doc.bindings.some((item) => item !== bound && item.name === bound.name && item.status === 'active');
605
+ if (bound.status !== 'active') {
606
+ if (!approved(bound.name) || !accounts.has(bound.name) || otherActive) {
607
+ throw new Refusal('disabled');
608
+ }
609
+ bound.status = 'active';
610
+ bound.email = person.email;
611
+ bound.display = person.username;
612
+ bound.at = at;
613
+ return linkAs(bound, 'sso-link');
614
+ }
615
+ if (!accounts.has(bound.name)) {
616
+ // Tombstoned now, so an account made later under this name does not inherit it.
617
+ identities.tombstone(doc, bound.name);
618
+ identities.write(doc);
619
+ throw new Refusal('gone');
620
+ }
621
+ if (bound.email !== person.email || bound.display !== person.username) {
622
+ bound.email = person.email;
623
+ bound.display = person.username;
624
+ identities.write(doc);
625
+ }
626
+ return bound.name;
627
+ }
628
+ try {
629
+ users.requireValidName(handle);
630
+ }
631
+ catch {
632
+ throw new Refusal('name');
633
+ }
634
+ const sameName = doc.bindings.filter((item) => item.name === handle);
635
+ if (sameName.some((item) => item.status === 'active'))
636
+ throw new Refusal('taken');
637
+ const tombstoned = sameName.length > 0;
638
+ const account = accounts.get(handle);
639
+ if (account !== undefined) {
640
+ if (!approved(handle)) {
641
+ if (tombstoned)
642
+ throw new Refusal('disabled');
643
+ if (users.normaliseRole(account[2]) === 'admin')
644
+ throw new Refusal('admin');
645
+ }
646
+ const binding = fresh(handle);
647
+ doc.bindings.push(binding);
648
+ return linkAs(binding, 'sso-link');
649
+ }
650
+ if (tombstoned)
651
+ throw new Refusal('disabled');
652
+ if (person.provision !== 'member' && person.provision !== 'readonly') {
653
+ throw new Refusal('noaccount');
654
+ }
655
+ if (![...accounts.values()].some(([, , role]) => users.normaliseRole(role) === 'admin')) {
656
+ throw new Refusal('noadmin');
657
+ }
658
+ accounts.set(handle, [hashed, at.slice(0, 10), person.provision]);
659
+ users.writeAll(accounts);
660
+ (0, audit_1.audit)(handle, 'user-add', `${handle} role=${person.provision}`, { origin: 'sso' });
661
+ const binding = fresh(handle);
662
+ doc.bindings.push(binding);
663
+ return linkAs(binding, 'sso-provision');
664
+ });
665
+ }
666
+ /**
667
+ * `users link-sso <name>`: let the Okta person whose username normalises to exactly `name`
668
+ * link to that existing account -- the only way an admin account, or a name whose link was
669
+ * removed, is linked. It cannot link a different name.
670
+ */
671
+ async function approveLink(name) {
672
+ const stored = users.normalizeName(name);
673
+ await users.withUsersLock(() => {
674
+ if (!users.readAll().has(stored)) {
675
+ throw new errors_1.NotFoundError(`no user ${(0, format_1.quotedText)(stored)} (see \`houston users list\`)`);
676
+ }
677
+ const doc = identities.read();
678
+ const active = doc.bindings.find((item) => item.name === stored && item.status === 'active');
679
+ if (active !== undefined) {
680
+ throw new errors_1.ConflictError(`${(0, format_1.quotedText)(stored)} is already linked to the Okta user ${active.email}`);
681
+ }
682
+ doc.approvals = doc.approvals.filter((item) => item.name !== stored);
683
+ doc.approvals.push({ name: stored, at: new Date().toISOString() });
684
+ identities.write(doc);
685
+ });
686
+ (0, audit_1.record)('sso-approve', stored);
687
+ }
688
+ /**
689
+ * `users unlink-sso <name>`: the link becomes a tombstone and the account's sessions end.
690
+ * The account and its password stay. Returns how many sessions ended.
691
+ */
692
+ async function unlink(name) {
693
+ const stored = users.normalizeName(name);
694
+ await users.withUsersLock(() => {
695
+ const doc = identities.read();
696
+ if (!identities.tombstone(doc, stored)) {
697
+ throw new errors_1.NotFoundError(`${(0, format_1.quotedText)(stored)} is not linked to an Okta user`);
698
+ }
699
+ identities.write(doc);
700
+ });
701
+ (0, audit_1.record)('sso-unlink', stored);
702
+ return await (0, sessions_1.revokeUser)(stored);
703
+ }