@cardstack/boxel-cli 0.9.0-unstable.5 → 0.9.0-unstable.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled-test-harness/assets/{ai-module-creation-test-BNiZ9Als.js → ai-module-creation-test-CYdqfeyE.js} +1 -1
- package/bundled-test-harness/assets/{app-CP2kZsut.js → app-DEPzUD4Y.js} +1 -1
- package/bundled-test-harness/assets/{binary-upload-dedupe-test-c4W0iix2.js → binary-upload-dedupe-test-BIf-AWak.js} +1 -1
- package/bundled-test-harness/assets/{can-invoke-test-DyozfCFg.js → can-invoke-test-BjgjfYqo.js} +1 -1
- package/bundled-test-harness/assets/{card-chooser-paging-test-BKdBwPQ3.js → card-chooser-paging-test-C2v55yZ3.js} +1 -1
- package/bundled-test-harness/assets/{card-chooser-test-DAPWVfJL.js → card-chooser-test-OqnnAsAY.js} +1 -1
- package/bundled-test-harness/assets/{card-def-field-def-relationships-test-Dz1qg9ZW.js → card-def-field-def-relationships-test-TNzXYsVI.js} +1 -1
- package/bundled-test-harness/assets/{card-delete-test-BmI-DLtn.js → card-delete-test-BVnE3BU6.js} +1 -1
- package/bundled-test-harness/assets/{choreo-feature-reel-test-S0XwN4xA.js → choreo-feature-reel-test-DrvZlnG0.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-B0nnktwP.js → choreo-gallery-D8__QZCe.js} +11 -11
- package/bundled-test-harness/assets/{choreo-gallery-build-order-test-C6q9CDNY.js → choreo-gallery-build-order-test-7TpxKQd2.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-compositor-test-C-GwjEUw.js → choreo-gallery-compositor-test-BgMWB-xz.js} +1 -1
- package/bundled-test-harness/assets/choreo-gallery-cover-test-uR-CNV8g.js +205 -0
- package/bundled-test-harness/assets/{choreo-gallery-crossing-stage-test-B7jRQTAh.js → choreo-gallery-crossing-stage-test-CmGH0E5q.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-demos-alive-test-BLqE-zk1.js → choreo-gallery-demos-alive-test-DZ1sPqe8.js} +8 -2
- package/bundled-test-harness/assets/{choreo-gallery-drift-test-DOXLQNB9.js → choreo-gallery-drift-test-q7KosXIw.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-escort-test-lfBfmp-4.js → choreo-gallery-escort-test-CH_qyw6w.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-films-test-M761cc8Q.js → choreo-gallery-films-test-CYmek5qU.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-filter-test-BrUWMDaJ.js → choreo-gallery-filter-test-Curg5Fg7.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-fold-test-CTtdGSAI.js → choreo-gallery-fold-test-BDTkaH6H.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-guides-test-PHmvqxfk.js → choreo-gallery-guides-test-B1vY7Fkx.js} +2 -2
- package/bundled-test-harness/assets/{choreo-gallery-hang-test-DP5lQG0y.js → choreo-gallery-hang-test-BJJghTnK.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-highlight-test-CLhvRo6X.js → choreo-gallery-highlight-test-DGT0jmDf.js} +2 -2
- package/bundled-test-harness/assets/{choreo-gallery-inline-edit-test-jOddqOxH.js → choreo-gallery-inline-edit-test-DwF8ZeCB.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-interruption-test-hdQSH8Mi.js → choreo-gallery-interruption-test-DvfkLdWd.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-lone-stack-test-AHGiG8yJ.js → choreo-gallery-lone-stack-test-CDwE2xKJ.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-navigation-test-BlGmMyFM.js → choreo-gallery-navigation-test-DG6IdX6k.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-playhead-transport-test-8aNOk09i.js → choreo-gallery-playhead-transport-test-CITO-DAn.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-poplayout-subtree-test-BCJLJdyC.js → choreo-gallery-poplayout-subtree-test-Cs4S9Ky9.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-presence-modes-test-CbhdndwS.js → choreo-gallery-presence-modes-test-p8mppXAD.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-presentation-test-DDUagg6a.js → choreo-gallery-presentation-test-CT0lZepE.js} +36 -1
- package/bundled-test-harness/assets/{choreo-gallery-sheet-standalone-test-BNyhCtW2.js → choreo-gallery-sheet-standalone-test-D-MLCQ6u.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-sheet-test-NEe_oYnA.js → choreo-gallery-sheet-test-unHvAt2e.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-site-test-hT5mISBG.js → choreo-gallery-site-test-BRHuPInI.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-stage-Bmz9m8sP.js → choreo-gallery-stage-DVGS6XI-.js} +1 -1
- package/bundled-test-harness/assets/choreo-gallery-stage-keyboard-test-BYpAwZPD.js +102 -0
- package/bundled-test-harness/assets/{choreo-gallery-stages-test-DZjVu0Zq.js → choreo-gallery-stages-test-DPFv-GKb.js} +2 -2
- package/bundled-test-harness/assets/{choreo-gallery-subdivision-test-DBjnIZ8l.js → choreo-gallery-subdivision-test-C4rwq-DA.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-table-plan-test-DTSu2DjF.js → choreo-gallery-table-plan-test-CAQdsCBB.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-theater-test-BsLF8HcI.js → choreo-gallery-theater-test-BxvAn-i8.js} +2 -2
- package/bundled-test-harness/assets/{choreo-gallery-tuning-test-B1JW701Z.js → choreo-gallery-tuning-test-CvAiiRMn.js} +1 -1
- package/bundled-test-harness/assets/{choreo-gallery-widget-room-test-DcEIPub1.js → choreo-gallery-widget-room-test-DLkgh8Ws.js} +2 -2
- package/bundled-test-harness/assets/{choreo-gallery-wires-test-6VOc5SF8.js → choreo-gallery-wires-test-DMdHX2zj.js} +1 -1
- package/bundled-test-harness/assets/{codeblocks-test-DGtwtURg.js → codeblocks-test-DDMirwuJ.js} +1 -1
- package/bundled-test-harness/assets/{compaction-test-CTNozvI6.js → compaction-test-BKQ_668T.js} +1 -1
- package/bundled-test-harness/assets/{container-Az9Nq0LL.js → container-BrZklF85.js} +5 -2
- package/bundled-test-harness/assets/{create-listing-modal-test-cdE1T_YD.js → create-listing-modal-test-Bsgixn9Z.js} +1 -1
- package/bundled-test-harness/assets/{debug-message-test-BfS52C_5.js → debug-message-test-8e9w8xNX.js} +1 -1
- package/bundled-test-harness/assets/{fallback-banner-live-delete-test-C6Rl_3oe.js → fallback-banner-live-delete-test-CNsd-0FB.js} +1 -1
- package/bundled-test-harness/assets/{fallback-banner-test-CsSGrseR.js → fallback-banner-test-DlT-8Lpv.js} +1 -1
- package/bundled-test-harness/assets/{fallback-models-test-D7FBFpyT.js → fallback-models-test-CwG7Ydui.js} +1 -1
- package/bundled-test-harness/assets/{file-attachment-test-DtPZTxy4.js → file-attachment-test-Cvs-ulUS.js} +1 -1
- package/bundled-test-harness/assets/{general-test-CMH4p9LD.js → general-test-BDjfjhSB.js} +1 -1
- package/bundled-test-harness/assets/{main-DQBeCoaR.js → main-BeQF5cZd.js} +1 -1
- package/bundled-test-harness/assets/{model-cost-tier-test-DR2G3zVF.js → model-cost-tier-test-FFf8YNd5.js} +1 -1
- package/bundled-test-harness/assets/{operator-mode-card-chooser-test-Dtd5macc.js → operator-mode-card-chooser-test-DKo-UoRQ.js} +1 -1
- package/bundled-test-harness/assets/{operator-mode-links-test-BW7fJlL7.js → operator-mode-links-test-Dl5g5COc.js} +1 -1
- package/bundled-test-harness/assets/{operator-mode-test-OwSg0jux.js → operator-mode-test-Bo8diNLE.js} +1 -1
- package/bundled-test-harness/assets/{operator-mode-ui-test-gV3LQASK.js → operator-mode-ui-test-CSc-CYTU.js} +1 -1
- package/bundled-test-harness/assets/{overlay-menu-items-test-DhsN6QTO.js → overlay-menu-items-test-Bs1zoaym.js} +1 -1
- package/bundled-test-harness/assets/{past-sessions-test-DD6A7KuB.js → past-sessions-test-BGg7ZyON.js} +1 -1
- package/bundled-test-harness/assets/{permission-checking-realm-test-bQz4K37U.js → permission-checking-realm-test-Be6jGmyM.js} +1 -1
- package/bundled-test-harness/assets/{realm-config-policy-standing-test-Cs9XpWCX.js → realm-config-policy-standing-test-nM6CGX-Q.js} +1 -1
- package/bundled-test-harness/assets/{realm-config-routing-rule-edit-test-_D_xuw3p.js → realm-config-routing-rule-edit-test-TIuE2nug.js} +1 -1
- package/bundled-test-harness/assets/{realm-config-settings-test-DNqVtlJT.js → realm-config-settings-test-CWqwPMkw.js} +1 -1
- package/bundled-test-harness/assets/{reasoning-test-B74P8G_y.js → reasoning-test-CfRBo1ut.js} +1 -1
- package/bundled-test-harness/assets/{scrolling-test-EMUFGWKu.js → scrolling-test-DTJ7HVdE.js} +1 -1
- package/bundled-test-harness/assets/{sending-test-BIADsBdp.js → sending-test-D6iQh346.js} +1 -1
- package/bundled-test-harness/assets/{skills-test-AcW3L6RD.js → skills-test-Ca1EpjMI.js} +1 -1
- package/bundled-test-harness/assets/{store-test-CgPJ9v5Z.js → store-test-BS1Ue4Rt.js} +1 -1
- package/bundled-test-harness/assets/{tests-QZJXdl8x.js → tests-CPowoOp0.js} +471 -469
- package/bundled-test-harness/assets/{text-input-validator-test-DybvZTP3.js → text-input-validator-test-XpZxMbh0.js} +1 -1
- package/bundled-test-harness/assets/{to-device-streaming-test-BbgQFsQk.js → to-device-streaming-test-CKu1Ud8R.js} +1 -1
- package/bundled-test-harness/assets/{token-usage-test-BkQp1TTc.js → token-usage-test-Cszf7EU8.js} +1 -1
- package/bundled-test-harness/assets/{tools-test-DEfT44PZ.js → tools-test-DdlkGAFH.js} +1 -1
- package/bundled-test-harness/index.html +4 -4
- package/bundled-test-harness/tests/index.html +4 -4
- package/bundled-types/host-app/components/host-mode/content.gts +9 -0
- package/dist/api.js +166 -165
- package/dist/index.js +271 -270
- package/package.json +1 -1
- package/src/commands/realm-server/data-keys.ts +7 -14
- package/src/commands/realm-server/index.ts +2 -0
- package/src/commands/realm-server/keys.ts +496 -0
- package/src/lib/prompt.ts +45 -12
- package/src/lib/seed-auth.ts +63 -3
package/src/lib/seed-auth.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import jwt from 'jsonwebtoken';
|
|
2
|
+
import { ensureTrailingSlash } from '@cardstack/runtime-common/paths';
|
|
2
3
|
import type { RealmAuthenticator } from './realm-authenticator.ts';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -86,19 +87,78 @@ export function mintRealmServerToken(
|
|
|
86
87
|
/**
|
|
87
88
|
* Mint an operator token for one family of the realm server's operator
|
|
88
89
|
* endpoints (the `boxel realm-server` commands). It carries no user, names its
|
|
89
|
-
* family in the `operator` claim
|
|
90
|
-
*
|
|
90
|
+
* family in the `operator` claim, names the realm server's origin as its
|
|
91
|
+
* audience and lives for minutes; only that server accepts it, on those
|
|
92
|
+
* endpoints only, and the seed never leaves this machine.
|
|
91
93
|
*/
|
|
92
94
|
export function mintOperatorToken(
|
|
93
95
|
seed: string,
|
|
94
|
-
scope: 'data-keys',
|
|
96
|
+
scope: 'data-keys' | 'system-keys',
|
|
97
|
+
audience: string,
|
|
95
98
|
opts: { expiresIn?: jwt.SignOptions['expiresIn'] } = {},
|
|
96
99
|
): string {
|
|
97
100
|
return jwt.sign({ operator: scope }, seed, {
|
|
101
|
+
audience,
|
|
98
102
|
expiresIn: opts.expiresIn ?? '5m',
|
|
99
103
|
});
|
|
100
104
|
}
|
|
101
105
|
|
|
106
|
+
const LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]']);
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The URL of an operator endpoint on a realm server. An operator request
|
|
110
|
+
* carries a seed-signed token, and may carry a key value, so it goes only over
|
|
111
|
+
* https, or over plain http to this machine.
|
|
112
|
+
*/
|
|
113
|
+
export function operatorEndpointURL(realmServerUrl: string, path: string): URL {
|
|
114
|
+
let url: URL;
|
|
115
|
+
try {
|
|
116
|
+
url = new URL(path, ensureTrailingSlash(realmServerUrl));
|
|
117
|
+
} catch {
|
|
118
|
+
throw new Error(`${realmServerUrl} is not a URL`);
|
|
119
|
+
}
|
|
120
|
+
if (url.protocol !== 'https:' && !LOOPBACK_HOSTS.has(url.hostname)) {
|
|
121
|
+
throw new Error(
|
|
122
|
+
`${url.origin} is not https; refusing to send an operator request to it`,
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
return url;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Sends a request to a realm server's operator endpoint with an operator token
|
|
130
|
+
* for `scope` bound to that server's origin. Redirects are refused rather than
|
|
131
|
+
* followed: a redirect to another origin would carry the body there.
|
|
132
|
+
*/
|
|
133
|
+
export async function operatorRequest(
|
|
134
|
+
{
|
|
135
|
+
realmServerUrl,
|
|
136
|
+
realmSecretSeed,
|
|
137
|
+
fetch = globalThis.fetch,
|
|
138
|
+
}: {
|
|
139
|
+
realmServerUrl: string;
|
|
140
|
+
realmSecretSeed: string;
|
|
141
|
+
fetch?: typeof globalThis.fetch;
|
|
142
|
+
},
|
|
143
|
+
scope: 'data-keys' | 'system-keys',
|
|
144
|
+
path: string,
|
|
145
|
+
method: 'GET' | 'POST' | 'PATCH' | 'DELETE',
|
|
146
|
+
body?: unknown,
|
|
147
|
+
): Promise<{ url: string; response: Response }> {
|
|
148
|
+
let url = operatorEndpointURL(realmServerUrl, path);
|
|
149
|
+
let response = await fetch(url.href, {
|
|
150
|
+
method,
|
|
151
|
+
redirect: 'error',
|
|
152
|
+
headers: {
|
|
153
|
+
Accept: 'application/json',
|
|
154
|
+
Authorization: `Bearer ${mintOperatorToken(realmSecretSeed, scope, url.origin)}`,
|
|
155
|
+
...(body !== undefined ? { 'Content-Type': 'application/json' } : {}),
|
|
156
|
+
},
|
|
157
|
+
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
158
|
+
});
|
|
159
|
+
return { url: url.href, response };
|
|
160
|
+
}
|
|
161
|
+
|
|
102
162
|
function normalizeRealmUrl(realmUrl: string): string {
|
|
103
163
|
try {
|
|
104
164
|
const u = new URL(realmUrl);
|