@floegence/floe-webapp-boot 0.52.13 → 0.53.1

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.
@@ -1,6 +1,5 @@
1
- import type { ArtifactSource, ConnectionSnapshot } from '@floegence/flowersec-core';
2
- import type { PrivateLoopbackArtifactSourceV1 } from '@floegence/flowersec-core/browser';
3
- import { ConnectedAcquisition } from './acquisition';
1
+ import type { ConnectionSnapshot } from '@floegence/flowersec-core';
2
+ import { type AcquisitionSource, ConnectedAcquisition } from './acquisition';
4
3
  import { ProxyBootstrapOwner } from './proxy-bootstrap';
5
4
  export interface AcquisitionConnectionLifecycle {
6
5
  synchronize(snapshot: ConnectionSnapshot): void;
@@ -10,4 +9,4 @@ export type AcquisitionConnectionLifecycleOptions = Readonly<{
10
9
  proxyBootstrap?: ProxyBootstrapOwner;
11
10
  onConnected?: (acquisition: ConnectedAcquisition) => void;
12
11
  }>;
13
- export declare function createAcquisitionConnectionLifecycle(source: ArtifactSource | PrivateLoopbackArtifactSourceV1, options?: AcquisitionConnectionLifecycleOptions): AcquisitionConnectionLifecycle;
12
+ export declare function createAcquisitionConnectionLifecycle(source: AcquisitionSource, options?: AcquisitionConnectionLifecycleOptions): AcquisitionConnectionLifecycle;
@@ -1,5 +1,5 @@
1
1
  import { type ArtifactLease, type ArtifactSource, type ConnectionSnapshot, type JsonValue, type Session } from '@floegence/flowersec-core';
2
- import type { PrivateLoopbackArtifactLeaseV1, PrivateLoopbackArtifactSourceV1, SessionOptions } from '@floegence/flowersec-core/browser';
2
+ import type { HTTPDirectArtifactLeaseV1, HTTPDirectArtifactSourceV1, PrivateLoopbackArtifactLeaseV1, PrivateLoopbackArtifactSourceV1, SessionOptions } from '@floegence/flowersec-core/browser';
3
3
  import { type ProxyRuntimeScope } from '@floegence/flowersec-core/proxy';
4
4
  export type CriticalScopeProjectionV1 = Readonly<{
5
5
  scope: 'proxy.runtime';
@@ -70,7 +70,7 @@ export declare class IsolatedOneShotAcquisition {
70
70
  static create(): IsolatedOneShotAcquisition;
71
71
  static assertAuthentic(value: IsolatedOneShotAcquisition): void;
72
72
  }
73
- type AcquisitionSource = ArtifactSource | PrivateLoopbackArtifactSourceV1;
73
+ export type AcquisitionSource = ArtifactSource | PrivateLoopbackArtifactSourceV1 | HTTPDirectArtifactSourceV1;
74
74
  export type ConnectedAcquisitionDetails = Readonly<{
75
75
  session: Session;
76
76
  scope: ProxyRuntimeScope;
@@ -85,6 +85,7 @@ type MaterializeOptions = Readonly<{
85
85
  export declare function registerAcquisitionSource(source: AcquisitionSource): void;
86
86
  export declare function materializeAcquisitionForSource(source: ArtifactSource, value: unknown, options: MaterializeOptions): Promise<ArtifactLease>;
87
87
  export declare function materializePrivateLoopbackAcquisitionForSource(source: PrivateLoopbackArtifactSourceV1, value: unknown, options: MaterializeOptions): Promise<PrivateLoopbackArtifactLeaseV1>;
88
+ export declare function materializeHTTPDirectAcquisitionForSource(source: HTTPDirectArtifactSourceV1, value: unknown, options: MaterializeOptions): Promise<HTTPDirectArtifactLeaseV1>;
88
89
  export declare function synchronizeAcquisitionSourceSnapshot(source: AcquisitionSource, snapshot: ConnectionSnapshot): ConnectedAcquisition | null;
89
90
  export declare function clearAcquisitionSource(source: AcquisitionSource): void;
90
91
  export declare function connectedAcquisitionDetails(acquisition: ConnectedAcquisition): ConnectedAcquisitionDetails;
@@ -1,9 +1,10 @@
1
- import { createArtifactLease as A, parseArtifact as T } from "@floegence/flowersec-core";
2
- import { assertProxyRuntimeScope as U } from "@floegence/flowersec-core/proxy";
3
- const O = 32, E = 16384, C = "#redeven=";
4
- class o extends Error {
5
- constructor(i) {
6
- super(`Floe acquisition failed (code=${i})`), this.code = i, this.name = "AcquisitionError";
1
+ import { sha256 as x } from "@noble/hashes/sha2.js";
2
+ import { createArtifactLease as A, parseArtifact as E } from "@floegence/flowersec-core";
3
+ import { assertProxyRuntimeScope as C } from "@floegence/flowersec-core/proxy";
4
+ const j = 32, L = 16384, H = "#redeven=";
5
+ class r extends Error {
6
+ constructor(t) {
7
+ super(`Floe acquisition failed (code=${t})`), this.code = t, this.name = "AcquisitionError";
7
8
  }
8
9
  }
9
10
  class w {
@@ -14,8 +15,8 @@ class w {
14
15
  static create() {
15
16
  return new w();
16
17
  }
17
- static assertAuthentic(i) {
18
- i.#e;
18
+ static assertAuthentic(t) {
19
+ t.#e;
19
20
  }
20
21
  }
21
22
  class v {
@@ -26,86 +27,89 @@ class v {
26
27
  static create() {
27
28
  return new v();
28
29
  }
29
- static assertAuthentic(i) {
30
- i.#e;
30
+ static assertAuthentic(t) {
31
+ t.#e;
31
32
  }
32
33
  }
33
- const g = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new Set();
34
- function K(e) {
35
- if (g.has(e)) throw new o("duplicate_acquisition_source");
34
+ const g = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new Set();
35
+ function ee(e) {
36
+ if (g.has(e)) throw new r("duplicate_acquisition_source");
36
37
  g.set(e, { pending: [] });
37
38
  }
38
- async function Q(e, i, t) {
39
- const n = g.get(e);
40
- if (n === void 0) throw new o("invalid_acquisition_source");
41
- const c = await B(i, t, T);
42
- return b(
43
- c,
44
- A,
45
- t.commitSpend,
46
- (r) => {
47
- n.pending.push(r);
48
- },
49
- (r) => {
50
- n.pending = n.pending.filter((a) => a !== r);
51
- }
52
- );
39
+ async function te(e, t, i) {
40
+ return q(e, t, i, E, A);
53
41
  }
54
- async function ee(e, i, t) {
55
- const n = g.get(e);
56
- if (n === void 0) throw new o("invalid_acquisition_source");
57
- const c = await import("@floegence/flowersec-core/browser"), r = await B(
42
+ async function ie(e, t, i) {
43
+ const n = await import("@floegence/flowersec-core/browser");
44
+ return q(
45
+ e,
46
+ t,
58
47
  i,
48
+ n.parsePrivateLoopbackArtifactV1,
49
+ n.createPrivateLoopbackArtifactLeaseV1
50
+ );
51
+ }
52
+ async function ne(e, t, i) {
53
+ const n = await import("@floegence/flowersec-core/browser");
54
+ return q(
55
+ e,
59
56
  t,
60
- c.parsePrivateLoopbackArtifactV1
57
+ i,
58
+ n.parseHTTPDirectArtifactV1,
59
+ n.createHTTPDirectArtifactLeaseV1
61
60
  );
62
- return b(
63
- r,
64
- c.createPrivateLoopbackArtifactLeaseV1,
65
- t.commitSpend,
66
- (a) => {
67
- n.pending.push(a);
61
+ }
62
+ async function q(e, t, i, n, c) {
63
+ const o = g.get(e);
64
+ if (o === void 0) throw new r("invalid_acquisition_source");
65
+ const a = await R(t, i, n);
66
+ return B(
67
+ a,
68
+ c,
69
+ i.commitSpend,
70
+ (d) => {
71
+ o.pending.push(d);
68
72
  },
69
- (a) => {
70
- n.pending = n.pending.filter((d) => d !== a);
73
+ (d) => {
74
+ o.pending = o.pending.filter((s) => s !== d);
71
75
  }
72
76
  );
73
77
  }
74
- function te(e, i) {
75
- const t = g.get(e);
76
- if (t === void 0) return null;
77
- if (i.state !== "connected" || i.currentSession === void 0)
78
- return (i.state === "idle" || i.state === "waiting" || i.state === "failed" || i.state === "closed") && (t.pending = [], t.connected = void 0, t.connectedSession = void 0), null;
79
- if (t.connected !== void 0 && t.connectedSession === i.currentSession)
80
- return t.connected;
81
- const n = t.pending.filter((a) => a.committed);
82
- if (n.length !== 1 || t.pending.length !== 1)
83
- throw t.pending = [], new o("connected_acquisition_mismatch");
78
+ function re(e, t) {
79
+ const i = g.get(e);
80
+ if (i === void 0) return null;
81
+ if (t.state !== "connected" || t.currentSession === void 0)
82
+ return (t.state === "idle" || t.state === "waiting" || t.state === "failed" || t.state === "closed") && (i.pending = [], i.connected = void 0, i.connectedSession = void 0), null;
83
+ if (i.connected !== void 0 && i.connectedSession === t.currentSession)
84
+ return i.connected;
85
+ const n = i.pending.filter((a) => a.committed);
86
+ if (n.length !== 1 || i.pending.length !== 1)
87
+ throw i.pending = [], new r("connected_acquisition_mismatch");
84
88
  const c = n[0];
85
- if (c === void 0) throw new o("connected_acquisition_mismatch");
86
- const r = w.create();
87
- return q.set(
88
- r,
89
+ if (c === void 0) throw new r("connected_acquisition_mismatch");
90
+ const o = w.create();
91
+ return O.set(
92
+ o,
89
93
  Object.freeze({
90
- session: i.currentSession,
94
+ session: t.currentSession,
91
95
  scope: c.scope,
92
96
  bindingIdentity: c.bindingIdentity,
93
- attempt: i.attempt
97
+ attempt: t.attempt
94
98
  })
95
- ), t.pending = [], t.connected = r, t.connectedSession = i.currentSession, r;
99
+ ), i.pending = [], i.connected = o, i.connectedSession = t.currentSession, o;
96
100
  }
97
- function ie(e) {
98
- const i = g.get(e);
99
- i !== void 0 && (i.pending = [], i.connected = void 0, i.connectedSession = void 0);
101
+ function oe(e) {
102
+ const t = g.get(e);
103
+ t !== void 0 && (t.pending = [], t.connected = void 0, t.connectedSession = void 0);
100
104
  }
101
- function ne(e) {
105
+ function ce(e) {
102
106
  w.assertAuthentic(e);
103
- const i = q.get(e);
104
- if (i === void 0) throw new o("invalid_connected_acquisition");
105
- return i;
107
+ const t = O.get(e);
108
+ if (t === void 0) throw new r("invalid_connected_acquisition");
109
+ return t;
106
110
  }
107
- async function oe(e) {
108
- const i = e.rawHandoff, t = typeof i != "string" || P(`${C}${i}`) > E;
111
+ async function ae(e) {
112
+ const t = e.rawHandoff, i = typeof t != "string" || V(`${H}${t}`) > L;
109
113
  let n = !1;
110
114
  try {
111
115
  n = e.clearSensitiveLocation() === !0;
@@ -113,17 +117,17 @@ async function oe(e) {
113
117
  n = !1;
114
118
  }
115
119
  if (!n)
116
- throw e.navigateToLauncher(), new o("isolated_location_clear_failed");
117
- if (t) throw new o("isolated_handoff_too_large");
118
- const c = m(i, "invalid_isolated_handoff"), r = await W(c);
119
- if (I.has(r))
120
- throw new o("isolated_handoff_consumed");
121
- I.add(r);
120
+ throw e.navigateToLauncher(), new r("isolated_location_clear_failed");
121
+ if (i) throw new r("isolated_handoff_too_large");
122
+ const c = m(t, "invalid_isolated_handoff"), o = await G(c);
123
+ if (D.has(o))
124
+ throw new r("isolated_handoff_consumed");
125
+ D.add(o);
122
126
  let a;
123
127
  try {
124
128
  a = JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(c));
125
129
  } catch {
126
- throw new o("invalid_isolated_handoff");
130
+ throw new r("invalid_isolated_handoff");
127
131
  }
128
132
  const d = await F(
129
133
  a,
@@ -131,120 +135,120 @@ async function oe(e) {
131
135
  e.commitSpend
132
136
  );
133
137
  let s;
134
- const l = b(
138
+ const l = B(
135
139
  d,
136
140
  A,
137
141
  e.commitSpend,
138
- (u) => {
139
- s = u;
142
+ (_) => {
143
+ s = _;
140
144
  },
141
145
  () => {
142
146
  }
143
147
  );
144
148
  if (s === void 0 || s.lease !== l)
145
- throw new o("isolated_materialization_failed");
146
- const p = v.create();
147
- return L.set(p, { pending: s, state: "ready" }), p;
149
+ throw new r("isolated_materialization_failed");
150
+ const u = v.create();
151
+ return P.set(u, { pending: s, state: "ready" }), u;
148
152
  }
149
- async function F(e, i, t) {
150
- const n = H(e, i), c = await B(
153
+ async function F(e, t, i) {
154
+ const n = J(e, t), c = await R(
151
155
  n.acquisition,
152
156
  {
153
- commitSpend: t,
157
+ commitSpend: i,
154
158
  expectedConsumer: "isolated",
155
- validateSpendBinding: (r) => {
156
- J(n, r, i);
159
+ validateSpendBinding: (o) => {
160
+ M(n, o, t);
157
161
  try {
158
- i.validateTargetBinding(r.targetBinding);
162
+ t.validateTargetBinding(o.targetBinding);
159
163
  } catch {
160
- throw new o("invalid_spend_binding");
164
+ throw new r("invalid_spend_binding");
161
165
  }
162
- return `${r.artifactDigestB64u}.${r.projectionDigestB64u}`;
166
+ return `${o.artifactDigestB64u}.${o.projectionDigestB64u}`;
163
167
  }
164
168
  },
165
- T
169
+ E
166
170
  );
167
171
  if (c.scope.appBasePath !== n.app_path)
168
- throw new o("isolated_app_path_mismatch");
172
+ throw new r("isolated_app_path_mismatch");
169
173
  if (c.scope.mode === "controller_bridge") {
170
- const r = c.scope.controllerBridge.allowedOrigins;
171
- if (r.length !== 1 || r[0] !== n.app_origin)
172
- throw new o("isolated_allowed_origins_mismatch");
174
+ const o = c.scope.controllerBridge.allowedOrigins;
175
+ if (o.length !== 1 || o[0] !== n.app_origin)
176
+ throw new r("isolated_allowed_origins_mismatch");
173
177
  }
174
178
  return c;
175
179
  }
176
- async function re(e, i, t) {
180
+ async function se(e, t, i) {
177
181
  const n = g.get(e);
178
- if (n === void 0) throw new o("invalid_acquisition_source");
182
+ if (n === void 0) throw new r("invalid_acquisition_source");
179
183
  const c = h(
180
- i,
184
+ t,
181
185
  ["v", "runtime_origin", "runtime_handoff_b64u"],
182
186
  "invalid_isolated_handoff"
183
- ), r = c.runtime_handoff_b64u;
184
- if (c.v !== 6 || typeof r != "string" || P(r) > E)
185
- throw new o("invalid_isolated_handoff");
186
- const a = m(r, "invalid_isolated_handoff");
187
+ ), o = c.runtime_handoff_b64u;
188
+ if (c.v !== 6 || typeof o != "string" || V(o) > L)
189
+ throw new r("invalid_isolated_handoff");
190
+ const a = m(o, "invalid_isolated_handoff");
187
191
  let d;
188
192
  try {
189
193
  d = JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(a));
190
194
  } catch {
191
- throw new o("invalid_isolated_handoff");
195
+ throw new r("invalid_isolated_handoff");
192
196
  }
193
197
  const s = d, l = {
194
- ...t.context,
198
+ ...i.context,
195
199
  runtimeOrigin: f(c.runtime_origin),
196
200
  appOrigin: f(s?.app_origin)
197
- }, p = await F(
201
+ }, u = await F(
198
202
  d,
199
203
  l,
200
- t.commitSpend
201
- ), u = s?.acquisition;
202
- if (!u) throw new o("invalid_isolated_handoff");
203
- return t.validateSpendBinding(R(u.spend_scope)), b(
204
- p,
204
+ i.commitSpend
205
+ ), _ = s?.acquisition;
206
+ if (!_) throw new r("invalid_isolated_handoff");
207
+ return i.validateSpendBinding($(_.spend_scope)), B(
208
+ u,
205
209
  A,
206
- t.commitSpend,
207
- (_) => n.pending.push(_),
208
- (_) => {
209
- n.pending = n.pending.filter((y) => y !== _);
210
+ i.commitSpend,
211
+ (p) => n.pending.push(p),
212
+ (p) => {
213
+ n.pending = n.pending.filter((y) => y !== p);
210
214
  }
211
215
  );
212
216
  }
213
- async function ce(e, i = {}) {
217
+ async function de(e, t = {}) {
214
218
  v.assertAuthentic(e);
215
- const t = L.get(e);
216
- if (t === void 0 || t.state !== "ready")
217
- throw new o("isolated_acquisition_consumed");
218
- t.state = "connecting";
219
+ const i = P.get(e);
220
+ if (i === void 0 || i.state !== "ready")
221
+ throw new r("isolated_acquisition_consumed");
222
+ i.state = "connecting";
219
223
  try {
220
- const { connect: n } = await import("@floegence/flowersec-core/browser"), c = await n(t.pending.lease, i);
221
- if (!t.pending.committed)
224
+ const { connect: n } = await import("@floegence/flowersec-core/browser"), c = await n(i.pending.lease, t);
225
+ if (!i.pending.committed)
222
226
  throw await c.close().catch(() => {
223
- }), new o("isolated_spend_not_committed");
224
- const r = w.create();
225
- return q.set(
226
- r,
227
+ }), new r("isolated_spend_not_committed");
228
+ const o = w.create();
229
+ return O.set(
230
+ o,
227
231
  Object.freeze({
228
232
  session: c,
229
- scope: t.pending.scope,
230
- bindingIdentity: t.pending.bindingIdentity,
233
+ scope: i.pending.scope,
234
+ bindingIdentity: i.pending.bindingIdentity,
231
235
  attempt: 1
232
236
  })
233
- ), t.state = "consumed", r;
237
+ ), i.state = "consumed", o;
234
238
  } catch (n) {
235
- throw t.state = "consumed", n;
239
+ throw i.state = "consumed", n;
236
240
  }
237
241
  }
238
- async function B(e, i, t) {
242
+ async function R(e, t, i) {
239
243
  const n = h(
240
244
  e,
241
245
  ["v", "connect_artifact", "critical_scope_projection_json", "spend_scope"],
242
246
  "invalid_acquisition_envelope"
243
247
  );
244
248
  if (n.v !== 1 || typeof n.connect_artifact != "string" || n.connect_artifact.length === 0 || typeof n.critical_scope_projection_json != "string" || n.critical_scope_projection_json.length === 0)
245
- throw new o("invalid_acquisition_envelope");
246
- const c = V(n.spend_scope, i.expectedConsumer), r = new TextEncoder().encode(n.connect_artifact), a = new TextEncoder().encode(n.critical_scope_projection_json);
247
- await D(r, c.artifact_digest_b64u, "artifact_digest_mismatch"), await D(
249
+ throw new r("invalid_acquisition_envelope");
250
+ const c = U(n.spend_scope, t.expectedConsumer), o = new TextEncoder().encode(n.connect_artifact), a = new TextEncoder().encode(n.critical_scope_projection_json);
251
+ await I(o, c.artifact_digest_b64u, "artifact_digest_mismatch"), await I(
248
252
  a,
249
253
  c.projection_digest_b64u,
250
254
  "projection_digest_mismatch"
@@ -253,7 +257,7 @@ async function B(e, i, t) {
253
257
  try {
254
258
  d = JSON.parse(n.critical_scope_projection_json);
255
259
  } catch {
256
- throw new o("invalid_critical_scope_projection");
260
+ throw new r("invalid_critical_scope_projection");
257
261
  }
258
262
  const s = h(
259
263
  d,
@@ -261,51 +265,51 @@ async function B(e, i, t) {
261
265
  "invalid_critical_scope_projection"
262
266
  );
263
267
  if (s.scope !== "proxy.runtime" || s.scope_version !== 2 || s.critical !== !0)
264
- throw new o("invalid_critical_scope_projection");
268
+ throw new r("invalid_critical_scope_projection");
265
269
  let l;
266
270
  try {
267
- l = U(s.payload);
271
+ l = C(s.payload);
268
272
  } catch {
269
- throw new o("invalid_proxy_runtime_scope");
273
+ throw new r("invalid_proxy_runtime_scope");
270
274
  }
271
- let p;
275
+ let u;
272
276
  try {
273
- p = t(n.connect_artifact);
277
+ u = i(n.connect_artifact);
274
278
  } catch {
275
- throw new o("invalid_connect_artifact");
279
+ throw new r("invalid_connect_artifact");
276
280
  }
277
- const u = R(c), _ = i.validateSpendBinding(u);
278
- if (_ !== void 0 && (typeof _ != "string" || _.trim() === "" || _ !== _.trim()))
279
- throw new o("invalid_spend_binding_identity");
281
+ const _ = $(c), p = t.validateSpendBinding(_);
282
+ if (p !== void 0 && (typeof p != "string" || p.trim() === "" || p !== p.trim()))
283
+ throw new r("invalid_spend_binding_identity");
280
284
  return Object.freeze({
281
- artifact: p,
285
+ artifact: u,
282
286
  scope: l,
283
- binding: u,
284
- bindingIdentity: _ ?? `${u.artifactDigestB64u}.${u.projectionDigestB64u}`,
287
+ binding: _,
288
+ bindingIdentity: p ?? `${_.artifactDigestB64u}.${_.projectionDigestB64u}`,
285
289
  receipt: c.receipt
286
290
  });
287
291
  }
288
- function b(e, i, t, n, c) {
289
- const r = e.artifact, a = e.scope, d = e.binding, s = e.bindingIdentity;
290
- let l = e.receipt, p;
291
- const u = i(r, async (_) => {
292
+ function B(e, t, i, n, c) {
293
+ const o = e.artifact, a = e.scope, d = e.binding, s = e.bindingIdentity;
294
+ let l = e.receipt, u;
295
+ const _ = t(o, async (p) => {
292
296
  const y = l;
293
- if (l = void 0, y === void 0) throw new o("spend_binding_consumed");
297
+ if (l = void 0, y === void 0) throw new r("spend_binding_consumed");
294
298
  const k = Object.freeze({
295
299
  ...d,
296
- attemptId: G(),
300
+ attemptId: X(),
297
301
  receipt: y
298
302
  });
299
303
  try {
300
- await t(k, _), p.committed = !0;
304
+ await i(k, p), u.committed = !0;
301
305
  } catch (N) {
302
- throw c(p), N;
306
+ throw c(u), N;
303
307
  }
304
308
  });
305
- return p = { lease: u, scope: a, bindingIdentity: s, committed: !1 }, n(p), u;
309
+ return u = { lease: _, scope: a, bindingIdentity: s, committed: !1 }, n(u), _;
306
310
  }
307
- function V(e, i) {
308
- const t = h(
311
+ function U(e, t) {
312
+ const i = h(
309
313
  e,
310
314
  [
311
315
  "v",
@@ -321,24 +325,24 @@ function V(e, i) {
321
325
  ],
322
326
  "invalid_spend_scope"
323
327
  );
324
- if (t.v !== 1 || typeof t.receipt != "string" || !M(t.receipt) || typeof t.artifact_digest_b64u != "string" || !x(t.artifact_digest_b64u) || typeof t.projection_digest_b64u != "string" || !x(t.projection_digest_b64u) || t.consumer !== i || typeof t.expires_at != "string" || !Z(t.expires_at) || !S(t.target_binding))
325
- throw new o("invalid_spend_scope");
326
- const n = f(t.launcher_origin), c = f(t.runtime_origin), r = f(t.app_origin);
327
- if (Date.parse(t.expires_at) <= Date.now()) throw new o("expired_spend_scope");
328
+ if (i.v !== 1 || typeof i.receipt != "string" || !Z(i.receipt) || typeof i.artifact_digest_b64u != "string" || !T(i.artifact_digest_b64u) || typeof i.projection_digest_b64u != "string" || !T(i.projection_digest_b64u) || i.consumer !== t || typeof i.expires_at != "string" || !W(i.expires_at) || !b(i.target_binding))
329
+ throw new r("invalid_spend_scope");
330
+ const n = f(i.launcher_origin), c = f(i.runtime_origin), o = f(i.app_origin);
331
+ if (Date.parse(i.expires_at) <= Date.now()) throw new r("expired_spend_scope");
328
332
  return Object.freeze({
329
333
  v: 1,
330
- receipt: t.receipt,
331
- artifact_digest_b64u: t.artifact_digest_b64u,
332
- projection_digest_b64u: t.projection_digest_b64u,
334
+ receipt: i.receipt,
335
+ artifact_digest_b64u: i.artifact_digest_b64u,
336
+ projection_digest_b64u: i.projection_digest_b64u,
333
337
  launcher_origin: n,
334
338
  runtime_origin: c,
335
- app_origin: r,
336
- consumer: i,
337
- target_binding: j(t.target_binding),
338
- expires_at: t.expires_at
339
+ app_origin: o,
340
+ consumer: t,
341
+ target_binding: S(i.target_binding),
342
+ expires_at: i.expires_at
339
343
  });
340
344
  }
341
- function R(e) {
345
+ function $(e) {
342
346
  return Object.freeze({
343
347
  artifactDigestB64u: e.artifact_digest_b64u,
344
348
  projectionDigestB64u: e.projection_digest_b64u,
@@ -350,8 +354,8 @@ function R(e) {
350
354
  expiresAt: e.expires_at
351
355
  });
352
356
  }
353
- function H(e, i) {
354
- const t = h(
357
+ function J(e, t) {
358
+ const i = h(
355
359
  e,
356
360
  [
357
361
  "v",
@@ -368,126 +372,118 @@ function H(e, i) {
368
372
  ],
369
373
  "invalid_isolated_handoff"
370
374
  );
371
- if (t.v !== 6 || t.env_public_id !== i.envPublicId || t.floe_app !== i.floeApp || t.code_space_id !== i.codeSpaceId || t.app_path !== i.appPath || t.launcher_kind !== i.launcherKind || t.launcher_id !== i.launcherId || t.launcher_origin !== i.launcherOrigin || t.runtime_origin !== i.runtimeOrigin || t.app_origin !== i.appOrigin)
372
- throw new o("isolated_context_mismatch");
373
- return f(t.launcher_origin), f(t.runtime_origin), f(t.app_origin), t;
375
+ if (i.v !== 6 || i.env_public_id !== t.envPublicId || i.floe_app !== t.floeApp || i.code_space_id !== t.codeSpaceId || i.app_path !== t.appPath || i.launcher_kind !== t.launcherKind || i.launcher_id !== t.launcherId || i.launcher_origin !== t.launcherOrigin || i.runtime_origin !== t.runtimeOrigin || i.app_origin !== t.appOrigin)
376
+ throw new r("isolated_context_mismatch");
377
+ return f(i.launcher_origin), f(i.runtime_origin), f(i.app_origin), i;
374
378
  }
375
- function J(e, i, t) {
376
- if (i.consumer !== "isolated" || i.launcherOrigin !== e.launcher_origin || i.runtimeOrigin !== e.runtime_origin || i.appOrigin !== e.app_origin || e.runtime_origin !== t.runtimeOrigin || e.app_origin !== t.appOrigin)
377
- throw new o("isolated_spend_binding_mismatch");
379
+ function M(e, t, i) {
380
+ if (t.consumer !== "isolated" || t.launcherOrigin !== e.launcher_origin || t.runtimeOrigin !== e.runtime_origin || t.appOrigin !== e.app_origin || e.runtime_origin !== i.runtimeOrigin || e.app_origin !== i.appOrigin)
381
+ throw new r("isolated_spend_binding_mismatch");
378
382
  }
379
- function h(e, i, t) {
383
+ function h(e, t, i) {
380
384
  if (e === null || typeof e != "object" || Array.isArray(e))
381
- throw new o(t);
382
- const n = e, c = new Set(i), r = Object.keys(n);
383
- if (r.length !== i.length || r.some((a) => !c.has(a)))
384
- throw new o(t);
385
+ throw new r(i);
386
+ const n = e, c = new Set(t), o = Object.keys(n);
387
+ if (o.length !== t.length || o.some((a) => !c.has(a)))
388
+ throw new r(i);
385
389
  return n;
386
390
  }
387
391
  function f(e) {
388
- if (typeof e != "string") throw new o("invalid_spend_scope");
389
- let i;
392
+ if (typeof e != "string") throw new r("invalid_spend_scope");
393
+ let t;
390
394
  try {
391
- i = new URL(e);
395
+ t = new URL(e);
392
396
  } catch {
393
- throw new o("invalid_spend_scope");
397
+ throw new r("invalid_spend_scope");
394
398
  }
395
- if (i.protocol !== "https:" && i.protocol !== "http:" || i.origin !== e || i.username !== "" || i.password !== "")
396
- throw new o("invalid_spend_scope");
399
+ if (t.protocol !== "https:" && t.protocol !== "http:" || t.origin !== e || t.username !== "" || t.password !== "")
400
+ throw new r("invalid_spend_scope");
397
401
  return e;
398
402
  }
399
- function M(e) {
400
- const i = /^r1\.([A-Za-z0-9_-]{1,64})\.([A-Za-z0-9_-]+)$/u.exec(e);
401
- if (i === null || i[2] === void 0) return !1;
403
+ function Z(e) {
404
+ const t = /^r1\.([A-Za-z0-9_-]{1,64})\.([A-Za-z0-9_-]+)$/u.exec(e);
405
+ if (t === null || t[2] === void 0) return !1;
402
406
  try {
403
- return m(i[2], "invalid_spend_scope").length === O;
407
+ return m(t[2], "invalid_spend_scope").length === j;
404
408
  } catch {
405
409
  return !1;
406
410
  }
407
411
  }
408
- function x(e) {
412
+ function T(e) {
409
413
  try {
410
- return m(e, "invalid_spend_scope").length === O;
414
+ return m(e, "invalid_spend_scope").length === j;
411
415
  } catch {
412
416
  return !1;
413
417
  }
414
418
  }
415
- function Z(e) {
419
+ function W(e) {
416
420
  return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/u.test(e) ? Number.isFinite(Date.parse(e)) : !1;
417
421
  }
418
- function S(e, i = 0) {
419
- return i > 32 ? !1 : e === null || typeof e == "string" || typeof e == "boolean" ? !0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.every((t) => S(t, i + 1)) : typeof e != "object" ? !1 : Object.values(e).every(
420
- (t) => S(t, i + 1)
422
+ function b(e, t = 0) {
423
+ return t > 32 ? !1 : e === null || typeof e == "string" || typeof e == "boolean" ? !0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.every((i) => b(i, t + 1)) : typeof e != "object" ? !1 : Object.values(e).every(
424
+ (i) => b(i, t + 1)
421
425
  );
422
426
  }
423
- function j(e) {
427
+ function S(e) {
424
428
  if (Array.isArray(e)) {
425
- for (const i of e) j(i);
429
+ for (const t of e) S(t);
426
430
  return Object.freeze(e);
427
431
  }
428
432
  if (e !== null && typeof e == "object") {
429
- for (const i of Object.values(e)) j(i);
433
+ for (const t of Object.values(e)) S(t);
430
434
  return Object.freeze(e);
431
435
  }
432
436
  return e;
433
437
  }
434
- async function D(e, i, t) {
435
- const n = await $(e), c = m(i, t);
436
- if (n.length !== c.length) throw new o(t);
437
- let r = 0;
438
+ async function I(e, t, i) {
439
+ const n = await x(e), c = m(t, i);
440
+ if (n.length !== c.length) throw new r(i);
441
+ let o = 0;
438
442
  for (let a = 0; a < n.length; a += 1)
439
- r |= n[a] ^ c[a];
440
- if (r !== 0) throw new o(t);
441
- }
442
- async function W(e) {
443
- return z(await $(e));
444
- }
445
- async function $(e) {
446
- if (globalThis.crypto?.subtle === void 0)
447
- throw new o("acquisition_crypto_unavailable");
448
- const i = e.buffer.slice(
449
- e.byteOffset,
450
- e.byteOffset + e.byteLength
451
- ), t = await globalThis.crypto.subtle.digest("SHA-256", i);
452
- return new Uint8Array(t);
453
- }
454
- function G() {
443
+ o |= n[a] ^ c[a];
444
+ if (o !== 0) throw new r(i);
445
+ }
446
+ async function G(e) {
447
+ return z(await x(e));
448
+ }
449
+ function X() {
455
450
  if (globalThis.crypto?.getRandomValues === void 0)
456
- throw new o("acquisition_entropy_unavailable");
457
- return z(globalThis.crypto.getRandomValues(new Uint8Array(O)));
451
+ throw new r("acquisition_entropy_unavailable");
452
+ return z(globalThis.crypto.getRandomValues(new Uint8Array(j)));
458
453
  }
459
- function m(e, i) {
460
- if (!/^[A-Za-z0-9_-]*$/u.test(e) || e.length % 4 === 1) throw new o(i);
461
- const t = e.replace(/-/gu, "+").replace(/_/gu, "/") + "=".repeat((4 - e.length % 4) % 4);
454
+ function m(e, t) {
455
+ if (!/^[A-Za-z0-9_-]*$/u.test(e) || e.length % 4 === 1) throw new r(t);
456
+ const i = e.replace(/-/gu, "+").replace(/_/gu, "/") + "=".repeat((4 - e.length % 4) % 4);
462
457
  let n;
463
458
  try {
464
- n = atob(t);
459
+ n = atob(i);
465
460
  } catch {
466
- throw new o(i);
461
+ throw new r(t);
467
462
  }
468
- const c = Uint8Array.from(n, (r) => r.charCodeAt(0));
469
- if (z(c) !== e) throw new o(i);
463
+ const c = Uint8Array.from(n, (o) => o.charCodeAt(0));
464
+ if (z(c) !== e) throw new r(t);
470
465
  return c;
471
466
  }
472
467
  function z(e) {
473
- let i = "";
474
- for (const t of e) i += String.fromCharCode(t);
475
- return btoa(i).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/u, "");
468
+ let t = "";
469
+ for (const i of e) t += String.fromCharCode(i);
470
+ return btoa(t).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/u, "");
476
471
  }
477
- function P(e) {
472
+ function V(e) {
478
473
  return new TextEncoder().encode(e).length;
479
474
  }
480
475
  export {
481
- o as AcquisitionError,
476
+ r as AcquisitionError,
482
477
  w as ConnectedAcquisition,
483
478
  v as IsolatedOneShotAcquisition,
484
- ie as clearAcquisitionSource,
485
- ce as connectIsolatedOneShot,
486
- ne as connectedAcquisitionDetails,
487
- Q as materializeAcquisitionForSource,
488
- oe as materializeIsolatedOneShot,
489
- re as materializeNativeIsolatedAcquisitionForSource,
490
- ee as materializePrivateLoopbackAcquisitionForSource,
491
- K as registerAcquisitionSource,
492
- te as synchronizeAcquisitionSourceSnapshot
479
+ oe as clearAcquisitionSource,
480
+ de as connectIsolatedOneShot,
481
+ ce as connectedAcquisitionDetails,
482
+ te as materializeAcquisitionForSource,
483
+ ne as materializeHTTPDirectAcquisitionForSource,
484
+ ae as materializeIsolatedOneShot,
485
+ se as materializeNativeIsolatedAcquisitionForSource,
486
+ ie as materializePrivateLoopbackAcquisitionForSource,
487
+ ee as registerAcquisitionSource,
488
+ re as synchronizeAcquisitionSourceSnapshot
493
489
  };
@@ -1,5 +1,5 @@
1
1
  import type { ArtifactSource, JsonObject, RetryDisposition } from '@floegence/flowersec-core';
2
- import type { PrivateLoopbackArtifactSourceV1 } from '@floegence/flowersec-core/browser';
2
+ import type { HTTPDirectArtifactSourceV1, PrivateLoopbackArtifactSourceV1 } from '@floegence/flowersec-core/browser';
3
3
  import { type NativeIsolatedAcquisitionContext, type CommitSpend, type ValidateSpendBinding } from './acquisition';
4
4
  export type ControlplaneArtifactSourceOptions = Readonly<{
5
5
  baseUrl: string;
@@ -16,6 +16,7 @@ export type ControlplaneArtifactSourceOptions = Readonly<{
16
16
  retryableBusinessCodes?: readonly string[];
17
17
  }>;
18
18
  export type PrivateLoopbackControlplaneArtifactSourceOptions = Omit<ControlplaneArtifactSourceOptions, 'allowLoopbackHTTP' | 'entryTicket'>;
19
+ export type HTTPDirectControlplaneArtifactSourceOptions = Omit<ControlplaneArtifactSourceOptions, 'allowLoopbackHTTP' | 'entryTicket'>;
19
20
  export declare class ControlplaneRequestError extends Error {
20
21
  readonly status: number;
21
22
  readonly code: string;
@@ -42,3 +43,7 @@ export declare function createIsolatedControlplaneArtifactSource(options: Contro
42
43
  isolatedContext: NativeIsolatedAcquisitionContext;
43
44
  }>): ArtifactSource;
44
45
  export declare function createPrivateLoopbackControlplaneArtifactSource(options: PrivateLoopbackControlplaneArtifactSourceOptions): PrivateLoopbackArtifactSourceV1;
46
+ /** Explicit HTTP acquisition; the HTTP Direct controller validates the session origin.
47
+ * This never changes the transport policy of the TLS or private-loopback sources.
48
+ */
49
+ export declare function createHTTPDirectControlplaneArtifactSource(options: HTTPDirectControlplaneArtifactSourceOptions): HTTPDirectArtifactSourceV1;
@@ -1,6 +1,6 @@
1
- import { registerAcquisitionSource as u, materializeNativeIsolatedAcquisitionForSource as S, AcquisitionError as m, materializeAcquisitionForSource as k, materializePrivateLoopbackAcquisitionForSource as _ } from "./acquisition.js";
2
- const h = /^[a-z][a-z0-9_]{0,63}$/u;
3
- class s extends Error {
1
+ import { registerAcquisitionSource as d, materializeHTTPDirectAcquisitionForSource as S, materializeNativeIsolatedAcquisitionForSource as _, AcquisitionError as h, materializeAcquisitionForSource as k, materializePrivateLoopbackAcquisitionForSource as z } from "./acquisition.js";
2
+ const m = /^[a-z][a-z0-9_]{0,63}$/u;
3
+ class c extends Error {
4
4
  constructor(r, t) {
5
5
  super(`Floe controlplane request failed (code=${t})`), this.status = r, this.code = t, this.name = "ControlplaneRequestError";
6
6
  }
@@ -9,23 +9,23 @@ function v(e) {
9
9
  const r = e.toLowerCase();
10
10
  return r === "localhost" || r === "::1" || r === "127.0.0.1" || r.startsWith("127.");
11
11
  }
12
- function z(e, r) {
12
+ function j(e, r) {
13
13
  let t;
14
14
  try {
15
15
  t = new URL(e);
16
16
  } catch {
17
- throw new s(0, "transport_policy_denied");
17
+ throw new c(0, "transport_policy_denied");
18
18
  }
19
19
  if (t.protocol !== "https:" && !(r && t.protocol === "http:" && v(t.hostname)))
20
- throw new s(0, "transport_policy_denied");
20
+ throw new c(0, "transport_policy_denied");
21
21
  return t.pathname = t.pathname.replace(/\/+$/u, ""), t;
22
22
  }
23
- function j(e, r) {
23
+ function A(e, r) {
24
24
  const t = r === void 0 ? "/v1/connect/artifact" : "/v1/connect/artifact/entry", o = e.pathname === "/" ? "" : e.pathname;
25
25
  return new URL(`${o}${t}`, e).toString();
26
26
  }
27
27
  function O(e) {
28
- if (!h.test(e.code))
28
+ if (!m.test(e.code))
29
29
  return Object.freeze({
30
30
  code: "invalid_error_code",
31
31
  disposition: Object.freeze({ kind: "terminal" })
@@ -33,7 +33,7 @@ function O(e) {
33
33
  if (new Set(e.retryableBusinessCodes ?? []).has(e.code))
34
34
  return Object.freeze({ code: e.code, disposition: Object.freeze({ kind: "retryable" }) });
35
35
  if (e.status === 429) {
36
- const t = T(e.retryAfter, e.nowUnixMilliseconds ?? Date.now());
36
+ const t = L(e.retryAfter, e.nowUnixMilliseconds ?? Date.now());
37
37
  return Object.freeze({
38
38
  code: e.code,
39
39
  disposition: Object.freeze(t === void 0 ? { kind: "retryable" } : { kind: "retry_after", notBeforeUnixMilliseconds: t })
@@ -41,42 +41,59 @@ function O(e) {
41
41
  }
42
42
  return e.status === 408 || e.status === 425 || e.status >= 500 ? Object.freeze({ code: e.code, disposition: Object.freeze({ kind: "retryable" }) }) : Object.freeze({ code: e.code, disposition: Object.freeze({ kind: "terminal" }) });
43
43
  }
44
- function L(e) {
45
- const r = p(e, k);
46
- return u(r), r;
44
+ function U(e) {
45
+ const r = l(e, k);
46
+ return d(r), r;
47
47
  }
48
48
  function I(e) {
49
- const r = p(
49
+ const r = l(
50
50
  e,
51
- (t, o, i) => S(t, o, {
51
+ (t, o, i) => _(t, o, {
52
52
  ...i,
53
53
  context: e.isolatedContext
54
54
  }),
55
55
  "isolated"
56
56
  );
57
- return u(r), r;
57
+ return d(r), r;
58
58
  }
59
59
  function N(e) {
60
- const r = A(e.baseUrl), t = p(
60
+ const r = T(e.baseUrl), t = l(
61
61
  { ...e, baseUrl: r.origin, allowLoopbackHTTP: !0 },
62
- _
62
+ z
63
+ );
64
+ return d(t), t;
65
+ }
66
+ function P(e) {
67
+ let r;
68
+ try {
69
+ r = new URL(e.baseUrl);
70
+ } catch {
71
+ throw new c(0, "transport_policy_denied");
72
+ }
73
+ if (e.baseUrl !== r.origin || r.protocol !== "http:")
74
+ throw new c(0, "transport_policy_denied");
75
+ const t = l(
76
+ e,
77
+ S,
78
+ "trusted",
79
+ r
63
80
  );
64
- return u(t), t;
81
+ return d(t), t;
65
82
  }
66
- function p(e, r, t = "trusted") {
83
+ function l(e, r, t = "trusted", o = j(e.baseUrl, e.allowLoopbackHTTP === !0)) {
67
84
  if (typeof e.commitSpend != "function") throw new TypeError("commitSpend is required");
68
85
  if (typeof e.validateSpendBinding != "function")
69
86
  throw new TypeError("validateSpendBinding is required");
70
- const o = e.fetch ?? globalThis.fetch;
71
- if (typeof o != "function") throw new TypeError("fetch is required");
72
- const i = z(e.baseUrl, e.allowLoopbackHTTP === !0), c = j(i, e.entryTicket), b = {
73
- acquire: async ({ signal: d }) => {
87
+ const i = e.fetch ?? globalThis.fetch;
88
+ if (typeof i != "function") throw new TypeError("fetch is required");
89
+ const a = A(o, e.entryTicket), y = {
90
+ acquire: async ({ signal: u }) => {
74
91
  try {
75
92
  const n = {
76
93
  endpoint_id: e.endpointId,
77
94
  ...e.payload === void 0 ? {} : { payload: e.payload },
78
95
  ...e.entryTicket === void 0 && e.correlation !== void 0 ? { correlation: { trace_id: e.correlation.traceId } } : {}
79
- }, a = await o(c, {
96
+ }, s = await i(a, {
80
97
  method: "POST",
81
98
  headers: {
82
99
  accept: "application/json",
@@ -86,39 +103,39 @@ function p(e, r, t = "trusted") {
86
103
  body: JSON.stringify(n),
87
104
  credentials: "omit",
88
105
  redirect: "error",
89
- signal: d
106
+ signal: u
90
107
  });
91
- if (!a.ok) {
92
- const l = await g(a);
108
+ if (!s.ok) {
109
+ const f = await E(s);
93
110
  return { kind: "failure", ...O({
94
- status: a.status,
95
- code: l,
96
- retryAfter: a.headers.get("retry-after"),
111
+ status: s.status,
112
+ code: f,
113
+ retryAfter: s.headers.get("retry-after"),
97
114
  retryableBusinessCodes: e.retryableBusinessCodes
98
115
  }) };
99
116
  }
100
- let y;
117
+ let b;
101
118
  try {
102
- y = await a.json();
119
+ b = await s.json();
103
120
  } catch {
104
- return f("invalid_controlplane_response");
121
+ return p("invalid_controlplane_response");
105
122
  }
106
- const w = await r(b, y, {
123
+ const w = await r(y, b, {
107
124
  commitSpend: e.commitSpend,
108
- validateSpendBinding: (l) => {
125
+ validateSpendBinding: (f) => {
109
126
  try {
110
- return e.validateSpendBinding(l);
127
+ return e.validateSpendBinding(f);
111
128
  } catch {
112
- throw new m("invalid_spend_binding");
129
+ throw new h("invalid_spend_binding");
113
130
  }
114
131
  },
115
132
  expectedConsumer: t
116
133
  });
117
134
  return Object.freeze({ kind: "lease", lease: w });
118
135
  } catch (n) {
119
- if (d.aborted) throw d.reason ?? new DOMException("Aborted", "AbortError");
136
+ if (u.aborted) throw u.reason ?? new DOMException("Aborted", "AbortError");
120
137
  if (n instanceof DOMException && n.name === "AbortError") throw n;
121
- return n instanceof m || n instanceof s ? f(n.code) : Object.freeze({
138
+ return n instanceof h || n instanceof c ? p(n.code) : Object.freeze({
122
139
  kind: "failure",
123
140
  code: "network_error",
124
141
  disposition: Object.freeze({ kind: "retryable" })
@@ -126,17 +143,17 @@ function p(e, r, t = "trusted") {
126
143
  }
127
144
  }
128
145
  };
129
- return b;
146
+ return y;
130
147
  }
131
- function A(e) {
148
+ function T(e) {
132
149
  let r;
133
150
  try {
134
151
  r = new URL(e);
135
152
  } catch {
136
- throw new s(0, "transport_policy_denied");
153
+ throw new c(0, "transport_policy_denied");
137
154
  }
138
- if (e !== r.origin || r.protocol !== "http:" || r.username !== "" || r.password !== "" || !C(r.port) || !E(r.hostname))
139
- throw new s(0, "transport_policy_denied");
155
+ if (e !== r.origin || r.protocol !== "http:" || r.username !== "" || r.password !== "" || !C(r.port) || !g(r.hostname))
156
+ throw new c(0, "transport_policy_denied");
140
157
  return r;
141
158
  }
142
159
  function C(e) {
@@ -144,10 +161,10 @@ function C(e) {
144
161
  const r = Number(e);
145
162
  return Number.isSafeInteger(r) && r >= 1024 && r <= 65535;
146
163
  }
147
- function E(e) {
164
+ function g(e) {
148
165
  return e === "127.0.0.1" || e === "[::1]";
149
166
  }
150
- async function g(e) {
167
+ async function E(e) {
151
168
  try {
152
169
  const r = await e.json();
153
170
  if (r !== null && typeof r == "object" && !Array.isArray(r)) {
@@ -161,29 +178,30 @@ async function g(e) {
161
178
  }
162
179
  return "request_failed";
163
180
  }
164
- function T(e, r) {
181
+ function L(e, r) {
165
182
  if (e == null) return;
166
183
  const t = e.trim();
167
184
  if (/^\d+$/u.test(t)) {
168
185
  const i = Number(t);
169
186
  if (!Number.isSafeInteger(i)) return;
170
- const c = r + i * 1e3;
171
- return Number.isSafeInteger(c) && c > r ? c : void 0;
187
+ const a = r + i * 1e3;
188
+ return Number.isSafeInteger(a) && a > r ? a : void 0;
172
189
  }
173
190
  const o = Date.parse(t);
174
191
  return Number.isSafeInteger(o) && o > r ? o : void 0;
175
192
  }
176
- function f(e) {
193
+ function p(e) {
177
194
  return Object.freeze({
178
195
  kind: "failure",
179
- code: h.test(e) ? e : "invalid_error_code",
196
+ code: m.test(e) ? e : "invalid_error_code",
180
197
  disposition: Object.freeze({ kind: "terminal" })
181
198
  });
182
199
  }
183
200
  export {
184
- s as ControlplaneRequestError,
201
+ c as ControlplaneRequestError,
185
202
  O as classifyControlplaneFailure,
186
- L as createControlplaneArtifactSource,
203
+ U as createControlplaneArtifactSource,
204
+ P as createHTTPDirectControlplaneArtifactSource,
187
205
  I as createIsolatedControlplaneArtifactSource,
188
206
  N as createPrivateLoopbackControlplaneArtifactSource
189
207
  };
@@ -1,5 +1,5 @@
1
1
  import type { ArtifactSource } from '@floegence/flowersec-core';
2
- import type { ConnectionControllerOptions, PrivateLoopbackArtifactSourceV1, PrivateLoopbackConnectionControllerOptionsV1 } from '@floegence/flowersec-core/browser';
2
+ import type { ConnectionControllerOptions, HTTPDirectArtifactSourceV1, HTTPDirectConnectionControllerOptionsV1, PrivateLoopbackArtifactSourceV1, PrivateLoopbackConnectionControllerOptionsV1 } from '@floegence/flowersec-core/browser';
3
3
  import { type AcquisitionConnectionLifecycle } from './acquisition-lifecycle';
4
4
  import type { ConnectedAcquisition } from './acquisition';
5
5
  import type { ProxyBootstrapOwner } from './proxy-bootstrap';
@@ -10,9 +10,16 @@ export type FlowersecConnectionConfig = SharedFlowersecConnectionConfig & (Reado
10
10
  source: ArtifactSource;
11
11
  controller?: ConnectionControllerOptions;
12
12
  privateLoopback?: never;
13
+ httpDirect?: never;
13
14
  }> | Readonly<{
14
15
  source: PrivateLoopbackArtifactSourceV1;
15
16
  privateLoopback: PrivateLoopbackConnectionControllerOptionsV1;
17
+ httpDirect?: never;
18
+ controller?: never;
19
+ }> | Readonly<{
20
+ source: HTTPDirectArtifactSourceV1;
21
+ httpDirect: HTTPDirectConnectionControllerOptionsV1;
22
+ privateLoopback?: never;
16
23
  controller?: never;
17
24
  }>);
18
25
  type AcquisitionConnectionOptions = Readonly<{
@@ -27,6 +34,12 @@ export type PrivateLoopbackDirectConnectionOptions = Readonly<{
27
34
  privateLoopback: PrivateLoopbackConnectionControllerOptionsV1;
28
35
  onConnected?: (acquisition: ConnectedAcquisition) => void;
29
36
  }>;
37
+ export type HTTPDirectConnectionOptions = Readonly<{
38
+ source: HTTPDirectArtifactSourceV1;
39
+ httpDirect: HTTPDirectConnectionControllerOptionsV1;
40
+ onConnected?: (acquisition: ConnectedAcquisition) => void;
41
+ }>;
42
+ export declare function createHTTPDirectConnectionConfig(options: HTTPDirectConnectionOptions): FlowersecConnectionConfig;
30
43
  export type ProxyRuntimeTunnelConnectionOptions = AcquisitionConnectionOptions & Readonly<{
31
44
  proxyBootstrap: ProxyBootstrapOwner;
32
45
  }>;
@@ -1,35 +1,45 @@
1
- import { createAcquisitionConnectionLifecycle as r } from "./acquisition-lifecycle.js";
2
- function t(e) {
3
- return n(e);
1
+ import { createAcquisitionConnectionLifecycle as c } from "./acquisition-lifecycle.js";
2
+ function o(e) {
3
+ return Object.freeze({
4
+ source: e.source,
5
+ httpDirect: e.httpDirect,
6
+ lifecycle: c(e.source, {
7
+ ...e.onConnected === void 0 ? {} : { onConnected: e.onConnected }
8
+ })
9
+ });
4
10
  }
5
11
  function i(e) {
6
- return n(e, e.proxyBootstrap);
12
+ return n(e);
7
13
  }
8
14
  function u(e) {
9
- return n(e);
15
+ return n(e, e.proxyBootstrap);
10
16
  }
11
17
  function f(e) {
18
+ return n(e);
19
+ }
20
+ function C(e) {
12
21
  return Object.freeze({
13
22
  source: e.source,
14
23
  privateLoopback: e.privateLoopback,
15
- lifecycle: r(e.source, {
24
+ lifecycle: c(e.source, {
16
25
  ...e.onConnected === void 0 ? {} : { onConnected: e.onConnected }
17
26
  })
18
27
  });
19
28
  }
20
- function n(e, c) {
29
+ function n(e, r) {
21
30
  return Object.freeze({
22
31
  source: e.source,
23
32
  ...e.controller === void 0 ? {} : { controller: e.controller },
24
- lifecycle: r(e.source, {
25
- ...c === void 0 ? {} : { proxyBootstrap: c },
33
+ lifecycle: c(e.source, {
34
+ ...r === void 0 ? {} : { proxyBootstrap: r },
26
35
  ...e.onConnected === void 0 ? {} : { onConnected: e.onConnected }
27
36
  })
28
37
  });
29
38
  }
30
39
  export {
31
- u as createArtifactDirectConnectionConfig,
32
- t as createArtifactTunnelConnectionConfig,
33
- f as createPrivateLoopbackDirectConnectionConfig,
34
- i as createProxyRuntimeTunnelConnectionConfig
40
+ f as createArtifactDirectConnectionConfig,
41
+ i as createArtifactTunnelConnectionConfig,
42
+ o as createHTTPDirectConnectionConfig,
43
+ C as createPrivateLoopbackDirectConnectionConfig,
44
+ u as createProxyRuntimeTunnelConnectionConfig
35
45
  };
package/dist/index.d.ts CHANGED
@@ -3,15 +3,15 @@ export type { WaitForMessageOptions } from './messaging';
3
3
  export { postMessageToOrigins, waitForMessage } from './messaging';
4
4
  export { getSessionStorage, removeSessionStorage, setSessionStorage } from './storage';
5
5
  export type { ArtifactSource, ArtifactSourceResult } from '@floegence/flowersec-core';
6
- export { createControlplaneArtifactSource, createIsolatedControlplaneArtifactSource, createPrivateLoopbackControlplaneArtifactSource, ControlplaneRequestError, } from './artifact-source';
6
+ export { createControlplaneArtifactSource, createHTTPDirectControlplaneArtifactSource, createIsolatedControlplaneArtifactSource, createPrivateLoopbackControlplaneArtifactSource, ControlplaneRequestError, } from './artifact-source';
7
7
  export { classifyControlplaneFailure } from './artifact-source';
8
- export type { ClassifiedControlplaneFailure, ControlplaneArtifactSourceOptions, ControlplaneFailureInput, PrivateLoopbackControlplaneArtifactSourceOptions, } from './artifact-source';
9
- export { AcquisitionError, clearAcquisitionSource, connectIsolatedOneShot, ConnectedAcquisition, IsolatedOneShotAcquisition, materializePrivateLoopbackAcquisitionForSource, materializeIsolatedOneShot, synchronizeAcquisitionSourceSnapshot, } from './acquisition';
8
+ export type { ClassifiedControlplaneFailure, ControlplaneArtifactSourceOptions, HTTPDirectControlplaneArtifactSourceOptions, ControlplaneFailureInput, PrivateLoopbackControlplaneArtifactSourceOptions, } from './artifact-source';
9
+ export { AcquisitionError, clearAcquisitionSource, connectIsolatedOneShot, ConnectedAcquisition, IsolatedOneShotAcquisition, materializePrivateLoopbackAcquisitionForSource, materializeHTTPDirectAcquisitionForSource, materializeIsolatedOneShot, synchronizeAcquisitionSourceSnapshot, } from './acquisition';
10
10
  export type { CommitSpend, CriticalScopeProjectionV1, IsolatedHandoffValidationContext, MaterializeIsolatedOneShotOptions, RuntimeBootInitPayloadV6, SerializedAcquisitionEnvelopeV1, SpendBindingView, SpendCommitRequest, SpendScopeV1, ValidateSpendBinding, } from './acquisition';
11
11
  export { createAcquisitionConnectionLifecycle } from './acquisition-lifecycle';
12
12
  export type { AcquisitionConnectionLifecycle, AcquisitionConnectionLifecycleOptions, } from './acquisition-lifecycle';
13
- export type { DirectArtifactConnectionOptions, FlowersecConnectionConfig, PrivateLoopbackDirectConnectionOptions, ProxyRuntimeTunnelConnectionOptions, TunnelArtifactConnectionOptions, } from './connection';
14
- export { createArtifactDirectConnectionConfig, createArtifactTunnelConnectionConfig, createPrivateLoopbackDirectConnectionConfig, createProxyRuntimeTunnelConnectionConfig, } from './connection';
13
+ export type { DirectArtifactConnectionOptions, HTTPDirectConnectionOptions, FlowersecConnectionConfig, PrivateLoopbackDirectConnectionOptions, ProxyRuntimeTunnelConnectionOptions, TunnelArtifactConnectionOptions, } from './connection';
14
+ export { createArtifactDirectConnectionConfig, createHTTPDirectConnectionConfig, createArtifactTunnelConnectionConfig, createPrivateLoopbackDirectConnectionConfig, createProxyRuntimeTunnelConnectionConfig, } from './connection';
15
15
  export type { FetchServerSentEventsOptions, ServerSentEvent, ServerSentEventStreamErrorCode, } from './server-sent-events';
16
16
  export { fetchServerSentEvents, ServerSentEventStreamError } from './server-sent-events';
17
17
  export { closeProxyBootstrap, createProxyBootstrapOwner, ProxyBootstrapOwner, synchronizeProxyBootstrap, } from './proxy-bootstrap';
package/dist/index.js CHANGED
@@ -1,42 +1,45 @@
1
1
  import { clearLocationHash as r, parseHashParam as t } from "./hash.js";
2
2
  import { postMessageToOrigins as i, waitForMessage as a } from "./messaging.js";
3
3
  import { getSessionStorage as s, removeSessionStorage as l, setSessionStorage as p } from "./storage.js";
4
- import { ControlplaneRequestError as S, classifyControlplaneFailure as u, createControlplaneArtifactSource as m, createIsolatedControlplaneArtifactSource as C, createPrivateLoopbackControlplaneArtifactSource as x } from "./artifact-source.js";
5
- import { AcquisitionError as g, ConnectedAcquisition as h, IsolatedOneShotAcquisition as y, clearAcquisitionSource as P, connectIsolatedOneShot as q, materializeIsolatedOneShot as v, materializePrivateLoopbackAcquisitionForSource as O, synchronizeAcquisitionSourceSnapshot as d } from "./acquisition.js";
6
- import { createAcquisitionConnectionLifecycle as L } from "./acquisition-lifecycle.js";
7
- import { createArtifactDirectConnectionConfig as B, createArtifactTunnelConnectionConfig as I, createPrivateLoopbackDirectConnectionConfig as b, createProxyRuntimeTunnelConnectionConfig as k } from "./connection.js";
8
- import { ServerSentEventStreamError as F, fetchServerSentEvents as T } from "./server-sent-events.js";
9
- import { ProxyBootstrapOwner as H, closeProxyBootstrap as M, createProxyBootstrapOwner as R, synchronizeProxyBootstrap as j } from "./proxy-bootstrap.js";
4
+ import { ControlplaneRequestError as S, classifyControlplaneFailure as u, createControlplaneArtifactSource as C, createHTTPDirectControlplaneArtifactSource as m, createIsolatedControlplaneArtifactSource as x, createPrivateLoopbackControlplaneArtifactSource as A } from "./artifact-source.js";
5
+ import { AcquisitionError as P, ConnectedAcquisition as h, IsolatedOneShotAcquisition as q, clearAcquisitionSource as y, connectIsolatedOneShot as T, materializeHTTPDirectAcquisitionForSource as v, materializeIsolatedOneShot as O, materializePrivateLoopbackAcquisitionForSource as d, synchronizeAcquisitionSourceSnapshot as z } from "./acquisition.js";
6
+ import { createAcquisitionConnectionLifecycle as E } from "./acquisition-lifecycle.js";
7
+ import { createArtifactDirectConnectionConfig as L, createArtifactTunnelConnectionConfig as B, createHTTPDirectConnectionConfig as F, createPrivateLoopbackDirectConnectionConfig as I, createProxyRuntimeTunnelConnectionConfig as b } from "./connection.js";
8
+ import { ServerSentEventStreamError as w, fetchServerSentEvents as M } from "./server-sent-events.js";
9
+ import { ProxyBootstrapOwner as j, closeProxyBootstrap as G, createProxyBootstrapOwner as J, synchronizeProxyBootstrap as K } from "./proxy-bootstrap.js";
10
10
  export {
11
- g as AcquisitionError,
11
+ P as AcquisitionError,
12
12
  h as ConnectedAcquisition,
13
13
  S as ControlplaneRequestError,
14
- y as IsolatedOneShotAcquisition,
15
- H as ProxyBootstrapOwner,
16
- F as ServerSentEventStreamError,
14
+ q as IsolatedOneShotAcquisition,
15
+ j as ProxyBootstrapOwner,
16
+ w as ServerSentEventStreamError,
17
17
  u as classifyControlplaneFailure,
18
- P as clearAcquisitionSource,
18
+ y as clearAcquisitionSource,
19
19
  r as clearLocationHash,
20
- M as closeProxyBootstrap,
21
- q as connectIsolatedOneShot,
22
- L as createAcquisitionConnectionLifecycle,
23
- B as createArtifactDirectConnectionConfig,
24
- I as createArtifactTunnelConnectionConfig,
25
- m as createControlplaneArtifactSource,
26
- C as createIsolatedControlplaneArtifactSource,
27
- x as createPrivateLoopbackControlplaneArtifactSource,
28
- b as createPrivateLoopbackDirectConnectionConfig,
29
- R as createProxyBootstrapOwner,
30
- k as createProxyRuntimeTunnelConnectionConfig,
31
- T as fetchServerSentEvents,
20
+ G as closeProxyBootstrap,
21
+ T as connectIsolatedOneShot,
22
+ E as createAcquisitionConnectionLifecycle,
23
+ L as createArtifactDirectConnectionConfig,
24
+ B as createArtifactTunnelConnectionConfig,
25
+ C as createControlplaneArtifactSource,
26
+ F as createHTTPDirectConnectionConfig,
27
+ m as createHTTPDirectControlplaneArtifactSource,
28
+ x as createIsolatedControlplaneArtifactSource,
29
+ A as createPrivateLoopbackControlplaneArtifactSource,
30
+ I as createPrivateLoopbackDirectConnectionConfig,
31
+ J as createProxyBootstrapOwner,
32
+ b as createProxyRuntimeTunnelConnectionConfig,
33
+ M as fetchServerSentEvents,
32
34
  s as getSessionStorage,
33
- v as materializeIsolatedOneShot,
34
- O as materializePrivateLoopbackAcquisitionForSource,
35
+ v as materializeHTTPDirectAcquisitionForSource,
36
+ O as materializeIsolatedOneShot,
37
+ d as materializePrivateLoopbackAcquisitionForSource,
35
38
  t as parseHashParam,
36
39
  i as postMessageToOrigins,
37
40
  l as removeSessionStorage,
38
41
  p as setSessionStorage,
39
- d as synchronizeAcquisitionSourceSnapshot,
40
- j as synchronizeProxyBootstrap,
42
+ z as synchronizeAcquisitionSourceSnapshot,
43
+ K as synchronizeProxyBootstrap,
41
44
  a as waitForMessage
42
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-boot",
3
- "version": "0.52.13",
3
+ "version": "0.53.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -35,7 +35,8 @@
35
35
  "clean": "rm -rf dist *.tsbuildinfo"
36
36
  },
37
37
  "dependencies": {
38
- "@floegence/flowersec-core": "5.1.0"
38
+ "@floegence/flowersec-core": "5.2.0",
39
+ "@noble/hashes": "2.4.0"
39
40
  },
40
41
  "devDependencies": {
41
42
  "typescript": "^5.9.3",