latchkey 2.5.0 → 2.5.1
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.
- package/dist/src/cli.js +0 -0
- package/package.json +2 -2
- package/dist/integrations/SKILL.md +0 -114
- package/dist/integrations/openclaw/SKILL.md +0 -106
- package/dist/package.json +0 -67
- package/dist/scripts/encryptFile.d.ts +0 -21
- package/dist/scripts/encryptFile.d.ts.map +0 -1
- package/dist/scripts/encryptFile.js +0 -101
- package/dist/scripts/encryptFile.js.map +0 -1
- package/dist/skills/generic/SKILL.md +0 -114
- package/dist/skills/openclaw/SKILL.md +0 -106
- package/dist/src/browserState.d.ts +0 -8
- package/dist/src/browserState.d.ts.map +0 -1
- package/dist/src/browserState.js +0 -21
- package/dist/src/browserState.js.map +0 -1
- package/dist/src/latestVersionCheck.d.ts +0 -10
- package/dist/src/latestVersionCheck.d.ts.map +0 -1
- package/dist/src/latestVersionCheck.js +0 -42
- package/dist/src/latestVersionCheck.js.map +0 -1
- package/dist/src/registeredService.d.ts +0 -20
- package/dist/src/registeredService.d.ts.map +0 -1
- package/dist/src/registeredService.js +0 -34
- package/dist/src/registeredService.js.map +0 -1
- package/dist/src/registeredServiceStore.d.ts +0 -24
- package/dist/src/registeredServiceStore.d.ts.map +0 -1
- package/dist/src/registeredServiceStore.js +0 -70
- package/dist/src/registeredServiceStore.js.map +0 -1
- package/dist/src/services/base.d.ts +0 -141
- package/dist/src/services/base.d.ts.map +0 -1
- package/dist/src/services/base.js +0 -189
- package/dist/src/services/base.js.map +0 -1
- package/dist/src/services/google/maps.d.ts +0 -39
- package/dist/src/services/google/maps.d.ts.map +0 -1
- package/dist/src/services/google/maps.js +0 -94
- package/dist/src/services/google/maps.js.map +0 -1
- package/dist/src/services/google.d.ts +0 -34
- package/dist/src/services/google.d.ts.map +0 -1
- package/dist/src/services/google.js +0 -336
- package/dist/src/services/google.js.map +0 -1
- package/dist/src/services/googleAnalytics.d.ts +0 -11
- package/dist/src/services/googleAnalytics.d.ts.map +0 -1
- package/dist/src/services/googleAnalytics.js +0 -18
- package/dist/src/services/googleAnalytics.js.map +0 -1
- package/dist/src/services/googleMaps.d.ts +0 -12
- package/dist/src/services/googleMaps.d.ts.map +0 -1
- package/dist/src/services/googleMaps.js +0 -17
- package/dist/src/services/googleMaps.js.map +0 -1
- package/dist/tests/latestVersionCheck.test.d.ts +0 -2
- package/dist/tests/latestVersionCheck.test.d.ts.map +0 -1
- package/dist/tests/latestVersionCheck.test.js +0 -80
- package/dist/tests/latestVersionCheck.test.js.map +0 -1
package/dist/src/cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "latchkey",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "A CLI tool that injects API credentials into curl requests to third-party services",
|
|
5
5
|
"author": "Imbue <hynek@imbue.com>",
|
|
6
6
|
"repository": {
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"vitest": "^4.0.18"
|
|
67
67
|
},
|
|
68
68
|
"pi": {
|
|
69
|
-
"skills": ["./skills/generic"]
|
|
69
|
+
"skills": ["./dist/skills/generic"]
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: latchkey
|
|
3
|
-
description: Interact with third-party or self-hosted services (Slack, Google Workspace, Dropbox, GitHub, Linear, Coolify...) using their HTTP APIs on the user's behalf.
|
|
4
|
-
compatibility: Requires node.js, curl and latchkey (npm install -g latchkey). A desktop/GUI environment is required for the browser functionality.
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Latchkey
|
|
8
|
-
|
|
9
|
-
## Instructions
|
|
10
|
-
|
|
11
|
-
Latchkey is a CLI tool that automatically injects credentials into curl commands. Credentials (mostly API tokens) can be either manually managed or, for some services, Latchkey can open a browser login pop-up window and extract API credentials from the session.
|
|
12
|
-
|
|
13
|
-
Use this skill when the user asks you to work on their behalf with services that have HTTP APIs, like AWS, GitLab, Google Drive, Discord or others.
|
|
14
|
-
|
|
15
|
-
Usage:
|
|
16
|
-
|
|
17
|
-
1. **Use `latchkey curl`** instead of regular `curl` for supported services.
|
|
18
|
-
2. **Pass through all regular curl arguments** - latchkey is a transparent wrapper.
|
|
19
|
-
3. **Check for `latchkey services list`** to get a list of supported services. Use `--viable` to only show the currently configured ones.
|
|
20
|
-
4. **Use `latchkey services info <service_name>`** to get information about a specific service (auth options, credentials status, API docs links, special requirements, etc.).
|
|
21
|
-
5. **If necessary, ask the user to configure credentials first.** Tell the user to run `latchkey auth set` on the machine where latchkey is installed (using the setCredentialsExample from the `services info` command).
|
|
22
|
-
6. **Alternatively, let the user log in with the browser.** If supported for the given service, run `latchkey auth browser <service_name>` to open a browser login pop-up window.
|
|
23
|
-
7. **Look for the newest documentation of the desired public API online.** If using the `browser` auth command, avoid bot-only endpoints.
|
|
24
|
-
8. **Do not initiate a new login if the credentials status is `valid` or `unknown`** - the user might just not have the necessary permissions for the action you're trying to do.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Examples
|
|
28
|
-
|
|
29
|
-
### Make an authenticated curl request
|
|
30
|
-
```bash
|
|
31
|
-
latchkey curl [curl arguments]
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Creating a Slack channel
|
|
35
|
-
```bash
|
|
36
|
-
latchkey curl -X POST 'https://slack.com/api/conversations.create' \
|
|
37
|
-
-H 'Content-Type: application/json' \
|
|
38
|
-
-d '{"name":"my-channel"}'
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
(Notice that `-H 'Authorization: Bearer` is not present in the invocation.)
|
|
42
|
-
|
|
43
|
-
### Getting Discord user info
|
|
44
|
-
```bash
|
|
45
|
-
latchkey curl 'https://discord.com/api/v10/users/@me'
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Detect expired credentials and force a new login to Discord
|
|
49
|
-
```bash
|
|
50
|
-
latchkey services info discord # Check the "credentialStatus" field - shows "invalid"
|
|
51
|
-
latchkey auth browser discord
|
|
52
|
-
latchkey curl 'https://discord.com/api/v10/users/@me'
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Only do this when you notice that your previous call ended up not being authenticated (HTTP 401 or 403).
|
|
56
|
-
|
|
57
|
-
### List usable services
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
latchkey services list --viable
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Lists services that either have stored credentials or can be authenticated via a browser.
|
|
64
|
-
|
|
65
|
-
### Get service-specific info
|
|
66
|
-
```bash
|
|
67
|
-
latchkey services info slack
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Returns auth options, credentials status, and developer notes
|
|
71
|
-
about the service. If `browser` is not present in the
|
|
72
|
-
`authOptions` field, the service requires the user to directly
|
|
73
|
-
set API credentials via `latchkey auth set` or `latchkey auth
|
|
74
|
-
set-nocurl` before making requests.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
## Storing credentials
|
|
78
|
-
|
|
79
|
-
Aside from the `latchkey auth browser` case, it is the user's responsibility to supply credentials.
|
|
80
|
-
The user would typically do something like this:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
latchkey auth set my-gitlab-instance -H "PRIVATE-TOKEN: <token>"
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
When credentials cannot be expressed as static curl arguments, the user would use the `set-nocurl` subcommand. For example:
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
latchkey auth set-nocurl aws <access-key-id> <secret-access-key>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
If a service doesn't appear with the `--viable` flag, it may
|
|
93
|
-
still be supported; the user just hasn't provided the
|
|
94
|
-
credentials yet. `latchkey service info <service_name>` can be
|
|
95
|
-
used to see how to provide credentials for a specific service.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
## Notes
|
|
99
|
-
|
|
100
|
-
- All curl arguments are passed through unchanged
|
|
101
|
-
- Return code, stdout and stderr are passed back from curl
|
|
102
|
-
- Credentials are always stored encrypted and are never transmitted anywhere beyond the endpoints specified by the actual curl calls.
|
|
103
|
-
|
|
104
|
-
## Currently supported services
|
|
105
|
-
|
|
106
|
-
Latchkey currently offers varying levels of support for the
|
|
107
|
-
following services: AWS, Calendly, Coolify, Discord, Dropbox, Figma, GitHub, GitLab,
|
|
108
|
-
Gmail, Google Analytics, Google Calendar, Google Docs, Google Drive, Google Sheets,
|
|
109
|
-
Linear, Mailchimp, Notion, Sentry, Slack, Stripe, Telegram, Umami, Yelp, Zoom, and more.
|
|
110
|
-
|
|
111
|
-
### User-registered services
|
|
112
|
-
|
|
113
|
-
Note for humans: users can also add limited support for new services
|
|
114
|
-
at runtime using the `latchkey services register` command.
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: latchkey
|
|
3
|
-
description: Interact with arbitrary third-party or self-hosted services (AWS, Slack, Google Drive, Dropbox, GitHub, GitLab, Linear, Coolify...) using their HTTP APIs.
|
|
4
|
-
compatibility: Requires node.js, curl and latchkey (npm install -g latchkey).
|
|
5
|
-
metadata: {"openclaw":{"emoji":"🔑","requires":{"bins":["latchkey"]},"install":[{"id":"node","kind":"node","package":"latchkey","bins":["latchkey"],"label":"Install Latchkey (npm)"}]}}
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Latchkey
|
|
9
|
-
|
|
10
|
-
## Instructions
|
|
11
|
-
|
|
12
|
-
Latchkey is a CLI tool that automatically injects credentials into curl commands. Credentials (mostly API tokens) need to be manually managed by the user.
|
|
13
|
-
|
|
14
|
-
Use this skill when the user asks you to work with services that have HTTP APIs, like AWS, Coolify, GitLab, Google Drive, Discord or others.
|
|
15
|
-
|
|
16
|
-
Usage:
|
|
17
|
-
|
|
18
|
-
1. **Use `latchkey curl`** instead of regular `curl` for supported services.
|
|
19
|
-
2. **Pass through all regular curl arguments** - latchkey is a transparent wrapper.
|
|
20
|
-
3. **Check for `latchkey services list`** to get a list of supported services. Use `--viable` to only show the currently configured ones.
|
|
21
|
-
4. **Use `latchkey services info <service_name>`** to get information about a specific service (auth options, credentials status, API docs links, special requirements, etc.).
|
|
22
|
-
5. **If necessary, ask the user to configure credentials first.** Tell the user to run `latchkey auth set` on the machine where latchkey is installed (using the setCredentialsExample from the `services info` command).
|
|
23
|
-
6. **Look for the newest documentation of the desired public API online.**
|
|
24
|
-
7. **Do not initiate a new login if the credentials status is `valid` or `unknown`** - the user might just not have the necessary permissions for the action you're trying to do.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Examples
|
|
28
|
-
|
|
29
|
-
### Make an authenticated curl request
|
|
30
|
-
```bash
|
|
31
|
-
latchkey curl [curl arguments]
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Creating a Slack channel
|
|
35
|
-
```bash
|
|
36
|
-
latchkey curl -X POST 'https://slack.com/api/conversations.create' \
|
|
37
|
-
-H 'Content-Type: application/json' \
|
|
38
|
-
-d '{"name":"my-channel"}'
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
(Notice that `-H 'Authorization: Bearer` is not present in the invocation.)
|
|
42
|
-
|
|
43
|
-
### Getting Discord user info
|
|
44
|
-
```bash
|
|
45
|
-
latchkey curl 'https://discord.com/api/v10/users/@me'
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Detect expired credentials
|
|
49
|
-
```bash
|
|
50
|
-
latchkey services info discord # Check the "credentialStatus" field - shows "invalid"
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### List usable services
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
latchkey services list --viable
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Lists services that have stored credentials.
|
|
60
|
-
|
|
61
|
-
### Get service-specific info
|
|
62
|
-
```bash
|
|
63
|
-
latchkey services info slack
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Returns auth options, credentials status, and developer notes
|
|
67
|
-
about the service.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
## Storing credentials
|
|
71
|
-
|
|
72
|
-
It is the user's responsibility to supply credentials. The user would typically do something like this:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
latchkey auth set my-gitlab-instance -H "PRIVATE-TOKEN: <token>"
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
When credentials cannot be expressed as static curl arguments, the user would use the `set-nocurl` subcommand. For example:
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
latchkey auth set-nocurl aws <access-key-id> <secret-access-key>
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
If a service doesn't appear with the `--viable` flag, it may
|
|
85
|
-
still be supported; the user just hasn't provided the
|
|
86
|
-
credentials yet. `latchkey service info <service_name>` can be
|
|
87
|
-
used to see how to provide credentials for a specific service.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
## Notes
|
|
91
|
-
|
|
92
|
-
- All curl arguments are passed through unchanged
|
|
93
|
-
- Return code, stdout and stderr are passed back from curl
|
|
94
|
-
- Credentials are always stored encrypted and are never transmitted anywhere beyond the endpoints specified by the actual curl calls.
|
|
95
|
-
|
|
96
|
-
## Currently supported services
|
|
97
|
-
|
|
98
|
-
Latchkey currently offers varying levels of support for the
|
|
99
|
-
following services: AWS, Calendly, Coolify, Discord, Dropbox, Figma, GitHub, GitLab,
|
|
100
|
-
Gmail, Google Analytics, Google Calendar, Google Docs, Google Drive, Google Sheets,
|
|
101
|
-
Linear, Mailchimp, Notion, Sentry, Slack, Stripe, Telegram, Umami, Yelp, Zoom, and more.
|
|
102
|
-
|
|
103
|
-
### User-registered services
|
|
104
|
-
|
|
105
|
-
Note for humans: users can also add limited support for new services
|
|
106
|
-
at runtime using the `latchkey services register` command.
|
package/dist/package.json
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "latchkey",
|
|
3
|
-
"version": "2.3.0",
|
|
4
|
-
"description": "A CLI tool that injects API credentials into curl requests to third-party services",
|
|
5
|
-
"author": "Imbue <hynek@imbue.com>",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/imbue-ai/latchkey.git"
|
|
9
|
-
},
|
|
10
|
-
"homepage": "https://github.com/imbue-ai/latchkey#readme",
|
|
11
|
-
"bugs": {
|
|
12
|
-
"url": "https://github.com/imbue-ai/latchkey/issues"
|
|
13
|
-
},
|
|
14
|
-
"type": "module",
|
|
15
|
-
"main": "dist/src/index.js",
|
|
16
|
-
"types": "dist/src/index.d.ts",
|
|
17
|
-
"bin": {
|
|
18
|
-
"latchkey": "./dist/src/cli.js"
|
|
19
|
-
},
|
|
20
|
-
"files": [
|
|
21
|
-
"dist",
|
|
22
|
-
"README.md",
|
|
23
|
-
"LICENSE"
|
|
24
|
-
],
|
|
25
|
-
"scripts": {
|
|
26
|
-
"prepublishOnly": "npm run build",
|
|
27
|
-
"build": "tsc && node -e \"require('fs').cpSync('integrations', 'dist/integrations', {recursive:true})\" ",
|
|
28
|
-
"dev": "tsc --watch",
|
|
29
|
-
"lint": "eslint src tests scripts",
|
|
30
|
-
"lint:fix": "eslint src tests scripts --fix",
|
|
31
|
-
"format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\" \"scripts/**/*.ts\"",
|
|
32
|
-
"format:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\" \"scripts/**/*.ts\"",
|
|
33
|
-
"typecheck": "tsc --noEmit",
|
|
34
|
-
"test": "vitest run",
|
|
35
|
-
"test:watch": "vitest",
|
|
36
|
-
"start": "node dist/cli.js",
|
|
37
|
-
"bun-compile": "bun build ./src/cli.ts --compile --external chromium-bidi --external electron --outfile latchkey"
|
|
38
|
-
},
|
|
39
|
-
"keywords": [
|
|
40
|
-
"cli",
|
|
41
|
-
"curl",
|
|
42
|
-
"api",
|
|
43
|
-
"credentials",
|
|
44
|
-
"authentication",
|
|
45
|
-
"agents",
|
|
46
|
-
"imbue"
|
|
47
|
-
],
|
|
48
|
-
"license": "MIT",
|
|
49
|
-
"engines": {
|
|
50
|
-
"node": ">=20"
|
|
51
|
-
},
|
|
52
|
-
"dependencies": {
|
|
53
|
-
"@napi-rs/keyring": "^1.2.0",
|
|
54
|
-
"commander": "^12.0.0",
|
|
55
|
-
"playwright": "^1.58.2",
|
|
56
|
-
"zod": "^3.22.0"
|
|
57
|
-
},
|
|
58
|
-
"devDependencies": {
|
|
59
|
-
"@eslint/js": "^9.39.2",
|
|
60
|
-
"@types/node": "^20.0.0",
|
|
61
|
-
"eslint": "^9.39.2",
|
|
62
|
-
"prettier": "^3.8.1",
|
|
63
|
-
"typescript": "^5.3.0",
|
|
64
|
-
"typescript-eslint": "^8.53.1",
|
|
65
|
-
"vitest": "^4.0.18"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env npx tsx
|
|
2
|
-
/**
|
|
3
|
-
* CLI tool for encrypting and decrypting latchkey files.
|
|
4
|
-
*
|
|
5
|
-
* This is a developer utility for inspecting and modifying encrypted
|
|
6
|
-
* credential and browser state files.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* npx tsx scripts/encryptFile.ts decrypt <file> # Decrypt file to stdout
|
|
10
|
-
* npx tsx scripts/encryptFile.ts encrypt <file> # Encrypt file in place
|
|
11
|
-
*
|
|
12
|
-
* The encryption key is sourced from:
|
|
13
|
-
* 1. LATCHKEY_ENCRYPTION_KEY environment variable
|
|
14
|
-
* 2. System keychain
|
|
15
|
-
*
|
|
16
|
-
* Examples:
|
|
17
|
-
* npx tsx scripts/encryptFile.ts decrypt ~/.latchkey/credentials.json
|
|
18
|
-
* npx tsx scripts/encryptFile.ts encrypt ~/.latchkey/credentials.json
|
|
19
|
-
*/
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=encryptFile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encryptFile.d.ts","sourceRoot":"","sources":["../../scripts/encryptFile.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env npx tsx
|
|
2
|
-
/**
|
|
3
|
-
* CLI tool for encrypting and decrypting latchkey files.
|
|
4
|
-
*
|
|
5
|
-
* This is a developer utility for inspecting and modifying encrypted
|
|
6
|
-
* credential and browser state files.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* npx tsx scripts/encryptFile.ts decrypt <file> # Decrypt file to stdout
|
|
10
|
-
* npx tsx scripts/encryptFile.ts encrypt <file> # Encrypt file in place
|
|
11
|
-
*
|
|
12
|
-
* The encryption key is sourced from:
|
|
13
|
-
* 1. LATCHKEY_ENCRYPTION_KEY environment variable
|
|
14
|
-
* 2. System keychain
|
|
15
|
-
*
|
|
16
|
-
* Examples:
|
|
17
|
-
* npx tsx scripts/encryptFile.ts decrypt ~/.latchkey/credentials.json
|
|
18
|
-
* npx tsx scripts/encryptFile.ts encrypt ~/.latchkey/credentials.json
|
|
19
|
-
*/
|
|
20
|
-
import { program } from 'commander';
|
|
21
|
-
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
22
|
-
import { CONFIG } from '../src/config.js';
|
|
23
|
-
import { EncryptedStorage } from '../src/encryptedStorage.js';
|
|
24
|
-
import { encrypt, generateKey } from '../src/encryption.js';
|
|
25
|
-
import { isKeychainAvailable, retrieveFromKeychain } from '../src/keychain.js';
|
|
26
|
-
const ENCRYPTED_FILE_PREFIX = 'LATCHKEY_ENCRYPTED:';
|
|
27
|
-
function getEncryptionKey() {
|
|
28
|
-
// 1. Check environment variable via Config
|
|
29
|
-
if (CONFIG.encryptionKeyOverride) {
|
|
30
|
-
return CONFIG.encryptionKeyOverride;
|
|
31
|
-
}
|
|
32
|
-
// 2. Check keychain
|
|
33
|
-
if (isKeychainAvailable(CONFIG.serviceName, CONFIG.accountName)) {
|
|
34
|
-
const keychainKey = retrieveFromKeychain(CONFIG.serviceName, CONFIG.accountName);
|
|
35
|
-
if (keychainKey) {
|
|
36
|
-
return keychainKey;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
console.error(`\
|
|
40
|
-
Error: No encryption key available.
|
|
41
|
-
Set LATCHKEY_ENCRYPTION_KEY or ensure the system keychain has a stored key.
|
|
42
|
-
|
|
43
|
-
To generate a new key:
|
|
44
|
-
export LATCHKEY_ENCRYPTION_KEY="${generateKey()}"`);
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
function decryptCommand(filePath) {
|
|
48
|
-
if (!existsSync(filePath)) {
|
|
49
|
-
console.error(`Error: File not found: ${filePath}`);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
const storage = new EncryptedStorage({
|
|
53
|
-
serviceName: CONFIG.serviceName,
|
|
54
|
-
accountName: CONFIG.accountName,
|
|
55
|
-
});
|
|
56
|
-
const content = storage.readFile(filePath);
|
|
57
|
-
if (content === null) {
|
|
58
|
-
console.error(`Error: Could not read file: ${filePath}`);
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
61
|
-
// Output to stdout
|
|
62
|
-
process.stdout.write(content);
|
|
63
|
-
}
|
|
64
|
-
function encryptCommand(filePath) {
|
|
65
|
-
if (!existsSync(filePath)) {
|
|
66
|
-
console.error(`Error: File not found: ${filePath}`);
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
const content = readFileSync(filePath, 'utf-8');
|
|
70
|
-
if (content.startsWith(ENCRYPTED_FILE_PREFIX)) {
|
|
71
|
-
console.error(`Error: File is already encrypted: ${filePath}`);
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
const key = getEncryptionKey();
|
|
75
|
-
const encryptedData = encrypt(content, key);
|
|
76
|
-
const dataToWrite = ENCRYPTED_FILE_PREFIX + encryptedData;
|
|
77
|
-
writeFileSync(filePath, dataToWrite, { encoding: 'utf-8', mode: 0o600 });
|
|
78
|
-
console.error(`Encrypted: ${filePath}`);
|
|
79
|
-
}
|
|
80
|
-
program.name('encryptFile').description(`\
|
|
81
|
-
CLI tool for encrypting and decrypting latchkey files.
|
|
82
|
-
|
|
83
|
-
The encryption key is sourced from:
|
|
84
|
-
1. LATCHKEY_ENCRYPTION_KEY environment variable
|
|
85
|
-
2. System keychain`);
|
|
86
|
-
program
|
|
87
|
-
.command('decrypt')
|
|
88
|
-
.description('Decrypt file and print to stdout')
|
|
89
|
-
.argument('<file>', 'Path to the encrypted file')
|
|
90
|
-
.action((filePath) => {
|
|
91
|
-
decryptCommand(filePath);
|
|
92
|
-
});
|
|
93
|
-
program
|
|
94
|
-
.command('encrypt')
|
|
95
|
-
.description('Encrypt an unencrypted file in place')
|
|
96
|
-
.argument('<file>', 'Path to the file to encrypt')
|
|
97
|
-
.action((filePath) => {
|
|
98
|
-
encryptCommand(filePath);
|
|
99
|
-
});
|
|
100
|
-
program.parse();
|
|
101
|
-
//# sourceMappingURL=encryptFile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encryptFile.js","sourceRoot":"","sources":["../../scripts/encryptFile.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAEpD,SAAS,gBAAgB;IAC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EAAE;IAC3B,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: latchkey
|
|
3
|
-
description: Interact with third-party or self-hosted services (Slack, Google Workspace, Dropbox, GitHub, Linear, Coolify...) using their HTTP APIs on the user's behalf.
|
|
4
|
-
compatibility: Requires node.js, curl and latchkey (npm install -g latchkey). A desktop/GUI environment is required for the browser functionality.
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Latchkey
|
|
8
|
-
|
|
9
|
-
## Instructions
|
|
10
|
-
|
|
11
|
-
Latchkey is a CLI tool that automatically injects credentials into curl commands. Credentials (mostly API tokens) can be either manually managed or, for some services, Latchkey can open a browser login pop-up window and extract API credentials from the session.
|
|
12
|
-
|
|
13
|
-
Use this skill when the user asks you to work on their behalf with services that have HTTP APIs, like AWS, GitLab, Google Drive, Discord or others.
|
|
14
|
-
|
|
15
|
-
Usage:
|
|
16
|
-
|
|
17
|
-
1. **Use `latchkey curl`** instead of regular `curl` for supported services.
|
|
18
|
-
2. **Pass through all regular curl arguments** - latchkey is a transparent wrapper.
|
|
19
|
-
3. **Check for `latchkey services list`** to get a list of supported services. Use `--viable` to only show the currently configured ones.
|
|
20
|
-
4. **Use `latchkey services info <service_name>`** to get information about a specific service (auth options, credentials status, API docs links, special requirements, etc.).
|
|
21
|
-
5. **If necessary, ask the user to configure credentials first.** Tell the user to run `latchkey auth set` on the machine where latchkey is installed (using the setCredentialsExample from the `services info` command).
|
|
22
|
-
6. **Alternatively, let the user log in with the browser.** If supported for the given service, run `latchkey auth browser <service_name>` to open a browser login pop-up window.
|
|
23
|
-
7. **Look for the newest documentation of the desired public API online.** If using the `browser` auth command, avoid bot-only endpoints.
|
|
24
|
-
8. **Do not initiate a new login if the credentials status is `valid` or `unknown`** - the user might just not have the necessary permissions for the action you're trying to do.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Examples
|
|
28
|
-
|
|
29
|
-
### Make an authenticated curl request
|
|
30
|
-
```bash
|
|
31
|
-
latchkey curl [curl arguments]
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Creating a Slack channel
|
|
35
|
-
```bash
|
|
36
|
-
latchkey curl -X POST 'https://slack.com/api/conversations.create' \
|
|
37
|
-
-H 'Content-Type: application/json' \
|
|
38
|
-
-d '{"name":"my-channel"}'
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
(Notice that `-H 'Authorization: Bearer` is not present in the invocation.)
|
|
42
|
-
|
|
43
|
-
### Getting Discord user info
|
|
44
|
-
```bash
|
|
45
|
-
latchkey curl 'https://discord.com/api/v10/users/@me'
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Detect expired credentials and force a new login to Discord
|
|
49
|
-
```bash
|
|
50
|
-
latchkey services info discord # Check the "credentialStatus" field - shows "invalid"
|
|
51
|
-
latchkey auth browser discord
|
|
52
|
-
latchkey curl 'https://discord.com/api/v10/users/@me'
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Only do this when you notice that your previous call ended up not being authenticated (HTTP 401 or 403).
|
|
56
|
-
|
|
57
|
-
### List usable services
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
latchkey services list --viable
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Lists services that either have stored credentials or can be authenticated via a browser.
|
|
64
|
-
|
|
65
|
-
### Get service-specific info
|
|
66
|
-
```bash
|
|
67
|
-
latchkey services info slack
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Returns auth options, credentials status, and developer notes
|
|
71
|
-
about the service. If `browser` is not present in the
|
|
72
|
-
`authOptions` field, the service requires the user to directly
|
|
73
|
-
set API credentials via `latchkey auth set` or `latchkey auth
|
|
74
|
-
set-nocurl` before making requests.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
## Storing credentials
|
|
78
|
-
|
|
79
|
-
Aside from the `latchkey auth browser` case, it is the user's responsibility to supply credentials.
|
|
80
|
-
The user would typically do something like this:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
latchkey auth set my-gitlab-instance -H "PRIVATE-TOKEN: <token>"
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
When credentials cannot be expressed as static curl arguments, the user would use the `set-nocurl` subcommand. For example:
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
latchkey auth set-nocurl aws <access-key-id> <secret-access-key>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
If a service doesn't appear with the `--viable` flag, it may
|
|
93
|
-
still be supported; the user just hasn't provided the
|
|
94
|
-
credentials yet. `latchkey service info <service_name>` can be
|
|
95
|
-
used to see how to provide credentials for a specific service.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
## Notes
|
|
99
|
-
|
|
100
|
-
- All curl arguments are passed through unchanged
|
|
101
|
-
- Return code, stdout and stderr are passed back from curl
|
|
102
|
-
- Credentials are always stored encrypted and are never transmitted anywhere beyond the endpoints specified by the actual curl calls.
|
|
103
|
-
|
|
104
|
-
## Currently supported services
|
|
105
|
-
|
|
106
|
-
Latchkey currently offers varying levels of support for the
|
|
107
|
-
following services: AWS, Calendly, Coolify, Discord, Dropbox, Figma, GitHub, GitLab,
|
|
108
|
-
Gmail, Google Analytics, Google Calendar, Google Docs, Google Drive, Google Sheets,
|
|
109
|
-
Linear, Mailchimp, Notion, Sentry, Slack, Stripe, Telegram, Umami, Yelp, Zoom, and more.
|
|
110
|
-
|
|
111
|
-
### User-registered services
|
|
112
|
-
|
|
113
|
-
Note for humans: users can also add limited support for new services
|
|
114
|
-
at runtime using the `latchkey services register` command.
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: latchkey
|
|
3
|
-
description: Interact with arbitrary third-party or self-hosted services (AWS, Slack, Google Drive, Dropbox, GitHub, GitLab, Linear, Coolify...) using their HTTP APIs.
|
|
4
|
-
compatibility: Requires node.js, curl and latchkey (npm install -g latchkey).
|
|
5
|
-
metadata: {"openclaw":{"emoji":"🔑","requires":{"bins":["latchkey"]},"install":[{"id":"node","kind":"node","package":"latchkey","bins":["latchkey"],"label":"Install Latchkey (npm)"}]}}
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Latchkey
|
|
9
|
-
|
|
10
|
-
## Instructions
|
|
11
|
-
|
|
12
|
-
Latchkey is a CLI tool that automatically injects credentials into curl commands. Credentials (mostly API tokens) need to be manually managed by the user.
|
|
13
|
-
|
|
14
|
-
Use this skill when the user asks you to work with services that have HTTP APIs, like AWS, Coolify, GitLab, Google Drive, Discord or others.
|
|
15
|
-
|
|
16
|
-
Usage:
|
|
17
|
-
|
|
18
|
-
1. **Use `latchkey curl`** instead of regular `curl` for supported services.
|
|
19
|
-
2. **Pass through all regular curl arguments** - latchkey is a transparent wrapper.
|
|
20
|
-
3. **Check for `latchkey services list`** to get a list of supported services. Use `--viable` to only show the currently configured ones.
|
|
21
|
-
4. **Use `latchkey services info <service_name>`** to get information about a specific service (auth options, credentials status, API docs links, special requirements, etc.).
|
|
22
|
-
5. **If necessary, ask the user to configure credentials first.** Tell the user to run `latchkey auth set` on the machine where latchkey is installed (using the setCredentialsExample from the `services info` command).
|
|
23
|
-
6. **Look for the newest documentation of the desired public API online.**
|
|
24
|
-
7. **Do not initiate a new login if the credentials status is `valid` or `unknown`** - the user might just not have the necessary permissions for the action you're trying to do.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Examples
|
|
28
|
-
|
|
29
|
-
### Make an authenticated curl request
|
|
30
|
-
```bash
|
|
31
|
-
latchkey curl [curl arguments]
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Creating a Slack channel
|
|
35
|
-
```bash
|
|
36
|
-
latchkey curl -X POST 'https://slack.com/api/conversations.create' \
|
|
37
|
-
-H 'Content-Type: application/json' \
|
|
38
|
-
-d '{"name":"my-channel"}'
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
(Notice that `-H 'Authorization: Bearer` is not present in the invocation.)
|
|
42
|
-
|
|
43
|
-
### Getting Discord user info
|
|
44
|
-
```bash
|
|
45
|
-
latchkey curl 'https://discord.com/api/v10/users/@me'
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Detect expired credentials
|
|
49
|
-
```bash
|
|
50
|
-
latchkey services info discord # Check the "credentialStatus" field - shows "invalid"
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### List usable services
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
latchkey services list --viable
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Lists services that have stored credentials.
|
|
60
|
-
|
|
61
|
-
### Get service-specific info
|
|
62
|
-
```bash
|
|
63
|
-
latchkey services info slack
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Returns auth options, credentials status, and developer notes
|
|
67
|
-
about the service.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
## Storing credentials
|
|
71
|
-
|
|
72
|
-
It is the user's responsibility to supply credentials. The user would typically do something like this:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
latchkey auth set my-gitlab-instance -H "PRIVATE-TOKEN: <token>"
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
When credentials cannot be expressed as static curl arguments, the user would use the `set-nocurl` subcommand. For example:
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
latchkey auth set-nocurl aws <access-key-id> <secret-access-key>
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
If a service doesn't appear with the `--viable` flag, it may
|
|
85
|
-
still be supported; the user just hasn't provided the
|
|
86
|
-
credentials yet. `latchkey service info <service_name>` can be
|
|
87
|
-
used to see how to provide credentials for a specific service.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
## Notes
|
|
91
|
-
|
|
92
|
-
- All curl arguments are passed through unchanged
|
|
93
|
-
- Return code, stdout and stderr are passed back from curl
|
|
94
|
-
- Credentials are always stored encrypted and are never transmitted anywhere beyond the endpoints specified by the actual curl calls.
|
|
95
|
-
|
|
96
|
-
## Currently supported services
|
|
97
|
-
|
|
98
|
-
Latchkey currently offers varying levels of support for the
|
|
99
|
-
following services: AWS, Calendly, Coolify, Discord, Dropbox, Figma, GitHub, GitLab,
|
|
100
|
-
Gmail, Google Analytics, Google Calendar, Google Docs, Google Drive, Google Sheets,
|
|
101
|
-
Linear, Mailchimp, Notion, Sentry, Slack, Stripe, Telegram, Umami, Yelp, Zoom, and more.
|
|
102
|
-
|
|
103
|
-
### User-registered services
|
|
104
|
-
|
|
105
|
-
Note for humans: users can also add limited support for new services
|
|
106
|
-
at runtime using the `latchkey services register` command.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browserState.d.ts","sourceRoot":"","sources":["../../src/browserState.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAUnD"}
|