feat: add seal auth providers
This commit is contained in:
1 parent
25e4dd7714
commit
d575683c8b
8 files changed
+510
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import { CorpConfig } from "../config/types.js";
|
||||
import { SealSession } from "./types.js";
|
||||
|
||||
export async function getDirectSealSession(corp: CorpConfig): Promise<SealSession> {
|
||||
if (corp.source.type !== "direct") {
|
||||
throw new Error(`Unsupported Seal source: ${corp.source.type}`);
|
||||
}
|
||||
|
||||
const sealUrl = corp.seal.url ?? corp.source.sealUrl;
|
||||
|
||||
return {
|
||||
token: corp.source.token,
|
||||
expiresAt: Date.now() + corp.source.expiresIn * 1000,
|
||||
enterprise: {
|
||||
provider: "direct",
|
||||
corpId: corp.source.corpId ?? corp.id,
|
||||
staffId: corp.source.staffId,
|
||||
sealUrl,
|
||||
tenantSlug: corp.seal.tenantSlug,
|
||||
raw: {
|
||||
sourceType: "direct"
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user