refactor(credentials): add cp.Credentials LuaCATS class

This commit is contained in:
Barrett Ruth 2026-03-07 19:50:34 -05:00
parent 5aa2c024e0
commit 0d06d5cb89
Signed by: barrett
GPG key ID: A6C96C9349D2FC81

View file

@ -1,3 +1,8 @@
---@class cp.Credentials
---@field username string
---@field password string
---@field token? string
local M = {}
local HOSTS = {
@ -53,7 +58,7 @@ local function _parse_output(stdout)
end
---@param platform string
---@return { username: string, password: string, token?: string }?
---@return cp.Credentials?
function M.get(platform)
local host = HOSTS[platform]
if not host then
@ -92,7 +97,7 @@ function M.get(platform)
end
---@param platform string
---@param creds { username: string, password: string, token?: string }
---@param creds cp.Credentials
function M.store(platform, creds)
local host = HOSTS[platform]
if not host then
@ -110,7 +115,7 @@ function M.store(platform, creds)
end
---@param platform string
---@param creds { username: string, password: string, token?: string }
---@param creds cp.Credentials
function M.reject(platform, creds)
local host = HOSTS[platform]
if not host or not creds then