summaryrefslogtreecommitdiffhomepage
path: root/packages/console/core/script
diff options
context:
space:
mode:
authorFrank <[email protected]>2026-03-17 22:50:52 -0400
committerFrank <[email protected]>2026-03-17 22:50:54 -0400
commitfe43bdb699ab065482abd162576f5e6a42199311 (patch)
treeef9c0a5bba0a8de11b24bfc108957f5f1fdb7070 /packages/console/core/script
parenta849a17e9329f0b4b0dbb85abf1366b51f935f8c (diff)
downloadopencode-fe43bdb699ab065482abd162576f5e6a42199311.tar.gz
opencode-fe43bdb699ab065482abd162576f5e6a42199311.zip
wip: zen
Diffstat (limited to 'packages/console/core/script')
-rw-r--r--packages/console/core/script/lookup-user.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/packages/console/core/script/lookup-user.ts b/packages/console/core/script/lookup-user.ts
index 8b7bbc1ca..360fc6272 100644
--- a/packages/console/core/script/lookup-user.ts
+++ b/packages/console/core/script/lookup-user.ts
@@ -19,7 +19,7 @@ if (!identifier) {
if (identifier.startsWith("wrk_")) {
await printWorkspace(identifier)
}
-// lookup by API key
+// lookup by API key ID
else if (identifier.startsWith("key_")) {
const key = await Database.use((tx) =>
tx
@@ -34,6 +34,21 @@ else if (identifier.startsWith("key_")) {
}
await printWorkspace(key.workspaceID)
}
+// lookup by API key value
+else if (identifier.startsWith("sk-")) {
+ const key = await Database.use((tx) =>
+ tx
+ .select()
+ .from(KeyTable)
+ .where(eq(KeyTable.key, identifier))
+ .then((rows) => rows[0]),
+ )
+ if (!key) {
+ console.error("API key not found")
+ process.exit(1)
+ }
+ await printWorkspace(key.workspaceID)
+}
// lookup by email
else {
const authData = await Database.use(async (tx) =>