(apiKey: string)
| 32 | } |
| 33 | |
| 34 | export function getApiKeyType(apiKey: string): ApiKeyType | undefined { |
| 35 | if (apiKey.startsWith("tr_dev_")) { |
| 36 | return { |
| 37 | environment: "dev", |
| 38 | type: "server", |
| 39 | }; |
| 40 | } |
| 41 | |
| 42 | if (apiKey.startsWith("pk_dev_")) { |
| 43 | return { |
| 44 | environment: "dev", |
| 45 | type: "public", |
| 46 | }; |
| 47 | } |
| 48 | |
| 49 | // If they enter a prod key (tr_prod_), let them know |
| 50 | if (apiKey.startsWith("tr_prod_")) { |
| 51 | return { |
| 52 | environment: "prod", |
| 53 | type: "server", |
| 54 | }; |
| 55 | } |
| 56 | |
| 57 | if (apiKey.startsWith("pk_prod_")) { |
| 58 | return { |
| 59 | environment: "prod", |
| 60 | type: "public", |
| 61 | }; |
| 62 | } |
| 63 | |
| 64 | return; |
| 65 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…