Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/core-firebase/src/models/TeamApiKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
} from "@owlprotocol/crud-firebase";
import { TeamId } from "./Team.js";

export const teamApiKeyPrefix = "team_" as const;

export interface TeamApiKeyId {
readonly apiKey: string;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/core-firebase/src/scripts/createTeamApiKey.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { v4 as uuidv4 } from "uuid";
import { teamApiKeyResource } from "../admin/resources.js";
import { teamApiKeyPrefix } from "../models/TeamApiKey.js";

export async function createTeamApiKey() {
if (process.argv.length != 3) throw new Error("Usage: node createTeamApiKey.js <teamId>");
const teamId = process.argv[2];

const apiKey = uuidv4();
const apiKey = teamApiKeyPrefix + uuidv4();

const numTeamApiKeys = await teamApiKeyResource.getWhereCount({ teamId });

Expand Down
Loading