{ "module": "jwtlib.security", "content": { "path": "jwtlib.security", "docstring": "# Summary\n\nSecurity utilities: Password hashing and `JWT` management.\n\nThis module provides low-level cryptographic helpers for password\nhashing and `JWT` token lifecycle management. It serves as the\ncryptographic engine for the authentication library.", "objects": { "os": { "name": "os", "kind": "alias", "path": "jwtlib.security.os", "signature": "", "docstring": null }, "datetime": { "name": "datetime", "kind": "alias", "path": "jwtlib.security.datetime", "signature": "", "docstring": null }, "timedelta": { "name": "timedelta", "kind": "alias", "path": "jwtlib.security.timedelta", "signature": "", "docstring": null }, "JWTError": { "name": "JWTError", "kind": "alias", "path": "jwtlib.security.JWTError", "signature": "", "docstring": null }, "jwt": { "name": "jwt", "kind": "alias", "path": "jwtlib.security.jwt", "signature": "", "docstring": null }, "CryptContext": { "name": "CryptContext", "kind": "alias", "path": "jwtlib.security.CryptContext", "signature": "", "docstring": null }, "TokenPayload": { "name": "TokenPayload", "kind": "class", "path": "jwtlib.security.TokenPayload", "signature": "", "docstring": "Decoded `JWT` payload.\n\nAttributes:\n sub (str):\n Subject claim identifying the user (typically a username or user ID).\n exp (int):\n Expiration time as a Unix timestamp (seconds since epoch).\n\nNotes:\n **Responsibilities:**\n\n - Represents the validated claims extracted from a `JWT` after\n signature verification. This model is used internally to enforce\n required claims and provide a typed interface to token data.\n\n **Guarantees:**\n\n - This model assumes the `JWT` signature has already been verified.\n No authorization decisions should be made solely on this model.\n Additional claims may exist but are intentionally ignored.", "members": { "sub": { "name": "sub", "kind": "attribute", "path": "jwtlib.security.TokenPayload.sub", "signature": "", "docstring": null }, "exp": { "name": "exp", "kind": "attribute", "path": "jwtlib.security.TokenPayload.exp", "signature": "", "docstring": null } } }, "SECRET_KEY": { "name": "SECRET_KEY", "kind": "attribute", "path": "jwtlib.security.SECRET_KEY", "signature": null, "docstring": null }, "ALGORITHM": { "name": "ALGORITHM", "kind": "attribute", "path": "jwtlib.security.ALGORITHM", "signature": null, "docstring": null }, "ACCESS_TOKEN_EXPIRE_MINUTES": { "name": "ACCESS_TOKEN_EXPIRE_MINUTES", "kind": "attribute", "path": "jwtlib.security.ACCESS_TOKEN_EXPIRE_MINUTES", "signature": null, "docstring": null }, "pwd_context": { "name": "pwd_context", "kind": "attribute", "path": "jwtlib.security.pwd_context", "signature": null, "docstring": null }, "hash_password": { "name": "hash_password", "kind": "function", "path": "jwtlib.security.hash_password", "signature": "", "docstring": "Hash a plain-text password using the configured crypt context.\n\nArgs:\n password (str):\n The plain-text password to hash.\n\nReturns:\n str:\n The secure hash string." }, "verify_password": { "name": "verify_password", "kind": "function", "path": "jwtlib.security.verify_password", "signature": "", "docstring": "Verify a plain-text password against a stored hash.\n\nArgs:\n plain_password (str):\n The unhashed password provided by the user.\n hashed_password (str):\n The secure hash to verify against.\n\nReturns:\n bool:\n True if the password is valid, False otherwise." }, "create_access_token": { "name": "create_access_token", "kind": "function", "path": "jwtlib.security.create_access_token", "signature": "", "docstring": "Generate a new `JWT` access token.\n\nArgs:\n data (dict):\n Subject data to include in the token payload.\n expires_delta (timedelta | None):\n Optional expiration override.\n\nReturns:\n str:\n An encoded `JWT` string." }, "get_jwt_payload": { "name": "get_jwt_payload", "kind": "function", "path": "jwtlib.security.get_jwt_payload", "signature": "", "docstring": "Decode and validate a `JWT`, returning a strongly-typed payload.\n\nArgs:\n token (str):\n The `JWT` string to decode.\n\nReturns:\n TokenPayload:\n The decoded and typed token payload.\n\nRaises:\n JWTError:\n If the token is invalid, expired, or malformed." } } } }