Adds the py-jwt wiki to the hub alongside lib and mcp and picks up the regenerated flat lib reference and standardized MCP modules.
194 lines
9.5 KiB
JSON
194 lines
9.5 KiB
JSON
{
|
|
"module": "jwtlib.repository",
|
|
"content": {
|
|
"path": "jwtlib.repository",
|
|
"docstring": "# Summary\n\nUserRepository: Persistence layer for authentication.\n\nThis module defines the MongoDB-backed repository for managing user records,\nincluding creation, lookup, and credential verification.",
|
|
"objects": {
|
|
"LoginRequest": {
|
|
"name": "LoginRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.repository.LoginRequest",
|
|
"signature": null,
|
|
"docstring": "Payload for authenticating a user and issuing a `JWT`.\n\nAttributes:\n username (str):\n Username identifier.\n password (str):\n Plain-text password to be verified.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.LoginRequest.model_config",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.LoginRequest.username",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.LoginRequest.password",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"PublicUser": {
|
|
"name": "PublicUser",
|
|
"kind": "class",
|
|
"path": "jwtlib.repository.PublicUser",
|
|
"signature": null,
|
|
"docstring": "Public-facing user representation returned by authentication APIs.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n is_active (bool):\n Whether the user account is active.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.PublicUser.model_config",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.PublicUser.username",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.PublicUser.email",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.PublicUser.is_active",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"RegisterRequest": {
|
|
"name": "RegisterRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.repository.RegisterRequest",
|
|
"signature": null,
|
|
"docstring": "Payload for registering a new user account.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n password (str):\n Plain-text password (to be hashed by the repository layer).",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.RegisterRequest.model_config",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.RegisterRequest.username",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.RegisterRequest.email",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.RegisterRequest.password",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"User": {
|
|
"name": "User",
|
|
"kind": "class",
|
|
"path": "jwtlib.repository.User",
|
|
"signature": null,
|
|
"docstring": "Internal user persistence model.\n\nAttributes:\n hashed_password (str):\n Secure hash of the user's password.\n\nNotes:\n **Responsibilities:**\n\n - Represents a user record as stored in the database. Includes\n sensitive fields and is strictly confined to the persistence\n layer.\n\n **Guarantees:**\n\n - This model MUST NOT be returned from authentication APIs.\n Consumers should use `PublicUser` instead. Password verification\n is handled by the repository layer.",
|
|
"members": {
|
|
"hashed_password": {
|
|
"name": "hashed_password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.User.hashed_password",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"create_access_token": {
|
|
"name": "create_access_token",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.create_access_token",
|
|
"signature": "create_access_token(data: dict[str, object], expires_delta: timedelta | None = None)",
|
|
"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."
|
|
},
|
|
"hash_password": {
|
|
"name": "hash_password",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.hash_password",
|
|
"signature": "hash_password(password: str)",
|
|
"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.repository.verify_password",
|
|
"signature": "verify_password(plain_password: str, hashed_password: str)",
|
|
"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."
|
|
},
|
|
"UserRepository": {
|
|
"name": "UserRepository",
|
|
"kind": "class",
|
|
"path": "jwtlib.repository.UserRepository",
|
|
"signature": "UserRepository()",
|
|
"docstring": "MongoDB-backed repository for `User` documents.\n\nNotes:\n **Responsibilities:**\n\n - Manage user persistence (CRUD).\n - Handle credential verification and token issuance.",
|
|
"members": {
|
|
"create": {
|
|
"name": "create",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.UserRepository.create",
|
|
"signature": "create(user_create: RegisterRequest) -> PublicUser",
|
|
"docstring": "Create a new user record.\n\nArgs:\n user_create (RegisterRequest):\n Registration data including prospective password.\n\nReturns:\n PublicUser:\n A PublicUser representation of the created user."
|
|
},
|
|
"get_by_username": {
|
|
"name": "get_by_username",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.UserRepository.get_by_username",
|
|
"signature": "get_by_username(username: str) -> User | None",
|
|
"docstring": "Retrieve a user by their unique username.\n\nArgs:\n username (str):\n The username to search for.\n\nReturns:\n User | None:\n The User document if found, otherwise None."
|
|
},
|
|
"get_by_email": {
|
|
"name": "get_by_email",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.UserRepository.get_by_email",
|
|
"signature": "get_by_email(email: str) -> User | None",
|
|
"docstring": "Retrieve a user by their unique email address.\n\nArgs:\n email (str):\n The email address to search for.\n\nReturns:\n User | None:\n The User document if found, otherwise None."
|
|
},
|
|
"get_active_users": {
|
|
"name": "get_active_users",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.UserRepository.get_active_users",
|
|
"signature": "get_active_users(skip: int = 0, limit: int = 100) -> list[User]",
|
|
"docstring": "List all active users with pagination.\n\nArgs:\n skip (int):\n Number of records to skip.\n limit (int):\n Maximum number of records to return.\n\nReturns:\n list[User]:\n A list of active User documents."
|
|
},
|
|
"authenticate_user": {
|
|
"name": "authenticate_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.UserRepository.authenticate_user",
|
|
"signature": "authenticate_user(user_auth: LoginRequest) -> dict[str, object] | None",
|
|
"docstring": "Verify user credentials and prepare a login response.\n\nArgs:\n user_auth (LoginRequest):\n Login credentials.\n\nReturns:\n dict | None:\n A dictionary containing the access token and public user if successful, otherwise None."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |