-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathworker-configuration.d.ts
5712 lines (5710 loc) · 229 KB
/
worker-configuration.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Generated by Wrangler by running `wrangler types` (hash: caae3a793aa8a4245b4fde088f2f0978)
// Runtime types generated with [email protected] 2024-05-12
declare namespace Cloudflare {
interface Env {
SUDOS: KVNamespace;
CODES: KVNamespace;
ENV: "development" | "production";
NETWORK_PASSPHRASE: "Test SDF Network ; September 2015" | "Public Global Stellar Network ; September 2015";
NATIVE_CONTRACT_ID: "CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC" | "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA";
RPC_URLS: string;
MOCK_SK: string;
FUND_SK: string;
JWT_SECRET: string;
CREDITS_DURABLE_OBJECT: DurableObjectNamespace<import("./dist/index").CreditsDurableObject>;
SEQUENCER_DURABLE_OBJECT: DurableObjectNamespace<import("./dist/index").SequencerDurableObject>;
MONITOR_DURABLE_OBJECT: DurableObjectNamespace<import("./dist/index").MonitorDurableObject>;
DB: D1Database;
EMAIL: SendEmail;
}
}
interface Env extends Cloudflare.Env {}
// Begin runtime types
/*! *****************************************************************************
Copyright (c) Cloudflare. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* eslint-disable */
// noinspection JSUnusedGlobalSymbols
declare var onmessage: never;
/**
* An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
*/
declare class DOMException extends Error {
constructor(message?: string, name?: string);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
readonly message: string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
readonly name: string;
/**
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
*/
readonly code: number;
static readonly INDEX_SIZE_ERR: number;
static readonly DOMSTRING_SIZE_ERR: number;
static readonly HIERARCHY_REQUEST_ERR: number;
static readonly WRONG_DOCUMENT_ERR: number;
static readonly INVALID_CHARACTER_ERR: number;
static readonly NO_DATA_ALLOWED_ERR: number;
static readonly NO_MODIFICATION_ALLOWED_ERR: number;
static readonly NOT_FOUND_ERR: number;
static readonly NOT_SUPPORTED_ERR: number;
static readonly INUSE_ATTRIBUTE_ERR: number;
static readonly INVALID_STATE_ERR: number;
static readonly SYNTAX_ERR: number;
static readonly INVALID_MODIFICATION_ERR: number;
static readonly NAMESPACE_ERR: number;
static readonly INVALID_ACCESS_ERR: number;
static readonly VALIDATION_ERR: number;
static readonly TYPE_MISMATCH_ERR: number;
static readonly SECURITY_ERR: number;
static readonly NETWORK_ERR: number;
static readonly ABORT_ERR: number;
static readonly URL_MISMATCH_ERR: number;
static readonly QUOTA_EXCEEDED_ERR: number;
static readonly TIMEOUT_ERR: number;
static readonly INVALID_NODE_TYPE_ERR: number;
static readonly DATA_CLONE_ERR: number;
get stack(): any;
set stack(value: any);
}
type WorkerGlobalScopeEventMap = {
fetch: FetchEvent;
scheduled: ScheduledEvent;
queue: QueueEvent;
unhandledrejection: PromiseRejectionEvent;
rejectionhandled: PromiseRejectionEvent;
};
declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
EventTarget: typeof EventTarget;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */
interface Console {
"assert"(condition?: boolean, ...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) */
clear(): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */
count(label?: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countreset_static) */
countReset(label?: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
debug(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */
dir(item?: any, options?: any): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */
dirxml(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */
error(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */
group(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupcollapsed_static) */
groupCollapsed(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupend_static) */
groupEnd(): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
info(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */
log(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) */
table(tabularData?: any, properties?: string[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
time(label?: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeend_static) */
timeEnd(label?: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timelog_static) */
timeLog(label?: string, ...data: any[]): void;
timeStamp(label?: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
trace(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */
warn(...data: any[]): void;
}
declare const console: Console;
type BufferSource = ArrayBufferView | ArrayBuffer;
type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
declare namespace WebAssembly {
class CompileError extends Error {
constructor(message?: string);
}
class RuntimeError extends Error {
constructor(message?: string);
}
type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64" | "v128";
interface GlobalDescriptor {
value: ValueType;
mutable?: boolean;
}
class Global {
constructor(descriptor: GlobalDescriptor, value?: any);
value: any;
valueOf(): any;
}
type ImportValue = ExportValue | number;
type ModuleImports = Record<string, ImportValue>;
type Imports = Record<string, ModuleImports>;
type ExportValue = Function | Global | Memory | Table;
type Exports = Record<string, ExportValue>;
class Instance {
constructor(module: Module, imports?: Imports);
readonly exports: Exports;
}
interface MemoryDescriptor {
initial: number;
maximum?: number;
shared?: boolean;
}
class Memory {
constructor(descriptor: MemoryDescriptor);
readonly buffer: ArrayBuffer;
grow(delta: number): number;
}
type ImportExportKind = "function" | "global" | "memory" | "table";
interface ModuleExportDescriptor {
kind: ImportExportKind;
name: string;
}
interface ModuleImportDescriptor {
kind: ImportExportKind;
module: string;
name: string;
}
abstract class Module {
static customSections(module: Module, sectionName: string): ArrayBuffer[];
static exports(module: Module): ModuleExportDescriptor[];
static imports(module: Module): ModuleImportDescriptor[];
}
type TableKind = "anyfunc" | "externref";
interface TableDescriptor {
element: TableKind;
initial: number;
maximum?: number;
}
class Table {
constructor(descriptor: TableDescriptor, value?: any);
readonly length: number;
get(index: number): any;
grow(delta: number, value?: any): number;
set(index: number, value?: any): void;
}
function instantiate(module: Module, imports?: Imports): Promise<Instance>;
function validate(bytes: BufferSource): boolean;
}
/**
* This ServiceWorker API interface represents the global execution context of a service worker.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)
*/
interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
DOMException: typeof DOMException;
WorkerGlobalScope: typeof WorkerGlobalScope;
btoa(data: string): string;
atob(data: string): string;
setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
clearTimeout(timeoutId: number | null): void;
setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
clearInterval(timeoutId: number | null): void;
queueMicrotask(task: Function): void;
structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
reportError(error: any): void;
fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;
self: ServiceWorkerGlobalScope;
crypto: Crypto;
caches: CacheStorage;
scheduler: Scheduler;
performance: Performance;
Cloudflare: Cloudflare;
readonly origin: string;
Event: typeof Event;
ExtendableEvent: typeof ExtendableEvent;
CustomEvent: typeof CustomEvent;
PromiseRejectionEvent: typeof PromiseRejectionEvent;
FetchEvent: typeof FetchEvent;
TailEvent: typeof TailEvent;
TraceEvent: typeof TailEvent;
ScheduledEvent: typeof ScheduledEvent;
MessageEvent: typeof MessageEvent;
CloseEvent: typeof CloseEvent;
ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;
ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;
ReadableStream: typeof ReadableStream;
WritableStream: typeof WritableStream;
WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;
TransformStream: typeof TransformStream;
ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
CountQueuingStrategy: typeof CountQueuingStrategy;
ErrorEvent: typeof ErrorEvent;
EventSource: typeof EventSource;
ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;
ReadableStreamDefaultController: typeof ReadableStreamDefaultController;
ReadableByteStreamController: typeof ReadableByteStreamController;
WritableStreamDefaultController: typeof WritableStreamDefaultController;
TransformStreamDefaultController: typeof TransformStreamDefaultController;
CompressionStream: typeof CompressionStream;
DecompressionStream: typeof DecompressionStream;
TextEncoderStream: typeof TextEncoderStream;
TextDecoderStream: typeof TextDecoderStream;
Headers: typeof Headers;
Body: typeof Body;
Request: typeof Request;
Response: typeof Response;
WebSocket: typeof WebSocket;
WebSocketPair: typeof WebSocketPair;
WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
AbortController: typeof AbortController;
AbortSignal: typeof AbortSignal;
TextDecoder: typeof TextDecoder;
TextEncoder: typeof TextEncoder;
navigator: Navigator;
Navigator: typeof Navigator;
URL: typeof URL;
URLSearchParams: typeof URLSearchParams;
URLPattern: typeof URLPattern;
Blob: typeof Blob;
File: typeof File;
FormData: typeof FormData;
Crypto: typeof Crypto;
SubtleCrypto: typeof SubtleCrypto;
CryptoKey: typeof CryptoKey;
CacheStorage: typeof CacheStorage;
Cache: typeof Cache;
FixedLengthStream: typeof FixedLengthStream;
IdentityTransformStream: typeof IdentityTransformStream;
HTMLRewriter: typeof HTMLRewriter;
GPUAdapter: typeof GPUAdapter;
GPUOutOfMemoryError: typeof GPUOutOfMemoryError;
GPUValidationError: typeof GPUValidationError;
GPUInternalError: typeof GPUInternalError;
GPUDeviceLostInfo: typeof GPUDeviceLostInfo;
GPUBufferUsage: typeof GPUBufferUsage;
GPUShaderStage: typeof GPUShaderStage;
GPUMapMode: typeof GPUMapMode;
GPUTextureUsage: typeof GPUTextureUsage;
GPUColorWrite: typeof GPUColorWrite;
}
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */
declare function btoa(data: string): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */
declare function atob(data: string): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
declare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearTimeout) */
declare function clearTimeout(timeoutId: number | null): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
declare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
declare function clearInterval(timeoutId: number | null): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
declare function queueMicrotask(task: Function): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
declare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/reportError) */
declare function reportError(error: any): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
declare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;
declare const self: ServiceWorkerGlobalScope;
/**
* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
* The Workers runtime implements the full surface of this API, but with some differences in
* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
* compared to those implemented in most browsers.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
*/
declare const crypto: Crypto;
/**
* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
*/
declare const caches: CacheStorage;
declare const scheduler: Scheduler;
/**
* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
* as well as timing of subrequests and other operations.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
*/
declare const performance: Performance;
declare const Cloudflare: Cloudflare;
declare const origin: string;
declare const navigator: Navigator;
interface TestController {
}
interface ExecutionContext {
waitUntil(promise: Promise<any>): void;
passThroughOnException(): void;
props: any;
}
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext) => Response | Promise<Response>;
type ExportedHandlerTailHandler<Env = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise<void>;
type ExportedHandlerTraceHandler<Env = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise<void>;
type ExportedHandlerTailStreamHandler<Env = unknown> = (event: TailStream.TailEvent, env: Env, ctx: ExecutionContext) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
type ExportedHandlerScheduledHandler<Env = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext) => void | Promise<void>;
type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext) => void | Promise<void>;
type ExportedHandlerTestHandler<Env = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext) => void | Promise<void>;
interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown> {
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
tail?: ExportedHandlerTailHandler<Env>;
trace?: ExportedHandlerTraceHandler<Env>;
tailStream?: ExportedHandlerTailStreamHandler<Env>;
scheduled?: ExportedHandlerScheduledHandler<Env>;
test?: ExportedHandlerTestHandler<Env>;
email?: EmailExportedHandler<Env>;
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
}
interface StructuredSerializeOptions {
transfer?: any[];
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent) */
declare abstract class PromiseRejectionEvent extends Event {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */
readonly promise: Promise<any>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
readonly reason: any;
}
declare abstract class Navigator {
sendBeacon(url: string, body?: (ReadableStream | string | (ArrayBuffer | ArrayBufferView) | Blob | FormData | URLSearchParams | URLSearchParams)): boolean;
readonly userAgent: string;
readonly gpu?: GPU;
}
/**
* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
* as well as timing of subrequests and other operations.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
*/
interface Performance {
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
readonly timeOrigin: number;
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
now(): number;
}
interface AlarmInvocationInfo {
readonly isRetry: boolean;
readonly retryCount: number;
}
interface Cloudflare {
readonly compatibilityFlags: Record<string, boolean>;
}
interface DurableObject {
fetch(request: Request): Response | Promise<Response>;
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;
webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
}
type DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"> & {
readonly id: DurableObjectId;
readonly name?: string;
};
interface DurableObjectId {
toString(): string;
equals(other: DurableObjectId): boolean;
readonly name?: string;
}
interface DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {
newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;
idFromName(name: string): DurableObjectId;
idFromString(id: string): DurableObjectId;
get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;
}
type DurableObjectJurisdiction = "eu" | "fedramp";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "oc" | "afr" | "me";
interface DurableObjectNamespaceGetDurableObjectOptions {
locationHint?: DurableObjectLocationHint;
}
interface DurableObjectState {
waitUntil(promise: Promise<any>): void;
readonly id: DurableObjectId;
readonly storage: DurableObjectStorage;
container?: Container;
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
getWebSockets(tag?: string): WebSocket[];
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
getHibernatableWebSocketEventTimeout(): number | null;
getTags(ws: WebSocket): string[];
abort(reason?: string): void;
}
interface DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;
list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;
put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
rollback(): void;
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
}
interface DurableObjectStorage {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;
list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;
put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
deleteAll(options?: DurableObjectPutOptions): Promise<void>;
transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
sync(): Promise<void>;
sql: SqlStorage;
transactionSync<T>(closure: () => T): T;
getCurrentBookmark(): Promise<string>;
getBookmarkForTime(timestamp: number | Date): Promise<string>;
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
}
interface DurableObjectListOptions {
start?: string;
startAfter?: string;
end?: string;
prefix?: string;
reverse?: boolean;
limit?: number;
allowConcurrency?: boolean;
noCache?: boolean;
}
interface DurableObjectGetOptions {
allowConcurrency?: boolean;
noCache?: boolean;
}
interface DurableObjectGetAlarmOptions {
allowConcurrency?: boolean;
}
interface DurableObjectPutOptions {
allowConcurrency?: boolean;
allowUnconfirmed?: boolean;
noCache?: boolean;
}
interface DurableObjectSetAlarmOptions {
allowConcurrency?: boolean;
allowUnconfirmed?: boolean;
}
declare class WebSocketRequestResponsePair {
constructor(request: string, response: string);
get request(): string;
get response(): string;
}
interface AnalyticsEngineDataset {
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
}
interface AnalyticsEngineDataPoint {
indexes?: ((ArrayBuffer | string) | null)[];
doubles?: number[];
blobs?: ((ArrayBuffer | string) | null)[];
}
/**
* An event which takes place in the DOM.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
*/
declare class Event {
constructor(type: string, init?: EventInit);
/**
* Returns the type of event, e.g. "click", "hashchange", or "submit".
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
*/
get type(): string;
/**
* Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
*/
get eventPhase(): number;
/**
* Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
*/
get composed(): boolean;
/**
* Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
*/
get bubbles(): boolean;
/**
* Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
*/
get cancelable(): boolean;
/**
* Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
*/
get defaultPrevented(): boolean;
/**
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
*/
get returnValue(): boolean;
/**
* Returns the object whose event listener's callback is currently being invoked.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
*/
get currentTarget(): EventTarget | undefined;
/**
* Returns the object to which event is dispatched (its target).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
*/
get target(): EventTarget | undefined;
/**
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
*/
get srcElement(): EventTarget | undefined;
/**
* Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
*/
get timeStamp(): number;
/**
* Returns true if event was dispatched by the user agent, and false otherwise.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
*/
get isTrusted(): boolean;
/**
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
get cancelBubble(): boolean;
/**
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
set cancelBubble(value: boolean);
/**
* Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
*/
stopImmediatePropagation(): void;
/**
* If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
*/
preventDefault(): void;
/**
* When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
*/
stopPropagation(): void;
/**
* Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
*/
composedPath(): EventTarget[];
static readonly NONE: number;
static readonly CAPTURING_PHASE: number;
static readonly AT_TARGET: number;
static readonly BUBBLING_PHASE: number;
}
interface EventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
}
type EventListener<EventType extends Event = Event> = (event: EventType) => void;
interface EventListenerObject<EventType extends Event = Event> {
handleEvent(event: EventType): void;
}
type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;
/**
* EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
*/
declare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {
constructor();
/**
* Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
*
* The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
*
* When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
*
* When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
*
* When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
*
* If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
*
* The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
*/
addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
/**
* Removes the event listener in target's event listener list with the same type, callback, and options.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
dispatchEvent(event: EventMap[keyof EventMap]): boolean;
}
interface EventTargetEventListenerOptions {
capture?: boolean;
}
interface EventTargetAddEventListenerOptions {
capture?: boolean;
passive?: boolean;
once?: boolean;
signal?: AbortSignal;
}
interface EventTargetHandlerObject {
handleEvent: (event: Event) => any | undefined;
}
/**
* A controller object that allows you to abort one or more DOM requests as and when desired.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)
*/
declare class AbortController {
constructor();
/**
* Returns the AbortSignal object associated with this object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
*/
get signal(): AbortSignal;
/**
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
*/
abort(reason?: any): void;
}
/**
* A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)
*/
declare abstract class AbortSignal extends EventTarget {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
static abort(reason?: any): AbortSignal;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
static timeout(delay: number): AbortSignal;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */
static any(signals: AbortSignal[]): AbortSignal;
/**
* Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
*/
get aborted(): boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */
get reason(): any;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
get onabort(): any | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
set onabort(value: any | null);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
throwIfAborted(): void;
}
interface Scheduler {
wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;
}
interface SchedulerWaitOptions {
signal?: AbortSignal;
}
/**
* Extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
*/
declare abstract class ExtendableEvent extends Event {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
waitUntil(promise: Promise<any>): void;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent) */
declare class CustomEvent<T = any> extends Event {
constructor(type: string, init?: CustomEventCustomEventInit);
/**
* Returns any custom data event was created with. Typically used for synthetic events.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
*/
get detail(): T;
}
interface CustomEventCustomEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
detail?: any;
}
/**
* A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)
*/
declare class Blob {
constructor(type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
get size(): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
get type(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
slice(start?: number, end?: number, type?: string): Blob;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
arrayBuffer(): Promise<ArrayBuffer>;
bytes(): Promise<Uint8Array>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
text(): Promise<string>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
stream(): ReadableStream;
}
interface BlobOptions {
type?: string;
}
/**
* Provides information about files and allows JavaScript in a web page to access their content.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)
*/
declare class File extends Blob {
constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
get name(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
get lastModified(): number;
}
interface FileOptions {
type?: string;
lastModified?: number;
}
/**
* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
*/
declare abstract class CacheStorage {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */
open(cacheName: string): Promise<Cache>;
readonly default: Cache;
}
/**
* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
*/
declare abstract class Cache {
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
put(request: RequestInfo | URL, response: Response): Promise<void>;
}
interface CacheQueryOptions {
ignoreMethod?: boolean;
}
/**
* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
* The Workers runtime implements the full surface of this API, but with some differences in
* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
* compared to those implemented in most browsers.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
*/
declare abstract class Crypto {
/**
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
*/
get subtle(): SubtleCrypto;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T;
/**
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
*/
randomUUID(): string;
DigestStream: typeof DigestStream;
}
/**
* This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto).
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)
*/
declare abstract class SubtleCrypto {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt) */
encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt) */
decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign) */
sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify) */
verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest) */
digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits) */
deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey) */
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey) */
wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;
}
/**
* The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
*/
declare abstract class CryptoKey {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
readonly type: string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
readonly extractable: boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
readonly usages: string[];
}
interface CryptoKeyPair {
publicKey: CryptoKey;
privateKey: CryptoKey;
}
interface JsonWebKey {
kty: string;
use?: string;
key_ops?: string[];
alg?: string;
ext?: boolean;
crv?: string;
x?: string;
y?: string;
d?: string;
n?: string;
e?: string;
p?: string;
q?: string;
dp?: string;
dq?: string;
qi?: string;
oth?: RsaOtherPrimesInfo[];
k?: string;
}
interface RsaOtherPrimesInfo {
r?: string;
d?: string;
t?: string;
}
interface SubtleCryptoDeriveKeyAlgorithm {
name: string;
salt?: ArrayBuffer;
iterations?: number;
hash?: (string | SubtleCryptoHashAlgorithm);
$public?: CryptoKey;
info?: ArrayBuffer;
}
interface SubtleCryptoEncryptAlgorithm {
name: string;
iv?: ArrayBuffer;
additionalData?: ArrayBuffer;
tagLength?: number;
counter?: ArrayBuffer;
length?: number;
label?: ArrayBuffer;
}
interface SubtleCryptoGenerateKeyAlgorithm {
name: string;
hash?: (string | SubtleCryptoHashAlgorithm);
modulusLength?: number;
publicExponent?: ArrayBuffer;
length?: number;
namedCurve?: string;
}
interface SubtleCryptoHashAlgorithm {
name: string;
}
interface SubtleCryptoImportKeyAlgorithm {
name: string;
hash?: (string | SubtleCryptoHashAlgorithm);
length?: number;
namedCurve?: string;
compressed?: boolean;
}
interface SubtleCryptoSignAlgorithm {