API key reveal
Developer settings API keys card where a generated key decodes with a character scramble, masks once saved, and slides into the active list with revoke confirmation.
Installation
Installation is available on the Startup and Business plans. Your personal install command appears here once you have access.
Usage
Import it, pass your props, and make it part of your product.
import { ApiKeyReveal } from '@/components/component-kit/items/block-api-key-reveal';
export function Example() { return <ApiKeyReveal />;}Props
| Prop | Type | Default | Description |
|---|---|---|---|
keys | ApiKey[] | 2 demo keys | Initial keys. ApiKey = { id, name, last4, createdAt, lastUsed?, status: 'active' | 'revoked' }. |
prefix | string | "nb_live_" | Prefix shown before the generated secret and the masked key. |
onGenerate | (key: ApiKey, secret: string) => void | undefined | Called once a key is generated, with the full secret (without prefix). |
onRevoke | (key: ApiKey) => void | undefined | Called after the revoke dialog is confirmed. |
compact | boolean | false | Generate row plus one key row at index-card density. |
autoPlay | boolean | false | In compact mode, re-run the scramble decode on the demo key every 2.5s. |
contentClassName | string | undefined | Class for the portalled revoke dialog and tooltip. |