auth.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ---@meta
  2. ---Authentication handler definition
  3. ------------------------------------
  4. -- Used by `minetest.register_authentication_handler`.
  5. ---@class mt.AuthHandlerDef
  6. local auth = {}
  7. -- Get authentication data for existing player `name` (`nil` if player doesn't exist).
  8. ---@param name string
  9. ---@return {password:string, privileges:table, last_login:number|nil}
  10. function auth.get_auth(name) end
  11. -- * Create new auth data for player `name`.
  12. -- * Note that `password` is not plain-text but an arbitrary
  13. -- representation decided by the engine.
  14. ---@param name string
  15. ---@param password string
  16. function auth.create_auth(name, password) end
  17. -- * Delete auth data of player `name`.
  18. -- * Returns boolean indicating success (false if player is nonexistent).
  19. ---@param name string
  20. ---@return boolean success
  21. function auth.delete_auth(name) end
  22. -- * Set password of player `name` to `password`.
  23. -- * Auth data should be created if not present.
  24. ---@param name string
  25. ---@param password string
  26. function auth.set_password(name, password) end
  27. -- * Set privileges of player `name`.
  28. -- * Auth data should be created if not present.
  29. ---@param name string
  30. ---@param privileges table
  31. function auth.set_privileges(name, privileges) end
  32. -- * Reload authentication data from the storage location.
  33. -- * Returns boolean indicating success.
  34. function auth.reload() end
  35. -- Called when player joins, used for keeping track of last_login.
  36. ---@param name string
  37. function auth.record_login(name) end
  38. -- Returns an iterator (use with `for` loops) for all player names
  39. -- currently in the auth database.
  40. ---@return function
  41. function auth.iterate() end