@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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +517 -0
  3. package/dist/capabilities.d.ts +8 -0
  4. package/dist/capabilities.js +21 -0
  5. package/dist/client.d.ts +39 -0
  6. package/dist/client.js +153 -0
  7. package/dist/controlManager.d.ts +38 -0
  8. package/dist/controlManager.js +344 -0
  9. package/dist/core.d.ts +698 -0
  10. package/dist/core.js +13 -0
  11. package/dist/deviceManager.d.ts +52 -0
  12. package/dist/deviceManager.js +491 -0
  13. package/dist/encryptedUploadV2Host.d.ts +239 -0
  14. package/dist/encryptedUploadV2Host.js +2136 -0
  15. package/dist/errors.d.ts +24 -0
  16. package/dist/errors.js +230 -0
  17. package/dist/gatt.d.ts +39 -0
  18. package/dist/gatt.js +57 -0
  19. package/dist/generated/bota_device_sdk_core.d.ts +202 -0
  20. package/dist/generated/bota_device_sdk_core.js +1025 -0
  21. package/dist/generated/bota_device_sdk_core_bg.wasm +0 -0
  22. package/dist/index.d.ts +13 -0
  23. package/dist/index.js +2 -0
  24. package/dist/indexedDbWorkflowStore.d.ts +52 -0
  25. package/dist/indexedDbWorkflowStore.js +763 -0
  26. package/dist/logManager.d.ts +24 -0
  27. package/dist/logManager.js +205 -0
  28. package/dist/models.d.ts +217 -0
  29. package/dist/models.js +1 -0
  30. package/dist/opfsBlobStore.d.ts +12 -0
  31. package/dist/opfsBlobStore.js +250 -0
  32. package/dist/otaManager.d.ts +49 -0
  33. package/dist/otaManager.js +951 -0
  34. package/dist/providerCancellation.d.ts +2 -0
  35. package/dist/providerCancellation.js +23 -0
  36. package/dist/providers.d.ts +138 -0
  37. package/dist/providers.js +1 -0
  38. package/dist/provisioningManager.d.ts +48 -0
  39. package/dist/provisioningManager.js +753 -0
  40. package/dist/recordingManager.d.ts +53 -0
  41. package/dist/recordingManager.js +1397 -0
  42. package/dist/storage.d.ts +103 -0
  43. package/dist/storage.js +60 -0
  44. package/dist/transport.d.ts +33 -0
  45. package/dist/transport.js +8 -0
  46. package/dist/wasmCore.d.ts +3 -0
  47. package/dist/wasmCore.js +1651 -0
  48. package/dist/webBluetoothTransport.d.ts +23 -0
  49. package/dist/webBluetoothTransport.js +369 -0
  50. package/dist/wifiManager.d.ts +54 -0
  51. package/dist/wifiManager.js +528 -0
  52. package/dist/workflowRuntime.d.ts +115 -0
  53. package/dist/workflowRuntime.js +1508 -0
  54. package/package.json +46 -0
@@ -0,0 +1,24 @@
1
+ import type { CoreOperation } from './core.ts';
2
+ export type BotaSDKErrorCode = 'unsupported_browser' | 'invalid_input' | 'picker_cancelled' | 'bluetooth_unavailable' | 'permission_denied' | 'operation_in_progress' | 'connection_failed' | 'identity_mismatch' | 'device_disconnected' | 'protocol_error' | 'cancelled' | 'internal_error' | 'unsupported_capability' | 'picker_required' | 'storage_unavailable' | 'storage_quota_exceeded' | 'authorization_expired' | 'resume_rejected' | 'reconciliation_required' | 'integrity_failed' | 'upload_failed' | 'firmware_rejected';
3
+ export type BotaOperation = 'initialize' | 'connect' | 'reconnect' | 'disconnect' | 'read_snapshot' | 'provision' | 'deprovision' | 'settings' | 'wifi' | 'recording_control' | 'transfer_recording' | 'upload' | 'update_firmware' | 'read_device_logs' | 'clear_persisted_data' | 'unknown';
4
+ export declare class BotaSDKError extends Error {
5
+ readonly code: BotaSDKErrorCode;
6
+ readonly operation: BotaOperation;
7
+ readonly retryable: boolean;
8
+ readonly protocolStatus: number | null;
9
+ constructor(code: BotaSDKErrorCode, operation: BotaOperation, options?: {
10
+ retryable?: boolean;
11
+ protocolStatus?: number | null;
12
+ cause?: unknown;
13
+ });
14
+ }
15
+ export type CoreBridgeErrorCode = 'invalid_input' | 'truncated_packet' | 'unknown_packet' | 'payload_too_large' | 'unsupported_capability' | 'unsupported_operation' | 'feature_unavailable' | 'operation_in_progress' | 'unexpected_event' | 'device_not_found' | 'identity_mismatch' | 'connection_failed' | 'persistence_failed' | 'not_connected' | 'timeout' | 'cancelled' | 'protocol_rejected' | 'integrity_failed' | 'upload_ownership_unknown' | 'download_failed' | 'internal';
16
+ export declare class CoreBridgeError extends Error {
17
+ readonly code: CoreBridgeErrorCode;
18
+ readonly operation: CoreOperation;
19
+ readonly retryable: boolean;
20
+ readonly protocolStatus: number | null;
21
+ constructor(code: CoreBridgeErrorCode, operation: CoreOperation, retryable: boolean, protocolStatus: number | null);
22
+ }
23
+ export declare function normalizePrivateCoreError(error: unknown, fallbackOperation: CoreOperation): CoreBridgeError | BotaSDKError;
24
+ export declare function normalizeCoreError(error: unknown, fallbackOperation: BotaOperation): BotaSDKError;
package/dist/errors.js ADDED
@@ -0,0 +1,230 @@
1
+ const MESSAGES = {
2
+ unsupported_browser: 'Bluetooth is not supported by this browser.',
3
+ invalid_input: 'The operation contains invalid input.',
4
+ picker_cancelled: 'Device selection was cancelled.',
5
+ bluetooth_unavailable: 'Bluetooth is unavailable.',
6
+ permission_denied: 'Bluetooth permission was denied.',
7
+ operation_in_progress: 'Another device operation is already in progress.',
8
+ connection_failed: 'The device connection failed.',
9
+ identity_mismatch: 'The selected device does not match this device record.',
10
+ device_disconnected: 'The device is disconnected.',
11
+ protocol_error: 'The device returned invalid protocol data.',
12
+ cancelled: 'The operation was cancelled.',
13
+ internal_error: 'The SDK could not complete the operation.',
14
+ unsupported_capability: 'This browser or device does not support the operation.',
15
+ picker_required: 'Select the device again to continue.',
16
+ storage_unavailable: 'Durable browser storage is unavailable.',
17
+ storage_quota_exceeded: 'Durable browser storage quota was exceeded.',
18
+ authorization_expired: 'The operation authorization has expired.',
19
+ resume_rejected: 'The saved operation cannot be resumed.',
20
+ reconciliation_required: 'The operation requires exact-state reconciliation.',
21
+ integrity_failed: 'The operation failed an integrity check.',
22
+ upload_failed: 'The upload could not be completed.',
23
+ firmware_rejected: 'The device rejected the firmware update.',
24
+ };
25
+ export class BotaSDKError extends Error {
26
+ code;
27
+ operation;
28
+ retryable;
29
+ protocolStatus;
30
+ constructor(code, operation, options = {}) {
31
+ super(MESSAGES[code]);
32
+ this.name = 'BotaSDKError';
33
+ this.code = code;
34
+ this.operation = operation;
35
+ this.retryable = options.retryable ?? false;
36
+ this.protocolStatus = options.protocolStatus ?? null;
37
+ }
38
+ }
39
+ export class CoreBridgeError extends Error {
40
+ code;
41
+ operation;
42
+ retryable;
43
+ protocolStatus;
44
+ constructor(code, operation, retryable, protocolStatus) {
45
+ super('The core workflow could not complete the operation.');
46
+ this.name = 'CoreBridgeError';
47
+ this.code = code;
48
+ this.operation = operation;
49
+ this.retryable = retryable;
50
+ this.protocolStatus = protocolStatus;
51
+ }
52
+ }
53
+ const PRIVATE_CORE_CODES = {
54
+ InvalidInput: 'invalid_input',
55
+ invalid_input: 'invalid_input',
56
+ TruncatedPacket: 'truncated_packet',
57
+ truncated_packet: 'truncated_packet',
58
+ UnknownPacket: 'unknown_packet',
59
+ unknown_packet: 'unknown_packet',
60
+ PayloadTooLarge: 'payload_too_large',
61
+ payload_too_large: 'payload_too_large',
62
+ UnsupportedCapability: 'unsupported_capability',
63
+ unsupported_capability: 'unsupported_capability',
64
+ UnsupportedOperation: 'unsupported_operation',
65
+ unsupported_operation: 'unsupported_operation',
66
+ FeatureUnavailable: 'feature_unavailable',
67
+ feature_unavailable: 'feature_unavailable',
68
+ OperationInProgress: 'operation_in_progress',
69
+ operation_in_progress: 'operation_in_progress',
70
+ UnexpectedEvent: 'unexpected_event',
71
+ unexpected_event: 'unexpected_event',
72
+ DeviceNotFound: 'device_not_found',
73
+ device_not_found: 'device_not_found',
74
+ IdentityMismatch: 'identity_mismatch',
75
+ identity_mismatch: 'identity_mismatch',
76
+ ConnectionFailed: 'connection_failed',
77
+ connection_failed: 'connection_failed',
78
+ PersistenceFailed: 'persistence_failed',
79
+ persistence_failed: 'persistence_failed',
80
+ NotConnected: 'not_connected',
81
+ not_connected: 'not_connected',
82
+ Timeout: 'timeout',
83
+ timeout: 'timeout',
84
+ Cancelled: 'cancelled',
85
+ cancelled: 'cancelled',
86
+ ProtocolRejected: 'protocol_rejected',
87
+ protocol_rejected: 'protocol_rejected',
88
+ IntegrityFailed: 'integrity_failed',
89
+ integrity_failed: 'integrity_failed',
90
+ UploadOwnershipUnknown: 'upload_ownership_unknown',
91
+ upload_ownership_unknown: 'upload_ownership_unknown',
92
+ DownloadFailed: 'download_failed',
93
+ download_failed: 'download_failed',
94
+ Internal: 'internal',
95
+ internal: 'internal',
96
+ };
97
+ const PRIVATE_CORE_OPERATIONS = {
98
+ Validate: 'validate',
99
+ validate: 'validate',
100
+ Decode: 'decode',
101
+ decode: 'decode',
102
+ Encode: 'encode',
103
+ encode: 'encode',
104
+ Discover: 'discover',
105
+ discover: 'discover',
106
+ Connect: 'connect',
107
+ connect: 'connect',
108
+ Reconnect: 'reconnect',
109
+ reconnect: 'reconnect',
110
+ Provision: 'provision',
111
+ provision: 'provision',
112
+ TransferRecording: 'transfer_recording',
113
+ transfer_recording: 'transfer_recording',
114
+ Upload: 'upload',
115
+ upload: 'upload',
116
+ UpdateFirmware: 'update_firmware',
117
+ update_firmware: 'update_firmware',
118
+ ReadDeviceLogs: 'read_device_logs',
119
+ read_device_logs: 'read_device_logs',
120
+ FactoryReset: 'factory_reset',
121
+ factory_reset: 'factory_reset',
122
+ Unknown: 'unknown',
123
+ unknown: 'unknown',
124
+ };
125
+ export function normalizePrivateCoreError(error, fallbackOperation) {
126
+ if (error instanceof CoreBridgeError || error instanceof BotaSDKError) {
127
+ return error;
128
+ }
129
+ if (typeof error === 'object' && error !== null) {
130
+ const structured = error;
131
+ if (typeof structured.code === 'string') {
132
+ const operation = typeof structured.operation === 'string'
133
+ ? (PRIVATE_CORE_OPERATIONS[structured.operation] ?? fallbackOperation)
134
+ : fallbackOperation;
135
+ return new CoreBridgeError(PRIVATE_CORE_CODES[structured.code] ?? 'internal', operation, structured.retryable === true, typeof structured.protocol_status === 'number'
136
+ ? structured.protocol_status
137
+ : null);
138
+ }
139
+ }
140
+ return new CoreBridgeError('internal', fallbackOperation, false, null);
141
+ }
142
+ const CORE_CODES = {
143
+ InvalidInput: 'invalid_input',
144
+ invalid_input: 'invalid_input',
145
+ OperationInProgress: 'operation_in_progress',
146
+ operation_in_progress: 'operation_in_progress',
147
+ UnsupportedCapability: 'unsupported_capability',
148
+ unsupported_capability: 'unsupported_capability',
149
+ UnsupportedOperation: 'unsupported_capability',
150
+ unsupported_operation: 'unsupported_capability',
151
+ FeatureUnavailable: 'unsupported_capability',
152
+ feature_unavailable: 'unsupported_capability',
153
+ UnexpectedEvent: 'protocol_error',
154
+ unexpected_event: 'protocol_error',
155
+ DeviceNotFound: 'connection_failed',
156
+ device_not_found: 'connection_failed',
157
+ IdentityMismatch: 'identity_mismatch',
158
+ identity_mismatch: 'identity_mismatch',
159
+ ConnectionFailed: 'connection_failed',
160
+ connection_failed: 'connection_failed',
161
+ NotConnected: 'device_disconnected',
162
+ not_connected: 'device_disconnected',
163
+ TruncatedPacket: 'protocol_error',
164
+ truncated_packet: 'protocol_error',
165
+ UnknownPacket: 'protocol_error',
166
+ unknown_packet: 'protocol_error',
167
+ ProtocolRejected: 'protocol_error',
168
+ protocol_rejected: 'protocol_error',
169
+ PayloadTooLarge: 'protocol_error',
170
+ payload_too_large: 'protocol_error',
171
+ PersistenceFailed: 'storage_unavailable',
172
+ persistence_failed: 'storage_unavailable',
173
+ Timeout: 'connection_failed',
174
+ timeout: 'connection_failed',
175
+ IntegrityFailed: 'integrity_failed',
176
+ integrity_failed: 'integrity_failed',
177
+ UploadOwnershipUnknown: 'upload_failed',
178
+ upload_ownership_unknown: 'upload_failed',
179
+ DownloadFailed: 'upload_failed',
180
+ download_failed: 'upload_failed',
181
+ Cancelled: 'cancelled',
182
+ cancelled: 'cancelled',
183
+ };
184
+ const CORE_OPERATIONS = {
185
+ Connect: 'connect',
186
+ connect: 'connect',
187
+ Reconnect: 'reconnect',
188
+ reconnect: 'reconnect',
189
+ Provision: 'provision',
190
+ provision: 'provision',
191
+ TransferRecording: 'transfer_recording',
192
+ transfer_recording: 'transfer_recording',
193
+ Upload: 'upload',
194
+ upload: 'upload',
195
+ UpdateFirmware: 'update_firmware',
196
+ update_firmware: 'update_firmware',
197
+ ReadDeviceLogs: 'read_device_logs',
198
+ read_device_logs: 'read_device_logs',
199
+ Decode: 'read_snapshot',
200
+ decode: 'read_snapshot',
201
+ Validate: 'unknown',
202
+ validate: 'unknown',
203
+ };
204
+ export function normalizeCoreError(error, fallbackOperation) {
205
+ if (error instanceof BotaSDKError)
206
+ return error;
207
+ if (typeof error === 'object' && error !== null) {
208
+ const structured = error;
209
+ if (typeof structured.code === 'string') {
210
+ const operation = typeof structured.operation === 'string'
211
+ ? (CORE_OPERATIONS[structured.operation] ?? fallbackOperation)
212
+ : fallbackOperation;
213
+ const code = operation === 'update_firmware'
214
+ && (structured.code === 'ProtocolRejected'
215
+ || structured.code === 'protocol_rejected')
216
+ ? 'firmware_rejected'
217
+ : (CORE_CODES[structured.code] ?? 'internal_error');
218
+ return new BotaSDKError(code, operation, {
219
+ retryable: structured.retryable === true,
220
+ protocolStatus: typeof structured.protocol_status === 'number'
221
+ ? structured.protocol_status
222
+ : typeof structured.protocolStatus === 'number'
223
+ ? structured.protocolStatus
224
+ : null,
225
+ cause: error,
226
+ });
227
+ }
228
+ }
229
+ return new BotaSDKError('internal_error', fallbackOperation, { cause: error });
230
+ }
package/dist/gatt.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ export declare const DEVICE_INFORMATION_SERVICE = "0000180a-0000-1000-8000-00805f9b34fb";
2
+ export declare const SERIAL_NUMBER_CHARACTERISTIC = "00002a25-0000-1000-8000-00805f9b34fb";
3
+ export declare const MODEL_NUMBER_CHARACTERISTIC = "00002a24-0000-1000-8000-00805f9b34fb";
4
+ export declare const HARDWARE_REVISION_CHARACTERISTIC = "00002a27-0000-1000-8000-00805f9b34fb";
5
+ export declare const FIRMWARE_REVISION_CHARACTERISTIC = "00002a26-0000-1000-8000-00805f9b34fb";
6
+ export declare const BOTA_CONTROL_SERVICE = "b07a0002-0000-1000-8000-00805f9b34fb";
7
+ export declare const DEVICE_STATUS_CHARACTERISTIC = "b07a0002-0001-1000-8000-00805f9b34fb";
8
+ export declare const DEVICE_COMMAND_CHARACTERISTIC = "b07a0002-0005-1000-8000-00805f9b34fb";
9
+ export declare const RECORDING_CONTROL_CHARACTERISTIC = "b07a0002-0002-1000-8000-00805f9b34fb";
10
+ export declare const RECORDING_STATUS_CHARACTERISTIC = "b07a0002-0003-1000-8000-00805f9b34fb";
11
+ export declare const BOTA_PROVISIONING_SERVICE = "b07a0003-0000-1000-8000-00805f9b34fb";
12
+ export declare const DEVICE_TOKEN_CHARACTERISTIC = "b07a0003-0002-1000-8000-00805f9b34fb";
13
+ export declare const API_ENDPOINT_CHARACTERISTIC = "b07a0003-0003-1000-8000-00805f9b34fb";
14
+ export declare const PROVISIONING_RESULT_CHARACTERISTIC = "b07a0003-0005-1000-8000-00805f9b34fb";
15
+ export declare const DEVICE_SETTINGS_CHARACTERISTIC = "b07a0003-0006-1000-8000-00805f9b34fb";
16
+ export declare const BOTA_STORAGE_SERVICE = "b07a0004-0000-1000-8000-00805f9b34fb";
17
+ export declare const RECORDING_LIST_CHARACTERISTIC = "b07a0004-0002-1000-8000-00805f9b34fb";
18
+ export declare const RECORDING_TRANSFER_CHARACTERISTIC = "b07a0004-0003-1000-8000-00805f9b34fb";
19
+ export declare const TRANSFER_CONTROL_CHARACTERISTIC = "b07a0004-0004-1000-8000-00805f9b34fb";
20
+ export declare const STORAGE_TRANSFER_CAPABILITIES_V2_CHARACTERISTIC = "b07a0004-0006-1000-8000-00805f9b34fb";
21
+ export declare const ENCRYPTED_UPLOAD_V2_CAPABILITY_CHARACTERISTIC = "b07a0004-0006-1000-8000-00805f9b34fb";
22
+ export declare const TRANSFER_SIGNED_BLOB_V2_CHARACTERISTIC = "b07a0004-0007-1000-8000-00805f9b34fb";
23
+ export declare const TRANSFER_CONTROL_V2_CHARACTERISTIC = "b07a0004-0008-1000-8000-00805f9b34fb";
24
+ export declare const RECORDING_TRANSFER_V2_CHARACTERISTIC = "b07a0004-0009-1000-8000-00805f9b34fb";
25
+ export declare const TRANSFER_STATUS_V2_CHARACTERISTIC = "b07a0004-000a-1000-8000-00805f9b34fb";
26
+ export declare const RECORDING_LIST_V2_CHARACTERISTIC = "b07a0004-000b-1000-8000-00805f9b34fb";
27
+ export declare const BOTA_AUTH_SERVICE = "b07a0005-0000-1000-8000-00805f9b34fb";
28
+ export declare const DEVICE_PUBLIC_KEY_CHARACTERISTIC = "b07a0005-0001-1000-8000-00805f9b34fb";
29
+ export declare const AUTH_NONCE_CHARACTERISTIC = "b07a0005-0002-1000-8000-00805f9b34fb";
30
+ export declare const BOTA_WIFI_CONFIG_SERVICE = "b07a0006-0000-1000-8000-00805f9b34fb";
31
+ export declare const WIFI_GRANT_CHARACTERISTIC = "b07a0006-0001-1000-8000-00805f9b34fb";
32
+ export declare const WIFI_CREDENTIAL_CHARACTERISTIC = "b07a0006-0002-1000-8000-00805f9b34fb";
33
+ export declare const WIFI_STATUS_CHARACTERISTIC = "b07a0006-0003-1000-8000-00805f9b34fb";
34
+ export declare const WIFI_SCAN_CHARACTERISTIC = "b07a0006-0004-1000-8000-00805f9b34fb";
35
+ export declare const BOTA_DIAGNOSTICS_SERVICE = "b07a0007-0000-1000-8000-00805f9b34fb";
36
+ export declare const DEVICE_LOG_CONTROL_CHARACTERISTIC = "b07a0007-0001-1000-8000-00805f9b34fb";
37
+ export declare const DEVICE_LOG_DATA_CHARACTERISTIC = "b07a0007-0002-1000-8000-00805f9b34fb";
38
+ export declare const FOREGROUND_GATT_SERVICES: readonly ["0000180a-0000-1000-8000-00805f9b34fb", "b07a0002-0000-1000-8000-00805f9b34fb", "b07a0003-0000-1000-8000-00805f9b34fb", "b07a0004-0000-1000-8000-00805f9b34fb", "b07a0005-0000-1000-8000-00805f9b34fb", "b07a0006-0000-1000-8000-00805f9b34fb", "b07a0007-0000-1000-8000-00805f9b34fb"];
39
+ export declare function canonicalGattUuid(uuid: string): string;
package/dist/gatt.js ADDED
@@ -0,0 +1,57 @@
1
+ const BLUETOOTH_BASE_UUID_SUFFIX = '-0000-1000-8000-00805f9b34fb';
2
+ export const DEVICE_INFORMATION_SERVICE = `0000180a${BLUETOOTH_BASE_UUID_SUFFIX}`;
3
+ export const SERIAL_NUMBER_CHARACTERISTIC = `00002a25${BLUETOOTH_BASE_UUID_SUFFIX}`;
4
+ export const MODEL_NUMBER_CHARACTERISTIC = `00002a24${BLUETOOTH_BASE_UUID_SUFFIX}`;
5
+ export const HARDWARE_REVISION_CHARACTERISTIC = `00002a27${BLUETOOTH_BASE_UUID_SUFFIX}`;
6
+ export const FIRMWARE_REVISION_CHARACTERISTIC = `00002a26${BLUETOOTH_BASE_UUID_SUFFIX}`;
7
+ export const BOTA_CONTROL_SERVICE = `b07a0002${BLUETOOTH_BASE_UUID_SUFFIX}`;
8
+ export const DEVICE_STATUS_CHARACTERISTIC = 'b07a0002-0001-1000-8000-00805f9b34fb';
9
+ export const DEVICE_COMMAND_CHARACTERISTIC = 'b07a0002-0005-1000-8000-00805f9b34fb';
10
+ export const RECORDING_CONTROL_CHARACTERISTIC = 'b07a0002-0002-1000-8000-00805f9b34fb';
11
+ export const RECORDING_STATUS_CHARACTERISTIC = 'b07a0002-0003-1000-8000-00805f9b34fb';
12
+ export const BOTA_PROVISIONING_SERVICE = `b07a0003${BLUETOOTH_BASE_UUID_SUFFIX}`;
13
+ export const DEVICE_TOKEN_CHARACTERISTIC = 'b07a0003-0002-1000-8000-00805f9b34fb';
14
+ export const API_ENDPOINT_CHARACTERISTIC = 'b07a0003-0003-1000-8000-00805f9b34fb';
15
+ export const PROVISIONING_RESULT_CHARACTERISTIC = 'b07a0003-0005-1000-8000-00805f9b34fb';
16
+ export const DEVICE_SETTINGS_CHARACTERISTIC = 'b07a0003-0006-1000-8000-00805f9b34fb';
17
+ export const BOTA_STORAGE_SERVICE = `b07a0004${BLUETOOTH_BASE_UUID_SUFFIX}`;
18
+ export const RECORDING_LIST_CHARACTERISTIC = 'b07a0004-0002-1000-8000-00805f9b34fb';
19
+ export const RECORDING_TRANSFER_CHARACTERISTIC = 'b07a0004-0003-1000-8000-00805f9b34fb';
20
+ export const TRANSFER_CONTROL_CHARACTERISTIC = 'b07a0004-0004-1000-8000-00805f9b34fb';
21
+ export const STORAGE_TRANSFER_CAPABILITIES_V2_CHARACTERISTIC = 'b07a0004-0006-1000-8000-00805f9b34fb';
22
+ export const ENCRYPTED_UPLOAD_V2_CAPABILITY_CHARACTERISTIC = STORAGE_TRANSFER_CAPABILITIES_V2_CHARACTERISTIC;
23
+ export const TRANSFER_SIGNED_BLOB_V2_CHARACTERISTIC = 'b07a0004-0007-1000-8000-00805f9b34fb';
24
+ export const TRANSFER_CONTROL_V2_CHARACTERISTIC = 'b07a0004-0008-1000-8000-00805f9b34fb';
25
+ export const RECORDING_TRANSFER_V2_CHARACTERISTIC = 'b07a0004-0009-1000-8000-00805f9b34fb';
26
+ export const TRANSFER_STATUS_V2_CHARACTERISTIC = 'b07a0004-000a-1000-8000-00805f9b34fb';
27
+ export const RECORDING_LIST_V2_CHARACTERISTIC = 'b07a0004-000b-1000-8000-00805f9b34fb';
28
+ export const BOTA_AUTH_SERVICE = `b07a0005${BLUETOOTH_BASE_UUID_SUFFIX}`;
29
+ export const DEVICE_PUBLIC_KEY_CHARACTERISTIC = 'b07a0005-0001-1000-8000-00805f9b34fb';
30
+ export const AUTH_NONCE_CHARACTERISTIC = 'b07a0005-0002-1000-8000-00805f9b34fb';
31
+ export const BOTA_WIFI_CONFIG_SERVICE = `b07a0006${BLUETOOTH_BASE_UUID_SUFFIX}`;
32
+ export const WIFI_GRANT_CHARACTERISTIC = 'b07a0006-0001-1000-8000-00805f9b34fb';
33
+ export const WIFI_CREDENTIAL_CHARACTERISTIC = 'b07a0006-0002-1000-8000-00805f9b34fb';
34
+ export const WIFI_STATUS_CHARACTERISTIC = 'b07a0006-0003-1000-8000-00805f9b34fb';
35
+ export const WIFI_SCAN_CHARACTERISTIC = 'b07a0006-0004-1000-8000-00805f9b34fb';
36
+ export const BOTA_DIAGNOSTICS_SERVICE = `b07a0007${BLUETOOTH_BASE_UUID_SUFFIX}`;
37
+ export const DEVICE_LOG_CONTROL_CHARACTERISTIC = 'b07a0007-0001-1000-8000-00805f9b34fb';
38
+ export const DEVICE_LOG_DATA_CHARACTERISTIC = 'b07a0007-0002-1000-8000-00805f9b34fb';
39
+ export const FOREGROUND_GATT_SERVICES = Object.freeze([
40
+ DEVICE_INFORMATION_SERVICE,
41
+ BOTA_CONTROL_SERVICE,
42
+ BOTA_PROVISIONING_SERVICE,
43
+ BOTA_STORAGE_SERVICE,
44
+ BOTA_AUTH_SERVICE,
45
+ BOTA_WIFI_CONFIG_SERVICE,
46
+ BOTA_DIAGNOSTICS_SERVICE,
47
+ ]);
48
+ export function canonicalGattUuid(uuid) {
49
+ const normalized = uuid.toLowerCase();
50
+ if (/^[0-9a-f]{4}$/.test(normalized)) {
51
+ return `0000${normalized}${BLUETOOTH_BASE_UUID_SUFFIX}`;
52
+ }
53
+ if (/^[0-9a-f]{8}$/.test(normalized)) {
54
+ return `${normalized}${BLUETOOTH_BASE_UUID_SUFFIX}`;
55
+ }
56
+ return normalized;
57
+ }
@@ -0,0 +1,202 @@
1
+ /**
2
+ * @param {Uint8Array} bytes
3
+ * @returns {any}
4
+ */
5
+ export function decodeConnectionSettings(bytes: Uint8Array): any;
6
+ /**
7
+ * @param {Uint8Array} bytes
8
+ * @returns {any}
9
+ */
10
+ export function decodeDeprovisionResult(bytes: Uint8Array): any;
11
+ /**
12
+ * @param {Uint8Array} bytes
13
+ * @returns {any}
14
+ */
15
+ export function decodeDeviceStatus(bytes: Uint8Array): any;
16
+ /**
17
+ * @param {Uint8Array} bytes
18
+ * @returns {any}
19
+ */
20
+ export function decodeEncryptedUploadV2Capabilities(bytes: Uint8Array): any;
21
+ /**
22
+ * @param {Uint8Array} bytes
23
+ * @returns {any}
24
+ */
25
+ export function decodeEncryptedUploadV2SignedBlobResult(bytes: Uint8Array): any;
26
+ /**
27
+ * @param {Uint8Array} bytes
28
+ * @returns {any}
29
+ */
30
+ export function decodeEncryptedUploadV2Status(bytes: Uint8Array): any;
31
+ /**
32
+ * @param {Uint8Array} bytes
33
+ * @returns {any}
34
+ */
35
+ export function decodeEncryptedUploadV2Transfer(bytes: Uint8Array): any;
36
+ /**
37
+ * @param {Uint8Array} bytes
38
+ * @returns {any}
39
+ */
40
+ export function decodeRecordingControlResult(bytes: Uint8Array): any;
41
+ /**
42
+ * @param {Uint8Array} bytes
43
+ * @returns {any}
44
+ */
45
+ export function decodeRecordingList(bytes: Uint8Array): any;
46
+ /**
47
+ * @param {Uint8Array} bytes
48
+ * @returns {any}
49
+ */
50
+ export function decodeWiFiConfigResult(bytes: Uint8Array): any;
51
+ /**
52
+ * @param {Uint8Array} bytes
53
+ * @returns {any}
54
+ */
55
+ export function decodeWiFiScanUpdate(bytes: Uint8Array): any;
56
+ /**
57
+ * @param {Uint8Array} bytes
58
+ * @returns {any}
59
+ */
60
+ export function decodeWiFiStatus(bytes: Uint8Array): any;
61
+ /**
62
+ * @param {any} settings
63
+ * @param {string} model
64
+ * @returns {Uint8Array}
65
+ */
66
+ export function encodeConnectionSettings(settings: any, model: string): Uint8Array;
67
+ /**
68
+ * @returns {Uint8Array}
69
+ */
70
+ export function encodeDeprovisionCommand(): Uint8Array;
71
+ /**
72
+ * @param {any} frame
73
+ * @returns {Uint8Array}
74
+ */
75
+ export function encodeEncryptedUploadV2SignedBlob(frame: any): Uint8Array;
76
+ /**
77
+ * @param {any} frame
78
+ * @returns {Uint8Array}
79
+ */
80
+ export function encodeEncryptedUploadV2Transfer(frame: any): Uint8Array;
81
+ /**
82
+ * @param {string} recording_uuid
83
+ * @returns {Uint8Array}
84
+ */
85
+ export function encodeRecordingConfirm(recording_uuid: string): Uint8Array;
86
+ /**
87
+ * @param {string} action
88
+ * @returns {Uint8Array}
89
+ */
90
+ export function encodeRecordingControlCommand(action: string): Uint8Array;
91
+ /**
92
+ * @returns {Uint8Array}
93
+ */
94
+ export function encodeRecordingListCommand(): Uint8Array;
95
+ /**
96
+ * @param {string} ssid
97
+ * @param {string} password
98
+ * @returns {Uint8Array}
99
+ */
100
+ export function encodeWiFiCredentials(ssid: string, password: string): Uint8Array;
101
+ /**
102
+ * @param {string} grant
103
+ * @param {number} capacity
104
+ * @returns {Uint8Array}
105
+ */
106
+ export function encodeWiFiGrant(grant: string, capacity: number): Uint8Array;
107
+ /**
108
+ * @returns {Uint8Array}
109
+ */
110
+ export function encodeWiFiScanCommand(): Uint8Array;
111
+ export class WebCoreBridge {
112
+ __destroy_into_raw(): any;
113
+ __wbg_ptr: any;
114
+ free(): void;
115
+ /**
116
+ * @param {Uint8Array} cancellation_id
117
+ * @returns {any}
118
+ */
119
+ cancel(cancellation_id: Uint8Array): any;
120
+ /**
121
+ * @param {any} event
122
+ * @returns {any}
123
+ */
124
+ dispatch(event: any): any;
125
+ /**
126
+ * @param {any} input
127
+ * @returns {any}
128
+ */
129
+ startDeviceLogs(input: any): any;
130
+ /**
131
+ * @param {any} input
132
+ * @returns {any}
133
+ */
134
+ startEncryptedUploadV2(input: any): any;
135
+ /**
136
+ * @param {string} expected_serial
137
+ * @param {string} peripheral_id
138
+ * @param {string | null | undefined} name
139
+ * @param {Uint8Array} cancellation_id
140
+ * @returns {any}
141
+ */
142
+ startExactConnection(expected_serial: string, peripheral_id: string, name: string | null | undefined, cancellation_id: Uint8Array): any;
143
+ /**
144
+ * @param {any} input
145
+ * @returns {any}
146
+ */
147
+ startFirmwareUpdate(input: any): any;
148
+ /**
149
+ * @param {any} input
150
+ * @returns {any}
151
+ */
152
+ startProvisioning(input: any): any;
153
+ /**
154
+ * @param {any} input
155
+ * @returns {any}
156
+ */
157
+ startReconnect(input: any): any;
158
+ /**
159
+ * @param {any} input
160
+ * @returns {any}
161
+ */
162
+ startRecordingTransfer(input: any): any;
163
+ /**
164
+ * @returns {any}
165
+ */
166
+ status(): any;
167
+ /**
168
+ * @param {any} capabilities
169
+ * @returns {boolean}
170
+ */
171
+ supportsEncryptedUploadV2Batch(capabilities: any): boolean;
172
+ /**
173
+ * @param {any} capabilities
174
+ * @param {number} recording_generation
175
+ * @param {number} storage_format
176
+ */
177
+ validateEncryptedUploadV2Profile(capabilities: any, recording_generation: number, storage_format: number): void;
178
+ }
179
+ export class WebIntegrityHasher {
180
+ __destroy_into_raw(): any;
181
+ __wbg_ptr: any;
182
+ free(): void;
183
+ /**
184
+ * @returns {number}
185
+ */
186
+ crc32(): number;
187
+ /**
188
+ * @returns {bigint}
189
+ */
190
+ length(): bigint;
191
+ /**
192
+ * @returns {Uint8Array}
193
+ */
194
+ sha256Snapshot(): Uint8Array;
195
+ /**
196
+ * @param {Uint8Array} bytes
197
+ */
198
+ update(bytes: Uint8Array): void;
199
+ }
200
+ export function initSync(module: any): any;
201
+ declare function __wbg_init(module_or_path: any): Promise<any>;
202
+ export { __wbg_init as default };