@bota.dev/web-app-sdk 2.0.0-beta.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/LICENSE +21 -0
- package/README.md +517 -0
- package/dist/capabilities.d.ts +8 -0
- package/dist/capabilities.js +21 -0
- package/dist/client.d.ts +39 -0
- package/dist/client.js +153 -0
- package/dist/controlManager.d.ts +38 -0
- package/dist/controlManager.js +344 -0
- package/dist/core.d.ts +698 -0
- package/dist/core.js +13 -0
- package/dist/deviceManager.d.ts +52 -0
- package/dist/deviceManager.js +491 -0
- package/dist/encryptedUploadV2Host.d.ts +239 -0
- package/dist/encryptedUploadV2Host.js +2136 -0
- package/dist/errors.d.ts +24 -0
- package/dist/errors.js +230 -0
- package/dist/gatt.d.ts +39 -0
- package/dist/gatt.js +57 -0
- package/dist/generated/bota_device_sdk_core.d.ts +202 -0
- package/dist/generated/bota_device_sdk_core.js +1025 -0
- package/dist/generated/bota_device_sdk_core_bg.wasm +0 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +2 -0
- package/dist/indexedDbWorkflowStore.d.ts +52 -0
- package/dist/indexedDbWorkflowStore.js +763 -0
- package/dist/logManager.d.ts +24 -0
- package/dist/logManager.js +205 -0
- package/dist/models.d.ts +217 -0
- package/dist/models.js +1 -0
- package/dist/opfsBlobStore.d.ts +12 -0
- package/dist/opfsBlobStore.js +250 -0
- package/dist/otaManager.d.ts +49 -0
- package/dist/otaManager.js +951 -0
- package/dist/providerCancellation.d.ts +2 -0
- package/dist/providerCancellation.js +23 -0
- package/dist/providers.d.ts +138 -0
- package/dist/providers.js +1 -0
- package/dist/provisioningManager.d.ts +48 -0
- package/dist/provisioningManager.js +753 -0
- package/dist/recordingManager.d.ts +53 -0
- package/dist/recordingManager.js +1397 -0
- package/dist/storage.d.ts +103 -0
- package/dist/storage.js +60 -0
- package/dist/transport.d.ts +33 -0
- package/dist/transport.js +8 -0
- package/dist/wasmCore.d.ts +3 -0
- package/dist/wasmCore.js +1651 -0
- package/dist/webBluetoothTransport.d.ts +23 -0
- package/dist/webBluetoothTransport.js +369 -0
- package/dist/wifiManager.d.ts +54 -0
- package/dist/wifiManager.js +528 -0
- package/dist/workflowRuntime.d.ts +115 -0
- package/dist/workflowRuntime.js +1508 -0
- package/package.json +46 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import type { CoreBridge, CoreEffectEnvelope, CoreEncryptedUploadV2Checkpoint, CoreEncryptedUploadV2Evidence, CoreEncryptedUploadV2OutboundTransferFrame, CoreEncryptedUploadV2TransferFrame, CoreHostEvent } from './core.ts';
|
|
2
|
+
import type { EncryptedUploadV2Material, EncryptedUploadV2Recording } from './providers.ts';
|
|
3
|
+
import { type BrowserBlobHandle, type BrowserSdkStorage } from './storage.ts';
|
|
4
|
+
import { type BrowserBluetoothTransport, type BrowserDeviceHandle } from './transport.ts';
|
|
5
|
+
import type { WorkflowEffectContext, WorkflowEffectHost } from './workflowRuntime.ts';
|
|
6
|
+
type SignedBlobKind = 'authorization' | 'receipt';
|
|
7
|
+
export interface EncryptedUploadV2ListResult {
|
|
8
|
+
entries: Array<Extract<CoreEncryptedUploadV2TransferFrame, {
|
|
9
|
+
kind: 'recording_entry';
|
|
10
|
+
}>>;
|
|
11
|
+
listRevision: number;
|
|
12
|
+
}
|
|
13
|
+
export interface EncryptedUploadV2TransferRequest {
|
|
14
|
+
transportSessionId: bigint;
|
|
15
|
+
uploadSessionUuid: string;
|
|
16
|
+
recordingUuid: string;
|
|
17
|
+
recordingGeneration: number;
|
|
18
|
+
authorizationSha256: Uint8Array;
|
|
19
|
+
expectedCiphertextLength: bigint;
|
|
20
|
+
expectedCiphertextSha256: Uint8Array;
|
|
21
|
+
expectedCheckpointIntervalBlocks: number;
|
|
22
|
+
windowPackets: number;
|
|
23
|
+
dataPayloadBytes: number;
|
|
24
|
+
}
|
|
25
|
+
export type EncryptedUploadV2TransferContinuation = {
|
|
26
|
+
kind: 'window';
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'manifest';
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'repair';
|
|
31
|
+
missingSequences: number[];
|
|
32
|
+
};
|
|
33
|
+
export type EncryptedUploadV2OpenResult = {
|
|
34
|
+
kind: 'opened';
|
|
35
|
+
notifications: AsyncIterable<CoreEncryptedUploadV2TransferFrame>;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'resume_rejected';
|
|
38
|
+
};
|
|
39
|
+
export interface EncryptedUploadV2NativeCheckpoint {
|
|
40
|
+
revision: number;
|
|
41
|
+
nextCiphertextOffset: bigint;
|
|
42
|
+
prefixSha256: Uint8Array;
|
|
43
|
+
highestContiguousSequence: number | null;
|
|
44
|
+
}
|
|
45
|
+
export type EncryptedUploadV2ReceiverEvent = {
|
|
46
|
+
kind: 'window_staged';
|
|
47
|
+
checkpoint: EncryptedUploadV2NativeCheckpoint;
|
|
48
|
+
missingSequences: number[];
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'completed';
|
|
51
|
+
manifest: Uint8Array;
|
|
52
|
+
evidence: CoreEncryptedUploadV2Evidence;
|
|
53
|
+
};
|
|
54
|
+
interface TransferReceiverOptions {
|
|
55
|
+
transportSessionId: bigint;
|
|
56
|
+
expectedCiphertextLength: bigint;
|
|
57
|
+
expectedCiphertextSha256: Uint8Array;
|
|
58
|
+
maximumDataPayloadBytes: number;
|
|
59
|
+
maximumWindowPackets: number;
|
|
60
|
+
maximumMissingSequences: number;
|
|
61
|
+
checkpoint: EncryptedUploadV2NativeCheckpoint;
|
|
62
|
+
}
|
|
63
|
+
interface BleOwnerTimingOptions {
|
|
64
|
+
resultTimeoutMs?: number;
|
|
65
|
+
cleanupTimeoutMs?: number;
|
|
66
|
+
}
|
|
67
|
+
export declare class EncryptedUploadV2SignedBlobWriter {
|
|
68
|
+
private readonly core;
|
|
69
|
+
private readonly transport;
|
|
70
|
+
private readonly device;
|
|
71
|
+
private readonly onOwnershipUncertain;
|
|
72
|
+
private readonly resultTimeoutMs;
|
|
73
|
+
private readonly cleanupTimeoutMs;
|
|
74
|
+
private readonly writes;
|
|
75
|
+
private active;
|
|
76
|
+
private operation;
|
|
77
|
+
private cancelled;
|
|
78
|
+
constructor(core: CoreBridge, transport: BrowserBluetoothTransport, device: BrowserDeviceHandle, onOwnershipUncertain?: () => void, timing?: BleOwnerTimingOptions);
|
|
79
|
+
send(blobKind: SignedBlobKind, writeId: number, value: Uint8Array, maximumBlobBytes: number, signal?: AbortSignal, terminalCallback?: () => void): Promise<void>;
|
|
80
|
+
private runSend;
|
|
81
|
+
cancel(): Promise<void>;
|
|
82
|
+
private finishOperation;
|
|
83
|
+
private poison;
|
|
84
|
+
private largestChunk;
|
|
85
|
+
private write;
|
|
86
|
+
}
|
|
87
|
+
export declare class EncryptedUploadV2TransferControl {
|
|
88
|
+
private readonly core;
|
|
89
|
+
private readonly transport;
|
|
90
|
+
private readonly device;
|
|
91
|
+
private readonly onOwnershipUncertain;
|
|
92
|
+
private readonly cleanupTimeoutMs;
|
|
93
|
+
private readonly writes;
|
|
94
|
+
private active;
|
|
95
|
+
private session;
|
|
96
|
+
constructor(core: CoreBridge, transport: BrowserBluetoothTransport, device: BrowserDeviceHandle, onOwnershipUncertain?: () => void, timing?: BleOwnerTimingOptions);
|
|
97
|
+
open(request: EncryptedUploadV2TransferRequest, checkpoint: EncryptedUploadV2NativeCheckpoint | null, signal?: AbortSignal): Promise<EncryptedUploadV2OpenResult>;
|
|
98
|
+
sendActiveFrame(frame: Extract<CoreEncryptedUploadV2OutboundTransferFrame, {
|
|
99
|
+
kind: 'window_ack';
|
|
100
|
+
}>, continuation: EncryptedUploadV2TransferContinuation): Promise<void>;
|
|
101
|
+
confirm(frame: Extract<CoreEncryptedUploadV2OutboundTransferFrame, {
|
|
102
|
+
kind: 'confirm';
|
|
103
|
+
}>, writeSucceeded: () => Promise<void>): Promise<void>;
|
|
104
|
+
confirmationAttemptedOrClaimCancellation(): Promise<boolean>;
|
|
105
|
+
abort(reason?: number): Promise<void>;
|
|
106
|
+
cancel(): Promise<void>;
|
|
107
|
+
private acceptTransferFrame;
|
|
108
|
+
private requireSession;
|
|
109
|
+
private releaseSession;
|
|
110
|
+
private poison;
|
|
111
|
+
list(transportSessionId: bigint, signal?: AbortSignal): Promise<EncryptedUploadV2ListResult>;
|
|
112
|
+
private writeControl;
|
|
113
|
+
}
|
|
114
|
+
export interface PersistedEncryptedUploadV2State {
|
|
115
|
+
schemaVersion: 1;
|
|
116
|
+
operationId: string;
|
|
117
|
+
serialNumber: string;
|
|
118
|
+
recording: EncryptedUploadV2Recording;
|
|
119
|
+
materialId: string;
|
|
120
|
+
recordingId: string;
|
|
121
|
+
uploadSessionId: string;
|
|
122
|
+
ownerRevision: number;
|
|
123
|
+
policy: 'legacy_allowed' | 'v2_preferred' | 'v2_required';
|
|
124
|
+
transportSessionId: bigint;
|
|
125
|
+
sinkId: string;
|
|
126
|
+
windowPackets: number;
|
|
127
|
+
dataPayloadBytes: number;
|
|
128
|
+
maximumSignedBlobBytes: number;
|
|
129
|
+
maximumMissingSequences: number;
|
|
130
|
+
checkpointIntervalBlocks: number;
|
|
131
|
+
capabilitySha256Hex: string;
|
|
132
|
+
coreCheckpoint: CoreEncryptedUploadV2Checkpoint | null;
|
|
133
|
+
highestContiguousSequence: number | null;
|
|
134
|
+
evidence: CoreEncryptedUploadV2Evidence | null;
|
|
135
|
+
}
|
|
136
|
+
export interface EncryptedUploadV2HostCallbacks {
|
|
137
|
+
transferCompleted(evidence: CoreEncryptedUploadV2Evidence): Promise<void>;
|
|
138
|
+
uploading(): Promise<void>;
|
|
139
|
+
cloudCompleted(receiptSha256: Uint8Array): Promise<void>;
|
|
140
|
+
confirmed(): Promise<void>;
|
|
141
|
+
}
|
|
142
|
+
export interface EncryptedUploadV2HostOptions {
|
|
143
|
+
core: CoreBridge;
|
|
144
|
+
transport: BrowserBluetoothTransport;
|
|
145
|
+
device: BrowserDeviceHandle;
|
|
146
|
+
storage: BrowserSdkStorage;
|
|
147
|
+
blob: BrowserBlobHandle;
|
|
148
|
+
material: EncryptedUploadV2Material;
|
|
149
|
+
state: PersistedEncryptedUploadV2State;
|
|
150
|
+
fetcher: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
151
|
+
callbacks: EncryptedUploadV2HostCallbacks;
|
|
152
|
+
recoveryPhase: 'prepared' | 'transferring' | 'staged' | 'uploading' | 'cloud_completed';
|
|
153
|
+
expectedReceiptSha256Hex: string | null;
|
|
154
|
+
onOwnershipUncertain(): void;
|
|
155
|
+
}
|
|
156
|
+
export declare class EncryptedUploadV2Host implements WorkflowEffectHost {
|
|
157
|
+
private readonly core;
|
|
158
|
+
private readonly storage;
|
|
159
|
+
private readonly blob;
|
|
160
|
+
private readonly material;
|
|
161
|
+
private readonly state;
|
|
162
|
+
private readonly fetcher;
|
|
163
|
+
private readonly callbacks;
|
|
164
|
+
private readonly recoveryPhase;
|
|
165
|
+
private readonly expectedReceiptSha256Hex;
|
|
166
|
+
private readonly signedWriter;
|
|
167
|
+
private readonly transferControl;
|
|
168
|
+
private readonly uploadAbort;
|
|
169
|
+
private receiver;
|
|
170
|
+
private pendingNativeCheckpoint;
|
|
171
|
+
private persistedCoreCheckpoint;
|
|
172
|
+
private completedManifest;
|
|
173
|
+
private completedEvidence;
|
|
174
|
+
private acceptedReceipt;
|
|
175
|
+
private acceptedReceiptSha256;
|
|
176
|
+
private boundaryTarget;
|
|
177
|
+
private boundaryGate;
|
|
178
|
+
private startBoundaryTarget;
|
|
179
|
+
private pumpPromise;
|
|
180
|
+
private preparedAuthorizationSha256;
|
|
181
|
+
private cancelledValue;
|
|
182
|
+
private abortPromise;
|
|
183
|
+
constructor(options: EncryptedUploadV2HostOptions);
|
|
184
|
+
execute(envelope: CoreEffectEnvelope, context: WorkflowEffectContext): Promise<CoreHostEvent | readonly CoreHostEvent[] | null>;
|
|
185
|
+
confirmationAttemptedOrClaimCancellation(): Promise<boolean>;
|
|
186
|
+
cancel(): Promise<void>;
|
|
187
|
+
private startTransfer;
|
|
188
|
+
private repairWindow;
|
|
189
|
+
private saveCheckpoint;
|
|
190
|
+
private acknowledgeWindow;
|
|
191
|
+
private stageArtifacts;
|
|
192
|
+
private awaitReceipt;
|
|
193
|
+
private confirm;
|
|
194
|
+
private pump;
|
|
195
|
+
private dispatchTarget;
|
|
196
|
+
private validateCheckpointOwner;
|
|
197
|
+
private validateStartEffect;
|
|
198
|
+
private validateCompletion;
|
|
199
|
+
private requireReceiver;
|
|
200
|
+
private requireCompletedManifest;
|
|
201
|
+
private uploadCiphertext;
|
|
202
|
+
private abortState;
|
|
203
|
+
}
|
|
204
|
+
export declare class EncryptedUploadV2TransferReceiver {
|
|
205
|
+
private readonly core;
|
|
206
|
+
private readonly blob;
|
|
207
|
+
private readonly options;
|
|
208
|
+
private checkpoint;
|
|
209
|
+
private readonly packets;
|
|
210
|
+
private pendingWindow;
|
|
211
|
+
private readonly manifest;
|
|
212
|
+
private readonly manifestPresent;
|
|
213
|
+
private manifestSha256;
|
|
214
|
+
private prepared;
|
|
215
|
+
private terminal;
|
|
216
|
+
private completed;
|
|
217
|
+
private bufferedBytes;
|
|
218
|
+
constructor(core: CoreBridge, blob: BrowserBlobHandle, options: TransferReceiverOptions);
|
|
219
|
+
prepare(): Promise<void>;
|
|
220
|
+
receive(frame: CoreEncryptedUploadV2TransferFrame): Promise<EncryptedUploadV2ReceiverEvent | null>;
|
|
221
|
+
repairAcknowledgement(missingSequences: number[]): Extract<CoreEncryptedUploadV2OutboundTransferFrame, {
|
|
222
|
+
kind: 'window_ack';
|
|
223
|
+
}>;
|
|
224
|
+
checkpointDidPersist(checkpoint: EncryptedUploadV2NativeCheckpoint): void;
|
|
225
|
+
windowAcknowledgement(checkpoint: EncryptedUploadV2NativeCheckpoint): Extract<CoreEncryptedUploadV2OutboundTransferFrame, {
|
|
226
|
+
kind: 'window_ack';
|
|
227
|
+
}>;
|
|
228
|
+
private receiveData;
|
|
229
|
+
private receiveWindowEnd;
|
|
230
|
+
private receiveManifest;
|
|
231
|
+
private receiveEof;
|
|
232
|
+
private flushWindow;
|
|
233
|
+
private hashProspectivePrefix;
|
|
234
|
+
private acknowledgement;
|
|
235
|
+
}
|
|
236
|
+
export declare function initialEncryptedUploadV2Checkpoint(): EncryptedUploadV2NativeCheckpoint;
|
|
237
|
+
export declare function coreCheckpoint(serialNumber: string, recordingUuid: Uint8Array, recordingGeneration: number, uploadSessionId: Uint8Array, ownerRevision: number, transportSessionId: bigint, checkpoint: EncryptedUploadV2NativeCheckpoint, windowPackets: number, dataPayloadBytes: number): CoreEncryptedUploadV2Checkpoint;
|
|
238
|
+
export declare function parsePersistedEncryptedUploadV2State(value: unknown): PersistedEncryptedUploadV2State;
|
|
239
|
+
export {};
|