mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-11 20:52:43 +00:00
Merge branch 'main' into password-attempts
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
export { toDate } from "./helpers";
|
||||
export { createClientFor, toDate } from "./helpers";
|
||||
export { NewAuthorizationBearerInterceptor } from "./interceptors";
|
||||
|
||||
// TODO: Move this to `./protobuf.ts` and export it from there
|
||||
export { create, fromJson, toJson } from "@bufbuild/protobuf";
|
||||
export type { JsonObject } from "@bufbuild/protobuf";
|
||||
export type { GenService } from "@bufbuild/protobuf/codegenv1";
|
||||
export { TimestampSchema, timestampDate, timestampFromDate, timestampFromMs, timestampMs } from "@bufbuild/protobuf/wkt";
|
||||
export type { Duration, Timestamp } from "@bufbuild/protobuf/wkt";
|
||||
export type { Code, ConnectError } from "@connectrpc/connect";
|
||||
export type { Client, Code, ConnectError } from "@connectrpc/connect";
|
||||
|
||||
@@ -27,13 +27,23 @@ export function createClientTransport(token: string, opts: GrpcTransportOptions)
|
||||
});
|
||||
}
|
||||
|
||||
export async function newSystemToken() {
|
||||
export async function newSystemToken({
|
||||
audience,
|
||||
subject,
|
||||
key,
|
||||
expirationTime,
|
||||
}: {
|
||||
audience: string;
|
||||
subject: string;
|
||||
key: string;
|
||||
expirationTime?: number | string | Date;
|
||||
}) {
|
||||
return await new SignJWT({})
|
||||
.setProtectedHeader({ alg: "RS256" })
|
||||
.setIssuedAt()
|
||||
.setExpirationTime("1h")
|
||||
.setIssuer(process.env.ZITADEL_SYSTEM_API_USERID ?? "")
|
||||
.setSubject(process.env.ZITADEL_SYSTEM_API_USERID ?? "")
|
||||
.setAudience(process.env.ZITADEL_ISSUER ?? "")
|
||||
.sign(await importPKCS8(process.env.ZITADEL_SYSTEM_API_KEY ?? "", "RS256"));
|
||||
.setExpirationTime(expirationTime ?? "1h")
|
||||
.setIssuer(subject)
|
||||
.setSubject(subject)
|
||||
.setAudience(audience)
|
||||
.sign(await importPKCS8(key, "RS256"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user