多字段凭据
凭据也是内置的 credential 卡片类型。通用字段视图将普通凭据元数据映射为普通字段,将秘密正文中的字段映射为 sensitive,读取时不会重写旧格式的字节。memories card field 支持相同的有序模式;成功的文本字段编辑会保留现有使用方所需的结构化凭据正文。二进制旧格式凭据会拒绝通用字段迁移,以免丢失字节。
一个凭据可以包含多个独立的可选字段。所有字段都可以为空。
| 字段 | 是否为秘密 | 存储位置 |
|---|---|---|
username |
否 | Content.credential.username |
url |
否 | Content.credential.url |
notes |
否 | Content.credential.notes |
自定义,secret: false |
否 | Content.credential.custom[] |
password |
是 | 加密正文 |
otp(base32 种子或 otpauth:// URI) |
是 | 加密正文;种子参数位于 Content.credential.otp |
api_key |
是 | 加密正文 |
自定义,secret: true |
是 | 加密正文 |
Content.credential(非秘密,可以安全地列出):
{
"username": "octo",
"url": "https://github.com",
"notes": "work account",
"custom": [{"name": "team", "value": "core"}],
"secret_fields": ["password", "otp", "api_key", "pin"],
"otp": {"digits": 6, "period": 30, "algorithm": "sha1"}
}
结构化正文(使用保险库加密,在 body 中采用 base64url 编码):
{"memories.credential": 2, "password": "…", "otp": "…", "api_key": "…",
"custom": [{"name": "pin", "value": "…"}]}
兼容性与迁移
- 旧格式凭据在
body中保留原始秘密字节,并按原样读取:otpauth://值或以OTP:开头的标题映射到otp;具有 HTTP 身份验证或允许主机的凭据映射到api_key;其他情况映射到password。二进制旧格式秘密(密钥、证书)仍然照常工作,只是没有文本字段。 - 所有现有的单秘密使用方(不带
--field的credential copy、HTTP 注入、运行绑定、代理、登录导出)均使用主要秘密:旧格式字节,或者按 password、api_key、otp、第一个秘密自定义字段的顺序选取首个非空值。 - 迁移按需进行:对旧格式凭据执行任何
credential_set写入,都会将其重写为结构化格式,并将旧值放入映射的字段。memories credential migrate VAULT ASSET仅执行此转换,不做其他更改。先前修订保留在历史记录中,因此不会丢失数据。
CLI
memories credential set VAULT [ASSET] [--title T] [--username U] [--url U] [--notes N]
[--password] [--api-key] [--otp [--otp-digits 6|8] [--otp-period 30|60] [--otp-algorithm sha1|sha256|sha512]]
[--field NAME=VALUE]... [--secret-field NAME]... [--remove NAME]...
memories credential show VAULT ASSET # non-secret fields + names of secret fields
memories credential get VAULT ASSET --field NAME [--reveal] # secret fields need --reveal
memories credential copy VAULT ASSET [--field NAME] # clipboard, never printed
memories credential otp VAULT ASSET # code from the otp field
memories credential migrate VAULT ASSET
秘密值只能通过隐藏输入提示(--password、--api-key、--otp、--secret-field)输入,绝不作为参数传递。空输入会清除该字段。
服务请求
credential_set {vault, asset?, title?, fields: {username?, password?, otp?, otp_params?, api_key?, url?, notes?, custom: [{name, value, secret}], remove: [name]}}—null/缺省表示保留字段,""表示清除字段。需要提权。credential_show {vault, asset}— 非秘密视图;需要提权。credential_copy {vault, asset, label?, field?}— 单个字段(审计事件为credential.field.copy);需要提权。otp_code {vault, asset}— 也接受带有otp字段的凭据。
托管作用域:credential_show/credential_copy 需要读取权限,credential_set 需要写入权限。
MCP
credential_fields(read 授权):返回非秘密字段和秘密字段的名称,绝不返回秘密值。credential_reveal(allow_all 授权):返回单个字段;要求intent: "reveal_plaintext"和简短的reason。审计事件为credential.field.reveal。MCP 不提供完整秘密复制功能。sealed_reveal对密封的结构化凭据接受可选的field。
托管 Center 与端到端同步
托管 Center RPC 接受 credential_show(读取)和 credential_set(写入)。对于端到端(e2e)凭据,Center 的副本可能只包含描述信息:credential_set 拒绝任何非空秘密字段,秘密值仅在为设备密封的信封内传输。
密封的结构化凭据,其明文可以是结构化正文本身,也可以是 {"meta": <non-secret fields>, "body": "<structured body>"}。在已配对设备上:
memories device sealed-get --vault V --card C --field username
memories device sealed-get --vault V --card C --field password --reveal
memories device sealed-get --vault V --card C --otp
不使用 --reveal/--field/--otp 时,只输出描述信息和秘密字段名称。旧格式单秘密信封的行为与以前相同。
移动端
新建凭据时会打开分区表单(登录、一次性验证码、API、更多,以及带秘密开关的自定义字段)。所有字段均为可选;名称默认使用用户名或 URL 主机,仅在保存时仍为空才提示输入。详情视图直接复制普通字段;启用生物识别保护时,秘密字段和实时 OTP 验证码(带倒计时)需要系统解锁验证。