Skip to content

Gio.TlsPassword

class — extends GObject.Object

An abstract interface representing a password used in TLS. Often used in user interaction such as unlocking a key storage token.

Constructors

new

@classmethod
def new(cls, flags: TlsPasswordFlags | int, description: str) -> TlsPassword

Create a new TlsPassword object.

Parameters:

  • flags — the password flags
  • description — description of what the password is for

Methods

get_description

def get_description(self) -> str

Get a description string about what the password will be used for.

get_flags

def get_flags(self) -> TlsPasswordFlags

Get flags about the password.

get_value

def get_value(self) -> list[int]

Get the password value. If length is not None then it will be filled in with the length of the password value. (Note that the password value is not nul-terminated, so you can only pass None for length in contexts where you know the password will have a certain fixed length.)

get_warning

def get_warning(self) -> str

Get a user readable translated warning. Usually this warning is a representation of the password flags returned from TlsPassword.get_flags.

set_description

def set_description(self, description: str) -> None

Set a description string about what the password will be used for.

Parameters:

  • description — The description of the password

set_flags

def set_flags(self, flags: TlsPasswordFlags | int) -> None

Set flags about the password.

Parameters:

  • flags — The flags about the password

set_value

def set_value(self, value: list[int]) -> None

Set the value for this password. The value will be copied by the password object.

Specify the length, for a non-nul-terminated password. Pass -1 as length if using a nul-terminated password, and length will be calculated automatically. (Note that the terminating nul is not considered part of the password in this case.)

Parameters:

  • value — the new password value

set_value_full

def set_value_full(self, value: list[int], destroy: GLib.DestroyNotify | None = ...) -> None

Provide the value for this password.

The value will be owned by the password object, and later freed using the destroy function callback.

Specify the length, for a non-nul-terminated password. Pass -1 as length if using a nul-terminated password, and length will be calculated automatically. (Note that the terminating nul is not considered part of the password in this case.)

Parameters:

  • value — the value for the password
  • destroy — a function to use to free the password.

set_warning

def set_warning(self, warning: str) -> None

Set a user readable translated warning. Usually this warning is a representation of the password flags returned from TlsPassword.get_flags.

Parameters:

  • warning — The user readable warning

Virtual methods

do_get_default_warning

def do_get_default_warning(self) -> str

virtual method for TlsPassword.get_warning if no value has been set using TlsPassword.set_warning

do_get_value

def do_get_value(self) -> list[int]

Get the password value. If length is not None then it will be filled in with the length of the password value. (Note that the password value is not nul-terminated, so you can only pass None for length in contexts where you know the password will have a certain fixed length.)

do_set_value

def do_set_value(self, value: list[int], destroy: GLib.DestroyNotify | None = ...) -> None

Provide the value for this password.

The value will be owned by the password object, and later freed using the destroy function callback.

Specify the length, for a non-nul-terminated password. Pass -1 as length if using a nul-terminated password, and length will be calculated automatically. (Note that the terminating nul is not considered part of the password in this case.)

Parameters:

  • value — the value for the password
  • destroy — a function to use to free the password.

Properties

description

description: str  # read/write

Description of what the password is for.

flags

flags: TlsPasswordFlags | int  # read/write

Flags about the password.

warning

warning: str  # read/write

Warning about the password.