This commit is contained in:
Frank
2026-03-17 22:50:52 -04:00
parent a849a17e93
commit fe43bdb699
2 changed files with 19 additions and 3 deletions

View File

@@ -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) =>