pymap.user

class pymap.user.Passwords(config)[source]

Helper utility for performing password operations in a CPU bound pool.

Parameters:

config (IMAPConfig) – The IMAP config object.

async hash_password(password: str) str[source]
async hash_password(password: None) None

Hash the given password using the configured hash algorithm.

Parameters:

password – The password string to hash.

async check_password(identity, credentials)[source]

Check the credentials against the SASL identity.

Parameters:
Return type:

bool

class pymap.user.UserMetadata(config, name, entity_tag=None, previous_entity_tag=None, password=None, token_key=None, roles=frozenset({}), params=<pymap.frozen.FrozenDict object>)[source]

Defines the attributes associated with a user identity.

Parameters:
config: IMAPConfig

The config object.

name: str

The user identity name.

entity_tag: int | None = None

The entity tag of the current version of this metadata.

previous_entity_tag: int | None = None

The entity tag of the previous version of this metadata.

password: str | None = None

The password string or hash digest.

token_key: bytes | None = None

The private key used to verify tokens.

roles: frozenset[str] = frozenset({})

The set of roles assigned to the user.

params: frozendict[str, str] = <pymap.frozen.FrozenDict object>

Additional parameters associated with the user.

property authcid: str

The authentication identity, e.g. a login username.

compare_authcid(authcid)[source]

Compare the identity’s authcid with the given authcid.

Parameters:

authcid (str) – The authentication identity string value.

Return type:

bool

compare_secret(value)[source]

Compare the identity’s secret with the given secret. The comparison must account for things like hashing or token algorithms.

Parameters:
  • secret – The authentication secret string value.

  • value (str)

Return type:

bool

get_clear_secret()[source]

Return the cleartext secret string if it is available.

Return type:

str | None

classmethod new_entity_tag()[source]

Generate a new random value for entity_tag.

Return type:

int