Appearance
密码管理
用户自定义的固定密码,通过门锁键盘输入验证开锁。
离线密码
算法生成的离线密码无需通过指令添加,详见 离线密码。
指令列表
| 指令码 | 名称 | 方向 | 说明 |
|---|---|---|---|
0x0500 | ListPasswords | APP → 设备 | 获取密码列表 |
0x0501 | GetPassword | APP → 设备 | 获取密码详情 |
0x0502 | AddPassword | APP → 设备 | 添加密码 |
0x0503 | UpdatePassword | APP → 设备 | 更新密码 |
0x0504 | DeletePassword | APP → 设备 | 删除密码 |
0x0505 | ClearPasswords | APP → 设备 | 清空所有密码 |
数据结构
protobuf
message Password {
uint32 credential_id = 1; // 凭证ID(锁内唯一)
uint32 user_id = 2; // 归属用户ID
string password = 3; // 密码内容(4-10位数字)
uint32 created_by = 4; // 创建者用户ID
uint64 created_at = 5; // 创建时间(UNIX毫秒时间戳)
ValidityPeriod validity = 6; // 有效期
uint32 use_count_limit = 7; // 使用次数限制(0=不限)
uint32 use_count = 8; // 已使用次数
string label = 9; // 标签
bool is_duress = 10; // 是否胁迫凭证
}| 字段 | 类型 | 说明 |
|---|---|---|
credential_id | uint32 | 凭证ID,锁内唯一标识 |
user_id | uint32 | 归属用户ID |
password | string | 密码内容,4-10 位纯数字 |
created_by | uint32 | 创建者用户ID |
created_at | uint64 | 创建时间(UNIX毫秒时间戳) |
validity | ValidityPeriod | 有效期,详见 凭证期限 |
use_count_limit | uint32 | 使用次数限制,0 表示不限制 |
use_count | uint32 | 已使用次数 |
label | string | 用户自定义标签 |
is_duress | bool | 是否胁迫凭证 |
密码规则
| 规则 | 说明 |
|---|---|
| 长度 | 4-10 位 |
| 字符 | 纯数字 0-9 |
| 唯一性 | 同一门锁内密码不可重复 |
安全建议
避免使用简单密码如 123456、000000、生日等易被猜测的组合。
ListPasswords - 获取密码列表
指令码: 0x0500
ListPasswordsReq
protobuf
message ListPasswordsReq {
optional uint32 user_id = 1; // 按用户ID筛选(不指定则返回所有)
}ListPasswordsResp
protobuf
message ListPasswordsResp {
uint32 code = 1;
string message = 2;
repeated Password passwords = 3; // 密码列表
}密码脱敏
列表查询时 password 字段返回脱敏内容(如 12****56),完整密码需通过 GetPassword 获取。
GetPassword - 获取密码详情
指令码: 0x0501
GetPasswordReq
protobuf
message GetPasswordReq {
uint32 credential_id = 1; // 凭证ID
}GetPasswordResp
protobuf
message GetPasswordResp {
uint32 code = 1;
string message = 2;
Password password = 3; // 密码详情(含完整密码)
}AddPassword - 添加密码
指令码: 0x0502
AddPasswordReq
protobuf
message AddPasswordReq {
string password = 1; // 密码内容(4-10位数字,必填)
optional uint32 user_id = 2; // 归属用户ID(不指定则自动创建用户)
optional ValidityPeriod validity = 3; // 有效期
optional uint32 use_count_limit = 4; // 使用次数限制
optional string label = 5; // 标签
optional bool is_duress = 6; // 是否胁迫凭证
}| 字段 | 必填 | 说明 |
|---|---|---|
password | 是 | 4-10 位纯数字 |
user_id | 否 | 不指定时自动创建新用户 |
validity | 否 | 不指定时永久有效 |
use_count_limit | 否 | 默认 0(不限制) |
label | 否 | 默认空字符串 |
is_duress | 否 | 默认 false |
AddPasswordResp
protobuf
message AddPasswordResp {
uint32 code = 1;
string message = 2;
uint32 credential_id = 3; // 新建的凭证ID
uint32 user_id = 4; // 归属用户ID
}UpdatePassword - 更新密码
指令码: 0x0503
密码可更新
与生物特征凭证不同,密码内容本身可以通过 UpdatePassword 修改。
UpdatePasswordReq
protobuf
message UpdatePasswordReq {
uint32 credential_id = 1; // 凭证ID(必填)
optional string password = 2; // 新密码内容
optional ValidityPeriod validity = 3; // 有效期
optional uint32 use_count_limit = 4; // 使用次数限制
optional string label = 5; // 标签
optional bool is_duress = 6; // 是否胁迫凭证
}UpdatePasswordResp
protobuf
message UpdatePasswordResp {
uint32 code = 1;
string message = 2;
}DeletePassword - 删除密码
指令码: 0x0504
DeletePasswordReq
protobuf
message DeletePasswordReq {
uint32 credential_id = 1; // 凭证ID
}DeletePasswordResp
protobuf
message DeletePasswordResp {
uint32 code = 1;
string message = 2;
}ClearPasswords - 清空所有密码
指令码: 0x0505
危险操作
此操作将删除门锁上所有自定义密码,不可恢复。离线密码不受影响。
ClearPasswordsReq
protobuf
message ClearPasswordsReq {
// 无参数
}ClearPasswordsResp
protobuf
message ClearPasswordsResp {
uint32 code = 1;
string message = 2;
uint32 count = 3; // 删除的数量
}