@girs/gck-2 4.0.0-3.0.0-beta.12

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/gck-2.d.cts ADDED
@@ -0,0 +1,3452 @@
1
+
2
+ /*
3
+ * Type Definitions for Gjs (https://gjs.guide/)
4
+ *
5
+ * These type definitions are automatically generated, do not edit them by hand.
6
+ * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gjs
7
+ */
8
+ /**
9
+ * Gck-2
10
+ */
11
+
12
+ import type Gio from '@girs/gio-2.0';
13
+ import type GObject from '@girs/gobject-2.0';
14
+ import type GLib from '@girs/glib-2.0';
15
+
16
+ /**
17
+ * Flags to be used with a [method`Builder`.init_full] and [ctor`Builder`.new].
18
+ */
19
+ export enum BuilderFlags {
20
+ /**
21
+ * no special flags
22
+ */
23
+ NONE,
24
+ /**
25
+ * use non-pageable memory for the values of the attributes
26
+ */
27
+ SECURE_MEMORY,
28
+ }
29
+ /**
30
+ * Various error codes. All the `CKR_XXX` error codes from PKCS#11 are also
31
+ * relevant error codes.
32
+ *
33
+ * Note that errors are returned as [struct`GLib`.Error] structures. The `code`
34
+ * member of the error then contains the raw PKCS#11 `CK_RV` result value.
35
+ */
36
+ export enum Error {
37
+ /**
38
+ * a result code that signifies there was a problem
39
+ * loading a PKCS#11 module, usually a shared library
40
+ */
41
+ PROBLEM,
42
+ }
43
+ /**
44
+ * Various error codes used with PKCS#11 URIs
45
+ */
46
+ export enum UriError {
47
+ /**
48
+ * invalid URI scheme
49
+ */
50
+ BAD_SCHEME,
51
+ /**
52
+ * bad URI encoding
53
+ */
54
+ BAD_ENCODING,
55
+ /**
56
+ * bad URI syntax
57
+ */
58
+ BAD_SYNTAX,
59
+ /**
60
+ * bad URI version component
61
+ */
62
+ BAD_VERSION,
63
+ /**
64
+ * piece of the URI was not found
65
+ */
66
+ NOT_FOUND,
67
+ }
68
+ /**
69
+ * Options for creating sessions.
70
+ * @bitfield
71
+ */
72
+ export enum SessionOptions {
73
+ /**
74
+ * Open session as read only
75
+ */
76
+ READ_ONLY,
77
+ /**
78
+ * Open sessions as read/write
79
+ */
80
+ READ_WRITE,
81
+ /**
82
+ * Login as user on new sessions
83
+ */
84
+ LOGIN_USER,
85
+ /**
86
+ * Authenticate as necessary
87
+ */
88
+ AUTHENTICATE,
89
+ }
90
+ /**
91
+ * Which parts of the PKCS#11 URI will be parsed or formatted. These can be
92
+ * combined.
93
+ * @bitfield
94
+ */
95
+ export enum UriFlags {
96
+ /**
97
+ * the URI will be used to match objects.
98
+ */
99
+ FOR_OBJECT,
100
+ /**
101
+ * the URI will be used to match tokens.
102
+ */
103
+ FOR_TOKEN,
104
+ /**
105
+ * the URI will be used to match modules.
106
+ */
107
+ FOR_MODULE,
108
+ /**
109
+ * the URI has specific version numbers for module and/or token
110
+ */
111
+ WITH_VERSION,
112
+ /**
113
+ * parse all recognized components of the URI.
114
+ */
115
+ FOR_ANY,
116
+ }
117
+ /**
118
+ * Used as a terminator at the end of variable argument lists.
119
+ */
120
+ export const INVALID: number
121
+ /**
122
+ * The major version number of the Gck library.
123
+ */
124
+ export const MAJOR_VERSION: number
125
+ /**
126
+ * The micro version number of the Gck library.
127
+ */
128
+ export const MICRO_VERSION: number
129
+ /**
130
+ * The minor version number of the Gck library.
131
+ */
132
+ export const MINOR_VERSION: number
133
+ /**
134
+ * The URI will match specific version of modules. To be used as a GckUriFlags argument.
135
+ */
136
+ export const URI_FOR_MODULE_WITH_VERSION: number
137
+ /**
138
+ * The URI will match objects on a specific token. To be used as a GckUriFlags argument.
139
+ */
140
+ export const URI_FOR_OBJECT_ON_TOKEN: number
141
+ /**
142
+ * The token inserted into a device with a specific module.
143
+ */
144
+ export const URI_FOR_OBJECT_ON_TOKEN_AND_MODULE: number
145
+ /**
146
+ * Custom PKCS#11 errors that originate from the gck library, are
147
+ * based at this error code.
148
+ */
149
+ export const VENDOR_CODE: number
150
+ export function error_quark(): GLib.Quark
151
+ /**
152
+ * Get a message for a PKCS#11 return value or error code. Do not
153
+ * pass `CKR_OK` or other non-errors to this function.
154
+ * @param rv The PKCS#11 return value to get a message for.
155
+ * @returns The user readable message.
156
+ */
157
+ export function message_from_rv(rv: number): string | null
158
+ /**
159
+ * Setup an enumerator for listing matching objects on the modules.
160
+ *
161
+ * This call will not block but will return an enumerator immediately.
162
+ * @param modules The modules
163
+ * @param attrs attributes that the objects must have, or empty for all objects
164
+ * @param session_options Options from GckSessionOptions
165
+ * @returns A new enumerator, which should be released with g_object_unref().
166
+ */
167
+ export function modules_enumerate_objects(modules: Module[], attrs: Attributes, session_options: SessionOptions): Enumerator
168
+ /**
169
+ * Enumerate objects that match a URI.
170
+ *
171
+ * This call will not block. Use the [class`Enumerator]` functions in order to
172
+ * get at the actual objects that match.
173
+ * @param modules The modules
174
+ * @param uri The URI that the enumerator will match
175
+ * @param session_options Options from GckSessionOptions
176
+ * @returns A new #GckEnumerator, or %NULL if an error occurs.
177
+ */
178
+ export function modules_enumerate_uri(modules: Module[], uri: string | null, session_options: SessionOptions): Enumerator
179
+ /**
180
+ * Get a list of slots for across all of the modules.
181
+ * @param modules The modules
182
+ * @param token_present Whether to only list slots with token present
183
+ * @returns A list of #GckSlot objects.
184
+ */
185
+ export function modules_get_slots(modules: Module[], token_present: boolean): Slot[]
186
+ /**
187
+ * Load and initialize all the registered modules.
188
+ * @param cancellable optional cancellation object
189
+ * @returns A newly allocated list of #GckModule objects.
190
+ */
191
+ export function modules_initialize_registered(cancellable: Gio.Cancellable | null): Module[]
192
+ /**
193
+ * Load and initialize all the registered modules asynchronously.
194
+ * @param cancellable optional cancellation object
195
+ * @param callback a callback which will be called when the operation completes
196
+ */
197
+ export function modules_initialize_registered_async<Z = unknown>(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<Z> | null): void
198
+ /**
199
+ * Finishes the asynchronous operation to initialize the registered
200
+ * PKCS#11 modules.
201
+ * @param result the asynchronous result
202
+ * @returns a list of newly initialized #GckModule objects
203
+ */
204
+ export function modules_initialize_registered_finish(result: Gio.AsyncResult): Module[]
205
+ /**
206
+ * Find an object that matches a URI.
207
+ *
208
+ * This call can block. Use [func`modules_enumerate_uri]` for a non-blocking
209
+ * version.
210
+ * @param modules The modules
211
+ * @param uri The URI the objects must match
212
+ * @param session_options Options from GckSessionOptions
213
+ * @returns A new #GckObject which should be released with g_object_unref(), or %NULL if no matching object was found.
214
+ */
215
+ export function modules_object_for_uri(modules: Module[], uri: string | null, session_options: SessionOptions): Object | null
216
+ /**
217
+ * Find objects that match a URI.
218
+ *
219
+ * This call can block. Use [func`modules_enumerate_uri]` for a non-blocking
220
+ * version.
221
+ * @param modules The modules
222
+ * @param uri The URI the objects must match
223
+ * @param session_options Options from GckSessionOptions
224
+ * @returns A (possibly empty) list of `Gck.Object`s.
225
+ */
226
+ export function modules_objects_for_uri(modules: Module[], uri: string | null, session_options: SessionOptions): Object[]
227
+ /**
228
+ * Lookup a token that matches the URI.
229
+ * @param modules The modules
230
+ * @param uri The URI that the token must match
231
+ * @returns A newly allocated #GckSlot or %NULL if no such token was found.
232
+ */
233
+ export function modules_token_for_uri(modules: Module[], uri: string | null): Slot
234
+ /**
235
+ * Lookup a token that matches the URI.
236
+ * @param modules The modules
237
+ * @param uri The URI that the token must match
238
+ * @returns A list of newly allocated #GckSlot objects.
239
+ */
240
+ export function modules_tokens_for_uri(modules: Module[], uri: string | null): Slot[]
241
+ /**
242
+ * Initialize a list of GckObject from raw PKCS#11 handles. The handles argument must contain
243
+ * contiguous CK_OBJECT_HANDLE handles in an array.
244
+ * @param session The session for these objects
245
+ * @param object_handles The raw object handles.
246
+ * @returns The list of #GckObject objects.
247
+ */
248
+ export function objects_from_handle_array(session: Session, object_handles: number[]): Object[]
249
+ /**
250
+ * Setup an enumerator for listing matching objects on the slots.
251
+ *
252
+ * This call will not block but will return an enumerator immediately.
253
+ * @param slots a list of #GckSlot to enumerate objects on.
254
+ * @param match attributes that the objects must match, or empty for all objects
255
+ * @param options options for opening a session
256
+ * @returns a new enumerator
257
+ */
258
+ export function slots_enumerate_objects(slots: Slot[], match: Attributes, options: SessionOptions): Enumerator
259
+ /**
260
+ * Parse a PKCS#11 URI for use in a given context.
261
+ *
262
+ * The result will contain the fields that are relevant for
263
+ * the given context. See #GckUriData for more info.
264
+ * Other fields will be set to %NULL.
265
+ * @param string the URI to parse.
266
+ * @param flags the context in which the URI will be used.
267
+ * @returns a newly allocated #GckUriData; which should be freed with gck_uri_data_free()
268
+ */
269
+ export function uri_data_parse(string: string | null, flags: UriFlags): UriData
270
+ export function uri_error_quark(): GLib.Quark
271
+ /**
272
+ * Convert `CK_BBOOL` type memory to a boolean.
273
+ * @param value memory to convert
274
+ * @returns Whether the conversion was successful.
275
+ */
276
+ export function value_to_boolean(value: Uint8Array): [ /* returnType */ boolean, /* result */ boolean ]
277
+ /**
278
+ * Convert `CK_ULONG` type memory to a boolean.
279
+ * @param value memory to convert
280
+ * @returns Whether the conversion was successful.
281
+ */
282
+ export function value_to_ulong(value: Uint8Array): [ /* returnType */ boolean, /* result */ number ]
283
+ /**
284
+ * An allocator used to allocate data for the attributes in this
285
+ * [struct`Attributes]` set.
286
+ *
287
+ * This is a function that acts like g_realloc. Specifically it frees when length is
288
+ * set to zero, it allocates when data is set to %NULL, and it reallocates when both
289
+ * are valid.
290
+ * @callback
291
+ * @param data Memory to allocate or deallocate.
292
+ * @param length New length of memory.
293
+ * @returns The allocated memory, or %NULL when freeing.
294
+ */
295
+ export interface Allocator {
296
+ (data: any | null, length: number): any | null
297
+ }
298
+ export module ObjectCache {
299
+
300
+ // Constructor properties interface
301
+
302
+ export interface ConstructorProperties extends Object.ConstructorProperties, GObject.Object.ConstructorProperties {
303
+
304
+ // Own constructor properties of Gck-2.Gck.ObjectCache
305
+
306
+ /**
307
+ * The attributes cached on this object.
308
+ */
309
+ attributes?: Attributes | null
310
+ }
311
+
312
+ }
313
+
314
+ export interface ObjectCache extends Object {
315
+
316
+ // Own properties of Gck-2.Gck.ObjectCache
317
+
318
+ /**
319
+ * The attributes cached on this object.
320
+ */
321
+ attributes: Attributes
322
+
323
+ // Owm methods of Gck-2.Gck.ObjectCache
324
+
325
+ /**
326
+ * Adds the attributes to the set cached on this object. If an attribute is
327
+ * already present in the cache it will be overridden by this value.
328
+ *
329
+ * This will be done in a thread-safe manner.
330
+ * @param attrs the attributes to cache
331
+ */
332
+ fill(attrs: Attributes): void
333
+ /**
334
+ * Sets the attributes cached on this object.
335
+ * @param attrs the attributes to set
336
+ */
337
+ set_attributes(attrs: Attributes | null): void
338
+ /**
339
+ * Update the object cache with given attributes. If an attribute already
340
+ * exists in the cache, it will be updated, and if it doesn't it will be added.
341
+ *
342
+ * This may block, use the asynchronous version when this is not desirable
343
+ * @param attr_types the types of attributes to update
344
+ * @param cancellable optional cancellation object
345
+ * @returns whether the cache update was successful
346
+ */
347
+ update(attr_types: number[], cancellable: Gio.Cancellable | null): boolean
348
+ /**
349
+ * Update the object cache with given attributes. If an attribute already
350
+ * exists in the cache, it will be updated, and if it doesn't it will be added.
351
+ *
352
+ * This call will return immediately and complete asynchronously.
353
+ * @param attr_types the types of attributes to update
354
+ * @param cancellable optional cancellation object
355
+ * @param callback called when the operation completes
356
+ */
357
+ update_async(attr_types: number[], cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
358
+ /**
359
+ * Complete an asynchronous operation to update the object cache with given
360
+ * attributes.
361
+ * @param result the asynchronous result passed to the callback
362
+ * @returns whether the cache update was successful
363
+ */
364
+ update_finish(result: Gio.AsyncResult): boolean
365
+
366
+ // Conflicting methods
367
+
368
+ /**
369
+ * Get the data for the specified attribute from the object. For convenience
370
+ * the returned data has a null terminator.
371
+ *
372
+ * This call may block for an indefinite period.
373
+ * @param attr_type The attribute to get data for.
374
+ * @param cancellable A #GCancellable or %NULL
375
+ * @returns the resulting PKCS#11 attribute data, or %NULL if an error occurred
376
+ */
377
+ get_data(attr_type: number, cancellable: Gio.Cancellable | null): Uint8Array
378
+
379
+ // Overloads of get_data
380
+
381
+ /**
382
+ * Gets a named field from the objects table of associations (see g_object_set_data()).
383
+ * @param key name of the key for that association
384
+ * @returns the data if found, or %NULL if no such data exists.
385
+ */
386
+ get_data(key: string | null): any | null
387
+ /**
388
+ * Gets a named field from the objects table of associations (see g_object_set_data()).
389
+ * @param key name of the key for that association
390
+ * @returns the data if found, or %NULL if no such data exists.
391
+ */
392
+ get_data(key: string | null): any | null
393
+
394
+ // Own virtual methods of Gck-2.Gck.ObjectCache
395
+
396
+ /**
397
+ * Adds the attributes to the set cached on this object. If an attribute is
398
+ * already present in the cache it will be overridden by this value.
399
+ *
400
+ * This will be done in a thread-safe manner.
401
+ * @virtual
402
+ * @param attrs the attributes to cache
403
+ */
404
+ vfunc_fill(attrs: Attributes): void
405
+
406
+ // Class property signals of Gck-2.Gck.ObjectCache
407
+
408
+ connect(sigName: "notify::attributes", callback: (($obj: ObjectCache, pspec: GObject.ParamSpec) => void)): number
409
+ connect_after(sigName: "notify::attributes", callback: (($obj: ObjectCache, pspec: GObject.ParamSpec) => void)): number
410
+ emit(sigName: "notify::attributes", ...args: any[]): void
411
+ connect(sigName: "notify::handle", callback: (($obj: ObjectCache, pspec: GObject.ParamSpec) => void)): number
412
+ connect_after(sigName: "notify::handle", callback: (($obj: ObjectCache, pspec: GObject.ParamSpec) => void)): number
413
+ emit(sigName: "notify::handle", ...args: any[]): void
414
+ connect(sigName: "notify::module", callback: (($obj: ObjectCache, pspec: GObject.ParamSpec) => void)): number
415
+ connect_after(sigName: "notify::module", callback: (($obj: ObjectCache, pspec: GObject.ParamSpec) => void)): number
416
+ emit(sigName: "notify::module", ...args: any[]): void
417
+ connect(sigName: "notify::session", callback: (($obj: ObjectCache, pspec: GObject.ParamSpec) => void)): number
418
+ connect_after(sigName: "notify::session", callback: (($obj: ObjectCache, pspec: GObject.ParamSpec) => void)): number
419
+ emit(sigName: "notify::session", ...args: any[]): void
420
+ connect(sigName: string, callback: (...args: any[]) => void): number
421
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
422
+ emit(sigName: string, ...args: any[]): void
423
+ disconnect(id: number): void
424
+ }
425
+
426
+ /**
427
+ * An interface implemented by derived classes of [class`Object]` to indicate
428
+ * which attributes they'd like an enumerator to retrieve.
429
+ *
430
+ * These attributes are then cached on the object and can be retrieved through
431
+ * the [property`ObjectCache:`attributes] property.
432
+ * @interface
433
+ */
434
+ export class ObjectCache extends GObject.Object {
435
+
436
+ // Own properties of Gck-2.Gck.ObjectCache
437
+
438
+ static name: string
439
+ static $gtype: GObject.GType<ObjectCache>
440
+
441
+ // Constructors of Gck-2.Gck.ObjectCache
442
+
443
+ constructor(config?: ObjectCache.ConstructorProperties)
444
+ _init(config?: ObjectCache.ConstructorProperties): void
445
+ }
446
+
447
+ export module Enumerator {
448
+
449
+ // Constructor properties interface
450
+
451
+ export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
452
+
453
+ // Own constructor properties of Gck-2.Gck.Enumerator
454
+
455
+ /**
456
+ * Chained enumerator, which will be enumerated when this enumerator
457
+ * has enumerated all its objects.
458
+ */
459
+ chained?: Enumerator | null
460
+ /**
461
+ * Interaction object used to ask the user for pins when opening
462
+ * sessions. Used if the session_options of the enumerator have
463
+ * %GCK_SESSION_LOGIN_USER
464
+ */
465
+ interaction?: Gio.TlsInteraction | null
466
+ }
467
+
468
+ }
469
+
470
+ export interface Enumerator {
471
+
472
+ // Own properties of Gck-2.Gck.Enumerator
473
+
474
+ /**
475
+ * Chained enumerator, which will be enumerated when this enumerator
476
+ * has enumerated all its objects.
477
+ */
478
+ chained: Enumerator
479
+ /**
480
+ * Interaction object used to ask the user for pins when opening
481
+ * sessions. Used if the session_options of the enumerator have
482
+ * %GCK_SESSION_LOGIN_USER
483
+ */
484
+ interaction: Gio.TlsInteraction
485
+
486
+ // Owm methods of Gck-2.Gck.Enumerator
487
+
488
+ /**
489
+ * Get the enumerator that will be run after all objects from this one
490
+ * are seen.
491
+ * @returns the chained enumerator or %NULL
492
+ */
493
+ get_chained(): Enumerator | null
494
+ /**
495
+ * Get the interaction used when a pin is needed
496
+ * @returns the interaction or %NULL
497
+ */
498
+ get_interaction(): Gio.TlsInteraction | null
499
+ /**
500
+ * Get the type of objects created by this enumerator. The type will always
501
+ * either be #GckObject or derived from it.
502
+ * @returns the type of objects created
503
+ */
504
+ get_object_type(): GObject.GType
505
+ /**
506
+ * Get the next object in the enumerator, or %NULL if there are no more objects.
507
+ *
508
+ * %NULL is also returned if the function fails. Use the `error` to determine
509
+ * whether a failure occurred or not.
510
+ * @param cancellable A #GCancellable or %NULL
511
+ * @returns The next object, which must be released using g_object_unref, or %NULL.
512
+ */
513
+ next(cancellable: Gio.Cancellable | null): Object | null
514
+ /**
515
+ * Get the next set of objects from the enumerator. This operation completes
516
+ * asynchronously.The maximum number of objects can be specified with
517
+ * `max_objects`. If -1 is specified, then all the remaining objects will be
518
+ * enumerated.
519
+ * @param max_objects The maximum number of objects to get
520
+ * @param cancellable A #GCancellable or %NULL
521
+ * @param callback Called when the result is ready
522
+ */
523
+ next_async(max_objects: number, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
524
+ /**
525
+ * Complete an operation to enumerate next objects.
526
+ *
527
+ * %NULL is also returned if the function fails. Use the `error` to determine
528
+ * whether a failure occurred or not.
529
+ * @param result The result passed to the callback
530
+ * @returns A list of `Gck.Object`s
531
+ */
532
+ next_finish(result: Gio.AsyncResult): Object[]
533
+ /**
534
+ * Get the next set of objects from the enumerator. The maximum number of
535
+ * objects can be specified with `max_objects`. If -1 is specified, then all
536
+ * the remaining objects will be returned.
537
+ *
538
+ * %NULL is also returned if the function fails. Use the `error` to determine
539
+ * whether a failure occurred or not.
540
+ * @param max_objects The maximum amount of objects to enumerate
541
+ * @param cancellable A #GCancellable or %NULL
542
+ * @returns A list of `Gck.Object`s
543
+ */
544
+ next_n(max_objects: number, cancellable: Gio.Cancellable | null): Object[]
545
+ /**
546
+ * Set a chained enumerator that will be run after all objects from this one
547
+ * are seen.
548
+ * @param chained the chained enumerator or %NULL
549
+ */
550
+ set_chained(chained: Enumerator | null): void
551
+ /**
552
+ * Set the interaction used when a pin is needed
553
+ * @param interaction the interaction or %NULL
554
+ */
555
+ set_interaction(interaction: Gio.TlsInteraction | null): void
556
+ /**
557
+ * Set the type of objects to be created by this enumerator. The type must
558
+ * always be either #GckObject or derived from it.
559
+ *
560
+ * If `attr_types` and `attr_count` are non-NULL and non-zero respectively,
561
+ * then the #GckObjectCache interface is expected to be implemented on the
562
+ * derived class, then the enumerator will retrieve attributes for each object.
563
+ * @param object_type the type of objects to create
564
+ * @param attr_types types of attributes to retrieve for objects
565
+ */
566
+ set_object_type(object_type: GObject.GType, attr_types: number[]): void
567
+
568
+ // Class property signals of Gck-2.Gck.Enumerator
569
+
570
+ connect(sigName: "notify::chained", callback: (($obj: Enumerator, pspec: GObject.ParamSpec) => void)): number
571
+ connect_after(sigName: "notify::chained", callback: (($obj: Enumerator, pspec: GObject.ParamSpec) => void)): number
572
+ emit(sigName: "notify::chained", ...args: any[]): void
573
+ connect(sigName: "notify::interaction", callback: (($obj: Enumerator, pspec: GObject.ParamSpec) => void)): number
574
+ connect_after(sigName: "notify::interaction", callback: (($obj: Enumerator, pspec: GObject.ParamSpec) => void)): number
575
+ emit(sigName: "notify::interaction", ...args: any[]): void
576
+ connect(sigName: string, callback: (...args: any[]) => void): number
577
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
578
+ emit(sigName: string, ...args: any[]): void
579
+ disconnect(id: number): void
580
+ }
581
+
582
+ /**
583
+ * Can be used to enumerate through PKCS#11 objects. It will automatically
584
+ * create sessions as necessary.
585
+ *
586
+ * Use [func`modules_enumerate_objects]` or [func`modules_enumerate_uri]` to
587
+ * create an enumerator. To get the objects, use [method`Enumerator`.next] or
588
+ * [method`Enumerator`.next_async] functions.
589
+ * @class
590
+ */
591
+ export class Enumerator extends GObject.Object {
592
+
593
+ // Own properties of Gck-2.Gck.Enumerator
594
+
595
+ static name: string
596
+ static $gtype: GObject.GType<Enumerator>
597
+
598
+ // Constructors of Gck-2.Gck.Enumerator
599
+
600
+ constructor(config?: Enumerator.ConstructorProperties)
601
+ _init(config?: Enumerator.ConstructorProperties): void
602
+ }
603
+
604
+ export module Module {
605
+
606
+ // Constructor properties interface
607
+
608
+ export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
609
+
610
+ // Own constructor properties of Gck-2.Gck.Module
611
+
612
+ /**
613
+ * The raw PKCS&num;11 function list for the module.
614
+ *
615
+ * This points to a CK_FUNCTION_LIST structure.
616
+ */
617
+ functions?: any | null
618
+ /**
619
+ * The PKCS&num;11 module file path.
620
+ *
621
+ * This may be set to NULL if this object was created from an already
622
+ * initialized module via the gck_module_new() function.
623
+ */
624
+ path?: string | null
625
+ }
626
+
627
+ }
628
+
629
+ export interface Module {
630
+
631
+ // Own properties of Gck-2.Gck.Module
632
+
633
+ /**
634
+ * The raw PKCS&num;11 function list for the module.
635
+ *
636
+ * This points to a CK_FUNCTION_LIST structure.
637
+ */
638
+ readonly functions: any
639
+ /**
640
+ * The PKCS&num;11 module file path.
641
+ *
642
+ * This may be set to NULL if this object was created from an already
643
+ * initialized module via the gck_module_new() function.
644
+ */
645
+ readonly path: string | null
646
+
647
+ // Own fields of Gck-2.Gck.Module
648
+
649
+ parent_instance: GObject.Object
650
+
651
+ // Owm methods of Gck-2.Gck.Module
652
+
653
+ /**
654
+ * Checks equality of two modules. Two GckModule objects can point to the same
655
+ * underlying PKCS#11 module.
656
+ * @param module2 a second #GckModule
657
+ * @returns %TRUE if module1 and module2 are equal. %FALSE if either is not a GckModule.
658
+ */
659
+ equal(module2: Module): boolean
660
+ /**
661
+ * Get the info about a PKCS#11 module.
662
+ * @returns the module info; release this with gck_module_info_free()
663
+ */
664
+ get_info(): ModuleInfo
665
+ /**
666
+ * Get the file path of this module. This may not be an absolute path, and
667
+ * usually reflects the path passed to [func`Module`.initialize].
668
+ * @returns The path, do not modify or free this value.
669
+ */
670
+ get_path(): string | null
671
+ /**
672
+ * Get the GckSlot objects for a given module.
673
+ * @param token_present Whether to limit only to slots with a token present.
674
+ * @returns The possibly empty list of slots.
675
+ */
676
+ get_slots(token_present: boolean): Slot[]
677
+ /**
678
+ * Create a hash value for the GckModule.
679
+ *
680
+ * This function is intended for easily hashing a [class`Module]` to add to
681
+ * a [struct`GLib`.HashTable] or similar data structure.
682
+ * @returns An integer that can be used as a hash value, or 0 if invalid.
683
+ */
684
+ hash(): number
685
+ /**
686
+ * Check whether the PKCS#11 URI matches the module
687
+ * @param uri the uri to match against the module
688
+ * @returns whether the URI matches or not
689
+ */
690
+ match(uri: UriData): boolean
691
+
692
+ // Own virtual methods of Gck-2.Gck.Module
693
+
694
+ vfunc_authenticate_object(object: Object, label: string | null, password: string | null): boolean
695
+ vfunc_authenticate_slot(slot: Slot, label: string | null, password: string | null): boolean
696
+
697
+ // Class property signals of Gck-2.Gck.Module
698
+
699
+ connect(sigName: "notify::functions", callback: (($obj: Module, pspec: GObject.ParamSpec) => void)): number
700
+ connect_after(sigName: "notify::functions", callback: (($obj: Module, pspec: GObject.ParamSpec) => void)): number
701
+ emit(sigName: "notify::functions", ...args: any[]): void
702
+ connect(sigName: "notify::path", callback: (($obj: Module, pspec: GObject.ParamSpec) => void)): number
703
+ connect_after(sigName: "notify::path", callback: (($obj: Module, pspec: GObject.ParamSpec) => void)): number
704
+ emit(sigName: "notify::path", ...args: any[]): void
705
+ connect(sigName: string, callback: (...args: any[]) => void): number
706
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
707
+ emit(sigName: string, ...args: any[]): void
708
+ disconnect(id: number): void
709
+ }
710
+
711
+ /**
712
+ * Holds a loaded PKCS#11 module. A PKCS#11 module is a shared library.
713
+ *
714
+ * You can load and initialize a PKCS#11 module with the
715
+ * [func`Module`.initialize] call. If you already have a loaded and
716
+ * initialized module that you'd like to use with the various Gck functions,
717
+ * then you can use [ctor`Module`.new].
718
+ * @class
719
+ */
720
+ export class Module extends GObject.Object {
721
+
722
+ // Own properties of Gck-2.Gck.Module
723
+
724
+ static name: string
725
+ static $gtype: GObject.GType<Module>
726
+
727
+ // Constructors of Gck-2.Gck.Module
728
+
729
+ constructor(config?: Module.ConstructorProperties)
730
+ _init(config?: Module.ConstructorProperties): void
731
+ /**
732
+ * Load and initialize a PKCS#11 module represented by a GckModule object.
733
+ * @param path The file system path to the PKCS#11 module to load.
734
+ * @param cancellable optional cancellation object
735
+ * @returns The loaded PKCS#11 module or %NULL if failed.
736
+ */
737
+ static initialize(path: string | null, cancellable: Gio.Cancellable | null): Module
738
+ /**
739
+ * Asynchronously load and initialize a PKCS#11 module represented by a
740
+ * [class`Module]` object.
741
+ * @param path the file system path to the PKCS#11 module to load
742
+ * @param cancellable optional cancellation object
743
+ * @param callback a callback which will be called when the operation completes
744
+ */
745
+ static initialize_async(path: string | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<Module> | null): void
746
+ /**
747
+ * Finishes the asynchronous initialize operation.
748
+ * @param result the asynchronous result
749
+ * @returns The initialized module, or %NULL
750
+ */
751
+ static initialize_finish(result: Gio.AsyncResult): Module | null
752
+ }
753
+
754
+ export module Object {
755
+
756
+ // Constructor properties interface
757
+
758
+ export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
759
+
760
+ // Own constructor properties of Gck-2.Gck.Object
761
+
762
+ /**
763
+ * The raw PKCS11 handle for this object.
764
+ */
765
+ handle?: number | null
766
+ /**
767
+ * The GckModule that this object belongs to.
768
+ */
769
+ module?: Module | null
770
+ /**
771
+ * The PKCS11 session to make calls on when this object needs to
772
+ * perform operations on itself.
773
+ *
774
+ * If this is NULL then a new session is opened for each operation,
775
+ * such as gck_object_get(), gck_object_set() or gck_object_destroy().
776
+ */
777
+ session?: Session | null
778
+ }
779
+
780
+ }
781
+
782
+ export interface Object {
783
+
784
+ // Own properties of Gck-2.Gck.Object
785
+
786
+ /**
787
+ * The raw PKCS11 handle for this object.
788
+ */
789
+ readonly handle: number
790
+ /**
791
+ * The GckModule that this object belongs to.
792
+ */
793
+ readonly module: Module
794
+ /**
795
+ * The PKCS11 session to make calls on when this object needs to
796
+ * perform operations on itself.
797
+ *
798
+ * If this is NULL then a new session is opened for each operation,
799
+ * such as gck_object_get(), gck_object_set() or gck_object_destroy().
800
+ */
801
+ readonly session: Session
802
+
803
+ // Own fields of Gck-2.Gck.Object
804
+
805
+ parent_instance: GObject.Object
806
+
807
+ // Owm methods of Gck-2.Gck.Object
808
+
809
+ /**
810
+ * Lookup attributes in the cache, or retrieve them from the object if necessary.
811
+ *
812
+ * If `object` is a #GckObjectCache then this will lookup the attributes there
813
+ * first if available, otherwise will read them from the object and update
814
+ * the cache.
815
+ *
816
+ * If `object` is not a #GckObjectCache, then the attributes will simply be
817
+ * read from the object.
818
+ *
819
+ * This may block, use the asynchronous version when this is not desirable
820
+ * @param attr_types the types of attributes to update
821
+ * @param cancellable optional cancellation object
822
+ * @returns the attributes retrieved or %NULL on failure
823
+ */
824
+ cache_lookup(attr_types: number[], cancellable: Gio.Cancellable | null): Attributes
825
+ /**
826
+ * Lookup attributes in the cache, or retrieve them from the object if necessary.
827
+ *
828
+ * If `object` is a #GckObjectCache then this will lookup the attributes there
829
+ * first if available, otherwise will read them from the object and update
830
+ * the cache.
831
+ *
832
+ * If `object` is not a #GckObjectCache, then the attributes will simply be
833
+ * read from the object.
834
+ *
835
+ * This will return immediately and complete asynchronously
836
+ * @param attr_types the types of attributes to update
837
+ * @param cancellable optional cancellation object
838
+ * @param callback called when the operation completes
839
+ */
840
+ cache_lookup_async(attr_types: number[], cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
841
+ /**
842
+ * Complete an operation to lookup attributes in the cache or retrieve them
843
+ * from the object if necessary.
844
+ * @param result the asynchrounous result passed to the callback
845
+ * @returns the attributes retrieved or %NULL on failure
846
+ */
847
+ cache_lookup_finish(result: Gio.AsyncResult): Attributes
848
+ /**
849
+ * Destroy a PKCS#11 object, deleting it from storage or the session.
850
+ * This call may block for an indefinite period.
851
+ * @param cancellable Optional cancellable object, or %NULL to ignore.
852
+ * @returns Whether the call was successful or not.
853
+ */
854
+ destroy(cancellable: Gio.Cancellable | null): boolean
855
+ /**
856
+ * Destroy a PKCS#11 object, deleting it from storage or the session.
857
+ * This call will return immediately and complete asynchronously.
858
+ * @param cancellable Optional cancellable object, or %NULL to ignore.
859
+ * @param callback Callback which is called when operation completes.
860
+ */
861
+ destroy_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
862
+ /**
863
+ * Get the status of the operation to destroy a PKCS#11 object, begun with
864
+ * gck_object_destroy_async().
865
+ * @param result The result of the destory operation passed to the callback.
866
+ * @returns Whether the object was destroyed successfully or not.
867
+ */
868
+ destroy_finish(result: Gio.AsyncResult): boolean
869
+ /**
870
+ * Checks equality of two objects. Two GckObject objects can point to the same
871
+ * underlying PKCS#11 object.
872
+ * @param object2 a pointer to the second #GckObject
873
+ * @returns %TRUE if object1 and object2 are equal. %FALSE if either is not a GckObject.
874
+ */
875
+ equal(object2: Object): boolean
876
+ /**
877
+ * Get the specified attributes from the object. The attributes will be cleared
878
+ * of their current values, and new attributes will be stored. The attributes
879
+ * should not be accessed in any way except for referencing and unreferencing
880
+ * them until gck_object_get_finish() is called.
881
+ *
882
+ * This call returns immediately and completes asynchronously.
883
+ * @param attr_types the types of the attributes to get
884
+ * @param cancellable optional cancellation object, or %NULL
885
+ * @param callback A callback which is called when the operation completes.
886
+ */
887
+ get_async(attr_types: number[], cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
888
+ /**
889
+ * Get the data for the specified attribute from the object. For convenience
890
+ * the returned data has a null terminator.
891
+ *
892
+ * This call may block for an indefinite period.
893
+ * @param attr_type The attribute to get data for.
894
+ * @param cancellable A #GCancellable or %NULL
895
+ * @returns the resulting PKCS#11 attribute data, or %NULL if an error occurred
896
+ */
897
+ get_data(attr_type: number, cancellable: Gio.Cancellable | null): Uint8Array
898
+
899
+ // Overloads of get_data
900
+
901
+ /**
902
+ * Gets a named field from the objects table of associations (see g_object_set_data()).
903
+ * @param key name of the key for that association
904
+ * @returns the data if found, or %NULL if no such data exists.
905
+ */
906
+ get_data(key: string | null): any | null
907
+ /**
908
+ * Get the data for the specified attribute from the object.
909
+ *
910
+ * This call will return immediately and complete asynchronously.
911
+ * @param attr_type The attribute to get data for.
912
+ * @param allocator An allocator with which to allocate memory for the data, or %NULL for default.
913
+ * @param cancellable Optional cancellation object, or %NULL.
914
+ * @param callback Called when the operation completes.
915
+ */
916
+ get_data_async(attr_type: number, allocator: Allocator, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
917
+ /**
918
+ * Get the result of an operation to get attribute data from
919
+ * an object. For convenience the returned data has an extra null terminator,
920
+ * not included in the returned length.
921
+ * @param result The result passed to the callback.
922
+ * @returns The PKCS#11 attribute data or %NULL if an error occurred.
923
+ */
924
+ get_data_finish(result: Gio.AsyncResult): Uint8Array
925
+ /**
926
+ * Get the result of a get operation and return specified attributes from
927
+ * the object.
928
+ *
929
+ * No extra references are added to the returned attributes pointer.
930
+ * @param result The result passed to the callback.
931
+ * @returns The filled in attributes structure if successful or %NULL if not successful.
932
+ */
933
+ get_finish(result: Gio.AsyncResult): Attributes
934
+ /**
935
+ * Get the specified attributes from the object. This call may
936
+ * block for an indefinite period.
937
+ *
938
+ * No extra references are added to the returned attributes pointer.
939
+ * During this call you may not access the attributes in any way.
940
+ * @param attr_types the types of the attributes to get
941
+ * @param cancellable optional cancellation object, or %NULL
942
+ * @returns a pointer to the filled in attributes if successful, or %NULL if not
943
+ */
944
+ get_full(attr_types: number[], cancellable: Gio.Cancellable | null): Attributes
945
+ /**
946
+ * Get the raw PKCS#11 handle of a GckObject.
947
+ * @returns the raw CK_OBJECT_HANDLE object handle
948
+ */
949
+ get_handle(): number
950
+ /**
951
+ * Get the PKCS#11 module to which this object belongs.
952
+ * @returns the module, which should be unreffed after use
953
+ */
954
+ get_module(): Module
955
+ /**
956
+ * Get the PKCS#11 session assigned to make calls on when operating
957
+ * on this object.
958
+ *
959
+ * This will only return a session if it was set explitly on this
960
+ * object. By default an object will open and close sessions
961
+ * appropriate for its calls.
962
+ * @returns the assigned session, which must be unreffed after use
963
+ */
964
+ get_session(): Session
965
+ /**
966
+ * Get an attribute template from the object. The attr_type must be for
967
+ * an attribute which returns a template.
968
+ *
969
+ * This call may block for an indefinite period.
970
+ * @param attr_type The template attribute type.
971
+ * @param cancellable Optional cancellation object, or %NULL.
972
+ * @returns the resulting PKCS#11 attribute template, or %NULL if an error occurred
973
+ */
974
+ get_template(attr_type: number, cancellable: Gio.Cancellable | null): Attributes
975
+ /**
976
+ * Get an attribute template from the object. The `attr_type` must be for
977
+ * an attribute which returns a template.
978
+ *
979
+ * This call will return immediately and complete asynchronously.
980
+ * @param attr_type The template attribute type.
981
+ * @param cancellable Optional cancellation object, or %NULL.
982
+ * @param callback Called when the operation completes.
983
+ */
984
+ get_template_async(attr_type: number, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
985
+ /**
986
+ * Get the result of an operation to get attribute template from
987
+ * an object.
988
+ * @param result The result passed to the callback.
989
+ * @returns the resulting PKCS#11 attribute template, or %NULL if an error occurred
990
+ */
991
+ get_template_finish(result: Gio.AsyncResult): Attributes
992
+ /**
993
+ * Create a hash value for the GckObject.
994
+ *
995
+ * This function is intended for easily hashing a GckObject to add to
996
+ * a GHashTable or similar data structure.
997
+ * @returns An integer that can be used as a hash value, or 0 if invalid.
998
+ */
999
+ hash(): number
1000
+ /**
1001
+ * Set PKCS#11 attributes on an object. This call may block for an indefinite period.
1002
+ * @param attrs The attributes to set on the object.
1003
+ * @param cancellable Optional cancellable object, or %NULL to ignore.
1004
+ * @returns Whether the call was successful or not.
1005
+ */
1006
+ set(attrs: Attributes, cancellable: Gio.Cancellable | null): boolean
1007
+ /**
1008
+ * Set PKCS#11 attributes on an object. This call will return
1009
+ * immediately and completes asynchronously.
1010
+ * @param attrs The attributes to set on the object.
1011
+ * @param cancellable Optional cancellable object, or %NULL to ignore.
1012
+ * @param callback Callback which is called when operation completes.
1013
+ */
1014
+ set_async(attrs: Attributes, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1015
+ /**
1016
+ * Get the status of the operation to set attributes on a PKCS#11 object,
1017
+ * begun with gck_object_set_async().
1018
+ * @param result The result of the destory operation passed to the callback.
1019
+ * @returns Whether the attributes were successfully set on the object or not.
1020
+ */
1021
+ set_finish(result: Gio.AsyncResult): boolean
1022
+ /**
1023
+ * Set an attribute template on the object. The attr_type must be for
1024
+ * an attribute which contains a template.
1025
+ *
1026
+ * If the `attrs` #GckAttributes is floating, it is consumed.
1027
+ *
1028
+ * This call may block for an indefinite period.
1029
+ * @param attr_type The attribute template type.
1030
+ * @param attrs The attribute template.
1031
+ * @param cancellable Optional cancellation object, or %NULL.
1032
+ * @returns %TRUE if the operation succeeded.
1033
+ */
1034
+ set_template(attr_type: number, attrs: Attributes, cancellable: Gio.Cancellable | null): boolean
1035
+ /**
1036
+ * Set an attribute template on the object. The attr_type must be for
1037
+ * an attribute which contains a template.
1038
+ *
1039
+ * If the `attrs` #GckAttributes is floating, it is consumed.
1040
+ *
1041
+ * This call will return immediately and complete asynchronously.
1042
+ * @param attr_type The attribute template type.
1043
+ * @param attrs The attribute template.
1044
+ * @param cancellable Optional cancellation object, or %NULL.
1045
+ * @param callback Called when the operation completes.
1046
+ */
1047
+ set_template_async(attr_type: number, attrs: Attributes, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1048
+ /**
1049
+ * Get the result of an operation to set attribute template on
1050
+ * an object.
1051
+ * @param result The result passed to the callback.
1052
+ * @returns %TRUE if the operation succeeded.
1053
+ */
1054
+ set_template_finish(result: Gio.AsyncResult): boolean
1055
+
1056
+ // Class property signals of Gck-2.Gck.Object
1057
+
1058
+ connect(sigName: "notify::handle", callback: (($obj: Object, pspec: GObject.ParamSpec) => void)): number
1059
+ connect_after(sigName: "notify::handle", callback: (($obj: Object, pspec: GObject.ParamSpec) => void)): number
1060
+ emit(sigName: "notify::handle", ...args: any[]): void
1061
+ connect(sigName: "notify::module", callback: (($obj: Object, pspec: GObject.ParamSpec) => void)): number
1062
+ connect_after(sigName: "notify::module", callback: (($obj: Object, pspec: GObject.ParamSpec) => void)): number
1063
+ emit(sigName: "notify::module", ...args: any[]): void
1064
+ connect(sigName: "notify::session", callback: (($obj: Object, pspec: GObject.ParamSpec) => void)): number
1065
+ connect_after(sigName: "notify::session", callback: (($obj: Object, pspec: GObject.ParamSpec) => void)): number
1066
+ emit(sigName: "notify::session", ...args: any[]): void
1067
+ connect(sigName: string, callback: (...args: any[]) => void): number
1068
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
1069
+ emit(sigName: string, ...args: any[]): void
1070
+ disconnect(id: number): void
1071
+ }
1072
+
1073
+ /**
1074
+ * Holds a handle to a PKCS11 object such as a key or certificate. Token
1075
+ * objects are stored on the token persistently. Others are transient and are
1076
+ * called session objects.
1077
+ * @interface
1078
+ */
1079
+ export class Object extends GObject.Object {
1080
+
1081
+ // Own properties of Gck-2.Gck.Object
1082
+
1083
+ static name: string
1084
+ static $gtype: GObject.GType<Object>
1085
+
1086
+ // Constructors of Gck-2.Gck.Object
1087
+
1088
+ constructor(config?: Object.ConstructorProperties)
1089
+ /**
1090
+ * Initialize a GckObject from a raw PKCS#11 handle. Normally you would use
1091
+ * [method`Session`.create_object] or [method`Session`.find_objects] to access
1092
+ * objects.
1093
+ * @constructor
1094
+ * @param session The session through which this object is accessed or created.
1095
+ * @param object_handle The raw `CK_OBJECT_HANDLE` of the object.
1096
+ * @returns The new object
1097
+ */
1098
+ static from_handle(session: Session, object_handle: number): Object
1099
+ _init(config?: Object.ConstructorProperties): void
1100
+ }
1101
+
1102
+ export module Password {
1103
+
1104
+ // Constructor properties interface
1105
+
1106
+ export interface ConstructorProperties extends Gio.TlsPassword.ConstructorProperties {
1107
+
1108
+ // Own constructor properties of Gck-2.Gck.Password
1109
+
1110
+ /**
1111
+ * The PKCS#11 key that the password is being requested for. If this
1112
+ * is set then the GckPassword:token property will be %NULL
1113
+ */
1114
+ key?: Object | null
1115
+ /**
1116
+ * The PKCS#11 token the password is for, if this is set then
1117
+ * the GckPassword:object property will be %NULL
1118
+ */
1119
+ token?: Slot | null
1120
+ }
1121
+
1122
+ }
1123
+
1124
+ export interface Password {
1125
+
1126
+ // Own properties of Gck-2.Gck.Password
1127
+
1128
+ /**
1129
+ * The PKCS#11 key that the password is being requested for. If this
1130
+ * is set then the GckPassword:token property will be %NULL
1131
+ */
1132
+ readonly key: Object
1133
+ /**
1134
+ * The PKCS#11 module that is requesting the password
1135
+ */
1136
+ readonly module: Module
1137
+ /**
1138
+ * The PKCS#11 token the password is for, if this is set then
1139
+ * the GckPassword:object property will be %NULL
1140
+ */
1141
+ readonly token: Slot
1142
+
1143
+ // Owm methods of Gck-2.Gck.Password
1144
+
1145
+ /**
1146
+ * If the password request is to unlock a PKCS#11 key, then this is the
1147
+ * the object representing that key.
1148
+ * @returns the password is for this key, or %NULL if not being requested for a key; must be unreferenced after use
1149
+ */
1150
+ get_key(): Object
1151
+ /**
1152
+ * Get the PKCS#11 module that is requesting the password.
1153
+ * @returns the module that is requesting the password, which must be unreferenced after use
1154
+ */
1155
+ get_module(): Module
1156
+ /**
1157
+ * If the password request is to unlock a PKCS#11 token, then this is the
1158
+ * slot containing that token.
1159
+ * @returns the slot that contains the token, or %NULL if not being requested for a token; must be unreferenced after use
1160
+ */
1161
+ get_token(): Slot
1162
+
1163
+ // Class property signals of Gck-2.Gck.Password
1164
+
1165
+ connect(sigName: "notify::key", callback: (($obj: Password, pspec: GObject.ParamSpec) => void)): number
1166
+ connect_after(sigName: "notify::key", callback: (($obj: Password, pspec: GObject.ParamSpec) => void)): number
1167
+ emit(sigName: "notify::key", ...args: any[]): void
1168
+ connect(sigName: "notify::module", callback: (($obj: Password, pspec: GObject.ParamSpec) => void)): number
1169
+ connect_after(sigName: "notify::module", callback: (($obj: Password, pspec: GObject.ParamSpec) => void)): number
1170
+ emit(sigName: "notify::module", ...args: any[]): void
1171
+ connect(sigName: "notify::token", callback: (($obj: Password, pspec: GObject.ParamSpec) => void)): number
1172
+ connect_after(sigName: "notify::token", callback: (($obj: Password, pspec: GObject.ParamSpec) => void)): number
1173
+ emit(sigName: "notify::token", ...args: any[]): void
1174
+ connect(sigName: "notify::description", callback: (($obj: Password, pspec: GObject.ParamSpec) => void)): number
1175
+ connect_after(sigName: "notify::description", callback: (($obj: Password, pspec: GObject.ParamSpec) => void)): number
1176
+ emit(sigName: "notify::description", ...args: any[]): void
1177
+ connect(sigName: "notify::flags", callback: (($obj: Password, pspec: GObject.ParamSpec) => void)): number
1178
+ connect_after(sigName: "notify::flags", callback: (($obj: Password, pspec: GObject.ParamSpec) => void)): number
1179
+ emit(sigName: "notify::flags", ...args: any[]): void
1180
+ connect(sigName: "notify::warning", callback: (($obj: Password, pspec: GObject.ParamSpec) => void)): number
1181
+ connect_after(sigName: "notify::warning", callback: (($obj: Password, pspec: GObject.ParamSpec) => void)): number
1182
+ emit(sigName: "notify::warning", ...args: any[]): void
1183
+ connect(sigName: string, callback: (...args: any[]) => void): number
1184
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
1185
+ emit(sigName: string, ...args: any[]): void
1186
+ disconnect(id: number): void
1187
+ }
1188
+
1189
+ /**
1190
+ * Represents a password which is requested of the user.
1191
+ *
1192
+ * This is used in conjuction with [class`Gio`.TlsInteraction]. `GckPassword` is
1193
+ * a [class`Gio`.TlsPassword] which contains additional information about which
1194
+ * PKCS#11 token or key the password is being requested for.
1195
+ * @class
1196
+ */
1197
+ export class Password extends Gio.TlsPassword {
1198
+
1199
+ // Own properties of Gck-2.Gck.Password
1200
+
1201
+ static name: string
1202
+ static $gtype: GObject.GType<Password>
1203
+
1204
+ // Constructors of Gck-2.Gck.Password
1205
+
1206
+ constructor(config?: Password.ConstructorProperties)
1207
+ _init(config?: Password.ConstructorProperties): void
1208
+ }
1209
+
1210
+ export module Session {
1211
+
1212
+ // Signal callback interfaces
1213
+
1214
+ /**
1215
+ * Signal callback interface for `discard-handle`
1216
+ */
1217
+ export interface DiscardHandleSignalCallback {
1218
+ ($obj: Session, handle: number): boolean
1219
+ }
1220
+
1221
+
1222
+ // Constructor properties interface
1223
+
1224
+ export interface ConstructorProperties extends Gio.AsyncInitable.ConstructorProperties, Gio.Initable.ConstructorProperties, GObject.Object.ConstructorProperties {
1225
+
1226
+ // Own constructor properties of Gck-2.Gck.Session
1227
+
1228
+ /**
1229
+ * Raw PKCS#11 application data used to open the PKCS#11 session.
1230
+ */
1231
+ app_data?: any | null
1232
+ /**
1233
+ * The raw CK_SESSION_HANDLE handle of this session.
1234
+ */
1235
+ handle?: number | null
1236
+ /**
1237
+ * Interaction object used to ask the user for pins when opening
1238
+ * sessions. Used if the session_options of the enumerator have
1239
+ * %GCK_SESSION_LOGIN_USER
1240
+ */
1241
+ interaction?: Gio.TlsInteraction | null
1242
+ /**
1243
+ * Raw PKCS#11 flags used to open the PKCS#11 session.
1244
+ */
1245
+ opening_flags?: number | null
1246
+ /**
1247
+ * The options this session was opened with.
1248
+ */
1249
+ options?: SessionOptions | null
1250
+ /**
1251
+ * The GckSlot this session is opened on.
1252
+ */
1253
+ slot?: Slot | null
1254
+ }
1255
+
1256
+ }
1257
+
1258
+ export interface Session extends Gio.AsyncInitable, Gio.Initable {
1259
+
1260
+ // Own properties of Gck-2.Gck.Session
1261
+
1262
+ /**
1263
+ * Raw PKCS#11 application data used to open the PKCS#11 session.
1264
+ */
1265
+ readonly app_data: any
1266
+ /**
1267
+ * The raw CK_SESSION_HANDLE handle of this session.
1268
+ */
1269
+ readonly handle: number
1270
+ /**
1271
+ * Interaction object used to ask the user for pins when opening
1272
+ * sessions. Used if the session_options of the enumerator have
1273
+ * %GCK_SESSION_LOGIN_USER
1274
+ */
1275
+ interaction: Gio.TlsInteraction
1276
+ /**
1277
+ * The GckModule that this session is opened on.
1278
+ */
1279
+ readonly module: Module
1280
+ /**
1281
+ * Raw PKCS#11 flags used to open the PKCS#11 session.
1282
+ */
1283
+ readonly opening_flags: number
1284
+ /**
1285
+ * The options this session was opened with.
1286
+ */
1287
+ readonly options: SessionOptions
1288
+ /**
1289
+ * The GckSlot this session is opened on.
1290
+ */
1291
+ readonly slot: Slot
1292
+
1293
+ // Own fields of Gck-2.Gck.Session
1294
+
1295
+ parent_instance: GObject.Object
1296
+
1297
+ // Owm methods of Gck-2.Gck.Session
1298
+
1299
+ /**
1300
+ * Create a new PKCS#11 object. This call may block for an
1301
+ * indefinite period.
1302
+ * @param attrs The attributes to create the object with.
1303
+ * @param cancellable Optional cancellation object, or %NULL.
1304
+ * @returns the newly created object or %NULL if an error occurred
1305
+ */
1306
+ create_object(attrs: Attributes, cancellable: Gio.Cancellable | null): Object
1307
+ /**
1308
+ * Create a new PKCS#11 object. This call will return immediately
1309
+ * and complete asynchronously.
1310
+ *
1311
+ * If `attrs` is a floating reference, it is consumed.
1312
+ * @param attrs The attributes to create the object with.
1313
+ * @param cancellable Optional cancellation object or %NULL.
1314
+ * @param callback Called when the operation completes.
1315
+ */
1316
+ create_object_async(attrs: Attributes, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1317
+ /**
1318
+ * Get the result of creating a new PKCS#11 object.
1319
+ * @param result The result passed to the callback.
1320
+ * @returns the newly created object or %NULL if an error occurred
1321
+ */
1322
+ create_object_finish(result: Gio.AsyncResult): Object
1323
+ /**
1324
+ * Decrypt data in a mechanism specific manner. This call may
1325
+ * block for an indefinite period.
1326
+ * @param key The key to decrypt with.
1327
+ * @param mech_type The mechanism type to use for decryption.
1328
+ * @param input data to decrypt
1329
+ * @param cancellable Optional cancellation object, or %NULL
1330
+ * @returns the data that was decrypted, or %NULL if an error occured
1331
+ */
1332
+ decrypt(key: Object, mech_type: number, input: Uint8Array, cancellable: Gio.Cancellable | null): Uint8Array
1333
+ /**
1334
+ * Decrypt data in a mechanism specific manner. This call will
1335
+ * return immediately and complete asynchronously.
1336
+ * @param key The key to decrypt with.
1337
+ * @param mechanism The mechanism type and parameters to use for decryption.
1338
+ * @param input data to decrypt
1339
+ * @param cancellable A GCancellable which can be used to cancel the operation.
1340
+ * @param callback Called when the operation completes.
1341
+ */
1342
+ decrypt_async(key: Object, mechanism: Mechanism, input: Uint8Array, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1343
+ /**
1344
+ * Get the result of an decryption operation.
1345
+ * @param result The result object passed to the callback.
1346
+ * @returns the data that was decrypted, or %NULL if an error occurred
1347
+ */
1348
+ decrypt_finish(result: Gio.AsyncResult): Uint8Array
1349
+ /**
1350
+ * Decrypt data in a mechanism specific manner. This call may
1351
+ * block for an indefinite period.
1352
+ * @param key The key to decrypt with.
1353
+ * @param mechanism The mechanism type and parameters to use for decryption.
1354
+ * @param input data to decrypt
1355
+ * @param cancellable A GCancellable which can be used to cancel the operation.
1356
+ * @returns the data that was decrypted, or %NULL if an error occured
1357
+ */
1358
+ decrypt_full(key: Object, mechanism: Mechanism, input: Uint8Array, cancellable: Gio.Cancellable | null): Uint8Array
1359
+ /**
1360
+ * Derive a key from another key. This call may block for an
1361
+ * indefinite period.
1362
+ *
1363
+ * If the `attrs` #GckAttributes is floating, it is consumed.
1364
+ * @param base The key to derive from.
1365
+ * @param mech_type The mechanism to use for derivation.
1366
+ * @param attrs Additional attributes for the derived key.
1367
+ * @param cancellable Optional cancellation object, or %NULL.
1368
+ * @returns the new derived key or %NULL if the operation failed
1369
+ */
1370
+ derive_key(base: Object, mech_type: number, attrs: Attributes, cancellable: Gio.Cancellable | null): Object
1371
+ /**
1372
+ * Derive a key from another key. This call will
1373
+ * return immediately and complete asynchronously.
1374
+ * @param base The key to derive from.
1375
+ * @param mechanism The mechanism to use for derivation.
1376
+ * @param attrs Additional attributes for the derived key.
1377
+ * @param cancellable Optional cancellation object or %NULL.
1378
+ * @param callback Called when the operation completes.
1379
+ */
1380
+ derive_key_async(base: Object, mechanism: Mechanism, attrs: Attributes, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1381
+ /**
1382
+ * Get the result of a derive key operation.
1383
+ * @param result The async result passed to the callback.
1384
+ * @returns the new derived key or %NULL if the operation failed
1385
+ */
1386
+ derive_key_finish(result: Gio.AsyncResult): Object
1387
+ /**
1388
+ * Derive a key from another key. This call may block for an
1389
+ * indefinite period.
1390
+ * @param base The key to derive from.
1391
+ * @param mechanism The mechanism to use for derivation.
1392
+ * @param attrs Additional attributes for the derived key.
1393
+ * @param cancellable Optional cancellation object, or %NULL.
1394
+ * @returns the new derived key or %NULL if the operation failed
1395
+ */
1396
+ derive_key_full(base: Object, mechanism: Mechanism, attrs: Attributes, cancellable: Gio.Cancellable | null): Object
1397
+ /**
1398
+ * Encrypt data in a mechanism specific manner. This call may
1399
+ * block for an indefinite period.
1400
+ * @param key The key to encrypt with.
1401
+ * @param mech_type The mechanism type to use for encryption.
1402
+ * @param input the data to encrypt
1403
+ * @param cancellable Optional cancellation object, or %NULL
1404
+ * @returns the data that was encrypted, or %NULL if an error occured.
1405
+ */
1406
+ encrypt(key: Object, mech_type: number, input: Uint8Array, cancellable: Gio.Cancellable | null): Uint8Array
1407
+ /**
1408
+ * Encrypt data in a mechanism specific manner. This call will
1409
+ * return immediately and complete asynchronously.
1410
+ * @param key The key to encrypt with.
1411
+ * @param mechanism The mechanism type and parameters to use for encryption.
1412
+ * @param input the data to encrypt
1413
+ * @param cancellable A GCancellable which can be used to cancel the operation.
1414
+ * @param callback Called when the operation completes.
1415
+ */
1416
+ encrypt_async(key: Object, mechanism: Mechanism, input: Uint8Array, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1417
+ /**
1418
+ * Get the result of an encryption operation.
1419
+ * @param result The result object passed to the callback.
1420
+ * @returns the data that was encrypted, or %NULL if an error occurred.
1421
+ */
1422
+ encrypt_finish(result: Gio.AsyncResult): Uint8Array
1423
+ /**
1424
+ * Encrypt data in a mechanism specific manner. This call may
1425
+ * block for an indefinite period.
1426
+ * @param key The key to encrypt with.
1427
+ * @param mechanism The mechanism type and parameters to use for encryption.
1428
+ * @param input the data to encrypt
1429
+ * @param cancellable A GCancellable which can be used to cancel the operation.
1430
+ * @returns the data that was encrypted, or %NULL if an error occured
1431
+ */
1432
+ encrypt_full(key: Object, mechanism: Mechanism, input: Uint8Array, cancellable: Gio.Cancellable | null): Uint8Array
1433
+ /**
1434
+ * Setup an enumerator for listing matching objects available via this session.
1435
+ *
1436
+ * This call will not block but will return an enumerator immediately.
1437
+ * @param match attributes that the objects must match, or empty for all objects
1438
+ * @returns a new enumerator
1439
+ */
1440
+ enumerate_objects(match: Attributes): Enumerator
1441
+ /**
1442
+ * Find the objects matching the passed attributes. This call may
1443
+ * block for an indefinite period.
1444
+ * @param match the attributes to match against objects
1445
+ * @param cancellable optional cancellation object or %NULL
1446
+ * @returns a list of the matching objects, which may be empty
1447
+ */
1448
+ find_handles(match: Attributes, cancellable: Gio.Cancellable | null): number[] | null
1449
+ /**
1450
+ * Find the objects matching the passed attributes. This call will
1451
+ * return immediately and complete asynchronously.
1452
+ *
1453
+ * If `match` is a floating reference, it is consumed.
1454
+ * @param match the attributes to match against the objects
1455
+ * @param cancellable optional cancellation object or %NULL
1456
+ * @param callback called when the operation completes
1457
+ */
1458
+ find_handles_async(match: Attributes, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1459
+ /**
1460
+ * Get the result of a find handles operation.
1461
+ * @param result the asynchronous result
1462
+ * @returns an array of handles that matched, which may be empty, or %NULL on failure
1463
+ */
1464
+ find_handles_finish(result: Gio.AsyncResult): number[] | null
1465
+ /**
1466
+ * Find the objects matching the passed attributes. This call may
1467
+ * block for an indefinite period.
1468
+ *
1469
+ * If `match` is a floating reference, it is consumed.
1470
+ * @param match the attributes to match
1471
+ * @param cancellable Optional cancellation object or %NULL.
1472
+ * @returns a list of the matching objects, which may be empty
1473
+ */
1474
+ find_objects(match: Attributes, cancellable: Gio.Cancellable | null): Object[]
1475
+ /**
1476
+ * Find the objects matching the passed attributes. This call will
1477
+ * return immediately and complete asynchronously.
1478
+ *
1479
+ * If the `match` #GckAttributes is floating, it is consumed.
1480
+ * @param match The attributes to match.
1481
+ * @param cancellable Optional cancellation object or %NULL.
1482
+ * @param callback Called when the operation completes.
1483
+ */
1484
+ find_objects_async(match: Attributes, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1485
+ /**
1486
+ * Get the result of a find operation.
1487
+ * @param result The attributes to match.
1488
+ * @returns a list of the matching objects, which may be empty
1489
+ */
1490
+ find_objects_finish(result: Gio.AsyncResult): Object[]
1491
+ /**
1492
+ * Generate a new key pair of public and private keys. This call may block for
1493
+ * an indefinite period.
1494
+ *
1495
+ * If `public_attrs` and/or `private_attrs` is a floating reference, it is
1496
+ * consumed.
1497
+ * @param mech_type The mechanism type to use for key generation.
1498
+ * @param public_attrs Additional attributes for the generated public key.
1499
+ * @param private_attrs Additional attributes for the generated private key.
1500
+ * @param cancellable Optional cancellation object, or %NULL.
1501
+ * @returns %TRUE if the operation succeeded.
1502
+ */
1503
+ generate_key_pair(mech_type: number, public_attrs: Attributes, private_attrs: Attributes, cancellable: Gio.Cancellable | null): [ /* returnType */ boolean, /* public_key */ Object, /* private_key */ Object ]
1504
+ /**
1505
+ * Generate a new key pair of public and private keys. This call will
1506
+ * return immediately and complete asynchronously.
1507
+ *
1508
+ * If `public_attrs` and/or `private_attrs` is a floating reference, it is
1509
+ * consumed.
1510
+ * @param mechanism The mechanism to use for key generation.
1511
+ * @param public_attrs Additional attributes for the generated public key.
1512
+ * @param private_attrs Additional attributes for the generated private key.
1513
+ * @param cancellable Optional cancellation object or %NULL.
1514
+ * @param callback Called when the operation completes.
1515
+ */
1516
+ generate_key_pair_async(mechanism: Mechanism, public_attrs: Attributes, private_attrs: Attributes, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1517
+ /**
1518
+ * Get the result of a generate key pair operation.
1519
+ * @param result The async result passed to the callback.
1520
+ * @returns %TRUE if the operation succeeded.
1521
+ */
1522
+ generate_key_pair_finish(result: Gio.AsyncResult): [ /* returnType */ boolean, /* public_key */ Object, /* private_key */ Object ]
1523
+ /**
1524
+ * Generate a new key pair of public and private keys. This call may block for an
1525
+ * indefinite period.
1526
+ * @param mechanism The mechanism to use for key generation.
1527
+ * @param public_attrs Additional attributes for the generated public key.
1528
+ * @param private_attrs Additional attributes for the generated private key.
1529
+ * @param cancellable Optional cancellation object, or %NULL.
1530
+ * @returns %TRUE if the operation succeeded.
1531
+ */
1532
+ generate_key_pair_full(mechanism: Mechanism, public_attrs: Attributes, private_attrs: Attributes, cancellable: Gio.Cancellable | null): [ /* returnType */ boolean, /* public_key */ Object, /* private_key */ Object ]
1533
+ /**
1534
+ * Get the raw PKCS#11 session handle from a session object.
1535
+ * @returns The raw session handle.
1536
+ */
1537
+ get_handle(): number
1538
+ /**
1539
+ * Get information about the session.
1540
+ * @returns the session info. Use the gck_session_info_free() to release when done
1541
+ */
1542
+ get_info(): SessionInfo
1543
+ /**
1544
+ * Get the interaction object set on this session, which is used to prompt
1545
+ * for pins and the like.
1546
+ * @returns the interaction object, or %NULL
1547
+ */
1548
+ get_interaction(): Gio.TlsInteraction | null
1549
+ /**
1550
+ * Get the PKCS#11 module to which this session belongs.
1551
+ * @returns the module, which should be unreffed after use
1552
+ */
1553
+ get_module(): Module
1554
+ /**
1555
+ * Get the options this session was opened with.
1556
+ * @returns The session options.
1557
+ */
1558
+ get_options(): SessionOptions
1559
+ /**
1560
+ * Get the PKCS#11 slot to which this session belongs.
1561
+ * @returns The slot, which should be unreffed after use.
1562
+ */
1563
+ get_slot(): Slot
1564
+ /**
1565
+ * Get the session state. The state is the various PKCS#11 CKS_XXX flags.
1566
+ * @returns the session state
1567
+ */
1568
+ get_state(): number
1569
+ /**
1570
+ * Initialize the user's pin on this slot that this session is opened on.
1571
+ * According to the PKCS#11 standards, the session must be logged in with
1572
+ * the CKU_SO user type.
1573
+ *
1574
+ * This call may block for an indefinite period.
1575
+ * @param pin the user's PIN, or %NULL for protected authentication path
1576
+ * @param cancellable Optional cancellation object, or %NULL.
1577
+ * @returns Whether successful or not.
1578
+ */
1579
+ init_pin(pin: Uint8Array | null, cancellable: Gio.Cancellable | null): boolean
1580
+ /**
1581
+ * Initialize the user's pin on this slot that this session is opened on.
1582
+ * According to the PKCS#11 standards, the session must be logged in with
1583
+ * the `CKU_SO` user type.
1584
+ *
1585
+ * This call will return immediately and completes asynchronously.
1586
+ * @param pin the user's PIN, or %NULL for protected authentication path
1587
+ * @param cancellable Optional cancellation object, or %NULL.
1588
+ * @param callback Called when the operation completes.
1589
+ */
1590
+ init_pin_async(pin: Uint8Array | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1591
+ /**
1592
+ * Get the result of initializing a user's PIN.
1593
+ * @param result The result passed to the callback.
1594
+ * @returns Whether the operation was successful or not.
1595
+ */
1596
+ init_pin_finish(result: Gio.AsyncResult): boolean
1597
+ /**
1598
+ * Login the user on the session. This call may block for
1599
+ * an indefinite period.
1600
+ * @param user_type The type of login user.
1601
+ * @param pin the user's PIN, or %NULL for protected authentication path
1602
+ * @param cancellable Optional cancellation object, or %NULL.
1603
+ * @returns Whether successful or not.
1604
+ */
1605
+ login(user_type: number, pin: Uint8Array | null, cancellable: Gio.Cancellable | null): boolean
1606
+ /**
1607
+ * Login the user on the session. This call will return
1608
+ * immediately and completes asynchronously.
1609
+ * @param user_type The type of login user.
1610
+ * @param pin the user's PIN, or %NULL for protected authentication path
1611
+ * @param cancellable Optional cancellation object, or %NULL.
1612
+ * @param callback Called when the operation completes.
1613
+ */
1614
+ login_async(user_type: number, pin: Uint8Array | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1615
+ /**
1616
+ * Get the result of a login operation.
1617
+ * @param result The result passed to the callback.
1618
+ * @returns Whether the operation was successful or not.
1619
+ */
1620
+ login_finish(result: Gio.AsyncResult): boolean
1621
+ /**
1622
+ * Login the user on the session requesting the password interactively
1623
+ * when necessary. This call may block for an indefinite period.
1624
+ * @param user_type the type of login user
1625
+ * @param interaction interaction to request PIN when necessary
1626
+ * @param cancellable optional cancellation object, or %NULL
1627
+ * @returns Whether successful or not.
1628
+ */
1629
+ login_interactive(user_type: number, interaction: Gio.TlsInteraction | null, cancellable: Gio.Cancellable | null): boolean
1630
+ /**
1631
+ * Login the user on the session prompting for passwords interactively when
1632
+ * necessary. This call will return immediately and completes asynchronously.
1633
+ * @param user_type the type of login user
1634
+ * @param interaction interaction to request PIN when necessary
1635
+ * @param cancellable optional cancellation object, or %NULL
1636
+ * @param callback called when the operation completes
1637
+ */
1638
+ login_interactive_async(user_type: number, interaction: Gio.TlsInteraction | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1639
+ /**
1640
+ * Get the result of a login operation.
1641
+ * @param result the result passed to the callback
1642
+ * @returns Whether the operation was successful or not.
1643
+ */
1644
+ login_interactive_finish(result: Gio.AsyncResult): boolean
1645
+ /**
1646
+ * Log out of the session. This call may block for an indefinite period.
1647
+ * @param cancellable Optional cancellation object, or %NULL.
1648
+ * @returns Whether the logout was successful or not.
1649
+ */
1650
+ logout(cancellable: Gio.Cancellable | null): boolean
1651
+ /**
1652
+ * Log out of the session. This call returns immediately and completes
1653
+ * asynchronously.
1654
+ * @param cancellable Optional cancellation object, or %NULL.
1655
+ * @param callback Called when the operation completes.
1656
+ */
1657
+ logout_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1658
+ /**
1659
+ * Get the result of logging out of a session.
1660
+ * @param result The result passed to the callback.
1661
+ * @returns Whether the logout was successful or not.
1662
+ */
1663
+ logout_finish(result: Gio.AsyncResult): boolean
1664
+ /**
1665
+ * Set the interaction object on this session, which is used to prompt for
1666
+ * pins and the like.
1667
+ * @param interaction the interaction or %NULL
1668
+ */
1669
+ set_interaction(interaction: Gio.TlsInteraction | null): void
1670
+ /**
1671
+ * Change the user's pin on this slot that this session is opened on.
1672
+ *
1673
+ * This call may block for an indefinite period.
1674
+ * @param old_pin the user's old PIN, or %NULL for protected authentication path.
1675
+ * @param new_pin the user's new PIN, or %NULL for protected authentication path
1676
+ * @param cancellable Optional cancellation object, or %NULL.
1677
+ * @returns Whether successful or not.
1678
+ */
1679
+ set_pin(old_pin: Uint8Array | null, new_pin: Uint8Array | null, cancellable: Gio.Cancellable | null): boolean
1680
+ /**
1681
+ * Change the user's pin on this slot that this session is opened on.
1682
+ *
1683
+ * This call will return immediately and completes asynchronously.
1684
+ * @param old_pin the user's old PIN, or %NULL for protected authentication path
1685
+ * @param n_old_pin the length of the old PIN
1686
+ * @param new_pin the user's new PIN, or %NULL for protected authentication path
1687
+ * @param cancellable Optional cancellation object, or %NULL.
1688
+ * @param callback Called when the operation completes.
1689
+ */
1690
+ set_pin_async(old_pin: Uint8Array | null, n_old_pin: number, new_pin: Uint8Array | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1691
+ /**
1692
+ * Get the result of changing a user's PIN.
1693
+ * @param result The result passed to the callback.
1694
+ * @returns Whether the operation was successful or not.
1695
+ */
1696
+ set_pin_finish(result: Gio.AsyncResult): boolean
1697
+ /**
1698
+ * Sign data in a mechanism specific manner. This call may
1699
+ * block for an indefinite period.
1700
+ * @param key The key to sign with.
1701
+ * @param mech_type The mechanism type to use for signing.
1702
+ * @param input data to sign
1703
+ * @param cancellable Optional cancellation object, or %NULL
1704
+ * @returns the data that was signed, or %NULL if an error occured
1705
+ */
1706
+ sign(key: Object, mech_type: number, input: Uint8Array, cancellable: Gio.Cancellable | null): Uint8Array
1707
+ /**
1708
+ * Sign data in a mechanism specific manner. This call will
1709
+ * return immediately and complete asynchronously.
1710
+ * @param key The key to sign with.
1711
+ * @param mechanism The mechanism type and parameters to use for signing.
1712
+ * @param input data to sign
1713
+ * @param cancellable A GCancellable which can be used to cancel the operation.
1714
+ * @param callback Called when the operation completes.
1715
+ */
1716
+ sign_async(key: Object, mechanism: Mechanism, input: Uint8Array, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1717
+ /**
1718
+ * Get the result of an signing operation.
1719
+ * @param result The result object passed to the callback.
1720
+ * @returns the data that was signed, or %NULL if an error occurred
1721
+ */
1722
+ sign_finish(result: Gio.AsyncResult): Uint8Array
1723
+ /**
1724
+ * Sign data in a mechanism specific manner. This call may
1725
+ * block for an indefinite period.
1726
+ * @param key The key to sign with.
1727
+ * @param mechanism The mechanism type and parameters to use for signing.
1728
+ * @param input data to sign
1729
+ * @param n_result location to store the length of the result data
1730
+ * @param cancellable A GCancellable which can be used to cancel the operation.
1731
+ * @returns The data that was signed, or %NULL if an error occured.
1732
+ */
1733
+ sign_full(key: Object, mechanism: Mechanism, input: Uint8Array, n_result: number, cancellable: Gio.Cancellable | null): number
1734
+ /**
1735
+ * Unwrap a key from a byte stream. This call may block for an
1736
+ * indefinite period.
1737
+ * @param wrapper The key to use for unwrapping.
1738
+ * @param mech_type The mechanism to use for unwrapping.
1739
+ * @param input the wrapped data as a byte stream
1740
+ * @param attrs Additional attributes for the unwrapped key.
1741
+ * @param cancellable Optional cancellation object, or %NULL.
1742
+ * @returns the new unwrapped key or %NULL if the operation failed
1743
+ */
1744
+ unwrap_key(wrapper: Object, mech_type: number, input: Uint8Array, attrs: Attributes, cancellable: Gio.Cancellable | null): Object
1745
+ /**
1746
+ * Unwrap a key from a byte stream. This call will
1747
+ * return immediately and complete asynchronously.
1748
+ * @param wrapper The key to use for unwrapping.
1749
+ * @param mechanism The mechanism to use for unwrapping.
1750
+ * @param input the wrapped data as a byte stream
1751
+ * @param attrs Additional attributes for the unwrapped key.
1752
+ * @param cancellable Optional cancellation object or %NULL.
1753
+ * @param callback Called when the operation completes.
1754
+ */
1755
+ unwrap_key_async(wrapper: Object, mechanism: Mechanism, input: Uint8Array, attrs: Attributes, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1756
+ /**
1757
+ * Get the result of a unwrap key operation.
1758
+ * @param result The async result passed to the callback.
1759
+ * @returns the new unwrapped key or %NULL if the operation failed.
1760
+ */
1761
+ unwrap_key_finish(result: Gio.AsyncResult): Object
1762
+ /**
1763
+ * Unwrap a key from a byte stream. This call may block for an
1764
+ * indefinite period.
1765
+ * @param wrapper The key to use for unwrapping.
1766
+ * @param mechanism The mechanism to use for unwrapping.
1767
+ * @param input the wrapped data as a byte stream
1768
+ * @param attrs Additional attributes for the unwrapped key.
1769
+ * @param cancellable Optional cancellation object, or %NULL.
1770
+ * @returns the new unwrapped key or %NULL if the operation failed
1771
+ */
1772
+ unwrap_key_full(wrapper: Object, mechanism: Mechanism, input: Uint8Array, attrs: Attributes, cancellable: Gio.Cancellable | null): Object
1773
+ /**
1774
+ * Verify data in a mechanism specific manner. This call may
1775
+ * block for an indefinite period.
1776
+ * @param key The key to verify with.
1777
+ * @param mech_type The mechanism type to use for verifying.
1778
+ * @param input data to verify
1779
+ * @param signature the signature
1780
+ * @param cancellable Optional cancellation object, or %NULL
1781
+ * @returns %TRUE if the data verified correctly, otherwise a failure or error occurred.
1782
+ */
1783
+ verify(key: Object, mech_type: number, input: Uint8Array, signature: Uint8Array, cancellable: Gio.Cancellable | null): boolean
1784
+ /**
1785
+ * Verify data in a mechanism specific manner. This call returns
1786
+ * immediately and completes asynchronously.
1787
+ * @param key The key to verify with.
1788
+ * @param mechanism The mechanism type and parameters to use for signing.
1789
+ * @param input data to verify
1790
+ * @param signature the signature
1791
+ * @param cancellable A GCancellable which can be used to cancel the operation.
1792
+ * @param callback Called when the operation completes.
1793
+ */
1794
+ verify_async(key: Object, mechanism: Mechanism, input: Uint8Array, signature: Uint8Array, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1795
+ /**
1796
+ * Get the result of an verify operation.
1797
+ * @param result The result object passed to the callback.
1798
+ * @returns %TRUE if the data verified correctly, otherwise a failure or error occurred.
1799
+ */
1800
+ verify_finish(result: Gio.AsyncResult): boolean
1801
+ /**
1802
+ * Verify data in a mechanism specific manner. This call may
1803
+ * block for an indefinite period.
1804
+ * @param key The key to verify with.
1805
+ * @param mechanism The mechanism type and parameters to use for signing.
1806
+ * @param input data to verify
1807
+ * @param signature the signature
1808
+ * @param cancellable A GCancellable which can be used to cancel the operation.
1809
+ * @returns %TRUE if the data verified correctly, otherwise a failure or error occurred.
1810
+ */
1811
+ verify_full(key: Object, mechanism: Mechanism, input: Uint8Array, signature: Uint8Array, cancellable: Gio.Cancellable | null): boolean
1812
+ /**
1813
+ * Wrap a key into a byte stream. This call may block for an
1814
+ * indefinite period.
1815
+ * @param wrapper The key to use for wrapping.
1816
+ * @param mech_type The mechanism type to use for wrapping.
1817
+ * @param wrapped The key to wrap.
1818
+ * @param cancellable A #GCancellable or %NULL
1819
+ * @returns the wrapped data or %NULL if the operation failed
1820
+ */
1821
+ wrap_key(wrapper: Object, mech_type: number, wrapped: Object, cancellable: Gio.Cancellable | null): Uint8Array
1822
+ /**
1823
+ * Wrap a key into a byte stream. This call will
1824
+ * return immediately and complete asynchronously.
1825
+ * @param wrapper The key to use for wrapping.
1826
+ * @param mechanism The mechanism to use for wrapping.
1827
+ * @param wrapped The key to wrap.
1828
+ * @param cancellable Optional cancellation object or %NULL.
1829
+ * @param callback Called when the operation completes.
1830
+ */
1831
+ wrap_key_async(wrapper: Object, mechanism: Mechanism, wrapped: Object, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
1832
+ /**
1833
+ * Get the result of a wrap key operation.
1834
+ * @param result The async result passed to the callback.
1835
+ * @returns the wrapped data or %NULL if the operation failed
1836
+ */
1837
+ wrap_key_finish(result: Gio.AsyncResult): Uint8Array
1838
+ /**
1839
+ * Wrap a key into a byte stream. This call may block for an
1840
+ * indefinite period.
1841
+ * @param wrapper The key to use for wrapping.
1842
+ * @param mechanism The mechanism to use for wrapping.
1843
+ * @param wrapped The key to wrap.
1844
+ * @param cancellable Optional cancellation object, or %NULL.
1845
+ * @returns the wrapped data or %NULL if the operation failed
1846
+ */
1847
+ wrap_key_full(wrapper: Object, mechanism: Mechanism, wrapped: Object, cancellable: Gio.Cancellable | null): Uint8Array
1848
+
1849
+ // Own signals of Gck-2.Gck.Session
1850
+
1851
+ connect(sigName: "discard-handle", callback: Session.DiscardHandleSignalCallback): number
1852
+ connect_after(sigName: "discard-handle", callback: Session.DiscardHandleSignalCallback): number
1853
+ emit(sigName: "discard-handle", handle: number, ...args: any[]): void
1854
+
1855
+ // Class property signals of Gck-2.Gck.Session
1856
+
1857
+ connect(sigName: "notify::app-data", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1858
+ connect_after(sigName: "notify::app-data", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1859
+ emit(sigName: "notify::app-data", ...args: any[]): void
1860
+ connect(sigName: "notify::handle", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1861
+ connect_after(sigName: "notify::handle", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1862
+ emit(sigName: "notify::handle", ...args: any[]): void
1863
+ connect(sigName: "notify::interaction", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1864
+ connect_after(sigName: "notify::interaction", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1865
+ emit(sigName: "notify::interaction", ...args: any[]): void
1866
+ connect(sigName: "notify::module", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1867
+ connect_after(sigName: "notify::module", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1868
+ emit(sigName: "notify::module", ...args: any[]): void
1869
+ connect(sigName: "notify::opening-flags", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1870
+ connect_after(sigName: "notify::opening-flags", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1871
+ emit(sigName: "notify::opening-flags", ...args: any[]): void
1872
+ connect(sigName: "notify::options", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1873
+ connect_after(sigName: "notify::options", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1874
+ emit(sigName: "notify::options", ...args: any[]): void
1875
+ connect(sigName: "notify::slot", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1876
+ connect_after(sigName: "notify::slot", callback: (($obj: Session, pspec: GObject.ParamSpec) => void)): number
1877
+ emit(sigName: "notify::slot", ...args: any[]): void
1878
+ connect(sigName: string, callback: (...args: any[]) => void): number
1879
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
1880
+ emit(sigName: string, ...args: any[]): void
1881
+ disconnect(id: number): void
1882
+ }
1883
+
1884
+ /**
1885
+ * Represents an open PKCS11 session.
1886
+ *
1887
+ * Before performing any PKCS11 operations, a session must be opened. This is
1888
+ * analogous to an open database handle, or a file handle.
1889
+ * @class
1890
+ */
1891
+ export class Session extends GObject.Object {
1892
+
1893
+ // Own properties of Gck-2.Gck.Session
1894
+
1895
+ static name: string
1896
+ static $gtype: GObject.GType<Session>
1897
+
1898
+ // Constructors of Gck-2.Gck.Session
1899
+
1900
+ constructor(config?: Session.ConstructorProperties)
1901
+ _init(config?: Session.ConstructorProperties): void
1902
+ /**
1903
+ * Initialize a session object from a raw PKCS#11 session handle.
1904
+ * Usually one would use the [method`Slot`.open_session] function to
1905
+ * create a session.
1906
+ * @param slot The slot which the session belongs to.
1907
+ * @param session_handle the raw PKCS#11 handle of the session
1908
+ * @param options Session options. Those which are used during opening a session have no effect.
1909
+ * @returns the new GckSession object
1910
+ */
1911
+ static from_handle(slot: Slot, session_handle: number, options: SessionOptions): Session
1912
+ /**
1913
+ * Open a session on the slot. This call may block for an indefinite period.
1914
+ * @param slot the slot to open session on
1915
+ * @param options session options
1916
+ * @param interaction optional interaction for logins or object authentication
1917
+ * @param cancellable optional cancellation object
1918
+ * @returns the new session
1919
+ */
1920
+ static open(slot: Slot, options: SessionOptions, interaction: Gio.TlsInteraction | null, cancellable: Gio.Cancellable | null): Session
1921
+ /**
1922
+ * Open a session on the slot. This call will return immediately and complete
1923
+ * asynchronously.
1924
+ * @param slot the slot to open session on
1925
+ * @param options session options
1926
+ * @param interaction optional interaction for logins or object authentication
1927
+ * @param cancellable optional cancellation object
1928
+ * @param callback called when the operation completes
1929
+ */
1930
+ static open_async(slot: Slot, options: SessionOptions, interaction: Gio.TlsInteraction | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<Session> | null): void
1931
+ /**
1932
+ * Get the result of an open session operation.
1933
+ * @param result the result passed to the callback
1934
+ * @returns the new session
1935
+ */
1936
+ static open_finish(result: Gio.AsyncResult): Session
1937
+ }
1938
+
1939
+ export module Slot {
1940
+
1941
+ // Constructor properties interface
1942
+
1943
+ export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
1944
+
1945
+ // Own constructor properties of Gck-2.Gck.Slot
1946
+
1947
+ /**
1948
+ * The raw CK_SLOT_ID handle of this slot.
1949
+ */
1950
+ handle?: number | null
1951
+ /**
1952
+ * The PKCS11 object that this slot is a part of.
1953
+ */
1954
+ module?: Module | null
1955
+ }
1956
+
1957
+ }
1958
+
1959
+ export interface Slot {
1960
+
1961
+ // Own properties of Gck-2.Gck.Slot
1962
+
1963
+ /**
1964
+ * The raw CK_SLOT_ID handle of this slot.
1965
+ */
1966
+ readonly handle: number
1967
+ /**
1968
+ * The PKCS11 object that this slot is a part of.
1969
+ */
1970
+ readonly module: Module
1971
+
1972
+ // Owm methods of Gck-2.Gck.Slot
1973
+
1974
+ /**
1975
+ * Setup an enumerator for listing matching objects on the slot.
1976
+ *
1977
+ * If the `match` #GckAttributes is floating, it is consumed.
1978
+ *
1979
+ * This call will not block but will return an enumerator immediately.
1980
+ * @param match attributes that the objects must match, or empty for all objects
1981
+ * @param options options for opening a session
1982
+ * @returns a new enumerator
1983
+ */
1984
+ enumerate_objects(match: Attributes, options: SessionOptions): Enumerator
1985
+ /**
1986
+ * Checks equality of two slots. Two GckSlot objects can point to the same
1987
+ * underlying PKCS#11 slot.
1988
+ * @param slot2 a pointer to the second #GckSlot
1989
+ * @returns %TRUE if slot1 and slot2 are equal. %FALSE if either is not a GckSlot.
1990
+ */
1991
+ equal(slot2: Slot): boolean
1992
+ /**
1993
+ * Get the raw PKCS#11 handle of a slot.
1994
+ * @returns the raw CK_SLOT_ID handle
1995
+ */
1996
+ get_handle(): number
1997
+ /**
1998
+ * Get the information for this slot.
1999
+ * @returns the slot information, when done, use gck_slot_info_free() to release it.
2000
+ */
2001
+ get_info(): SlotInfo
2002
+ /**
2003
+ * Get information for the specified mechanism.
2004
+ * @param mech_type The mechanisms type to get info for.
2005
+ * @returns the mechanism information, or %NULL if failed; use gck_mechanism_info_free() when done with it
2006
+ */
2007
+ get_mechanism_info(mech_type: number): MechanismInfo
2008
+ /**
2009
+ * Get the available mechanisms for this slot.
2010
+ * @returns a list of the mechanisms for this slot, which should be freed with g_array_free ()
2011
+ */
2012
+ get_mechanisms(): number[]
2013
+ /**
2014
+ * Get the module that this slot is on.
2015
+ * @returns The module, you must unreference this after you're done with it.
2016
+ */
2017
+ get_module(): Module
2018
+ /**
2019
+ * Get the token information for this slot.
2020
+ * @returns the token information; when done, use gck_token_info_free() to release it
2021
+ */
2022
+ get_token_info(): TokenInfo
2023
+ /**
2024
+ * Check if the PKCS11 slot has the given flags.
2025
+ * @param flags The flags to check.
2026
+ * @returns Whether one or more flags exist.
2027
+ */
2028
+ has_flags(flags: number): boolean
2029
+ /**
2030
+ * Create a hash value for the GckSlot.
2031
+ *
2032
+ * This function is intended for easily hashing a GckSlot to add to
2033
+ * a GHashTable or similar data structure.
2034
+ * @returns An integer that can be used as a hash value, or 0 if invalid.
2035
+ */
2036
+ hash(): number
2037
+ /**
2038
+ * Check whether the PKCS#11 URI matches the slot
2039
+ * @param uri the uri to match against the slot
2040
+ * @returns whether the URI matches or not
2041
+ */
2042
+ match(uri: UriData): boolean
2043
+ /**
2044
+ * Open a session on the slot. If the 'auto reuse' setting is set,
2045
+ * then this may be a recycled session with the same flags.
2046
+ *
2047
+ * This call may block for an indefinite period.
2048
+ * @param options The #GckSessionOptions to open a session with.
2049
+ * @param interaction The #GTlsInteraction to use, or %NULL.
2050
+ * @param cancellable An optional cancellation object, or %NULL.
2051
+ * @returns a new session or %NULL if an error occurs
2052
+ */
2053
+ open_session(options: SessionOptions, interaction: Gio.TlsInteraction | null, cancellable: Gio.Cancellable | null): Session
2054
+ /**
2055
+ * Open a session on the slot. If the 'auto reuse' setting is set,
2056
+ * then this may be a recycled session with the same flags.
2057
+ *
2058
+ * This call will return immediately and complete asynchronously.
2059
+ * @param options The options to open the new session with.
2060
+ * @param interaction The #GTlsInteraction to use, or %NULL.
2061
+ * @param cancellable Optional cancellation object, or %NULL.
2062
+ * @param callback Called when the operation completes.
2063
+ */
2064
+ open_session_async(options: SessionOptions, interaction: Gio.TlsInteraction | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
2065
+ /**
2066
+ * Get the result of an open session operation. If the 'auto reuse' setting is set,
2067
+ * then this may be a recycled session with the same flags.
2068
+ * @param result The result passed to the callback.
2069
+ * @returns the new session or %NULL if an error occurs
2070
+ */
2071
+ open_session_finish(result: Gio.AsyncResult): Session
2072
+
2073
+ // Class property signals of Gck-2.Gck.Slot
2074
+
2075
+ connect(sigName: "notify::handle", callback: (($obj: Slot, pspec: GObject.ParamSpec) => void)): number
2076
+ connect_after(sigName: "notify::handle", callback: (($obj: Slot, pspec: GObject.ParamSpec) => void)): number
2077
+ emit(sigName: "notify::handle", ...args: any[]): void
2078
+ connect(sigName: "notify::module", callback: (($obj: Slot, pspec: GObject.ParamSpec) => void)): number
2079
+ connect_after(sigName: "notify::module", callback: (($obj: Slot, pspec: GObject.ParamSpec) => void)): number
2080
+ emit(sigName: "notify::module", ...args: any[]): void
2081
+ connect(sigName: string, callback: (...args: any[]) => void): number
2082
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
2083
+ emit(sigName: string, ...args: any[]): void
2084
+ disconnect(id: number): void
2085
+ }
2086
+
2087
+ /**
2088
+ * Represents a PKCS#11 slot that can contain a token.
2089
+ *
2090
+ * A PKCS#11 slot can contain a token. As an example, a slot might be a card
2091
+ * reader, and the token the card. If the PKCS#11 module is not a hardware
2092
+ * driver, often the slot and token are equivalent.
2093
+ * @class
2094
+ */
2095
+ export class Slot extends GObject.Object {
2096
+
2097
+ // Own properties of Gck-2.Gck.Slot
2098
+
2099
+ static name: string
2100
+ static $gtype: GObject.GType<Slot>
2101
+
2102
+ // Constructors of Gck-2.Gck.Slot
2103
+
2104
+ constructor(config?: Slot.ConstructorProperties)
2105
+ _init(config?: Slot.ConstructorProperties): void
2106
+ /**
2107
+ * Create a new GckSlot object for a raw PKCS#11 handle.
2108
+ * @param module The module that this slot is on.
2109
+ * @param slot_id The raw PKCS#11 handle or slot id of this slot.
2110
+ * @returns The new GckSlot object.
2111
+ */
2112
+ static from_handle(module: Module, slot_id: number): Slot
2113
+ }
2114
+
2115
+ export interface Attribute {
2116
+
2117
+ // Own fields of Gck-2.Gck.Attribute
2118
+
2119
+ /**
2120
+ * The attribute type, such as `CKA_LABEL`.
2121
+ * @field
2122
+ */
2123
+ type: number
2124
+ /**
2125
+ * The value of the attribute. May be %NULL.
2126
+ * @field
2127
+ */
2128
+ value: Uint8Array
2129
+ /**
2130
+ * The length of the attribute. May be [const`INVALID]` if the
2131
+ * attribute is invalid.
2132
+ * @field
2133
+ */
2134
+ length: number
2135
+
2136
+ // Owm methods of Gck-2.Gck.Attribute
2137
+
2138
+ /**
2139
+ * Clear allocated memory held by a #GckAttribute.
2140
+ *
2141
+ * This attribute must have been allocated by a Gck library function, or
2142
+ * the results of this method are undefined.
2143
+ *
2144
+ * The type of the attribute will remain set.
2145
+ */
2146
+ clear(): void
2147
+ /**
2148
+ * Dump the specified attribute using g_printerr().
2149
+ */
2150
+ dump(): void
2151
+ /**
2152
+ * Duplicate the PKCS#11 attribute. All value memory is
2153
+ * also copied.
2154
+ *
2155
+ * The `attr` must have been allocated or initialized by a Gck function or
2156
+ * the results of this function are undefined.
2157
+ * @returns the duplicated attribute; use gck_attribute_free() to free it
2158
+ */
2159
+ dup(): Attribute
2160
+ /**
2161
+ * Compare two attributes. Useful with <code>GHashTable</code>.
2162
+ * @param attr2 second attribute to compare
2163
+ * @returns %TRUE if the attributes are equal.
2164
+ */
2165
+ equal(attr2: Attribute): boolean
2166
+ /**
2167
+ * Free an attribute and its allocated memory. These is usually
2168
+ * used with attributes that are allocated by [ctor`Attribute`.new]
2169
+ * or a similar function.
2170
+ */
2171
+ free(): void
2172
+ /**
2173
+ * Get the CK_BBOOL of a PKCS#11 attribute. No conversion
2174
+ * is performed. It is an error to pass an attribute to this
2175
+ * function unless you're know it's supposed to contain a
2176
+ * boolean value.
2177
+ * @returns The boolean value of the attribute.
2178
+ */
2179
+ get_boolean(): boolean
2180
+ /**
2181
+ * Get the raw value in the attribute.
2182
+ *
2183
+ * This is useful from scripting languages. C callers will generally
2184
+ * access the #GckAttribute struct directly.
2185
+ *
2186
+ * This function will %NULL if the attribute contains empty or invalid
2187
+ * data. The returned data must not be modified and is only valid
2188
+ * as long as this `attribute`.
2189
+ * @returns the value data or %NULL
2190
+ */
2191
+ get_data(): Uint8Array
2192
+ /**
2193
+ * Get the CK_DATE of a PKCS#11 attribute. No
2194
+ * conversion is performed. It is an error to pass an attribute
2195
+ * to this function unless you're know it's supposed to contain
2196
+ * a value of the right type.
2197
+ * @param value The date value to fill in with the parsed date.
2198
+ */
2199
+ get_date(value: GLib.Date): void
2200
+ /**
2201
+ * Get the string value of a PKCS#11 attribute. No
2202
+ * conversion is performed. It is an error to pass an attribute
2203
+ * to this function unless you're know it's supposed to contain
2204
+ * a value of the right type.
2205
+ * @returns a null terminated string, to be freed with g_free(), or %NULL if the value was invalid
2206
+ */
2207
+ get_string(): string | null
2208
+ /**
2209
+ * Get the CK_ULONG value of a PKCS#11 attribute. No
2210
+ * conversion is performed. It is an error to pass an attribute
2211
+ * to this function unless you're know it's supposed to contain
2212
+ * a value of the right type.
2213
+ * @returns The ulong value of the attribute.
2214
+ */
2215
+ get_ulong(): number
2216
+ /**
2217
+ * Hash an attribute for use in <code>GHashTable</code> keys.
2218
+ * @returns the hash code
2219
+ */
2220
+ hash(): number
2221
+ /**
2222
+ * Initialize a PKCS#11 attribute as a copy of another attribute.
2223
+ * This copies the value memory as well.
2224
+ *
2225
+ * When done with the copied attribute you should use
2226
+ * [method`Attribute`.clear] to free the internal memory.
2227
+ * @param src An attribute to copy.
2228
+ */
2229
+ init_copy(src: Attribute): void
2230
+ /**
2231
+ * Check if the PKCS#11 attribute represents 'invalid' or 'not found'
2232
+ * according to the PKCS#11 spec. That is, having length
2233
+ * of (CK_ULONG)-1.
2234
+ * @returns Whether the attribute represents invalid or not.
2235
+ */
2236
+ is_invalid(): boolean
2237
+ }
2238
+
2239
+ /**
2240
+ * This structure represents a PKCS#11 `CK_ATTRIBUTE`. These attributes contain
2241
+ * information about a PKCS#11 object. Use [method`Object`.get] or
2242
+ * [method`Object`.set] to set and attributes on an object.
2243
+ *
2244
+ * Although you are free to allocate a `GckAttribute` in your own code, no
2245
+ * functions in this library will operate on such an attribute.
2246
+ * @record
2247
+ */
2248
+ export class Attribute {
2249
+
2250
+ // Own properties of Gck-2.Gck.Attribute
2251
+
2252
+ static name: string
2253
+
2254
+ // Constructors of Gck-2.Gck.Attribute
2255
+
2256
+ /**
2257
+ * Create a new PKCS#11 attribute. The value will be copied
2258
+ * into the new attribute.
2259
+ * @constructor
2260
+ * @param attr_type the PKCS#11 attribute type to set on the attribute
2261
+ * @param value the raw value of the attribute
2262
+ * @param length the length of the attribute
2263
+ * @returns the new attribute; when done with the attribute use gck_attribute_free() to free it
2264
+ */
2265
+ constructor(attr_type: number, value: number, length: number)
2266
+ /**
2267
+ * Create a new PKCS#11 attribute. The value will be copied
2268
+ * into the new attribute.
2269
+ * @constructor
2270
+ * @param attr_type the PKCS#11 attribute type to set on the attribute
2271
+ * @param value the raw value of the attribute
2272
+ * @param length the length of the attribute
2273
+ * @returns the new attribute; when done with the attribute use gck_attribute_free() to free it
2274
+ */
2275
+ static new(attr_type: number, value: number, length: number): Attribute
2276
+ /**
2277
+ * Initialize a PKCS#11 attribute to boolean. This will result
2278
+ * in a CK_BBOOL attribute from the PKCS#11 specs.
2279
+ * @constructor
2280
+ * @param attr_type the PKCS#11 attribute type to set on the attribute
2281
+ * @param value the boolean value of the attribute
2282
+ * @returns the new attribute; when done with the attribute u gck_attribute_free() to free it
2283
+ */
2284
+ static new_boolean(attr_type: number, value: boolean): Attribute
2285
+ /**
2286
+ * Initialize a PKCS#11 attribute to a date. This will result
2287
+ * in a CK_DATE attribute from the PKCS#11 specs.
2288
+ * @constructor
2289
+ * @param attr_type the PKCS#11 attribute type to set on the attribute
2290
+ * @param value the date value of the attribute
2291
+ * @returns the new attribute; when done with the attribute u gck_attribute_free() to free it
2292
+ */
2293
+ static new_date(attr_type: number, value: GLib.Date): Attribute
2294
+ /**
2295
+ * Create a new PKCS#11 attribute with empty data.
2296
+ * @constructor
2297
+ * @param attr_type the PKCS#11 attribute type to set on the attribute
2298
+ * @returns the new attribute; when done with the attribute use gck_attribute_free() to free it
2299
+ */
2300
+ static new_empty(attr_type: number): Attribute
2301
+ /**
2302
+ * Create a new PKCS#11 attribute as 'invalid' or 'not found'
2303
+ * state. Specifically this sets the value length to (CK_ULONG)-1
2304
+ * as specified in the PKCS#11 specification.
2305
+ * @constructor
2306
+ * @param attr_type the PKCS#11 attribute type to set on the attribute
2307
+ * @returns the new attribute; when done with the attribute use gck_attribute_free() to free it
2308
+ */
2309
+ static new_invalid(attr_type: number): Attribute
2310
+ /**
2311
+ * Initialize a PKCS#11 attribute to a string. This will result
2312
+ * in an attribute containing the text, but not the null terminator.
2313
+ * The text in the attribute will be of the same encoding as you pass
2314
+ * to this function.
2315
+ * @constructor
2316
+ * @param attr_type the PKCS#11 attribute type to set on the attribute
2317
+ * @param value the null-terminated string value of the attribute
2318
+ * @returns the new attribute; when done with the attribute u gck_attribute_free() to free it
2319
+ */
2320
+ static new_string(attr_type: number, value: string | null): Attribute
2321
+ /**
2322
+ * Initialize a PKCS#11 attribute to a unsigned long. This will result
2323
+ * in a `CK_ULONG` attribute from the PKCS#11 specs.
2324
+ * @constructor
2325
+ * @param attr_type the PKCS#11 attribute type to set on the attribute
2326
+ * @param value the ulong value of the attribute
2327
+ * @returns the new attribute; when done with the attribute u gck_attribute_free() to free it
2328
+ */
2329
+ static new_ulong(attr_type: number, value: number): Attribute
2330
+ }
2331
+
2332
+ export interface Attributes {
2333
+
2334
+ // Owm methods of Gck-2.Gck.Attributes
2335
+
2336
+ /**
2337
+ * Get attribute at the specified index in the attribute array.
2338
+ *
2339
+ * Use [method`Attributes`.count] to determine how many attributes are
2340
+ * in the array.
2341
+ * @param index The attribute index to retrieve.
2342
+ * @returns the specified attribute
2343
+ */
2344
+ at(index: number): Attribute
2345
+ /**
2346
+ * Check whether the attributes contain a certain attribute.
2347
+ * @param match The attribute to find
2348
+ * @returns %TRUE if the attributes contain the attribute.
2349
+ */
2350
+ contains(match: Attribute): boolean
2351
+ /**
2352
+ * Get the number of attributes in this attribute array.
2353
+ * @returns The number of contained attributes.
2354
+ */
2355
+ count(): number
2356
+ /**
2357
+ * Dump the attributes using g_printerr().
2358
+ */
2359
+ dump(): void
2360
+ /**
2361
+ * Find an attribute with the specified type in the array.
2362
+ * @param attr_type The type of attribute to find.
2363
+ * @returns the first attribute found with the specified type, or %NULL
2364
+ */
2365
+ find(attr_type: number): Attribute
2366
+ /**
2367
+ * Find an attribute with the specified type in the array.
2368
+ *
2369
+ * The attribute (if found) must be of the right size to store
2370
+ * a boolean value (ie: CK_BBOOL). If the attribute is marked invalid
2371
+ * then it will be treated as not found.
2372
+ * @param attr_type The type of attribute to find.
2373
+ * @returns Whether a value was found or not.
2374
+ */
2375
+ find_boolean(attr_type: number): [ /* returnType */ boolean, /* value */ boolean ]
2376
+ /**
2377
+ * Find an attribute with the specified type in the array.
2378
+ *
2379
+ * The attribute (if found) must be of the right size to store
2380
+ * a date value (ie: CK_DATE). If the attribute is marked invalid
2381
+ * then it will be treated as not found.
2382
+ * @param attr_type The type of attribute to find.
2383
+ * @returns Whether a value was found or not.
2384
+ */
2385
+ find_date(attr_type: number): [ /* returnType */ boolean, /* value */ GLib.Date ]
2386
+ /**
2387
+ * Find an attribute with the specified type in the array.
2388
+ *
2389
+ * If the attribute is marked invalid then it will be treated as not found.
2390
+ * The resulting string will be null-terminated, and must be freed by the caller
2391
+ * using g_free().
2392
+ * @param attr_type The type of attribute to find.
2393
+ * @returns Whether a value was found or not.
2394
+ */
2395
+ find_string(attr_type: number): [ /* returnType */ boolean, /* value */ string | null ]
2396
+ /**
2397
+ * Find an attribute with the specified type in the array.
2398
+ *
2399
+ * The attribute (if found) must be of the right size to store
2400
+ * a unsigned long value (ie: CK_ULONG). If the attribute is marked invalid
2401
+ * then it will be treated as not found.
2402
+ * @param attr_type The type of attribute to find.
2403
+ * @returns Whether a value was found or not.
2404
+ */
2405
+ find_ulong(attr_type: number): [ /* returnType */ boolean, /* value */ number ]
2406
+ /**
2407
+ * Reference this attributes array.
2408
+ * @returns the attributes
2409
+ */
2410
+ ref(): Attributes
2411
+ /**
2412
+ * Print out attributes to a string in aform that's useful for debugging
2413
+ * or logging.
2414
+ *
2415
+ * The format of the string returned may change in the future.
2416
+ * @returns a newly allocated string
2417
+ */
2418
+ to_string(): string | null
2419
+ /**
2420
+ * Unreference this attribute array.
2421
+ *
2422
+ * When all outstanding references are gone, the array will be freed.
2423
+ */
2424
+ unref(): void
2425
+ }
2426
+
2427
+ /**
2428
+ * A set of [struct`Attribute]` structures.
2429
+ *
2430
+ * These attributes contain information about a PKCS11 object. Use
2431
+ * [method`Object`.get] or [method`Object`.set] to set and retrieve attributes on
2432
+ * an object.
2433
+ * @record
2434
+ */
2435
+ export class Attributes {
2436
+
2437
+ // Own properties of Gck-2.Gck.Attributes
2438
+
2439
+ static name: string
2440
+
2441
+ // Constructors of Gck-2.Gck.Attributes
2442
+
2443
+ /**
2444
+ * Create a new empty `GckAttributes` array.
2445
+ * @constructor
2446
+ * @returns a reference to the new attributes array; when done with the array release it with gck_attributes_unref().
2447
+ */
2448
+ constructor()
2449
+ /**
2450
+ * Create a new empty `GckAttributes` array.
2451
+ * @constructor
2452
+ * @returns a reference to the new attributes array; when done with the array release it with gck_attributes_unref().
2453
+ */
2454
+ static new(): Attributes
2455
+ }
2456
+
2457
+ export interface Builder {
2458
+
2459
+ // Owm methods of Gck-2.Gck.Builder
2460
+
2461
+ /**
2462
+ * Add all the `attrs` attributes to the builder. The attributes are added
2463
+ * uncondititionally whether or not attributes with the same types already
2464
+ * exist in the builder.
2465
+ *
2466
+ * As an optimization, the attribute memory values are automatically shared
2467
+ * between the attributes and the builder.
2468
+ * @param attrs the attributes to add
2469
+ */
2470
+ add_all(attrs: Attributes): void
2471
+ /**
2472
+ * Add an attribute to the builder. The attribute is added unconditionally whether
2473
+ * or not an attribute with the same type already exists on the builder.
2474
+ *
2475
+ * The `attr` attribute must have been created or owned by the Gck library.
2476
+ * If you call this function on an arbitrary `GckAttribute` that is allocated on
2477
+ * the stack or elsewhere, then this will result in undefined behavior.
2478
+ *
2479
+ * As an optimization, the attribute memory value is automatically shared
2480
+ * between the attribute and the builder.
2481
+ * @param attr the attribute to add
2482
+ */
2483
+ add_attribute(attr: Attribute): void
2484
+ /**
2485
+ * Add a new attribute to the builder for the boolean `value`.
2486
+ * Unconditionally adds a new attribute, even if one with the same `attr_type`
2487
+ * already exists.
2488
+ * @param attr_type the new attribute type
2489
+ * @param value the attribute value
2490
+ */
2491
+ add_boolean(attr_type: number, value: boolean): void
2492
+ /**
2493
+ * Add a new attribute to the builder with an arbitrary value. Unconditionally
2494
+ * adds a new attribute, even if one with the same `attr_type` already exists.
2495
+ *
2496
+ * The memory in `value` is copied by the builder.
2497
+ *
2498
+ * %NULL may be specified for the `value` argument, in which case an empty
2499
+ * attribute is created. [const`INVALID]` may be specified for the length, in
2500
+ * which case an invalid attribute is created in the PKCS#11 style.
2501
+ * @param attr_type the new attribute type
2502
+ * @param value the new attribute memory
2503
+ */
2504
+ add_data(attr_type: number, value: Uint8Array | null): void
2505
+ /**
2506
+ * Add a new attribute to the builder for the date `value`.
2507
+ * Unconditionally adds a new attribute, even if one with the same `attr_type`
2508
+ * already exists.
2509
+ * @param attr_type the new attribute type
2510
+ * @param value the attribute value
2511
+ */
2512
+ add_date(attr_type: number, value: GLib.Date): void
2513
+ /**
2514
+ * Add a new attribute to the builder that is empty. Unconditionally
2515
+ * adds a new attribute, even if one with the same `attr_type` already exists.
2516
+ * @param attr_type the new attribute type
2517
+ */
2518
+ add_empty(attr_type: number): void
2519
+ /**
2520
+ * Add a new attribute to the builder that is invalid in the PKCS#11 sense.
2521
+ * Unconditionally adds a new attribute, even if one with the same `attr_type`
2522
+ * already exists.
2523
+ * @param attr_type the new attribute type
2524
+ */
2525
+ add_invalid(attr_type: number): void
2526
+ /**
2527
+ * Add the attributes with the types in `only_types` from `attrs` to the
2528
+ * builder. The attributes are added uncondititionally whether or not
2529
+ * attributes with the same types already exist in the builder.
2530
+ *
2531
+ * ```c
2532
+ * // Add the CKA_ID and CKA_CLASS attributes from attrs to builder
2533
+ * gulong only[] = { CKA_ID, CKA_CLASS };
2534
+ * gck_builder_add_onlyv (builder, attrs, only, 2);
2535
+ * ```
2536
+ *
2537
+ * As an optimization, the attribute memory values are automatically shared
2538
+ * between the attributes and the builder.
2539
+ * @param attrs the attributes to add
2540
+ * @param only_types the types of attributes to add
2541
+ */
2542
+ add_only(attrs: Attributes, only_types: number[]): void
2543
+ /**
2544
+ * Add a new attribute to the builder for the string `value` or %NULL.
2545
+ * Unconditionally adds a new attribute, even if one with the same `attr_type`
2546
+ * already exists.
2547
+ * @param attr_type the new attribute type
2548
+ * @param value the attribute value
2549
+ */
2550
+ add_string(attr_type: number, value: string | null): void
2551
+ /**
2552
+ * Add a new attribute to the builder for the unsigned long `value`.
2553
+ * Unconditionally adds a new attribute, even if one with the same `attr_type`
2554
+ * already exists.
2555
+ * @param attr_type the new attribute type
2556
+ * @param value the attribute value
2557
+ */
2558
+ add_ulong(attr_type: number, value: number): void
2559
+ /**
2560
+ * Clear the builder and release all allocated memory. The builder may be used
2561
+ * again to build another set of attributes after this function call.
2562
+ *
2563
+ * If memory is shared between this builder and other attributes, then that
2564
+ * memory is only freed when both of them are cleared or unreferenced.
2565
+ */
2566
+ clear(): void
2567
+ /**
2568
+ * Make a copy of the builder and its state. The new builder is allocated
2569
+ * with [ctor`Builder`.new] and should be freed with gck_builder_unref().
2570
+ *
2571
+ * Attribute value memory is automatically shared between the two builders,
2572
+ * and is only freed when both are gone.
2573
+ * @returns the builder copy, which should be freed with gck_builder_unref().
2574
+ */
2575
+ copy(): Builder
2576
+ /**
2577
+ * Take the attributes that have been built in the #GckBuilder. The builder
2578
+ * will no longer contain any attributes after this function call.
2579
+ * @returns the attributes, which should be freed with gck_attributes_unref()
2580
+ */
2581
+ end(): Attributes
2582
+ /**
2583
+ * Find an attribute in the builder. Both valid and invalid attributes (in
2584
+ * the PKCS#11 sense) are returned. If multiple attributes exist for the given
2585
+ * attribute type, then the first one is returned.
2586
+ *
2587
+ * The returned [struct`Attribute]` is owned by the builder and may not be
2588
+ * modified in any way. It is only valid until another attribute is added to or
2589
+ * set on the builder, or until the builder is cleared or unreferenced.
2590
+ * @param attr_type the type of attribute to find
2591
+ * @returns the attribute or %NULL if not found
2592
+ */
2593
+ find(attr_type: number): Attribute
2594
+ /**
2595
+ * Find a boolean attribute in the builder that has the type `attr_type,` is
2596
+ * of the correct boolean size, and is not invalid in the PKCS#11 sense.
2597
+ * If multiple attributes exist for the given attribute type, then the first\
2598
+ * one is returned.
2599
+ * @param attr_type the type of attribute to find
2600
+ * @returns whether a valid boolean attribute was found
2601
+ */
2602
+ find_boolean(attr_type: number): [ /* returnType */ boolean, /* value */ boolean ]
2603
+ /**
2604
+ * Find a date attribute in the builder that has the type `attr_type,` is of
2605
+ * the correct date size, and is not invalid in the PKCS#11 sense.
2606
+ * If multiple attributes exist for the given attribute type, then the first
2607
+ * one is returned.
2608
+ * @param attr_type the type of attribute to find
2609
+ * @returns whether a valid date attribute was found
2610
+ */
2611
+ find_date(attr_type: number): [ /* returnType */ boolean, /* value */ GLib.Date ]
2612
+ /**
2613
+ * Find a string attribute in the builder that has the type `attr_type,` has a
2614
+ * non %NULL value pointer, and is not invalid in the PKCS#11 sense.
2615
+ * If multiple attributes exist for the given attribute type, then the first
2616
+ * one is returned.
2617
+ * @param attr_type the type of attribute to find
2618
+ * @returns whether a valid string attribute was found
2619
+ */
2620
+ find_string(attr_type: number): [ /* returnType */ boolean, /* value */ string | null ]
2621
+ /**
2622
+ * Find a unsigned long attribute in the builder that has the type `attr_type,`
2623
+ * is of the correct unsigned long size, and is not invalid in the PKCS#11 sense.
2624
+ * If multiple attributes exist for the given attribute type, then the first
2625
+ * one is returned.
2626
+ * @param attr_type the type of attribute to find
2627
+ * @returns whether a valid unsigned long attribute was found
2628
+ */
2629
+ find_ulong(attr_type: number): [ /* returnType */ boolean, /* value */ number ]
2630
+ /**
2631
+ * Initialize a stack allocated builder, with the default flags.
2632
+ *
2633
+ * This is equivalent to initializing a builder variable with the
2634
+ * %GCK_BUILDER_INIT constant, or setting it to zeroed memory.
2635
+ *
2636
+ * ```c
2637
+ * // Equivalent ways of initializing a GckBuilder
2638
+ * GckBuilder builder = GCK_BUILDER_INIT;
2639
+ * GckBuilder builder2;
2640
+ * GckBuilder builder3;
2641
+ *
2642
+ * gck_builder_init (&builder2);
2643
+ *
2644
+ * memset (&builder3, 0, sizeof (builder3));
2645
+ * ```
2646
+ */
2647
+ init(): void
2648
+ /**
2649
+ * Initialize a stack allocated builder, with the appropriate flags.
2650
+ *
2651
+ * If the %GCK_BUILDER_SECURE_MEMORY flag is specified then non-pageable memory
2652
+ * will be used for the various values of the attributes in the builder
2653
+ * @param flags the flags for the new builder
2654
+ */
2655
+ init_full(flags: BuilderFlags): void
2656
+ /**
2657
+ * Add a reference to a builder that was created with [ctor`Builder`.new]. The
2658
+ * builder must later be unreferenced again with gck_builder_unref().
2659
+ *
2660
+ * It is an error to use this function on builders that were allocated on the
2661
+ * stack.
2662
+ * @returns the builder
2663
+ */
2664
+ ref(): Builder
2665
+ /**
2666
+ * Set all the `attrs` attributes to the builder. If any attributes with the
2667
+ * same types are already present in the builder, then those attributes are
2668
+ * changed to the new values.
2669
+ *
2670
+ * As an optimization, the attribute memory values are automatically shared
2671
+ * between the attributes and the builder.
2672
+ * @param attrs the attributes to set
2673
+ */
2674
+ set_all(attrs: Attributes): void
2675
+ /**
2676
+ * Set an attribute on the builder for the boolean `value`.
2677
+ * If an attribute with `attr_type` already exists in the builder then it is
2678
+ * changed to the new value, otherwise an attribute is added.
2679
+ * @param attr_type the new attribute type
2680
+ * @param value the attribute value
2681
+ */
2682
+ set_boolean(attr_type: number, value: boolean): void
2683
+ /**
2684
+ * Set a new attribute to the builder with an arbitrary value. If an attribute
2685
+ * with `attr_type` already exists in the builder then it is changed to the new
2686
+ * value, otherwise an attribute is added.
2687
+ *
2688
+ * The memory in `value` is copied by the builder.
2689
+ *
2690
+ * %NULL may be specified for the `value` argument, in which case an empty
2691
+ * attribute is created. [const`INVALID]` may be specified for the length, in
2692
+ * which case an invalid attribute is created in the PKCS#11 style.
2693
+ * @param attr_type the attribute type
2694
+ * @param value the new attribute memory
2695
+ */
2696
+ set_data(attr_type: number, value: Uint8Array | null): void
2697
+ /**
2698
+ * Set an attribute on the builder for the date `value`.
2699
+ * If an attribute with `attr_type` already exists in the builder then it is
2700
+ * changed to the new value, otherwise an attribute is added.
2701
+ * @param attr_type the new attribute type
2702
+ * @param value the attribute value
2703
+ */
2704
+ set_date(attr_type: number, value: GLib.Date): void
2705
+ /**
2706
+ * Set an attribute on the builder that is empty. If an attribute
2707
+ * with `attr_type` already exists in the builder then it is changed to the new
2708
+ * value, otherwise an attribute is added.
2709
+ * @param attr_type the attribute type
2710
+ */
2711
+ set_empty(attr_type: number): void
2712
+ /**
2713
+ * Set an attribute on the builder that is invalid in the PKCS#11 sense.
2714
+ * If an attribute with `attr_type` already exists in the builder then it is
2715
+ * changed to the new value, otherwise an attribute is added.
2716
+ * @param attr_type the attribute type
2717
+ */
2718
+ set_invalid(attr_type: number): void
2719
+ /**
2720
+ * Set an attribute on the builder for the string `value` or %NULL.
2721
+ * If an attribute with `attr_type` already exists in the builder then it is
2722
+ * changed to the new value, otherwise an attribute is added.
2723
+ * @param attr_type the new attribute type
2724
+ * @param value the attribute value
2725
+ */
2726
+ set_string(attr_type: number, value: string | null): void
2727
+ /**
2728
+ * Set an attribute on the builder for the unsigned long `value`.
2729
+ * If an attribute with `attr_type` already exists in the builder then it is
2730
+ * changed to the new value, otherwise an attribute is added.
2731
+ * @param attr_type the new attribute type
2732
+ * @param value the attribute value
2733
+ */
2734
+ set_ulong(attr_type: number, value: number): void
2735
+ /**
2736
+ * Add a new attribute to the builder with an arbitrary value. Unconditionally
2737
+ * adds a new attribute, even if one with the same `attr_type` already exists.
2738
+ *
2739
+ * Ownership of the `value` memory is taken by the builder, may be reallocated,
2740
+ * and is eventually freed with g_free(). The memory must have been allocated
2741
+ * using the standard GLib memory allocation routines.
2742
+ *
2743
+ * %NULL may be specified for the `value` argument, in which case an empty
2744
+ * attribute is created. [const`INVALID]` may be specified for the length, in
2745
+ * which case an invalid attribute is created in the PKCS#11 style.
2746
+ * @param attr_type the new attribute type
2747
+ * @param value the new attribute memory
2748
+ */
2749
+ take_data(attr_type: number, value: Uint8Array | null): void
2750
+ /**
2751
+ * Unreferences a builder. If this was the last reference then the builder
2752
+ * is freed.
2753
+ *
2754
+ * It is an error to use this function on builders that were allocated on the
2755
+ * stack.
2756
+ */
2757
+ unref(): void
2758
+ }
2759
+
2760
+ /**
2761
+ * A builder for a set of attributes. Add attributes to a builder, and then use
2762
+ * [method`Builder`.end] to get the completed [struct`Attributes]`.
2763
+ *
2764
+ * The fields of #GckBuilder are private and not to be accessed directly.
2765
+ * @record
2766
+ */
2767
+ export class Builder {
2768
+
2769
+ // Own properties of Gck-2.Gck.Builder
2770
+
2771
+ static name: string
2772
+
2773
+ // Constructors of Gck-2.Gck.Builder
2774
+
2775
+ /**
2776
+ * Create a new `GckBuilder` not allocated on the stack, so it can be shared
2777
+ * across a single scope, and referenced / unreferenced.
2778
+ *
2779
+ * Normally a `GckBuilder` is created on the stack, and simply initialized.
2780
+ *
2781
+ * If the %GCK_BUILDER_SECURE_MEMORY flag is specified then non-pageable memory
2782
+ * will be used for the various values of the attributes in the builder
2783
+ * @constructor
2784
+ * @param flags flags for the new builder
2785
+ * @returns a new builder, to be freed with gck_builder_unref()
2786
+ */
2787
+ constructor(flags: BuilderFlags)
2788
+ /**
2789
+ * Create a new `GckBuilder` not allocated on the stack, so it can be shared
2790
+ * across a single scope, and referenced / unreferenced.
2791
+ *
2792
+ * Normally a `GckBuilder` is created on the stack, and simply initialized.
2793
+ *
2794
+ * If the %GCK_BUILDER_SECURE_MEMORY flag is specified then non-pageable memory
2795
+ * will be used for the various values of the attributes in the builder
2796
+ * @constructor
2797
+ * @param flags flags for the new builder
2798
+ * @returns a new builder, to be freed with gck_builder_unref()
2799
+ */
2800
+ static new(flags: BuilderFlags): Builder
2801
+ }
2802
+
2803
+ export interface EnumeratorClass {
2804
+
2805
+ // Own fields of Gck-2.Gck.EnumeratorClass
2806
+
2807
+ parent_class: GObject.ObjectClass
2808
+ }
2809
+
2810
+ export abstract class EnumeratorClass {
2811
+
2812
+ // Own properties of Gck-2.Gck.EnumeratorClass
2813
+
2814
+ static name: string
2815
+ }
2816
+
2817
+ export interface Mechanism {
2818
+
2819
+ // Own fields of Gck-2.Gck.Mechanism
2820
+
2821
+ /**
2822
+ * The mechanism type
2823
+ * @field
2824
+ */
2825
+ type: number
2826
+ /**
2827
+ * Mechanism specific data.
2828
+ * @field
2829
+ */
2830
+ parameter: any
2831
+ /**
2832
+ * Length of mechanism specific data.
2833
+ * @field
2834
+ */
2835
+ n_parameter: number
2836
+ }
2837
+
2838
+ /**
2839
+ * Represents a mechanism used with crypto operations.
2840
+ * @record
2841
+ */
2842
+ export class Mechanism {
2843
+
2844
+ // Own properties of Gck-2.Gck.Mechanism
2845
+
2846
+ static name: string
2847
+ }
2848
+
2849
+ export interface MechanismInfo {
2850
+
2851
+ // Own fields of Gck-2.Gck.MechanismInfo
2852
+
2853
+ /**
2854
+ * The minimum key size that can be used with this mechanism.
2855
+ * @field
2856
+ */
2857
+ min_key_size: number
2858
+ /**
2859
+ * The maximum key size that can be used with this mechanism.
2860
+ * @field
2861
+ */
2862
+ max_key_size: number
2863
+ /**
2864
+ * Various PKCS11 flags that apply to this mechanism.
2865
+ * @field
2866
+ */
2867
+ flags: number
2868
+
2869
+ // Owm methods of Gck-2.Gck.MechanismInfo
2870
+
2871
+ /**
2872
+ * Make a copy of the mechanism info.
2873
+ * @returns a newly allocated copy mechanism info
2874
+ */
2875
+ copy(): MechanismInfo
2876
+ /**
2877
+ * Free the GckMechanismInfo and associated resources.
2878
+ */
2879
+ free(): void
2880
+ }
2881
+
2882
+ /**
2883
+ * Represents information about a PKCS11 mechanism.
2884
+ *
2885
+ * This is analogous to a CK_MECHANISM_INFO structure.
2886
+ *
2887
+ * When you're done with this structure it should be released with
2888
+ * gck_mechanism_info_free().
2889
+ * @record
2890
+ */
2891
+ export class MechanismInfo {
2892
+
2893
+ // Own properties of Gck-2.Gck.MechanismInfo
2894
+
2895
+ static name: string
2896
+ }
2897
+
2898
+ export interface ModuleClass {
2899
+
2900
+ // Own fields of Gck-2.Gck.ModuleClass
2901
+
2902
+ parent: GObject.ObjectClass
2903
+ authenticate_slot: (self: Module, slot: Slot, label: string | null, password: string | null) => boolean
2904
+ authenticate_object: (self: Module, object: Object, label: string | null, password: string | null) => boolean
2905
+ }
2906
+
2907
+ export abstract class ModuleClass {
2908
+
2909
+ // Own properties of Gck-2.Gck.ModuleClass
2910
+
2911
+ static name: string
2912
+ }
2913
+
2914
+ export interface ModuleInfo {
2915
+
2916
+ // Own fields of Gck-2.Gck.ModuleInfo
2917
+
2918
+ /**
2919
+ * The major version of the module.
2920
+ * @field
2921
+ */
2922
+ pkcs11_version_major: number
2923
+ /**
2924
+ * The minor version of the module.
2925
+ * @field
2926
+ */
2927
+ pkcs11_version_minor: number
2928
+ /**
2929
+ * The module manufacturer.
2930
+ * @field
2931
+ */
2932
+ manufacturer_id: string | null
2933
+ /**
2934
+ * The module PKCS&num;11 flags.
2935
+ * @field
2936
+ */
2937
+ flags: number
2938
+ /**
2939
+ * The module description.
2940
+ * @field
2941
+ */
2942
+ library_description: string | null
2943
+ /**
2944
+ * The major version of the library.
2945
+ * @field
2946
+ */
2947
+ library_version_major: number
2948
+ /**
2949
+ * The minor version of the library.
2950
+ * @field
2951
+ */
2952
+ library_version_minor: number
2953
+
2954
+ // Owm methods of Gck-2.Gck.ModuleInfo
2955
+
2956
+ /**
2957
+ * Make a copy of the module info.
2958
+ * @returns a newly allocated copy module info
2959
+ */
2960
+ copy(): ModuleInfo
2961
+ /**
2962
+ * Free a GckModuleInfo structure.
2963
+ */
2964
+ free(): void
2965
+ }
2966
+
2967
+ /**
2968
+ * Holds information about the PKCS#11 module.
2969
+ *
2970
+ * This structure corresponds to `CK_MODULE_INFO` in the PKCS#11 standard. The
2971
+ * strings are %NULL terminated for easier use.
2972
+ *
2973
+ * Use gck_module_info_free() to release this structure when done with it.
2974
+ * @record
2975
+ */
2976
+ export class ModuleInfo {
2977
+
2978
+ // Own properties of Gck-2.Gck.ModuleInfo
2979
+
2980
+ static name: string
2981
+ }
2982
+
2983
+ export interface ObjectCacheInterface {
2984
+
2985
+ // Own fields of Gck-2.Gck.ObjectCacheInterface
2986
+
2987
+ /**
2988
+ * parent interface
2989
+ * @field
2990
+ */
2991
+ interface: GObject.TypeInterface
2992
+ /**
2993
+ * attribute types that an
2994
+ * enumerator should retrieve
2995
+ * @field
2996
+ */
2997
+ default_types: number[]
2998
+ /**
2999
+ * number of attribute types to be retrieved
3000
+ * @field
3001
+ */
3002
+ n_default_types: number
3003
+ fill: (object: ObjectCache, attrs: Attributes) => void
3004
+ }
3005
+
3006
+ /**
3007
+ * Interface for [iface`ObjectCache]`. If the `default_types` field is
3008
+ * implemented by a implementing class, then that will be used by a
3009
+ * [class`Enumerator]` which has been setup using
3010
+ * [method`Enumerator`.set_object_type]
3011
+ *
3012
+ * The implementation for `populate` should add the attributes to the
3013
+ * cache. It must be thread safe.
3014
+ * @record
3015
+ */
3016
+ export abstract class ObjectCacheInterface {
3017
+
3018
+ // Own properties of Gck-2.Gck.ObjectCacheInterface
3019
+
3020
+ static name: string
3021
+ }
3022
+
3023
+ export interface ObjectClass {
3024
+
3025
+ // Own fields of Gck-2.Gck.ObjectClass
3026
+
3027
+ /**
3028
+ * derived from this
3029
+ * @field
3030
+ */
3031
+ parent: GObject.ObjectClass
3032
+ }
3033
+
3034
+ /**
3035
+ * The class for a [class`Object]`.
3036
+ *
3037
+ * If the `attribute_types` field is set by a derived class, then the a
3038
+ * #GckEnumerator which has been setup using [method`Enumerator`.set_object_type]
3039
+ * with this derived type will retrieve these attributes when enumerating. In
3040
+ * this case the class must implement an 'attributes' property of boxed type
3041
+ * `GCK_TYPE_ATTRIBUTES`.
3042
+ * @record
3043
+ */
3044
+ export abstract class ObjectClass {
3045
+
3046
+ // Own properties of Gck-2.Gck.ObjectClass
3047
+
3048
+ static name: string
3049
+ }
3050
+
3051
+ export interface PasswordClass {
3052
+
3053
+ // Own fields of Gck-2.Gck.PasswordClass
3054
+
3055
+ parent_class: Gio.TlsPasswordClass
3056
+ }
3057
+
3058
+ /**
3059
+ * The class struct for [class`Password]`.
3060
+ * @record
3061
+ */
3062
+ export abstract class PasswordClass {
3063
+
3064
+ // Own properties of Gck-2.Gck.PasswordClass
3065
+
3066
+ static name: string
3067
+ }
3068
+
3069
+ export interface SessionClass {
3070
+
3071
+ // Own fields of Gck-2.Gck.SessionClass
3072
+
3073
+ parent: GObject.ObjectClass
3074
+ }
3075
+
3076
+ export abstract class SessionClass {
3077
+
3078
+ // Own properties of Gck-2.Gck.SessionClass
3079
+
3080
+ static name: string
3081
+ }
3082
+
3083
+ export interface SessionInfo {
3084
+
3085
+ // Own fields of Gck-2.Gck.SessionInfo
3086
+
3087
+ /**
3088
+ * The handle of the PKCS11 slot that this session is opened on.
3089
+ * @field
3090
+ */
3091
+ slot_id: number
3092
+ /**
3093
+ * The user login state of the session.
3094
+ * @field
3095
+ */
3096
+ state: number
3097
+ /**
3098
+ * Various PKCS11 flags.
3099
+ * @field
3100
+ */
3101
+ flags: number
3102
+ /**
3103
+ * The last device error that occurred from an operation on this session.
3104
+ * @field
3105
+ */
3106
+ device_error: number
3107
+
3108
+ // Owm methods of Gck-2.Gck.SessionInfo
3109
+
3110
+ /**
3111
+ * Make a new copy of a session info structure.
3112
+ * @returns a new copy of the session info
3113
+ */
3114
+ copy(): SessionInfo
3115
+ /**
3116
+ * Free the GckSessionInfo structure and all associated memory.
3117
+ */
3118
+ free(): void
3119
+ }
3120
+
3121
+ /**
3122
+ * Information about the session. This is analogous to a CK_SESSION_INFO structure.
3123
+ *
3124
+ * When done with this structure, release it using gck_session_info_free().
3125
+ * @record
3126
+ */
3127
+ export class SessionInfo {
3128
+
3129
+ // Own properties of Gck-2.Gck.SessionInfo
3130
+
3131
+ static name: string
3132
+ }
3133
+
3134
+ export interface SlotClass {
3135
+
3136
+ // Own fields of Gck-2.Gck.SlotClass
3137
+
3138
+ parent_class: GObject.ObjectClass
3139
+ }
3140
+
3141
+ export abstract class SlotClass {
3142
+
3143
+ // Own properties of Gck-2.Gck.SlotClass
3144
+
3145
+ static name: string
3146
+ }
3147
+
3148
+ export interface SlotInfo {
3149
+
3150
+ // Own fields of Gck-2.Gck.SlotInfo
3151
+
3152
+ /**
3153
+ * Description of the slot.
3154
+ * @field
3155
+ */
3156
+ slot_description: string | null
3157
+ /**
3158
+ * The manufacturer of this slot.
3159
+ * @field
3160
+ */
3161
+ manufacturer_id: string | null
3162
+ /**
3163
+ * Various PKCS11 flags that apply to this slot.
3164
+ * @field
3165
+ */
3166
+ flags: number
3167
+ /**
3168
+ * The major version of the hardware.
3169
+ * @field
3170
+ */
3171
+ hardware_version_major: number
3172
+ /**
3173
+ * The minor version of the hardware.
3174
+ * @field
3175
+ */
3176
+ hardware_version_minor: number
3177
+ /**
3178
+ * The major version of the firmware.
3179
+ * @field
3180
+ */
3181
+ firmware_version_major: number
3182
+ /**
3183
+ * The minor version of the firmware.
3184
+ * @field
3185
+ */
3186
+ firmware_version_minor: number
3187
+
3188
+ // Owm methods of Gck-2.Gck.SlotInfo
3189
+
3190
+ /**
3191
+ * Make a copy of the slot info.
3192
+ * @returns a newly allocated copy slot info
3193
+ */
3194
+ copy(): SlotInfo
3195
+ /**
3196
+ * Free the GckSlotInfo and associated resources.
3197
+ */
3198
+ free(): void
3199
+ }
3200
+
3201
+ /**
3202
+ * Represents information about a PKCS11 slot.
3203
+ *
3204
+ * This is analogous to a CK_SLOT_INFO structure, but the
3205
+ * strings are far more usable.
3206
+ *
3207
+ * When you're done with this structure it should be released with
3208
+ * gck_slot_info_free().
3209
+ * @record
3210
+ */
3211
+ export class SlotInfo {
3212
+
3213
+ // Own properties of Gck-2.Gck.SlotInfo
3214
+
3215
+ static name: string
3216
+ }
3217
+
3218
+ export interface TokenInfo {
3219
+
3220
+ // Own fields of Gck-2.Gck.TokenInfo
3221
+
3222
+ /**
3223
+ * The displayable token label.
3224
+ * @field
3225
+ */
3226
+ label: string | null
3227
+ /**
3228
+ * The manufacturer of this slot.
3229
+ * @field
3230
+ */
3231
+ manufacturer_id: string | null
3232
+ /**
3233
+ * The token model number as a string.
3234
+ * @field
3235
+ */
3236
+ model: string | null
3237
+ /**
3238
+ * The token serial number as a string.
3239
+ * @field
3240
+ */
3241
+ serial_number: string | null
3242
+ /**
3243
+ * Various PKCS11 flags that apply to this token.
3244
+ * @field
3245
+ */
3246
+ flags: number
3247
+ /**
3248
+ * The maximum number of sessions allowed on this token.
3249
+ * @field
3250
+ */
3251
+ max_session_count: number
3252
+ /**
3253
+ * The number of sessions open on this token.
3254
+ * @field
3255
+ */
3256
+ session_count: number
3257
+ /**
3258
+ * The maximum number of read/write sessions allowed on this token.
3259
+ * @field
3260
+ */
3261
+ max_rw_session_count: number
3262
+ /**
3263
+ * The number of sessions open on this token.
3264
+ * @field
3265
+ */
3266
+ rw_session_count: number
3267
+ /**
3268
+ * The maximum length of a PIN for locking this token.
3269
+ * @field
3270
+ */
3271
+ max_pin_len: number
3272
+ /**
3273
+ * The minimum length of a PIN for locking this token.
3274
+ * @field
3275
+ */
3276
+ min_pin_len: number
3277
+ /**
3278
+ * The total amount of memory on this token for storing public objects.
3279
+ * @field
3280
+ */
3281
+ total_public_memory: number
3282
+ /**
3283
+ * The available amount of memory on this token for storing public objects.
3284
+ * @field
3285
+ */
3286
+ free_public_memory: number
3287
+ /**
3288
+ * The total amount of memory on this token for storing private objects.
3289
+ * @field
3290
+ */
3291
+ total_private_memory: number
3292
+ /**
3293
+ * The available amount of memory on this token for storing private objects.
3294
+ * @field
3295
+ */
3296
+ free_private_memory: number
3297
+ /**
3298
+ * The major version of the hardware.
3299
+ * @field
3300
+ */
3301
+ hardware_version_major: number
3302
+ /**
3303
+ * The minor version of the hardware.
3304
+ * @field
3305
+ */
3306
+ hardware_version_minor: number
3307
+ /**
3308
+ * The major version of the firmware.
3309
+ * @field
3310
+ */
3311
+ firmware_version_major: number
3312
+ /**
3313
+ * The minor version of the firmware.
3314
+ * @field
3315
+ */
3316
+ firmware_version_minor: number
3317
+ /**
3318
+ * If the token has a hardware clock, this is the UTC #GDateTime
3319
+ * @field
3320
+ */
3321
+ utc_time: GLib.DateTime
3322
+
3323
+ // Owm methods of Gck-2.Gck.TokenInfo
3324
+
3325
+ /**
3326
+ * Make a copy of the token info.
3327
+ * @returns a newly allocated copy token info
3328
+ */
3329
+ copy(): TokenInfo
3330
+ /**
3331
+ * Free the GckTokenInfo and associated resources.
3332
+ */
3333
+ free(): void
3334
+ }
3335
+
3336
+ /**
3337
+ * Represents information about a PKCS#11 token.
3338
+ *
3339
+ * This is analogous to a `CK_TOKEN_INFO` structure, but the fields are far
3340
+ * more usable.
3341
+ *
3342
+ * When you're done with this structure it should be released with
3343
+ * gck_token_info_free().
3344
+ * @record
3345
+ */
3346
+ export class TokenInfo {
3347
+
3348
+ // Own properties of Gck-2.Gck.TokenInfo
3349
+
3350
+ static name: string
3351
+ }
3352
+
3353
+ export interface UriData {
3354
+
3355
+ // Own fields of Gck-2.Gck.UriData
3356
+
3357
+ /**
3358
+ * whether any parts of the PKCS#11 URI were unsupported or unrecognized.
3359
+ * @field
3360
+ */
3361
+ any_unrecognized: boolean
3362
+ /**
3363
+ * information about the PKCS#11 modules matching the URI.
3364
+ * @field
3365
+ */
3366
+ module_info: ModuleInfo
3367
+ /**
3368
+ * information about the PKCS#11 tokens matching the URI.
3369
+ * @field
3370
+ */
3371
+ token_info: TokenInfo
3372
+ /**
3373
+ * information about the PKCS#11 objects matching the URI.
3374
+ * @field
3375
+ */
3376
+ attributes: Attributes
3377
+
3378
+ // Owm methods of Gck-2.Gck.UriData
3379
+
3380
+ /**
3381
+ * Build a PKCS#11 URI. The various parts relevant to the flags
3382
+ * specified will be used to build the URI.
3383
+ * @param flags The context that the URI is for
3384
+ * @returns a newly allocated string containing a PKCS#11 URI.
3385
+ */
3386
+ build(flags: UriFlags): string | null
3387
+ /**
3388
+ * Copy a #GckUriData
3389
+ * @returns newly allocated copy of the uri data
3390
+ */
3391
+ copy(): UriData
3392
+ /**
3393
+ * Free a #GckUriData.
3394
+ */
3395
+ free(): void
3396
+ }
3397
+
3398
+ /**
3399
+ * Information about the contents of a PKCS#11 URI. Various fields may be %NULL
3400
+ * depending on the context that the URI was parsed for.
3401
+ *
3402
+ * Since PKCS#11 URIs represent a set which results from the intersections of
3403
+ * all of the URI parts, if `any_recognized` is set to %TRUE then usually the URI
3404
+ * should be treated as not matching anything.
3405
+ * @record
3406
+ */
3407
+ export class UriData {
3408
+
3409
+ // Own properties of Gck-2.Gck.UriData
3410
+
3411
+ static name: string
3412
+
3413
+ // Constructors of Gck-2.Gck.UriData
3414
+
3415
+ /**
3416
+ * Allocate a new GckUriData structure. None of the fields
3417
+ * will be set.
3418
+ * @constructor
3419
+ * @returns a newly allocated GckUriData, free with gck_uri_data_free()
3420
+ */
3421
+ constructor()
3422
+ /**
3423
+ * Allocate a new GckUriData structure. None of the fields
3424
+ * will be set.
3425
+ * @constructor
3426
+ * @returns a newly allocated GckUriData, free with gck_uri_data_free()
3427
+ */
3428
+ static new(): UriData
3429
+ /**
3430
+ * Parse a PKCS#11 URI for use in a given context.
3431
+ *
3432
+ * The result will contain the fields that are relevant for
3433
+ * the given context. See #GckUriData for more info.
3434
+ * Other fields will be set to %NULL.
3435
+ * @param string the URI to parse.
3436
+ * @param flags the context in which the URI will be used.
3437
+ * @returns a newly allocated #GckUriData; which should be freed with gck_uri_data_free()
3438
+ */
3439
+ static parse(string: string | null, flags: UriFlags): UriData
3440
+ }
3441
+
3442
+ /**
3443
+ * Name of the imported GIR library
3444
+ * @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
3445
+ */
3446
+ export const __name__: string
3447
+ /**
3448
+ * Version of the imported GIR library
3449
+ * @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
3450
+ */
3451
+ export const __version__: string
3452
+ // END