module documentation
Remove sensitive parts from tokens.
This module masks signatures and other sensitive token parts. It keeps useful nonsensitive parts visible. It supports Nebius IAM tokens and JWT tokens. Token-version definitions specify prefixes, delimiters, and signature positions.
| Class | |
Identify token versions from a predefined mapping. |
| Class | |
Mask sensitive token parts according to the token version. |
| Class | |
Describe the structure of a token version. |
| Class | |
Define the interface that identifies a token version. |
| Function | sanitize |
Limit the visible payload of a token that has no signature. |
| Function | sanitize |
Limit the visible part of an unrecognized token. |
| Constant | ACCESS |
Supported access-token formats. |
| Constant | CREDENTIALS |
Supported credential formats. |
| Constant | MASK |
The mask printed instead of sensitive parts of tokens. |
| Constant | MAX |
Maximum length of visible payload before masking. |
| Constant | NO |
Constant indicating no signature position in the token. |
Limit the visible payload of a token that has no signature.
Return the complete token if its payload is not too long. Otherwise,
replace the end of the payload with MASK_STRING.
| Parameters | |
token:str | The full token string. |
prefix:str | The prefix of the token version. |
| Returns | |
str | The sanitized token. |
Supported access-token formats.
The keys are version names. The values describe each format.
| Value |
|
Supported credential formats.
The mapping contains all access-token formats, DE1, and JWT.
| Value |
|