@girs/jcat-1.0 0.2.1-4.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/README.md ADDED
@@ -0,0 +1,104 @@
1
+
2
+ # Jcat-1.0
3
+
4
+ ![version](https://img.shields.io/npm/v/@girs/jcat-1.0)
5
+ ![downloads/week](https://img.shields.io/npm/dw/@girs/jcat-1.0)
6
+
7
+
8
+ GJS TypeScript type definitions for Jcat-1.0, generated from library version 0.2.1 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0.
9
+
10
+
11
+ ## Install
12
+
13
+ To use this type definitions, install them with NPM:
14
+ ```bash
15
+ npm install @girs/jcat-1.0
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ You can import this package into your project like this:
21
+ ```ts
22
+ import Jcat from '@girs/jcat-1.0';
23
+ ```
24
+
25
+ Or if you prefer CommonJS, you can also use this:
26
+ ```ts
27
+ const Jcat = require('@girs/jcat-1.0');
28
+ ```
29
+
30
+ ### Ambient Modules
31
+
32
+ You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
33
+ For this you need to include `@girs/jcat-1.0` or `@girs/jcat-1.0/ambient` in your `tsconfig` or entry point Typescript file:
34
+
35
+ `index.ts`:
36
+ ```ts
37
+ import '@girs/jcat-1.0'
38
+ ```
39
+
40
+ `tsconfig.json`:
41
+ ```json
42
+ {
43
+ "compilerOptions": {
44
+ ...
45
+ },
46
+ "include": ["@girs/jcat-1.0"],
47
+ ...
48
+ }
49
+ ```
50
+
51
+ Now you can import the ambient module with TypeScript support:
52
+
53
+ ```ts
54
+ import Jcat from 'gi://Jcat?version=1.0';
55
+ ```
56
+
57
+ ### Global import
58
+
59
+ You can also import the module with Typescript support using the global `imports.gi` object of GJS.
60
+ For this you need to include `@girs/jcat-1.0` or `@girs/jcat-1.0/import` in your `tsconfig` or entry point Typescript file:
61
+
62
+ `index.ts`:
63
+ ```ts
64
+ import '@girs/jcat-1.0'
65
+ ```
66
+
67
+ `tsconfig.json`:
68
+ ```json
69
+ {
70
+ "compilerOptions": {
71
+ ...
72
+ },
73
+ "include": ["@girs/jcat-1.0"],
74
+ ...
75
+ }
76
+ ```
77
+
78
+ Now you have also type support for this, too:
79
+
80
+ ```ts
81
+ const Jcat = imports.gi.Jcat;
82
+ ```
83
+
84
+
85
+ ### ESM vs. CommonJS
86
+
87
+ GJS supports two different import syntaxes. The new modern ESM syntax and the old global imports syntax.
88
+
89
+ In TypeScript projects for GJS and GNOME Shell extensions, you have the flexibility to use `ESM` syntax and then decide the import syntax for your bundled file. If your bundler is configured to use `CommonJS`, it will convert to the GJS-specific global imports syntax, like `const moduleName = imports.gi[moduleName]`. This is different from the traditional `require` syntax seen in Node.js. The global imports syntax is chosen because it aligns with the CommonJS format supported by NPM, which is used for the generated type definitions and this package.
90
+
91
+ On the other hand, if you configure your bundler to use ESM, it will retain the ESM import syntax. It's crucial to ensure that your bundler is set up to correctly translate and bundle these imports into either CommonJS or ESM format, depending on your project's requirements.
92
+
93
+ This approach is particularly important due to the `@girs` types, which include both `*.cjs `files, using the GJS global imports syntax, and `*.js` files, which utilize the ESM syntax. By appropriately setting up your bundler, you can control which syntax—CommonJS or ESM—is used in your project. The choice of CommonJS in this context is also due to the similarity between the GJS-specific global imports and CommonJS syntax, allowing for easier management and bundling in these specific types of projects.
94
+
95
+ Since GNOME Shell 45, you should only use ESM, even for GNOME Shell extensions. Before that, extensions had to use the global import syntax, unlike normal GJS applications, where ESM has been available for some time.
96
+
97
+ ### Bundle
98
+
99
+ Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
100
+
101
+ ## Other packages
102
+
103
+ All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
104
+
@@ -0,0 +1,12 @@
1
+
2
+ declare module 'gi://Jcat?version=1.0' {
3
+ import Jcat from '@girs/jcat-1.0';
4
+ export default Jcat;
5
+ }
6
+
7
+ declare module 'gi://Jcat' {
8
+ import Jcat10 from 'gi://Jcat?version=1.0';
9
+ export default Jcat10;
10
+ }
11
+
12
+
@@ -0,0 +1,2 @@
1
+ export {}
2
+
@@ -0,0 +1,12 @@
1
+
2
+ import Jcat10 from '@girs/jcat-1.0';
3
+
4
+ declare global {
5
+ export interface GjsGiImports {
6
+ Jcat: typeof Jcat10;
7
+ }
8
+ }
9
+
10
+ export default GjsGiImports;
11
+
12
+
@@ -0,0 +1,3 @@
1
+ const gi = globalThis.imports?.gi || {};
2
+ export default gi;
3
+
package/jcat-1.0.d.ts ADDED
@@ -0,0 +1,865 @@
1
+ /*
2
+ * Type Definitions for Gjs (https://gjs.guide/)
3
+ *
4
+ * These type definitions are automatically generated, do not edit them by hand.
5
+ * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
6
+ */
7
+
8
+ import './jcat-1.0-ambient.d.ts';
9
+
10
+ /**
11
+ * Jcat-1.0
12
+ */
13
+
14
+ import type Json from '@girs/json-1.0';
15
+ import type Gio from '@girs/gio-2.0';
16
+ import type GObject from '@girs/gobject-2.0';
17
+ import type GLib from '@girs/glib-2.0';
18
+
19
+ export namespace Jcat {
20
+ /**
21
+ * The kind of blob stored as a signature on the item.
22
+ */
23
+ enum BlobKind {
24
+ /**
25
+ * No known blob kind
26
+ */
27
+ UNKNOWN,
28
+ /**
29
+ * SHA-256 checksum
30
+ */
31
+ SHA256,
32
+ /**
33
+ * GPG detached signature
34
+ */
35
+ GPG,
36
+ /**
37
+ * PKCS-7 detached signature
38
+ */
39
+ PKCS7,
40
+ /**
41
+ * SHA-1 checksum
42
+ */
43
+ SHA1,
44
+ /**
45
+ * Binary transparency manifest
46
+ */
47
+ BT_MANIFEST,
48
+ /**
49
+ * Binary transparency checkpoint
50
+ */
51
+ BT_CHECKPOINT,
52
+ /**
53
+ * Binary transparency inclusion proof
54
+ */
55
+ BT_INCLUSION_PROOF,
56
+ /**
57
+ * Binary transparency verifier
58
+ */
59
+ BT_VERIFIER,
60
+ /**
61
+ * ED25519 signature
62
+ */
63
+ ED25519,
64
+ /**
65
+ * SHA-512 checksum
66
+ */
67
+ SHA512,
68
+ }
69
+ /**
70
+ * The blob verification method.
71
+ */
72
+ enum BlobMethod {
73
+ /**
74
+ * Unknown
75
+ */
76
+ UNKNOWN,
77
+ /**
78
+ * Checksum
79
+ */
80
+ CHECKSUM,
81
+ /**
82
+ * Signature
83
+ */
84
+ SIGNATURE,
85
+ }
86
+ /**
87
+ * Flags used for importing.
88
+ */
89
+ enum ImportFlags {
90
+ /**
91
+ * No flags set
92
+ */
93
+ NONE,
94
+ }
95
+ /**
96
+ * The compile-time major version
97
+ */
98
+ const MAJOR_VERSION: number;
99
+ /**
100
+ * The compile-time micro version
101
+ */
102
+ const MICRO_VERSION: number;
103
+ /**
104
+ * The compile-time minor version
105
+ */
106
+ const MINOR_VERSION: number;
107
+ /**
108
+ * Gets the JCat installed runtime version.
109
+ * @returns a version number, e.g. "0.1.11"
110
+ */
111
+ function version_string(): string;
112
+ /**
113
+ * Flags used when creating the blob.
114
+ */
115
+ enum BlobFlags {
116
+ /**
117
+ * Generic binary data
118
+ */
119
+ NONE,
120
+ /**
121
+ * ASCII text
122
+ */
123
+ IS_UTF8,
124
+ }
125
+ /**
126
+ * Flags used for exporting.
127
+ */
128
+ enum ExportFlags {
129
+ /**
130
+ * No flags set
131
+ */
132
+ NONE,
133
+ /**
134
+ * Do not export timestamps
135
+ */
136
+ NO_TIMESTAMP,
137
+ }
138
+ /**
139
+ * The flags to when signing a binary
140
+ */
141
+ enum SignFlags {
142
+ /**
143
+ * No flags set
144
+ */
145
+ NONE,
146
+ /**
147
+ * Add a timestamp
148
+ */
149
+ ADD_TIMESTAMP,
150
+ /**
151
+ * Add a certificate
152
+ */
153
+ ADD_CERT,
154
+ }
155
+ /**
156
+ * The flags to use when interacting with a keyring
157
+ */
158
+ enum VerifyFlags {
159
+ /**
160
+ * No flags set
161
+ */
162
+ NONE,
163
+ /**
164
+ * Disable checking of validity periods
165
+ */
166
+ DISABLE_TIME_CHECKS,
167
+ /**
168
+ * Require the item contains at least one checksum
169
+ */
170
+ REQUIRE_CHECKSUM,
171
+ /**
172
+ * Require the item contains at least one signature
173
+ */
174
+ REQUIRE_SIGNATURE,
175
+ }
176
+ module Blob {
177
+ // Constructor properties interface
178
+
179
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
180
+ }
181
+
182
+ class Blob extends GObject.Object {
183
+ static $gtype: GObject.GType<Blob>;
184
+
185
+ // Constructors of Jcat.Blob
186
+
187
+ constructor(properties?: Partial<Blob.ConstructorProps>, ...args: any[]);
188
+
189
+ _init(...args: any[]): void;
190
+
191
+ static ['new'](kind: BlobKind, data: GLib.Bytes | Uint8Array): Blob;
192
+
193
+ static new_full(kind: BlobKind, data: GLib.Bytes | Uint8Array, flags: BlobFlags): Blob;
194
+
195
+ static new_utf8(kind: BlobKind, data: string): Blob;
196
+
197
+ // Own static methods of Jcat.Blob
198
+
199
+ /**
200
+ * Converts the string to an enumerated kind.
201
+ * @param kind A string
202
+ */
203
+ static kind_from_string(kind: string): BlobKind;
204
+ /**
205
+ * Converts the enumerated kind to the normal file extension.
206
+ * @param kind #JcatBlobKind
207
+ */
208
+ static kind_to_filename_ext(kind: BlobKind): string;
209
+ /**
210
+ * Converts the enumerated kind to a string.
211
+ * @param kind #JcatBlobKind
212
+ */
213
+ static kind_to_string(kind: BlobKind): string;
214
+
215
+ // Own methods of Jcat.Blob
216
+
217
+ /**
218
+ * Gets the optional AppStream ID for the blob.
219
+ * @returns a string, or %NULL if not set
220
+ */
221
+ get_appstream_id(): string;
222
+ /**
223
+ * Gets the data stored in the blob, typically in binary (unprintable) form.
224
+ * @returns a #GBytes, or %NULL if the filename was not found
225
+ */
226
+ get_data(): GLib.Bytes;
227
+ // Conflicted with GObject.Object.get_data
228
+ get_data(...args: never[]): any;
229
+ /**
230
+ * Gets the data stored in the blob, in human readable form.
231
+ * @returns base64 encoded version of data
232
+ */
233
+ get_data_as_string(): string;
234
+ /**
235
+ * gets the blob kind
236
+ * @returns #JcatBlobKind, e.g. %JCAT_BLOB_KIND_SHA256
237
+ */
238
+ get_kind(): BlobKind;
239
+ /**
240
+ * Gets the blob target.
241
+ * @returns #JcatBlobKind, e.g. %JCAT_BLOB_KIND_SHA256
242
+ */
243
+ get_target(): BlobKind;
244
+ /**
245
+ * Gets the creation timestamp for the blob.
246
+ * @returns UTC UNIX time, or 0 if unset
247
+ */
248
+ get_timestamp(): number;
249
+ /**
250
+ * Sets an optional AppStream ID on the blob.
251
+ * @param appstream_id string
252
+ */
253
+ set_appstream_id(appstream_id?: string | null): void;
254
+ /**
255
+ * Sets the blob target.
256
+ * @param target a #JcatBlobKind, e.g. %JCAT_BLOB_KIND_SHA256
257
+ */
258
+ set_target(target: BlobKind): void;
259
+ /**
260
+ * Sets the creation timestamp for the blob.
261
+ * @param timestamp UTC timestamp
262
+ */
263
+ set_timestamp(timestamp: number): void;
264
+ /**
265
+ * Converts the #JcatBlob to a string.
266
+ * @returns string
267
+ */
268
+ to_string(): string;
269
+ }
270
+
271
+ module BtCheckpoint {
272
+ // Constructor properties interface
273
+
274
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
275
+ }
276
+
277
+ class BtCheckpoint extends GObject.Object {
278
+ static $gtype: GObject.GType<BtCheckpoint>;
279
+
280
+ // Constructors of Jcat.BtCheckpoint
281
+
282
+ constructor(properties?: Partial<BtCheckpoint.ConstructorProps>, ...args: any[]);
283
+
284
+ _init(...args: any[]): void;
285
+
286
+ static ['new'](blob: GLib.Bytes | Uint8Array): BtCheckpoint;
287
+
288
+ // Own methods of Jcat.BtCheckpoint
289
+
290
+ /**
291
+ * Gets the first 4 bytes of the SHA256 hash of the associated public key to act as a hint in
292
+ * identifying the correct key to verify with.
293
+ * @returns string, or %NULL
294
+ */
295
+ get_hash(): string;
296
+ /**
297
+ * Gets a human-readable representation of the signing ID.
298
+ * @returns string, or %NULL
299
+ */
300
+ get_identity(): string;
301
+ /**
302
+ * Gets the log_size.
303
+ * @returns integer
304
+ */
305
+ get_log_size(): number;
306
+ /**
307
+ * Gets the unique identifier for the log identity which issued the checkpoint.
308
+ * @returns string, or %NULL
309
+ */
310
+ get_origin(): string;
311
+ /**
312
+ * Gets the ED25519 public key blob.
313
+ * @returns blob, or %NULL
314
+ */
315
+ get_payload(): GLib.Bytes;
316
+ /**
317
+ * Gets the ED25519 public key blob.
318
+ * @returns blob, or %NULL
319
+ */
320
+ get_pubkey(): GLib.Bytes;
321
+ /**
322
+ * Gets the ED25519 public key blob.
323
+ * @returns blob, or %NULL
324
+ */
325
+ get_signature(): GLib.Bytes;
326
+ /**
327
+ * Converts the #JcatBtCheckpoint to a string.
328
+ * @returns string
329
+ */
330
+ to_string(): string;
331
+ }
332
+
333
+ module BtVerifier {
334
+ // Constructor properties interface
335
+
336
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
337
+ }
338
+
339
+ class BtVerifier extends GObject.Object {
340
+ static $gtype: GObject.GType<BtVerifier>;
341
+
342
+ // Constructors of Jcat.BtVerifier
343
+
344
+ constructor(properties?: Partial<BtVerifier.ConstructorProps>, ...args: any[]);
345
+
346
+ _init(...args: any[]): void;
347
+
348
+ static ['new'](blob: GLib.Bytes | Uint8Array): BtVerifier;
349
+
350
+ // Own methods of Jcat.BtVerifier
351
+
352
+ /**
353
+ * Gets the algorithm ID.
354
+ * @returns ID, typically 1
355
+ */
356
+ get_alg(): number;
357
+ /**
358
+ * Gets the hash.
359
+ * @returns string, or %NULL
360
+ */
361
+ get_hash(): string;
362
+ /**
363
+ * Gets the ED25519 public key blob.
364
+ * @returns blob, or %NULL
365
+ */
366
+ get_key(): GLib.Bytes;
367
+ /**
368
+ * Gets the name.
369
+ * @returns string, or %NULL
370
+ */
371
+ get_name(): string;
372
+ /**
373
+ * Converts the #JcatBtVerifier to a string.
374
+ * @returns string
375
+ */
376
+ to_string(): string;
377
+ }
378
+
379
+ module Context {
380
+ // Constructor properties interface
381
+
382
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
383
+ }
384
+
385
+ class Context extends GObject.Object {
386
+ static $gtype: GObject.GType<Context>;
387
+
388
+ // Constructors of Jcat.Context
389
+
390
+ constructor(properties?: Partial<Context.ConstructorProps>, ...args: any[]);
391
+
392
+ _init(...args: any[]): void;
393
+
394
+ static ['new'](): Context;
395
+
396
+ // Own methods of Jcat.Context
397
+
398
+ /**
399
+ * Adds a single public key.
400
+ * @param filename A filename
401
+ */
402
+ add_public_key(filename: string): void;
403
+ /**
404
+ * Adds a public key directory.
405
+ * @param path A directory of files
406
+ */
407
+ add_public_keys(path: string): void;
408
+ /**
409
+ * Adds a blob kind to the allowlist. By default, JCat will use all signature and checksum schemes
410
+ * compiled in at build time. Once this function has been called only specific blob kinds will be
411
+ * used in functions like jcat_context_verify_blob().
412
+ * @param kind #JcatBlobKind, e.g. %JCAT_BLOB_KIND_GPG
413
+ */
414
+ blob_kind_allow(kind: BlobKind): void;
415
+ /**
416
+ * Removes a blob kind from the allowlist. By default, JCat will use all signature and checksum
417
+ * schemes compiled in at build time. Once this function has been called this `kind` will not be
418
+ * used in functions like jcat_context_verify_blob().
419
+ * @param kind #JcatBlobKind, e.g. %JCAT_BLOB_KIND_GPG
420
+ */
421
+ blob_kind_disallow(kind: BlobKind): void;
422
+ /**
423
+ * Gets the engine for a specific engine kind, setting up the context
424
+ * automatically if required.
425
+ * @param kind #JcatBlobKind, e.g. %JCAT_BLOB_KIND_GPG
426
+ * @returns #JcatEngine, or %NULL for unavailable
427
+ */
428
+ get_engine(kind: BlobKind): Engine;
429
+ /**
430
+ * Gets the local state directory the engines are using.
431
+ * @returns path
432
+ */
433
+ get_keyring_path(): string | null;
434
+ /**
435
+ * Sets the local state directory for the engines to use.
436
+ * @param path A directory
437
+ */
438
+ set_keyring_path(path: string): void;
439
+ /**
440
+ * Verifies a #JcatBlob using the public keys added to the context.
441
+ * @param data #GBytes
442
+ * @param blob #JcatBlob
443
+ * @param flags #JcatVerifyFlags, e.g. %JCAT_VERIFY_FLAG_DISABLE_TIME_CHECKS
444
+ * @returns #JcatResult, or %NULL for failed
445
+ */
446
+ verify_blob(data: GLib.Bytes | Uint8Array, blob: Blob, flags: VerifyFlags): Result;
447
+ /**
448
+ * Verifies a #JcatItem using the public keys added to the context. All
449
+ * `verify=CHECKSUM` engines (e.g. SHA256) must verify correctly,
450
+ * but only one non-checksum signature has to verify.
451
+ * @param data #GBytes
452
+ * @param item #JcatItem
453
+ * @param flags #JcatVerifyFlags, e.g. %JCAT_VERIFY_FLAG_REQUIRE_SIGNATURE
454
+ * @returns array of #JcatResult, or %NULL for failed
455
+ */
456
+ verify_item(data: GLib.Bytes | Uint8Array, item: Item, flags: VerifyFlags): Result[];
457
+ /**
458
+ * Verifies a #JcatItem using the target to an item. At least one `verify=CHECKSUM` (e.g. SHA256)
459
+ * must exist and all checksum types that do exist must verify correctly.
460
+ * @param item_target #JcatItem containing checksums of the data
461
+ * @param item #JcatItem
462
+ * @param flags #JcatVerifyFlags, e.g. %JCAT_VERIFY_FLAG_REQUIRE_SIGNATURE
463
+ * @returns results, or %NULL for failed
464
+ */
465
+ verify_target(item_target: Item, item: Item, flags: VerifyFlags): Result[];
466
+ }
467
+
468
+ module Engine {
469
+ // Constructor properties interface
470
+
471
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
472
+ context: Context;
473
+ kind: number;
474
+ method: number;
475
+ verify_kind: number;
476
+ verifyKind: number;
477
+ }
478
+ }
479
+
480
+ class Engine extends GObject.Object {
481
+ static $gtype: GObject.GType<Engine>;
482
+
483
+ // Own properties of Jcat.Engine
484
+
485
+ get context(): Context;
486
+ get kind(): number;
487
+ get method(): number;
488
+ get verify_kind(): number;
489
+ get verifyKind(): number;
490
+
491
+ // Constructors of Jcat.Engine
492
+
493
+ constructor(properties?: Partial<Engine.ConstructorProps>, ...args: any[]);
494
+
495
+ _init(...args: any[]): void;
496
+
497
+ // Own virtual methods of Jcat.Engine
498
+
499
+ vfunc_add_public_key(filename: string): boolean;
500
+ /**
501
+ * Adds a public key manually.
502
+ * @param blob #GBytes
503
+ */
504
+ vfunc_add_public_key_raw(blob: GLib.Bytes | Uint8Array): boolean;
505
+ /**
506
+ * Signs a chunk of data.
507
+ * @param blob #GBytes
508
+ * @param cert #GBytes
509
+ * @param privkey #GBytes
510
+ * @param flags #JcatSignFlags, e.g. %JCAT_SIGN_FLAG_ADD_TIMESTAMP
511
+ */
512
+ vfunc_pubkey_sign(
513
+ blob: GLib.Bytes | Uint8Array,
514
+ cert: GLib.Bytes | Uint8Array,
515
+ privkey: GLib.Bytes | Uint8Array,
516
+ flags: SignFlags,
517
+ ): Blob;
518
+ /**
519
+ * Verifies a chunk of data.
520
+ * @param blob #GBytes
521
+ * @param blob_signature #GBytes
522
+ * @param flags #JcatVerifyFlags, e.g. %JCAT_VERIFY_FLAG_DISABLE_TIME_CHECKS
523
+ */
524
+ vfunc_pubkey_verify(
525
+ blob: GLib.Bytes | Uint8Array,
526
+ blob_signature: GLib.Bytes | Uint8Array,
527
+ flags: VerifyFlags,
528
+ ): Result;
529
+ /**
530
+ * Signs a chunk of data.
531
+ * @param blob #GBytes
532
+ * @param flags #JcatSignFlags, e.g. %JCAT_SIGN_FLAG_ADD_TIMESTAMP
533
+ */
534
+ vfunc_self_sign(blob: GLib.Bytes | Uint8Array, flags: SignFlags): Blob;
535
+ /**
536
+ * Verifies a chunk of data.
537
+ * @param blob #GBytes
538
+ * @param blob_signature #GBytes
539
+ * @param flags #JcatVerifyFlags, e.g. %JCAT_VERIFY_FLAG_DISABLE_TIME_CHECKS
540
+ */
541
+ vfunc_self_verify(
542
+ blob: GLib.Bytes | Uint8Array,
543
+ blob_signature: GLib.Bytes | Uint8Array,
544
+ flags: VerifyFlags,
545
+ ): Result;
546
+ vfunc_setup(): boolean;
547
+
548
+ // Own methods of Jcat.Engine
549
+
550
+ /**
551
+ * Adds a public key manually.
552
+ * @param blob #GBytes
553
+ * @returns %
554
+ */
555
+ add_public_key_raw(blob: GLib.Bytes | Uint8Array): boolean;
556
+ /**
557
+ * Gets the blob kind.
558
+ * @returns #JcatBlobKind, e.g. %JCAT_BLOB_KIND_SHA256
559
+ */
560
+ get_kind(): BlobKind;
561
+ /**
562
+ * Gets the verification method.
563
+ * @returns #JcatBlobMethod, e.g. %JCAT_BLOB_METHOD_SIGNATURE
564
+ */
565
+ get_method(): BlobMethod;
566
+ /**
567
+ * Signs a chunk of data.
568
+ * @param blob #GBytes
569
+ * @param cert #GBytes
570
+ * @param privkey #GBytes
571
+ * @param flags #JcatSignFlags, e.g. %JCAT_SIGN_FLAG_ADD_TIMESTAMP
572
+ * @returns #JcatBlob, or %NULL for failed
573
+ */
574
+ pubkey_sign(
575
+ blob: GLib.Bytes | Uint8Array,
576
+ cert: GLib.Bytes | Uint8Array,
577
+ privkey: GLib.Bytes | Uint8Array,
578
+ flags: SignFlags,
579
+ ): Blob;
580
+ /**
581
+ * Verifies a chunk of data.
582
+ * @param blob #GBytes
583
+ * @param blob_signature #GBytes
584
+ * @param flags #JcatVerifyFlags, e.g. %JCAT_VERIFY_FLAG_DISABLE_TIME_CHECKS
585
+ * @returns #JcatResult, or %NULL for failed
586
+ */
587
+ pubkey_verify(
588
+ blob: GLib.Bytes | Uint8Array,
589
+ blob_signature: GLib.Bytes | Uint8Array,
590
+ flags: VerifyFlags,
591
+ ): Result;
592
+ /**
593
+ * Signs a chunk of data.
594
+ * @param blob #GBytes
595
+ * @param flags #JcatSignFlags, e.g. %JCAT_SIGN_FLAG_ADD_TIMESTAMP
596
+ * @returns #JcatBlob, or %NULL for failed
597
+ */
598
+ self_sign(blob: GLib.Bytes | Uint8Array, flags: SignFlags): Blob;
599
+ /**
600
+ * Verifies a chunk of data.
601
+ * @param blob #GBytes
602
+ * @param blob_signature #GBytes
603
+ * @param flags #JcatVerifyFlags, e.g. %JCAT_VERIFY_FLAG_DISABLE_TIME_CHECKS
604
+ * @returns #JcatResult, or %NULL for failed
605
+ */
606
+ self_verify(blob: GLib.Bytes | Uint8Array, blob_signature: GLib.Bytes | Uint8Array, flags: VerifyFlags): Result;
607
+ }
608
+
609
+ module File {
610
+ // Constructor properties interface
611
+
612
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
613
+ }
614
+
615
+ class File extends GObject.Object {
616
+ static $gtype: GObject.GType<File>;
617
+
618
+ // Constructors of Jcat.File
619
+
620
+ constructor(properties?: Partial<File.ConstructorProps>, ...args: any[]);
621
+
622
+ _init(...args: any[]): void;
623
+
624
+ static ['new'](): File;
625
+
626
+ // Own methods of Jcat.File
627
+
628
+ /**
629
+ * Adds an item to a file.
630
+ * @param item #JcatItem
631
+ */
632
+ add_item(item: Item): void;
633
+ /**
634
+ * Exports a Jcat file to a compressed file.
635
+ * @param gfile #gfile
636
+ * @param flags a #JcatExportFlags, typically %JCAT_EXPORT_FLAG_NONE
637
+ * @param cancellable #GCancellable, or %NULL
638
+ * @returns %TRUE for success
639
+ */
640
+ export_file(gfile: Gio.File, flags: ExportFlags, cancellable?: Gio.Cancellable | null): boolean;
641
+ /**
642
+ * Exports a Jcat file to raw JSON.
643
+ * @param flags a #JcatExportFlags, typically %JCAT_EXPORT_FLAG_NONE
644
+ * @returns JSON output, or %NULL for error
645
+ */
646
+ export_json(flags: ExportFlags): string;
647
+ /**
648
+ * Exports a Jcat file to a compressed stream.
649
+ * @param ostream #GOutputStream
650
+ * @param flags a #JcatExportFlags, typically %JCAT_EXPORT_FLAG_NONE
651
+ * @param cancellable #GCancellable, or %NULL
652
+ * @returns %TRUE for success
653
+ */
654
+ export_stream(ostream: Gio.OutputStream, flags: ExportFlags, cancellable?: Gio.Cancellable | null): boolean;
655
+ /**
656
+ * Finds the item with the specified ID, falling back to the ID alias if set.
657
+ * @param id An ID, typically a filename basename
658
+ * @returns a #JcatItem, or %NULL if the filename was not found
659
+ */
660
+ get_item_by_id(id: string): Item;
661
+ /**
662
+ * Finds the default item. If more than one #JcatItem exists this function will
663
+ * return with an error.
664
+ * @returns a #JcatItem, or %NULL if no default exists
665
+ */
666
+ get_item_default(): Item;
667
+ /**
668
+ * Returns all the items in the file.
669
+ * @returns all the items in the file
670
+ */
671
+ get_items(): Item[];
672
+ /**
673
+ * Returns the major version number of the Jcat specification
674
+ * @returns integer
675
+ */
676
+ get_version_major(): number;
677
+ /**
678
+ * Returns the minor version number of the Jcat specification
679
+ * @returns integer
680
+ */
681
+ get_version_minor(): number;
682
+ /**
683
+ * Imports a compressed Jcat file from an input stream.
684
+ * @param gfile #gfile
685
+ * @param flags #JcatImportFlags, typically %JCAT_IMPORT_FLAG_NONE
686
+ * @param cancellable #GCancellable, or %NULL
687
+ * @returns %TRUE for success
688
+ */
689
+ import_file(gfile: Gio.File, flags: ImportFlags, cancellable?: Gio.Cancellable | null): boolean;
690
+ /**
691
+ * Imports a Jcat file from raw JSON.
692
+ * @param json JSON data
693
+ * @param flags #JcatImportFlags, typically %JCAT_IMPORT_FLAG_NONE
694
+ * @returns %TRUE for success
695
+ */
696
+ import_json(json: string, flags: ImportFlags): boolean;
697
+ /**
698
+ * Imports a compressed Jcat file from a file.
699
+ * @param istream #GInputStream
700
+ * @param flags #JcatImportFlags, typically %JCAT_IMPORT_FLAG_NONE
701
+ * @param cancellable #GCancellable, or %NULL
702
+ * @returns %TRUE for success
703
+ */
704
+ import_stream(istream: Gio.InputStream, flags: ImportFlags, cancellable?: Gio.Cancellable | null): boolean;
705
+ /**
706
+ * Converts the #JcatFile to a string.
707
+ * @returns string
708
+ */
709
+ to_string(): string;
710
+ }
711
+
712
+ module Item {
713
+ // Constructor properties interface
714
+
715
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
716
+ }
717
+
718
+ class Item extends GObject.Object {
719
+ static $gtype: GObject.GType<Item>;
720
+
721
+ // Constructors of Jcat.Item
722
+
723
+ constructor(properties?: Partial<Item.ConstructorProps>, ...args: any[]);
724
+
725
+ _init(...args: any[]): void;
726
+
727
+ static ['new'](id: string): Item;
728
+
729
+ // Own methods of Jcat.Item
730
+
731
+ /**
732
+ * Adds an item alias ID. Alias IDs are matched when using functions such as
733
+ * jcat_file_get_item_by_id().
734
+ * @param id An item ID alias, typically a file basename
735
+ */
736
+ add_alias_id(id: string): void;
737
+ /**
738
+ * Adds a new blob to the item.
739
+ * @param blob #JcatBlob
740
+ */
741
+ add_blob(blob: Blob): void;
742
+ /**
743
+ * Gets the list of alias IDs.
744
+ * @returns array
745
+ */
746
+ get_alias_ids(): string[];
747
+ /**
748
+ * Gets the item blobs by a specific kind.
749
+ * @param kind #JcatBlobKind, e.g. %JCAT_BLOB_KIND_SHA256
750
+ * @returns a blob, or %NULL
751
+ */
752
+ get_blob_by_kind(kind: BlobKind): Blob;
753
+ /**
754
+ * Gets all the blobs for this item.
755
+ * @returns blobs
756
+ */
757
+ get_blobs(): Blob[];
758
+ /**
759
+ * Gets the item blobs by a specific kind.
760
+ * @param kind #JcatBlobKind, e.g. %JCAT_BLOB_KIND_SHA256
761
+ * @returns blobs
762
+ */
763
+ get_blobs_by_kind(kind: BlobKind): Blob[];
764
+ /**
765
+ * Returns the item ID.
766
+ * @returns string
767
+ */
768
+ get_id(): string;
769
+ /**
770
+ * Finds out if any of the blobs are targeting an internal checksum.
771
+ * If this returns with success then the caller might be able to use functions like
772
+ * jcat_context_verify_target() supplying some target checksums.
773
+ * @returns %TRUE on success
774
+ */
775
+ has_target(): boolean;
776
+ /**
777
+ * Removes an item alias ID.
778
+ * @param id An item ID alias, typically a file basename
779
+ */
780
+ remove_alias_id(id: string): void;
781
+ /**
782
+ * Converts the #JcatItem to a string.
783
+ * @returns string
784
+ */
785
+ to_string(): string;
786
+ }
787
+
788
+ module Result {
789
+ // Constructor properties interface
790
+
791
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
792
+ authority: string;
793
+ engine: Engine;
794
+ timestamp: number;
795
+ }
796
+ }
797
+
798
+ class Result extends GObject.Object {
799
+ static $gtype: GObject.GType<Result>;
800
+
801
+ // Own properties of Jcat.Result
802
+
803
+ get authority(): string;
804
+ set authority(val: string);
805
+ get engine(): Engine;
806
+ get timestamp(): number;
807
+ set timestamp(val: number);
808
+
809
+ // Constructors of Jcat.Result
810
+
811
+ constructor(properties?: Partial<Result.ConstructorProps>, ...args: any[]);
812
+
813
+ _init(...args: any[]): void;
814
+
815
+ // Own methods of Jcat.Result
816
+
817
+ /**
818
+ * Gets the signing authority, if set.
819
+ * @returns string, or %NULL
820
+ */
821
+ get_authority(): string;
822
+ /**
823
+ * Gets the blob kind.
824
+ * @returns #JcatBlobKind, e.g. %JCAT_BLOB_KIND_SHA256
825
+ */
826
+ get_kind(): BlobKind;
827
+ /**
828
+ * Gets the verification kind.
829
+ * @returns #JcatBlobMethod, e.g. %JCAT_BLOB_METHOD_SIGNATURE
830
+ */
831
+ get_method(): BlobMethod;
832
+ /**
833
+ * Gets the signing timestamp, if set.
834
+ * @returns UNIX timestamp, or 0 if unset
835
+ */
836
+ get_timestamp(): number;
837
+ /**
838
+ * Converts the #JcatResult to a string.
839
+ * @returns string
840
+ */
841
+ to_string(): string;
842
+ }
843
+
844
+ type BlobClass = typeof Blob;
845
+ type BtCheckpointClass = typeof BtCheckpoint;
846
+ type BtVerifierClass = typeof BtVerifier;
847
+ type ContextClass = typeof Context;
848
+ type EngineClass = typeof Engine;
849
+ type FileClass = typeof File;
850
+ type ItemClass = typeof Item;
851
+ type ResultClass = typeof Result;
852
+ /**
853
+ * Name of the imported GIR library
854
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
855
+ */
856
+ const __name__: string;
857
+ /**
858
+ * Version of the imported GIR library
859
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
860
+ */
861
+ const __version__: string;
862
+ }
863
+
864
+ export default Jcat;
865
+ // END
package/jcat-1.0.js ADDED
@@ -0,0 +1,6 @@
1
+
2
+ // @ts-expect-error
3
+ import Jcat from 'gi://Jcat?version=1.0';
4
+ export { Jcat };
5
+ export default Jcat;
6
+
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@girs/jcat-1.0",
3
+ "version": "0.2.1-4.0.0",
4
+ "description": "GJS TypeScript type definitions for Jcat-1.0, generated from library version 0.2.1",
5
+ "type": "module",
6
+ "module": "jcat-1.0.js",
7
+ "main": "jcat-1.0.js",
8
+ "exports": {
9
+ "./ambient": {
10
+ "types": "./jcat-1.0-ambient.d.ts",
11
+ "import": "./jcat-1.0-ambient.js",
12
+ "default": "./jcat-1.0-ambient.js"
13
+ },
14
+ "./import": {
15
+ "types": "./jcat-1.0-import.d.ts",
16
+ "import": "./jcat-1.0-import.js",
17
+ "default": "./jcat-1.0-import.js"
18
+ },
19
+ ".": {
20
+ "types": "./jcat-1.0.d.ts",
21
+ "import": "./jcat-1.0.js",
22
+ "default": "./jcat-1.0.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "test": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit jcat-1.0.d.ts"
27
+ },
28
+ "dependencies": {
29
+ "@girs/gio-2.0": "^2.77.0-4.0.0-beta.1",
30
+ "@girs/gjs": "^4.0.0-beta.1",
31
+ "@girs/glib-2.0": "^2.77.0-4.0.0-beta.1",
32
+ "@girs/gobject-2.0": "^2.77.0-4.0.0-beta.1",
33
+ "@girs/json-1.0": "^1.7.1-4.0.0-beta.1"
34
+ },
35
+ "devDependencies": {
36
+ "typescript": "*"
37
+ },
38
+ "keywords": [
39
+ "Gir",
40
+ "TypeScript",
41
+ "types",
42
+ "GObject-Introspection",
43
+ "GJS",
44
+ "Jcat-1.0"
45
+ ],
46
+ "author": "ts-for-gir",
47
+ "license": "MIT",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/gjsify/ts-for-gir.git"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/gjsify/ts-for-gir/issues"
54
+ },
55
+ "homepage": "https://github.com/gjsify/types/tree/main/jcat-1.0#readme"
56
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ // General settings for code interpretation
4
+ "target": "ESNext",
5
+ "module": "ESNext",
6
+ "lib": ["ESNext"],
7
+ "types": [],
8
+ "experimentalDecorators": true,
9
+ "moduleResolution": "node",
10
+ "noEmit": true,
11
+ "noEmitOnError": false,
12
+ "baseUrl": "./",
13
+ "rootDir": ".",
14
+ // General settings for code generation
15
+ "removeComments": false,
16
+ "inlineSourceMap": false,
17
+ "inlineSources": false,
18
+ "newLine": "LF"
19
+ },
20
+ "include": ["./jcat-1.0.d.ts"]
21
+ }
22
+
23
+
package/typedoc.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "entryPoints": ["./jcat-1.0.d.ts"],
3
+ "readme": "./README.md",
4
+ "name": "Jcat-1.0",
5
+ "tsconfig": "./tsconfig.json"
6
+ }
7
+