跳到主要内容

钥匙串模块

钥匙串模块管理用户的密码、账号等敏感信息。

数据结构

interface KeychainItem {
id: string
name: string // 名称
url?: string // 关联网址
phone?: string // 手机号
email?: string // 邮箱
password: string // 密码
note?: string // 备注
createdAt: string
updatedAt: string
}

IPC 通道

通道参数返回
keychain-get-all-KeychainItem[]
keychain-createPartial<KeychainItem>KeychainItem
keychain-updateid, Partial<KeychainItem>KeychainItem
keychain-deleteidboolean

在元宇宙中使用

const api = getWtElectronAPI()

// 加载所有钥匙
const items = await api.keychain.getAll()

// 创建
await api.keychain.create({
name: 'GitHub',
url: 'https://github.com',
password: 'xxxxx',
})

// 更新
await api.keychain.update(id, { name: '新名称' })

// 删除
await api.keychain.remove(id)

特性

  • 密码脱敏显示(••••••••)
  • 一键复制字段
  • 搜索过滤
  • 展开详情查看