mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-06-15 03:50:37 -04:00
* feat(authentication): api key
Keeps selected UX pieces from b487b096.
Co-authored-by: Nguyen Quy Hy <nguyenquyhy@live.com.sg>
* refactor: pr feedbacks
* chore: bump @better-auth/api-key
* refactor: global limit of 50 api key instead of 10 per org
---------
Co-authored-by: Nguyen Quy Hy <nguyenquyhy@live.com.sg>
13 lines
375 B
TypeScript
13 lines
375 B
TypeScript
import { safeJsonParse } from "@zerobyte/core/utils";
|
|
import { z } from "zod";
|
|
|
|
const apiKeyMetadataSchema = z.object({
|
|
organizationId: z.string(),
|
|
});
|
|
|
|
export const parseApiKeyOrganizationId = (metadata: string | null | undefined) => {
|
|
const parsed = apiKeyMetadataSchema.safeParse(safeJsonParse(metadata));
|
|
|
|
return parsed.success ? parsed.data.organizationId : null;
|
|
};
|