UNPKG

@archon-inc/sdk

Version:

Integrate easily to our government platform using this SDK. More info on https://archon.inc/sdk

20 lines (17 loc) 738 B
import { JsonValue } from "type-fest"; import { Archon } from "../Archon.js"; /** * Get a secret from the Archon configurator secret store. This includes database passwords, API keys, and other sensitive information. * * Make sure the application calling this API has the appropriate permissions to access the secret. * @param key The key of the secret to retrieve. * @returns The secret value. */ export default async function getSecret(key: string): Promise<JsonValue> { const response = await Archon.request(`/config/secret/${key}`, "GET"); if (response.status !== 200) { throw new Error(`Failed to retrieve configuration value for key ${key}.`); } const data = response.data; return data.value; }