@membox-cloud/membox 0.1.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 (117) hide show
  1. package/README.md +169 -0
  2. package/dist/index.d.ts +8 -0
  3. package/dist/index.js +159 -0
  4. package/dist/src/api/account.d.ts +3 -0
  5. package/dist/src/api/account.js +3 -0
  6. package/dist/src/api/client.d.ts +21 -0
  7. package/dist/src/api/client.js +107 -0
  8. package/dist/src/api/device-flow.d.ts +9 -0
  9. package/dist/src/api/device-flow.js +55 -0
  10. package/dist/src/api/devices.d.ts +10 -0
  11. package/dist/src/api/devices.js +24 -0
  12. package/dist/src/api/recovery.d.ts +5 -0
  13. package/dist/src/api/recovery.js +9 -0
  14. package/dist/src/api/sync.d.ts +9 -0
  15. package/dist/src/api/sync.js +22 -0
  16. package/dist/src/cli/bootstrap.d.ts +37 -0
  17. package/dist/src/cli/bootstrap.js +326 -0
  18. package/dist/src/cli/grants.d.ts +8 -0
  19. package/dist/src/cli/grants.js +76 -0
  20. package/dist/src/cli/helpers.d.ts +6 -0
  21. package/dist/src/cli/helpers.js +13 -0
  22. package/dist/src/cli/passphrase-input.d.ts +11 -0
  23. package/dist/src/cli/passphrase-input.js +94 -0
  24. package/dist/src/cli/pause.d.ts +2 -0
  25. package/dist/src/cli/pause.js +29 -0
  26. package/dist/src/cli/provisioning.d.ts +3 -0
  27. package/dist/src/cli/provisioning.js +30 -0
  28. package/dist/src/cli/pull.d.ts +31 -0
  29. package/dist/src/cli/pull.js +142 -0
  30. package/dist/src/cli/restore.d.ts +12 -0
  31. package/dist/src/cli/restore.js +90 -0
  32. package/dist/src/cli/setup.d.ts +17 -0
  33. package/dist/src/cli/setup.js +209 -0
  34. package/dist/src/cli/status.d.ts +1 -0
  35. package/dist/src/cli/status.js +31 -0
  36. package/dist/src/cli/sync.d.ts +4 -0
  37. package/dist/src/cli/sync.js +124 -0
  38. package/dist/src/cli/unlock.d.ts +19 -0
  39. package/dist/src/cli/unlock.js +153 -0
  40. package/dist/src/config.d.ts +4 -0
  41. package/dist/src/config.js +12 -0
  42. package/dist/src/constants.d.ts +23 -0
  43. package/dist/src/constants.js +27 -0
  44. package/dist/src/contract-types.d.ts +301 -0
  45. package/dist/src/contract-types.js +52 -0
  46. package/dist/src/crypto/aes-gcm.d.ts +29 -0
  47. package/dist/src/crypto/aes-gcm.js +44 -0
  48. package/dist/src/crypto/device-keys.d.ts +18 -0
  49. package/dist/src/crypto/device-keys.js +25 -0
  50. package/dist/src/crypto/grant.d.ts +29 -0
  51. package/dist/src/crypto/grant.js +87 -0
  52. package/dist/src/crypto/kdf.d.ts +16 -0
  53. package/dist/src/crypto/kdf.js +24 -0
  54. package/dist/src/crypto/keys.d.ts +14 -0
  55. package/dist/src/crypto/keys.js +35 -0
  56. package/dist/src/crypto/manifest.d.ts +25 -0
  57. package/dist/src/crypto/manifest.js +41 -0
  58. package/dist/src/crypto/recovery.d.ts +16 -0
  59. package/dist/src/crypto/recovery.js +94 -0
  60. package/dist/src/crypto/types.d.ts +34 -0
  61. package/dist/src/crypto/types.js +1 -0
  62. package/dist/src/debug-logger.d.ts +32 -0
  63. package/dist/src/debug-logger.js +108 -0
  64. package/dist/src/hooks/gateway-lifecycle.d.ts +6 -0
  65. package/dist/src/hooks/gateway-lifecycle.js +40 -0
  66. package/dist/src/hooks/prompt-inject.d.ts +7 -0
  67. package/dist/src/hooks/prompt-inject.js +18 -0
  68. package/dist/src/store/keychain.d.ts +26 -0
  69. package/dist/src/store/keychain.js +151 -0
  70. package/dist/src/store/local-state.d.ts +27 -0
  71. package/dist/src/store/local-state.js +47 -0
  72. package/dist/src/store/managed-unlock.d.ts +8 -0
  73. package/dist/src/store/managed-unlock.js +46 -0
  74. package/dist/src/store/pending-setup.d.ts +23 -0
  75. package/dist/src/store/pending-setup.js +32 -0
  76. package/dist/src/store/session.d.ts +13 -0
  77. package/dist/src/store/session.js +28 -0
  78. package/dist/src/sync/auto-sync.d.ts +12 -0
  79. package/dist/src/sync/auto-sync.js +82 -0
  80. package/dist/src/sync/conflict.d.ts +24 -0
  81. package/dist/src/sync/conflict.js +92 -0
  82. package/dist/src/sync/diff.d.ts +25 -0
  83. package/dist/src/sync/diff.js +75 -0
  84. package/dist/src/sync/downloader.d.ts +16 -0
  85. package/dist/src/sync/downloader.js +73 -0
  86. package/dist/src/sync/scanner.d.ts +12 -0
  87. package/dist/src/sync/scanner.js +52 -0
  88. package/dist/src/sync/state.d.ts +4 -0
  89. package/dist/src/sync/state.js +22 -0
  90. package/dist/src/sync/uploader.d.ts +20 -0
  91. package/dist/src/sync/uploader.js +86 -0
  92. package/dist/src/tools/grants-approve-pending.d.ts +17 -0
  93. package/dist/src/tools/grants-approve-pending.js +50 -0
  94. package/dist/src/tools/pull.d.ts +31 -0
  95. package/dist/src/tools/pull.js +71 -0
  96. package/dist/src/tools/restore.d.ts +31 -0
  97. package/dist/src/tools/restore.js +96 -0
  98. package/dist/src/tools/result.d.ts +7 -0
  99. package/dist/src/tools/result.js +6 -0
  100. package/dist/src/tools/secret-file.d.ts +10 -0
  101. package/dist/src/tools/secret-file.js +37 -0
  102. package/dist/src/tools/setup-finish.d.ts +36 -0
  103. package/dist/src/tools/setup-finish.js +108 -0
  104. package/dist/src/tools/setup-poll.d.ts +27 -0
  105. package/dist/src/tools/setup-poll.js +83 -0
  106. package/dist/src/tools/setup-start.d.ts +18 -0
  107. package/dist/src/tools/setup-start.js +49 -0
  108. package/dist/src/tools/status.d.ts +17 -0
  109. package/dist/src/tools/status.js +40 -0
  110. package/dist/src/tools/sync.d.ts +17 -0
  111. package/dist/src/tools/sync.js +49 -0
  112. package/dist/src/tools/unlock-secret.d.ts +42 -0
  113. package/dist/src/tools/unlock-secret.js +87 -0
  114. package/dist/src/tools/unlock.d.ts +25 -0
  115. package/dist/src/tools/unlock.js +72 -0
  116. package/openclaw.plugin.json +16 -0
  117. package/package.json +35 -0
@@ -0,0 +1,72 @@
1
+ import { readState } from "../store/local-state.js";
2
+ import { vaultSession } from "../store/session.js";
3
+ import { unlockWithPassphrase } from "../cli/unlock.js";
4
+ import { readSecretFile } from "./secret-file.js";
5
+ import { jsonResult } from "./result.js";
6
+ export function createUnlockTool() {
7
+ return {
8
+ name: "membox_unlock",
9
+ label: "Membox Vault Unlock",
10
+ description: "Unlock Membox Vault using a local passphrase file. The passphrase stays on the machine and is never sent to the server.",
11
+ parameters: {
12
+ type: "object",
13
+ properties: {
14
+ passphrase_file: {
15
+ type: "string",
16
+ description: "Path to a local file containing the vault passphrase. On Unix, the file must not be readable by group or others.",
17
+ },
18
+ },
19
+ required: ["passphrase_file"],
20
+ additionalProperties: false,
21
+ },
22
+ async execute(_toolCallId, params) {
23
+ const state = await readState();
24
+ if (!state?.setup_complete) {
25
+ return jsonResult({
26
+ error: true,
27
+ message: "Vault not set up. Complete browser authorization and final setup first.",
28
+ });
29
+ }
30
+ if (vaultSession.isUnlocked()) {
31
+ return jsonResult({
32
+ ok: true,
33
+ already_unlocked: true,
34
+ message: "Vault is already unlocked.",
35
+ });
36
+ }
37
+ if (!params?.passphrase_file) {
38
+ return jsonResult({
39
+ error: true,
40
+ message: "Missing required parameter: `passphrase_file`.",
41
+ });
42
+ }
43
+ try {
44
+ const { value, resolvedPath } = await readSecretFile(params.passphrase_file, {
45
+ label: "Passphrase",
46
+ trimWhitespace: false,
47
+ });
48
+ const unlocked = await unlockWithPassphrase(value, {
49
+ announceDeriving: true,
50
+ });
51
+ if (!unlocked) {
52
+ return jsonResult({
53
+ error: true,
54
+ message: "Unlock failed. Check the passphrase file contents or recover the vault on this machine.",
55
+ });
56
+ }
57
+ return jsonResult({
58
+ ok: true,
59
+ unlocked: true,
60
+ passphrase_file: resolvedPath,
61
+ message: "Vault unlocked.",
62
+ });
63
+ }
64
+ catch (err) {
65
+ return jsonResult({
66
+ error: true,
67
+ message: `Unlock failed: ${err instanceof Error ? err.message : String(err)}`,
68
+ });
69
+ }
70
+ },
71
+ };
72
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "membox",
3
+ "name": "Membox Vault",
4
+ "description": "Zero-knowledge encrypted memory sync for OpenClaw",
5
+ "version": "0.1.0",
6
+ "configSchema": {
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "serverUrl": {
11
+ "type": "string",
12
+ "description": "Membox sync server URL (default: https://membox.cloud)"
13
+ }
14
+ }
15
+ }
16
+ }
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@membox-cloud/membox",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "files": [
8
+ "dist/",
9
+ "openclaw.plugin.json",
10
+ "README.md"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "@noble/hashes": "^1.7.1",
17
+ "@noble/ciphers": "^1.2.1",
18
+ "@noble/curves": "^1.8.1",
19
+ "hash-wasm": "^4.11.0",
20
+ "keytar": "^7.9.0"
21
+ },
22
+ "peerDependencies": {
23
+ "openclaw": ">=2026.3.7"
24
+ },
25
+ "peerDependenciesMeta": {
26
+ "openclaw": {
27
+ "optional": true
28
+ }
29
+ },
30
+ "openclaw": {
31
+ "extensions": [
32
+ "./dist/index.js"
33
+ ]
34
+ }
35
+ }