@almadar/shell-runtime 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-57SBCUSM.js +62 -0
- package/dist/chunk-625EP7W2.js +108 -0
- package/dist/{chunk-NATGCIVM.js → chunk-7WB6VWRK.js} +344 -129
- package/dist/{chunk-Q2H75UYT.js → chunk-A2JJT4GA.js} +1 -37
- package/dist/chunk-BAS26HBN.js +10 -0
- package/dist/{chunk-REPX5QPI.js → chunk-BOVU4TCQ.js} +11 -3
- package/dist/chunk-BY5G4225.js +6 -0
- package/dist/chunk-DFDNHVDW.js +284 -0
- package/dist/chunk-I3TKINSO.js +398 -0
- package/dist/{chunk-DYOJGLIX.js → chunk-LKWYCYX5.js} +2 -5
- package/dist/chunk-LYFIQPXX.js +1 -0
- package/dist/{chunk-VNMG7NKY.js → chunk-MU335ZA4.js} +20 -26
- package/dist/{chunk-ODJCZ27I.js → chunk-N7HYNKK6.js} +35 -2
- package/dist/{chunk-4J2QEIUV.js → chunk-NTFQ36UN.js} +4 -30
- package/dist/chunk-NU6LVKGS.js +15 -0
- package/dist/chunk-P2N6K2IV.js +20 -0
- package/dist/{chunk-QQRDUMB2.js → chunk-QCJWPXLH.js} +11 -11
- package/dist/{chunk-QELZ6TEJ.js → chunk-UD2CXYSJ.js} +39 -3
- package/dist/{chunk-UJHOUZAL.js → chunk-V4EMDPCO.js} +2 -5
- package/dist/chunk-VNGXRYFF.js +9 -0
- package/dist/{chunk-HNOAZWFH.js → chunk-WGCWJOT2.js} +2 -0
- package/dist/chunk-X6W44WHO.js +26 -0
- package/dist/chunk-ZUSM4VW4.js +197 -0
- package/dist/client/EventTransport.d.ts +23 -7
- package/dist/client/EventTransport.js +1 -2
- package/dist/client/awaiting.js +0 -1
- package/dist/client/channel-transport.d.ts +6 -6
- package/dist/client/channel-transport.js +0 -1
- package/dist/client/circuit-store.d.ts +16 -5
- package/dist/client/circuit-store.js +2 -3
- package/dist/client/client-kernel.d.ts +36 -15
- package/dist/client/declared-input-dispatch.d.ts +19 -2
- package/dist/client/declared-input-dispatch.js +1 -2
- package/dist/client/inbound-dispatch.d.ts +21 -2
- package/dist/client/inbound-dispatch.js +1 -2
- package/dist/client/local-fold.d.ts +15 -8
- package/dist/client/local-fold.js +1 -2
- package/dist/client/render-sigils.js +0 -1
- package/dist/client/state-book.d.ts +9 -16
- package/dist/client/state-book.js +1 -2
- package/dist/client/trait-mount-error.js +0 -1
- package/dist/credentials/env-vars.d.ts +5 -1
- package/dist/credentials/env-vars.js +1 -3
- package/dist/credentials/scope.d.ts +8 -7
- package/dist/credentials/scope.js +0 -1
- package/dist/credentials/vault.d.ts +142 -0
- package/dist/credentials/vault.js +1 -0
- package/dist/effects/in-flight-calls.js +0 -1
- package/dist/effects/on-device-model.js +0 -1
- package/dist/events/EventBus.d.ts +1 -4
- package/dist/events/EventBus.js +0 -1
- package/dist/events/emit-stamp.js +0 -1
- package/dist/index.d.ts +25 -42
- package/dist/index.js +27 -45
- package/dist/kernel/decode.d.ts +8 -10
- package/dist/kernel/decode.js +1 -2
- package/dist/kernel/engine.d.ts +132 -31
- package/dist/kernel/engine.js +7 -9
- package/dist/kernel/frame-applier.d.ts +8 -7
- package/dist/kernel/frame-applier.js +1 -2
- package/dist/kernel/host.d.ts +127 -16
- package/dist/kernel/host.js +4 -7
- package/dist/kernel/lane.d.ts +1 -22
- package/dist/kernel/lane.js +1 -2
- package/dist/kernel/os-fetch-port.d.ts +7 -0
- package/dist/kernel/os-fetch-port.js +3 -0
- package/dist/kernel/os-port.d.ts +30 -8
- package/dist/kernel/os-port.js +1 -2
- package/dist/kernel/program-effects.d.ts +11 -28
- package/dist/kernel/program-effects.js +1 -2
- package/dist/kernel/secret-ports.d.ts +139 -0
- package/dist/kernel/secret-ports.js +2 -0
- package/dist/kernel/wire.d.ts +50 -12
- package/dist/loader/fetch-loader.d.ts +26 -0
- package/dist/loader/fetch-loader.js +1 -0
- package/dist/loader/lazy-page.js +0 -1
- package/dist/loader/schema-loader.d.ts +1 -17
- package/dist/persistence/native-memory.js +0 -1
- package/dist/runtime/entities/declaredCollections.d.ts +6 -0
- package/dist/runtime/entities/declaredCollections.js +1 -0
- package/dist/runtime/evaluation/local-store-transport.d.ts +14 -23
- package/dist/runtime/evaluation/local-store-transport.js +9 -13
- package/dist/runtime/evaluation/residence-transport.d.ts +3 -3
- package/dist/runtime/evaluation/residence-transport.js +1 -2
- package/dist/runtime/evaluation/routed-persistence.js +0 -1
- package/dist/runtime/events/identity/routing.d.ts +2 -53
- package/dist/runtime/events/identity/routing.js +1 -2
- package/dist/runtime/types.d.ts +5 -205
- package/dist/runtime/types.js +1 -2
- package/dist/service/default-call-service.js +0 -1
- package/dist/service/service-provider.js +0 -1
- package/package.json +8 -5
- package/dist/chunk-2JU7Y4KU.js +0 -21
- package/dist/chunk-46RWK2B5.js +0 -28
- package/dist/chunk-4ZICQ5PM.js +0 -192
- package/dist/chunk-53IPZXDP.js +0 -76
- package/dist/chunk-5D63EMO5.js +0 -16
- package/dist/chunk-CPSQXEJ6.js +0 -55
- package/dist/chunk-CQP5XAX6.js +0 -173
- package/dist/chunk-CROS2GEX.js +0 -49
- package/dist/chunk-D4XJTBLB.js +0 -217
- package/dist/chunk-D5USD2EX.js +0 -232
- package/dist/chunk-EV56K4GB.js +0 -63
- package/dist/chunk-FQ6IZMIU.js +0 -10
- package/dist/chunk-HMK6YMQS.js +0 -135
- package/dist/chunk-IHQLE5M7.js +0 -62
- package/dist/chunk-JFWFDUTR.js +0 -35
- package/dist/chunk-MHYSHSRG.js +0 -54
- package/dist/chunk-MLKGABMK.js +0 -7
- package/dist/chunk-NAECVIAR.js +0 -322
- package/dist/chunk-Q7JK4KY7.js +0 -9
- package/dist/chunk-RBUMDYFS.js +0 -681
- package/dist/chunk-SAS5KKCR.js +0 -43
- package/dist/chunk-SWPDU752.js +0 -28
- package/dist/chunk-T775TUCD.js +0 -18
- package/dist/chunk-VMOBW7RK.js +0 -21
- package/dist/chunk-WNPNNYXY.js +0 -22
- package/dist/chunk-XB5GYODW.js +0 -28
- package/dist/chunk-YL2SO5TP.js +0 -334
- package/dist/chunk-YO4LWS3I.js +0 -606
- package/dist/chunk-ZAQSS47X.js +0 -157
- package/dist/chunk-ZCQUUJIF.js +0 -129
- package/dist/client/ServerBridge.d.ts +0 -126
- package/dist/client/ServerBridge.js +0 -3
- package/dist/credentials/seed.d.ts +0 -21
- package/dist/credentials/seed.js +0 -2
- package/dist/credentials/store.d.ts +0 -110
- package/dist/credentials/store.js +0 -2
- package/dist/index-hT1xCdTq.d.ts +0 -46
- package/dist/kernel/beacon.d.ts +0 -32
- package/dist/kernel/beacon.js +0 -2
- package/dist/kernel/http.d.ts +0 -302
- package/dist/kernel/http.js +0 -6
- package/dist/kernel/oauth-effects.d.ts +0 -25
- package/dist/kernel/oauth-effects.js +0 -7
- package/dist/kernel/oauth-port.d.ts +0 -31
- package/dist/kernel/oauth-port.js +0 -2
- package/dist/loader/http-loader.d.ts +0 -111
- package/dist/loader/http-loader.js +0 -2
- package/dist/runtime/effects/composition/compose-behaviors.d.ts +0 -58
- package/dist/runtime/effects/composition/compose-behaviors.js +0 -4
- package/dist/runtime/effects/composition/event-wiring.d.ts +0 -38
- package/dist/runtime/effects/composition/event-wiring.js +0 -2
- package/dist/runtime/effects/composition/index.d.ts +0 -5
- package/dist/runtime/effects/composition/index.js +0 -6
- package/dist/runtime/effects/composition/layout-strategy.d.ts +0 -35
- package/dist/runtime/effects/composition/layout-strategy.js +0 -2
- package/dist/runtime/effects/composition/pipe.d.ts +0 -25
- package/dist/runtime/effects/composition/pipe.js +0 -2
- package/dist/runtime/entities/mockStoreSeed.d.ts +0 -56
- package/dist/runtime/entities/mockStoreSeed.js +0 -3
- package/dist/runtime/entities/seedBrowserStore.d.ts +0 -28
- package/dist/runtime/entities/seedBrowserStore.js +0 -2
- package/dist/runtime/entities/std-mock-seed.d.ts +0 -87
- package/dist/runtime/entities/std-mock-seed.js +0 -2
- package/dist/runtime/time/TickScheduler.d.ts +0 -77
- package/dist/runtime/time/TickScheduler.js +0 -3
- package/dist/runtime/time/cron.d.ts +0 -25
- package/dist/runtime/time/cron.js +0 -2
- package/dist/runtime/time/duration.d.ts +0 -20
- package/dist/runtime/time/duration.js +0 -2
- package/dist/runtime/traits/OrbitalTraitParsing.d.ts +0 -34
- package/dist/runtime/traits/OrbitalTraitParsing.js +0 -2
- package/dist/runtime/traits/listen-targets.d.ts +0 -16
- package/dist/runtime/traits/listen-targets.js +0 -3
- package/dist/runtime/traits/trait-index.d.ts +0 -35
- package/dist/runtime/traits/trait-index.js +0 -3
package/dist/kernel/host.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { PageFactField, BrowserPageFacts, PersistenceAdapter, ServiceParams, EventPayload, JsonValue, UserContext, ServiceHostPorts, OnDeviceModelPorts, BrowserTabPort, EventStreamItem } from '@almadar/core';
|
|
1
|
+
import { PageFactField, BrowserPageFacts, PersistenceAdapter, ServiceParams, EventPayload, JsonValue, UserContext, ServiceHostPorts, OnDeviceModelPorts, BrowserTabPort, JsonObject, EventStreamItem, HostAskCompletion } from '@almadar/core';
|
|
2
2
|
import { InFlightCalls } from '../effects/in-flight-calls.js';
|
|
3
3
|
import { ServiceCallContext } from '../service/service-provider.js';
|
|
4
4
|
import { ProgramEffectName, ProgramEffectOutcome } from './program-effects.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import './
|
|
9
|
-
import '../credentials/
|
|
10
|
-
import './decode.js';
|
|
5
|
+
import { SecretPorts } from './secret-ports.js';
|
|
6
|
+
import { Settled, EventRequest, CallSiteWire, SubstrateFailureWire, IoRequestWire, IoAnswerWire, OsError } from '@almadar/core/kernel-wire';
|
|
7
|
+
import { KernelModule } from './wire.js';
|
|
8
|
+
import { OsHostPort, OsCompletionPort, OsTlsPort, OsCompletionEvent } from './os-port.js';
|
|
9
|
+
import '../credentials/vault.js';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* The host half of the kernel path: the I/O the kernel asks for, answered with the runtime's own
|
|
@@ -26,13 +25,90 @@ interface DeferredCallOutcome {
|
|
|
26
25
|
payload: EventPayload | undefined;
|
|
27
26
|
entityId: string | undefined;
|
|
28
27
|
originClientId: string | undefined;
|
|
29
|
-
user: UserContext | undefined;
|
|
30
28
|
locale: string | undefined;
|
|
31
29
|
}
|
|
32
30
|
interface SubstrateStreamSource {
|
|
33
31
|
subscribe(message: (value: JsonValue) => void, ended: () => void): () => void;
|
|
34
32
|
}
|
|
33
|
+
/** The `audio/*` asks: a sound or music key, absent where the op names none (stop every sound, stop the music). */
|
|
34
|
+
type HostAudioAsk = {
|
|
35
|
+
op: 'audio/play-sound';
|
|
36
|
+
key: string;
|
|
37
|
+
} | {
|
|
38
|
+
op: 'audio/stop-sound';
|
|
39
|
+
key: string | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
op: 'audio/change-music';
|
|
42
|
+
key: string | undefined;
|
|
43
|
+
} | {
|
|
44
|
+
op: 'audio/stop-music';
|
|
45
|
+
};
|
|
46
|
+
/** The one object `auth/sign-in` takes: the method and the credentials it needs. */
|
|
47
|
+
type HostSignInRequest = {
|
|
48
|
+
method: 'google';
|
|
49
|
+
} | {
|
|
50
|
+
method: 'email';
|
|
51
|
+
email: string;
|
|
52
|
+
password: string;
|
|
53
|
+
} | {
|
|
54
|
+
method: 'emailLink';
|
|
55
|
+
email: string;
|
|
56
|
+
continueUrl: string;
|
|
57
|
+
} | {
|
|
58
|
+
method: 'emailLink';
|
|
59
|
+
email: string;
|
|
60
|
+
link: string;
|
|
61
|
+
} | {
|
|
62
|
+
method: 'customToken';
|
|
63
|
+
token: string;
|
|
64
|
+
};
|
|
65
|
+
/** What a sign-in answers: the viewer, or `{ sent: true }` for an email link that was only sent. */
|
|
66
|
+
type HostSignInAnswer = {
|
|
67
|
+
uid: string;
|
|
68
|
+
email?: string;
|
|
69
|
+
displayName?: string;
|
|
70
|
+
} | {
|
|
71
|
+
sent: true;
|
|
72
|
+
};
|
|
73
|
+
/** The one object `auth/consent` takes: the authorize URL the viewer is sent to. */
|
|
74
|
+
interface HostConsentRequest {
|
|
75
|
+
authorizeUrl: string;
|
|
76
|
+
}
|
|
77
|
+
/** What a consent answers: the `code` and `state` query params of the final redirect URL, read as they are. */
|
|
78
|
+
interface HostConsentAnswer {
|
|
79
|
+
code: string;
|
|
80
|
+
state: string;
|
|
81
|
+
}
|
|
82
|
+
/** Why a host ask failed: the viewer closed it, the provider denied it, the request was malformed, or the host has no such action. */
|
|
83
|
+
type HostAskFailureKind = 'cancelled' | 'denied' | 'invalid' | 'unavailable';
|
|
84
|
+
/** A host action's own failure, carrying the kind the completion reports. */
|
|
85
|
+
declare class HostAskError extends Error {
|
|
86
|
+
readonly kind: HostAskFailureKind;
|
|
87
|
+
constructor(kind: HostAskFailureKind, message: string);
|
|
88
|
+
}
|
|
89
|
+
/** What the client host does for the `audio/*`, `auth/sign-out`, `auth/sign-in` and `auth/consent` asks; a host that has none refuses them by name. */
|
|
90
|
+
interface KernelHostActions {
|
|
91
|
+
audio?: (ask: HostAudioAsk) => void;
|
|
92
|
+
signOut?: () => void | Promise<void>;
|
|
93
|
+
signIn?: (request: HostSignInRequest) => Promise<HostSignInAnswer>;
|
|
94
|
+
consent?: (request: HostConsentRequest) => Promise<HostConsentAnswer>;
|
|
95
|
+
}
|
|
96
|
+
/** A host ask's answer: the payload of its success route, or the error and kind of its failure route. */
|
|
97
|
+
type HostAskOutcome = {
|
|
98
|
+
ok: JsonObject;
|
|
99
|
+
} | {
|
|
100
|
+
error: string;
|
|
101
|
+
kind: HostAskFailureKind;
|
|
102
|
+
};
|
|
103
|
+
/** The event a host's answer dispatches: to `trait` (on `entityId` when the frame is a row), carrying `payload`. */
|
|
104
|
+
interface HostAskReturn {
|
|
105
|
+
trait: string;
|
|
106
|
+
entityId?: string;
|
|
107
|
+
event: string;
|
|
108
|
+
payload: JsonObject;
|
|
109
|
+
}
|
|
35
110
|
interface KernelHostPorts {
|
|
111
|
+
hostActions?: KernelHostActions;
|
|
36
112
|
pageFacts?: (fields: readonly PageFactField[]) => BrowserPageFacts;
|
|
37
113
|
persistence: PersistenceAdapter;
|
|
38
114
|
callService: KernelCallService;
|
|
@@ -52,8 +128,8 @@ interface KernelHostPorts {
|
|
|
52
128
|
}, payload: EventPayload, originClientId: string | undefined) => void;
|
|
53
129
|
/** Read per call: the sink a follow-on call's outcome runs through, absent when the host cannot deliver it to the tab. */
|
|
54
130
|
deferCallOutcome: () => ((call: DeferredCallOutcome) => void) | undefined;
|
|
55
|
-
/** The
|
|
56
|
-
|
|
131
|
+
/** The secret store, CSPRNG and credential administration ports the kernel's secret, random and credential asks use. */
|
|
132
|
+
secretPorts?: SecretPorts;
|
|
57
133
|
/** The on-device model and embedder; absent, a `browser/prompt` or `browser/embed` ask fails `unconfigured`. */
|
|
58
134
|
onDevice?: OnDeviceModelPorts;
|
|
59
135
|
/** The browser's tabs for the `browser/tab-*` effects; absent, a tab ask fails `unavailable`. */
|
|
@@ -62,6 +138,10 @@ interface KernelHostPorts {
|
|
|
62
138
|
os?: OsHostPort;
|
|
63
139
|
/** What the kernel decides about a deferred `os` call (which ops defer, the event an outcome fires); absent, every `os` ask is answered in place. */
|
|
64
140
|
osCompletions?: OsCompletionPort;
|
|
141
|
+
/** The kernel's TLS state for sockets it owns (EXEC-HTTP-7); absent, a deferred outcome reaches its route as the host gave it. */
|
|
142
|
+
osTls?: OsTlsPort;
|
|
143
|
+
/** The kernel's typed parse of a `program/dispatch` event request; absent, that ask is refused. */
|
|
144
|
+
parseEventRequest?: EventRequestParser;
|
|
65
145
|
substrateStream?: (op: string, args: readonly JsonValue[], scope: KernelAnswerScope) => SubstrateStreamSource | undefined;
|
|
66
146
|
substrateMessage?: (site: CallSiteWire, key: string, value: JsonValue) => OsCompletionEvent | null;
|
|
67
147
|
substrateCompletion?: (site: CallSiteWire, key: string, op: string, args: readonly JsonValue[], outcome: Settled<JsonValue, SubstrateFailureWire>) => OsCompletionEvent | null;
|
|
@@ -72,17 +152,48 @@ interface KernelHostPorts {
|
|
|
72
152
|
interface KernelAnswerScope {
|
|
73
153
|
/** The orbital the request is addressed to. */
|
|
74
154
|
orbital: string;
|
|
75
|
-
/** The viewer the dispatch runs as; a substrate operator is called as them. */
|
|
76
|
-
user?: UserContext;
|
|
77
155
|
/** The requesting tab. */
|
|
78
156
|
originClientId?: string;
|
|
79
157
|
locale?: string;
|
|
80
158
|
entityId?: string;
|
|
81
|
-
/** Runs `work` with the host's event queue released (a service call must not hold the next event). */
|
|
82
|
-
outsideEventQueue?: <T>(work: () => Promise<T>) => Promise<T>;
|
|
83
159
|
onStream?: (item: EventStreamItem) => void;
|
|
84
160
|
assertReentry?: () => void;
|
|
85
161
|
}
|
|
162
|
+
/** The kernel's typed parse of a `program/dispatch` event request: the request, or the reason it is none. */
|
|
163
|
+
type EventRequestParser = (payload: JsonObject, options: JsonObject) => Settled<EventRequest, string>;
|
|
164
|
+
/** The request parser over the kernel module: `EventRequest::from_dispatch`, not copied. */
|
|
165
|
+
declare function kernelEventRequestParser(kernel: Pick<KernelModule, 'parseEventRequest'>): EventRequestParser;
|
|
166
|
+
/** `audio/*` and `auth/sign-out`: one ask each, performed by the host's actions; a host without them refuses by name. */
|
|
167
|
+
declare function performHostAsk(actions: KernelHostActions | undefined, op: string, args: readonly JsonValue[]): Promise<Settled<null, string>>;
|
|
168
|
+
/** The `auth/sign-in` request an ask carries, or why it is refused before the host is asked. */
|
|
169
|
+
declare function parseSignInRequest(args: readonly JsonValue[]): {
|
|
170
|
+
request: HostSignInRequest;
|
|
171
|
+
} | {
|
|
172
|
+
error: string;
|
|
173
|
+
};
|
|
174
|
+
/** The `auth/consent` request an ask carries, or why it is refused before the host is asked. */
|
|
175
|
+
declare function parseConsentRequest(args: readonly JsonValue[]): {
|
|
176
|
+
request: HostConsentRequest;
|
|
177
|
+
} | {
|
|
178
|
+
error: string;
|
|
179
|
+
};
|
|
180
|
+
/** The `code` and `state` query params of a consent's final redirect URL, read as they are; a redirect without both is a denial. */
|
|
181
|
+
declare function consentFromRedirect(redirectUrl: string): HostConsentAnswer;
|
|
182
|
+
/** The answer of one host ask whose completion the host returns: `auth/sign-in` through the host's sign-in, `auth/consent` through its consent, any other op as it is performed (an empty success). */
|
|
183
|
+
declare function performHostAnswer(actions: KernelHostActions | undefined, op: string, args: readonly JsonValue[]): Promise<HostAskOutcome>;
|
|
184
|
+
/** The event `outcome` fires on the ask's declared route, or undefined when the ask declared none for it (nothing fires). */
|
|
185
|
+
declare function hostAskReturn(completion: HostAskCompletion, outcome: HostAskOutcome): HostAskReturn | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* A deferred raw `os` outcome that belongs to a TLS operation the kernel parked (EXEC-HTTP-7) is finished in the kernel:
|
|
188
|
+
* it decrypts or encrypts the raw outcome and, while it needs more raw bytes, asks the host's `os` port for them. Any
|
|
189
|
+
* other key's outcome is returned as it stands.
|
|
190
|
+
*/
|
|
191
|
+
declare function finishTls(ports: KernelHostPorts, os: OsHostPort, key: string, raw: Settled<JsonValue, OsError>): Promise<Settled<JsonValue, OsError>>;
|
|
192
|
+
/**
|
|
193
|
+
* The same loop, handing the outcome to `finish` in the calling turn whenever the kernel needs no further raw ask
|
|
194
|
+
* (nothing parked, or done at once); only a parked operation's follow-up ask makes it wait (EXEC-QUEUE-10/13).
|
|
195
|
+
*/
|
|
196
|
+
declare function completeTls(ports: KernelHostPorts, os: OsHostPort, key: string, raw: Settled<JsonValue, OsError>, finish: (outcome: Settled<JsonValue, OsError>) => void): void;
|
|
86
197
|
declare function writeRows(persistence: PersistenceAdapter, request: Extract<IoRequestWire, {
|
|
87
198
|
kind: 'writeRows';
|
|
88
199
|
}>): Promise<IoAnswerWire>;
|
|
@@ -91,5 +202,5 @@ declare function declareCapabilities(persistence: PersistenceAdapter, declare: (
|
|
|
91
202
|
/** Answer one request of the kernel; a thrown adapter error becomes the request's declared failure. */
|
|
92
203
|
declare function answerRequest(ports: KernelHostPorts, request: IoRequestWire, scope: KernelAnswerScope): Promise<IoAnswerWire>;
|
|
93
204
|
|
|
94
|
-
export { answerRequest, declareCapabilities, writeRows };
|
|
95
|
-
export type { DeferredCallOutcome, KernelAnswerScope, KernelCallService, KernelHostPorts, SubstrateStreamSource };
|
|
205
|
+
export { HostAskError, answerRequest, completeTls, consentFromRedirect, declareCapabilities, finishTls, hostAskReturn, kernelEventRequestParser, parseConsentRequest, parseSignInRequest, performHostAnswer, performHostAsk, writeRows };
|
|
206
|
+
export type { DeferredCallOutcome, EventRequestParser, HostAskFailureKind, HostAskOutcome, HostAskReturn, HostAudioAsk, HostConsentAnswer, HostConsentRequest, HostSignInAnswer, HostSignInRequest, KernelAnswerScope, KernelCallService, KernelHostActions, KernelHostPorts, SubstrateStreamSource };
|
package/dist/kernel/host.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
export { answerRequest, declareCapabilities, writeRows } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-MZKIL5IN.js';
|
|
1
|
+
export { HostAskError, answerRequest, completeTls, consentFromRedirect, declareCapabilities, finishTls, hostAskReturn, kernelEventRequestParser, parseConsentRequest, parseSignInRequest, performHostAnswer, performHostAsk, writeRows } from '../chunk-7WB6VWRK.js';
|
|
2
|
+
import '../chunk-WGCWJOT2.js';
|
|
3
|
+
import '../chunk-ZUSM4VW4.js';
|
|
5
4
|
import '../chunk-FWA5K7Q2.js';
|
|
6
|
-
import '../chunk-VMOBW7RK.js';
|
|
7
|
-
import '../chunk-RBUMDYFS.js';
|
|
8
5
|
import '../chunk-HLOUDLPI.js';
|
|
9
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-MZKIL5IN.js';
|
package/dist/kernel/lane.d.ts
CHANGED
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
interface LaneTurn {
|
|
2
|
-
readonly ticket: number;
|
|
3
|
-
}
|
|
4
1
|
declare class LaneHeldByParkedDispatch extends Error {
|
|
5
2
|
readonly ticket: number;
|
|
6
3
|
readonly event: string;
|
|
7
4
|
constructor(ticket: number, event: string);
|
|
8
5
|
}
|
|
9
|
-
interface LaneGuard {
|
|
10
|
-
readonly turn: LaneTurn;
|
|
11
|
-
park(event: string): void;
|
|
12
|
-
resume(): void;
|
|
13
|
-
release(): void;
|
|
14
|
-
}
|
|
15
|
-
declare class DispatchLane {
|
|
16
|
-
private nextTicket;
|
|
17
|
-
private holder;
|
|
18
|
-
private depth;
|
|
19
|
-
private parkedEvent;
|
|
20
|
-
private readonly waiters;
|
|
21
|
-
assertCanReenter(turn: LaneTurn): void;
|
|
22
|
-
enter(turn?: LaneTurn): Promise<LaneGuard>;
|
|
23
|
-
private take;
|
|
24
|
-
private guard;
|
|
25
|
-
}
|
|
26
6
|
|
|
27
|
-
export {
|
|
28
|
-
export type { LaneGuard, LaneTurn };
|
|
7
|
+
export { LaneHeldByParkedDispatch };
|
package/dist/kernel/lane.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import '../chunk-MLKGABMK.js';
|
|
1
|
+
export { LaneHeldByParkedDispatch } from '../chunk-NU6LVKGS.js';
|
package/dist/kernel/os-port.d.ts
CHANGED
|
@@ -39,8 +39,8 @@ type OsRequirement = {
|
|
|
39
39
|
};
|
|
40
40
|
/** The grant decisions the wasm kernel owns (`OsGrants::allows`, the one-grant glob matcher, `is_public_address`). */
|
|
41
41
|
interface OsGrantPort {
|
|
42
|
-
/** `OsGrants::allows` over the grants
|
|
43
|
-
allows(need: OsRequirement): boolean;
|
|
42
|
+
/** `OsGrants::allows` over the grants of `orbital` (its own plus the app level); with no orbital, the app level alone. */
|
|
43
|
+
allows(need: OsRequirement, orbital?: string): boolean;
|
|
44
44
|
/** Whether the absolute `glob` (`**`, `*`, `?`) matches `path`, as a one-grant `fs_allows` for read. */
|
|
45
45
|
globMatches(glob: string, path: string): boolean;
|
|
46
46
|
/** `is_public_address`: the rule an outbound host name must pass. */
|
|
@@ -57,19 +57,20 @@ interface OsAnchorProblem {
|
|
|
57
57
|
}
|
|
58
58
|
/** What a host answers an `os` ask with; `close` drops every handle it holds, as the native `OsHandles::close_all`. */
|
|
59
59
|
interface OsHostPort {
|
|
60
|
-
|
|
60
|
+
/** `orbital` is the orbital whose trait made the ask: its grants (plus the app's) answer it. */
|
|
61
|
+
answer(op: OsOp, args: JsonValue[], orbital?: string): Promise<Settled<JsonValue, OsError>>;
|
|
61
62
|
/**
|
|
62
63
|
* `Completions::run_later`: a keyed ask of a completion-deferring op. A failed check (or a key already pending) is the
|
|
63
64
|
* in-place `error`; `ok` means the work runs in the background and its outcome reaches `deliver` once, unless
|
|
64
65
|
* the key is cancelled first. A host with no `defer` answers every ask in place.
|
|
65
66
|
*/
|
|
66
|
-
defer?(op: OsOp, args: JsonValue[], key: string, deliver: (outcome: Settled<JsonValue, OsError>) => void): Settled<null, OsError>;
|
|
67
|
+
defer?(op: OsOp, args: JsonValue[], key: string, deliver: (outcome: Settled<JsonValue, OsError>) => void, orbital?: string): Settled<null, OsError>;
|
|
67
68
|
/**
|
|
68
69
|
* A keyed stream (`OsOp::is_stream`, EXEC-QUEUE-12): the host binds and answers once in place, then hands each message
|
|
69
70
|
* to `message` until it ends; `message` answers `false` when no one takes it any more. A failure after the answer
|
|
70
71
|
* reaches `fail` once. A host with no `stream` answers every stream ask in place, as unsupported.
|
|
71
72
|
*/
|
|
72
|
-
stream?(op: OsOp, args: JsonValue[], key: string, message: (value: JsonValue) => boolean, fail: (error: OsError) => void): Promise<Settled<JsonValue, OsError>>;
|
|
73
|
+
stream?(op: OsOp, args: JsonValue[], key: string, message: (value: JsonValue) => boolean, fail: (error: OsError) => void, orbital?: string): Promise<Settled<JsonValue, OsError>>;
|
|
73
74
|
/** `OsHandles::cancel_completion`: drop the pending completion of `key`, or stop its stream; `false` when none is open. */
|
|
74
75
|
cancel?(key: string): boolean;
|
|
75
76
|
close(): void;
|
|
@@ -85,6 +86,26 @@ interface OsCompletionPort {
|
|
|
85
86
|
streams(op: OsOp): boolean;
|
|
86
87
|
event(site: CallSiteWire, key: string, outcome: Settled<JsonValue, OsError>): OsCompletionEvent | null;
|
|
87
88
|
}
|
|
89
|
+
/** The next step of a TLS operation the kernel parked on a deferred raw ask. */
|
|
90
|
+
type OsTlsStep = {
|
|
91
|
+
ask: {
|
|
92
|
+
op: OsOp;
|
|
93
|
+
args: JsonValue[];
|
|
94
|
+
};
|
|
95
|
+
} | {
|
|
96
|
+
done: Settled<JsonValue, OsError>;
|
|
97
|
+
};
|
|
98
|
+
/** The kernel's TLS sockets (EXEC-HTTP-7): the host's raw outcome of a deferred ask goes in, the next raw ask or the program's outcome comes out. */
|
|
99
|
+
interface OsTlsPort {
|
|
100
|
+
/** `null` when `key` parks no TLS operation. */
|
|
101
|
+
complete(key: string, outcome: Settled<JsonValue, OsError>): OsTlsStep | null;
|
|
102
|
+
}
|
|
103
|
+
/** The server handle's TLS export. */
|
|
104
|
+
interface OsTlsKernel {
|
|
105
|
+
tlsComplete(key: string, outcomeJson: string): string;
|
|
106
|
+
}
|
|
107
|
+
/** The TLS port over the kernel `Server` handle: every decision is `RuntimeKernel::tls_complete`. */
|
|
108
|
+
declare function kernelOsTls(server: () => OsTlsKernel): OsTlsPort;
|
|
88
109
|
/** The kernel exports the completion port is built from. */
|
|
89
110
|
interface OsCompletionMatchers {
|
|
90
111
|
osDeferringOps(): string;
|
|
@@ -95,7 +116,7 @@ interface OsCompletionMatchers {
|
|
|
95
116
|
declare function kernelOsCompletions(kernel: OsCompletionMatchers): OsCompletionPort;
|
|
96
117
|
/** The kernel pieces a grant port is built from: the `Server` handle holding the program's grants and the module-level matchers. */
|
|
97
118
|
interface OsGrantKernel {
|
|
98
|
-
osAllows(requirementJson: string): boolean;
|
|
119
|
+
osAllows(requirementJson: string, orbital?: string): boolean;
|
|
99
120
|
setOsAnchors(anchorsJson: string): string;
|
|
100
121
|
osResolveArgs(op: string, argsJson: string): string;
|
|
101
122
|
}
|
|
@@ -113,6 +134,7 @@ interface OsAnchors {
|
|
|
113
134
|
readonly home?: string;
|
|
114
135
|
readonly start?: string;
|
|
115
136
|
readonly exeDir?: string;
|
|
137
|
+
readonly exe?: string;
|
|
116
138
|
readonly env?: Readonly<Record<string, string>>;
|
|
117
139
|
}
|
|
118
140
|
/** What a written path names under the host's anchors (`OsAnchors::expand`). */
|
|
@@ -129,5 +151,5 @@ declare function expandAnchor(anchors: OsAnchors, text: string): AnchoredPath;
|
|
|
129
151
|
/** The grant port a host checks absolute paths through: an fs need also matches the program's `~/` and `./` grants (`OsGrants::fs_allows_at`). */
|
|
130
152
|
declare function anchoredGrants(grants: OsGrantPort, anchors: OsAnchors): OsGrantPort;
|
|
131
153
|
|
|
132
|
-
export { anchoredGrants, expandAnchor, kernelOsCompletions, kernelOsGrants };
|
|
133
|
-
export type { AnchoredPath, OsAnchorProblem, OsAnchors, OsCompletionEvent, OsCompletionMatchers, OsCompletionPort, OsDesktopKind, OsFsMode, OsGrantKernel, OsGrantMatchers, OsGrantPort, OsHostPort, OsNetKind, OsRequirement, OsStdioKind, OsSysKind };
|
|
154
|
+
export { anchoredGrants, expandAnchor, kernelOsCompletions, kernelOsGrants, kernelOsTls };
|
|
155
|
+
export type { AnchoredPath, OsAnchorProblem, OsAnchors, OsCompletionEvent, OsCompletionMatchers, OsCompletionPort, OsDesktopKind, OsFsMode, OsGrantKernel, OsGrantMatchers, OsGrantPort, OsHostPort, OsNetKind, OsRequirement, OsStdioKind, OsSysKind, OsTlsKernel, OsTlsPort, OsTlsStep };
|
package/dist/kernel/os-port.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { anchoredGrants, expandAnchor, kernelOsCompletions, kernelOsGrants } from '../chunk-
|
|
2
|
-
import '../chunk-MLKGABMK.js';
|
|
1
|
+
export { anchoredGrants, expandAnchor, kernelOsCompletions, kernelOsGrants, kernelOsTls } from '../chunk-BOVU4TCQ.js';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { ProgramInspection, CatalogEntry, TraitDescription, BehaviorDescription, OrbitalSchema, EvaluatedProgram, ProgramValidationIssue, DependencyGraph, EventPayload
|
|
1
|
+
import { ProgramInspection, CatalogEntry, TraitDescription, BehaviorDescription, OrbitalSchema, EvaluatedProgram, ProgramValidationIssue, DependencyGraph, EventPayload } from '@almadar/core';
|
|
2
|
+
import { ProveReport, OsGrantsReport, PlayedStep } from '@almadar/core/kernel-wire';
|
|
3
|
+
export { PlayedStep } from '@almadar/core/kernel-wire';
|
|
2
4
|
|
|
3
5
|
/** The effects the language trio routes to this host. */
|
|
4
|
-
declare const PROGRAM_EFFECTS: readonly ["behavior/catalog", "behavior/describe", "behavior/source", "behavior/resolve", "behavior/dependencies", "program/read", "program/print", "program/eval", "program/validate", "program/compose", "program/step"];
|
|
6
|
+
declare const PROGRAM_EFFECTS: readonly ["behavior/catalog", "behavior/describe", "behavior/source", "behavior/resolve", "behavior/dependencies", "program/read", "program/print", "program/eval", "program/validate", "program/prove", "program/os-grants", "program/compose", "program/step"];
|
|
5
7
|
type ProgramEffectName = (typeof PROGRAM_EFFECTS)[number];
|
|
6
8
|
/** Narrow an effect head to one this host runs. */
|
|
7
9
|
declare function isProgramEffect(name: string): name is ProgramEffectName;
|
|
@@ -26,35 +28,16 @@ interface StepRequest {
|
|
|
26
28
|
now?: number;
|
|
27
29
|
/** A live call's cutoff: an open call still running after this many ms is cancelled. */
|
|
28
30
|
settleMs?: number;
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
interface CascadeOutcome {
|
|
34
|
-
orbital: string;
|
|
35
|
-
trait: string;
|
|
36
|
-
/** The event this trait handled (a listener's own triggered event). */
|
|
37
|
-
event: string;
|
|
38
|
-
from: string;
|
|
39
|
-
to: string;
|
|
40
|
-
/** The arm that fired; null when none did. */
|
|
41
|
-
arm: number | null;
|
|
42
|
-
fired: boolean;
|
|
43
|
-
/** The effects of the arm this trait fired, as the top-level `effects` report them. */
|
|
44
|
-
effects: CircuitStepResult['effects'];
|
|
45
|
-
emitted: CircuitStepResult['emitted'];
|
|
46
|
-
}
|
|
47
|
-
/** A played request: the request as asked, and the circuit it ran, with every trait its cascade moved. */
|
|
48
|
-
type PlayedStep = StepRequest & {
|
|
49
|
-
result: CircuitStepResult & {
|
|
50
|
-
outcomes: CascadeOutcome[];
|
|
51
|
-
entityAfter: EventPayload | null;
|
|
31
|
+
/** Test-only: the verified identity the replay kernel binds for this step (`@user`); absent is the anonymous viewer. */
|
|
32
|
+
identity?: {
|
|
33
|
+
subject: string;
|
|
34
|
+
claims: EventPayload;
|
|
52
35
|
};
|
|
53
|
-
}
|
|
36
|
+
}
|
|
54
37
|
/** The outcome of one program effect: the value for `{ result }`, or the failure (`errors` for eval's validator issues). */
|
|
55
38
|
type ProgramEffectOutcome = {
|
|
56
39
|
readonly ok: true;
|
|
57
|
-
readonly result: ProgramInspection | CatalogEntry[] | TraitDescription | BehaviorDescription | OrbitalSchema | string | EvaluatedProgram | ProgramValidationReport | DependencyGraph | PlayedStep[];
|
|
40
|
+
readonly result: ProgramInspection | CatalogEntry[] | TraitDescription | BehaviorDescription | OrbitalSchema | string | EvaluatedProgram | ProgramValidationReport | ProveReport | OsGrantsReport | DependencyGraph | PlayedStep[];
|
|
58
41
|
} | {
|
|
59
42
|
readonly ok: false;
|
|
60
43
|
readonly error: string;
|
|
@@ -62,4 +45,4 @@ type ProgramEffectOutcome = {
|
|
|
62
45
|
};
|
|
63
46
|
|
|
64
47
|
export { PROGRAM_EFFECTS, isProgramEffect };
|
|
65
|
-
export type {
|
|
48
|
+
export type { ProgramEffectName, ProgramEffectOutcome, ProgramValidationReport, StepRequest };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { PROGRAM_EFFECTS, isProgramEffect } from '../chunk-
|
|
2
|
-
import '../chunk-MLKGABMK.js';
|
|
1
|
+
export { PROGRAM_EFFECTS, isProgramEffect } from '../chunk-WGCWJOT2.js';
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { RuntimeValue, CredentialPayload } from '@almadar/core';
|
|
2
|
+
import { TokenEndpointPost, CredentialVault } from '../credentials/vault.js';
|
|
3
|
+
import { CredentialGrantWire, CredentialStanding, ConnectFailure } from '@almadar/core/kernel-wire';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The host ports of the kernel's secret, random and credential asks: the secret store, the CSPRNG and the credential
|
|
7
|
+
* administration port. The `http` effect is retired (HTTP/1.1 is `.lolo` over `os/*`), so nothing here moves HTTP bytes.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The host's secret store: a credential NAME in, its value out; `set` keeps a minted value for `ttlMs`.
|
|
12
|
+
* `principal` is the signed-in user's id for a user-scoped credential (the kernel sets it from the dispatch's `@user`,
|
|
13
|
+
* never the program); absent, the credential is app-wide.
|
|
14
|
+
*/
|
|
15
|
+
interface SecretStore {
|
|
16
|
+
get(name: string, principal?: string): Promise<string | undefined>;
|
|
17
|
+
/** `ttlMs` of 0 forgets the value. */
|
|
18
|
+
set(name: string, value: string, ttlMs: number, principal?: string): Promise<void>;
|
|
19
|
+
/** Replace the stored credential with `value`, durably (a rotated refresh token). A host without one cannot rotate. */
|
|
20
|
+
rotate?(name: string, value: string, principal?: string): Promise<void>;
|
|
21
|
+
/** Drop the credential, the minted value and the stored one. */
|
|
22
|
+
forget(name: string, principal?: string): Promise<void>;
|
|
23
|
+
/** Keep `value` as the credential until it is forgotten, creating it when absent: unlike `rotate` it needs no existing entry. `label` is a non-secret account name stored beside it, never the value. */
|
|
24
|
+
persist?(name: string, value: string, principal?: string, label?: string): Promise<void>;
|
|
25
|
+
/** The non-secret account label stored beside the credential; absent when its row carries none. */
|
|
26
|
+
label?(name: string, principal?: string): Promise<string | undefined>;
|
|
27
|
+
/** Whether `persist` keeps a value on this host. */
|
|
28
|
+
durable?(): Promise<boolean>;
|
|
29
|
+
}
|
|
30
|
+
/** The credential-store key of one user's credential. */
|
|
31
|
+
declare function userCredentialKey(principal: string, name: string): string;
|
|
32
|
+
/** CSPRNG output: `bytes` random bytes. */
|
|
33
|
+
type RandomSource = (bytes: number) => Uint8Array;
|
|
34
|
+
/**
|
|
35
|
+
* The host's raw credential store and mode flag, answered to the kernel's `credentialStore*` and `credentialMode*`
|
|
36
|
+
* asks. It decides nothing: the role gate, the declared-name check, the masking and the mode check are the kernel's.
|
|
37
|
+
*/
|
|
38
|
+
interface CredentialAdminPort {
|
|
39
|
+
/** Whether the store can encrypt and the service and name of every stored row; `null` when the host holds no store. */
|
|
40
|
+
list(): Promise<{
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
entries: Array<{
|
|
43
|
+
service: string;
|
|
44
|
+
name: string;
|
|
45
|
+
}>;
|
|
46
|
+
} | null>;
|
|
47
|
+
/** The stored value of credential `name`, from the store only. */
|
|
48
|
+
read(name: string): Promise<string | null>;
|
|
49
|
+
write(service: string, name: string, value: string): Promise<void>;
|
|
50
|
+
/** Whether a stored row existed. */
|
|
51
|
+
remove(name: string): Promise<boolean>;
|
|
52
|
+
rotate(): Promise<{
|
|
53
|
+
rotated: number;
|
|
54
|
+
alreadyCurrent: number;
|
|
55
|
+
unreadable: number;
|
|
56
|
+
}>;
|
|
57
|
+
/** The mode flag; `null` when the host keeps none. */
|
|
58
|
+
mode(): Promise<string | null>;
|
|
59
|
+
/** Switch the flag; the host may refuse. The mode in force afterwards. */
|
|
60
|
+
setMode(mode: string): Promise<string>;
|
|
61
|
+
}
|
|
62
|
+
/** The tails of the named variables this host's own environment holds: `last4` only from eight characters up, never a value. */
|
|
63
|
+
type EnvTailsPort = (names: readonly string[]) => Array<{
|
|
64
|
+
name: string;
|
|
65
|
+
last4?: string;
|
|
66
|
+
}>;
|
|
67
|
+
/** The environment tails of `env`: a name it holds non-empty, with the last four characters of a value of eight or more. */
|
|
68
|
+
declare function envTailsOf(env: Readonly<Record<string, string | undefined>>): EnvTailsPort;
|
|
69
|
+
/** The host's answer to a `credentialConnect` ask: the kernel's store builds the exchange and settles it, the host only sends it. */
|
|
70
|
+
type CredentialConnectPort = (grant: CredentialGrantWire) => Promise<{
|
|
71
|
+
ok: CredentialStanding;
|
|
72
|
+
} | {
|
|
73
|
+
error: ConnectFailure;
|
|
74
|
+
}>;
|
|
75
|
+
interface SecretPorts {
|
|
76
|
+
/** The host CSPRNG `random-bytes` and the driver's `Random` ask draw from. */
|
|
77
|
+
random: RandomSource;
|
|
78
|
+
secrets: SecretStore;
|
|
79
|
+
/** The credential store and mode flag the credential administration effects ask; absent, those asks fail unavailable. */
|
|
80
|
+
credentials?: CredentialAdminPort;
|
|
81
|
+
/** The host's own environment, for `credential-list`; absent, the host answers `unsupported` (a browser reads none). */
|
|
82
|
+
env?: EnvTailsPort;
|
|
83
|
+
/** Carries a `credentialConnect`; absent, the ask answers `unavailable`. */
|
|
84
|
+
connect?: CredentialConnectPort;
|
|
85
|
+
}
|
|
86
|
+
interface SecretPortsOptions {
|
|
87
|
+
random?: RandomSource;
|
|
88
|
+
secrets?: SecretStore;
|
|
89
|
+
/** Defaults to the installed credential store and mode flag. */
|
|
90
|
+
credentials?: CredentialAdminPort;
|
|
91
|
+
/** Defaults to the process environment. */
|
|
92
|
+
env?: EnvTailsPort;
|
|
93
|
+
/** The host's POST to a token endpoint; with it the credential store connects and refreshes OAuth credentials, without it neither is attempted. */
|
|
94
|
+
tokenPost?: TokenEndpointPost;
|
|
95
|
+
}
|
|
96
|
+
/** Where the secrets' durable credentials live: the store a host installed, and how a name resolves through it. */
|
|
97
|
+
interface SecretStoreHost {
|
|
98
|
+
store(): Promise<CredentialVault | null>;
|
|
99
|
+
resolve(name: string, principal: string | undefined): Promise<string | undefined>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The secrets of a host: minted values with an expiry (a memory tier that never reaches the rows), then the credential vault
|
|
103
|
+
* the host holds (by default the one the host installed). Everything durable is the kernel's: `rotate`, `persist`, `label`,
|
|
104
|
+
* and `forget`.
|
|
105
|
+
*/
|
|
106
|
+
declare function createSecretStore(now?: () => number, host?: SecretStoreHost, tokenPost?: TokenEndpointPost): SecretStore;
|
|
107
|
+
/** `credentialConnect` over the installed credential store and the host's token POST. */
|
|
108
|
+
declare function createCredentialConnectPort(post: TokenEndpointPost): CredentialConnectPort;
|
|
109
|
+
/** The credential store and mode flag the host installed, as the kernel's raw asks. */
|
|
110
|
+
declare function createCredentialAdminPort(): CredentialAdminPort;
|
|
111
|
+
/** Bytes from the platform CSPRNG. */
|
|
112
|
+
declare const systemRandom: RandomSource;
|
|
113
|
+
/** The most bytes one `random-bytes` may ask for (the kernel's `RANDOM_BYTES_MAX`). */
|
|
114
|
+
declare const RANDOM_BYTES_MAX = 1024;
|
|
115
|
+
/** Standard padded base64 (the wire form of a `Random` answer). */
|
|
116
|
+
declare function base64Standard(bytes: Uint8Array): string;
|
|
117
|
+
/** URL-safe base64 without padding (the `random-bytes` value; the kernel's `codec::base64url_encode`). */
|
|
118
|
+
declare function base64Url(bytes: Uint8Array): string;
|
|
119
|
+
/**
|
|
120
|
+
* `random-bytes`: the success payload for `bytes` drawn from the host CSPRNG; a bad count or key is the effect's
|
|
121
|
+
* failure. A keyed call echoes its `key` beside the `value`.
|
|
122
|
+
*/
|
|
123
|
+
declare function randomBytesPayload(ports: Pick<SecretPorts, 'random'>, bytes: RuntimeValue | undefined, key?: RuntimeValue): {
|
|
124
|
+
value: string;
|
|
125
|
+
key?: string;
|
|
126
|
+
};
|
|
127
|
+
/** `credential-status`: a bare name selects the viewer; an explicit slot selects its declared scope. */
|
|
128
|
+
declare function credentialStatusPayload(ports: Pick<SecretPorts, 'secrets'>, credential: RuntimeValue | undefined, principal: string | undefined): Promise<CredentialPayload>;
|
|
129
|
+
/** `credential-forget`: drops the signed-in viewer's credential; `{ connected: false }`. */
|
|
130
|
+
declare function credentialForgetPayload(ports: Pick<SecretPorts, 'secrets'>, credential: RuntimeValue | undefined, principal: string | undefined): Promise<{
|
|
131
|
+
connected: false;
|
|
132
|
+
label: string;
|
|
133
|
+
}>;
|
|
134
|
+
declare function createSecretPorts(options?: SecretPortsOptions): SecretPorts;
|
|
135
|
+
/** Ports of a browser: it holds no credential, so a secret ask fails and the CSPRNG is the page's. */
|
|
136
|
+
declare function createBrowserSecretPorts(): SecretPorts;
|
|
137
|
+
|
|
138
|
+
export { RANDOM_BYTES_MAX, base64Standard, base64Url, createBrowserSecretPorts, createCredentialAdminPort, createCredentialConnectPort, createSecretPorts, createSecretStore, credentialForgetPayload, credentialStatusPayload, envTailsOf, randomBytesPayload, systemRandom, userCredentialKey };
|
|
139
|
+
export type { CredentialAdminPort, CredentialConnectPort, EnvTailsPort, RandomSource, SecretPorts, SecretPortsOptions, SecretStore, SecretStoreHost };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { RANDOM_BYTES_MAX, base64Standard, base64Url, createBrowserSecretPorts, createCredentialAdminPort, createCredentialConnectPort, createSecretPorts, createSecretStore, credentialForgetPayload, credentialStatusPayload, envTailsOf, randomBytesPayload, systemRandom, userCredentialKey } from '../chunk-ZUSM4VW4.js';
|
|
2
|
+
import '../chunk-HLOUDLPI.js';
|