/** * Type Definitions for Gjs (https://gjs.guide/) * * These type definitions are automatically generated, do not edit them by hand. * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir * * The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ... */ import '@girs/gjs'; // Module dependencies import type Gio from '@girs/gio-2.0'; import type GObject from '@girs/gobject-2.0'; import type GLib from '@girs/glib-2.0'; import type GModule from '@girs/gmodule-2.0'; import type Gck from '@girs/gck-2'; export namespace Gcr { /** * Gcr-4 */ /** * The status of a built certificate chain. Will be set to * {@link Gcr.CertificateChainStatus.UNKNOWN} for certificate chains that have not been * built. * @gir-type Enum */ enum CertificateChainStatus { /** * The certificate chain's status is unknown. * When a chain is not yet built it has this status. If a chain is modified after * being built, it has this status. */ UNKNOWN, /** * A full chain could not be loaded. The * chain does not end with a self-signed certificate, a trusted anchor, or a * pinned certificate. */ INCOMPLETE, /** * The certificate chain contains a revoked * or otherwise explicitly distrusted certificate. The entire chain should * be distrusted. */ DISTRUSTED, /** * The chain ends with a self-signed * certificate. No trust anchor was found. */ SELFSIGNED, /** * The chain represents a pinned certificate. A * pinned certificate is an exception which trusts a given certificate * explicitly for a purpose and communication with a certain peer. */ PINNED, /** * The chain ends with an anchored * certificate. The anchored certificate is not necessarily self-signed. */ ANCHORED, } /** * The format of a certificate request. Currently only PKCS#10 is supported. * @gir-type Enum */ enum CertificateRequestFormat { /** * certificate request is in PKCS#10 format */ CERTIFICATE_REQUEST_PKCS10, } /** * Values responding to error codes for parsing and serializing data. * @gir-type Enum */ enum DataError { /** * Failed to parse or serialize the data */ FAILURE, /** * The data was unrecognized or unsupported */ UNRECOGNIZED, /** * The operation was cancelled */ CANCELLED, /** * The data was encrypted or locked and could not be unlocked. */ LOCKED, } /** * The various format identifiers. * @gir-type Enum */ enum DataFormat { /** * Represents all the formats, when enabling or disabling */ ALL, /** * Not a valid format */ INVALID, /** * DER encoded private key */ DER_PRIVATE_KEY, /** * DER encoded RSA private key */ DER_PRIVATE_KEY_RSA, /** * DER encoded DSA private key */ DER_PRIVATE_KEY_DSA, /** * DER encoded EC private key */ DER_PRIVATE_KEY_EC, /** * DER encoded SubjectPublicKeyInfo */ DER_SUBJECT_PUBLIC_KEY, /** * DER encoded X.509 certificate */ DER_CERTIFICATE_X509, /** * DER encoded PKCS#7 container file which can contain certificates */ DER_PKCS7, /** * DER encoded PKCS#8 file which can contain a key */ DER_PKCS8, /** * Unencrypted DER encoded PKCS#8 file which can contain a key */ DER_PKCS8_PLAIN, /** * Encrypted DER encoded PKCS#8 file which can contain a key */ DER_PKCS8_ENCRYPTED, /** * DER encoded PKCS#10 certificate request file */ DER_PKCS10, /** * DER encoded SPKAC as generated by HTML5 keygen element */ DER_SPKAC, /** * OpenSSL style SPKAC data */ BASE64_SPKAC, /** * DER encoded PKCS#12 file which can contain certificates and/or keys */ DER_PKCS12, /** * OpenSSH v1 or v2 public key */ OPENSSH_PUBLIC, /** * OpenPGP key packet(s) */ OPENPGP_PACKET, /** * OpenPGP public or private key armor encoded data */ OPENPGP_ARMOR, /** * An OpenSSL style PEM file with unspecified contents */ PEM, /** * An OpenSSL style PEM file with a private RSA key */ PEM_PRIVATE_KEY_RSA, /** * An OpenSSL style PEM file with a private DSA key */ PEM_PRIVATE_KEY_DSA, /** * An OpenSSL style PEM file with an X.509 certificate */ PEM_CERTIFICATE_X509, /** * An OpenSSL style PEM file containing PKCS#7 */ PEM_PKCS7, /** * Unencrypted OpenSSL style PEM file containing PKCS#8 */ PEM_PKCS8_PLAIN, /** * Encrypted OpenSSL style PEM file containing PKCS#8 */ PEM_PKCS8_ENCRYPTED, /** * An OpenSSL style PEM file containing PKCS#12 */ PEM_PKCS12, /** * An OpenSSL style PEM file with a private key */ PEM_PRIVATE_KEY, /** * An OpenSSL style PEM file containing PKCS#10 */ PEM_PKCS10, /** * An OpenSSL style PEM file with a private EC key */ PEM_PRIVATE_KEY_EC, /** * An OpenSSL style PEM file containing a SubjectPublicKeyInfo */ PEM_PUBLIC_KEY, } /** * Various replies returned by {@link Prompt.confirm} and friends. * @gir-type Enum */ enum PromptReply { /** * the prompt was cancelled */ CANCEL, /** * the user replied with 'ok' */ CONTINUE, } /** * No error returned by the {@link Gcr.SystemPrompt} is suitable for display or * to the user. * * If the system prompter can only show one prompt at a time, and there is * already a prompt being displayed, and the timeout waiting to open the * prompt expires, then {@link Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS} is returned. * @gir-type Enum */ enum SystemPromptError { /** * another prompt is already in progress */ SYSTEM_PROMPT_IN_PROGRESS, } /** * The mode for the system prompter. Most system prompters can only show * one prompt at a time and would use the {@link Gcr.SystemPrompterMode.SINGLE} mode. * @gir-type Enum */ enum SystemPrompterMode { /** * only one prompt shown at a time */ SINGLE, /** * more than one prompt shown at a time */ MULTIPLE, } /** * The major version number of the Gcr library. */ const MAJOR_VERSION: number; /** * The micro version number of the Gcr library. */ const MICRO_VERSION: number; /** * The minor version number of the Gcr library. */ const MINOR_VERSION: number; /** * The purpose used to verify the client certificate in a TLS connection. */ const PURPOSE_CLIENT_AUTH: string; /** * The purpose used to verify certificate used for the signature on signed code. */ const PURPOSE_CODE_SIGNING: string; /** * The purpose used to verify certificates that are used in email communication * such as S/MIME. */ const PURPOSE_EMAIL: string; /** * The purpose used to verify the server certificate in a TLS connection. This * is the most common purpose in use. */ const PURPOSE_SERVER_AUTH: string; /** * The current secret exchange protocol. Key agreement is done using DH with the * 1536 bit IKE parameter group. Keys are derived using SHA256 with HKDF. The * transport encryption is done with 128 bit AES. */ const SECRET_EXCHANGE_PROTOCOL_1: string; const UNLOCK_OPTION_ALWAYS: string; const UNLOCK_OPTION_IDLE: string; const UNLOCK_OPTION_SESSION: string; const UNLOCK_OPTION_TIMEOUT: string; function data_error_get_domain(): GLib.Quark; /** * Create a key fingerprint for a certificate, public key or private key. * Note that this is not a fingerprint of certificate data, which you would * use `gcr_certificate_get_fingerprint()` for. * @param attrs attributes for key or certificate * @param checksum_type the type of fingerprint to create * @returns the fingerprint or `null` if the input was invalid. */ function fingerprint_from_attributes(attrs: Gck.Attributes, checksum_type: GLib.ChecksumType): Uint8Array | null; /** * Create a key fingerprint for a DER encoded subjectPublicKeyInfo. The * fingerprint is created so that it will be identical for a key and its * corresponding certificate. * * Note that in the case of certificates this is not a fingerprint of the * actual certificate data, but rather of the public key contained in a * certificate. * @param key_info DER encoded subjectPublicKeyInfo structure * @param checksum_type the type of fingerprint to create * @returns the fingerprint or `null` if the input was invalid. */ function fingerprint_from_subject_public_key_info(key_info: Uint8Array | string, checksum_type: GLib.ChecksumType): Uint8Array | null; /** * Create a set of importers which can import this parsed item. * * The parsed item is represented by the state of the {@link Gcr.Parser} at the * time of calling this method. * @param parsed a parser with a parsed item to import * @returns a list of importers which can import the parsed item, which should be freed with `g_object_unref()`, or `null` if no types of importers can be created */ function importer_create_for_parsed(parsed: Parsed): Importer[]; /** * Queues an additional item to be imported in all compattible importers * in the set. The parsed item is represented by the state of the {@link Gcr.Parser} * at the time of calling this method. * * If the parsed item is incompatible with an importer, then that the item * will not be queued on that importer. * @param importers a set of importers * @param parsed a parsed item * @returns a new set of importers that queued the item. */ function importer_queue_and_filter_for_parsed(importers: Importer[], parsed: Parsed): Importer[]; /** * Register an importer to handle parsed items that match the given attributes. * @param importer_type the GType of the importer being registered * @param attrs the attributes that this importer is compatible with */ function importer_register(importer_type: GObject.GType, attrs: Gck.Attributes): void; /** * Register built-in PKCS#11 and GnuPG importers. */ function importer_register_well_known(): void; /** * Disconnect the mock prompter */ function mock_prompter_disconnect(): void; /** * Queue an expected response on the mock prompter. * * Expects any prompt, and closes the prompt when it gets it. */ function mock_prompter_expect_close(): void; /** * Queue an expected response on the mock prompter. * * Expects a confirmation prompt, and then cancels that prompt. */ function mock_prompter_expect_confirm_cancel(): void; /** * Queue an expected response on the mock prompter. * * Expects a password prompt, and then cancels that prompt. */ function mock_prompter_expect_password_cancel(): void; /** * Get the delay in milliseconds before the mock prompter completes * an expected prompt. * @returns the delay */ function mock_prompter_get_delay_msec(): number; /** * Check if the mock prompter is expecting a response. This will be `true` * when one of the gcr_mock_prompter_expect_xxx() * functions have been used to queue an expected prompt, but that prompt * response has not be 'used' yet. * @returns whether expecting a prompt */ function mock_prompter_is_expecting(): boolean; /** * Check if the mock prompter is showing any prompts. * @returns whether prompting */ function mock_prompter_is_prompting(): boolean; /** * Set the delay in milliseconds before the mock prompter completes * an expected prompt. * @param delay_msec prompt response delay in milliseconds */ function mock_prompter_set_delay_msec(delay_msec: number): void; /** * Start the mock prompter. This is often used from the * setup() function of tests. * * Starts the mock prompter in an additional thread. Use the returned DBus bus * name with `gcr_system_prompt_open_for_prompter()` to connect to this prompter. * @returns the bus name that the mock prompter is listening on */ function mock_prompter_start(): string; /** * Stop the mock prompter. This is often used from the * teardown() function of tests. */ function mock_prompter_stop(): void; /** * Unreferences a parsed item which was referenced with `gcr_parsed_ref()` * @param parsed a parsed item */ function parsed_unref(parsed: null): void; /** * Add a {@link Gck.Module} to the list of PKCS#11 modules that are used by the * GCR library. * * It is not normally necessary to call this function. The available * PKCS#11 modules installed on the system are automatically loaded * by the GCR library. * @param module a {@link Gck.Module} */ function pkcs11_add_module(module: Gck.Module): void; /** * Initialize a PKCS#11 module and add it to the modules that are * used by the GCR library. Note that is an error to initialize the same * PKCS#11 module twice. * * It is not normally necessary to call this function. The available * PKCS#11 modules installed on the system are automatically loaded * by the GCR library. * @param module_path the full file path of the PKCS#11 module * @param unused unused * @returns whether the module was sucessfully added. */ function pkcs11_add_module_from_file(module_path: string, unused: null): boolean; /** * List all the PKCS#11 modules that are used by the GCR library. * Each module is a {@link Gck.Module} object. * * An empty list of modules will be returned if {@link pkcs11_set_modules}, * or {@link pkcs11_initialize} has not yet run. * @returns a newly allocated list of {@link Gck.Module} objects */ function pkcs11_get_modules(): Gck.Module[]; /** * List all the PKCS#11 slots that are used by the GCR library for lookup * of trust assertions. Each slot is a {@link Gck.Slot} object. * * This will return an empty list if the {@link pkcs11_initialize} function has * not yet been called. * @returns a list of {@link Gck.Slot} objects to use for lookup of trust, or the empty list if not initialized or no appropriate trust stores could be found. */ function pkcs11_get_trust_lookup_slots(): Gck.Slot[]; /** * Get the PKCS#11 URIs that are used to identify which slots to use for * lookup trust assertions. * @returns the uri which identifies trust storage slot */ function pkcs11_get_trust_lookup_uris(): string[] | null; /** * Selects an appropriate PKCS#11 slot to store trust assertions. The slot * to use is normally configured automatically by the system. * * This will only return a valid result after the {@link pkcs11_initialize} * method has been called. * * When done with the {@link Gck.Slot}, use `g_object_unref()` to release it. * @returns the {@link Gck.Slot} to use for trust assertions, or null if not initialized or no appropriate trust store could be found. */ function pkcs11_get_trust_store_slot(): Gck.Slot | null; /** * Get the PKCS#11 URI that is used to identify which slot to use for * storing trust storage. * @returns the uri which identifies trust storage slot */ function pkcs11_get_trust_store_uri(): string | null; /** * Asynchronously initialize the registered PKCS#11 modules. * @param cancellable optional cancellable used to cancel the operation * @returns whether the operation was successful or not. */ function pkcs11_initialize(cancellable: Gio.Cancellable | null): boolean; /** * Asynchronously initialize the registered PKCS#11 modules. * @param cancellable optional cancellable used to cancel the operation */ function pkcs11_initialize_async(cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Asynchronously initialize the registered PKCS#11 modules. * @param cancellable optional cancellable used to cancel the operation * @param callback callback which will be called when the operation completes */ function pkcs11_initialize_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Asynchronously initialize the registered PKCS#11 modules. * @param cancellable optional cancellable used to cancel the operation * @param callback callback which will be called when the operation completes */ function pkcs11_initialize_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Complete the asynchronous operation to initialize the registered PKCS#11 * modules. * @param result the asynchronous result * @returns whether the operation was successful or not. */ function pkcs11_initialize_finish(result: Gio.AsyncResult): boolean; /** * Set the list of PKCS#11 modules that are used by the GCR library. * Each module in the list is a {@link Gck.Module} object. * * It is not normally necessary to call this function. The available * PKCS#11 modules installed on the system are automatically loaded * by the GCR library. * @param modules a list of PKCS#11 modules */ function pkcs11_set_modules(modules: Gck.Module[]): void; /** * Set the PKCS#11 URIs that are used to identify which slots to use for * lookup of trust assertions. * * It is not normally necessary to call this function. The relevant * PKCS#11 slots are automatically configured by the GCR library. * @param pkcs11_uris the uris which identifies trust lookup slots */ function pkcs11_set_trust_lookup_uris(pkcs11_uris: string | null): void; /** * Set the PKCS#11 URI that is used to identify which slot to use for * storing trust assertions. * * It is not normally necessary to call this function. The relevant * PKCS#11 slot is automatically configured by the GCR library. * @param pkcs11_uri the uri which identifies trust storage slot */ function pkcs11_set_trust_store_uri(pkcs11_uri: string | null): void; /** * Add a pinned `certificate` for connections to `peer` for `purpose`. A pinned * certificate overrides all other certificate verification and should be * used with care. * * If the same pinned certificate already exists, then this operation * does not add another, and succeeds without error. * * This call may block, see {@link Gcr.trust_add_pinned_certificate_async} for * the non-blocking version. * @param certificate a {@link Gcr.Certificate} * @param purpose the purpose string * @param peer the peer for this pinned certificate * @param cancellable a {@link Gio.Cancellable} * @returns `true` if the pinned certificate is recorded successfully */ function trust_add_pinned_certificate(certificate: Certificate, purpose: string, peer: string, cancellable: Gio.Cancellable | null): boolean; /** * Add a pinned certificate for communication with `peer` for `purpose`. A pinned * certificate overrides all other certificate verification and should be used * with care. * * If the same pinned certificate already exists, then this operation * does not add another, and succeeds without error. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.trust_add_pinned_certificate_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} * @param purpose the purpose string * @param peer the peer for this pinned certificate * @param cancellable a {@link Gio.Cancellable} */ function trust_add_pinned_certificate_async(certificate: Certificate, purpose: string, peer: string, cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Add a pinned certificate for communication with `peer` for `purpose`. A pinned * certificate overrides all other certificate verification and should be used * with care. * * If the same pinned certificate already exists, then this operation * does not add another, and succeeds without error. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.trust_add_pinned_certificate_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} * @param purpose the purpose string * @param peer the peer for this pinned certificate * @param cancellable a {@link Gio.Cancellable} * @param callback a {@link Gio.AsyncReadyCallback} to call when the operation completes */ function trust_add_pinned_certificate_async(certificate: Certificate, purpose: string, peer: string, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Add a pinned certificate for communication with `peer` for `purpose`. A pinned * certificate overrides all other certificate verification and should be used * with care. * * If the same pinned certificate already exists, then this operation * does not add another, and succeeds without error. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.trust_add_pinned_certificate_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} * @param purpose the purpose string * @param peer the peer for this pinned certificate * @param cancellable a {@link Gio.Cancellable} * @param callback a {@link Gio.AsyncReadyCallback} to call when the operation completes */ function trust_add_pinned_certificate_async(certificate: Certificate, purpose: string, peer: string, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Finishes an asynchronous operation started by * {@link Gcr.trust_add_pinned_certificate_async}. * @param result the {@link Gio.AsyncResult} passed to the callback * @returns `true` if the pinned certificate is recorded successfully */ function trust_add_pinned_certificate_finish(result: Gio.AsyncResult): boolean; /** * Check if the `certificate` is a trust anchor for the given `purpose`. A trust * anchor is used to verify the signatures on other certificates when verifying * a certificate chain. Also known as a trusted certificate authority. * * This call may block, see {@link Gcr.trust_is_certificate_anchored_async} for * the non-blocking version. * * In the case of an error, `false` is also returned. Check `error` to detect * if an error occurred. * @param certificate a {@link Gcr.Certificate} to check * @param purpose the purpose string * @param cancellable a {@link Gio.Cancellable} * @returns `true` if the certificate is a trust anchor */ function trust_is_certificate_anchored(certificate: Certificate, purpose: string, cancellable: Gio.Cancellable | null): boolean; /** * Check if the `certificate` is a trust anchor for the given `purpose`. A trust * anchor is used to verify the signatures on other certificates when verifying * a certificate chain. Also known as a trusted certificate authority. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.trust_is_certificate_anchored_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} to check * @param purpose the purpose string * @param cancellable a {@link Gio.Cancellable} */ function trust_is_certificate_anchored_async(certificate: Certificate, purpose: string, cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Check if the `certificate` is a trust anchor for the given `purpose`. A trust * anchor is used to verify the signatures on other certificates when verifying * a certificate chain. Also known as a trusted certificate authority. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.trust_is_certificate_anchored_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} to check * @param purpose the purpose string * @param cancellable a {@link Gio.Cancellable} * @param callback a {@link Gio.AsyncReadyCallback} to call when the operation completes */ function trust_is_certificate_anchored_async(certificate: Certificate, purpose: string, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Check if the `certificate` is a trust anchor for the given `purpose`. A trust * anchor is used to verify the signatures on other certificates when verifying * a certificate chain. Also known as a trusted certificate authority. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.trust_is_certificate_anchored_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} to check * @param purpose the purpose string * @param cancellable a {@link Gio.Cancellable} * @param callback a {@link Gio.AsyncReadyCallback} to call when the operation completes */ function trust_is_certificate_anchored_async(certificate: Certificate, purpose: string, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Finishes an asynchronous operation started by * {@link Gcr.trust_is_certificate_anchored_async}. * * In the case of an error, `false` is also returned. Check `error` to detect * if an error occurred. * @param result the {@link Gio.AsyncResult} passed to the callback * @returns `true` if the certificate is a trust anchor */ function trust_is_certificate_anchored_finish(result: Gio.AsyncResult): boolean; /** * Checks whether the certificate that can be uniquely identified with the * given `serial_nr` and `issuer` is marked as distrusted (for example by the * user, or because it's part of a CRL). * * Since we can't directly use {@link Certificate} to fetch these values, you * need to call these with the raw serial number and issuer as provided by the * PKCS#11 fields `CKA_SERIAL_NR` and `CKA_ISSUER`. * @param serial_nr The serial number of the certificate * @param issuer The raw issuer * @param cancellable a {@link Gio.Cancellable} or `null` * @returns `true` if the certificate is marked as distrusted */ function trust_is_certificate_distrusted(serial_nr: Uint8Array | string, issuer: Uint8Array | string, cancellable: Gio.Cancellable | null): boolean; /** * Asynchronously checks whether the certificate that can be uniquely * identified with the given `serial_nr` and `issuer` is marked as distrusted * (for example by the user, or because it's part of a CRL). * * Since we can't directly use {@link Certificate} to fetch these values, you * need to call these with the raw serial number and issuer as provided by the * PKCS#11 fields `CKA_SERIAL_NR` and `CKA_ISSUER`. * * When the operation is finished, `callback` will be called. You can then call * {@link trust_is_certificate_distrusted_finish} to get the result of the * operation. * @param serial_nr The serial number of the certificate * @param issuer The raw issuer * @param cancellable a {@link Gio.Cancellable} or `null` */ function trust_is_certificate_distrusted_async(serial_nr: Uint8Array | string, issuer: Uint8Array | string, cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Asynchronously checks whether the certificate that can be uniquely * identified with the given `serial_nr` and `issuer` is marked as distrusted * (for example by the user, or because it's part of a CRL). * * Since we can't directly use {@link Certificate} to fetch these values, you * need to call these with the raw serial number and issuer as provided by the * PKCS#11 fields `CKA_SERIAL_NR` and `CKA_ISSUER`. * * When the operation is finished, `callback` will be called. You can then call * {@link trust_is_certificate_distrusted_finish} to get the result of the * operation. * @param serial_nr The serial number of the certificate * @param issuer The raw issuer * @param cancellable a {@link Gio.Cancellable} or `null` * @param callback a {@link Gio.AsyncReadyCallback} to call when the operation completes */ function trust_is_certificate_distrusted_async(serial_nr: Uint8Array | string, issuer: Uint8Array | string, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Asynchronously checks whether the certificate that can be uniquely * identified with the given `serial_nr` and `issuer` is marked as distrusted * (for example by the user, or because it's part of a CRL). * * Since we can't directly use {@link Certificate} to fetch these values, you * need to call these with the raw serial number and issuer as provided by the * PKCS#11 fields `CKA_SERIAL_NR` and `CKA_ISSUER`. * * When the operation is finished, `callback` will be called. You can then call * {@link trust_is_certificate_distrusted_finish} to get the result of the * operation. * @param serial_nr The serial number of the certificate * @param issuer The raw issuer * @param cancellable a {@link Gio.Cancellable} or `null` * @param callback a {@link Gio.AsyncReadyCallback} to call when the operation completes */ function trust_is_certificate_distrusted_async(serial_nr: Uint8Array | string, issuer: Uint8Array | string, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Finishes an asynchronous operation started by * {@link trust_is_certificate_distrusted_async}. * * In the case of an error, `false` is also returned. Check `error` to detect * if an error occurred. * @param result the {@link Gio.AsyncResult} passed to the callback * @returns `true` if the certificate is a trust anchor */ function trust_is_certificate_distrusted_finish(result: Gio.AsyncResult): boolean; /** * Check if `certificate` is pinned for `purpose` to communicate with `peer`. * A pinned certificate overrides all other certificate verification. * * This call may block, see {@link Gcr.trust_is_certificate_pinned_async} for * the non-blocking version. * * In the case of an error, `false` is also returned. Check `error` to detect * if an error occurred. * @param certificate a {@link Gcr.Certificate} to check * @param purpose the purpose string * @param peer the peer for this pinned * @param cancellable a {@link Gio.Cancellable} * @returns `true` if the certificate is pinned for the host and purpose */ function trust_is_certificate_pinned(certificate: Certificate, purpose: string, peer: string, cancellable: Gio.Cancellable | null): boolean; /** * Check if `certificate` is pinned for `purpose` to communicate with `peer`. A * pinned certificate overrides all other certificate verification. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.trust_is_certificate_pinned_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} to check * @param purpose the purpose string * @param peer the peer for this pinned * @param cancellable a {@link Gio.Cancellable} */ function trust_is_certificate_pinned_async(certificate: Certificate, purpose: string, peer: string, cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Check if `certificate` is pinned for `purpose` to communicate with `peer`. A * pinned certificate overrides all other certificate verification. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.trust_is_certificate_pinned_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} to check * @param purpose the purpose string * @param peer the peer for this pinned * @param cancellable a {@link Gio.Cancellable} * @param callback a {@link Gio.AsyncReadyCallback} to call when the operation completes */ function trust_is_certificate_pinned_async(certificate: Certificate, purpose: string, peer: string, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Check if `certificate` is pinned for `purpose` to communicate with `peer`. A * pinned certificate overrides all other certificate verification. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.trust_is_certificate_pinned_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} to check * @param purpose the purpose string * @param peer the peer for this pinned * @param cancellable a {@link Gio.Cancellable} * @param callback a {@link Gio.AsyncReadyCallback} to call when the operation completes */ function trust_is_certificate_pinned_async(certificate: Certificate, purpose: string, peer: string, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Finishes an asynchronous operation started by * {@link Gcr.trust_is_certificate_pinned_async}. * * In the case of an error, `false` is also returned. Check `error` to detect * if an error occurred. * @param result the {@link Gio.AsyncResult} passed to the callback * @returns `true` if the certificate is pinned. */ function trust_is_certificate_pinned_finish(result: Gio.AsyncResult): boolean; /** * Remove a pinned certificate for communication with `peer` for `purpose`. * * If the same pinned certificate does not exist, or was already removed, * then this operation succeeds without error. * * This call may block, see {@link Gcr.trust_remove_pinned_certificate_async} * for the non-blocking version. * @param certificate a {@link Gcr.Certificate} * @param purpose the purpose string * @param peer the peer for this pinned certificate * @param cancellable a {@link Gio.Cancellable} * @returns `true` if the pinned certificate no longer exists */ function trust_remove_pinned_certificate(certificate: Certificate, purpose: string, peer: string, cancellable: Gio.Cancellable | null): boolean; /** * Remove a pinned certificate for communication with `peer` for `purpose`. * * If the same pinned certificate does not exist, or was already removed, * then this operation succeeds without error. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.trust_remove_pinned_certificate_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} * @param purpose the purpose string * @param peer the peer for this pinned certificate * @param cancellable a {@link Gio.Cancellable} */ function trust_remove_pinned_certificate_async(certificate: Certificate, purpose: string, peer: string, cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Remove a pinned certificate for communication with `peer` for `purpose`. * * If the same pinned certificate does not exist, or was already removed, * then this operation succeeds without error. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.trust_remove_pinned_certificate_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} * @param purpose the purpose string * @param peer the peer for this pinned certificate * @param cancellable a {@link Gio.Cancellable} * @param callback a {@link Gio.AsyncReadyCallback} to call when the operation completes */ function trust_remove_pinned_certificate_async(certificate: Certificate, purpose: string, peer: string, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Remove a pinned certificate for communication with `peer` for `purpose`. * * If the same pinned certificate does not exist, or was already removed, * then this operation succeeds without error. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.trust_remove_pinned_certificate_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} * @param purpose the purpose string * @param peer the peer for this pinned certificate * @param cancellable a {@link Gio.Cancellable} * @param callback a {@link Gio.AsyncReadyCallback} to call when the operation completes */ function trust_remove_pinned_certificate_async(certificate: Certificate, purpose: string, peer: string, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Finishes an asynchronous operation started by * {@link Gcr.trust_remove_pinned_certificate_async}. * @param result the {@link Gio.AsyncResult} passed to the callback * @returns `true` if the pinned certificate no longer exists */ function trust_remove_pinned_certificate_finish(result: Gio.AsyncResult): boolean; /** * Flags to be used with the {@link Gcr.CertificateChain.build} operation. * @gir-type Flags */ enum CertificateChainFlags { /** * no flags */ NONE, /** * If this flag is specified then no * lookups for anchors or pinned certificates are done, and the resulting chain * will be neither anchored or pinned. Additionally no missing certificate * authorities are looked up in PKCS#11. */ NO_LOOKUPS, } /** * @gir-type Flags */ enum CertificateSectionFlags { NONE, IMPORTANT, } namespace AccessDescription { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures {} // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps {} } /** * Describes a location for fetching extra information from the Certificate Authority. * * This object is usually part of a * {@link Gcr.CertificateExtensionAuthorityInfoAccess} object. * @gir-type Class * @since 4.3.91 */ class AccessDescription extends GObject.Object { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: AccessDescription.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns the location, described by a {@link Gcr.GeneralName}. * @returns the location */ get_location(): GeneralName; /** * Returns a user-friendly name of the method for accesssing the resource, if * known. * @returns A method name */ get_method_name(): string; /** * Returns the OID string that describes the method for accessing the resource. * @returns The method OID */ get_method_oid(): string; } namespace CertificateChain { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures { "notify::length": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps { length: number; } } /** * Represents a chain of certificates, normally used to * validate the trust in a certificate. An X.509 certificate chain has one * endpoint certificate (the one for which trust is being verified) and then * in turn the certificate that issued each previous certificate in the chain. * * This functionality is for building of certificate chains not for validating * them. Use your favorite crypto library to validate trust in a certificate * chain once its built. * * The order of certificates in the chain should be first the endpoint * certificates and then the signing certificates. * * Create a new certificate chain with {@link CertificateChain.new} and then * add the certificates with {@link CertificateChain.add}. * * You can then use {@link CertificateChain.build} to build the remainder of * the chain. This will lookup missing certificates in PKCS#11 modules and * also check that each certificate in the chain is the signer of the previous * one. If a trust anchor, pinned certificate, or self-signed certificate is * found, then the chain is considered built. Any extra certificates are * removed from the chain. * * Once the certificate chain has been built, you can access its status * through {@link CertificateChain.get_status}. The status signifies whether * the chain is anchored on a trust root, self-signed, incomplete etc. See * {@link CertificateChainStatus} for information on the various statuses. * * It's important to understand that the building of a certificate chain is * merely the first step towards verifying trust in a certificate. * @gir-type Class */ class CertificateChain extends GObject.Object { static $gtype: GObject.GType; // Properties /** * The length of the certificate chain. * @read-only * @default 0 */ get length(): number; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateChain.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; static ["new"](): CertificateChain; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Add `certificate` to the chain. The order of certificates in the chain are * important. The first certificate should be the endpoint certificate, and * then come the signers (certificate authorities) each in turn. If a root * certificate authority is present, it should come last. * * Adding a certificate an already built chain (see * {@link Gcr.CertificateChain.build}) resets the type of the certificate chain * to {@link Gcr.CertificateChainStatus.UNKNOWN} * @param certificate a {@link Gcr.Certificate} to add to the chain */ add(certificate: Certificate): void; /** * Complete a certificate chain. Once a certificate chain has been built * its status can be examined. * * This operation will lookup missing certificates in PKCS#11 * modules and also that each certificate in the chain is the signer of the * previous one. If a trust anchor, pinned certificate, or self-signed certificate * is found, then the chain is considered built. Any extra certificates are * removed from the chain. * * It's important to understand that building of a certificate chain does not * constitute verifying that chain. This is merely the first step towards * trust verification. * * The `purpose` is a string like `GCR_PURPOSE_CLIENT_AUTH` and is the purpose * for which the certificate chain will be used. Trust anchors are looked up * for this purpose. This argument is required. * * The `peer` is usually the host name of the peer whith which this certificate * chain is being used. It is used to look up pinned certificates that have * been stored for this peer. If `null` then no pinned certificates will * be considered. * * If the {@link Gcr.CertificateChainFlags.NO_LOOKUPS} flag is specified then no * lookups for anchors or pinned certificates are done, and the resulting chain * will be neither anchored or pinned. Additionally no missing certificate * authorities are looked up in PKCS#11 * * This call will block, see {@link Gcr.CertificateChain.build_async} for the * asynchronous version. * @param purpose the purpose the certificate chain will be used for * @param peer the peer the certificate chain will be used with, or `null` * @param flags chain completion flags * @param cancellable a {@link Gio.Cancellable} or `null` * @returns whether the operation completed successfully */ build(purpose: string, peer: string | null, flags: CertificateChainFlags, cancellable: Gio.Cancellable | null): boolean; /** * Complete a certificate chain. Once a certificate chain has been built * its status can be examined. * * This will lookup missing certificates in PKCS#11 * modules and also that each certificate in the chain is the signer of the * previous one. If a trust anchor, pinned certificate, or self-signed certificate * is found, then the chain is considered built. Any extra certificates are * removed from the chain. * * It's important to understand that building of a certificate chain does not * constitute verifying that chain. This is merely the first step towards * trust verification. * * The `purpose` is a string like `GCR_PURPOSE_CLIENT_AUTH` and is the purpose * for which the certificate chain will be used. Trust anchors are looked up * for this purpose. This argument is required. * * The `peer` is usually the host name of the peer whith which this certificate * chain is being used. It is used to look up pinned certificates that have * been stored for this peer. If `null` then no pinned certificates will * be considered. * * If the {@link Gcr.CertificateChainFlags.NO_LOOKUPS} flag is specified then no * lookups for anchors or pinned certificates are done, and the resulting chain * will be neither anchored or pinned. Additionally no missing certificate * authorities are looked up in PKCS#11 * * When the operation is finished, `callback` will be called. You can then call * `gcr_certificate_chain_build_finish()` to get the result of the operation. * @param purpose the purpose the certificate chain will be used for * @param peer the peer the certificate chain will be used with, or `null` * @param flags chain completion flags * @param cancellable a {@link Gio.Cancellable} or `null` */ build_async(purpose: string, peer: string | null, flags: CertificateChainFlags, cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Complete a certificate chain. Once a certificate chain has been built * its status can be examined. * * This will lookup missing certificates in PKCS#11 * modules and also that each certificate in the chain is the signer of the * previous one. If a trust anchor, pinned certificate, or self-signed certificate * is found, then the chain is considered built. Any extra certificates are * removed from the chain. * * It's important to understand that building of a certificate chain does not * constitute verifying that chain. This is merely the first step towards * trust verification. * * The `purpose` is a string like `GCR_PURPOSE_CLIENT_AUTH` and is the purpose * for which the certificate chain will be used. Trust anchors are looked up * for this purpose. This argument is required. * * The `peer` is usually the host name of the peer whith which this certificate * chain is being used. It is used to look up pinned certificates that have * been stored for this peer. If `null` then no pinned certificates will * be considered. * * If the {@link Gcr.CertificateChainFlags.NO_LOOKUPS} flag is specified then no * lookups for anchors or pinned certificates are done, and the resulting chain * will be neither anchored or pinned. Additionally no missing certificate * authorities are looked up in PKCS#11 * * When the operation is finished, `callback` will be called. You can then call * `gcr_certificate_chain_build_finish()` to get the result of the operation. * @param purpose the purpose the certificate chain will be used for * @param peer the peer the certificate chain will be used with, or `null` * @param flags chain completion flags * @param cancellable a {@link Gio.Cancellable} or `null` * @param callback this will be called when the operation completes. */ build_async(purpose: string, peer: string | null, flags: CertificateChainFlags, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Complete a certificate chain. Once a certificate chain has been built * its status can be examined. * * This will lookup missing certificates in PKCS#11 * modules and also that each certificate in the chain is the signer of the * previous one. If a trust anchor, pinned certificate, or self-signed certificate * is found, then the chain is considered built. Any extra certificates are * removed from the chain. * * It's important to understand that building of a certificate chain does not * constitute verifying that chain. This is merely the first step towards * trust verification. * * The `purpose` is a string like `GCR_PURPOSE_CLIENT_AUTH` and is the purpose * for which the certificate chain will be used. Trust anchors are looked up * for this purpose. This argument is required. * * The `peer` is usually the host name of the peer whith which this certificate * chain is being used. It is used to look up pinned certificates that have * been stored for this peer. If `null` then no pinned certificates will * be considered. * * If the {@link Gcr.CertificateChainFlags.NO_LOOKUPS} flag is specified then no * lookups for anchors or pinned certificates are done, and the resulting chain * will be neither anchored or pinned. Additionally no missing certificate * authorities are looked up in PKCS#11 * * When the operation is finished, `callback` will be called. You can then call * `gcr_certificate_chain_build_finish()` to get the result of the operation. * @param purpose the purpose the certificate chain will be used for * @param peer the peer the certificate chain will be used with, or `null` * @param flags chain completion flags * @param cancellable a {@link Gio.Cancellable} or `null` * @param callback this will be called when the operation completes. */ build_async(purpose: string, peer: string | null, flags: CertificateChainFlags, cancellable: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Finishes an asynchronous operation started by * `gcr_certificate_chain_build_async()`. * @param result the {@link Gio.AsyncResult} passed to the callback * @returns whether the operation succeeded */ build_finish(result: Gio.AsyncResult): boolean; /** * If the certificate chain has been built and is of status * {@link Gcr.CertificateChainStatus.ANCHORED}, then this will return the anchor * certificate that was found. This is not necessarily a root certificate * authority. If an intermediate certificate authority in the chain was * found to be anchored, then that certificate will be returned. * * If an anchor is returned it does not mean that the certificate chain has * been verified, but merely that an anchor has been found. * @returns the anchor certificate, or `null` if not anchored. */ get_anchor(): Certificate; /** * Get a certificate in the chain. It is an error to call this function * with an invalid index. * @param index index of the certificate to get * @returns the certificate */ get_certificate(index: number): Certificate; /** * Get the endpoint certificate in the chain. This is always the first * certificate in the chain. The endpoint certificate cannot be anchored. * @returns the endpoint certificate, or `null` if the chain is empty */ get_endpoint(): Certificate; /** * Get the length of the certificate chain. * @returns the length of the certificate chain */ get_length(): number; /** * Get the status of a certificate chain. If the certificate chain has not * been built, then the status will be {@link Gcr.CertificateChainStatus.UNKNOWN}. * * A status of {@link Gcr.CertificateChainStatus.ANCHORED} does not mean that the * certificate chain has been verified, but merely that an anchor has been * found. * @returns the status of the certificate chain. */ get_status(): CertificateChainStatus; } namespace CertificateExtension { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures { "notify::critical": (pspec: GObject.ParamSpec) => void; "notify::oid": (pspec: GObject.ParamSpec) => void; "notify::value": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps { critical: boolean; oid: string; value: GLib.Bytes | Uint8Array; } } /** * An object that describes a certificate extension. * * By default, a certificate extension exposes 3 things: an OID, * whether it's marked as critical, and the raw value. * * For known extensions, gcr tries to provide subclasses with the appropriate * API. * * See also {@link Certificate.list_extensions}. * @gir-type Class * @since 4.3.90 */ class CertificateExtension extends GObject.Object { static $gtype: GObject.GType; // Properties /** * Whether this certificate is critical. * @construct-only * @default false */ get critical(): boolean; /** * The Object Identifier (OID) that identifies the extension. * @read-only * @default null */ get oid(): string; /** * The raw value in bytes of the extension. * @construct-only */ get value(): GLib.Bytes; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateExtension.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns a user-displayable description of the OID that identifies the * extension, if known. * @returns A user-facing description, or `null` if unknown */ get_description(): string | null; /** * Returns the OID that identifies the extension */ get_oid(): string; /** * Returns the raw value in bytes of the extension. * @returns The raw value date */ get_value(): GLib.Bytes; /** * Returns wether the certificate extension is marked critical. * @returns `true` if the extension is marked critical */ is_critical(): boolean; } namespace CertificateExtensionAuthorityInfoAccess { // Signal signatures interface SignalSignatures extends CertificateExtension.SignalSignatures { "notify::n-items": (pspec: GObject.ParamSpec) => void; "notify::critical": (pspec: GObject.ParamSpec) => void; "notify::oid": (pspec: GObject.ParamSpec) => void; "notify::value": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends CertificateExtension.ConstructorProps, Gio.ListModel.ConstructorProps { n_items: number; nItems: number; } } /** * A certificate extension describing the Authority Information Access (AIA). * * This extensions specifies a list of resources of a certificate's issuer that * one may use to retrieve extra information, such as missing intermediate * certificates in a certificate chain, or to determine certifiate revocation * status. * * Each access point is exposed as a {@link Gcr.AccessDescription} object. * @gir-type Class * @since 4.3.91 */ class CertificateExtensionAuthorityInfoAccess extends CertificateExtension implements Gio.ListModel { static $gtype: GObject.GType; // Properties /** * The number of items. See {@link Gio.ListModel.get_n_items}. * @read-only * @default 0 */ get n_items(): number; /** * The number of items. See {@link Gio.ListModel.get_n_items}. * @read-only * @default 0 */ get nItems(): number; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateExtensionAuthorityInfoAccess.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns the description at a given position * @param position * @returns The description at position `position` */ get_description(position: number): AccessDescription; /** * @param args */ // Conflicted with Gcr.CertificateExtension.get_description get_description(...args: never[]): any; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @returns the {@link GObject.GType} of the items contained in `list`. */ get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @returns the number of items in `list`. */ get_n_items(): number; /** * Get the item at `position`. * * If `position` is greater than the number of items in `list`, `null` is * returned. * * `null` is never returned for an index that is smaller than the length * of the list. * * This function is meant to be used by language bindings in place * of `g_list_model_get_item()`. * * See also: `g_list_model_get_n_items()` * @param position the position of the item to fetch * @returns the object at `position`. */ get_item(position: number): A | null; /** * Emits the {@link Gio.ListModel.SignalSignatures.items_changed | Gio.ListModel::items-changed} signal on `list`. * * This function should only be called by classes implementing * {@link Gio.ListModel}. It has to be called after the internal representation * of `list` has been updated, because handlers connected to this signal * might query the new state of the list. * * Implementations must only make changes to the model (as visible to * its consumer) in places that will not cause problems for that * consumer. For models that are driven directly by a write API (such * as {@link Gio.ListStore}), changes can be reported in response to uses of that * API. For models that represent remote data, changes should only be * made from a fresh mainloop dispatch. It is particularly not * permitted to make changes in response to a call to the {@link Gio.ListModel} * consumer API. * * Stated another way: in general, it is assumed that code making a * series of accesses to the model via the API, without returning to the * mainloop, and without calling other code, will continue to view the * same contents of the model. * @param position the position at which `list` changed * @param removed the number of items removed * @param added the number of items added */ items_changed(position: number, removed: number, added: number): void; /** * Get the item at `position`. If `position` is greater than the number of * items in `list`, `null` is returned. * * `null` is never returned for an index that is smaller than the length * of the list. See `g_list_model_get_n_items()`. * * The same {@link GObject.Object} instance may not appear more than once in a {@link Gio.ListModel}. * @param position the position of the item to fetch * @virtual */ vfunc_get_item(position: number): A | null; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @virtual */ vfunc_get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @virtual */ vfunc_get_n_items(): number; } namespace CertificateExtensionAuthorityKeyIdentifier { // Signal signatures interface SignalSignatures extends CertificateExtension.SignalSignatures { "notify::critical": (pspec: GObject.ParamSpec) => void; "notify::oid": (pspec: GObject.ParamSpec) => void; "notify::value": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends CertificateExtension.ConstructorProps {} } /** * A certificate extension that contains the authority key identifier (SKI). * * This extension may expose the authority key identifier directly, which * should match the subject key identifier of the parent certificate. * * It _may_ also expose a combination of issuer name and serial number of the * used certificate instead. This is rare however. * @gir-type Class * @since 4.3.91 */ class CertificateExtensionAuthorityKeyIdentifier extends CertificateExtension { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateExtensionAuthorityKeyIdentifier.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns the issuer, described by a list of {@link Gcr.GeneralName}s. * @returns The names of issuer, if set */ get_authority_cert_issuer(): GeneralNames | null; /** * Returns the serial number of the certificate that was used to sign this * certificate. * @returns The serial number, if set */ get_authority_cert_serial_number(): GLib.Bytes | null; /** * Returns the raw bytes containing the authority key identifier, if present. * @returns The authority key identifier if present. */ get_key_id(): GLib.Bytes | null; } namespace CertificateExtensionBasicConstraints { // Signal signatures interface SignalSignatures extends CertificateExtension.SignalSignatures { "notify::critical": (pspec: GObject.ParamSpec) => void; "notify::oid": (pspec: GObject.ParamSpec) => void; "notify::value": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends CertificateExtension.ConstructorProps {} } /** * A certificate extension that can be used to identify the type of the * certificate subject (whether it is a certificate authority or not). * @gir-type Class * @since 4.3.90 */ class CertificateExtensionBasicConstraints extends CertificateExtension { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateExtensionBasicConstraints.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns the maximum number of CAs that are allowed in the chain below this * certificate. * * If this is not set, this method returns -1. * * Note that this field doesn't really make sense if * {@link Gcr.CertificateExtensionBasicConstraints.is_ca} is false. * @returns The value of "pathLenConstraint", or -1 if not set. */ get_path_len_constraint(): number; /** * Returns whether the certificate us a certificate authority (CA) certificate * or an end entity certificate. * @returns The value of "cA". */ is_ca(): boolean; } namespace CertificateExtensionCertificatePolicies { // Signal signatures interface SignalSignatures extends CertificateExtension.SignalSignatures { "notify::n-items": (pspec: GObject.ParamSpec) => void; "notify::critical": (pspec: GObject.ParamSpec) => void; "notify::oid": (pspec: GObject.ParamSpec) => void; "notify::value": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends CertificateExtension.ConstructorProps, Gio.ListModel.ConstructorProps { n_items: number; nItems: number; } } /** * A certificate extension that lists certificate policies. * * Each certificate policy is exposed as a {@link Gcr.CertificatePolicy} * object. * @gir-type Class * @since 4.3.91 */ class CertificateExtensionCertificatePolicies extends CertificateExtension implements Gio.ListModel { static $gtype: GObject.GType; // Properties /** * The number of items. See {@link Gio.ListModel.get_n_items}. * @read-only * @default 0 */ get n_items(): number; /** * The number of items. See {@link Gio.ListModel.get_n_items}. * @read-only * @default 0 */ get nItems(): number; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateExtensionCertificatePolicies.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns the policy at a given position * @param position * @returns The policy at position `position` */ get_policy(position: number): CertificatePolicy; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @returns the {@link GObject.GType} of the items contained in `list`. */ get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @returns the number of items in `list`. */ get_n_items(): number; /** * Get the item at `position`. * * If `position` is greater than the number of items in `list`, `null` is * returned. * * `null` is never returned for an index that is smaller than the length * of the list. * * This function is meant to be used by language bindings in place * of `g_list_model_get_item()`. * * See also: `g_list_model_get_n_items()` * @param position the position of the item to fetch * @returns the object at `position`. */ get_item(position: number): A | null; /** * Emits the {@link Gio.ListModel.SignalSignatures.items_changed | Gio.ListModel::items-changed} signal on `list`. * * This function should only be called by classes implementing * {@link Gio.ListModel}. It has to be called after the internal representation * of `list` has been updated, because handlers connected to this signal * might query the new state of the list. * * Implementations must only make changes to the model (as visible to * its consumer) in places that will not cause problems for that * consumer. For models that are driven directly by a write API (such * as {@link Gio.ListStore}), changes can be reported in response to uses of that * API. For models that represent remote data, changes should only be * made from a fresh mainloop dispatch. It is particularly not * permitted to make changes in response to a call to the {@link Gio.ListModel} * consumer API. * * Stated another way: in general, it is assumed that code making a * series of accesses to the model via the API, without returning to the * mainloop, and without calling other code, will continue to view the * same contents of the model. * @param position the position at which `list` changed * @param removed the number of items removed * @param added the number of items added */ items_changed(position: number, removed: number, added: number): void; /** * Get the item at `position`. If `position` is greater than the number of * items in `list`, `null` is returned. * * `null` is never returned for an index that is smaller than the length * of the list. See `g_list_model_get_n_items()`. * * The same {@link GObject.Object} instance may not appear more than once in a {@link Gio.ListModel}. * @param position the position of the item to fetch * @virtual */ vfunc_get_item(position: number): A | null; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @virtual */ vfunc_get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @virtual */ vfunc_get_n_items(): number; } namespace CertificateExtensionCrlDistributionPoints { // Signal signatures interface SignalSignatures extends CertificateExtension.SignalSignatures { "notify::n-items": (pspec: GObject.ParamSpec) => void; "notify::critical": (pspec: GObject.ParamSpec) => void; "notify::oid": (pspec: GObject.ParamSpec) => void; "notify::value": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends CertificateExtension.ConstructorProps, Gio.ListModel.ConstructorProps { n_items: number; nItems: number; } } /** * A certificate extension that lists CRL distribution points. * * Each distribution point is exposed as a {@link Gcr.DistributionPoint} * object. * @gir-type Class * @since 4.3.91 */ class CertificateExtensionCrlDistributionPoints extends CertificateExtension implements Gio.ListModel { static $gtype: GObject.GType; // Properties /** * The number of items. See {@link Gio.ListModel.get_n_items}. * @read-only * @default 0 */ get n_items(): number; /** * The number of items. See {@link Gio.ListModel.get_n_items}. * @read-only * @default 0 */ get nItems(): number; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateExtensionCrlDistributionPoints.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns the CRL distribution point at a given position. * * It is illegal to call this on an invalid position. * @param position * @returns The distribution point at position `position` */ get_distribution_point(position: number): DistributionPoint; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @returns the {@link GObject.GType} of the items contained in `list`. */ get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @returns the number of items in `list`. */ get_n_items(): number; /** * Get the item at `position`. * * If `position` is greater than the number of items in `list`, `null` is * returned. * * `null` is never returned for an index that is smaller than the length * of the list. * * This function is meant to be used by language bindings in place * of `g_list_model_get_item()`. * * See also: `g_list_model_get_n_items()` * @param position the position of the item to fetch * @returns the object at `position`. */ get_item(position: number): A | null; /** * Emits the {@link Gio.ListModel.SignalSignatures.items_changed | Gio.ListModel::items-changed} signal on `list`. * * This function should only be called by classes implementing * {@link Gio.ListModel}. It has to be called after the internal representation * of `list` has been updated, because handlers connected to this signal * might query the new state of the list. * * Implementations must only make changes to the model (as visible to * its consumer) in places that will not cause problems for that * consumer. For models that are driven directly by a write API (such * as {@link Gio.ListStore}), changes can be reported in response to uses of that * API. For models that represent remote data, changes should only be * made from a fresh mainloop dispatch. It is particularly not * permitted to make changes in response to a call to the {@link Gio.ListModel} * consumer API. * * Stated another way: in general, it is assumed that code making a * series of accesses to the model via the API, without returning to the * mainloop, and without calling other code, will continue to view the * same contents of the model. * @param position the position at which `list` changed * @param removed the number of items removed * @param added the number of items added */ items_changed(position: number, removed: number, added: number): void; /** * Get the item at `position`. If `position` is greater than the number of * items in `list`, `null` is returned. * * `null` is never returned for an index that is smaller than the length * of the list. See `g_list_model_get_n_items()`. * * The same {@link GObject.Object} instance may not appear more than once in a {@link Gio.ListModel}. * @param position the position of the item to fetch * @virtual */ vfunc_get_item(position: number): A | null; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @virtual */ vfunc_get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @virtual */ vfunc_get_n_items(): number; } namespace CertificateExtensionExtendedKeyUsage { // Signal signatures interface SignalSignatures extends CertificateExtension.SignalSignatures { "notify::critical": (pspec: GObject.ParamSpec) => void; "notify::oid": (pspec: GObject.ParamSpec) => void; "notify::value": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends CertificateExtension.ConstructorProps {} } /** * A certificate extension that can be used to restrict an extended set of * usages of a given certificate. * * Similar to {@link Gcr.CertificateExtensionKeyUsage}, this extension defined * an additional set of purposes for which this certificate may be used. * @gir-type Class * @since 4.3.90 */ class CertificateExtensionExtendedKeyUsage extends CertificateExtension { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateExtensionExtendedKeyUsage.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns a user-friendly list of description of the key usages. * @returns The descriptions. */ get_descriptions(): string[]; /** * Returns the list of OIDs of the extended key usages. * @returns The OIDs. */ get_oids(): string[]; } namespace CertificateExtensionKeyUsage { // Signal signatures interface SignalSignatures extends CertificateExtension.SignalSignatures { "notify::critical": (pspec: GObject.ParamSpec) => void; "notify::oid": (pspec: GObject.ParamSpec) => void; "notify::value": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends CertificateExtension.ConstructorProps {} } /** * A certificate extension that can be used to restrict the usages of a given * certificate. * * See also {@link Gcr.CertificateExtensionExtendedKeyUsage} for an additional * set of usages. * @gir-type Class * @since 4.3.90 */ class CertificateExtensionKeyUsage extends CertificateExtension { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateExtensionKeyUsage.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns a user-friendly list of description of the key usages. * @returns The descriptions. */ get_descriptions(): string[]; /** * Returns the bit string describing the usages. */ get_usages(): number; } namespace CertificateExtensionList { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures { "notify::n-items": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps, Gio.ListModel.ConstructorProps { n_items: number; nItems: number; } } /** * A wrapper type for a list of {@link CertificateExtension}s. * @gir-type Class * @since 4.3.90 */ class CertificateExtensionList extends GObject.Object implements Gio.ListModel { static $gtype: GObject.GType; // Properties /** * @read-only * @default 0 */ get n_items(): number; /** * @read-only * @default 0 */ get nItems(): number; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateExtensionList.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Looks for an extension with the given OID. * @param oid The OID of the certificate extension * @returns The certificate extension with the given OID, or `null` if not found. */ find_by_oid(oid: string): CertificateExtension | null; /** * Returns the extension at the given position. * * It is illegal to call this function with an invalid position. * @param position The position of the extension in the list * @returns The certificate extension with the given OID */ get_extension(position: number): CertificateExtension; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @returns the {@link GObject.GType} of the items contained in `list`. */ get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @returns the number of items in `list`. */ get_n_items(): number; /** * Get the item at `position`. * * If `position` is greater than the number of items in `list`, `null` is * returned. * * `null` is never returned for an index that is smaller than the length * of the list. * * This function is meant to be used by language bindings in place * of `g_list_model_get_item()`. * * See also: `g_list_model_get_n_items()` * @param position the position of the item to fetch * @returns the object at `position`. */ get_item(position: number): A | null; /** * Emits the {@link Gio.ListModel.SignalSignatures.items_changed | Gio.ListModel::items-changed} signal on `list`. * * This function should only be called by classes implementing * {@link Gio.ListModel}. It has to be called after the internal representation * of `list` has been updated, because handlers connected to this signal * might query the new state of the list. * * Implementations must only make changes to the model (as visible to * its consumer) in places that will not cause problems for that * consumer. For models that are driven directly by a write API (such * as {@link Gio.ListStore}), changes can be reported in response to uses of that * API. For models that represent remote data, changes should only be * made from a fresh mainloop dispatch. It is particularly not * permitted to make changes in response to a call to the {@link Gio.ListModel} * consumer API. * * Stated another way: in general, it is assumed that code making a * series of accesses to the model via the API, without returning to the * mainloop, and without calling other code, will continue to view the * same contents of the model. * @param position the position at which `list` changed * @param removed the number of items removed * @param added the number of items added */ items_changed(position: number, removed: number, added: number): void; /** * Get the item at `position`. If `position` is greater than the number of * items in `list`, `null` is returned. * * `null` is never returned for an index that is smaller than the length * of the list. See `g_list_model_get_n_items()`. * * The same {@link GObject.Object} instance may not appear more than once in a {@link Gio.ListModel}. * @param position the position of the item to fetch * @virtual */ vfunc_get_item(position: number): A | null; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @virtual */ vfunc_get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @virtual */ vfunc_get_n_items(): number; } namespace CertificateExtensionSubjectAltName { // Signal signatures interface SignalSignatures extends CertificateExtension.SignalSignatures { "notify::critical": (pspec: GObject.ParamSpec) => void; "notify::oid": (pspec: GObject.ParamSpec) => void; "notify::value": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends CertificateExtension.ConstructorProps, Gio.ListModel.ConstructorProps {} } /** * A certificate extension describing the Subject Alternative Name (SAN). * * This kind of extension is used for example to specify multiple domains for * the same certificate. * * The object exposes the different names with the {@link Gio.ListModel} API. * @gir-type Class * @since 4.3.90 */ class CertificateExtensionSubjectAltName extends CertificateExtension implements Gio.ListModel { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateExtensionSubjectAltName.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns the name at the given position. * @param position The position of the name * @returns The name at position `position` */ get_name(position: number): GeneralName; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @returns the {@link GObject.GType} of the items contained in `list`. */ get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @returns the number of items in `list`. */ get_n_items(): number; /** * Get the item at `position`. * * If `position` is greater than the number of items in `list`, `null` is * returned. * * `null` is never returned for an index that is smaller than the length * of the list. * * This function is meant to be used by language bindings in place * of `g_list_model_get_item()`. * * See also: `g_list_model_get_n_items()` * @param position the position of the item to fetch * @returns the object at `position`. */ get_item(position: number): A | null; /** * Emits the {@link Gio.ListModel.SignalSignatures.items_changed | Gio.ListModel::items-changed} signal on `list`. * * This function should only be called by classes implementing * {@link Gio.ListModel}. It has to be called after the internal representation * of `list` has been updated, because handlers connected to this signal * might query the new state of the list. * * Implementations must only make changes to the model (as visible to * its consumer) in places that will not cause problems for that * consumer. For models that are driven directly by a write API (such * as {@link Gio.ListStore}), changes can be reported in response to uses of that * API. For models that represent remote data, changes should only be * made from a fresh mainloop dispatch. It is particularly not * permitted to make changes in response to a call to the {@link Gio.ListModel} * consumer API. * * Stated another way: in general, it is assumed that code making a * series of accesses to the model via the API, without returning to the * mainloop, and without calling other code, will continue to view the * same contents of the model. * @param position the position at which `list` changed * @param removed the number of items removed * @param added the number of items added */ items_changed(position: number, removed: number, added: number): void; /** * Get the item at `position`. If `position` is greater than the number of * items in `list`, `null` is returned. * * `null` is never returned for an index that is smaller than the length * of the list. See `g_list_model_get_n_items()`. * * The same {@link GObject.Object} instance may not appear more than once in a {@link Gio.ListModel}. * @param position the position of the item to fetch * @virtual */ vfunc_get_item(position: number): A | null; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @virtual */ vfunc_get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @virtual */ vfunc_get_n_items(): number; } namespace CertificateExtensionSubjectKeyIdentifier { // Signal signatures interface SignalSignatures extends CertificateExtension.SignalSignatures { "notify::critical": (pspec: GObject.ParamSpec) => void; "notify::oid": (pspec: GObject.ParamSpec) => void; "notify::value": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends CertificateExtension.ConstructorProps {} } /** * A certificate extension that contains the subject key identifier (SKI). * @gir-type Class * @since 4.3.90 */ class CertificateExtensionSubjectKeyIdentifier extends CertificateExtension { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateExtensionSubjectKeyIdentifier.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns the raw bytes containing the subject key identifier. * @returns The subject key identifier. */ get_key_id(): GLib.Bytes; } namespace CertificateField { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures { "notify::label": (pspec: GObject.ParamSpec) => void; "notify::section": (pspec: GObject.ParamSpec) => void; "notify::value": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps { label: string; section: CertificateSection; value: GObject.Value | any; } } /** * @gir-type Class */ class CertificateField extends GObject.Object { static $gtype: GObject.GType; // Properties /** * @construct-only * @default null */ get label(): string; /** * @construct-only */ get section(): CertificateSection; /** * @read-only */ get value(): unknown; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateField.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Get the display label of the field. * @returns the display label of the field */ get_label(): string; /** * Get the parent {@link Gcr.CertificateSection}. * @returns the parent {@link Gcr.CertificateSection} */ get_section(): CertificateSection; /** * Get the value of the field. * * The `value` will have been initialized to the {@link GObject.GType} the value should be * provided in. * @returns `true` if the value was set successfully. */ get_value(): [boolean, unknown]; /** * Get the type associated with the value. * @returns The {@link GObject.GType} of the value */ get_value_type(): GObject.GType; } namespace CertificatePolicy { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures {} // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps, Gio.ListModel.ConstructorProps {} } /** * An object describing a certificate policy. * * These policies are listed as part of a * {@link Gcr.CertificateExtensionCertificatePolicies} object. * * A policy can optionally also include qualifiers, which are exposed through * the {@link Gio.ListModel} API. * @gir-type Class * @since 4.3.91 */ class CertificatePolicy extends GObject.Object implements Gio.ListModel { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificatePolicy.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns a user-friendly name of this certificate policy, if known. * @returns A name describing the policy OID */ get_name(): string; /** * Returns the OID string that describes this certificate policy. * @returns The policy OID */ get_oid(): string; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @returns the {@link GObject.GType} of the items contained in `list`. */ get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @returns the number of items in `list`. */ get_n_items(): number; /** * Get the item at `position`. * * If `position` is greater than the number of items in `list`, `null` is * returned. * * `null` is never returned for an index that is smaller than the length * of the list. * * This function is meant to be used by language bindings in place * of `g_list_model_get_item()`. * * See also: `g_list_model_get_n_items()` * @param position the position of the item to fetch * @returns the object at `position`. */ get_item(position: number): A | null; /** * Emits the {@link Gio.ListModel.SignalSignatures.items_changed | Gio.ListModel::items-changed} signal on `list`. * * This function should only be called by classes implementing * {@link Gio.ListModel}. It has to be called after the internal representation * of `list` has been updated, because handlers connected to this signal * might query the new state of the list. * * Implementations must only make changes to the model (as visible to * its consumer) in places that will not cause problems for that * consumer. For models that are driven directly by a write API (such * as {@link Gio.ListStore}), changes can be reported in response to uses of that * API. For models that represent remote data, changes should only be * made from a fresh mainloop dispatch. It is particularly not * permitted to make changes in response to a call to the {@link Gio.ListModel} * consumer API. * * Stated another way: in general, it is assumed that code making a * series of accesses to the model via the API, without returning to the * mainloop, and without calling other code, will continue to view the * same contents of the model. * @param position the position at which `list` changed * @param removed the number of items removed * @param added the number of items added */ items_changed(position: number, removed: number, added: number): void; /** * Get the item at `position`. If `position` is greater than the number of * items in `list`, `null` is returned. * * `null` is never returned for an index that is smaller than the length * of the list. See `g_list_model_get_n_items()`. * * The same {@link GObject.Object} instance may not appear more than once in a {@link Gio.ListModel}. * @param position the position of the item to fetch * @virtual */ vfunc_get_item(position: number): A | null; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @virtual */ vfunc_get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @virtual */ vfunc_get_n_items(): number; } namespace CertificatePolicyQualifier { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures {} // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps {} } /** * An object describing a certificate policy qualifier. * * These policies are (optionally) part of a {@link Gcr.CertificatePolicy} * object. * @gir-type Class * @since 4.3.91 */ class CertificatePolicyQualifier extends GObject.Object { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificatePolicyQualifier.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns a user-friendly name of this certificate policy qualifier, if known. * @returns A name describing the policy qualifier OID */ get_name(): string; /** * Returns the OID string that describes this certificate policy qualifier. * @returns The policy qualifier OID */ get_oid(): string; } namespace CertificateRequest { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures { "notify::private-key": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps { private_key: Gck.Object; privateKey: Gck.Object; } } /** * An object that allows creation of certificate requests. A certificate * request is sent to a certificate authority to request an X.509 certificate. * * Use {@link CertificateRequest.prepare} to create a blank certificate * request for a given private key. Set the common name on the certificate * request with {@link CertificateRequest.set_cn}, and then sign the request * with {@link CertificateRequest.complete_async}. * @gir-type Class */ class CertificateRequest extends GObject.Object { static $gtype: GObject.GType; // Properties /** * The private key that this certificate request is for. * @construct-only */ get private_key(): Gck.Object; /** * The private key that this certificate request is for. * @construct-only */ get privateKey(): Gck.Object; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateRequest.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Static methods /** * Check whether {@link CertificateRequest} is capable of creating a request * for the given `private_key`. * @param private_key a private key * @param cancellable cancellation object */ static capable(private_key: Gck.Object, cancellable: Gio.Cancellable | null): boolean; /** * Asynchronously check whether {@link CertificateRequest} is capable of * creating a request for the given `private_key`. * @param private_key a private key * @param cancellable cancellation object * @param callback will be called when the operation completes */ static capable_async(private_key: Gck.Object, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Get the result for asynchronously check whether {@link CertificateRequest} is * capable of creating a request for the given `private_key`. * @param result asynchronous result */ static capable_finish(result: Gio.AsyncResult): boolean; /** * Create a new certificate request, in the given format for the private key. * @param format the format for the certificate request * @param private_key the private key the the certificate is being requested for */ static prepare(format: CertificateRequestFormat, private_key: Gck.Object): CertificateRequest; // Methods /** * Complete and sign a certificate request, so that it can be encoded * and sent to a certificate authority. * * This call may block as it signs the request using the private key. * @param cancellable a cancellation object * @returns whether certificate request was successfully completed or not */ complete(cancellable: Gio.Cancellable | null): boolean; /** * Asynchronously complete and sign a certificate request, so that it can * be encoded and sent to a certificate authority. * * This call will return immediately and complete later. * @param cancellable a cancellation object */ complete_async(cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Asynchronously complete and sign a certificate request, so that it can * be encoded and sent to a certificate authority. * * This call will return immediately and complete later. * @param cancellable a cancellation object * @param callback called when the operation completes */ complete_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Asynchronously complete and sign a certificate request, so that it can * be encoded and sent to a certificate authority. * * This call will return immediately and complete later. * @param cancellable a cancellation object * @param callback called when the operation completes */ complete_async(cancellable: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Finish an asynchronous operation to complete and sign a certificate * request. * @param result result of the asynchronous operation * @returns whether certificate request was successfully completed or not */ complete_finish(result: Gio.AsyncResult): boolean; /** * Encode the certificate request. It must have been completed with * {@link CertificateRequest.complete} or * {@link CertificateRequest.complete_async}. * * If `textual` is `false`, the output is a DER encoded certificate request. * * If `textual` is `true`, the output is encoded as text. For PKCS#10 requests * this is done using the OpenSSL style PEM encoding. * @param textual whether to encode output as text * @returns the encoded certificate request */ encode(textual: boolean): Uint8Array; /** * Get the format of this certificate request. * @returns the format */ get_format(): CertificateRequestFormat; /** * Get the private key this certificate request is for. * @returns the private key, */ get_private_key(): Gck.Object; /** * Set the common name encoded in the certificate request. * @param cn common name to set on the request */ set_cn(cn: string): void; } namespace CertificateSection { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures { "notify::fields": (pspec: GObject.ParamSpec) => void; "notify::label": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps { fields: Gio.ListModel; label: string; } } /** * @gir-type Class */ class CertificateSection extends GObject.Object { static $gtype: GObject.GType; // Properties /** * @read-only */ get fields(): Gio.ListModel; /** * @construct-only * @default null */ get label(): string; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: CertificateSection.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Get the list of all the fields in this section. * @returns a {@link Gio.ListModel} of {@link Gcr.CertificateField} */ get_fields(): Gio.ListModel; /** * Get the flags. * @returns the {@link Gcr.CertificateSectionFlags} */ get_flags(): CertificateSectionFlags; /** * Get the displayable label of the section. * @returns the displayable label of the section */ get_label(): string; } namespace DistributionPoint { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures {} // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps {} } /** * An object describing a CRL distribution point. * * A certificate user can use such a Certifiate Revocation List (CLR) * distribution point to check if the certificate has been revoked. * * These distribution poitns are for example listed as part of a * {@link Gcr.CertificateExtensionCrlDistributionPoints} object. * @gir-type Class * @since 4.3.91 */ class DistributionPoint extends GObject.Object { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: DistributionPoint.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns the full name of the CRL distribution point, if set. * @returns The full name of the distribution point */ get_full_name(): GeneralNames | null; /** * Returns a part of the relative name of `self`, if set. * * Note that the relative name might not be set, nor the specific part. * * Examples of a `part` might be the 'OU' (organizational unit) or the 'CN' * (common name). Only the value of that part of the RDN is returned. * @param part a RDN type string or OID. * @returns The relative name part if set, or NULL */ get_relative_name_part(part: string): string | null; } namespace GeneralName { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures {} // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps {} } /** * An object describing a name as part of the Subject Alternative Name (SAN) * extension. * @gir-type Class * @since 4.3.90 */ class GeneralName extends GObject.Object { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: GeneralName.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns a user-friendly string describing the name. */ get_description(): string; /** * Returns the actual value of the name. */ get_value(): string; /** * Returns the raw bytes describing the value of the name. */ get_value_raw(): GLib.Bytes; } namespace GeneralNames { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures {} // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps, Gio.ListModel.ConstructorProps {} } /** * A list of {@link Gcr.GeneralName}s. * @gir-type Class * @since 4.3.91 */ class GeneralNames extends GObject.Object implements Gio.ListModel { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: GeneralNames.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Returns the name at the given position. * * It is illegal to call this function with a position larger than the number * of elements in this list. * @param position The position in the list * @returns The name at the given position */ get_name(position: number): GeneralName; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @returns the {@link GObject.GType} of the items contained in `list`. */ get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @returns the number of items in `list`. */ get_n_items(): number; /** * Get the item at `position`. * * If `position` is greater than the number of items in `list`, `null` is * returned. * * `null` is never returned for an index that is smaller than the length * of the list. * * This function is meant to be used by language bindings in place * of `g_list_model_get_item()`. * * See also: `g_list_model_get_n_items()` * @param position the position of the item to fetch * @returns the object at `position`. */ get_item(position: number): A | null; /** * Emits the {@link Gio.ListModel.SignalSignatures.items_changed | Gio.ListModel::items-changed} signal on `list`. * * This function should only be called by classes implementing * {@link Gio.ListModel}. It has to be called after the internal representation * of `list` has been updated, because handlers connected to this signal * might query the new state of the list. * * Implementations must only make changes to the model (as visible to * its consumer) in places that will not cause problems for that * consumer. For models that are driven directly by a write API (such * as {@link Gio.ListStore}), changes can be reported in response to uses of that * API. For models that represent remote data, changes should only be * made from a fresh mainloop dispatch. It is particularly not * permitted to make changes in response to a call to the {@link Gio.ListModel} * consumer API. * * Stated another way: in general, it is assumed that code making a * series of accesses to the model via the API, without returning to the * mainloop, and without calling other code, will continue to view the * same contents of the model. * @param position the position at which `list` changed * @param removed the number of items removed * @param added the number of items added */ items_changed(position: number, removed: number, added: number): void; /** * Get the item at `position`. If `position` is greater than the number of * items in `list`, `null` is returned. * * `null` is never returned for an index that is smaller than the length * of the list. See `g_list_model_get_n_items()`. * * The same {@link GObject.Object} instance may not appear more than once in a {@link Gio.ListModel}. * @param position the position of the item to fetch * @virtual */ vfunc_get_item(position: number): A | null; /** * Gets the type of the items in `list`. * * All items returned from `g_list_model_get_item()` are of the type * returned by this function, or a subtype, or if the type is an * interface, they are an implementation of that interface. * * The item type of a {@link Gio.ListModel} can not change during the life of the * model. * @virtual */ vfunc_get_item_type(): GObject.GType; /** * Gets the number of items in `list`. * * Depending on the model implementation, calling this function may be * less efficient than iterating the list with increasing values for * `position` until `g_list_model_get_item()` returns `null`. * @virtual */ vfunc_get_n_items(): number; } namespace Parser { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures { /** * This signal is emitted when an item needs to be unlocked or decrypted before * it can be parsed. The `count` argument specifies the number of times * the signal has been emitted for a given item. This can be used to * display a message saying the previous password was incorrect. * * Typically the `gcr_parser_add_password()` function is called in * response to this signal. * * If `false` is returned, then the authentication was not handled. If * no handlers return `true` then the item is not parsed and an error * with the code {@link Gcr.DataError.CANCELLED} will be raised. * @signal * @run-last */ authenticate: (arg0: number) => boolean | void; /** * This signal is emitted when an item is sucessfully parsed. To access * the information about the item use the `gcr_parser_get_parsed_label()`, * `gcr_parser_get_parsed_attributes()` and `gcr_parser_get_parsed_description()` * functions. * @signal * @run-first */ parsed: () => void; "notify::parsed-attributes": (pspec: GObject.ParamSpec) => void; "notify::parsed-description": (pspec: GObject.ParamSpec) => void; "notify::parsed-label": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps { parsed_attributes: Gck.Attributes | null; parsedAttributes: Gck.Attributes | null; parsed_description: string | null; parsedDescription: string | null; parsed_label: string | null; parsedLabel: string | null; } } /** * A parser for parsing various types of files or data. * * A {@link Gcr.Parser} can parse various certificate and key files such as OpenSSL * PEM files, DER encoded certifictes, PKCS#8 keys and so on. Each various * format is identified by a value in the {@link DataFormat} enumeration. * * In order to parse data, a new parser is created with {@link Parser.new} and * then the `Gcr.Parser::authenticate` and `Gcr.Parser::parsed` signals * should be connected to. Data is then fed to the parser via * {@link Parser.parse_data} or {@link Parser.parse_stream}. * * During the `Gcr.Parser::parsed` signal the attributes that make up the * currently parsed item can be retrieved using the * {@link Parser.get_parsed_attributes} function. * @gir-type Class */ class Parser extends GObject.Object { static $gtype: GObject.GType; // Properties /** * Get the attributes that make up the currently parsed item. This is * generally only valid during a `Gcr.Parser::parsed` signal. * @read-only */ get parsed_attributes(): Gck.Attributes | null; /** * Get the attributes that make up the currently parsed item. This is * generally only valid during a `Gcr.Parser::parsed` signal. * @read-only */ get parsedAttributes(): Gck.Attributes | null; /** * The description of the type of the currently parsed item. This is generally * only valid during a `Gcr.Parser::parsed` signal. * @read-only */ get parsed_description(): string | null; /** * The description of the type of the currently parsed item. This is generally * only valid during a `Gcr.Parser::parsed` signal. * @read-only */ get parsedDescription(): string | null; /** * The label of the currently parsed item. This is generally * only valid during a `Gcr.Parser::parsed` signal. * @read-only */ get parsed_label(): string | null; /** * The label of the currently parsed item. This is generally * only valid during a `Gcr.Parser::parsed` signal. * @read-only */ get parsedLabel(): string | null; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: Parser.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; static ["new"](): Parser; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Virtual methods /** * The default handler for the authenticate signal. * @param count * @virtual */ vfunc_authenticate(count: number): boolean; /** * The default handler for the parsed signal. * @virtual */ vfunc_parsed(): void; // Methods /** * Add a password to the set of passwords to try when parsing locked or encrypted * items. This is usually called from the `Gcr.Parser::authenticate` signal. * @param password a password to try */ add_password(password: string | null): void; /** * Disable parsing of the given format. Use {@link Gcr.DataFormat.ALL} to disable all the formats. * @param format The format identifier */ format_disable(format: DataFormat): void; /** * Enable parsing of the given format. Use {@link Gcr.DataFormat.ALL} to enable all the formats. * @param format The format identifier */ format_enable(format: DataFormat): void; /** * Check whether the given format is supported by the parser. * @param format The format identifier * @returns Whether the format is supported. */ format_supported(format: DataFormat): boolean; /** * Get the filename of the parser item. * @returns the filename set on the parser, or `null` */ get_filename(): string; /** * Get the currently parsed item * @returns the currently parsed item */ get_parsed(): Parsed; /** * Get the attributes which make up the currently parsed item. This is generally * only valid during the `Gcr.Parser::parsed` signal. * @returns the attributes for the current item, which are owned by the parser and should not be freed */ get_parsed_attributes(): Gck.Attributes | null; /** * Get the raw data block that represents this parsed object. This is only * valid during the `Gcr.Parser::parsed` signal. * @returns the raw data block of the currently parsed item; the value is owned by the parser and should not be freed */ get_parsed_block(): Uint8Array | null; /** * Get the raw data block that represents this parsed object. This is only * valid during the `Gcr.Parser::parsed` signal. * @returns the raw data block of the currently parsed item */ get_parsed_bytes(): GLib.Bytes; /** * Get a description for the type of the currently parsed item. This is generally * only valid during the `Gcr.Parser::parsed` signal. * @returns the description for the current item; this is owned by the parser and should not be freed */ get_parsed_description(): string | null; /** * Get the format of the raw data block that represents this parsed object. * This corresponds with the data returned from * {@link Parser.get_parsed_block}. * * This is only valid during the `Gcr.Parser::parsed` signal. * @returns the data format of the currently parsed item */ get_parsed_format(): DataFormat; /** * Get the label of the currently parsed item. This is generally only valid * during the `Gcr.Parser::parsed` signal. * @returns the label of the currently parsed item. The value is owned by the parser and should not be freed. */ get_parsed_label(): string | null; /** * Parse the data. The `Gcr.Parser::parsed` and * `Gcr.Parser::authenticate` signals may fire during the parsing. * @param data the data to parse * @returns Whether the data was parsed successfully or not. */ parse_bytes(data: GLib.Bytes | Uint8Array): boolean; /** * Parse the data. The `Gcr.Parser::parsed` and `Gcr.Parser::authenticate` * signals may fire during the parsing. * * A copy of the data will be made. Use {@link Parser.parse_bytes} to avoid * this. * @param data the data to parse * @returns Whether the data was parsed successfully or not. */ parse_data(data: Uint8Array | string): boolean; /** * Parse items from the data in a {@link Gio.InputStream}. This function may block while * reading from the input stream. Use {@link Parser.parse_stream_async} for * a non-blocking variant. * * The `Gcr.Parser::parsed` and `Gcr.Parser::authenticate` signals * may fire during the parsing. * @param input The input stream * @param cancellable An optional cancellation object * @returns Whether the parsing completed successfully or not. */ parse_stream(input: Gio.InputStream, cancellable: Gio.Cancellable | null): boolean; /** * Parse items from the data in a {@link Gio.InputStream}. This function completes * asyncronously and doesn't block. * * The `Gcr.Parser::parsed` and `Gcr.Parser::authenticate` signals * may fire during the parsing. * @param input The input stream * @param cancellable An optional cancellation object */ parse_stream_async(input: Gio.InputStream, cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Parse items from the data in a {@link Gio.InputStream}. This function completes * asyncronously and doesn't block. * * The `Gcr.Parser::parsed` and `Gcr.Parser::authenticate` signals * may fire during the parsing. * @param input The input stream * @param cancellable An optional cancellation object * @param callback Called when the operation result is ready. */ parse_stream_async(input: Gio.InputStream, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Parse items from the data in a {@link Gio.InputStream}. This function completes * asyncronously and doesn't block. * * The `Gcr.Parser::parsed` and `Gcr.Parser::authenticate` signals * may fire during the parsing. * @param input The input stream * @param cancellable An optional cancellation object * @param callback Called when the operation result is ready. */ parse_stream_async(input: Gio.InputStream, cancellable: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Complete an operation to parse a stream. * @param result The operation result * @returns Whether the parsing completed successfully or not. */ parse_stream_finish(result: Gio.AsyncResult): boolean; /** * Sets the filename of the parser item. * @param filename a string of the filename of the parser item */ set_filename(filename: string | null): void; } namespace Pkcs11Certificate { // Signal signatures interface SignalSignatures extends Gck.Object.SignalSignatures { "notify::attributes": (pspec: GObject.ParamSpec) => void; "notify::handle": (pspec: GObject.ParamSpec) => void; "notify::module": (pspec: GObject.ParamSpec) => void; "notify::session": (pspec: GObject.ParamSpec) => void; "notify::description": (pspec: GObject.ParamSpec) => void; "notify::expiry-date": (pspec: GObject.ParamSpec) => void; "notify::issuer-name": (pspec: GObject.ParamSpec) => void; "notify::label": (pspec: GObject.ParamSpec) => void; "notify::subject-name": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends Gck.Object.ConstructorProps, Certificate.ConstructorProps { attributes: Gck.Attributes; } } /** * A certificate loaded from a PKCS#11 storage. * It is also a valid {@link Gck.Object} and can be used as such. * * Use {@link Gcr.Pkcs11Certificate.lookup_issuer} to lookup the issuer of a * given certificate in the PKCS#11 store. * * Various common PKCS#11 certificate attributes are automatically loaded and * are available via {@link Gcr.Pkcs11Certificate.get_attributes}. * @gir-type Class */ class Pkcs11Certificate extends Gck.Object implements Certificate { static $gtype: GObject.GType; // Properties /** * Automatically loaded attributes for this certificate. * @construct-only */ get attributes(): Gck.Attributes; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: Pkcs11Certificate.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Static methods /** * Lookup a the issuer of a `certificate` in the PKCS#11 storage. The * lookup is done using the issuer DN of the certificate. No certificate chain * verification is done. Use a crypto library to make trust decisions. * * This call may block, see {@link Gcr.Pkcs11Certificate.lookup_issuer} for the * non-blocking version. * * Will return `null` if no issuer certificate is found. Use `error` to determine * if an error occurred. * @param certificate a {@link Gcr.Certificate} * @param cancellable a cancellable */ static lookup_issuer(certificate: Certificate, cancellable: Gio.Cancellable | null): Certificate | null; /** * Lookup a the issuer of a `certificate` in the PKCS#11 storage. The * lookup is done using the issuer DN of the certificate. No certificate chain * verification is done. Use a crypto library to make trust decisions. * * When the operation is finished, callback will be called. You can then call * {@link Gcr.Pkcs11Certificate.lookup_issuer_finish} to get the result of the * operation. * @param certificate a {@link Gcr.Certificate} * @param cancellable a cancellable * @param callback a {@link Gio.AsyncReadyCallback} to call when the operation completes */ static lookup_issuer_async(certificate: Certificate, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Finishes an asynchronous operation started by * {@link Gcr.Pkcs11Certificate.lookup_issuer_async}. * * Will return `null` if no issuer certificate is found. Use `error` to determine * if an error occurred. * @param result the {@link Gio.AsyncResult} passed to the callback */ static lookup_issuer_finish(result: Gio.AsyncResult): Certificate | null; /** * Lookup a certificate in the PKCS#11 storage by the given URI. * * This call may block, see `gcr_pkcs11_certificate_new_from_uri_async()` for * the non-blocking version. * * Will return `null` if no certificate is found. Use `error` to determine * if an error occurred. * @param pkcs11_uri a A PKCS \#11 URI * @param cancellable a {@link Gio.Cancellable} */ static new_from_uri(pkcs11_uri: string, cancellable: Gio.Cancellable | null): Certificate | null; /** * Lookup a certificate in the PKCS#11 storage by the given URI. * * When the operation is finished, callback will be called. You can then call * `gcr_pkcs11_certificate_new_from_uri_finish()` to get the result of the * operation. * @param pkcs11_uri a A PKCS \#11 URI * @param cancellable a {@link Gio.Cancellable} * @param callback a {@link Gio.AsyncReadyCallback} to call when the operation completes */ static new_from_uri_async(pkcs11_uri: string, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Finishes an asynchronous operation started by * `gcr_pkcs11_certificate_new_from_uri_async()`. * * Will return `null` if no certificate is found. Use `error` to determine * if an error occurred. * @param result the {@link Gio.AsyncResult} passed to the callback */ static new_from_uri_finish(result: Gio.AsyncResult): Certificate | null; // Methods /** * Access the automatically loaded attributes for this certificate. * @returns the certificate attributes */ get_attributes(): Gck.Attributes; /** * A readable description for this certificate * @read-only * @category Inherited from Gcr.Certificate */ get description(): string; /** * The expiry date of the certificate * @read-only * @category Inherited from Gcr.Certificate */ get expiry_date(): GLib.DateTime | null; /** * The expiry date of the certificate * @read-only * @category Inherited from Gcr.Certificate */ get expiryDate(): GLib.DateTime | null; /** * Common name part of the certificate issuer * @read-only * @category Inherited from Gcr.Certificate */ get issuer_name(): string | null; /** * Common name part of the certificate issuer * @read-only * @category Inherited from Gcr.Certificate */ get issuerName(): string | null; /** * A readable label for this certificate. * @read-only * @category Inherited from Gcr.Certificate */ get label(): string; /** * @read-only * @category Inherited from Gcr.Certificate */ get subject_name(): string | null; /** * @read-only * @category Inherited from Gcr.Certificate */ get subjectName(): string | null; /** * Get the basic constraints for the certificate if present. If `false` is * returned then no basic constraints are present and the `is_ca` and * `path_len` arguments are not changed. * @returns whether basic constraints are present or not */ get_basic_constraints(): [boolean, boolean, number]; /** * Gets the raw DER data for an X.509 certificate. * @returns raw DER data of the X.509 certificate */ get_der_data(): Uint8Array; /** * Get the expiry date of this certificate. * @returns An expiry date of this certificate. */ get_expiry_date(): GLib.DateTime | null; /** * Calculate the fingerprint for this certificate. * * The caller should free the returned data using `g_free()` when * it is no longer required. * @param type the type of algorithm for the fingerprint. * @returns the raw binary fingerprint */ get_fingerprint(type: GLib.ChecksumType): Uint8Array | null; /** * Calculate the fingerprint for this certificate, and return it * as a hex string. * * The caller should free the returned data using `g_free()` when * it is no longer required. * @param type the type of algorithm for the fingerprint. * @returns an allocated hex string which contains the fingerprint. */ get_fingerprint_hex(type: GLib.ChecksumType): string | null; /** * Get the list of sections from the certificate that can be shown to the user * interface. * @returns A {@link GLib.List} of {@link Gcr.CertificateSection} */ get_interface_elements(): CertificateSection[]; /** * Get the issued date of this certificate. * @returns A issued date of this certificate. */ get_issued_date(): GLib.DateTime | null; /** * Get the common name of the issuer of this certificate. * * The string returned should be freed by the caller when no longer * required. * @returns The allocated issuer CN, or `null` if no issuer CN present. */ get_issuer_cn(): string | null; /** * Get the full issuer DN of the certificate as a (mostly) * readable string. * * The string returned should be freed by the caller when no longer * required. * @returns The allocated issuer DN of the certificate. */ get_issuer_dn(): string | null; /** * Get a name to represent the issuer of this certificate. * * This will try to lookup the common name, orianizational unit, * organization in that order. * @returns the allocated issuer name, or `null` if no issuer name */ get_issuer_name(): string | null; /** * Get a part of the DN of the issuer of this certificate. * * Examples of a `part` might be the 'OU' (organizational unit) * or the 'CN' (common name). Only the value of that part * of the DN is returned. * * The string returned should be freed by the caller when no longer * required. * @param part a DN type string or OID. * @returns the allocated part of the issuer DN, or `null` if no such part is present */ get_issuer_part(part: string): string | null; /** * Get the raw DER data for the issuer DN of the certificate. * * The data should be freed by using `g_free()` when no longer required. * @returns allocated memory containing the raw issuer */ get_issuer_raw(): Uint8Array | null; /** * Get the key size in bits of the public key represented * by this certificate. * @returns The key size of the certificate. */ get_key_size(): number; /** * Returns the subject public key info (SPKI) of the certificate. * @returns The SPKI of the certificate. */ get_public_key_info(): SubjectPublicKeyInfo; /** * Get the raw binary serial number of the certificate. * * The caller should free the returned data using `g_free()` when * it is no longer required. * @returns the raw binary serial number. */ get_serial_number(): Uint8Array | null; /** * Get the serial number of the certificate as a hex string. * * The caller should free the returned data using `g_free()` when * it is no longer required. * @returns an allocated string containing the serial number as hex. */ get_serial_number_hex(): string | null; /** * Get the common name of the subject of this certificate. * * The string returned should be freed by the caller when no longer * required. * @returns The allocated subject CN, or `null` if no subject CN present. */ get_subject_cn(): string | null; /** * Get the full subject DN of the certificate as a (mostly) * readable string. * * The string returned should be freed by the caller when no longer * required. * @returns The allocated subject DN of the certificate. */ get_subject_dn(): string | null; /** * Get a name to represent the subject of this certificate. * * This will try to lookup the common name, orianizational unit, * organization in that order. * @returns the allocated subject name, or `null` if no subject name */ get_subject_name(): string | null; /** * Get a part of the DN of the subject of this certificate. * * Examples of a `part` might be the 'OU' (organizational unit) * or the 'CN' (common name). Only the value of that part * of the DN is returned. * * The string returned should be freed by the caller when no longer * required. * @param part a DN type string or OID. * @returns the allocated part of the subject DN, or `null` if no such part is present. */ get_subject_part(part: string): string | null; /** * Get the raw DER data for the subject DN of the certificate. * * The data should be freed by using `g_free()` when no longer required. * @returns allocated memory containing the raw subject */ get_subject_raw(): Uint8Array | null; /** * Get the version of the X.509 certificate. * @returns the version of the certificate */ get_version(): number; /** * Check if `issuer` could be the issuer of this certificate. This is done by * comparing the relevant subject and issuer fields. No signature check is * done. Proper verification of certificates must be done via a crypto * library. * @param issuer a possible issuer {@link Gcr.Certificate} * @returns whether `issuer` could be the issuer of the certificate. */ is_issuer(issuer: Certificate): boolean; /** * Creates a {@link CertificateExtensionList} that can be used to inspect the * extensions of this certificate. * @returns The certificate's extensions */ list_extensions(): CertificateExtensionList; /** * Implementers of the {@link Gcr.Certificate} mixin should call this function to notify * when the certificate has changed to emit notifications on the various * properties. */ mixin_emit_notify(): void; /** * Gets the raw DER data for an X.509 certificate. * @virtual */ vfunc_get_der_data(): Uint8Array | string; /** * Gets a named field from the objects table of associations (see `g_object_set_data()`). * @param key name of the key for that association * @returns the data if found, or `null` if no such data exists. */ get_data(key: string): null; /** * @param args */ // Conflicted with Gck.Object.get_data get_data(...args: never[]): any; /** * Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values. * @param properties Object containing the properties to set */ set(properties: { [key: string]: any }): void; /** * @param args */ // Conflicted with Gck.Object.set set(...args: never[]): any; } namespace SecretExchange { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures { "notify::protocol": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps { protocol: string; } } /** * Allows exchange of secrets between two processes on the same system without * exposing those secrets to things like loggers, non-pageable memory etc. * * This does not protect against active attacks like MITM attacks. * * Each side creates a secret exchange object, and one of the sides calls * {@link SecretExchange.begin}. This creates a string, which should be passed * to the other side. Each side passes the strings it receives into * {@link SecretExchange.receive}. * * In order to send a reply (either with or without a secret) use * {@link SecretExchange.send}. A side must have successfully called * {@link SecretExchange.receive} before it can use * {@link SecretExchange.send}. * * The secret exchange objects can be used for multiple iterations of the * conversation, or for just one request/reply. The only limitation being that * the initial request cannot contain a secret. * * Caveat: Information about the approximate length (rounded up to the nearest * 16 bytes) may be leaked. If this is considered inacceptable, do not use * {@link SecretExchange}. * @gir-type Class */ class SecretExchange extends GObject.Object { static $gtype: GObject.GType; // Properties /** * The protocol being used for the exchange. * * Will be `null` if no protocol was specified when creating this object, * and either {@link SecretExchange.begin} or {@link SecretExchange.receive} * have not been called successfully. * @construct-only * @default sx-aes-1 */ get protocol(): string; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: SecretExchange.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; static ["new"](protocol: string | null): SecretExchange; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Virtual methods /** * @param peer * @param n_peer * @virtual */ vfunc_derive_transport_key(peer: number, n_peer: number): boolean; /** * @param scheme * @param public_key * @param n_public_key * @virtual */ vfunc_generate_exchange_key(scheme: string, public_key: number, n_public_key: number): boolean; // Methods /** * Begin the secret exchange. The resulting string should be sent to the other * side of the exchange. The other side should use {@link SecretExchange.receive} * to process the string. * @returns A newly allocated string to be sent to the other side of the secret exchange */ begin(): string; /** * Will return `null` if no protocol was specified, and either * {@link SecretExchange.begin} or {@link SecretExchange.receive} have not * been called successfully. * @returns the protocol or `null` */ get_protocol(): string; /** * Returns the last secret received. If no secret has yet been received this * will return `null`. The string is owned by the {@link Gcr.SecretExchange} object * and will be valid until the next time that `gcr_secret_exchange_receive()` * is called on this object, or the object is destroyed. * * Depending on the secret passed into the other side of the secret exchange, * the result may be a binary string. It does however have a null terminator, * so if you're certain that it is does not contain arbitrary binary data, * it can be used as a string. * @returns the last secret received */ get_secret(): string[]; /** * Receive a string from the other side of secret exchange. This string will * have been created by {@link SecretExchange.begin} or * {@link SecretExchange.send}. * * After this call completes successfully the value returned from * `gcr_secret_exchange_get_secret()` will have changed. * @param exchange the string received * @returns whether the string was successfully parsed and received */ receive(exchange: string): boolean; /** * Send a reply to the other side of the secret exchange, optionally sending a * secret. * * {@link SecretExchange.receive} must have been successfully called at least * once on this object. In other words this object must have received data * from the other side of the secret exchange, before we can send a secret. * @param secret optionally, a secret to send to the other side * @param secret_len length of `secret`, or -1 if null terminated * @returns a newly allocated string to be sent to the other side of the secret exchange */ send(secret: string | null, secret_len: bigint | number): string; } namespace SimpleCertificate { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures { "notify::description": (pspec: GObject.ParamSpec) => void; "notify::expiry-date": (pspec: GObject.ParamSpec) => void; "notify::issuer-name": (pspec: GObject.ParamSpec) => void; "notify::label": (pspec: GObject.ParamSpec) => void; "notify::subject-name": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps, Certificate.ConstructorProps {} } /** * An implementation of {@link Certificate} which loads a certificate from DER * data already located in memory. * * To create an object, use the {@link SimpleCertificate.new} or * {@link SimpleCertificate.new_static} functions. * @gir-type Class */ class SimpleCertificate extends GObject.Object implements Certificate { static $gtype: GObject.GType; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: SimpleCertificate.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; static ["new"](data: Uint8Array | string): SimpleCertificate; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; /** * A readable description for this certificate * @read-only * @category Inherited from Gcr.Certificate */ get description(): string; /** * The expiry date of the certificate * @read-only * @category Inherited from Gcr.Certificate */ get expiry_date(): GLib.DateTime | null; /** * The expiry date of the certificate * @read-only * @category Inherited from Gcr.Certificate */ get expiryDate(): GLib.DateTime | null; /** * Common name part of the certificate issuer * @read-only * @category Inherited from Gcr.Certificate */ get issuer_name(): string | null; /** * Common name part of the certificate issuer * @read-only * @category Inherited from Gcr.Certificate */ get issuerName(): string | null; /** * A readable label for this certificate. * @read-only * @category Inherited from Gcr.Certificate */ get label(): string; /** * @read-only * @category Inherited from Gcr.Certificate */ get subject_name(): string | null; /** * @read-only * @category Inherited from Gcr.Certificate */ get subjectName(): string | null; /** * Get the basic constraints for the certificate if present. If `false` is * returned then no basic constraints are present and the `is_ca` and * `path_len` arguments are not changed. * @returns whether basic constraints are present or not */ get_basic_constraints(): [boolean, boolean, number]; /** * Gets the raw DER data for an X.509 certificate. * @returns raw DER data of the X.509 certificate */ get_der_data(): Uint8Array; /** * Get the expiry date of this certificate. * @returns An expiry date of this certificate. */ get_expiry_date(): GLib.DateTime | null; /** * Calculate the fingerprint for this certificate. * * The caller should free the returned data using `g_free()` when * it is no longer required. * @param type the type of algorithm for the fingerprint. * @returns the raw binary fingerprint */ get_fingerprint(type: GLib.ChecksumType): Uint8Array | null; /** * Calculate the fingerprint for this certificate, and return it * as a hex string. * * The caller should free the returned data using `g_free()` when * it is no longer required. * @param type the type of algorithm for the fingerprint. * @returns an allocated hex string which contains the fingerprint. */ get_fingerprint_hex(type: GLib.ChecksumType): string | null; /** * Get the list of sections from the certificate that can be shown to the user * interface. * @returns A {@link GLib.List} of {@link Gcr.CertificateSection} */ get_interface_elements(): CertificateSection[]; /** * Get the issued date of this certificate. * @returns A issued date of this certificate. */ get_issued_date(): GLib.DateTime | null; /** * Get the common name of the issuer of this certificate. * * The string returned should be freed by the caller when no longer * required. * @returns The allocated issuer CN, or `null` if no issuer CN present. */ get_issuer_cn(): string | null; /** * Get the full issuer DN of the certificate as a (mostly) * readable string. * * The string returned should be freed by the caller when no longer * required. * @returns The allocated issuer DN of the certificate. */ get_issuer_dn(): string | null; /** * Get a name to represent the issuer of this certificate. * * This will try to lookup the common name, orianizational unit, * organization in that order. * @returns the allocated issuer name, or `null` if no issuer name */ get_issuer_name(): string | null; /** * Get a part of the DN of the issuer of this certificate. * * Examples of a `part` might be the 'OU' (organizational unit) * or the 'CN' (common name). Only the value of that part * of the DN is returned. * * The string returned should be freed by the caller when no longer * required. * @param part a DN type string or OID. * @returns the allocated part of the issuer DN, or `null` if no such part is present */ get_issuer_part(part: string): string | null; /** * Get the raw DER data for the issuer DN of the certificate. * * The data should be freed by using `g_free()` when no longer required. * @returns allocated memory containing the raw issuer */ get_issuer_raw(): Uint8Array | null; /** * Get the key size in bits of the public key represented * by this certificate. * @returns The key size of the certificate. */ get_key_size(): number; /** * Returns the subject public key info (SPKI) of the certificate. * @returns The SPKI of the certificate. */ get_public_key_info(): SubjectPublicKeyInfo; /** * Get the raw binary serial number of the certificate. * * The caller should free the returned data using `g_free()` when * it is no longer required. * @returns the raw binary serial number. */ get_serial_number(): Uint8Array | null; /** * Get the serial number of the certificate as a hex string. * * The caller should free the returned data using `g_free()` when * it is no longer required. * @returns an allocated string containing the serial number as hex. */ get_serial_number_hex(): string | null; /** * Get the common name of the subject of this certificate. * * The string returned should be freed by the caller when no longer * required. * @returns The allocated subject CN, or `null` if no subject CN present. */ get_subject_cn(): string | null; /** * Get the full subject DN of the certificate as a (mostly) * readable string. * * The string returned should be freed by the caller when no longer * required. * @returns The allocated subject DN of the certificate. */ get_subject_dn(): string | null; /** * Get a name to represent the subject of this certificate. * * This will try to lookup the common name, orianizational unit, * organization in that order. * @returns the allocated subject name, or `null` if no subject name */ get_subject_name(): string | null; /** * Get a part of the DN of the subject of this certificate. * * Examples of a `part` might be the 'OU' (organizational unit) * or the 'CN' (common name). Only the value of that part * of the DN is returned. * * The string returned should be freed by the caller when no longer * required. * @param part a DN type string or OID. * @returns the allocated part of the subject DN, or `null` if no such part is present. */ get_subject_part(part: string): string | null; /** * Get the raw DER data for the subject DN of the certificate. * * The data should be freed by using `g_free()` when no longer required. * @returns allocated memory containing the raw subject */ get_subject_raw(): Uint8Array | null; /** * Get the version of the X.509 certificate. * @returns the version of the certificate */ get_version(): number; /** * Check if `issuer` could be the issuer of this certificate. This is done by * comparing the relevant subject and issuer fields. No signature check is * done. Proper verification of certificates must be done via a crypto * library. * @param issuer a possible issuer {@link Gcr.Certificate} * @returns whether `issuer` could be the issuer of the certificate. */ is_issuer(issuer: Certificate): boolean; /** * Creates a {@link CertificateExtensionList} that can be used to inspect the * extensions of this certificate. * @returns The certificate's extensions */ list_extensions(): CertificateExtensionList; /** * Implementers of the {@link Gcr.Certificate} mixin should call this function to notify * when the certificate has changed to emit notifications on the various * properties. */ mixin_emit_notify(): void; /** * Gets the raw DER data for an X.509 certificate. * @virtual */ vfunc_get_der_data(): Uint8Array | string; } namespace SshAskpass { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures { "notify::interaction": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps { interaction: Gio.TlsInteraction; } } /** * When used as the setup function while spawning an ssh command like ssh-add * or ssh, this allows callbacks for passwords on the provided interaction. * @gir-type Class */ class SshAskpass extends GObject.Object { static $gtype: GObject.GType; // Properties /** * The interaction used to prompt for passwords. * @construct-only */ get interaction(): Gio.TlsInteraction; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: SshAskpass.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; static ["new"](interaction: Gio.TlsInteraction): SshAskpass; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Static methods /** * Use this function as a callback setup function passed to `g_spawn_sync()`, * `g_spawn_async()`, `g_spawn_async_with_pipes()`. * @param askpass a {@link Gcr.SshAskpass} object */ static child_setup(askpass: null): void; // Methods /** * Get the interaction associated with this object. * @returns the interaction */ get_interaction(): Gio.TlsInteraction; } namespace SystemPrompt { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures { "notify::bus-name": (pspec: GObject.ParamSpec) => void; "notify::secret-exchange": (pspec: GObject.ParamSpec) => void; "notify::timeout-seconds": (pspec: GObject.ParamSpec) => void; "notify::caller-window": (pspec: GObject.ParamSpec) => void; "notify::cancel-label": (pspec: GObject.ParamSpec) => void; "notify::choice-chosen": (pspec: GObject.ParamSpec) => void; "notify::choice-label": (pspec: GObject.ParamSpec) => void; "notify::continue-label": (pspec: GObject.ParamSpec) => void; "notify::description": (pspec: GObject.ParamSpec) => void; "notify::message": (pspec: GObject.ParamSpec) => void; "notify::password-new": (pspec: GObject.ParamSpec) => void; "notify::password-strength": (pspec: GObject.ParamSpec) => void; "notify::title": (pspec: GObject.ParamSpec) => void; "notify::warning": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps, Prompt.ConstructorProps, Gio.AsyncInitable.ConstructorProps, Gio.Initable.ConstructorProps { bus_name: string; busName: string; secret_exchange: SecretExchange; secretExchange: SecretExchange; timeout_seconds: number; timeoutSeconds: number; } } /** * A {@link Prompt} implementation which calls to the system prompter to * display prompts in a system modal fashion. * * Since the system prompter usually only displays one prompt at a time, you * may have to wait for the prompt to be displayed. Use {@link SystemPrompt.open} * or a related function to open a prompt. Since this can take a long time, you * should always check that the prompt is still needed after it is opened. A * previous prompt may have already provided the information needed and you * may no longer need to prompt. * * Use {@link SystemPrompt.close} to close the prompt when you're done with it. * @gir-type Class */ class SystemPrompt extends GObject.Object implements Prompt, Gio.AsyncInitable, Gio.Initable { static $gtype: GObject.GType; // Properties /** * The DBus bus name of the prompter to use for prompting, or `null` * for the default prompter. * @construct-only * @default null */ get bus_name(): string; /** * The DBus bus name of the prompter to use for prompting, or `null` * for the default prompter. * @construct-only * @default null */ get busName(): string; /** * The {@link Gcr.SecretExchange} to use when transferring passwords. A default * secret exchange will be used if this is not set. */ get secret_exchange(): SecretExchange; set secret_exchange(val: SecretExchange); /** * The {@link Gcr.SecretExchange} to use when transferring passwords. A default * secret exchange will be used if this is not set. */ get secretExchange(): SecretExchange; set secretExchange(val: SecretExchange); /** * The timeout in seconds to wait when opening the prompt. * @construct-only * @default -1 */ set timeout_seconds(val: number); /** * The timeout in seconds to wait when opening the prompt. * @construct-only * @default -1 */ set timeoutSeconds(val: number); /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: SystemPrompt.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Static methods static error_get_domain(): GLib.Quark; /** * Opens a system prompt with the default prompter. * * Most system prompters only allow showing one prompt at a time, and if * another prompt is shown then this method will block for up to * `timeout_seconds` seconds. If `timeout_seconds` is equal to -1, then this * will block indefinitely until the prompt can be opened. If `timeout_seconds` * expires, then this function will fail with a {@link Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS} * error. * @param timeout_seconds the number of seconds to wait to access the prompt, or -1 * @param cancellable optional cancellation object */ static open(timeout_seconds: number, cancellable: Gio.Cancellable | null): SystemPrompt; /** * Asynchronously open a system prompt with the default system prompter. * * Most system prompters only allow showing one prompt at a time, and if * another prompt is shown then this method will block for up to * `timeout_seconds` seconds. If `timeout_seconds` is equal to -1, then this * will block indefinitely until the prompt can be opened. If `timeout_seconds` * expires, then this operation will fail with a {@link Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS} * error. * @param timeout_seconds the number of seconds to wait to access the prompt, or -1 * @param cancellable optional cancellation object * @param callback called when the operation completes */ static open_async(timeout_seconds: number, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Complete an operation to asynchronously open a system prompt. * @param result the asynchronous result */ static open_finish(result: Gio.AsyncResult): SystemPrompt; /** * Opens a system prompt. If prompter_name is `null`, then the default * system prompter is used. * * Most system prompters only allow showing one prompt at a time, and if * another prompt is shown then this method will block for up to * `timeout_seconds` seconds. If `timeout_seconds` is equal to -1, then this * will block indefinitely until the prompt can be opened. If `timeout_seconds` * expires, then this function will fail with a {@link Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS} * error. * @param prompter_name the prompter dbus name * @param timeout_seconds the number of seconds to wait to access the prompt, or -1 * @param cancellable optional cancellation object */ static open_for_prompter(prompter_name: string | null, timeout_seconds: number, cancellable: Gio.Cancellable | null): SystemPrompt; /** * Opens a system prompt asynchronously. If prompter_name is `null`, then the * default system prompter is used. * * Most system prompters only allow showing one prompt at a time, and if * another prompt is shown then this method will block for up to * `timeout_seconds` seconds. If `timeout_seconds` is equal to -1, then this * will block indefinitely until the prompt can be opened. If `timeout_seconds` * expires, then this operation will fail with a {@link Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS} * error. * @param prompter_name the prompter D-Bus name * @param timeout_seconds the number of seconds to wait to access the prompt, or -1 * @param cancellable optional cancellation object * @param callback called when the operation completes */ static open_for_prompter_async(prompter_name: string | null, timeout_seconds: number, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; // Methods /** * Close this prompt. After calling this function, no further prompts will * succeed on this object. The prompt object is not unreferenced by this * function, and you must unreference it once done. * * This call may block, use the `gcr_system_prompt_close_async()` to perform * this action indefinitely. * * Whether or not this function returns `true`, the system prompt object is * still closed and may not be further used. * @param cancellable an optional cancellation object * @returns whether close was cleanly completed */ close(cancellable: Gio.Cancellable | null): boolean; /** * @param args */ // Conflicted with Gcr.Prompt.close close(...args: never[]): any; /** * Close this prompt asynchronously. After calling this function, no further * methods may be called on this object. The prompt object is not unreferenced * by this function, and you must unreference it once done. * * This call returns immediately and completes asynchronously. * @param cancellable an optional cancellation object */ close_async(cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Close this prompt asynchronously. After calling this function, no further * methods may be called on this object. The prompt object is not unreferenced * by this function, and you must unreference it once done. * * This call returns immediately and completes asynchronously. * @param cancellable an optional cancellation object * @param callback called when the operation completes */ close_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Close this prompt asynchronously. After calling this function, no further * methods may be called on this object. The prompt object is not unreferenced * by this function, and you must unreference it once done. * * This call returns immediately and completes asynchronously. * @param cancellable an optional cancellation object * @param callback called when the operation completes */ close_async(cancellable: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Complete operation to close this prompt. * * Whether or not this function returns `true`, the system prompt object is * still closed and may not be further used. * @param result asynchronous operation result * @returns whether close was cleanly completed */ close_finish(result: Gio.AsyncResult): boolean; /** * Get the current {@link SecretExchange} used to transfer secrets in this prompt. * @returns the secret exchange */ get_secret_exchange(): SecretExchange; /** * The string handle of the caller's window. * * The caller window indicates to the prompt which window is prompting the * user. The prompt may choose to ignore this information or use it in whatever * way it sees fit. * * In X11, this will be a stringified version of the XWindow handle; in * Wayland this is the result of an export using the XDG foreign * protocol. * @default null * @category Inherited from Gcr.Prompt */ get caller_window(): string; set caller_window(val: string); /** * The string handle of the caller's window. * * The caller window indicates to the prompt which window is prompting the * user. The prompt may choose to ignore this information or use it in whatever * way it sees fit. * * In X11, this will be a stringified version of the XWindow handle; in * Wayland this is the result of an export using the XDG foreign * protocol. * @default null * @category Inherited from Gcr.Prompt */ get callerWindow(): string; set callerWindow(val: string); /** * The label for the cancel button in the prompt. * @default Cancel * @category Inherited from Gcr.Prompt */ get cancel_label(): string; set cancel_label(val: string); /** * The label for the cancel button in the prompt. * @default Cancel * @category Inherited from Gcr.Prompt */ get cancelLabel(): string; set cancelLabel(val: string); /** * Whether the additional choice is chosen or not. * * The additional choice would have been setup using {@link Gcr.Prompt.choice_label}. * @default false * @category Inherited from Gcr.Prompt */ get choice_chosen(): boolean; set choice_chosen(val: boolean); /** * Whether the additional choice is chosen or not. * * The additional choice would have been setup using {@link Gcr.Prompt.choice_label}. * @default false * @category Inherited from Gcr.Prompt */ get choiceChosen(): boolean; set choiceChosen(val: boolean); /** * The label for the additional choice. * * If this is a non-`null` value then an additional boolean choice will be * displayed by the prompt allowing the user to select or deselect it. * * If `null`, then no additional choice is displayed. * * The initial value of the choice can be set with {@link Gcr.Prompt.choice_chosen}. * @default null * @category Inherited from Gcr.Prompt */ get choice_label(): string; set choice_label(val: string); /** * The label for the additional choice. * * If this is a non-`null` value then an additional boolean choice will be * displayed by the prompt allowing the user to select or deselect it. * * If `null`, then no additional choice is displayed. * * The initial value of the choice can be set with {@link Gcr.Prompt.choice_chosen}. * @default null * @category Inherited from Gcr.Prompt */ get choiceLabel(): string; set choiceLabel(val: string); /** * The label for the continue button in the prompt. * @default Continue * @category Inherited from Gcr.Prompt */ get continue_label(): string; set continue_label(val: string); /** * The label for the continue button in the prompt. * @default Continue * @category Inherited from Gcr.Prompt */ get continueLabel(): string; set continueLabel(val: string); /** * The detailed description of the prompt. * * A prompt implementation may choose not to display this detailed description. * The prompt message should contain relevant information. * @default null * @category Inherited from Gcr.Prompt */ get description(): string; set description(val: string); /** * The prompt message for the user. * * A prompt implementation should always display this message. * @default null * @category Inherited from Gcr.Prompt */ get message(): string; set message(val: string); /** * Whether the prompt will prompt for a new password. * * This will cause the prompt implementation to ask the user to confirm the * password and/or display other relevant user interface for creating a new * password. * @default false * @category Inherited from Gcr.Prompt */ get password_new(): boolean; set password_new(val: boolean); /** * Whether the prompt will prompt for a new password. * * This will cause the prompt implementation to ask the user to confirm the * password and/or display other relevant user interface for creating a new * password. * @default false * @category Inherited from Gcr.Prompt */ get passwordNew(): boolean; set passwordNew(val: boolean); /** * Indication of the password strength. * * Prompts will return a zero value if the password is empty, and a value * greater than zero if the password has any characters. * * This is only valid after a successful prompt for a password. * @read-only * @default 0 * @category Inherited from Gcr.Prompt */ get password_strength(): number; /** * Indication of the password strength. * * Prompts will return a zero value if the password is empty, and a value * greater than zero if the password has any characters. * * This is only valid after a successful prompt for a password. * @read-only * @default 0 * @category Inherited from Gcr.Prompt */ get passwordStrength(): number; /** * The title of the prompt. * * A prompt implementation may choose not to display the prompt title. The * {@link Gcr.Prompt.message} should contain relevant information. * @default null * @category Inherited from Gcr.Prompt */ get title(): string; set title(val: string); /** * A prompt warning displayed on the prompt, or `null` for no warning. * * This is a warning like "The password is incorrect." usually displayed to the * user about a previous 'unsuccessful' prompt. * @default null * @category Inherited from Gcr.Prompt */ get warning(): string; set warning(val: string); /** * Prompts for confirmation asking a cancel/continue style question. * Set the various properties on the prompt before calling this function to * represent the question correctly. * * This method will block until the a response is returned from the prompter. * * {@link Gcr.PromptReply.CONTINUE} will be returned if the user confirms the prompt. The * return value will also be {@link Gcr.PromptReply.CANCEL} if the user cancels or if * an error occurs. Check the `error` argument to tell the difference. * @param cancellable optional cancellation object * @returns the reply from the prompt */ confirm(cancellable: Gio.Cancellable | null): PromptReply; /** * Prompts for confirmation asking a cancel/continue style question. * Set the various properties on the prompt before calling this method to * represent the question correctly. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object */ confirm_async(cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Prompts for confirmation asking a cancel/continue style question. * Set the various properties on the prompt before calling this method to * represent the question correctly. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object * @param callback called when the operation completes */ confirm_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Prompts for confirmation asking a cancel/continue style question. * Set the various properties on the prompt before calling this method to * represent the question correctly. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object * @param callback called when the operation completes */ confirm_async(cancellable: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Complete an operation to prompt for confirmation. * * {@link Gcr.PromptReply.CONTINUE} will be returned if the user confirms the prompt. The * return value will also be {@link Gcr.PromptReply.CANCEL} if the user cancels or if * an error occurs. Check the `error` argument to tell the difference. * @param result asynchronous result passed to callback * @returns the reply from the prompt */ confirm_finish(result: Gio.AsyncResult): PromptReply; /** * Prompts for confirmation asking a cancel/continue style question. * Set the various properties on the prompt before calling this function to * represent the question correctly. * * This method will block until the a response is returned from the prompter * and will run a main loop similar to a `gtk_dialog_run()`. The application * will remain responsive but care must be taken to handle reentrancy issues. * * {@link Gcr.PromptReply.CONTINUE} will be returned if the user confirms the prompt. The * return value will also be {@link Gcr.PromptReply.CANCEL} if the user cancels or if * an error occurs. Check the `error` argument to tell the difference. * @param cancellable optional cancellation object * @returns the reply from the prompt */ confirm_run(cancellable: Gio.Cancellable | null): PromptReply; /** * Get the string handle of the caller's window. * * The caller window indicates to the prompt which window is prompting the * user. The prompt may choose to ignore this information or use it in whatever * way it sees fit. * @returns a newly allocated string containing the string handle of the window. */ get_caller_window(): string; /** * Get the label for the cancel button. * * This is the button that results in a {@link Gcr.PromptReply.CANCEL} reply * from the prompt. * @returns a newly allocated string containing the label */ get_cancel_label(): string; /** * Get whether the additional choice was chosen or not. * * The additional choice would have been setup using * `gcr_prompt_set_choice_label()`. * @returns whether chosen */ get_choice_chosen(): boolean; /** * Get the label for the additional choice. * * This will be `null` if no additional choice is being displayed. * @returns a newly allocated string containing the additional choice or `null` */ get_choice_label(): string; /** * Get the label for the continue button. * * This is the button that results in a {@link Gcr.PromptReply.CONTINUE} reply * from the prompt. * @returns a newly allocated string containing the label */ get_continue_label(): string; /** * Get the detailed description of the prompt. * * A prompt implementation may choose not to display this detailed description. * The prompt message should contain relevant information. * @returns a newly allocated string containing the detailed description of the prompt */ get_description(): string; /** * Gets the prompt message for the user. * * A prompt implementation should always display this message. * @returns a newly allocated string containing the detailed description of the prompt */ get_message(): string; /** * Get whether the prompt will prompt for a new password. * * This will cause the prompt implementation to ask the user to confirm the * password and/or display other relevant user interface for creating a new * password. * @returns whether in new password mode or not */ get_password_new(): boolean; /** * Get indication of the password strength. * * Prompts will return a zero value if the password is empty, and a value * greater than zero if the password has any characters. * * This is only valid after a successful prompt for a password. * @returns zero if the password is empty, greater than zero if not */ get_password_strength(): number; /** * Gets the title of the prompt. * * A prompt implementation may choose not to display the prompt title. The * prompt message should contain relevant information. * @returns a newly allocated string containing the prompt title. */ get_title(): string; /** * Get a prompt warning displayed on the prompt. * * This is a warning like "The password is incorrect." usually displayed to the * user about a previous 'unsuccessful' prompt. * * If this string is `null` then no warning is displayed. * @returns a newly allocated string containing the prompt warning, or `null` if no warning */ get_warning(): string; /** * Prompts for password. Set the various properties on the prompt before calling * this method to explain which password should be entered. * * This method will block until the a response is returned from the prompter. * * A password will be returned if the user enters a password successfully. * The returned password is valid until the next time a method is called * to display another prompt. * * `null` will be returned if the user cancels or if an error occurs. Check the * `error` argument to tell the difference. * @param cancellable optional cancellation object * @returns the password owned by the prompt, or `null` */ password(cancellable: Gio.Cancellable | null): string; /** * Prompts for password. Set the various properties on the prompt before calling * this method to explain which password should be entered. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object */ password_async(cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Prompts for password. Set the various properties on the prompt before calling * this method to explain which password should be entered. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object * @param callback called when the operation completes */ password_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Prompts for password. Set the various properties on the prompt before calling * this method to explain which password should be entered. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object * @param callback called when the operation completes */ password_async(cancellable: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Complete an operation to prompt for a password. * * A password will be returned if the user enters a password successfully. * The returned password is valid until the next time a method is called * to display another prompt. * * `null` will be returned if the user cancels or if an error occurs. Check the * `error` argument to tell the difference. * @param result asynchronous result passed to callback * @returns the password owned by the prompt, or `null` */ password_finish(result: Gio.AsyncResult): string; /** * Prompts for password. Set the various properties on the prompt before calling * this method to explain which password should be entered. * * This method will block until the a response is returned from the prompter * and will run a main loop similar to a `gtk_dialog_run()`. The application * will remain responsive but care must be taken to handle reentrancy issues. * * A password will be returned if the user enters a password successfully. * The returned password is valid until the next time a method is called * to display another prompt. * * `null` will be returned if the user cancels or if an error occurs. Check the * `error` argument to tell the difference. * @param cancellable optional cancellation object * @returns the password owned by the prompt, or `null` */ password_run(cancellable: Gio.Cancellable | null): string; /** * Reset the contents and properties of the prompt. */ reset(): void; /** * Set the string handle of the caller's window. * * The caller window indicates to the prompt which window is prompting the * user. The prompt may choose to ignore this information or use it in whatever * way it sees fit. * @param window_id the window id */ set_caller_window(window_id: string): void; /** * Set the label for the continue button. * * This is the button that results in a {@link Gcr.PromptReply.CANCEL} reply * from the prompt. * @param cancel_label the label */ set_cancel_label(cancel_label: string): void; /** * Set whether the additional choice is chosen or not. * * The additional choice should be set up using `gcr_prompt_set_choice_label()`. * @param chosen whether chosen */ set_choice_chosen(chosen: boolean): void; /** * Set the label for the additional choice. * * If this is a non-`null` value then an additional boolean choice will be * displayed by the prompt allowing the user to select or deselect it. * * The initial value of the choice can be set with the * `gcr_prompt_set_choice_label()` method. * * If this is `null`, then no additional choice is being displayed. * @param choice_label the additional choice or `null` */ set_choice_label(choice_label: string | null): void; /** * Set the label for the continue button. * * This is the button that results in a {@link Gcr.PromptReply.CONTINUE} reply * from the prompt. * @param continue_label the label */ set_continue_label(continue_label: string): void; /** * Set the detailed description of the prompt. * * A prompt implementation may choose not to display this detailed description. * Use `gcr_prompt_set_message()` to set a general message containing relevant * information. * @param description the detailed description */ set_description(description: string): void; /** * Sets the prompt message for the user. * * A prompt implementation should always display this message. * @param message the prompt message */ set_message(message: string): void; /** * Set whether the prompt will prompt for a new password. * * This will cause the prompt implementation to ask the user to confirm the * password and/or display other relevant user interface for creating a new * password. * @param new_password whether in new password mode or not */ set_password_new(new_password: boolean): void; /** * Sets the title of the prompt. * * A prompt implementation may choose not to display the prompt title. The * prompt message should contain relevant information. * @param title the prompt title */ set_title(title: string): void; /** * Set a prompt warning displayed on the prompt. * * This is a warning like "The password is incorrect." usually displayed to the * user about a previous 'unsuccessful' prompt. * * If this string is `null` then no warning is displayed. * @param warning the warning or `null` */ set_warning(warning: string | null): void; /** * close a prompt * @virtual */ vfunc_prompt_close(): void; /** * Prompts for confirmation asking a cancel/continue style question. * Set the various properties on the prompt before calling this method to * represent the question correctly. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object * @param callback called when the operation completes * @virtual */ vfunc_prompt_confirm_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Complete an operation to prompt for confirmation. * * {@link Gcr.PromptReply.CONTINUE} will be returned if the user confirms the prompt. The * return value will also be {@link Gcr.PromptReply.CANCEL} if the user cancels or if * an error occurs. Check the `error` argument to tell the difference. * @param result asynchronous result passed to callback * @virtual */ vfunc_prompt_confirm_finish(result: Gio.AsyncResult): PromptReply; /** * Prompts for password. Set the various properties on the prompt before calling * this method to explain which password should be entered. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object * @param callback called when the operation completes * @virtual */ vfunc_prompt_password_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Complete an operation to prompt for a password. * * A password will be returned if the user enters a password successfully. * The returned password is valid until the next time a method is called * to display another prompt. * * `null` will be returned if the user cancels or if an error occurs. Check the * `error` argument to tell the difference. * @param result asynchronous result passed to callback * @virtual */ vfunc_prompt_password_finish(result: Gio.AsyncResult): string; /** * Starts asynchronous initialization of the object implementing the * interface. This must be done before any real use of the object after * initial construction. If the object also implements {@link Gio.Initable} you can * optionally call `g_initable_init()` instead. * * This method is intended for language bindings. If writing in C, * `g_async_initable_new_async()` should typically be used instead. * * When the initialization is finished, `callback` will be called. You can * then call `g_async_initable_init_finish()` to get the result of the * initialization. * * Implementations may also support cancellation. If `cancellable` is not * `null`, then initialization can be cancelled by triggering the cancellable * object from another thread. If the operation was cancelled, the error * {@link Gio.IOErrorEnum.CANCELLED} will be returned. If `cancellable` is not `null`, and * the object doesn't support cancellable initialization, the error * {@link Gio.IOErrorEnum.NOT_SUPPORTED} will be returned. * * As with {@link Gio.Initable}, if the object is not initialized, or initialization * returns with an error, then all operations on the object except * `g_object_ref()` and `g_object_unref()` are considered to be invalid, and * have undefined behaviour. They will often fail with `g_critical()` or * `g_warning()`, but this must not be relied on. * * Callers should not assume that a class which implements {@link Gio.AsyncInitable} can * be initialized multiple times; for more information, see `g_initable_init()`. * If a class explicitly supports being initialized multiple times, * implementation requires yielding all subsequent calls to `init_async()` on the * results of the first call. * * For classes that also support the {@link Gio.Initable} interface, the default * implementation of this method will run the `g_initable_init()` function * in a thread, so if you want to support asynchronous initialization via * threads, just implement the {@link Gio.AsyncInitable} interface without overriding * any interface methods. * @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the operation * @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore. */ init_async(io_priority: number, cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Starts asynchronous initialization of the object implementing the * interface. This must be done before any real use of the object after * initial construction. If the object also implements {@link Gio.Initable} you can * optionally call `g_initable_init()` instead. * * This method is intended for language bindings. If writing in C, * `g_async_initable_new_async()` should typically be used instead. * * When the initialization is finished, `callback` will be called. You can * then call `g_async_initable_init_finish()` to get the result of the * initialization. * * Implementations may also support cancellation. If `cancellable` is not * `null`, then initialization can be cancelled by triggering the cancellable * object from another thread. If the operation was cancelled, the error * {@link Gio.IOErrorEnum.CANCELLED} will be returned. If `cancellable` is not `null`, and * the object doesn't support cancellable initialization, the error * {@link Gio.IOErrorEnum.NOT_SUPPORTED} will be returned. * * As with {@link Gio.Initable}, if the object is not initialized, or initialization * returns with an error, then all operations on the object except * `g_object_ref()` and `g_object_unref()` are considered to be invalid, and * have undefined behaviour. They will often fail with `g_critical()` or * `g_warning()`, but this must not be relied on. * * Callers should not assume that a class which implements {@link Gio.AsyncInitable} can * be initialized multiple times; for more information, see `g_initable_init()`. * If a class explicitly supports being initialized multiple times, * implementation requires yielding all subsequent calls to `init_async()` on the * results of the first call. * * For classes that also support the {@link Gio.Initable} interface, the default * implementation of this method will run the `g_initable_init()` function * in a thread, so if you want to support asynchronous initialization via * threads, just implement the {@link Gio.AsyncInitable} interface without overriding * any interface methods. * @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the operation * @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore. * @param callback a {@link Gio.AsyncReadyCallback} to call when the request is satisfied */ init_async(io_priority: number, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Starts asynchronous initialization of the object implementing the * interface. This must be done before any real use of the object after * initial construction. If the object also implements {@link Gio.Initable} you can * optionally call `g_initable_init()` instead. * * This method is intended for language bindings. If writing in C, * `g_async_initable_new_async()` should typically be used instead. * * When the initialization is finished, `callback` will be called. You can * then call `g_async_initable_init_finish()` to get the result of the * initialization. * * Implementations may also support cancellation. If `cancellable` is not * `null`, then initialization can be cancelled by triggering the cancellable * object from another thread. If the operation was cancelled, the error * {@link Gio.IOErrorEnum.CANCELLED} will be returned. If `cancellable` is not `null`, and * the object doesn't support cancellable initialization, the error * {@link Gio.IOErrorEnum.NOT_SUPPORTED} will be returned. * * As with {@link Gio.Initable}, if the object is not initialized, or initialization * returns with an error, then all operations on the object except * `g_object_ref()` and `g_object_unref()` are considered to be invalid, and * have undefined behaviour. They will often fail with `g_critical()` or * `g_warning()`, but this must not be relied on. * * Callers should not assume that a class which implements {@link Gio.AsyncInitable} can * be initialized multiple times; for more information, see `g_initable_init()`. * If a class explicitly supports being initialized multiple times, * implementation requires yielding all subsequent calls to `init_async()` on the * results of the first call. * * For classes that also support the {@link Gio.Initable} interface, the default * implementation of this method will run the `g_initable_init()` function * in a thread, so if you want to support asynchronous initialization via * threads, just implement the {@link Gio.AsyncInitable} interface without overriding * any interface methods. * @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the operation * @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore. * @param callback a {@link Gio.AsyncReadyCallback} to call when the request is satisfied */ init_async(io_priority: number, cancellable: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Finishes asynchronous initialization and returns the result. * See `g_async_initable_init_async()`. * @param res a {@link Gio.AsyncResult}. * @returns `true` if successful. If an error has occurred, this function will return `false` and set `error` appropriately if present. */ init_finish(res: Gio.AsyncResult): boolean; /** * Finishes the async construction for the various g_async_initable_new * calls, returning the created object or `null` on error. * @param res the {@link Gio.AsyncResult} from the callback * @returns a newly created {@link GObject.Object}, or `null` on error. Free with `g_object_unref()`. */ new_finish(res: Gio.AsyncResult): SystemPrompt; /** * Starts asynchronous initialization of the object implementing the * interface. This must be done before any real use of the object after * initial construction. If the object also implements {@link Gio.Initable} you can * optionally call `g_initable_init()` instead. * * This method is intended for language bindings. If writing in C, * `g_async_initable_new_async()` should typically be used instead. * * When the initialization is finished, `callback` will be called. You can * then call `g_async_initable_init_finish()` to get the result of the * initialization. * * Implementations may also support cancellation. If `cancellable` is not * `null`, then initialization can be cancelled by triggering the cancellable * object from another thread. If the operation was cancelled, the error * {@link Gio.IOErrorEnum.CANCELLED} will be returned. If `cancellable` is not `null`, and * the object doesn't support cancellable initialization, the error * {@link Gio.IOErrorEnum.NOT_SUPPORTED} will be returned. * * As with {@link Gio.Initable}, if the object is not initialized, or initialization * returns with an error, then all operations on the object except * `g_object_ref()` and `g_object_unref()` are considered to be invalid, and * have undefined behaviour. They will often fail with `g_critical()` or * `g_warning()`, but this must not be relied on. * * Callers should not assume that a class which implements {@link Gio.AsyncInitable} can * be initialized multiple times; for more information, see `g_initable_init()`. * If a class explicitly supports being initialized multiple times, * implementation requires yielding all subsequent calls to `init_async()` on the * results of the first call. * * For classes that also support the {@link Gio.Initable} interface, the default * implementation of this method will run the `g_initable_init()` function * in a thread, so if you want to support asynchronous initialization via * threads, just implement the {@link Gio.AsyncInitable} interface without overriding * any interface methods. * @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the operation * @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore. * @param callback a {@link Gio.AsyncReadyCallback} to call when the request is satisfied * @virtual */ vfunc_init_async(io_priority: number, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Finishes asynchronous initialization and returns the result. * See `g_async_initable_init_async()`. * @param res a {@link Gio.AsyncResult}. * @virtual */ vfunc_init_finish(res: Gio.AsyncResult): boolean; /** * Initializes the object implementing the interface. * * This method is intended for language bindings. If writing in C, * `g_initable_new()` should typically be used instead. * * The object must be initialized before any real use after initial * construction, either with this function or `g_async_initable_init_async()`. * * Implementations may also support cancellation. If `cancellable` is not `null`, * then initialization can be cancelled by triggering the cancellable object * from another thread. If the operation was cancelled, the error * {@link Gio.IOErrorEnum.CANCELLED} will be returned. If `cancellable` is not `null` and * the object doesn't support cancellable initialization the error * {@link Gio.IOErrorEnum.NOT_SUPPORTED} will be returned. * * If the object is not initialized, or initialization returns with an * error, then all operations on the object except `g_object_ref()` and * `g_object_unref()` are considered to be invalid, and have undefined * behaviour. See the [description][iface@Gio.Initable#description] for more details. * * Callers should not assume that a class which implements {@link Gio.Initable} can be * initialized multiple times, unless the class explicitly documents itself as * supporting this. Generally, a class’ implementation of `init()` can assume * (and assert) that it will only be called once. Previously, this documentation * recommended all {@link Gio.Initable} implementations should be idempotent; that * recommendation was relaxed in GLib 2.54. * * If a class explicitly supports being initialized multiple times, it is * recommended that the method is idempotent: multiple calls with the same * arguments should return the same results. Only the first call initializes * the object; further calls return the result of the first call. * * One reason why a class might need to support idempotent initialization is if * it is designed to be used via the singleton pattern, with a * {@link GObject.ObjectClass}.constructor that sometimes returns an existing instance. * In this pattern, a caller would expect to be able to call `g_initable_init()` * on the result of `g_object_new()`, regardless of whether it is in fact a new * instance. * @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore. * @returns `true` if successful. If an error has occurred, this function will return `false` and set `error` appropriately if present. */ init(cancellable: Gio.Cancellable | null): boolean; /** * Initializes the object implementing the interface. * * This method is intended for language bindings. If writing in C, * `g_initable_new()` should typically be used instead. * * The object must be initialized before any real use after initial * construction, either with this function or `g_async_initable_init_async()`. * * Implementations may also support cancellation. If `cancellable` is not `null`, * then initialization can be cancelled by triggering the cancellable object * from another thread. If the operation was cancelled, the error * {@link Gio.IOErrorEnum.CANCELLED} will be returned. If `cancellable` is not `null` and * the object doesn't support cancellable initialization the error * {@link Gio.IOErrorEnum.NOT_SUPPORTED} will be returned. * * If the object is not initialized, or initialization returns with an * error, then all operations on the object except `g_object_ref()` and * `g_object_unref()` are considered to be invalid, and have undefined * behaviour. See the [description][iface@Gio.Initable#description] for more details. * * Callers should not assume that a class which implements {@link Gio.Initable} can be * initialized multiple times, unless the class explicitly documents itself as * supporting this. Generally, a class’ implementation of `init()` can assume * (and assert) that it will only be called once. Previously, this documentation * recommended all {@link Gio.Initable} implementations should be idempotent; that * recommendation was relaxed in GLib 2.54. * * If a class explicitly supports being initialized multiple times, it is * recommended that the method is idempotent: multiple calls with the same * arguments should return the same results. Only the first call initializes * the object; further calls return the result of the first call. * * One reason why a class might need to support idempotent initialization is if * it is designed to be used via the singleton pattern, with a * {@link GObject.ObjectClass}.constructor that sometimes returns an existing instance. * In this pattern, a caller would expect to be able to call `g_initable_init()` * on the result of `g_object_new()`, regardless of whether it is in fact a new * instance. * @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore. * @virtual */ vfunc_init(cancellable: Gio.Cancellable | null): boolean; } namespace SystemPrompter { // Signal signatures interface SignalSignatures extends GObject.Object.SignalSignatures { /** * Signal emitted to create a new prompt when needed. * * The default implementation of this signal creates a prompt of the type * `gcr_system_prompter_get_prompt_type()`. * @signal * @run-last */ "new-prompt": () => Prompt; "notify::prompt-type": (pspec: GObject.ParamSpec) => void; "notify::prompting": (pspec: GObject.ParamSpec) => void; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps { prompt_type: GObject.GTypeInput; promptType: GObject.GTypeInput; prompting: boolean; } } /** * A prompter used by implementations of system prompts. * * This is a D-Bus service which is rarely implemented. Use {@link SystemPrompt} * to display system prompts. * * The system prompter service responds to D-Bus requests to create system * prompts and creates {@link Gcr.Prompt} type objects to display those prompts. * * Pass the GType of the implementation of {@link Prompt} to * {@link SystemPrompter.new}. * @gir-type Class */ class SystemPrompter extends GObject.Object { static $gtype: GObject.GType; // Properties /** * The {@link GObject.GType} for prompts created by this prompter. This must be a * {@link Gcr.Prompt} implementation. * @construct-only */ get prompt_type(): GObject.GType; /** * The {@link GObject.GType} for prompts created by this prompter. This must be a * {@link Gcr.Prompt} implementation. * @construct-only */ get promptType(): GObject.GType; /** * Whether the prompter is prompting or not. * @read-only * @default false */ get prompting(): boolean; /** * Compile-time signal type information. * * This instance property is generated only for TypeScript type checking. * It is not defined at runtime and should not be accessed in JS code. * @internal */ $signals: SystemPrompter.SignalSignatures; // Constructors constructor(properties?: Partial, ...args: any[]); _init(...args: any[]): void; static ["new"](mode: SystemPrompterMode, prompt_type: GObject.GType): SystemPrompter; // Signals /** @signal */ connect(signal: K, callback: GObject.SignalCallback): number; connect(signal: string, callback: (...args: any[]) => any): number; /** @signal */ connect_after(signal: K, callback: GObject.SignalCallback): number; connect_after(signal: string, callback: (...args: any[]) => any): number; /** @signal */ emit(signal: K, ...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never): void; emit(signal: string, ...args: any[]): void; // Methods /** * Get the mode for this prompter. * * Most system prompters only display one prompt at a time and therefore * return {@link Gcr.SystemPrompterMode.SINGLE}. * @returns the prompter mode */ get_mode(): SystemPrompterMode; /** * Get the {@link GObject.GType} for prompts created by this prompter. * * The returned {@link GObject.GType} will be a {@link Gcr.Prompt} implementation. * @returns the prompt {@link GObject.GType} */ get_prompt_type(): GObject.GType; /** * Get whether prompting or not. * @returns whether prompting or not */ get_prompting(): boolean; /** * Register this system prompter on the DBus `connection`. * * This makes the prompter available for clients to call. The prompter will * remain registered until `gcr_system_prompter_unregister()` is called, or the * prompter is unreferenced. * @param connection a DBus connection */ register(connection: Gio.DBusConnection): void; /** * Unregister this system prompter on the DBus `connection`. * * The prompter must have previously been registered with `gcr_system_prompter_register()`. * * If `wait` is set then this function will wait until all prompts have been closed * or cancelled. This is usually only used by tests. * @param wait whether to wait for closing prompts */ unregister(wait: boolean): void; } /** * @gir-type Alias */ type AccessDescriptionClass = typeof AccessDescription; /** * @gir-type Alias */ type CertificateChainClass = typeof CertificateChain; /** * @gir-type Struct */ abstract class CertificateChainPrivate { static $gtype: GObject.GType; } /** * @gir-type Alias */ type CertificateExtensionAuthorityInfoAccessClass = typeof CertificateExtensionAuthorityInfoAccess; /** * @gir-type Alias */ type CertificateExtensionAuthorityKeyIdentifierClass = typeof CertificateExtensionAuthorityKeyIdentifier; /** * @gir-type Alias */ type CertificateExtensionBasicConstraintsClass = typeof CertificateExtensionBasicConstraints; /** * @gir-type Alias */ type CertificateExtensionCertificatePoliciesClass = typeof CertificateExtensionCertificatePolicies; /** * @gir-type Alias */ type CertificateExtensionClass = typeof CertificateExtension; /** * @gir-type Alias */ type CertificateExtensionCrlDistributionPointsClass = typeof CertificateExtensionCrlDistributionPoints; /** * @gir-type Alias */ type CertificateExtensionExtendedKeyUsageClass = typeof CertificateExtensionExtendedKeyUsage; /** * @gir-type Alias */ type CertificateExtensionKeyUsageClass = typeof CertificateExtensionKeyUsage; /** * @gir-type Alias */ type CertificateExtensionListClass = typeof CertificateExtensionList; /** * @gir-type Alias */ type CertificateExtensionSubjectAltNameClass = typeof CertificateExtensionSubjectAltName; /** * @gir-type Alias */ type CertificateExtensionSubjectKeyIdentifierClass = typeof CertificateExtensionSubjectKeyIdentifier; /** * @gir-type Alias */ type CertificateFieldClass = typeof CertificateField; /** * @gir-type Alias */ type CertificateIface = typeof Certificate; /** * @gir-type Alias */ type CertificatePolicyClass = typeof CertificatePolicy; /** * @gir-type Alias */ type CertificatePolicyQualifierClass = typeof CertificatePolicyQualifier; /** * @gir-type Alias */ type CertificateRequestClass = typeof CertificateRequest; /** * @gir-type Alias */ type CertificateSectionClass = typeof CertificateSection; /** * @gir-type Alias */ type DistributionPointClass = typeof DistributionPoint; /** * @gir-type Alias */ type GeneralNameClass = typeof GeneralName; /** * @gir-type Alias */ type GeneralNamesClass = typeof GeneralNames; /** * @gir-type Alias */ type ImportInteractionInterface = typeof ImportInteraction; /** * @gir-type Alias */ type ImporterInterface = typeof Importer; /** * A parsed item parsed by a {@link Gcr.Parser}. * @gir-type Struct */ abstract class Parsed { static $gtype: GObject.GType; // Static methods /** * Unreferences a parsed item which was referenced with `gcr_parsed_ref()` * @param parsed a parsed item */ static unref(parsed: null): void; // Methods /** * Get the attributes which make up the parsed item. * @returns the attributes for the item; these are owned by the parsed item and should not be freed */ get_attributes(): Gck.Attributes | null; /** * Get the raw data block for the parsed item. * @returns the raw data of the parsed item, or `null` */ get_bytes(): GLib.Bytes; /** * Get the raw data block for the parsed item. * @returns the raw data of the parsed item, or `null` */ get_data(): Uint8Array | null; /** * Get the descirption for a parsed item. * @returns the description */ get_description(): string | null; /** * Get the filename of the parsed item. * @returns the filename of the parsed item, or `null` */ get_filename(): string; /** * Get the format of the parsed item. * @returns the data format of the item */ get_format(): DataFormat; /** * Get the label for the parsed item. * @returns the label for the item */ get_label(): string | null; /** * Add a reference to a parsed item. An item may not be shared across threads * until it has been referenced at least once. * @returns the parsed item */ ref(): Parsed; } /** * @gir-type Alias */ type ParserClass = typeof Parser; /** * @gir-type Struct */ abstract class ParserPrivate { static $gtype: GObject.GType; } /** * @gir-type Alias */ type Pkcs11CertificateClass = typeof Pkcs11Certificate; /** * @gir-type Struct */ abstract class Pkcs11CertificatePrivate { static $gtype: GObject.GType; } /** * @gir-type Alias */ type PromptInterface = typeof Prompt; /** * @gir-type Alias */ type SecretExchangeClass = typeof SecretExchange; /** * @gir-type Struct */ abstract class SecretExchangePrivate { static $gtype: GObject.GType; } /** * @gir-type Alias */ type SimpleCertificateClass = typeof SimpleCertificate; /** * @gir-type Struct */ abstract class SimpleCertificatePrivate { static $gtype: GObject.GType; } /** * @gir-type Alias */ type SshAskpassClass = typeof SshAskpass; /** * @gir-type Struct */ abstract class SubjectPublicKeyInfo { static $gtype: GObject.GType; // Methods copy(): SubjectPublicKeyInfo; free(): void; /** * Returns a user-facing description of the algorithm used by the public key. */ get_algorithm_description(): string; /** * Returns the OID of the algorithm used by the public key. */ get_algorithm_oid(): string; /** * Returns the raw bytes describing the parameters for the public key's * algorithm. Their meaning is algorithm-specific * @returns The raw bytes describing the algorithm's parameters */ get_algorithm_parameters_raw(): GLib.Bytes; /** * Returns the public key. * @returns The raw data of the public key */ get_key(): GLib.Bytes; /** * Returns the size of the public key. * @returns The key size */ get_key_size(): number; } /** * @gir-type Alias */ type SystemPromptClass = typeof SystemPrompt; /** * @gir-type Struct */ abstract class SystemPromptPrivate { static $gtype: GObject.GType; } /** * @gir-type Alias */ type SystemPrompterClass = typeof SystemPrompter; /** * @gir-type Struct */ abstract class SystemPrompterPrivate { static $gtype: GObject.GType; } namespace Certificate { /** * Interface for implementing Certificate. * Contains only the virtual methods that need to be implemented. */ interface Interface { // Virtual methods /** * Gets the raw DER data for an X.509 certificate. * @virtual */ vfunc_get_der_data(): Uint8Array | string; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps { description: string; expiry_date: GLib.DateTime | null; expiryDate: GLib.DateTime | null; issuer_name: string | null; issuerName: string | null; label: string; subject_name: string | null; subjectName: string | null; } } export interface CertificateNamespace { $gtype: GObject.GType; prototype: Certificate; } /** * An interface that represents an X.509 certificate. * * Objects can implement this interface to make a certificate usable with the * GCR library. * * Various methods are available to parse out relevant bits of the certificate. * However no verification of the validity of a certificate is done here. Use * your favorite crypto library to do this. * * You can use {@link SimpleCertificate} to simply load a certificate for which * you already have the raw certificate data. * * The {@link Gcr.Certificate} interface has several properties that must be implemented. * You can use a mixin to implement these properties if desired. See the * {@link Certificate.mixin_class_init} and {@link Certificate.mixin_get_property} * functions. * @gir-type Interface */ interface Certificate extends GObject.Object, Certificate.Interface { // Properties /** * A readable description for this certificate * @read-only */ get description(): string; /** * The expiry date of the certificate * @read-only */ get expiry_date(): GLib.DateTime | null; /** * The expiry date of the certificate * @read-only */ get expiryDate(): GLib.DateTime | null; /** * Common name part of the certificate issuer * @read-only */ get issuer_name(): string | null; /** * Common name part of the certificate issuer * @read-only */ get issuerName(): string | null; /** * A readable label for this certificate. * @read-only */ get label(): string; /** * @read-only */ get subject_name(): string | null; /** * @read-only */ get subjectName(): string | null; // Methods /** * Get the basic constraints for the certificate if present. If `false` is * returned then no basic constraints are present and the `is_ca` and * `path_len` arguments are not changed. * @returns whether basic constraints are present or not */ get_basic_constraints(): [boolean, boolean, number]; /** * Gets the raw DER data for an X.509 certificate. * @returns raw DER data of the X.509 certificate */ get_der_data(): Uint8Array; /** * Get the expiry date of this certificate. * @returns An expiry date of this certificate. */ get_expiry_date(): GLib.DateTime | null; /** * Calculate the fingerprint for this certificate. * * The caller should free the returned data using `g_free()` when * it is no longer required. * @param type the type of algorithm for the fingerprint. * @returns the raw binary fingerprint */ get_fingerprint(type: GLib.ChecksumType): Uint8Array | null; /** * Calculate the fingerprint for this certificate, and return it * as a hex string. * * The caller should free the returned data using `g_free()` when * it is no longer required. * @param type the type of algorithm for the fingerprint. * @returns an allocated hex string which contains the fingerprint. */ get_fingerprint_hex(type: GLib.ChecksumType): string | null; /** * Get the list of sections from the certificate that can be shown to the user * interface. * @returns A {@link GLib.List} of {@link Gcr.CertificateSection} */ get_interface_elements(): CertificateSection[]; /** * Get the issued date of this certificate. * @returns A issued date of this certificate. */ get_issued_date(): GLib.DateTime | null; /** * Get the common name of the issuer of this certificate. * * The string returned should be freed by the caller when no longer * required. * @returns The allocated issuer CN, or `null` if no issuer CN present. */ get_issuer_cn(): string | null; /** * Get the full issuer DN of the certificate as a (mostly) * readable string. * * The string returned should be freed by the caller when no longer * required. * @returns The allocated issuer DN of the certificate. */ get_issuer_dn(): string | null; /** * Get a name to represent the issuer of this certificate. * * This will try to lookup the common name, orianizational unit, * organization in that order. * @returns the allocated issuer name, or `null` if no issuer name */ get_issuer_name(): string | null; /** * Get a part of the DN of the issuer of this certificate. * * Examples of a `part` might be the 'OU' (organizational unit) * or the 'CN' (common name). Only the value of that part * of the DN is returned. * * The string returned should be freed by the caller when no longer * required. * @param part a DN type string or OID. * @returns the allocated part of the issuer DN, or `null` if no such part is present */ get_issuer_part(part: string): string | null; /** * Get the raw DER data for the issuer DN of the certificate. * * The data should be freed by using `g_free()` when no longer required. * @returns allocated memory containing the raw issuer */ get_issuer_raw(): Uint8Array | null; /** * Get the key size in bits of the public key represented * by this certificate. * @returns The key size of the certificate. */ get_key_size(): number; /** * Returns the subject public key info (SPKI) of the certificate. * @returns The SPKI of the certificate. */ get_public_key_info(): SubjectPublicKeyInfo; /** * Get the raw binary serial number of the certificate. * * The caller should free the returned data using `g_free()` when * it is no longer required. * @returns the raw binary serial number. */ get_serial_number(): Uint8Array | null; /** * Get the serial number of the certificate as a hex string. * * The caller should free the returned data using `g_free()` when * it is no longer required. * @returns an allocated string containing the serial number as hex. */ get_serial_number_hex(): string | null; /** * Get the common name of the subject of this certificate. * * The string returned should be freed by the caller when no longer * required. * @returns The allocated subject CN, or `null` if no subject CN present. */ get_subject_cn(): string | null; /** * Get the full subject DN of the certificate as a (mostly) * readable string. * * The string returned should be freed by the caller when no longer * required. * @returns The allocated subject DN of the certificate. */ get_subject_dn(): string | null; /** * Get a name to represent the subject of this certificate. * * This will try to lookup the common name, orianizational unit, * organization in that order. * @returns the allocated subject name, or `null` if no subject name */ get_subject_name(): string | null; /** * Get a part of the DN of the subject of this certificate. * * Examples of a `part` might be the 'OU' (organizational unit) * or the 'CN' (common name). Only the value of that part * of the DN is returned. * * The string returned should be freed by the caller when no longer * required. * @param part a DN type string or OID. * @returns the allocated part of the subject DN, or `null` if no such part is present. */ get_subject_part(part: string): string | null; /** * Get the raw DER data for the subject DN of the certificate. * * The data should be freed by using `g_free()` when no longer required. * @returns allocated memory containing the raw subject */ get_subject_raw(): Uint8Array | null; /** * Get the version of the X.509 certificate. * @returns the version of the certificate */ get_version(): number; /** * Check if `issuer` could be the issuer of this certificate. This is done by * comparing the relevant subject and issuer fields. No signature check is * done. Proper verification of certificates must be done via a crypto * library. * @param issuer a possible issuer {@link Gcr.Certificate} * @returns whether `issuer` could be the issuer of the certificate. */ is_issuer(issuer: Certificate): boolean; /** * Creates a {@link CertificateExtensionList} that can be used to inspect the * extensions of this certificate. * @returns The certificate's extensions */ list_extensions(): CertificateExtensionList; /** * Implementers of the {@link Gcr.Certificate} mixin should call this function to notify * when the certificate has changed to emit notifications on the various * properties. */ mixin_emit_notify(): void; } export const Certificate: CertificateNamespace & { new (): Certificate; // This allows `obj instanceof Certificate` }; namespace ImportInteraction { /** * Interface for implementing ImportInteraction. * Contains only the virtual methods that need to be implemented. */ interface Interface { // Virtual methods /** * Supplement attributes before import. This means prompting the user for * things like labels and the like. The needed attributes will have been passed * to `gcr_import_interaction_supplement_prep()`. * * This method prompts the user and fills in the attributes. If the user or * cancellable cancels the operation the error should be set with {@link Gio.IOErrorEnum.CANCELLED}. * @param builder supplemented attributes * @param cancellable optional cancellable object * @virtual */ vfunc_supplement(builder: Gck.Builder, cancellable: Gio.Cancellable | null): Gio.TlsInteractionResult; /** * Asynchronously supplement attributes before import. This means prompting the * user for things like labels and the like. The needed attributes will have * been passed to `gcr_import_interaction_supplement_prep()`. * * This method prompts the user and fills in the attributes. * @param builder supplemented attributes * @param cancellable optional cancellable object * @param callback called when the operation completes * @virtual */ vfunc_supplement_async(builder: Gck.Builder, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Complete operation to asynchronously supplement attributes before import. * * If the user or cancellable cancels the operation the error should be set * with {@link Gio.IOErrorEnum.CANCELLED}. * @param result the asynchronous result * @virtual */ vfunc_supplement_finish(result: Gio.AsyncResult): Gio.TlsInteractionResult; /** * Prepare for supplementing the given attributes before import. This means * prompting the user for things like labels and the like. The attributes * will contain attributes for values that the importer needs, either empty * or prefilled with suggested values. * * This method does not prompt the user, but rather just prepares the * interaction that these are the attributes that are needed. * @param builder attributes to supplement * @virtual */ vfunc_supplement_prep(builder: Gck.Builder): void; } // Constructor properties interface interface ConstructorProps extends Gio.TlsInteraction.ConstructorProps {} } export interface ImportInteractionNamespace { $gtype: GObject.GType; prototype: ImportInteraction; } /** * This is an interface implemented by a caller performing an import. It allows * the importer to ask the caller for further information about the import. * * It must be implemented on a derived class of {@link Gio.TlsInteraction} * @gir-type Interface */ interface ImportInteraction extends Gio.TlsInteraction, ImportInteraction.Interface { // Methods /** * Supplement attributes before import. This means prompting the user for * things like labels and the like. The needed attributes will have been passed * to `gcr_import_interaction_supplement_prep()`. * * This method prompts the user and fills in the attributes. If the user or * cancellable cancels the operation the error should be set with {@link Gio.IOErrorEnum.CANCELLED}. * @param builder supplemented attributes * @param cancellable optional cancellable object * @returns {@link Gio.TlsInteractionResult.HANDLED} if successful or {@link Gio.TlsInteractionResult.FAILED} */ supplement(builder: Gck.Builder, cancellable: Gio.Cancellable | null): Gio.TlsInteractionResult; /** * Asynchronously supplement attributes before import. This means prompting the * user for things like labels and the like. The needed attributes will have * been passed to `gcr_import_interaction_supplement_prep()`. * * This method prompts the user and fills in the attributes. * @param builder supplemented attributes * @param cancellable optional cancellable object */ supplement_async(builder: Gck.Builder, cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Asynchronously supplement attributes before import. This means prompting the * user for things like labels and the like. The needed attributes will have * been passed to `gcr_import_interaction_supplement_prep()`. * * This method prompts the user and fills in the attributes. * @param builder supplemented attributes * @param cancellable optional cancellable object * @param callback called when the operation completes */ supplement_async(builder: Gck.Builder, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Asynchronously supplement attributes before import. This means prompting the * user for things like labels and the like. The needed attributes will have * been passed to `gcr_import_interaction_supplement_prep()`. * * This method prompts the user and fills in the attributes. * @param builder supplemented attributes * @param cancellable optional cancellable object * @param callback called when the operation completes */ supplement_async(builder: Gck.Builder, cancellable: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Complete operation to asynchronously supplement attributes before import. * * If the user or cancellable cancels the operation the error should be set * with {@link Gio.IOErrorEnum.CANCELLED}. * @param result the asynchronous result * @returns {@link Gio.TlsInteractionResult.HANDLED} if successful or {@link Gio.TlsInteractionResult.FAILED} */ supplement_finish(result: Gio.AsyncResult): Gio.TlsInteractionResult; /** * Prepare for supplementing the given attributes before import. This means * prompting the user for things like labels and the like. The attributes * will contain attributes for values that the importer needs, either empty * or prefilled with suggested values. * * This method does not prompt the user, but rather just prepares the * interaction that these are the attributes that are needed. * @param builder attributes to supplement */ supplement_prep(builder: Gck.Builder): void; } export const ImportInteraction: ImportInteractionNamespace & { new (): ImportInteraction; // This allows `obj instanceof ImportInteraction` }; namespace Importer { /** * Interface for implementing Importer. * Contains only the virtual methods that need to be implemented. */ interface Interface { // Virtual methods /** * Import the queued items in the importer. This function returns immediately * and completes asynchronously. * @param cancellable a {@link Gio.Cancellable}, or `null` * @param callback called when the operation completes * @virtual */ vfunc_import_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Complete an asynchronous operation to import queued items. * @param result an asynchronous result * @virtual */ vfunc_import_finish(result: Gio.AsyncResult): boolean; /** * Queues an additional item to be imported. The parsed item is represented * by the state of the {@link Parser} at the time of calling this method. * * If the parsed item is incompatible with the importer, then this will * fail and the item will not be queued. * @param parsed a parsed item to import * @virtual */ vfunc_queue_for_parsed(parsed: Parsed): boolean; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps { interaction: Gio.TlsInteraction | null; label: string; uri: string; } } export interface ImporterNamespace { $gtype: GObject.GType; prototype: Importer; /** * Create a set of importers which can import this parsed item. * * The parsed item is represented by the state of the {@link Gcr.Parser} at the * time of calling this method. * @param parsed a parser with a parsed item to import */ create_for_parsed(parsed: Parsed): Importer[]; /** * Queues an additional item to be imported in all compattible importers * in the set. The parsed item is represented by the state of the {@link Gcr.Parser} * at the time of calling this method. * * If the parsed item is incompatible with an importer, then that the item * will not be queued on that importer. * @param importers a set of importers * @param parsed a parsed item */ queue_and_filter_for_parsed(importers: Importer[], parsed: Parsed): Importer[]; /** * Register an importer to handle parsed items that match the given attributes. * @param importer_type the GType of the importer being registered * @param attrs the attributes that this importer is compatible with */ register(importer_type: GObject.GType, attrs: Gck.Attributes): void; /** * Register built-in PKCS#11 and GnuPG importers. */ register_well_known(): void; } /** * An interface which allows importing of certificates and keys. Each importer * is registered with a set of PKCS#11 attributes to match stuff that it can * import. * * An importer gets passed a {@link Parser} and accesses the currently parsed * item. To create a set of importers that can import the currently parsed * item in a parser, use {@link Importer.create_for_parsed}. The list of * importers returned has the parsed item queued for import. * * To queue additional items with a importer use * {@link Importer.queue_for_parsed}. In addition you can try and queue an * additional item with a set of importers using the * {@link Importer.queue_and_filter_for_parsed}. * * To start the import, use {@link Importer.import_async}. * @gir-type Interface */ interface Importer extends GObject.Object, Importer.Interface { // Properties /** * The interaction for the importer. */ get interaction(): Gio.TlsInteraction | null; set interaction(val: Gio.TlsInteraction | null); /** * The label for the importer. * @read-only */ get label(): string; /** * The URI of the location imported to. * @read-only * @default null */ get uri(): string; // Methods /** * Get the interaction used to prompt the user when needed by this * importer. * @returns the interaction or `null` */ get_interaction(): Gio.TlsInteraction | null; /** * Import the queued items in the importer. This function returns immediately * and completes asynchronously. * @param cancellable a {@link Gio.Cancellable}, or `null` */ import_async(cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Import the queued items in the importer. This function returns immediately * and completes asynchronously. * @param cancellable a {@link Gio.Cancellable}, or `null` * @param callback called when the operation completes */ import_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Import the queued items in the importer. This function returns immediately * and completes asynchronously. * @param cancellable a {@link Gio.Cancellable}, or `null` * @param callback called when the operation completes */ import_async(cancellable: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Complete an asynchronous operation to import queued items. * @param result an asynchronous result * @returns whether the import succeeded or failed */ import_finish(result: Gio.AsyncResult): boolean; /** * Queues an additional item to be imported. The parsed item is represented * by the state of the {@link Parser} at the time of calling this method. * * If the parsed item is incompatible with the importer, then this will * fail and the item will not be queued. * @param parsed a parsed item to import * @returns whether the item was queued or not */ queue_for_parsed(parsed: Parsed): boolean; /** * Set the interaction used to prompt the user when needed by this * importer. * @param interaction the interaction used by the importer */ set_interaction(interaction: Gio.TlsInteraction): void; } export const Importer: ImporterNamespace & { new (): Importer; // This allows `obj instanceof Importer` }; namespace Prompt { /** * Interface for implementing Prompt. * Contains only the virtual methods that need to be implemented. */ interface Interface { // Virtual methods /** * close a prompt * @virtual */ vfunc_prompt_close(): void; /** * Prompts for confirmation asking a cancel/continue style question. * Set the various properties on the prompt before calling this method to * represent the question correctly. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object * @param callback called when the operation completes * @virtual */ vfunc_prompt_confirm_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Complete an operation to prompt for confirmation. * * {@link Gcr.PromptReply.CONTINUE} will be returned if the user confirms the prompt. The * return value will also be {@link Gcr.PromptReply.CANCEL} if the user cancels or if * an error occurs. Check the `error` argument to tell the difference. * @param result asynchronous result passed to callback * @virtual */ vfunc_prompt_confirm_finish(result: Gio.AsyncResult): PromptReply; /** * Prompts for password. Set the various properties on the prompt before calling * this method to explain which password should be entered. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object * @param callback called when the operation completes * @virtual */ vfunc_prompt_password_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Complete an operation to prompt for a password. * * A password will be returned if the user enters a password successfully. * The returned password is valid until the next time a method is called * to display another prompt. * * `null` will be returned if the user cancels or if an error occurs. Check the * `error` argument to tell the difference. * @param result asynchronous result passed to callback * @virtual */ vfunc_prompt_password_finish(result: Gio.AsyncResult): string; } // Constructor properties interface interface ConstructorProps extends GObject.Object.ConstructorProps { caller_window: string; callerWindow: string; cancel_label: string; cancelLabel: string; choice_chosen: boolean; choiceChosen: boolean; choice_label: string; choiceLabel: string; continue_label: string; continueLabel: string; description: string; message: string; password_new: boolean; passwordNew: boolean; password_strength: number; passwordStrength: number; title: string; warning: string; } } export interface PromptNamespace { $gtype: GObject.GType; prototype: Prompt; } /** * A prompt displayed to the user. It is an interface with various * implementations. * * Various properties are set on the prompt, and then the prompt is displayed * the various prompt methods like {@link Prompt.password_run}. * * A {@link Gcr.Prompt} may be used to display multiple related prompts. Most * implementions do not hide the window between display of multiple related * prompts, and the {@link Gcr.Prompt} must be closed or destroyed in order to make * it go away. This allows the user to see that the prompts are related. * * Use `GcrPromptDialog` (part of gcr-ui) to create an in-process GTK+ dialog * prompt. Use {@link SystemPrompt} to create a system prompt in a prompter * process. * * The prompt implementation will always display the {@link Prompt.message} * property, but may choose not to display the {@link Prompt.description} or * {@link Prompt.title} properties. * @gir-type Interface */ interface Prompt extends GObject.Object, Prompt.Interface { // Properties /** * The string handle of the caller's window. * * The caller window indicates to the prompt which window is prompting the * user. The prompt may choose to ignore this information or use it in whatever * way it sees fit. * * In X11, this will be a stringified version of the XWindow handle; in * Wayland this is the result of an export using the XDG foreign * protocol. * @default null */ get caller_window(): string; set caller_window(val: string); /** * The string handle of the caller's window. * * The caller window indicates to the prompt which window is prompting the * user. The prompt may choose to ignore this information or use it in whatever * way it sees fit. * * In X11, this will be a stringified version of the XWindow handle; in * Wayland this is the result of an export using the XDG foreign * protocol. * @default null */ get callerWindow(): string; set callerWindow(val: string); /** * The label for the cancel button in the prompt. * @default Cancel */ get cancel_label(): string; set cancel_label(val: string); /** * The label for the cancel button in the prompt. * @default Cancel */ get cancelLabel(): string; set cancelLabel(val: string); /** * Whether the additional choice is chosen or not. * * The additional choice would have been setup using {@link Gcr.Prompt.choice_label}. * @default false */ get choice_chosen(): boolean; set choice_chosen(val: boolean); /** * Whether the additional choice is chosen or not. * * The additional choice would have been setup using {@link Gcr.Prompt.choice_label}. * @default false */ get choiceChosen(): boolean; set choiceChosen(val: boolean); /** * The label for the additional choice. * * If this is a non-`null` value then an additional boolean choice will be * displayed by the prompt allowing the user to select or deselect it. * * If `null`, then no additional choice is displayed. * * The initial value of the choice can be set with {@link Gcr.Prompt.choice_chosen}. * @default null */ get choice_label(): string; set choice_label(val: string); /** * The label for the additional choice. * * If this is a non-`null` value then an additional boolean choice will be * displayed by the prompt allowing the user to select or deselect it. * * If `null`, then no additional choice is displayed. * * The initial value of the choice can be set with {@link Gcr.Prompt.choice_chosen}. * @default null */ get choiceLabel(): string; set choiceLabel(val: string); /** * The label for the continue button in the prompt. * @default Continue */ get continue_label(): string; set continue_label(val: string); /** * The label for the continue button in the prompt. * @default Continue */ get continueLabel(): string; set continueLabel(val: string); /** * The detailed description of the prompt. * * A prompt implementation may choose not to display this detailed description. * The prompt message should contain relevant information. * @default null */ get description(): string; set description(val: string); /** * The prompt message for the user. * * A prompt implementation should always display this message. * @default null */ get message(): string; set message(val: string); /** * Whether the prompt will prompt for a new password. * * This will cause the prompt implementation to ask the user to confirm the * password and/or display other relevant user interface for creating a new * password. * @default false */ get password_new(): boolean; set password_new(val: boolean); /** * Whether the prompt will prompt for a new password. * * This will cause the prompt implementation to ask the user to confirm the * password and/or display other relevant user interface for creating a new * password. * @default false */ get passwordNew(): boolean; set passwordNew(val: boolean); /** * Indication of the password strength. * * Prompts will return a zero value if the password is empty, and a value * greater than zero if the password has any characters. * * This is only valid after a successful prompt for a password. * @read-only * @default 0 */ get password_strength(): number; /** * Indication of the password strength. * * Prompts will return a zero value if the password is empty, and a value * greater than zero if the password has any characters. * * This is only valid after a successful prompt for a password. * @read-only * @default 0 */ get passwordStrength(): number; /** * The title of the prompt. * * A prompt implementation may choose not to display the prompt title. The * {@link Gcr.Prompt.message} should contain relevant information. * @default null */ get title(): string; set title(val: string); /** * A prompt warning displayed on the prompt, or `null` for no warning. * * This is a warning like "The password is incorrect." usually displayed to the * user about a previous 'unsuccessful' prompt. * @default null */ get warning(): string; set warning(val: string); // Methods /** * Closes the prompt so that in can no longer be used to prompt. The various * prompt methods will return results as if the user dismissed the prompt. * * The prompt may also be closed by the implementor of the prompt object. * * This emits the `Gcr.Prompt::prompt-close` signal on the prompt object. */ close(): void; /** * Prompts for confirmation asking a cancel/continue style question. * Set the various properties on the prompt before calling this function to * represent the question correctly. * * This method will block until the a response is returned from the prompter. * * {@link Gcr.PromptReply.CONTINUE} will be returned if the user confirms the prompt. The * return value will also be {@link Gcr.PromptReply.CANCEL} if the user cancels or if * an error occurs. Check the `error` argument to tell the difference. * @param cancellable optional cancellation object * @returns the reply from the prompt */ confirm(cancellable: Gio.Cancellable | null): PromptReply; /** * Prompts for confirmation asking a cancel/continue style question. * Set the various properties on the prompt before calling this method to * represent the question correctly. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object */ confirm_async(cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Prompts for confirmation asking a cancel/continue style question. * Set the various properties on the prompt before calling this method to * represent the question correctly. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object * @param callback called when the operation completes */ confirm_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Prompts for confirmation asking a cancel/continue style question. * Set the various properties on the prompt before calling this method to * represent the question correctly. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object * @param callback called when the operation completes */ confirm_async(cancellable: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Complete an operation to prompt for confirmation. * * {@link Gcr.PromptReply.CONTINUE} will be returned if the user confirms the prompt. The * return value will also be {@link Gcr.PromptReply.CANCEL} if the user cancels or if * an error occurs. Check the `error` argument to tell the difference. * @param result asynchronous result passed to callback * @returns the reply from the prompt */ confirm_finish(result: Gio.AsyncResult): PromptReply; /** * Prompts for confirmation asking a cancel/continue style question. * Set the various properties on the prompt before calling this function to * represent the question correctly. * * This method will block until the a response is returned from the prompter * and will run a main loop similar to a `gtk_dialog_run()`. The application * will remain responsive but care must be taken to handle reentrancy issues. * * {@link Gcr.PromptReply.CONTINUE} will be returned if the user confirms the prompt. The * return value will also be {@link Gcr.PromptReply.CANCEL} if the user cancels or if * an error occurs. Check the `error` argument to tell the difference. * @param cancellable optional cancellation object * @returns the reply from the prompt */ confirm_run(cancellable: Gio.Cancellable | null): PromptReply; /** * Get the string handle of the caller's window. * * The caller window indicates to the prompt which window is prompting the * user. The prompt may choose to ignore this information or use it in whatever * way it sees fit. * @returns a newly allocated string containing the string handle of the window. */ get_caller_window(): string; /** * Get the label for the cancel button. * * This is the button that results in a {@link Gcr.PromptReply.CANCEL} reply * from the prompt. * @returns a newly allocated string containing the label */ get_cancel_label(): string; /** * Get whether the additional choice was chosen or not. * * The additional choice would have been setup using * `gcr_prompt_set_choice_label()`. * @returns whether chosen */ get_choice_chosen(): boolean; /** * Get the label for the additional choice. * * This will be `null` if no additional choice is being displayed. * @returns a newly allocated string containing the additional choice or `null` */ get_choice_label(): string; /** * Get the label for the continue button. * * This is the button that results in a {@link Gcr.PromptReply.CONTINUE} reply * from the prompt. * @returns a newly allocated string containing the label */ get_continue_label(): string; /** * Get the detailed description of the prompt. * * A prompt implementation may choose not to display this detailed description. * The prompt message should contain relevant information. * @returns a newly allocated string containing the detailed description of the prompt */ get_description(): string; /** * Gets the prompt message for the user. * * A prompt implementation should always display this message. * @returns a newly allocated string containing the detailed description of the prompt */ get_message(): string; /** * Get whether the prompt will prompt for a new password. * * This will cause the prompt implementation to ask the user to confirm the * password and/or display other relevant user interface for creating a new * password. * @returns whether in new password mode or not */ get_password_new(): boolean; /** * Get indication of the password strength. * * Prompts will return a zero value if the password is empty, and a value * greater than zero if the password has any characters. * * This is only valid after a successful prompt for a password. * @returns zero if the password is empty, greater than zero if not */ get_password_strength(): number; /** * Gets the title of the prompt. * * A prompt implementation may choose not to display the prompt title. The * prompt message should contain relevant information. * @returns a newly allocated string containing the prompt title. */ get_title(): string; /** * Get a prompt warning displayed on the prompt. * * This is a warning like "The password is incorrect." usually displayed to the * user about a previous 'unsuccessful' prompt. * * If this string is `null` then no warning is displayed. * @returns a newly allocated string containing the prompt warning, or `null` if no warning */ get_warning(): string; /** * Prompts for password. Set the various properties on the prompt before calling * this method to explain which password should be entered. * * This method will block until the a response is returned from the prompter. * * A password will be returned if the user enters a password successfully. * The returned password is valid until the next time a method is called * to display another prompt. * * `null` will be returned if the user cancels or if an error occurs. Check the * `error` argument to tell the difference. * @param cancellable optional cancellation object * @returns the password owned by the prompt, or `null` */ password(cancellable: Gio.Cancellable | null): string; /** * Prompts for password. Set the various properties on the prompt before calling * this method to explain which password should be entered. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object */ password_async(cancellable: Gio.Cancellable | null): globalThis.Promise; /** * Prompts for password. Set the various properties on the prompt before calling * this method to explain which password should be entered. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object * @param callback called when the operation completes */ password_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback | null): void; /** * Prompts for password. Set the various properties on the prompt before calling * this method to explain which password should be entered. * * This method will return immediately and complete asynchronously. * @param cancellable optional cancellation object * @param callback called when the operation completes */ password_async(cancellable: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): globalThis.Promise | void; /** * Complete an operation to prompt for a password. * * A password will be returned if the user enters a password successfully. * The returned password is valid until the next time a method is called * to display another prompt. * * `null` will be returned if the user cancels or if an error occurs. Check the * `error` argument to tell the difference. * @param result asynchronous result passed to callback * @returns the password owned by the prompt, or `null` */ password_finish(result: Gio.AsyncResult): string; /** * Prompts for password. Set the various properties on the prompt before calling * this method to explain which password should be entered. * * This method will block until the a response is returned from the prompter * and will run a main loop similar to a `gtk_dialog_run()`. The application * will remain responsive but care must be taken to handle reentrancy issues. * * A password will be returned if the user enters a password successfully. * The returned password is valid until the next time a method is called * to display another prompt. * * `null` will be returned if the user cancels or if an error occurs. Check the * `error` argument to tell the difference. * @param cancellable optional cancellation object * @returns the password owned by the prompt, or `null` */ password_run(cancellable: Gio.Cancellable | null): string; /** * Reset the contents and properties of the prompt. */ reset(): void; /** * Set the string handle of the caller's window. * * The caller window indicates to the prompt which window is prompting the * user. The prompt may choose to ignore this information or use it in whatever * way it sees fit. * @param window_id the window id */ set_caller_window(window_id: string): void; /** * Set the label for the continue button. * * This is the button that results in a {@link Gcr.PromptReply.CANCEL} reply * from the prompt. * @param cancel_label the label */ set_cancel_label(cancel_label: string): void; /** * Set whether the additional choice is chosen or not. * * The additional choice should be set up using `gcr_prompt_set_choice_label()`. * @param chosen whether chosen */ set_choice_chosen(chosen: boolean): void; /** * Set the label for the additional choice. * * If this is a non-`null` value then an additional boolean choice will be * displayed by the prompt allowing the user to select or deselect it. * * The initial value of the choice can be set with the * `gcr_prompt_set_choice_label()` method. * * If this is `null`, then no additional choice is being displayed. * @param choice_label the additional choice or `null` */ set_choice_label(choice_label: string | null): void; /** * Set the label for the continue button. * * This is the button that results in a {@link Gcr.PromptReply.CONTINUE} reply * from the prompt. * @param continue_label the label */ set_continue_label(continue_label: string): void; /** * Set the detailed description of the prompt. * * A prompt implementation may choose not to display this detailed description. * Use `gcr_prompt_set_message()` to set a general message containing relevant * information. * @param description the detailed description */ set_description(description: string): void; /** * Sets the prompt message for the user. * * A prompt implementation should always display this message. * @param message the prompt message */ set_message(message: string): void; /** * Set whether the prompt will prompt for a new password. * * This will cause the prompt implementation to ask the user to confirm the * password and/or display other relevant user interface for creating a new * password. * @param new_password whether in new password mode or not */ set_password_new(new_password: boolean): void; /** * Sets the title of the prompt. * * A prompt implementation may choose not to display the prompt title. The * prompt message should contain relevant information. * @param title the prompt title */ set_title(title: string): void; /** * Set a prompt warning displayed on the prompt. * * This is a warning like "The password is incorrect." usually displayed to the * user about a previous 'unsuccessful' prompt. * * If this string is `null` then no warning is displayed. * @param warning the warning or `null` */ set_warning(warning: string | null): void; } export const Prompt: PromptNamespace & { new (): Prompt; // This allows `obj instanceof Prompt` }; /** * Name of the imported GIR library * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188 */ const __name__: string; /** * Version of the imported GIR library * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189 */ const __version__: string; } export default Gcr; // END