frida-java-bridge 6.3.8 → 7.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/index.d.ts ADDED
@@ -0,0 +1,779 @@
1
+ declare module "frida-java-bridge" {
2
+ namespace Java {
3
+ /**
4
+ * Whether the current process has a Java runtime loaded. Do not invoke any other Java properties or
5
+ * methods unless this is the case.
6
+ */
7
+ const available: boolean;
8
+
9
+ /**
10
+ * Which version of Android we're running on.
11
+ */
12
+ const androidVersion: string;
13
+
14
+ const ACC_PUBLIC: number;
15
+ const ACC_PRIVATE: number;
16
+ const ACC_PROTECTED: number;
17
+ const ACC_STATIC: number;
18
+ const ACC_FINAL: number;
19
+ const ACC_SYNCHRONIZED: number;
20
+ const ACC_BRIDGE: number;
21
+ const ACC_VARARGS: number;
22
+ const ACC_NATIVE: number;
23
+ const ACC_ABSTRACT: number;
24
+ const ACC_STRICT: number;
25
+ const ACC_SYNTHETIC: number;
26
+
27
+ /**
28
+ * Calls `func` with the `obj` lock held.
29
+ *
30
+ * @param obj Instance whose lock to hold.
31
+ * @param fn Function to call with lock held.
32
+ */
33
+ function synchronized(obj: Wrapper, fn: () => void): void;
34
+
35
+ /**
36
+ * Enumerates loaded classes.
37
+ *
38
+ * @param callbacks Object with callbacks.
39
+ */
40
+ function enumerateLoadedClasses(callbacks: EnumerateLoadedClassesCallbacks): void;
41
+
42
+ /**
43
+ * Synchronous version of `enumerateLoadedClasses()`.
44
+ */
45
+ function enumerateLoadedClassesSync(): string[];
46
+
47
+ /**
48
+ * Enumerates class loaders.
49
+ *
50
+ * You may pass such a loader to `Java.ClassFactory.get()` to be able to
51
+ * `.use()` classes on the specified class loader.
52
+ *
53
+ * @param callbacks Object with callbacks.
54
+ */
55
+ function enumerateClassLoaders(callbacks: EnumerateClassLoadersCallbacks): void;
56
+
57
+ /**
58
+ * Synchronous version of `enumerateClassLoaders()`.
59
+ */
60
+ function enumerateClassLoadersSync(): Wrapper[];
61
+
62
+ /**
63
+ * Enumerates methods matching `query`.
64
+ *
65
+ * @param query Query specified as `class!method`, with globs permitted. May
66
+ * also be suffixed with `/` and one or more modifiers:
67
+ * - `i`: Case-insensitive matching.
68
+ * - `s`: Include method signatures, so e.g. `"putInt"` becomes
69
+ * `"putInt(java.lang.String, int): void"`.
70
+ * - `u`: User-defined classes only, ignoring system classes.
71
+ */
72
+ function enumerateMethods(query: string): EnumerateMethodsMatchGroup[];
73
+
74
+ /**
75
+ * Runs `fn` on the main thread of the VM.
76
+ *
77
+ * @param fn Function to run on the main thread of the VM.
78
+ */
79
+ function scheduleOnMainThread(fn: () => void): void;
80
+
81
+ /**
82
+ * Ensures that the current thread is attached to the VM and calls `fn`.
83
+ * (This isn't necessary in callbacks from Java.)
84
+ *
85
+ * Will defer calling `fn` if the app's class loader is not available yet.
86
+ * Use `Java.performNow()` if access to the app's classes is not needed.
87
+ *
88
+ * @param fn Function to run while attached to the VM.
89
+ */
90
+ function perform(fn: () => void): void;
91
+
92
+ /**
93
+ * Ensures that the current thread is attached to the VM and calls `fn`.
94
+ * (This isn't necessary in callbacks from Java.)
95
+ *
96
+ * @param fn Function to run while attached to the VM.
97
+ */
98
+ function performNow(fn: () => void): void;
99
+
100
+ /**
101
+ * Dynamically generates a JavaScript wrapper for `className` that you can
102
+ * instantiate objects from by calling `$new()` on to invoke a constructor.
103
+ * Call `$dispose()` on an instance to clean it up explicitly, or wait for
104
+ * the JavaScript object to get garbage-collected, or script to get
105
+ * unloaded. Static and non-static methods are available, and you can even
106
+ * replace method implementations.
107
+ *
108
+ * Uses the app's class loader, but you may access classes on other loaders
109
+ * by calling `Java.ClassFactory.get()`.
110
+ *
111
+ * @param className Canonical class name to get a wrapper for.
112
+ */
113
+ function use<T extends Members<T> = {}>(className: string): Wrapper<T>;
114
+
115
+ /**
116
+ * Opens the .dex file at `filePath`.
117
+ *
118
+ * @param filePath Path to .dex to open.
119
+ */
120
+ function openClassFile(filePath: string): DexFile;
121
+
122
+ /**
123
+ * Enumerates live instances of the `className` class by scanning the Java
124
+ * VM's heap.
125
+ *
126
+ * @param className Name of class to enumerate instances of.
127
+ * @param callbacks Object with callbacks.
128
+ */
129
+ function choose<T extends Members<T> = {}>(className: string, callbacks: ChooseCallbacks<T>): void;
130
+
131
+ /**
132
+ * Duplicates a JavaScript wrapper for later use outside replacement method.
133
+ *
134
+ * @param obj An existing wrapper retrieved from `this` in replacement method.
135
+ */
136
+ function retain<T extends Members<T> = {}>(obj: Wrapper<T>): Wrapper<T>;
137
+
138
+ /**
139
+ * Creates a JavaScript wrapper given the existing instance at `handle` of
140
+ * given class `klass` as returned from `Java.use()`.
141
+ *
142
+ * @param handle An existing wrapper or a JNI handle.
143
+ * @param klass Class wrapper for type to cast to.
144
+ */
145
+ function cast<From extends Members<From> = {}, To extends Members<To> = {}>(
146
+ handle: Wrapper<From> | NativePointerValue,
147
+ klass: Wrapper<To>,
148
+ ): Wrapper<To>;
149
+
150
+ /**
151
+ * Creates a Java array with elements of the specified `type`, from a
152
+ * JavaScript array `elements`. The resulting Java array behaves like
153
+ * a JS array, but can be passed by reference to Java APIs in order to
154
+ * allow them to modify its contents.
155
+ *
156
+ * @param type Type name of elements.
157
+ * @param elements Array of JavaScript values to use for constructing the
158
+ * Java array.
159
+ */
160
+ function array(type: string, elements: any[]): any[];
161
+
162
+ /**
163
+ * Generates a backtrace for the current thread.
164
+ *
165
+ * @param options Options to customize the stack-walking.
166
+ */
167
+ function backtrace(options?: BacktraceOptions): Backtrace;
168
+
169
+ /**
170
+ * Determines whether the caller is running on the main thread.
171
+ */
172
+ function isMainThread(): boolean;
173
+
174
+ /**
175
+ * Creates a new Java class.
176
+ *
177
+ * @param spec Object describing the class to be created.
178
+ */
179
+ function registerClass(spec: ClassSpec): Wrapper;
180
+
181
+ /**
182
+ * Forces the VM to execute everything with its interpreter. Necessary to
183
+ * prevent optimizations from bypassing method hooks in some cases, and
184
+ * allows ART's Instrumentation APIs to be used for tracing the runtime.
185
+ */
186
+ function deoptimizeEverything(): void;
187
+
188
+ /**
189
+ * Similar to deoptimizeEverything but only deoptimizes boot image code.
190
+ * Use with `dalvik.vm.dex2oat-flags --inline-max-code-units=0` for best
191
+ * results.
192
+ */
193
+ function deoptimizeBootImage(): void;
194
+
195
+ const vm: VM;
196
+
197
+ /**
198
+ * The default class factory used to implement e.g. `Java.use()`.
199
+ * Uses the application's main class loader.
200
+ */
201
+ const classFactory: ClassFactory;
202
+
203
+ interface EnumerateLoadedClassesCallbacks {
204
+ /**
205
+ * Called with the name of each currently loaded class, and a JNI
206
+ * reference for its Java Class object.
207
+ *
208
+ * Pass the `name` to `Java.use()` to get a JavaScript wrapper.
209
+ * You may also `Java.cast()` the `handle` to `java.lang.Class`.
210
+ */
211
+ onMatch: (name: string, handle: NativePointer) => void;
212
+
213
+ /**
214
+ * Called when all loaded classes have been enumerated.
215
+ */
216
+ onComplete: () => void;
217
+ }
218
+
219
+ interface EnumerateClassLoadersCallbacks {
220
+ /**
221
+ * Called with a `java.lang.ClassLoader` wrapper for each class loader
222
+ * found in the VM.
223
+ */
224
+ onMatch: (loader: Wrapper) => void;
225
+
226
+ /**
227
+ * Called when all class loaders have been enumerated.
228
+ */
229
+ onComplete: () => void;
230
+ }
231
+
232
+ /**
233
+ * Matching methods grouped by class loader.
234
+ */
235
+ interface EnumerateMethodsMatchGroup {
236
+ /**
237
+ * Class loader, or `null` for the bootstrap class loader.
238
+ *
239
+ * Typically passed to `ClassFactory.get()` to interact with classes of
240
+ * interest.
241
+ */
242
+ loader: Wrapper | null;
243
+
244
+ /**
245
+ * One or more matching classes that have one or more methods matching
246
+ * the given query.
247
+ */
248
+ classes: [EnumerateMethodsMatchClass, ...EnumerateMethodsMatchClass[]];
249
+ }
250
+
251
+ /**
252
+ * Class matching query which has one or more matching methods.
253
+ */
254
+ interface EnumerateMethodsMatchClass {
255
+ /**
256
+ * Class name that matched the given query.
257
+ */
258
+ name: string;
259
+
260
+ /**
261
+ * One or more matching method names, each followed by signature when
262
+ * the `s` modifier is used.
263
+ */
264
+ methods: [string, ...string[]];
265
+ }
266
+
267
+ interface ChooseCallbacks<T extends Members<T> = {}> {
268
+ /**
269
+ * Called with each live instance found with a ready-to-use `instance`
270
+ * just as if you would have called `Java.cast()` with a raw handle to
271
+ * this particular instance.
272
+ *
273
+ * May return `EnumerateAction.Stop` to stop the enumeration early.
274
+ */
275
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
276
+ onMatch: (instance: Wrapper<T>) => void | EnumerateAction;
277
+
278
+ /**
279
+ * Called when all instances have been enumerated.
280
+ */
281
+ onComplete: () => void;
282
+ }
283
+
284
+ /**
285
+ * Options that may be passed to `Java.backtrace()`.
286
+ */
287
+ interface BacktraceOptions {
288
+ /**
289
+ * Limit how many frames up the stack to walk. Defaults to 16.
290
+ */
291
+ limit?: number;
292
+ }
293
+
294
+ /**
295
+ * Backtrace returned by `Java.backtrace()`.
296
+ */
297
+ interface Backtrace {
298
+ /**
299
+ * ID that can be used for deduplicating identical backtraces.
300
+ */
301
+ id: string;
302
+
303
+ /**
304
+ * Stack frames.
305
+ */
306
+ frames: Frame[];
307
+ }
308
+
309
+ interface Frame {
310
+ /**
311
+ * Signature, e.g. `"Landroid/os/Looper;,loopOnce,(Landroid/os/Looper;JI)Z"`.
312
+ */
313
+ signature: string;
314
+
315
+ /**
316
+ * Where the code is from, i.e. the filesystem path to the `.dex` on Android.
317
+ */
318
+ origin: string;
319
+
320
+ /**
321
+ * Class name that method belongs to, e.g. `"android.os.Looper"`.
322
+ */
323
+ className: string;
324
+
325
+ /**
326
+ * Method name, e.g. `"loopOnce"`.
327
+ */
328
+ methodName: string;
329
+
330
+ /**
331
+ * Method flags. E.g. `Java.ACC_PUBLIC | Java.ACC_STATIC`.
332
+ */
333
+ methodFlags: number;
334
+
335
+ /**
336
+ * Source file name, e.g. `"Looper.java"`.
337
+ */
338
+ fileName: string;
339
+
340
+ /**
341
+ * Source line number, e.g. `201`.
342
+ */
343
+ lineNumber: number;
344
+ }
345
+
346
+ type Members<T> = Record<keyof T, MethodDispatcher | Field>;
347
+
348
+ /**
349
+ * Dynamically generated wrapper for any Java class, instance, or interface.
350
+ */
351
+ type Wrapper<T extends Members<T> = {}> =
352
+ & {
353
+ /**
354
+ * Automatically inject holder's type to all fields and methods
355
+ */
356
+ [K in keyof T]: T[K] extends Field<infer Value> ? Field<Value, T> : MethodDispatcher<T>;
357
+ }
358
+ & {
359
+ /**
360
+ * Allocates and initializes a new instance of the given class.
361
+ *
362
+ * Use this to create a new instance.
363
+ */
364
+ $new: MethodDispatcher<T>;
365
+
366
+ /**
367
+ * Allocates a new instance without initializing it.
368
+ *
369
+ * Call `$init()` to initialize it.
370
+ */
371
+ $alloc: MethodDispatcher<T>;
372
+
373
+ /**
374
+ * Initializes an instance that was allocated but not yet initialized.
375
+ * This wraps the constructor(s).
376
+ *
377
+ * Replace the `implementation` property to hook a given constructor.
378
+ */
379
+ $init: MethodDispatcher<T>;
380
+
381
+ /**
382
+ * Eagerly deletes the underlying JNI global reference without having to
383
+ * wait for the object to become unreachable and the JavaScript
384
+ * runtime's garbage collector to kick in (or script to be unloaded).
385
+ *
386
+ * Useful when a lot of short-lived objects are created in a loop and
387
+ * there's a risk of running out of global handles.
388
+ */
389
+ $dispose(): void;
390
+
391
+ /**
392
+ * Retrieves a `java.lang.Class` wrapper for the current class.
393
+ */
394
+ class: Wrapper;
395
+
396
+ /**
397
+ * Canonical name of class being wrapped.
398
+ */
399
+ $className: string;
400
+
401
+ /**
402
+ * Method and field names exposed by this object’s class, not including
403
+ * parent classes.
404
+ */
405
+ $ownMembers: string[];
406
+
407
+ /**
408
+ * Instance used for chaining up to super-class method implementations.
409
+ */
410
+ $super: Wrapper;
411
+
412
+ /**
413
+ * Methods and fields.
414
+ */
415
+ [name: string]: any;
416
+ };
417
+
418
+ interface MethodDispatcher<Holder extends Members<Holder> = {}> extends Method<Holder> {
419
+ /**
420
+ * Available overloads.
421
+ */
422
+ overloads: Array<Method<Holder>>;
423
+
424
+ /**
425
+ * Obtains a specific overload.
426
+ *
427
+ * @param args Signature of the overload to obtain.
428
+ * For example: `"java.lang.String", "int"`.
429
+ */
430
+ overload(...args: string[]): Method<Holder>;
431
+ }
432
+
433
+ interface Method<Holder extends Members<Holder> = {}> {
434
+ (...params: any[]): any;
435
+
436
+ /**
437
+ * Name of this method.
438
+ */
439
+ methodName: string;
440
+
441
+ /**
442
+ * Class that this method belongs to.
443
+ */
444
+ holder: Wrapper<Holder>;
445
+
446
+ /**
447
+ * What kind of method this is, i.e. constructor vs static vs instance.
448
+ */
449
+ type: MethodType;
450
+
451
+ /**
452
+ * Pointer to the VM's underlying method object.
453
+ */
454
+ handle: NativePointer;
455
+
456
+ /**
457
+ * Implementation. Assign a new implementation to this property to
458
+ * replace the original implementation. Assign `null` at a future point
459
+ * to revert back to the original implementation.
460
+ */
461
+ implementation: MethodImplementation<Holder> | null;
462
+
463
+ /**
464
+ * Method return type.
465
+ */
466
+ returnType: Type;
467
+
468
+ /**
469
+ * Method argument types.
470
+ */
471
+ argumentTypes: Type[];
472
+
473
+ /**
474
+ * Queries whether the method may be invoked with a given argument list.
475
+ */
476
+ canInvokeWith: (...args: any[]) => boolean;
477
+
478
+ /**
479
+ * Makes a new method wrapper with custom NativeFunction options.
480
+ *
481
+ * Useful for e.g. setting `traps: "all"` to perform execution tracing
482
+ * in conjunction with Stalker.
483
+ */
484
+ clone: (options: NativeFunctionOptions) => Method<Holder>;
485
+ }
486
+
487
+ type MethodImplementation<This extends Members<This> = {}> = (this: Wrapper<This>, ...params: any[]) => any;
488
+
489
+ interface Field<Value = any, Holder extends Members<Holder> = {}> {
490
+ /**
491
+ * Current value of this field. Assign to update the field's value.
492
+ */
493
+ value: Value;
494
+
495
+ /**
496
+ * Class that this field belongs to.
497
+ */
498
+ holder: Wrapper<Holder>;
499
+
500
+ /**
501
+ * What kind of field this is, i.e. static vs instance.
502
+ */
503
+ fieldType: FieldType;
504
+
505
+ /**
506
+ * Type of value.
507
+ */
508
+ fieldReturnType: Type;
509
+ }
510
+
511
+ // eslint-disable-next-line @definitelytyped/no-const-enum
512
+ const enum MethodType {
513
+ Constructor = 1,
514
+ Static = 2,
515
+ Instance = 3,
516
+ }
517
+
518
+ // eslint-disable-next-line @definitelytyped/no-const-enum
519
+ const enum FieldType {
520
+ Static = 1,
521
+ Instance = 2,
522
+ }
523
+
524
+ interface Type {
525
+ /**
526
+ * VM type name. For example `I` for `int`.
527
+ */
528
+ name: string;
529
+
530
+ /**
531
+ * Frida type name. For example `pointer` for a handle.
532
+ */
533
+ type: string;
534
+
535
+ /**
536
+ * Size in words.
537
+ */
538
+ size: number;
539
+
540
+ /**
541
+ * Size in bytes.
542
+ */
543
+ byteSize: number;
544
+
545
+ /**
546
+ * Class name, if applicable.
547
+ */
548
+ className?: string | undefined;
549
+
550
+ /**
551
+ * Checks whether a given JavaScript `value` is compatible.
552
+ */
553
+ isCompatible: (value: any) => boolean;
554
+
555
+ /**
556
+ * Converts `value` from a JNI value to a JavaScript value.
557
+ */
558
+ fromJni?: ((value: any) => any) | undefined;
559
+
560
+ /**
561
+ * Converts `value` from a JavaScript value to a JNI value.
562
+ */
563
+ toJni?: ((value: any) => any) | undefined;
564
+
565
+ /**
566
+ * Reads a value from memory.
567
+ */
568
+ read?: ((address: NativePointerValue) => any) | undefined;
569
+
570
+ /**
571
+ * Writes a value to memory.
572
+ */
573
+ write?: ((address: NativePointerValue, value: any) => void) | undefined;
574
+ }
575
+
576
+ interface DexFile {
577
+ /**
578
+ * Loads the contained classes into the VM.
579
+ */
580
+ load(): void;
581
+
582
+ /**
583
+ * Determines available class names.
584
+ */
585
+ getClassNames(): string[];
586
+ }
587
+
588
+ interface ClassSpec {
589
+ /**
590
+ * Name of the class.
591
+ */
592
+ name: string;
593
+
594
+ /**
595
+ * Super-class. Omit to inherit from `java.lang.Object`.
596
+ */
597
+ superClass?: Wrapper | undefined;
598
+
599
+ /**
600
+ * Interfaces implemented by this class.
601
+ */
602
+ implements?: Wrapper[] | undefined;
603
+
604
+ /**
605
+ * Name and type of each field to expose.
606
+ */
607
+ fields?: {
608
+ [name: string]: string;
609
+ } | undefined;
610
+
611
+ /**
612
+ * Methods to implement. Use the special name `$init` to define one or more constructors.
613
+ */
614
+ methods?: {
615
+ [name: string]: MethodImplementation | MethodSpec | MethodSpec[];
616
+ } | undefined;
617
+ }
618
+
619
+ interface MethodSpec {
620
+ /**
621
+ * Return type. Defaults to `void` if omitted.
622
+ */
623
+ returnType?: string | undefined;
624
+
625
+ /**
626
+ * Argument types. Defaults to `[]` if omitted.
627
+ */
628
+ argumentTypes?: string[] | undefined;
629
+
630
+ /**
631
+ * Implementation.
632
+ */
633
+ implementation: MethodImplementation;
634
+ }
635
+
636
+ interface VM {
637
+ /**
638
+ * Ensures that the current thread is attached to the VM and calls `fn`.
639
+ * (This isn't necessary in callbacks from Java.)
640
+ *
641
+ * @param fn Function to run while attached to the VM.
642
+ */
643
+ perform(fn: () => void): void;
644
+
645
+ /**
646
+ * Gets a wrapper for the current thread's `JNIEnv`.
647
+ *
648
+ * Throws an exception if the current thread is not attached to the VM.
649
+ */
650
+ getEnv(): Env;
651
+
652
+ /**
653
+ * Tries to get a wrapper for the current thread's `JNIEnv`.
654
+ *
655
+ * Returns `null` if the current thread is not attached to the VM.
656
+ */
657
+ tryGetEnv(): Env | null;
658
+ }
659
+
660
+ type Env = any;
661
+
662
+ class ClassFactory {
663
+ /**
664
+ * Gets the class factory instance for a given class loader, or the
665
+ * default factory when passing `null`.
666
+ *
667
+ * The default class factory used behind the scenes only interacts
668
+ * with the application's main class loader. Other class loaders
669
+ * can be discovered through APIs such as `Java.enumerateMethods()` and
670
+ * `Java.enumerateClassLoaders()`, and subsequently interacted with
671
+ * through this API.
672
+ */
673
+ static get(classLoader: Wrapper | null): ClassFactory;
674
+
675
+ /**
676
+ * Class loader currently being used. For the default class factory this
677
+ * is updated by the first call to `Java.perform()`.
678
+ */
679
+ readonly loader: Wrapper | null;
680
+
681
+ /**
682
+ * Path to cache directory currently being used. For the default class
683
+ * factory this is updated by the first call to `Java.perform()`.
684
+ */
685
+ cacheDir: string;
686
+
687
+ /**
688
+ * Naming convention to use for temporary files.
689
+ *
690
+ * Defaults to `{ prefix: "frida", suffix: "dat" }`.
691
+ */
692
+ tempFileNaming: TempFileNaming;
693
+
694
+ /**
695
+ * Dynamically generates a JavaScript wrapper for `className` that you can
696
+ * instantiate objects from by calling `$new()` on to invoke a constructor.
697
+ * Call `$dispose()` on an instance to clean it up explicitly, or wait for
698
+ * the JavaScript object to get garbage-collected, or script to get
699
+ * unloaded. Static and non-static methods are available, and you can even
700
+ * replace method implementations.
701
+ *
702
+ * @param className Canonical class name to get a wrapper for.
703
+ */
704
+ use<T extends Members<T> = {}>(className: string): Wrapper<T>;
705
+
706
+ /**
707
+ * Opens the .dex file at `filePath`.
708
+ *
709
+ * @param filePath Path to .dex to open.
710
+ */
711
+ openClassFile(filePath: string): DexFile;
712
+
713
+ /**
714
+ * Enumerates live instances of the `className` class by scanning the Java
715
+ * VM's heap.
716
+ *
717
+ * @param className Name of class to enumerate instances of.
718
+ * @param callbacks Object with callbacks.
719
+ */
720
+ choose<T extends Members<T> = {}>(className: string, callbacks: ChooseCallbacks<T>): void;
721
+
722
+ /**
723
+ * Duplicates a JavaScript wrapper for later use outside replacement method.
724
+ *
725
+ * @param obj An existing wrapper retrieved from `this` in replacement method.
726
+ */
727
+ retain<T extends Members<T> = {}>(obj: Wrapper<T>): Wrapper<T>;
728
+
729
+ /**
730
+ * Creates a JavaScript wrapper given the existing instance at `handle` of
731
+ * given class `klass` as returned from `Java.use()`.
732
+ *
733
+ * @param handle An existing wrapper or a JNI handle.
734
+ * @param klass Class wrapper for type to cast to.
735
+ */
736
+ cast<From extends Members<From> = {}, To extends Members<To> = {}>(
737
+ handle: Wrapper<From> | NativePointerValue,
738
+ klass: Wrapper<To>,
739
+ ): Wrapper<To>;
740
+
741
+ /**
742
+ * Creates a Java array with elements of the specified `type`, from a
743
+ * JavaScript array `elements`. The resulting Java array behaves like
744
+ * a JS array, but can be passed by reference to Java APIs in order to
745
+ * allow them to modify its contents.
746
+ *
747
+ * @param type Type name of elements.
748
+ * @param elements Array of JavaScript values to use for constructing the
749
+ * Java array.
750
+ */
751
+ array(type: string, elements: any[]): any[];
752
+
753
+ /**
754
+ * Creates a new Java class.
755
+ *
756
+ * @param spec Object describing the class to be created.
757
+ */
758
+ registerClass(spec: ClassSpec): Wrapper;
759
+ }
760
+
761
+ interface TempFileNaming {
762
+ /**
763
+ * File name prefix to use.
764
+ *
765
+ * For example: `frida`.
766
+ */
767
+ prefix: string;
768
+
769
+ /**
770
+ * File name suffix to use.
771
+ *
772
+ * For example: `dat`.
773
+ */
774
+ suffix: string;
775
+ }
776
+ }
777
+
778
+ export default Java;
779
+ }