secret_values#

class litestar.datastructures.secret_values.SecretBytes#

Bases: SecretValue[bytes]

Represents a secret bytes value.

get_obscured() bytes#

Overrides the base class method to return the hidden bytes value.

Returns:

The hidden bytes representation of the secret value.

Return type:

bytes

class litestar.datastructures.secret_values.SecretString#

Bases: SecretValue[str]

Represents a secret string value.

get_obscured() str#

Overrides the base class method to return the hidden string value.

Returns:

The hidden string representation of the secret value.

Return type:

str

class litestar.datastructures.secret_values.SecretT#

Type that represents a secret value of type str or bytes.

alias of TypeVar(‘SecretT’, bound=Union[str, bytes])

class litestar.datastructures.secret_values.SecretValue#

Bases: ABC, Generic[SecretT]

Represents a secret value that can be of type str or bytes.

__init__(secret_value: SecretT) None#

Initializes a SecretValue object with a secret value of type str or bytes.

Parameters:

secret_value (str | bytes) – The secret value to be encapsulated.

get_secret() SecretT#

Returns the actual secret value.

Returns:

The secret value.

Return type:

str | bytes

abstract get_obscured() SecretT#

Return the hidden representation of the secret value.

Raises:

NotImplementedError – Always raised to enforce implementation in subclasses.

__str__() str#

Returns a string representation of the hidden secret value.

Returns:

String representation of the hidden secret value.

Return type:

str

__repr__() str#

Returns a string representation of the object for debugging purposes.

Returns:

String representation of the object.

Return type:

str