feat(client): 新增家属端设备查询与端隔离鉴权
- 新增 ClientController,支持已绑定设备的信息、定位、应用与截图查询 - JWT 增加 clientType 标识,实现 admin/client 端鉴权隔离 - client 端支持独立配置令牌有效期,并在刷新时按端解析 TTL - 截图列表仅返回最近 20 条并规范化访问 URL 前缀
This commit is contained in:
@@ -102,6 +102,22 @@ public class HashUtils {
|
||||
return bytesToHex(hashBytes, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算字节数组的 SHA256 哈希值
|
||||
*
|
||||
* @param data 字节数组
|
||||
* @return SHA256 哈希值(小写十六进制字符串)
|
||||
*/
|
||||
public static String sha256(byte[] data) {
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
||||
byte[] hashBytes = digest.digest(data);
|
||||
return bytesToHex(hashBytes);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException("SHA-256 algorithm not found", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String calculateSHA256(File file) throws NoSuchAlgorithmException, IOException {
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
||||
try (InputStream inputStream = new FileInputStream(file)) {
|
||||
|
||||
Reference in New Issue
Block a user