ApiKey (api-key/index.ts)

activepieces · packages/core/shared/src/lib/ee/api-key/index.ts · typescript · MIT
auth, tag:knn-classified

Zod schemas for API key model and request/response types.

// Source: https://github.com/activepieces/activepieces | License: MIT | Copyright 2020-2024 Activepieces Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { ApId, BaseModelSchema, Nullable } from '@activepieces/core-utils'
import { z } from 'zod'

export const ApiKey = z.object({
    ...BaseModelSchema,
    platformId: ApId,
    displayName: z.string(),
    hashedValue: z.string(),
    truncatedValue: z.string(),
    lastUsedAt: Nullable(z.string()),
})

export type ApiKey = z.infer<typeof ApiKey>

export const ApiKeyResponseWithValue = ApiKey.omit({ hashedValue: true }).extend({
    value: z.string(),
})

export type ApiKeyResponseWithValue = z.infer<typeof ApiKeyResponseWithValue>


export const ApiKeyResponseWithoutValue = ApiKey.omit({ hashedValue: true })

e

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key