mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-31 07:35:24 +00:00
feat: move opkssh and warpgate into plugins (C3)
This commit is contained in:
1 parent
925da4a661
commit
98d367d7e2
336 files changed
+22380
-4746
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import {
|
||||
adoptLegacyTable,
|
||||
defineTable,
|
||||
id,
|
||||
refHost,
|
||||
refUser,
|
||||
text,
|
||||
varchar,
|
||||
} from "@termix/plugin-sdk/db";
|
||||
|
||||
/**
|
||||
* One cached certificate per user and host. Adopted from core's
|
||||
* opkssh_tokens, so the column and index names are the legacy ones.
|
||||
*
|
||||
* sshCert and privateKey are sealed with ctx.secrets.seal. Rows written by
|
||||
* 2.8 were encrypted with the user's data key instead; they do not unseal and
|
||||
* are treated as expired, which costs one browser sign-in.
|
||||
*/
|
||||
export const tokens = adoptLegacyTable(
|
||||
"opkssh_tokens",
|
||||
defineTable(
|
||||
"tokens",
|
||||
{
|
||||
id: id(),
|
||||
userId: refUser(),
|
||||
hostId: refHost(),
|
||||
sshCert: text().notNull(),
|
||||
privateKey: text().notNull(),
|
||||
email: text(),
|
||||
sub: text(),
|
||||
issuer: text(),
|
||||
audience: text(),
|
||||
createdAt: text().notNull().defaultNow(),
|
||||
expiresAt: varchar().notNull(),
|
||||
lastUsed: text(),
|
||||
},
|
||||
{
|
||||
uniques: [
|
||||
{
|
||||
name: "idx_opkssh_tokens_user_host",
|
||||
columns: ["userId", "hostId"],
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
export const tables = [tokens];
|
||||
Reference in new issue
Block a user