Module: EasyAI::Base::SystemKeychain

Defined in:
lib/easyai/base/system_keychain.rb

Constant Summary collapse

SERVICE_NAME =
"easyai"
ACCOUNT_NAME =
"config_password"

Class Method Summary collapse

Class Method Details

.delete_stored_passwordObject

跨平台密码删除



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/easyai/base/system_keychain.rb', line 41

def self.delete_stored_password
  case SystemInfo.platform
  when :macos
    delete_password_macos
  when :windows
    delete_password_windows
  when :linux
    delete_password_linux
  else
    true
  end
end

.detect_platformObject

检测操作系统平台(已迁移到 SystemInfo)



55
56
57
# File 'lib/easyai/base/system_keychain.rb', line 55

def self.detect_platform
  SystemInfo.platform
end

.get_stored_passwordObject

跨平台密码获取



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/easyai/base/system_keychain.rb', line 27

def self.get_stored_password
  case SystemInfo.platform
  when :macos
    get_password_macos
  when :windows
    get_password_windows
  when :linux
    get_password_linux
  else
    nil
  end
end

.store_password(password) ⇒ Object

跨平台密码存储



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/easyai/base/system_keychain.rb', line 12

def self.store_password(password)
  case SystemInfo.platform
  when :macos
    store_password_macos(password)
  when :windows
    store_password_windows(password)
  when :linux
    store_password_linux(password)
  else
    puts "⚠ 当前平台不支持密码自动存储,将在会话中临时保存"
    false
  end
end