@archon-inc/sdk
Version:
Integrate easily to our government platform using this SDK. More info on https://archon.inc/sdk
17 lines (16 loc) • 668 B
JavaScript
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) {
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;
}