Spaces:
Sleeping
Sleeping
Download src/utils/apiKeyManager.ts from codebybrody/TwistedStreamingBrody: direct link, hf CLI and curl.
- Browser
- Download file 555 Bytes
-
https://huggingface.co/spaces/codebybrody/TwistedStreamingBrody/resolve/14dbda54eabb12dff76fe0e2db1af9daa98de271/src/utils/apiKeyManager.ts
- Command line
-
hf download hf://spaces/codebybrody/TwistedStreamingBrody@14dbda54eabb12dff76fe0e2db1af9daa98de271/src/utils/apiKeyManager.ts
-
curl -L -o apiKeyManager.ts https://huggingface.co/spaces/codebybrody/TwistedStreamingBrody/resolve/14dbda54eabb12dff76fe0e2db1af9daa98de271/src/utils/apiKeyManager.ts
555 Bytes
| const USER_API_KEY_STORAGE = 'userApiKey'; | |
| export function saveUserApiKey(apiKey: string): void { | |
| if (!apiKey || apiKey.trim() === '') { | |
| throw new Error('API key no puede estar vacía'); | |
| } | |
| localStorage.setItem(USER_API_KEY_STORAGE, apiKey.trim()); | |
| } | |
| export function getUserApiKey(): string | null { | |
| return localStorage.getItem(USER_API_KEY_STORAGE); | |
| } | |
| export function deleteUserApiKey(): void { | |
| localStorage.removeItem(USER_API_KEY_STORAGE); | |
| } | |
| export function hasUserApiKey(): boolean { | |
| return !!getUserApiKey(); | |
| } | |