memory-privacy 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/identity.ts +5 -2
  2. package/package.json +1 -1
package/identity.ts CHANGED
@@ -35,10 +35,13 @@ export function resolveSessionIdentity(sessionKey: string | undefined): SessionI
35
35
 
36
36
  /**
37
37
  * 判断 userId 是否是主人
38
- * 从环境变量 owner_claw_user_id 获取主人 ID
38
+ * 从环境变量 OPENCLAW_GATEWAY_TOKEN 获取并解析主人 ID
39
+ * token 格式如 "oc-user-f76e8c98afb148539963c1b726f2afac",用 "-" 切分取最后一段作为 owner ID
39
40
  */
40
41
  export function isOwner(userId: string): boolean {
41
- const ownerUserId = process.env.owner_claw_user_id || "";
42
+ const token = process.env.OPENCLAW_GATEWAY_TOKEN || "";
43
+ if (!token) return false;
44
+ const ownerUserId = token.split("-").pop() || "";
42
45
  if (!ownerUserId) return false;
43
46
  return ownerUserId === userId;
44
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memory-privacy",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "files": [