@girs/gck-2 4.0.0-3.1.0 → 4.0.4

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