Remove legacy direct enterprise source

This commit is contained in:
gitea committed 2026-09-22 14:06:13 +08:00
1 parent 01ef5b37cb
commit 2e941f0842
29 files changed
+117 -132

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
import { CorpConfig } from "../config/types.js";
import { SealSession } from "./types.js";
export async function getNativeSealSession(corp: CorpConfig): Promise<SealSession> {
if (corp.source.type !== "seal") {
throw new Error(`Unsupported Seal source: ${corp.source.type}`);
}
const sealUrl = corp.seal.url ?? corp.source.sealUrl;
const expiresAt = corp.source.expiresAt
? new Date(corp.source.expiresAt).getTime()
: Date.now() + corp.source.expiresIn * 1000;
return {
token: corp.source.token,
expiresAt,
enterprise: {
provider: corp.source.provider ?? "seal",
corpId: corp.source.corpId ?? corp.id,
staffId: corp.source.staffId,
sealUrl,
tenantId: corp.source.tenantId,
tenantSlug: corp.seal.tenantSlug ?? corp.source.tenantSlug,
tenantName: corp.source.tenantName,
raw: {
sourceType: corp.source.type
}
}
};
}