djblets.secrets.token_generators.vendor_checksum¶
Generator for tokens that contain an identifiable prefix and checksum.
New in version 3.0.
- class VendorChecksumTokenGenerator[source]¶
Bases:
BaseTokenGenerator
Generator for tokens that contain an identifiable prefix and checksum.
Tokens of this format contain a prefix for identification (such as the vendor or type) and a checksum.
New in version 3.0.
- token_generator_id: Optional[str] = 'vendor_checksum'[source]¶
The unique ID of the token generator, for registration purposes.
- Type:
- CHARSET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'[source]¶
The character set to use for encoding the token.
- Type:
- create_token(token_info: Dict[str, Any] = {}, **kwargs) str [source]¶
Create a token that contains a prefix and checksum.
- Parameters:
- Returns:
The token value.
- Return type:
- Raises:
KeyError – The
token_info
dictionary is missing a required key.
- validate_token(token: str, token_info: Dict[str, Any] = {}, **kwargs) bool [source]¶
Return whether the token is a valid token from this generator.
- Parameters:
- Returns:
Whether the token is a valid token from this generator.
- Return type:
- __annotations__ = {'token_generator_id': 'Optional[str]'}¶