@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
91 lines (85 loc) • 2.72 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
export type V2ApisListKeysRequestBody = {
/**
* The API namespace whose keys you want to list.
*
* @remarks
* Returns all keys in this API, subject to pagination and filters.
*/
apiId: string;
/**
* Maximum number of keys to return per request.
*
* @remarks
* Balance between response size and number of pagination calls needed.
*/
limit?: number | undefined;
/**
* Pagination cursor from previous response to fetch next page.
*
* @remarks
* Use when `hasMore: true` in previous response.
*/
cursor?: string | undefined;
/**
* Filter keys by external ID to find keys for a specific user or entity.
*
* @remarks
* Must exactly match the externalId set during key creation.
*/
externalId?: string | undefined;
/**
* When true, attempts to include the plaintext key value in the response. SECURITY WARNING:
*
* @remarks
* - This requires special permissions on the calling root key
* - Only works for keys created with 'recoverable: true'
* - Exposes sensitive key material in the response
* - Should only be used in secure administrative contexts
* - Never enable this in user-facing applications
*/
decrypt?: boolean | undefined;
/**
* EXPERIMENTAL: Skip the cache and fetch the keys directly from the database. This ensures you see the most recent state, including keys created moments ago. Use this when:
*
* @remarks
* - You've just created a key and need to display it immediately
* - You need absolute certainty about the current key state
* - You're debugging cache consistency issues
*
* This parameter comes with a performance cost and should be used sparingly.
*/
revalidateKeysCache?: boolean | undefined;
};
/** @internal */
export type V2ApisListKeysRequestBody$Outbound = {
apiId: string;
limit: number;
cursor?: string | undefined;
externalId?: string | undefined;
decrypt: boolean;
revalidateKeysCache: boolean;
};
/** @internal */
export const V2ApisListKeysRequestBody$outboundSchema: z.ZodType<
V2ApisListKeysRequestBody$Outbound,
z.ZodTypeDef,
V2ApisListKeysRequestBody
> = z.object({
apiId: z.string(),
limit: z.number().int().default(100),
cursor: z.string().optional(),
externalId: z.string().optional(),
decrypt: z.boolean().default(false),
revalidateKeysCache: z.boolean().default(false),
});
export function v2ApisListKeysRequestBodyToJSON(
v2ApisListKeysRequestBody: V2ApisListKeysRequestBody,
): string {
return JSON.stringify(
V2ApisListKeysRequestBody$outboundSchema.parse(v2ApisListKeysRequestBody),
);
}